Re: [RFC PATCH] component: Add common helpers for compare/release functions

2022-02-09 Thread Yong Wu via iommu
On Fri, 2022-01-28 at 23:24 +0100, Daniel Vetter wrote:
> On Fri, Jan 28, 2022 at 04:11:01PM +0800, Yong Wu wrote:
> > The component requires the compare/release functions, there are so
> > many
> > copy in current kernel. Just define three common helpers for them.
> > No functional change.
> > 
> > Signed-off-by: Yong Wu 
> > ---
> > Base on v5.17-rc1
> > ---
> >  .../gpu/drm/arm/display/komeda/komeda_drv.c|  5 -
> >  drivers/gpu/drm/arm/hdlcd_drv.c|  7 +--
> >  drivers/gpu/drm/armada/armada_drv.c|  5 -
> >  drivers/gpu/drm/drm_of.c   |  8 +---
> >  drivers/gpu/drm/etnaviv/etnaviv_drv.c  |  7 ---
> >  drivers/gpu/drm/exynos/exynos_drm_drv.c|  5 -
> >  .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c|  5 -
> >  drivers/gpu/drm/imx/imx-drm-core.c |  4 ++--
> >  drivers/gpu/drm/ingenic/ingenic-drm-drv.c  |  5 -
> >  drivers/gpu/drm/mcde/mcde_drv.c|  7 +--
> >  drivers/gpu/drm/mediatek/mtk_drm_drv.c |  5 -
> >  drivers/gpu/drm/meson/meson_drv.c  |  8 
> >  drivers/gpu/drm/msm/msm_drv.c  |  9 -
> >  drivers/gpu/drm/omapdrm/dss/dss.c  |  8 +---
> >  drivers/gpu/drm/rockchip/rockchip_drm_drv.c|  5 -
> >  drivers/gpu/drm/sti/sti_drv.c  |  5 -
> >  drivers/gpu/drm/sun4i/sun4i_drv.c  |  9 -
> >  drivers/gpu/drm/vc4/vc4_drv.c  |  5 -
> >  drivers/iommu/mtk_iommu.h  | 10 --
> >  drivers/power/supply/ab8500_charger.c  |  8 +---
> >  drivers/video/fbdev/omap2/omapfb/dss/dss.c |  8 +---
> >  include/linux/component.h  | 18
> > ++
> >  sound/soc/codecs/wcd938x.c | 16 ++--
> > 
> 
> Seems like a neat idea. Please add kerneldoc for the new functions
> you're
> adding (bonus point for an example in there) and make sure it all
> renders
> correctly in

OK, I will add it.

> 
> $ make htmldoc

sorry, I still need some time to run this in my environment.

> 
> Also please split up the patch series per-driver and add the
> maintainers
> to each patches' Cc: list. With that I think this should be ready for
> merging.

In the orignal idea, I thought the name compare_of/release_of was
enough, thus I squashed them into one patch, otherwise, it may cause
build fail due to redefinition when bisecting.

>From Jani, It's better to add a namespace for the function name,
something like comp_ or component_?

If the function name is changed, then I could split them. A question:
The biggest change are in DRM, and all of these patches will go
together. Maybe all the DRM parts could be in one patch, to avoid so
many small patches, is this ok? or We'd better create a patch per a drm
driver.

In the end, then the code should be something like:

--- a/drivers/base/component.c
+++ b/drivers/base/component.c
@@ -287,6 +287,24 @@ static void take_down_master(struct master
*master)
}
 }

+int component_compare_of(struct device *dev, void *data)
+{
+   return device_match_of_node(dev, data);
+}
+EXPORT_SYMBOL_GPL(component_compare_of);
+
+void component_release_of(struct device *dev, void *data)
+{
+   of_node_put(data);
+}
+EXPORT_SYMBOL_GPL(component_release_of);

> 
> Cheers, Daniel
> 
> >  23 files changed, 28 insertions(+), 144 deletions(-)

