Messages in this thread |  | | | Date | Wed, 29 Sep 2004 09:15:04 +0200 | | From | Vojtech Pavlik <> | | Subject | Re: [PATCH 7/8] Psmouse - add packet size |
| |
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.
> - return param[0] == 3; > + if (param[0] == 3) { > + 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 1; > + } > + return 0; > }
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.
-- Vojtech Pavlik SuSE Labs, SuSE CR - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |