Re: [PATCH 1/1] Input: STMicroelectronics multi touch capacitivetouchscreen ftk

From: Joe Perches
Date: Fri Nov 30 2012 - 10:40:44 EST


On Fri, 2012-11-30 at 17:04 +0200, Felipe Balbi wrote:
> On Fri, Nov 30, 2012 at 09:18:54AM -0500, Li Wu wrote:
> > This is a initial driver for STMicroelectronics multi touch
> > capacitive touchscren FingertipK. It supports maximum 10 fingers,
> > based on I2C interface.
[]
> diff --git a/drivers/input/touchscreen/ftk.c b/drivers/input/touchscreen/ftk.c
[]
> > +static int stm_ts_probe(struct i2c_client *client,
> > + const struct i2c_device_id *idp)
> > +{
[]
> > + ftk_ts->dev = &ftk_ts->client->dev;
> > + ftk_ts->input_dev = input_allocate_device();

It'd be nicer to use a temporary "dev"

> > + ftk_ts->input_dev->dev.parent = &client->dev;
> > + if (!ftk_ts->input_dev) {
> > + dev_err(ftk_ts->dev, "err = ENOMEM!\n");
> > + err = ENOMEM;
> > + goto fail;
> > + }

Put the dev_parent assign after the error check.

> > + ftk_ts->input_dev->name = "ftk";
> > + ftk_ts->input_dev->phys = "ftk/input0";
> > + ftk_ts->input_dev->id.bustype = BUS_I2C;
> > + ftk_ts->input_dev->id.vendor = 0x0001;
> > + ftk_ts->input_dev->id.product = 0x0002;
> > + ftk_ts->input_dev->id.version = 0x0100;

All of these would be a lot shorter and likely fit on
a single line with just
dev->name = "ftk";
etc..


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/