Thread (67 messages) 67 messages, 5 authors, 2012-09-12

Re: [PATCH can-next v3 1/2] can: add tx/rx LED trigger support

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2012-07-31 12:00:42
Also in: lkml

On 07/31/2012 01:57 PM, Fabio Baltieri wrote:
[...]
quoted
quoted
quoted
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   |

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help