> > diff --git a/include/linux/component.h b/include/linux/component.h
> > index 16de18f473d7..5a7468ea827c 100644
> > --- a/include/linux/component.h
> > +++ b/include/linux/component.h
> > @@ -2,6 +2,8 @@
> >  #ifndef COMPONENT_H
> >  #define COMPONENT_H
> >  
> > +#include 
> > +#include 
> >  #include 
> >  
> >  
> > @@ -82,6 +84,22 @@ struct component_master_ops {
> > void (*unbind)(struct device *master);
> >  };
> >  
> > +/* A set common helpers for compare/release functions */
> > +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 compare_dev(struct device *dev, void *data)
> > +{
> > +   return dev == data;
> > +}
> > +
> >  void component_master_del(struct device *,
> > const struct component_master_ops *);
> 
> 

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [RFC PATCH] component: Add common helpers for compare/release functions

2022-02-09 Thread Yong Wu via iommu
On Fri, 2022-01-28 at 13:04 +, Robin Murphy wrote:
> On 2022-01-28 08:11, Yong Wu wrote:
> [...]
> > diff --git a/include/linux/component.h b/include/linux/component.h
> > index 16de18f473d7..5a7468ea827c 100644
> > --- a/include/linux/component.h
> > +++ b/include/linux/component.h
> > @@ -2,6 +2,8 @@
> >   #ifndef COMPONENT_H
> >   #define COMPONENT_H
> >   
> > +#include 
> > +#include 
> >   #include 
> >   
> >   
> > @@ -82,6 +84,22 @@ struct component_master_ops {
> > void (*unbind)(struct device *master);
> >   };
> >   
> > +/* A set common helpers for compare/release functions */
> > +static inline int compare_of(struct device *dev, void *data)
> > +{
> > +   return dev->of_node == data;
> > +}
> 
> Note that this is effectively just device_match_of_node(), although
> I 
> guess there is an argument that having a nice consistent set of 
> component_match API helpers might be worth more than a tiny code
> saving 
> by borrowing one from a different API.

Thanks for this tip. I could try use this, Let the maintainer decide.

> 
> Either way, however, I don't think there's any good argument for 
> instantiating separate copies of these functions in every driver
> that 
> uses them. If they're used as callbacks then they can't actually be 
> inlined anyway, so they may as well be exported from component.c as 

oh. The MTK iommu keeps this inline for long time... OK, I will try
to move into the component.c and export them.

(Sorry for the late reply due to New Year holidays.)

> normal so that the code really is shared (plus then there's nice 
> symmetry with the aforementioned device_match API helpers too).
> 
> Thanks,
> Robin.
  

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [RFC PATCH] component: Add common helpers for compare/release functions

