linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu: convert DT component matching to component_match_add_release()
@ 2016-06-03  7:58 Russell King
  2016-06-03 13:13 ` Matthias Brugger
  0 siblings, 1 reply; 4+ messages in thread
From: Russell King @ 2016-06-03  7:58 UTC (permalink / raw)
  To: linux-arm-kernel

Convert DT component matching to use component_match_add_release().

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/iommu/mtk_iommu.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index c3043d8754e3..c036df1c49ca 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -557,6 +557,11 @@ static int compare_of(struct device *dev, void *data)
 	return dev->of_node == data;
 }
 
+static void release_of(struct device *dev, void *data)
+{
+	of_node_put(data);
+}
+
 static int mtk_iommu_bind(struct device *dev)
 {
 	struct mtk_iommu_data *data = dev_get_drvdata(dev);
@@ -630,17 +635,19 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 			continue;
 
 		plarbdev = of_find_device_by_node(larbnode);
-		of_node_put(larbnode);
 		if (!plarbdev) {
 			plarbdev = of_platform_device_create(
 						larbnode, NULL,
 						platform_bus_type.dev_root);
-			if (!plarbdev)
+			if (!plarbdev) {
+				of_node_put(larbnode);
 				return -EPROBE_DEFER;
+			}
 		}
 		data->smi_imu.larb_imu[i].dev = &plarbdev->dev;
 
-		component_match_add(dev, &match, compare_of, larbnode);
+		component_match_add_release(dev, &match, release_of,
+					    compare_of, larbnode);
 	}
 
 	platform_set_drvdata(pdev, data);
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] iommu: convert DT component matching to component_match_add_release()
  2016-06-03  7:58 [PATCH] iommu: convert DT component matching to component_match_add_release() Russell King
@ 2016-06-03 13:13 ` Matthias Brugger
  0 siblings, 0 replies; 4+ messages in thread
From: Matthias Brugger @ 2016-06-03 13:13 UTC (permalink / raw)
  To: linux-arm-kernel



On 03/06/16 09:58, Russell King wrote:
> Convert DT component matching to use component_match_add_release().
>
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> ---

Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>

>   drivers/iommu/mtk_iommu.c | 13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
> index c3043d8754e3..c036df1c49ca 100644
> --- a/drivers/iommu/mtk_iommu.c
> +++ b/drivers/iommu/mtk_iommu.c
> @@ -557,6 +557,11 @@ static int compare_of(struct device *dev, void *data)
>   	return dev->of_node == data;
>   }
>
> +static void release_of(struct device *dev, void *data)
> +{
> +	of_node_put(data);
> +}
> +
>   static int mtk_iommu_bind(struct device *dev)
>   {
>   	struct mtk_iommu_data *data = dev_get_drvdata(dev);
> @@ -630,17 +635,19 @@ static int mtk_iommu_probe(struct platform_device *pdev)
>   			continue;
>
>   		plarbdev = of_find_device_by_node(larbnode);
> -		of_node_put(larbnode);
>   		if (!plarbdev) {
>   			plarbdev = of_platform_device_create(
>   						larbnode, NULL,
>   						platform_bus_type.dev_root);
> -			if (!plarbdev)
> +			if (!plarbdev) {
> +				of_node_put(larbnode);
>   				return -EPROBE_DEFER;
> +			}
>   		}
>   		data->smi_imu.larb_imu[i].dev = &plarbdev->dev;
>
> -		component_match_add(dev, &match, compare_of, larbnode);
> +		component_match_add_release(dev, &match, release_of,
> +					    compare_of, larbnode);
>   	}
>
>   	platform_set_drvdata(pdev, data);
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] iommu: convert DT component matching to component_match_add_release()
@ 2016-10-19 10:30 Russell King
  2016-11-10 11:25 ` Joerg Roedel
  0 siblings, 1 reply; 4+ messages in thread
From: Russell King @ 2016-10-19 10:30 UTC (permalink / raw)
  To: linux-arm-kernel

Convert DT component matching to use component_match_add_release().

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/iommu/mtk_iommu.c    | 8 +++++---
 drivers/iommu/mtk_iommu.h    | 5 +++++
 drivers/iommu/mtk_iommu_v1.c | 8 +++++---
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index b12c12d74c33..41604796fca3 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -583,17 +583,19 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 			continue;
 
 		plarbdev = of_find_device_by_node(larbnode);
-		of_node_put(larbnode);
 		if (!plarbdev) {
 			plarbdev = of_platform_device_create(
 						larbnode, NULL,
 						platform_bus_type.dev_root);
-			if (!plarbdev)
+			if (!plarbdev) {
+				of_node_put(larbnode);
 				return -EPROBE_DEFER;
+			}
 		}
 		data->smi_imu.larb_imu[i].dev = &plarbdev->dev;
 
-		component_match_add(dev, &match, compare_of, larbnode);
+		component_match_add_release(dev, &match, release_of,
+					    compare_of, larbnode);
 	}
 
 	platform_set_drvdata(pdev, data);
diff --git a/drivers/iommu/mtk_iommu.h b/drivers/iommu/mtk_iommu.h
index 3dab13b4a211..44ca38095c6a 100644
--- a/drivers/iommu/mtk_iommu.h
+++ b/drivers/iommu/mtk_iommu.h
@@ -60,6 +60,11 @@ static inline int compare_of(struct device *dev, void *data)
 	return dev->of_node == data;
 }
 
+static inline void release_of(struct device *dev, void *data)
+{
+	of_node_put(data);
+}
+
 static inline int mtk_iommu_bind(struct device *dev)
 {
 	struct mtk_iommu_data *data = dev_get_drvdata(dev);
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index b8aeb0768483..92341ef33354 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -624,17 +624,19 @@ static int mtk_iommu_probe(struct platform_device *pdev)
 			continue;
 
 		plarbdev = of_find_device_by_node(larb_spec.np);
-		of_node_put(larb_spec.np);
 		if (!plarbdev) {
 			plarbdev = of_platform_device_create(
 						larb_spec.np, NULL,
 						platform_bus_type.dev_root);
-			if (!plarbdev)
+			if (!plarbdev) {
+				of_node_put(larb_spec.np);
 				return -EPROBE_DEFER;
+			}
 		}
 
 		data->smi_imu.larb_imu[larb_nr].dev = &plarbdev->dev;
-		component_match_add(dev, &match, compare_of, larb_spec.np);
+		component_match_add_release(dev, &match, release_of,
+					    compare_of, larb_spec.np);
 		larb_nr++;
 	}
 
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] iommu: convert DT component matching to component_match_add_release()
  2016-10-19 10:30 Russell King
@ 2016-11-10 11:25 ` Joerg Roedel
  0 siblings, 0 replies; 4+ messages in thread
From: Joerg Roedel @ 2016-11-10 11:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Oct 19, 2016 at 11:30:34AM +0100, Russell King wrote:
> Convert DT component matching to use component_match_add_release().
> 
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> ---
>  drivers/iommu/mtk_iommu.c    | 8 +++++---
>  drivers/iommu/mtk_iommu.h    | 5 +++++
>  drivers/iommu/mtk_iommu_v1.c | 8 +++++---
>  3 files changed, 15 insertions(+), 6 deletions(-)

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-11-10 11:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-03  7:58 [PATCH] iommu: convert DT component matching to component_match_add_release() Russell King
2016-06-03 13:13 ` Matthias Brugger
  -- strict thread matches above, loose matches on Subject: below --
2016-10-19 10:30 Russell King
2016-11-10 11:25 ` Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).