[lkml]   [2012]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCHv5] Input: keypad: Add smsc ece1099 keypad driver
On Mon, Oct 29, 2012 at 09:05:53PM +0200, Felipe Balbi wrote:
> Hi,
> On Mon, Oct 29, 2012 at 10:06:33AM -0700, Dmitry Torokhov wrote:
> [ big snip ]
> > > > +static int __devexit smsc_remove(struct platform_device *pdev)
> > > > +{
> > >
> > > shouldn't you unregister the input device here ??
> >
> > And that is why I do not like devm_* interface myself... But no, since
> > input device was allocated with devm_input_allocate_device() it does not
> > need to be explicitly freed or unregistered.
> IMHO, that's a fragility on current devm implementation for input
> devices, then.
> devm_input_allocate_device() is *only* allocating the input device (at
> least judging by the name). Looks like you should introduce
> devm_input_register_device() ? What happens if I
> devm_input_allocate_device() but don't go as far as
> input_register_device() (some error happens in-between) ?

It will be freed automatically.

> I'm sure you have some proper handling for it, but it's quite misleading
> the way this was implemented.

Well, I could add devm_input_register_device(),
devm_input_unregister_device(), devm_input_free_device() and then add
checks to "normal" input_register_device(), input_unregister_device()
and input_free_device() to throw warnings and errors if they are used
with managed resources, and similarly add checks to devm_* API so that
they are not called with unmanaged devices and make a big mess out of

_OR_ I could just add one new call devm_input_allocate_device() to
create managed input devices and make the rest of old API work with both
managed and unmanaged input devices. I think the latter is much better.



 \ /
  Last update: 2012-10-30 02:01    [W:0.059 / U:0.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site