public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/3] Drop ID table and conditionals around of_node pointers for anx78xx driver
@ 2023-08-30 17:08 Biju Das
  2023-08-30 17:08 ` [PATCH v5 1/3] drm/bridge/analogix/anx78xx: Drop ID table Biju Das
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Biju Das @ 2023-08-30 17:08 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Andrzej Hajda, Neil Armstrong, Robert Foss, David Airlie,
	Daniel Vetter
  Cc: Biju Das, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Uwe Kleine-König, Douglas Anderson, Zhu Wang, dri-devel,
	linux-kernel, Andy Shevchenko

This patch series aims to drop ID table and conditionals around of_node pointers for anx78xx driver.

While at it, drop conditionals from drm_bridge.h.

v4->v5:
 * Added Rb tag from Andy and Helen for patch#1.
 * Split patch#2 into two
 * Added struct device_node forward declaration for patch#2.
 * Updated commit description for patch#2
v3->v4:
 * Created patch#2 for dropping conditionals around of_node pointers.
 * Added Rb tag from Laurent and Douglas Anderson for patch#1.
v2->v3:
 * Updated commit header.
v1->v2:
 * Dropped ID table support.

Biju Das (3):
  drm/bridge/analogix/anx78xx: Drop ID table
  drm/bridge: Drop conditionals around of_node pointers
  drm/bridge/analogix/anx78xx: Drop conditionals around of_node pointers

 drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 9 ---------
 include/drm/drm_bridge.h                           | 4 ++--
 2 files changed, 2 insertions(+), 11 deletions(-)

-- 
2.25.1


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

* [PATCH v5 1/3] drm/bridge/analogix/anx78xx: Drop ID table
  2023-08-30 17:08 [PATCH v5 0/3] Drop ID table and conditionals around of_node pointers for anx78xx driver Biju Das
@ 2023-08-30 17:08 ` Biju Das
  2023-08-30 17:08 ` [PATCH v5 2/3] drm/bridge: Drop conditionals around of_node pointers Biju Das
  2023-08-30 17:08 ` [PATCH v5 3/3] drm/bridge/analogix/anx78xx: " Biju Das
  2 siblings, 0 replies; 9+ messages in thread
From: Biju Das @ 2023-08-30 17:08 UTC (permalink / raw)
  To: Andrzej Hajda, Neil Armstrong, Robert Foss, David Airlie,
	Daniel Vetter
  Cc: Biju Das, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Douglas Anderson, Uwe Kleine-König, Zhu Wang, dri-devel,
	linux-kernel, Andy Shevchenko, Laurent Pinchart, Helen Koike

The driver has an ID table, but it uses the wrong API for retrieving match
data and that will lead to a crash, if it is instantiated by user space or
using ID. From this, there is no user for the ID table and let's drop it
from the driver as it saves some memory.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Helen Koike <helen.koike@collabora.com>
---
v4->v5:
 * Added Rb tag from Andy and Helen.
v3->v4:
 * Added Rb tag from Laurent and Douglas Anderson.
v2->v3:
 * Updated commit header.
v1->v2:
 * Dropped ID table support.
---
 drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
index 800555aef97f..6169db73d2fe 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
@@ -1367,12 +1367,6 @@ static void anx78xx_i2c_remove(struct i2c_client *client)
 	kfree(anx78xx->edid);
 }
 
-static const struct i2c_device_id anx78xx_id[] = {
-	{ "anx7814", 0 },
-	{ /* sentinel */ }
-};
-MODULE_DEVICE_TABLE(i2c, anx78xx_id);
-
 static const struct of_device_id anx78xx_match_table[] = {
 	{ .compatible = "analogix,anx7808", .data = anx7808_i2c_addresses },
 	{ .compatible = "analogix,anx7812", .data = anx781x_i2c_addresses },
@@ -1389,7 +1383,6 @@ static struct i2c_driver anx78xx_driver = {
 		  },
 	.probe = anx78xx_i2c_probe,
 	.remove = anx78xx_i2c_remove,
-	.id_table = anx78xx_id,
 };
 module_i2c_driver(anx78xx_driver);
 
-- 
2.25.1


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

