diff mbox series

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

Message ID 20250407-drm-bridge-convert-to-alloc-api-v1-2-42113ff8d9c0@bootlin.com (mailing list archive)
State New
Headers show
Series None | expand

Commit Message

Luca Ceresoli April 7, 2025, 2:23 p.m. UTC
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(-)

Comments

Ilpo Järvinen April 7, 2025, 4:46 p.m. UTC | #1
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?
diff mbox series

Patch

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;