2022-01-31 Thread Jani Nikula
On Fri, 28 Jan 2022, Daniel Vetter  wrote:
> On Fri, Jan 28, 2022 at 04:11:01PM +0800, Yong Wu wrote:
>> The component requires the compare/release functions, there are so many
>> copy in current kernel. Just define three common helpers for them.
>> No functional change.
>> 
>> Signed-off-by: Yong Wu 
>> ---
>> Base on v5.17-rc1
>> ---
>>  .../gpu/drm/arm/display/komeda/komeda_drv.c|  5 -
>>  drivers/gpu/drm/arm/hdlcd_drv.c|  7 +--
>>  drivers/gpu/drm/armada/armada_drv.c|  5 -
>>  drivers/gpu/drm/drm_of.c   |  8 +---
>>  drivers/gpu/drm/etnaviv/etnaviv_drv.c  |  7 ---
>>  drivers/gpu/drm/exynos/exynos_drm_drv.c|  5 -
>>  .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c|  5 -
>>  drivers/gpu/drm/imx/imx-drm-core.c |  4 ++--
>>  drivers/gpu/drm/ingenic/ingenic-drm-drv.c  |  5 -
>>  drivers/gpu/drm/mcde/mcde_drv.c|  7 +--
>>  drivers/gpu/drm/mediatek/mtk_drm_drv.c |  5 -
>>  drivers/gpu/drm/meson/meson_drv.c  |  8 
>>  drivers/gpu/drm/msm/msm_drv.c  |  9 -
>>  drivers/gpu/drm/omapdrm/dss/dss.c  |  8 +---
>>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c|  5 -
>>  drivers/gpu/drm/sti/sti_drv.c  |  5 -
>>  drivers/gpu/drm/sun4i/sun4i_drv.c  |  9 -
>>  drivers/gpu/drm/vc4/vc4_drv.c  |  5 -
>>  drivers/iommu/mtk_iommu.h  | 10 --
>>  drivers/power/supply/ab8500_charger.c  |  8 +---
>>  drivers/video/fbdev/omap2/omapfb/dss/dss.c |  8 +---
>>  include/linux/component.h  | 18 ++
>>  sound/soc/codecs/wcd938x.c | 16 ++--
>
> Seems like a neat idea. Please add kerneldoc for the new functions you're
> adding (bonus point for an example in there) and make sure it all renders
> correctly in
>
> $ make htmldoc
>
> Also please split up the patch series per-driver and add the maintainers
> to each patches' Cc: list. With that I think this should be ready for
> merging.

Aren't the function names perhaps a bit short and generic for the global
namespace though? If you encounter compare_of, release_of, or
compare_dev in code, component.h is not where you'd expect to find them.

BR,
Jani.


>> diff --git a/include/linux/component.h b/include/linux/component.h
>> index 16de18f473d7..5a7468ea827c 100644
>> --- a/include/linux/component.h
>> +++ b/include/linux/component.h
>> @@ -2,6 +2,8 @@
>>  #ifndef COMPONENT_H
>>  #define COMPONENT_H
>>  
>> +#include 
>> +#include 
>>  #include 
>>  
>>  
>> @@ -82,6 +84,22 @@ struct component_master_ops {
>>  void (*unbind)(struct device *master);
>>  };
>>  
>> +/* A set common helpers for compare/release functions */
>> +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 compare_dev(struct device *dev, void *data)
>> +{
>> +return dev == data;
>> +}
>> +
>>  void component_master_del(struct device *,
>>  const struct component_master_ops *);
>>  

-- 
Jani Nikula, Intel Open Source Graphics Center
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [RFC PATCH] component: Add common helpers for compare/release functions

2022-01-28 Thread Daniel Vetter
On Fri, Jan 28, 2022 at 04:11:01PM +0800, Yong Wu wrote:
> The component requires the compare/release functions, there are so many
> copy in current kernel. Just define three common helpers for them.
> No functional change.
> 
> Signed-off-by: Yong Wu 
> ---
> Base on v5.17-rc1
> ---
>  .../gpu/drm/arm/display/komeda/komeda_drv.c|  5 -
>  drivers/gpu/drm/arm/hdlcd_drv.c|  7 +--
>  drivers/gpu/drm/armada/armada_drv.c|  5 -
>  drivers/gpu/drm/drm_of.c   |  8 +---
>  drivers/gpu/drm/etnaviv/etnaviv_drv.c  |  7 ---
>  drivers/gpu/drm/exynos/exynos_drm_drv.c|  5 -
>  .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c|  5 -
>  drivers/gpu/drm/imx/imx-drm-core.c |  4 ++--
>  drivers/gpu/drm/ingenic/ingenic-drm-drv.c  |  5 -
>  drivers/gpu/drm/mcde/mcde_drv.c|  7 +--
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c |  5 -
>  drivers/gpu/drm/meson/meson_drv.c  |  8 
>  drivers/gpu/drm/msm/msm_drv.c  |  9 -
>  drivers/gpu/drm/omapdrm/dss/dss.c  |  8 +---
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c|  5 -
>  drivers/gpu/drm/sti/sti_drv.c  |  5 -
>  drivers/gpu/drm/sun4i/sun4i_drv.c  |  9 -
>  drivers/gpu/drm/vc4/vc4_drv.c  |  5 -
>  drivers/iommu/mtk_iommu.h  | 10 --
>  drivers/power/supply/ab8500_charger.c  |  8 +---
>  drivers/video/fbdev/omap2/omapfb/dss/dss.c |  8 +---
>  include/linux/component.h  | 18 ++
>  sound/soc/codecs/wcd938x.c | 16 ++--

