Re: [Freedreno] [PATCH v2 02/12] drm/armada: Use regular fbdev I/O helpers

2023-05-15 Thread Russell King (Oracle)
On Mon, May 15, 2023 at 07:55:44PM +0200, Sam Ravnborg wrote:
> Hi Thomas,
> 
> On Mon, May 15, 2023 at 11:40:23AM +0200, Thomas Zimmermann wrote:
> > Use the regular fbdev helpers for framebuffer I/O instead of DRM's
> > helpers. Armada does not use damage handling, so DRM's fbdev helpers
> > are mere wrappers around the fbdev code.
> > 
> > By using fbdev helpers directly within each DRM fbdev emulation,
> > we can eventually remove DRM's wrapper functions entirely.
> > 
> > v2:
> > * use FB_IO_HELPERS option
> > 
> > Signed-off-by: Thomas Zimmermann 
> > Cc: Russell King 
> > ---
> >  drivers/gpu/drm/armada/Kconfig| 1 +
> >  drivers/gpu/drm/armada/armada_fbdev.c | 9 -
> >  2 files changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/armada/Kconfig b/drivers/gpu/drm/armada/Kconfig
> > index f5c66d89ba99..5afade25e217 100644
> > --- a/drivers/gpu/drm/armada/Kconfig
> > +++ b/drivers/gpu/drm/armada/Kconfig
> > @@ -3,6 +3,7 @@ config DRM_ARMADA
> > tristate "DRM support for Marvell Armada SoCs"
> > depends on DRM && HAVE_CLK && ARM && MMU
> > select DRM_KMS_HELPER
> > +   select FB_IO_HELPERS if DRM_FBDEV_EMULATION
> > help
> >   Support the "LCD" controllers found on the Marvell Armada 510
> >   devices.  There are two controllers on the device, each controller
> > diff --git a/drivers/gpu/drm/armada/armada_fbdev.c 
> > b/drivers/gpu/drm/armada/armada_fbdev.c
> > index 0a5fd1aa86eb..6c3bbaf53569 100644
> > --- a/drivers/gpu/drm/armada/armada_fbdev.c
> > +++ b/drivers/gpu/drm/armada/armada_fbdev.c
> > @@ -5,6 +5,7 @@
> >   */
> >  
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >  
> > @@ -34,11 +35,9 @@ static void armada_fbdev_fb_destroy(struct fb_info *info)
> >  static const struct fb_ops armada_fb_ops = {
> > .owner  = THIS_MODULE,
> > DRM_FB_HELPER_DEFAULT_OPS,
> > -   .fb_read= drm_fb_helper_cfb_read,
> > -   .fb_write   = drm_fb_helper_cfb_write,
> I had expected to see
> .fb_read = fb_io_read,
> 
> But maybe this only used when using damage handling?
> 
> Likewise for drm_fb_helper_cfb_write.
> 
> ??
> 
> > -   .fb_fillrect= drm_fb_helper_cfb_fillrect,
> > -   .fb_copyarea= drm_fb_helper_cfb_copyarea,
> > -   .fb_imageblit   = drm_fb_helper_cfb_imageblit,
> > +   .fb_fillrect= cfb_fillrect,
> > +   .fb_copyarea= cfb_copyarea,
> > +   .fb_imageblit   = cfb_imageblit,
> 
> This part is as expected.

Well, to me it looks like this has gone through an entire circular set
of revisions:

commit e8b70e4dd7b5dad7c2379de6e0851587bf86bfd6
Author: Archit Taneja 
Date:   Wed Jul 22 14:58:04 2015 +0530

drm/armada: Use new drm_fb_helper functions

-   .fb_fillrect= cfb_fillrect,
-   .fb_copyarea= cfb_copyarea,
-   .fb_imageblit   = cfb_imageblit,
+   .fb_fillrect= drm_fb_helper_cfb_fillrect,
+   .fb_copyarea= drm_fb_helper_cfb_copyarea,
+   .fb_imageblit   = drm_fb_helper_cfb_imageblit,

commit 983780918c759fdbbf0bf033e701bbff75d2af23
Author: Thomas Zimmermann 
Date:   Thu Nov 3 16:14:40 2022 +0100

drm/fb-helper: Perform all fbdev I/O with the same implementation

+   .fb_read= drm_fb_helper_cfb_read,
+   .fb_write   = drm_fb_helper_cfb_write,

and now effectively those two changes are being reverted, so we'd
now be back to the pre-July 2015 state of affairs. As I believe
the fbdev layer has been stable, this change merely reverts the
driver back to what it once was.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!


Re: [Freedreno] [PATCH v2 02/21] drm/armada: Introduce GEM object functions

2020-09-15 Thread Russell King - ARM Linux admin
On Tue, Sep 15, 2020 at 04:59:39PM +0200, Thomas Zimmermann wrote:
> GEM object functions deprecate several similar callback interfaces in
> struct drm_driver. This patch replaces the per-driver callbacks with
> per-instance callbacks in armada.
> 
> Signed-off-by: Thomas Zimmermann 

Acked-by: Russell King 

Thanks.

> ---
>  drivers/gpu/drm/armada/armada_drv.c |  3 ---
>  drivers/gpu/drm/armada/armada_gem.c | 12 +++-
>  drivers/gpu/drm/armada/armada_gem.h |  2 --
>  3 files changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/armada/armada_drv.c 
> b/drivers/gpu/drm/armada/armada_drv.c
> index 980d3f1f8f16..22247cfce80b 100644
> --- a/drivers/gpu/drm/armada/armada_drv.c
> +++ b/drivers/gpu/drm/armada/armada_drv.c
> @@ -37,13 +37,10 @@ DEFINE_DRM_GEM_FOPS(armada_drm_fops);
>  
>  static struct drm_driver armada_drm_driver = {
>   .lastclose  = drm_fb_helper_lastclose,
> - .gem_free_object_unlocked = armada_gem_free_object,
>   .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>   .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
> - .gem_prime_export   = armada_gem_prime_export,
>   .gem_prime_import   = armada_gem_prime_import,
>   .dumb_create= armada_gem_dumb_create,
> - .gem_vm_ops = _gem_vm_ops,
>   .major  = 1,
>   .minor  = 0,
>   .name   = "armada-drm",
> diff --git a/drivers/gpu/drm/armada/armada_gem.c 
> b/drivers/gpu/drm/armada/armada_gem.c
> index ecf8a55e93d9..c343fbefe47c 100644
> --- a/drivers/gpu/drm/armada/armada_gem.c
> +++ b/drivers/gpu/drm/armada/armada_gem.c
> @@ -25,7 +25,7 @@ static vm_fault_t armada_gem_vm_fault(struct vm_fault *vmf)
>   return vmf_insert_pfn(vmf->vma, vmf->address, pfn);
>  }
>  
> -const struct vm_operations_struct armada_gem_vm_ops = {
> +static const struct vm_operations_struct armada_gem_vm_ops = {
>   .fault  = armada_gem_vm_fault,
>   .open   = drm_gem_vm_open,
>   .close  = drm_gem_vm_close,
> @@ -184,6 +184,12 @@ armada_gem_map_object(struct drm_device *dev, struct 
> armada_gem_object *dobj)
>   return dobj->addr;
>  }
>  
> +static const struct drm_gem_object_funcs armada_gem_object_funcs = {
> + .free = armada_gem_free_object,
> + .export = armada_gem_prime_export,
> + .vm_ops = _gem_vm_ops,
> +};
> +
>  struct armada_gem_object *
>  armada_gem_alloc_private_object(struct drm_device *dev, size_t size)
>  {
> @@ -195,6 +201,8 @@ armada_gem_alloc_private_object(struct drm_device *dev, 
> size_t size)
>   if (!obj)
>   return NULL;
>  
> + obj->obj.funcs = _gem_object_funcs;
> +
>   drm_gem_private_object_init(dev, >obj, size);
>  
>   DRM_DEBUG_DRIVER("alloc private obj %p size %zu\n", obj, size);
> @@ -214,6 +222,8 @@ static struct armada_gem_object 
> *armada_gem_alloc_object(struct drm_device *dev,
>   if (!obj)
>   return NULL;
>  
> + obj->obj.funcs = _gem_object_funcs;
> +
>   if (drm_gem_object_init(dev, >obj, size)) {
>   kfree(obj);
>   return NULL;
> diff --git a/drivers/gpu/drm/armada/armada_gem.h 
> b/drivers/gpu/drm/armada/armada_gem.h
> index de04cc2c8f0e..ffcc7e8dd351 100644
> --- a/drivers/gpu/drm/armada/armada_gem.h
> +++ b/drivers/gpu/drm/armada/armada_gem.h
> @@ -21,8 +21,6 @@ struct armada_gem_object {
>   void*update_data;
>  };
>  
> -extern const struct vm_operations_struct armada_gem_vm_ops;
> -
>  #define drm_to_armada_gem(o) container_of(o, struct armada_gem_object, obj)
>  
>  void armada_gem_free_object(struct drm_gem_object *);
> -- 
> 2.28.0
> 
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH 1/4] drm/edid: Pass connector to AVI inforframe functions

2018-12-05 Thread Russell King - ARM Linux
On Tue, Nov 20, 2018 at 06:13:42PM +0200, Ville Syrjala wrote:
> diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
> b/drivers/gpu/drm/i2c/tda998x_drv.c
> index a7c39f39793f..38c66fbc8276 100644
> --- a/drivers/gpu/drm/i2c/tda998x_drv.c
> +++ b/drivers/gpu/drm/i2c/tda998x_drv.c
> @@ -849,7 +849,8 @@ tda998x_write_avi(struct tda998x_priv *priv, struct 
> drm_display_mode *mode)
>  {
>   union hdmi_infoframe frame;
>  
> - drm_hdmi_avi_infoframe_from_display_mode(, mode, false);
> + drm_hdmi_avi_infoframe_from_display_mode(,
> +  >connector, mode);
>   frame.avi.quantization_range = HDMI_QUANTIZATION_RANGE_FULL;
>  
>   tda998x_write_if(priv, DIP_IF_FLAGS_IF2, REG_IF2_HB0, );

For this,

Acked-by: Russell King 

Thanks.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH] drm: add missing ctx argument to plane transitional helpers

2018-07-02 Thread Russell King
In commits:
34a2ab5e0689 ("drm: Add acquire ctx parameter to ->update_plane")
1931529448bc ("drm: Add acquire ctx parameter to ->plane_disable")

a pointer to a drm_modeset_acquire_ctx structure was added as an
argument to the method prototypes.  The transitional helpers are
supposed to be directly plugged in as implementations of these
methods, but doing so generates a warning.  Add the missing
argument.

A number of buggy users were added for drm_plane_helper_disable()
which need to be fixed up for this change, which we do by passing
a NULL ctx argument.

Fixes: 1931529448bc ("drm: Add acquire ctx parameter to ->plane_disable")
Signed-off-by: Russell King 
---
Note: not build for all the affected drivers yet.

 drivers/gpu/drm/arc/arcpgu_crtc.c  | 2 +-
 drivers/gpu/drm/arm/hdlcd_crtc.c   | 2 +-
 drivers/gpu/drm/drm_plane_helper.c | 8 ++--
 drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c | 2 +-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 2 +-
 drivers/gpu/drm/sti/sti_cursor.c   | 2 +-
 drivers/gpu/drm/sti/sti_gdp.c  | 2 +-
 drivers/gpu/drm/sti/sti_hqvdp.c| 2 +-
 drivers/gpu/drm/vc4/vc4_plane.c| 2 +-
 drivers/gpu/drm/zte/zx_plane.c | 2 +-
 include/drm/drm_plane_helper.h | 6 --
 11 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c 
b/drivers/gpu/drm/arc/arcpgu_crtc.c
index c3349b8fb58b..965cda48dc13 100644
--- a/drivers/gpu/drm/arc/arcpgu_crtc.c
+++ b/drivers/gpu/drm/arc/arcpgu_crtc.c
@@ -186,7 +186,7 @@ static const struct drm_plane_helper_funcs 
arc_pgu_plane_helper_funcs = {
 
 static void arc_pgu_plane_destroy(struct drm_plane *plane)
 {
-   drm_plane_helper_disable(plane);
+   drm_plane_helper_disable(plane, NULL);
drm_plane_cleanup(plane);
 }
 
diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
index cf5cbd63ecdf..f3f08cd6e9ef 100644
--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
@@ -282,7 +282,7 @@ static const struct drm_plane_helper_funcs 
hdlcd_plane_helper_funcs = {
 
 static void hdlcd_plane_destroy(struct drm_plane *plane)
 {
-   drm_plane_helper_disable(plane);
+   drm_plane_helper_disable(plane, NULL);
drm_plane_cleanup(plane);
 }
 
diff --git a/drivers/gpu/drm/drm_plane_helper.c 
b/drivers/gpu/drm/drm_plane_helper.c
index 2010794943bc..621f17643bb0 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -440,6 +440,7 @@ int drm_plane_helper_commit(struct drm_plane *plane,
  * @src_y: y offset of @fb for panning
  * @src_w: width of source rectangle in @fb
  * @src_h: height of source rectangle in @fb
+ * @ctx: lock acquire context, not used here
  *
  * Provides a default plane update handler using the atomic plane update
  * functions. It is fully left to the driver to check plane constraints and
@@ -455,7 +456,8 @@ int drm_plane_helper_update(struct drm_plane *plane, struct 
drm_crtc *crtc,
int crtc_x, int crtc_y,
unsigned int crtc_w, unsigned int crtc_h,
uint32_t src_x, uint32_t src_y,
-   uint32_t src_w, uint32_t src_h)
+   uint32_t src_w, uint32_t src_h,
+   struct drm_modeset_acquire_ctx *ctx)
 {
struct drm_plane_state *plane_state;
 
@@ -489,6 +491,7 @@ EXPORT_SYMBOL(drm_plane_helper_update);
 /**
  * drm_plane_helper_disable() - Transitional helper for plane disable
  * @plane: plane to disable
+ * @ctx: lock acquire context, not used here
  *
  * Provides a default plane disable handler using the atomic plane update
  * functions. It is fully left to the driver to check plane constraints and
@@ -499,7 +502,8 @@ EXPORT_SYMBOL(drm_plane_helper_update);
  * RETURNS:
  * Zero on success, error code on failure
  */
-int drm_plane_helper_disable(struct drm_plane *plane)
+int drm_plane_helper_disable(struct drm_plane *plane,
+struct drm_modeset_acquire_ctx *ctx)
 {
struct drm_plane_state *plane_state;
struct drm_framebuffer *old_fb;
diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c 
b/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c
index 7b641fa6dc4d..79ff653d8081 100644
--- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c
+++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c
@@ -68,7 +68,7 @@ static void mdp4_plane_destroy(struct drm_plane *plane)
 {
struct mdp4_plane *mdp4_plane = to_mdp4_plane(plane);
 
-   drm_plane_helper_disable(plane);
+   drm_plane_helper_disable(plane, NULL);
drm_plane_cleanup(plane);
 
kfree(mdp4_plane);
diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c 
b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c
index c4f115fe96ff..7d306c5acd09 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/disp/mdp

Re: [Freedreno] [PATCH] drm: convert DT component matching to component_match_add_release()

2016-10-21 Thread Russell King - ARM Linux
On Thu, Oct 20, 2016 at 07:15:56PM -0400, Sean Paul wrote:
> On Thu, Oct 20, 2016 at 5:50 PM, Russell King - ARM Linux
> <li...@armlinux.org.uk> wrote:
> > On Thu, Oct 20, 2016 at 04:39:04PM -0400, Sean Paul wrote:
> >> On Wed, Oct 19, 2016 at 6:28 AM, Russell King
> >> <rmk+ker...@armlinux.org.uk> wrote:
> >> > Convert DT component matching to use component_match_add_release().
> >> >
> >> > Signed-off-by: Russell King <rmk+ker...@armlinux.org.uk>
> >> > ---
> >> > Can we please get this patch from May merged into the drm-misc or
> >> > whatever trees so that we don't end up with conflicts?  I've no idea
> >> > who looks after drm-misc, as they have _still_ failed to add
> >> > themselves to MAINTAINERS.
> >>
> >> I think Daniel explained pretty clearly why this wasn't happening in
> >> the previous thread.
> >>
> >> Next time you send a v2, can you please mark it as such and include a
> >> "Changes in v2" section?
> >
> > Why - nothing's changed other than a rebase onto 4.9-rc1.  This isn't
> > a "I've changed it in XYZ way, so here's a new copy".
> 
> 
> Changes in v2: None
> 
> Is still useful since:
> a) the diffstat is different from v1, which necessitates me going
> through both versions to see what's changed from the previous reviews
> (only to find out myself that it's been rebased and a function has
> changed names)

Sorry, but I don't track in any fine detail what the changes are
between patches when I bring them forward: I have far too many patches
to do that (I have 300 right now) and I never know whether they're
going to result in a pull request or not.  It means finding some way
to manually attach a change log to each patch I send out, which will
be very time consuming.  I'd rather not send patches out than jump
through hoops like that, especially when the reason is that the
previous version was ignored.

> b) in June, you said you were going to roll a new version with the
> common OF bits extracted. it's nice to know at the outset that this
> has/hasn't happened

Now if you were following the rest of it, rather than just random parts
that suited you, you'd have noticed that I posted the new version, but
that caused more issues, so I publically said I was reverting back to
the original version.

> Also, prefacing the subject with [PATCH v2] or [PATCH RESEND] lets me
> know there is prior history with the change. Reading the previous
> version is helpful to see what reviewer's concerns were, and whether
> they've been addressed.

Yea, I'm very bad at changing the subject line in that way, and I'm
getting worse at it.  Sorry, I try my best, but I can't do better than
that.

> 
> 
> > It's being
> > posted in the hope that someone will finally either comment on it or
> > merge the damn thing, rather than ignoring it was done when it was
> > last posted.
> >
> >> >  drivers/gpu/drm/arm/hdlcd_drv.c |  3 ++-
> >> >  drivers/gpu/drm/arm/malidp_drv.c|  4 +++-
> >> >  drivers/gpu/drm/armada/armada_drv.c |  2 +-
> >> >  drivers/gpu/drm/drm_of.c| 28 
> >> > +++--
> >> >  drivers/gpu/drm/etnaviv/etnaviv_drv.c   |  5 +++--
> >> >  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c |  7 ---
> >> >  drivers/gpu/drm/mediatek/mtk_drm_drv.c  |  4 +++-
> >> >  drivers/gpu/drm/msm/msm_drv.c   | 12 ++-
> >> >  drivers/gpu/drm/rockchip/rockchip_drm_drv.c |  6 --
> >> >  drivers/gpu/drm/sti/sti_drv.c   |  5 +++--
> >> >  drivers/gpu/drm/sun4i/sun4i_drv.c   |  3 ++-
> >> >  drivers/gpu/drm/tilcdc/tilcdc_external.c|  4 +++-
> >> >  include/drm/drm_of.h| 12 +++
> >> >  13 files changed, 73 insertions(+), 22 deletions(-)
> >> >
> >> > diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c 
> >> > b/drivers/gpu/drm/arm/hdlcd_drv.c
> >> > index fb6a418ce6be..6477d1a65266 100644
> >> > --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> >> > +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> >> > @@ -453,7 +453,8 @@ static int hdlcd_probe(struct platform_device *pdev)
> >> > return -EAGAIN;
> >> > }
> >> >
> >> > -   component_match_add(>dev, , compare_dev, port);
> >> > +   drm_of_component_match_add(>dev, , compare_dev, 
> >> > port);
> >> > +

Re: [Freedreno] [PATCH] drm: convert DT component matching to component_match_add_release()

2016-10-20 Thread Russell King - ARM Linux
On Thu, Oct 20, 2016 at 04:39:04PM -0400, Sean Paul wrote:
> On Wed, Oct 19, 2016 at 6:28 AM, Russell King
> <rmk+ker...@armlinux.org.uk> wrote:
> > Convert DT component matching to use component_match_add_release().
> >
> > Signed-off-by: Russell King <rmk+ker...@armlinux.org.uk>
> > ---
> > Can we please get this patch from May merged into the drm-misc or
> > whatever trees so that we don't end up with conflicts?  I've no idea
> > who looks after drm-misc, as they have _still_ failed to add
> > themselves to MAINTAINERS.
> 
> I think Daniel explained pretty clearly why this wasn't happening in
> the previous thread.
> 
> Next time you send a v2, can you please mark it as such and include a
> "Changes in v2" section?

Why - nothing's changed other than a rebase onto 4.9-rc1.  This isn't
a "I've changed it in XYZ way, so here's a new copy".  It's being
posted in the hope that someone will finally either comment on it or
merge the damn thing, rather than ignoring it was done when it was
last posted.

> >  drivers/gpu/drm/arm/hdlcd_drv.c |  3 ++-
> >  drivers/gpu/drm/arm/malidp_drv.c|  4 +++-
> >  drivers/gpu/drm/armada/armada_drv.c |  2 +-
> >  drivers/gpu/drm/drm_of.c| 28 
> > +++--
> >  drivers/gpu/drm/etnaviv/etnaviv_drv.c   |  5 +++--
> >  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c |  7 ---
> >  drivers/gpu/drm/mediatek/mtk_drm_drv.c  |  4 +++-
> >  drivers/gpu/drm/msm/msm_drv.c   | 12 ++-
> >  drivers/gpu/drm/rockchip/rockchip_drm_drv.c |  6 --
> >  drivers/gpu/drm/sti/sti_drv.c   |  5 +++--
> >  drivers/gpu/drm/sun4i/sun4i_drv.c   |  3 ++-
> >  drivers/gpu/drm/tilcdc/tilcdc_external.c|  4 +++-
> >  include/drm/drm_of.h| 12 +++
> >  13 files changed, 73 insertions(+), 22 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c 
> > b/drivers/gpu/drm/arm/hdlcd_drv.c
> > index fb6a418ce6be..6477d1a65266 100644
> > --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> > +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> > @@ -453,7 +453,8 @@ static int hdlcd_probe(struct platform_device *pdev)
> > return -EAGAIN;
> > }
> >
> > -   component_match_add(>dev, , compare_dev, port);
> > +   drm_of_component_match_add(>dev, , compare_dev, port);
> > +   of_node_put(port);
> 
> There's no mention in your commit message about fixing these node leaks.

Isn't that kind-of the whole point of this patch?

> >
> > return component_master_add_with_match(>dev, 
> > _master_ops,
> >match);
> > diff --git a/drivers/gpu/drm/arm/malidp_drv.c 
> > b/drivers/gpu/drm/arm/malidp_drv.c
> > index 9280358b8f15..9f4739452a25 100644
> > --- a/drivers/gpu/drm/arm/malidp_drv.c
> > +++ b/drivers/gpu/drm/arm/malidp_drv.c
> > @@ -493,7 +493,9 @@ static int malidp_platform_probe(struct platform_device 
> > *pdev)
> > return -EAGAIN;
> > }
> >
> > -   component_match_add(>dev, , malidp_compare_dev, port);
> > +   drm_of_component_match_add(>dev, , malidp_compare_dev,
> > +  port);
> > +   of_node_put(port);
> > return component_master_add_with_match(>dev, 
> > _master_ops,
> >match);
> >  }
> > diff --git a/drivers/gpu/drm/armada/armada_drv.c 
> > b/drivers/gpu/drm/armada/armada_drv.c
> > index 1e0e68f608e4..94e46da9a758 100644
> > --- a/drivers/gpu/drm/armada/armada_drv.c
> > +++ b/drivers/gpu/drm/armada/armada_drv.c
> > @@ -254,7 +254,7 @@ static void armada_add_endpoints(struct device *dev,
> > continue;
> > }
> >
> > -   component_match_add(dev, match, compare_of, remote);
> > +   drm_of_component_match_add(dev, match, compare_of, remote);
> > of_node_put(remote);
> > }
> >  }
> > diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
> > index bc98bb94264d..47848ed8ca48 100644
> > --- a/drivers/gpu/drm/drm_of.c
> > +++ b/drivers/gpu/drm/drm_of.c
> > @@ -6,6 +6,11 @@
> >  #include 
> >  #include 
> >
> > +static void drm_release_of(struct device *dev, void *data)
> > +{
> > +   of_node_put(data);
> > +}
> > +
> >  /**
> >

[Freedreno] [PATCH] drm: convert DT component matching to component_match_add_release()

2016-10-19 Thread Russell King
Convert DT component matching to use component_match_add_release().

Signed-off-by: Russell King <rmk+ker...@armlinux.org.uk>
---
Can we please get this patch from May merged into the drm-misc or
whatever trees so that we don't end up with conflicts?  I've no idea
who looks after drm-misc, as they have _still_ failed to add
themselves to MAINTAINERS.

 drivers/gpu/drm/arm/hdlcd_drv.c |  3 ++-
 drivers/gpu/drm/arm/malidp_drv.c|  4 +++-
 drivers/gpu/drm/armada/armada_drv.c |  2 +-
 drivers/gpu/drm/drm_of.c| 28 +++--
 drivers/gpu/drm/etnaviv/etnaviv_drv.c   |  5 +++--
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c |  7 ---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c  |  4 +++-
 drivers/gpu/drm/msm/msm_drv.c   | 12 ++-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c |  6 --
 drivers/gpu/drm/sti/sti_drv.c   |  5 +++--
 drivers/gpu/drm/sun4i/sun4i_drv.c   |  3 ++-
 drivers/gpu/drm/tilcdc/tilcdc_external.c|  4 +++-
 include/drm/drm_of.h| 12 +++
 13 files changed, 73 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index fb6a418ce6be..6477d1a65266 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -453,7 +453,8 @@ static int hdlcd_probe(struct platform_device *pdev)
return -EAGAIN;
}
 
-   component_match_add(>dev, , compare_dev, port);
+   drm_of_component_match_add(>dev, , compare_dev, port);
+   of_node_put(port);
 
return component_master_add_with_match(>dev, _master_ops,
   match);
diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index 9280358b8f15..9f4739452a25 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -493,7 +493,9 @@ static int malidp_platform_probe(struct platform_device 
*pdev)
return -EAGAIN;
}
 
-   component_match_add(>dev, , malidp_compare_dev, port);
+   drm_of_component_match_add(>dev, , malidp_compare_dev,
+  port);
+   of_node_put(port);
return component_master_add_with_match(>dev, _master_ops,
   match);
 }
diff --git a/drivers/gpu/drm/armada/armada_drv.c 
b/drivers/gpu/drm/armada/armada_drv.c
index 1e0e68f608e4..94e46da9a758 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -254,7 +254,7 @@ static void armada_add_endpoints(struct device *dev,
continue;
}
 
-   component_match_add(dev, match, compare_of, remote);
+   drm_of_component_match_add(dev, match, compare_of, remote);
of_node_put(remote);
}
 }
diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
index bc98bb94264d..47848ed8ca48 100644
--- a/drivers/gpu/drm/drm_of.c
+++ b/drivers/gpu/drm/drm_of.c
@@ -6,6 +6,11 @@
 #include 
 #include 
 
+static void drm_release_of(struct device *dev, void *data)
+{
+   of_node_put(data);
+}
+
 /**
  * drm_crtc_port_mask - find the mask of a registered CRTC by port OF node
  * @dev: DRM device
@@ -64,6 +69,24 @@ uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
 EXPORT_SYMBOL(drm_of_find_possible_crtcs);
 
 /**
+ * drm_of_component_match_add - Add a component helper OF node match rule
+ * @master: master device
+ * @matchptr: component match pointer
+ * @compare: compare function used for matching component
+ * @node: of_node
+ */
+void drm_of_component_match_add(struct device *master,
+   struct component_match **matchptr,
+   int (*compare)(struct device *, void *),
+   struct device_node *node)
+{
+   of_node_get(node);
+   component_match_add_release(master, matchptr, drm_release_of,
+   compare, node);
+}
+EXPORT_SYMBOL_GPL(drm_of_component_match_add);
+
+/**
  * drm_of_component_probe - Generic probe function for a component based master
  * @dev: master device containing the OF node
  * @compare_of: compare function used for matching components
@@ -101,7 +124,7 @@ int drm_of_component_probe(struct device *dev,
continue;
}
 
-   component_match_add(dev, , compare_of, port);
+   drm_of_component_match_add(dev, , compare_of, port);
of_node_put(port);
}
 
@@ -140,7 +163,8 @@ int drm_of_component_probe(struct device *dev,
continue;
}
 
-   component_match_add(dev, , compare_of, remote);
+   drm_of_component_mat