[PATCH 02/34] platform: arm64: acer-aspire1-ec: convert to devm_drm_bridge_alloc() API

Luca Ceresoli posted 34 patches 10 months, 1 week ago
There is a newer version of this series
[PATCH 02/34] platform: arm64: acer-aspire1-ec: convert to devm_drm_bridge_alloc() API
Posted by Luca Ceresoli 10 months, 1 week ago
This is the new API for allocating DRM bridges.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

---

Cc: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/arm64/acer-aspire1-ec.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/arm64/acer-aspire1-ec.c b/drivers/platform/arm64/acer-aspire1-ec.c
index 958fe1bf5f85bb69ac7962f217de9f0b40cde9a1..438532a047e68799ac53a16a4c813fc16be997b9 100644
--- a/drivers/platform/arm64/acer-aspire1-ec.c
+++ b/drivers/platform/arm64/acer-aspire1-ec.c
@@ -452,9 +452,9 @@ static int aspire_ec_probe(struct i2c_client *client)
 	int ret;
 	u8 tmp;
 
-	ec = devm_kzalloc(dev, sizeof(*ec), GFP_KERNEL);
-	if (!ec)
-		return -ENOMEM;
+	ec = devm_drm_bridge_alloc(dev, struct aspire_ec, bridge, &aspire_ec_bridge_funcs);
+	if (IS_ERR(ec))
+		return PTR_ERR(ec);
 
 	ec->client = client;
 	i2c_set_clientdata(client, ec);
