linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: oskar.andero@sonyericsson.com,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"jic23@cam.ac.uk" <jic23@cam.ac.uk>,
	"aghayal@codeaurora.org" <aghayal@codeaurora.org>,
	"Cavin, Courtney" <Courtney.Cavin@sonyericsson.com>
Subject: Re: [PATCH v2] input: add driver support for Sharp gp2ap002a00f proximity sensor
Date: Tue, 15 Nov 2011 10:34:55 +0200	[thread overview]
Message-ID: <20111115083454.GE6492@legolas.emea.dhcp.ti.com> (raw)
In-Reply-To: <20111115082926.GA13157@core.coreip.homeip.net>

[-- Attachment #1: Type: text/plain, Size: 1446 bytes --]

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

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2011-11-15  8:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-14 15:39 [PATCH v2] input: add driver support for Sharp gp2ap002a00f proximity sensor oskar.andero
2011-11-14 17:03 ` Dmitry Torokhov
2011-11-15  7:34   ` oskar.andero
2011-11-16 15:39     ` anish kumar
2011-11-16 15:56       ` oskar.andero
2011-11-16 16:20         ` anish kumar
2011-11-16 16:50       ` Dmitry Torokhov
2011-11-15  7:56   ` oskar.andero
2011-11-15  8:29     ` Dmitry Torokhov
2011-11-15  8:34       ` Felipe Balbi [this message]
2011-11-15  8:46         ` Dmitry Torokhov
2011-11-15  8:47           ` Felipe Balbi
     [not found] ` <CAM=Q2cvH4gb5+=+ijE_d_ejoMCPikqd4g4uSw9T-z2yqDZCN+Q@mail.gmail.com>
2011-11-15  6:50   ` oskar.andero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111115083454.GE6492@legolas.emea.dhcp.ti.com \
    --to=balbi@ti.com \
    --cc=Courtney.Cavin@sonyericsson.com \
    --cc=aghayal@codeaurora.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jic23@cam.ac.uk \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oskar.andero@sonyericsson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).