Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1414776 > unrolled thread

[PATCH 02/22] amba: tegra-ahb: Use of_device_match()

Started byThierry Reding <thierry.reding@gmail.com>
First post2016-06-06 10:50 +0200
Last post2016-06-06 21:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 02/22] amba: tegra-ahb: Use of_device_match() Thierry Reding <thierry.reding@gmail.com> - 2016-06-06 10:50 +0200
    Re: [PATCH 02/22] amba: tegra-ahb: Use of_device_match() Frank Rowand <frowand.list@gmail.com> - 2016-06-06 21:00 +0200

#1414776 — [PATCH 02/22] amba: tegra-ahb: Use of_device_match()

FromThierry Reding <thierry.reding@gmail.com>
Date2016-06-06 10:50 +0200
Subject[PATCH 02/22] amba: tegra-ahb: Use of_device_match()
Message-ID<rGYoq-2vy-19@gated-at.bofh.it>
From: Thierry Reding <treding@nvidia.com>

Use the common implementation rather than the open-coded variant.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/amba/tegra-ahb.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/amba/tegra-ahb.c b/drivers/amba/tegra-ahb.c
index b0b688c481e8..d87e76cf448c 100644
--- a/drivers/amba/tegra-ahb.c
+++ b/drivers/amba/tegra-ahb.c
@@ -26,6 +26,7 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 
 #include <soc/tegra/ahb.h>
 
@@ -143,14 +144,6 @@ static inline void gizmo_writel(struct tegra_ahb *ahb, u32 value, u32 offset)
 }
 
 #ifdef CONFIG_TEGRA_IOMMU_SMMU
-static int tegra_ahb_match_by_smmu(struct device *dev, void *data)
-{
-	struct tegra_ahb *ahb = dev_get_drvdata(dev);
-	struct device_node *dn = data;
-
-	return (ahb->dev->of_node == dn) ? 1 : 0;
-}
-
 int tegra_ahb_enable_smmu(struct device_node *dn)
 {
 	struct device *dev;
@@ -158,7 +151,7 @@ int tegra_ahb_enable_smmu(struct device_node *dn)
 	struct tegra_ahb *ahb;
 
 	dev = driver_find_device(&tegra_ahb_driver.driver, NULL, dn,
-				 tegra_ahb_match_by_smmu);
+				 of_device_match);
 	if (!dev)
 		return -EPROBE_DEFER;
 	ahb = dev_get_drvdata(dev);
-- 
2.8.3

[toc] | [next] | [standalone]


#1415376

FromFrank Rowand <frowand.list@gmail.com>
Date2016-06-06 21:00 +0200
Message-ID<rH7UK-da-29@gated-at.bofh.it>
In reply to#1414776
On 06/06/16 01:31, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> Use the common implementation rather than the open-coded variant.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>  drivers/amba/tegra-ahb.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/amba/tegra-ahb.c b/drivers/amba/tegra-ahb.c
> index b0b688c481e8..d87e76cf448c 100644
> --- a/drivers/amba/tegra-ahb.c
> +++ b/drivers/amba/tegra-ahb.c
> @@ -26,6 +26,7 @@
>  #include <linux/platform_device.h>
>  #include <linux/io.h>
>  #include <linux/of.h>
> +#include <linux/of_device.h>
>  
>  #include <soc/tegra/ahb.h>
>  
> @@ -143,14 +144,6 @@ static inline void gizmo_writel(struct tegra_ahb *ahb, u32 value, u32 offset)
>  }
>  
>  #ifdef CONFIG_TEGRA_IOMMU_SMMU
> -static int tegra_ahb_match_by_smmu(struct device *dev, void *data)
> -{
> -	struct tegra_ahb *ahb = dev_get_drvdata(dev);
> -	struct device_node *dn = data;
> -
> -	return (ahb->dev->of_node == dn) ? 1 : 0;
> -}
> -
>  int tegra_ahb_enable_smmu(struct device_node *dn)
>  {
>  	struct device *dev;
> @@ -158,7 +151,7 @@ int tegra_ahb_enable_smmu(struct device_node *dn)
>  	struct tegra_ahb *ahb;
>  
>  	dev = driver_find_device(&tegra_ahb_driver.driver, NULL, dn,

To use of_device_match, should that be something like:

        struct tegra_ahb *ahb = dev_get_drvdata(dev);
        dev = driver_find_device(&tegra_ahb_driver.driver, NULL, ahb->dev,


> -				 tegra_ahb_match_by_smmu);
> +				 of_device_match);
>  	if (!dev)
>  		return -EPROBE_DEFER;
>  	ahb = dev_get_drvdata(dev);
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web