[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5017C8E4.4020003@pengutronix.de>
Date: Tue, 31 Jul 2012 14:00:36 +0200
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Fabio Baltieri <fabio.baltieri@...il.com>
CC: linux-can@...r.kernel.org, linux-kernel@...r.kernel.org,
Oliver Hartkopp <socketcan@...tkopp.net>,
Wolfgang Grandegger <wg@...ndegger.com>
Subject: Re: [PATCH can-next v3 1/2] can: add tx/rx LED trigger support
On 07/31/2012 01:57 PM, Fabio Baltieri wrote:
[...]
>>>> Can you provide a devm implementation for can_led?
>>>
>>> Sounds reasonable, you mean like a devm_kasprintf implementation to
>>> remove kfree and unwinding code?
>>
>> IMHO it would be sufficient if you implement the devm cleanup functions
>> here.
>
> Uh - can you be more specific? I mean, are you suggesting to just
> convert the code to something like:
>
> unsigned int len;
> char *p;
>
> len = snprintf(NULL, 0, "%s-tx", netdev->name);
> p = devm_kzalloc(&netdev->dev, len + 1, GFP_KERNEL);
> if (!p)
> return -ENOMEM;
> sprintf(p, len + 1, "%s-tx", netdev->name);
This would work, if you just have to free both names, but...
> or to implement something with devres_alloc() and a specific
> release function?
...you have to call led_trigger_unregister_simple(), so we need a custom
release function.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
Download attachment "signature.asc" of type "application/pgp-signature" (263 bytes)
Powered by blists - more mailing lists