* [PATCH v5 2/3] drm/bridge: Drop conditionals around of_node pointers
  2023-08-30 17:08 [PATCH v5 0/3] Drop ID table and conditionals around of_node pointers for anx78xx driver Biju Das
  2023-08-30 17:08 ` [PATCH v5 1/3] drm/bridge/analogix/anx78xx: Drop ID table Biju Das
@ 2023-08-30 17:08 ` Biju Das
  2023-08-30 19:51   ` Doug Anderson
  2023-08-30 20:38   ` Laurent Pinchart
  2023-08-30 17:08 ` [PATCH v5 3/3] drm/bridge/analogix/anx78xx: " Biju Das
  2 siblings, 2 replies; 9+ messages in thread
From: Biju Das @ 2023-08-30 17:08 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Andrzej Hajda, Neil Armstrong, Robert Foss, David Airlie,
	Daniel Vetter
  Cc: Biju Das, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	dri-devel, linux-kernel, Andy Shevchenko, Douglas Anderson

The commit c9e358dfc4a8 ("driver-core: remove conditionals around
devicetree pointers") supposed to remove conditionals around of_node
pointer, but it missed out drm/bridge.h. So drop #if conditionals by
adding struct device_node forward declaration.

Suggested-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v5:
 * Split from patch#2
 * Updated commit description
 * Added struct device_node forward declaration.
---
 include/drm/drm_bridge.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index c339fc85fd07..843736627f60 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -32,6 +32,8 @@
 #include <drm/drm_mode_object.h>
 #include <drm/drm_modes.h>
 
+struct device_node;
+
 struct drm_bridge;
 struct drm_bridge_timings;
 struct drm_connector;
@@ -716,10 +718,8 @@ struct drm_bridge {
 	struct drm_encoder *encoder;
 	/** @chain_node: used to form a bridge chain */
 	struct list_head chain_node;
-#ifdef CONFIG_OF
 	/** @of_node: device node pointer to the bridge */
 	struct device_node *of_node;
-#endif
 	/** @list: to keep track of all added bridges */
 	struct list_head list;
 	/**
-- 
2.25.1


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

* [PATCH v5 3/3] drm/bridge/analogix/anx78xx: Drop conditionals around of_node pointers
  2023-08-30 17:08 [PATCH v5 0/3] Drop ID table and conditionals around of_node pointers for anx78xx driver Biju Das
  2023-08-30 17:08 ` [PATCH v5 1/3] drm/bridge/analogix/anx78xx: Drop ID table Biju Das
  2023-08-30 17:08 ` [PATCH v5 2/3] drm/bridge: Drop conditionals around of_node pointers Biju Das
@ 2023-08-30 17:08 ` Biju Das
  2023-08-30 19:53   ` Doug Anderson
  2023-08-30 20:41   ` Laurent Pinchart
  2 siblings, 2 replies; 9+ messages in thread
From: Biju Das @ 2023-08-30 17:08 UTC (permalink / raw)
  To: Andrzej Hajda, Neil Armstrong, Robert Foss, David Airlie,
	Daniel Vetter
  Cc: Biju Das, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Uwe Kleine-König, Douglas Anderson, Zhu Wang, dri-devel,
	linux-kernel, Andy Shevchenko

Having conditional around the of_node pointers turns out to make driver
code use ugly #ifdef and #if blocks. So drop the conditionals.

Suggested-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v5:
 * Split from patch#2
---
 drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
index 6169db73d2fe..ad8241758896 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
@@ -1231,9 +1231,7 @@ static int anx78xx_i2c_probe(struct i2c_client *client)
 
 	mutex_init(&anx78xx->lock);
 
-#if IS_ENABLED(CONFIG_OF)
 	anx78xx->bridge.of_node = client->dev.of_node;
-#endif
 
 	anx78xx->client = client;
 	i2c_set_clientdata(client, anx78xx);
-- 
2.25.1


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

* Re: [PATCH v5 2/3] drm/bridge: Drop conditionals around of_node pointers
  2023-08-30 17:08 ` [PATCH v5 2/3] drm/bridge: Drop conditionals around of_node pointers Biju Das
@ 2023-08-30 19:51   ` Doug Anderson
  2023-08-30 20:38   ` Laurent Pinchart
  1 sibling, 0 replies; 9+ messages in thread
From: Doug Anderson @ 2023-08-30 19:51 UTC (permalink / raw)
  To: Biju Das
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Andrzej Hajda, Neil Armstrong, Robert Foss, David Airlie,
	Daniel Vetter, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	dri-devel, linux-kernel, Andy Shevchenko

Hi,

On Wed, Aug 30, 2023 at 10:08 AM Biju Das <biju.das.jz@bp.renesas.com> wrote:
>
> The commit c9e358dfc4a8 ("driver-core: remove conditionals around
> devicetree pointers") supposed to remove conditionals around of_node
> pointer, but it missed out drm/bridge.h. So drop #if conditionals by
> adding struct device_node forward declaration.
>
> Suggested-by: Douglas Anderson <dianders@chromium.org>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v5:
>  * Split from patch#2
>  * Updated commit description
>  * Added struct device_node forward declaration.
> ---
>  include/drm/drm_bridge.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Douglas Anderson <dianders@chromium.org>

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

* Re: [PATCH v5 3/3] drm/bridge/analogix/anx78xx: Drop conditionals around of_node pointers
  2023-08-30 17:08 ` [PATCH v5 3/3] drm/bridge/analogix/anx78xx: " Biju Das
