lkml.org 
[lkml]   [2011]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] input: add driver support for Sharp gp2ap002a00f proximity sensor
Hi,

On Tue, Nov 15, 2011 at 12:29:26AM -0800, Dmitry Torokhov wrote:
> > > > + error = input_register_device(dt->device);
> > > > + if (error) {
> > > > + dev_err(&dt->device->dev, "device registration failed\n");
> > > > + input_free_device(dt->device);
> > >
> > > If you swap request_threaded_irq() and input_register_device() so that
> > > registration is the last action error handling will be much simpler.
> > >
> >
> > I am getting a bit confused here, since you asked me to swap the order
> > of request_threaded_irq() and input_register_device() in my previous
> > version as well. Swapping again will take us back to square one or maybe
> > I am misinterpreting your comment?
>
> Gah, sorry, a bit of boilerplate slipped in. You already have the calls
> in right order, you just need proper labels.
>
>
> input_dev = input_allocate_device();
> if (!input_dev) {
> dev_err(...);
> error = -ENOMEM;
> goto err_free_mem;
> }
>
> ... set up input device fully ...
>
> error = request_threaded_irq(...);
> if (error) {
> dev_err(...);
> goto err_free_input_dev;
> }
>
> error = input_register_device(input_dev);
> if (error) {
> dev_err(...);
> goto err_free_irq;
> }

are you sure this is right order ? Won't this create a very small
timeframe where we could try to call input_report_switch() and
input_sync() on an unregistered input device ??

--
balbi
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2011-11-15 09:37    [W:0.068 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site