@@ -497,7 +497,6 @@ static int aspire_ec_probe(struct i2c_client *client)
 	fwnode = device_get_named_child_node(dev, "connector");
 	if (fwnode) {
 		INIT_WORK(&ec->work, aspire_ec_bridge_update_hpd_work);
-		ec->bridge.funcs = &aspire_ec_bridge_funcs;
 		ec->bridge.of_node = to_of_node(fwnode);
 		ec->bridge.ops = DRM_BRIDGE_OP_HPD;
 		ec->bridge.type = DRM_MODE_CONNECTOR_USB;

-- 
2.49.0

Re: [PATCH 02/34] platform: arm64: acer-aspire1-ec: convert to devm_drm_bridge_alloc() API
Posted by Ilpo Järvinen 10 months, 1 week ago
On Mon, 7 Apr 2025, Luca Ceresoli wrote:

> This is the new API for allocating DRM bridges.
> 
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> 
> ---
> 
> Cc: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
> Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
> Cc: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/platform/arm64/acer-aspire1-ec.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/platform/arm64/acer-aspire1-ec.c b/drivers/platform/arm64/acer-aspire1-ec.c
> index 958fe1bf5f85bb69ac7962f217de9f0b40cde9a1..438532a047e68799ac53a16a4c813fc16be997b9 100644
> --- a/drivers/platform/arm64/acer-aspire1-ec.c
> +++ b/drivers/platform/arm64/acer-aspire1-ec.c
> @@ -452,9 +452,9 @@ static int aspire_ec_probe(struct i2c_client *client)
>  	int ret;
>  	u8 tmp;
>  
> -	ec = devm_kzalloc(dev, sizeof(*ec), GFP_KERNEL);
> -	if (!ec)
> -		return -ENOMEM;
> +	ec = devm_drm_bridge_alloc(dev, struct aspire_ec, bridge, &aspire_ec_bridge_funcs);
> +	if (IS_ERR(ec))
> +		return PTR_ERR(ec);
>  
>  	ec->client = client;
>  	i2c_set_clientdata(client, ec);
> @@ -497,7 +497,6 @@ static int aspire_ec_probe(struct i2c_client *client)
>  	fwnode = device_get_named_child_node(dev, "connector");
>  	if (fwnode) {
>  		INIT_WORK(&ec->work, aspire_ec_bridge_update_hpd_work);
> -		ec->bridge.funcs = &aspire_ec_bridge_funcs;
>  		ec->bridge.of_node = to_of_node(fwnode);
>  		ec->bridge.ops = DRM_BRIDGE_OP_HPD;
>  		ec->bridge.type = DRM_MODE_CONNECTOR_USB;

Hi Luca,

It took a while to locate where the code for the new helper is. I suggest 
if you need send another version of the series directly linking to the 
commit in the cover letter so that it won't take multiple hoops to find it 
if one wants to review the code and is not having all drm trees easily at 
hand. Here it is for the benefit of other pdx86 people:

https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/0cc6aadd7fc1e629b715ea3d1ba537ef2da95eec


Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

I assume you want this to go through the drm tree where the helper already 
is?

-- 
 i.
Re: [PATCH 02/34] platform: arm64: acer-aspire1-ec: convert to devm_drm_bridge_alloc() API
Posted by Luca Ceresoli 10 months, 1 week ago
Hello Ilpo,

On Mon, 7 Apr 2025 19:46:59 +0300 (EEST)
Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> wrote:

> On Mon, 7 Apr 2025, Luca Ceresoli wrote:
> 
> > This is the new API for allocating DRM bridges.
> > 
> > Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> > 
> > ---
> > 
> > Cc: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
> > Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
> > Cc: Hans de Goede <hdegoede@redhat.com>
> > ---
> >  drivers/platform/arm64/acer-aspire1-ec.c | 7 +++----
> >  1 file changed, 3 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/platform/arm64/acer-aspire1-ec.c b/drivers/platform/arm64/acer-aspire1-ec.c
> > index 958fe1bf5f85bb69ac7962f217de9f0b40cde9a1..438532a047e68799ac53a16a4c813fc16be997b9 100644
> > --- a/drivers/platform/arm64/acer-aspire1-ec.c
> > +++ b/drivers/platform/arm64/acer-aspire1-ec.c
> > @@ -452,9 +452,9 @@ static int aspire_ec_probe(struct i2c_client *client)
> >  	int ret;
> >  	u8 tmp;
> >  
> > -	ec = devm_kzalloc(dev, sizeof(*ec), GFP_KERNEL);
> > -	if (!ec)
> > -		return -ENOMEM;
> > +	ec = devm_drm_bridge_alloc(dev, struct aspire_ec, bridge, &aspire_ec_bridge_funcs);
> > +	if (IS_ERR(ec))
> > +		return PTR_ERR(ec);
> >  
> >  	ec->client = client;
> >  	i2c_set_clientdata(client, ec);
> > @@ -497,7 +497,6 @@ static int aspire_ec_probe(struct i2c_client *client)
> >  	fwnode = device_get_named_child_node(dev, "connector");
> >  	if (fwnode) {
> >  		INIT_WORK(&ec->work, aspire_ec_bridge_update_hpd_work);
> > -		ec->bridge.funcs = &aspire_ec_bridge_funcs;
> >  		ec->bridge.of_node = to_of_node(fwnode);
> >  		ec->bridge.ops = DRM_BRIDGE_OP_HPD;
> >  		ec->bridge.type = DRM_MODE_CONNECTOR_USB;  
> 
> Hi Luca,
> 
> It took a while to locate where the code for the new helper is. I suggest 
> if you need send another version of the series directly linking to the 
> commit in the cover letter so that it won't take multiple hoops to find it 
> if one wants to review the code and is not having all drm trees easily at 
> hand. Here it is for the benefit of other pdx86 people:
> 
> https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/0cc6aadd7fc1e629b715ea3d1ba537ef2da95eec

Apologies, indeed you have a good point. I added the link to the cover
letter so it will be in v2, if any.

> Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Thanks!

> I assume you want this to go through the drm tree where the helper already 
> is?

MY best guess is that drm-misc-next is the appropriate branch, and it
is where the helper is already present, but I'll let maintainers decide
what is most appropriate.

Luca

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com