@ 2023-08-30 19:53   ` Doug Anderson
  2023-08-30 20:41   ` Laurent Pinchart
  1 sibling, 0 replies; 9+ messages in thread
From: Doug Anderson @ 2023-08-30 19:53 UTC (permalink / raw)
  To: Biju Das
  Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, David Airlie,
	Daniel Vetter, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Uwe Kleine-König, Zhu Wang, dri-devel, linux-kernel,
	Andy Shevchenko

Hi,

On Wed, Aug 30, 2023 at 10:08 AM Biju Das <biju.das.jz@bp.renesas.com> wrote:
>
> Having conditional around the of_node pointers turns out to make driver
> code use ugly #ifdef and #if blocks. So drop the conditionals.
>
> Suggested-by: Douglas Anderson <dianders@chromium.org>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v5:
>  * Split from patch#2
> ---
>  drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 2 --
>  1 file changed, 2 deletions(-)

Reviewed-by: Douglas Anderson <dianders@chromium.org>

My current plan, assuming no objections, will be to apply all 3
patches to drm-misc-next in about a week. I'd also be fine if someone
else wanted to apply then. ;-)

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

* Re: [PATCH v5 2/3] drm/bridge: Drop conditionals around of_node pointers
  2023-08-30 17:08 ` [PATCH v5 2/3] drm/bridge: Drop conditionals around of_node pointers Biju Das
  2023-08-30 19:51   ` Doug Anderson
@ 2023-08-30 20:38   ` Laurent Pinchart
  1 sibling, 0 replies; 9+ messages in thread
From: Laurent Pinchart @ 2023-08-30 20:38 UTC (permalink / raw)
  To: Biju Das
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Andrzej Hajda, Neil Armstrong, Robert Foss, David Airlie,
	Daniel Vetter, Jonas Karlman, Jernej Skrabec, dri-devel,
	linux-kernel, Andy Shevchenko, Douglas Anderson

Hi Biju,

Thank you for the patch.

In the commit message, s/pointers/pointer/ as you're only touching a
single one.

On Wed, Aug 30, 2023 at 06:08:18PM +0100, Biju Das wrote:
> The commit c9e358dfc4a8 ("driver-core: remove conditionals around
> devicetree pointers") supposed to remove conditionals around of_node
> pointer, but it missed out drm/bridge.h. So drop #if conditionals by
> adding struct device_node forward declaration.

You can hardly blame commit c9e358dfc4a8 for forgetting drm_bridge, as
that commit dates back from 2011 and the drm_bridge of_node field was
added in 2015 :-)

I would simply copy the rationale from the commit message of
c9e358dfc4a8 and write something like

--------
Having conditional around the of_node pointer of the drm_bridge
structure turns out to make driver code use ugly #ifdef blocks. Drop the
conditionals to simplify drivers. While this slightly increases the size
of struct drm_bridge on non-OF system, the number of bridges used today
and foreseen tomorrow on those systems is very low, so this shouldn't be
an issue.
--------

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

> Suggested-by: Douglas Anderson <dianders@chromium.org>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

> ---
> v5:
>  * Split from patch#2
>  * Updated commit description
>  * Added struct device_node forward declaration.
> ---
>  include/drm/drm_bridge.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
> index c339fc85fd07..843736627f60 100644
> --- a/include/drm/drm_bridge.h
> +++ b/include/drm/drm_bridge.h
> @@ -32,6 +32,8 @@
>  #include <drm/drm_mode_object.h>
>  #include <drm/drm_modes.h>
>  
> +struct device_node;
> +
>  struct drm_bridge;
>  struct drm_bridge_timings;
>  struct drm_connector;
> @@ -716,10 +718,8 @@ struct drm_bridge {
>  	struct drm_encoder *encoder;
>  	/** @chain_node: used to form a bridge chain */
>  	struct list_head chain_node;
> -#ifdef CONFIG_OF
>  	/** @of_node: device node pointer to the bridge */
>  	struct device_node *of_node;
> -#endif
>  	/** @list: to keep track of all added bridges */
>  	struct list_head list;
>  	/**

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH v5 3/3] drm/bridge/analogix/anx78xx: Drop conditionals around of_node pointers
  2023-08-30 17:08 ` [PATCH v5 3/3] drm/bridge/analogix/anx78xx: " Biju Das
  2023-08-30 19:53   ` Doug Anderson
@ 2023-08-30 20:41   ` Laurent Pinchart
  2023-08-31  6:52     ` Biju Das
  1 sibling, 1 reply; 9+ messages in thread
From: Laurent Pinchart @ 2023-08-30 20:41 UTC (permalink / raw)
  To: Biju Das
  Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, David Airlie,
	Daniel Vetter, Jonas Karlman, Jernej Skrabec,
	Uwe Kleine-König, Douglas Anderson, Zhu Wang, dri-devel,
	linux-kernel, Andy Shevchenko

Hi Biju,

Thank you for the patch.

On Wed, Aug 30, 2023 at 06:08:19PM +0100, Biju Das wrote:
> Having conditional around the of_node pointers turns out to make driver
> code use ugly #ifdef and #if blocks. So drop the conditionals.

How about doing this for all bridge drivers in one go ?

> Suggested-by: Douglas Anderson <dianders@chromium.org>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v5:
>  * Split from patch#2
> ---
>  drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
> index 6169db73d2fe..ad8241758896 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
> @@ -1231,9 +1231,7 @@ static int anx78xx_i2c_probe(struct i2c_client *client)
>  
>  	mutex_init(&anx78xx->lock);
>  
> -#if IS_ENABLED(CONFIG_OF)
>  	anx78xx->bridge.of_node = client->dev.of_node;
> -#endif
>  
>  	anx78xx->client = client;
>  	i2c_set_clientdata(client, anx78xx);

-- 
Regards,

Laurent Pinchart

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

* RE: [PATCH v5 3/3] drm/bridge/analogix/anx78xx: Drop conditionals around of_node pointers
  2023-08-30 20:41   ` Laurent Pinchart