Seems like a neat idea. Please add kerneldoc for the new functions you're
adding (bonus point for an example in there) and make sure it all renders
correctly in

$ make htmldoc

Also please split up the patch series per-driver and add the maintainers
to each patches' Cc: list. With that I think this should be ready for
merging.

Cheers, Daniel

>  23 files changed, 28 insertions(+), 144 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c 
> b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
> index e7933930a657..fe5b97107417 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
> @@ -92,11 +92,6 @@ static const struct component_master_ops komeda_master_ops 
> = {
>   .unbind = komeda_unbind,
>  };
>  
> -static int compare_of(struct device *dev, void *data)
> -{
> - return dev->of_node == data;
> -}
> -
>  static void komeda_add_slave(struct device *master,
>struct component_match **match,
>struct device_node *np,
> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
> index 479c2422a2e0..36d84c439df8 100644
> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> @@ -372,11 +372,6 @@ static const struct component_master_ops 
> hdlcd_master_ops = {
>   .unbind = hdlcd_drm_unbind,
>  };
>  
> -static int compare_dev(struct device *dev, void *data)
> -{
> - return dev->of_node == data;
> -}
> -
>  static int hdlcd_probe(struct platform_device *pdev)
>  {
>   struct device_node *port;
> @@ -387,7 +382,7 @@ static int hdlcd_probe(struct platform_device *pdev)
>   if (!port)
>   return -ENODEV;
>  
> - drm_of_component_match_add(>dev, , compare_dev, port);
> + drm_of_component_match_add(>dev, , compare_of, port);
>   of_node_put(port);
>  
>   return component_master_add_with_match(>dev, _master_ops,
> diff --git a/drivers/gpu/drm/armada/armada_drv.c 
> b/drivers/gpu/drm/armada/armada_drv.c
> index 8e3e98f13db4..9edc4912c1a0 100644
> --- a/drivers/gpu/drm/armada/armada_drv.c
> +++ b/drivers/gpu/drm/armada/armada_drv.c
> @@ -177,11 +177,6 @@ static void armada_drm_unbind(struct device *dev)
>   drm_mm_takedown(>linear);
>  }
>  
> -static int compare_of(struct device *dev, void *data)
> -{
> - return dev->of_node == data;
> -}
> -
>  static int compare_dev_name(struct device *dev, void *data)
>  {
>   const char *name = data;
> diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
> index 59d368ea006b..f958f48f8ba4 100644
> --- a/drivers/gpu/drm/drm_of.c
> +++ b/drivers/gpu/drm/drm_of.c
> @@ -18,11 +18,6 @@
>   * properties.
>   */
>  
> -static void drm_release_of(struct device *dev, void *data)
> -{
> - of_node_put(data);
> -}
> -
>  /**
>   * drm_of_crtc_port_mask - find the mask of a registered CRTC by port OF node
>   * @dev: DRM device
> @@ -94,8 +89,7 @@ void drm_of_component_match_add(struct device *master,
>   struct device_node *node)
>  {
>   of_node_get(node);
> - component_match_add_release(master, matchptr, drm_release_of,
> - compare, 

Re: [RFC PATCH] component: Add common helpers for compare/release functions

2022-01-28 Thread Robin Murphy

On 2022-01-28 08:11, Yong Wu wrote:
[...]

diff --git a/include/linux/component.h b/include/linux/component.h
index 16de18f473d7..5a7468ea827c 100644
--- a/include/linux/component.h
+++ b/include/linux/component.h
@@ -2,6 +2,8 @@
  #ifndef COMPONENT_H
  #define COMPONENT_H
  
+#include 

+#include 
  #include 
  
  
@@ -82,6 +84,22 @@ struct component_master_ops {

void (*unbind)(struct device *master);
  };
  
+/* A set common helpers for compare/release functions */

+static inline int compare_of(struct device *dev, void *data)
+{
+   return dev->of_node == data;
+}


Note that this is effectively just device_match_of_node(), although I 
guess there is an argument that having a nice consistent set of 
component_match API helpers might be worth more than a tiny code saving 
by borrowing one from a different API.


Either way, however, I don't think there's any good argument for 
instantiating separate copies of these functions in every driver that 
uses them. If they're used as callbacks then they can't actually be 
inlined anyway, so they may as well be exported from component.c as 
normal so that the code really is shared (plus then there's nice 
symmetry with the aforementioned device_match API helpers too).


Thanks,
Robin.


+static inline void release_of(struct device *dev, void *data)
+{
+   of_node_put(data);
+}
+
+static inline int compare_dev(struct device *dev, void *data)
+{
+   return dev == data;
+}
+
  void component_master_del(struct device *,
const struct component_master_ops *);
  
diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c

index eff200a07d9f..992132cbfb9f 100644
--- a/sound/soc/codecs/wcd938x.c
+++ b/sound/soc/codecs/wcd938x.c
@@ -4417,16 +4417,6 @@ static const struct component_master_ops 
wcd938x_comp_ops = {
.unbind = wcd938x_unbind,
  };
  
-static int wcd938x_compare_of(struct device *dev, void *data)

-{
-   return dev->of_node == data;
-}
-
-static void wcd938x_release_of(struct device *dev, void *data)
-{
-   of_node_put(data);
-}
-
  static int wcd938x_add_slave_components(struct wcd938x_priv *wcd938x,
struct device *dev,
struct component_match **matchptr)
@@ -4442,8 +4432,7 @@ static int wcd938x_add_slave_components(struct 
wcd938x_priv *wcd938x,
}
  
  	of_node_get(wcd938x->rxnode);

-   component_match_add_release(dev, matchptr, wcd938x_release_of,
-   wcd938x_compare_of, wcd938x->rxnode);
+   component_match_add_release(dev, matchptr, release_of, compare_of, 
wcd938x->rxnode);
  
  	wcd938x->txnode = of_parse_phandle(np, "qcom,tx-device", 0);

if (!wcd938x->txnode) {
@@ -4451,8 +4440,7 @@ static int wcd938x_add_slave_components(struct 
wcd938x_priv *wcd938x,
return -ENODEV;
}
of_node_get(wcd938x->txnode);
-   component_match_add_release(dev, matchptr, wcd938x_release_of,
-   wcd938x_compare_of, wcd938x->txnode);
+   component_match_add_release(dev, matchptr, release_of, compare_of, 
wcd938x->txnode);
return 0;
  }
  

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[RFC PATCH] component: Add common helpers for compare/release functions

2022-01-28 Thread Yong Wu
The component requires the compare/release functions, there are so many
copy in current kernel. Just define three common helpers for them.
No functional change.

Signed-off-by: Yong Wu 
---
Base on v5.17-rc1
---
 .../gpu/drm/arm/display/komeda/komeda_drv.c|  5 -
 drivers/gpu/drm/arm/hdlcd_drv.c|  7 +--
 drivers/gpu/drm/armada/armada_drv.c|  5 -
 drivers/gpu/drm/drm_of.c   |  8 +---
 drivers/gpu/drm/etnaviv/etnaviv_drv.c  |  7 ---
 drivers/gpu/drm/exynos/exynos_drm_drv.c|  5 -
 .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c|  5 -
 drivers/gpu/drm/imx/imx-drm-core.c |  4 ++--
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c  |  5 -
 drivers/gpu/drm/mcde/mcde_drv.c|  7 +--
 drivers/gpu/drm/mediatek/mtk_drm_drv.c |  5 -
 drivers/gpu/drm/meson/meson_drv.c  |  8 
 drivers/gpu/drm/msm/msm_drv.c  |  9 -
 drivers/gpu/drm/omapdrm/dss/dss.c  |  8 +---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c|  5 -
 drivers/gpu/drm/sti/sti_drv.c  |  5 -
 drivers/gpu/drm/sun4i/sun4i_drv.c  |  9 -
 drivers/gpu/drm/vc4/vc4_drv.c  |  5 -
 drivers/iommu/mtk_iommu.h  | 10 --
 drivers/power/supply/ab8500_charger.c  |  8 +---
 drivers/video/fbdev/omap2/omapfb/dss/dss.c |  8 +---
 include/linux/component.h  | 18 ++
 sound/soc/codecs/wcd938x.c | 16 ++--
 23 files changed, 28 insertions(+), 144 deletions(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c 
b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
index e7933930a657..fe5b97107417 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
@@ -92,11 +92,6 @@ static const struct component_master_ops komeda_master_ops = 
{
.unbind = komeda_unbind,
 };
 
-static int compare_of(struct device *dev, void *data)
-{
-   return dev->of_node == data;
-}
-
 static void komeda_add_slave(struct device *master,
 struct component_match **match,
 struct device_node *np,
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index 479c2422a2e0..36d84c439df8 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -372,11 +372,6 @@ static const struct component_master_ops hdlcd_master_ops 
= {
.unbind = hdlcd_drm_unbind,
 };
 
-static int compare_dev(struct device *dev, void *data)
-{
-   return dev->of_node == data;
-}
-
 static int hdlcd_probe(struct platform_device *pdev)
 {
struct device_node *port;
@@ -387,7 +382,7 @@ static int hdlcd_probe(struct platform_device *pdev)
if (!port)
return -ENODEV;
 
-   drm_of_component_match_add(>dev, , compare_dev, port);
+   drm_of_component_match_add(>dev, , compare_of, port);
of_node_put(port);
 
return component_master_add_with_match(>dev, _master_ops,
diff --git a/drivers/gpu/drm/armada/armada_drv.c 
b/drivers/gpu/drm/armada/armada_drv.c
index 8e3e98f13db4..9edc4912c1a0 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -177,11 +177,6 @@ static void armada_drm_unbind(struct device *dev)
drm_mm_takedown(>linear);
 }
 
-static int compare_of(struct device *dev, void *data)
-{
-   return dev->of_node == data;
-}
-
 static int compare_dev_name(struct device *dev, void *data)
 {
const char *name = data;
diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
index 59d368ea006b..f958f48f8ba4 100644
--- a/drivers/gpu/drm/drm_of.c
+++ b/drivers/gpu/drm/drm_of.c
@@ -18,11 +18,6 @@
  * properties.
  */
 
-static void drm_release_of(struct device *dev, void *data)
-{
-   of_node_put(data);
-}
-
 /**
  * drm_of_crtc_port_mask - find the mask of a registered CRTC by port OF node
  * @dev: DRM device
@@ -94,8 +89,7 @@ void drm_of_component_match_add(struct device *master,
struct device_node *node)
 {
of_node_get(node);
-   component_match_add_release(master, matchptr, drm_release_of,
-   compare, node);
+   component_match_add_release(master, matchptr, release_of, compare, 
node);
 }
 EXPORT_SYMBOL_GPL(drm_of_component_match_add);
 
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c 
b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index 0b756ecb1bc2..15351e26ab00 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -574,13 +574,6 @@ static const struct component_master_ops 
etnaviv_master_ops = {
.unbind = etnaviv_unbind,
 };
 
-static int compare_of(struct device *dev, void *data)
-{
-   struct device_node *np = data;
-
-