From: Dmitry Torokhov <dtor_core@ameritech.net>
To: Vojtech Pavlik <vojtech@suse.cz>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 7/8] Psmouse - add packet size
Date: Wed, 29 Sep 2004 02:29:28 -0500 [thread overview]
Message-ID: <200409290229.28652.dtor_core@ameritech.net> (raw)
In-Reply-To: <20040929071504.GB2648@ucw.cz>
On Wednesday 29 September 2004 02:15 am, Vojtech Pavlik wrote:
> On Wed, Sep 29, 2004 at 01:47:34AM -0500, Dmitry Torokhov wrote:
>
> > -int alps_detect(struct psmouse *psmouse)
> > +int alps_detect(struct psmouse *psmouse, int set_properties)
> > {
> > - return alps_get_model(psmouse) < 0 ? 0 : 1;
> > + if (alps_get_model(psmouse) < 0)
> > + return 0;
> > +
> > + if (set_properties) {
> > + psmouse->vendor = "ALPS";
> > + psmouse->name = "TouchPad";
> > + }
> > + return 1;
> > }
>
> I think we should return -1 (or -errno) on failure and 0 on success,
> like everybody else does.
>
All *detect functions return boolean value - either the device was detected or
not. I think it makes most sense. Negative error is convenient when function
normally returns some other meaningful value, like length. *detect is a simple
yes/no question, it is not really an error at all.
>
> This should be:
>
> if (param[0] != 3)
> return -1;
> if (set_properties) {
> set_bit(REL_WHEEL, psmouse->dev.relbit);
> if (!psmouse->vendor) psmouse->vendor = "Generic";
> if (!psmouse->name) psmouse->name = "Wheel Mouse";
> psmouse->pktsize = 4;
> }
> return 0;
>
> ... and similarly elsewhere. You save one level of nesting and it makes
> more sense.
>
Ok, will change.
--
Dmitry
next prev parent reply other threads:[~2004-09-29 7:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-29 6:40 [PATCH 0/8] Set of input (psmouse) patches Dmitry Torokhov
2004-09-29 6:41 ` [PATCH 1/8] New ALPS signature Dmitry Torokhov
2004-09-29 6:42 ` [PATCH 2/8] Psmouse rate and resolution handlers Dmitry Torokhov
2004-09-29 6:43 ` [PATCH 3/8] Guest protocol switch in synaptics Dmitry Torokhov
2004-09-29 6:44 ` [PATCH 4/8] Psmouse probe fixes Dmitry Torokhov
2004-09-29 6:44 ` [PATCH 5/8] Export psmouse parameters via sysfs Dmitry Torokhov
2004-09-29 6:45 ` [PATCH 6/8] Drop PS2TPP protocol identifier Dmitry Torokhov
2004-09-29 6:46 ` [PATCH 7/8] Separate PS2PP protocol handling Dmitry Torokhov
2004-09-29 6:47 ` [PATCH 7/8] Psmouse - add packet size Dmitry Torokhov
2004-09-29 7:15 ` Vojtech Pavlik
2004-09-29 7:29 ` Dmitry Torokhov [this message]
2004-09-29 9:31 ` Vojtech Pavlik
2004-09-29 13:24 ` Dmitry Torokhov
2004-09-29 13:38 ` Vojtech Pavlik
2004-09-30 6:43 ` Dmitry Torokhov
2004-09-30 7:55 ` Vojtech Pavlik
2004-09-30 10:34 ` Jan-Benedict Glaw
2004-09-29 7:11 ` [PATCH 0/8] Set of input (psmouse) patches Vojtech Pavlik
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=200409290229.28652.dtor_core@ameritech.net \
--to=dtor_core@ameritech.net \
--cc=linux-kernel@vger.kernel.org \
--cc=vojtech@suse.cz \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.