@ 2023-08-31  6:52     ` Biju Das
  0 siblings, 0 replies; 9+ messages in thread
From: Biju Das @ 2023-08-31  6:52 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, David Airlie,
	Daniel Vetter, Jonas Karlman, Jernej Skrabec,
	Uwe Kleine-König, Douglas Anderson, Zhu Wang,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Andy Shevchenko

Hi Laurent,

Thanks for the feedback.

> Subject: Re: [PATCH v5 3/3] drm/bridge/analogix/anx78xx: Drop conditionals
> around of_node pointers
> 
> Hi Biju,
> 
> Thank you for the patch.
> 
> On Wed, Aug 30, 2023 at 06:08:19PM +0100, Biju Das wrote:
> > Having conditional around the of_node pointers turns out to make
> > driver code use ugly #ifdef and #if blocks. So drop the conditionals.
> 
> How about doing this for all bridge drivers in one go ?

I will send separate patch for that one later.

Will send V6 with changes suggested for patch#2 first and then will investigate creating patch for dropping conditionals for remaining bridge drivers.

Cheers,
Biju

> 
> > Suggested-by: Douglas Anderson <dianders@chromium.org>
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> > v5:
> >  * Split from patch#2
> > ---
> >  drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 2 --
> >  1 file changed, 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
> > b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
> > index 6169db73d2fe..ad8241758896 100644
> > --- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
> > +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
> > @@ -1231,9 +1231,7 @@ static int anx78xx_i2c_probe(struct i2c_client
> > *client)
> >
> >  	mutex_init(&anx78xx->lock);
> >
> > -#if IS_ENABLED(CONFIG_OF)
> >  	anx78xx->bridge.of_node = client->dev.of_node; -#endif
> >
> >  	anx78xx->client = client;
> >  	i2c_set_clientdata(client, anx78xx);
> 
> --
> Regards,
> 
> Laurent Pinchart

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

end of thread, other threads:[~2023-08-31  6:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-30 17:08 [PATCH v5 0/3] Drop ID table and conditionals around of_node pointers for anx78xx driver Biju Das
2023-08-30 17:08 ` [PATCH v5 1/3] drm/bridge/analogix/anx78xx: Drop ID table Biju Das
2023-08-30 17:08 ` [PATCH v5 2/3] drm/bridge: Drop conditionals around of_node pointers Biju Das
2023-08-30 19:51   ` Doug Anderson
2023-08-30 20:38   ` Laurent Pinchart
2023-08-30 17:08 ` [PATCH v5 3/3] drm/bridge/analogix/anx78xx: " Biju Das
2023-08-30 19:53   ` Doug Anderson
2023-08-30 20:41   ` Laurent Pinchart
2023-08-31  6:52     ` Biju Das

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox