Re: [PATCH v2] input: PCAP2 based touchscreen driver

From: Mark Brown
Date: Tue Aug 04 2009 - 17:04:07 EST


On Tue, Aug 04, 2009 at 10:52:47PM +0200, Antonio Ospite wrote:
> Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> wrote:

> > > +static int __devinit pcap_ts_probe(struct platform_device *pdev)
> > > +{
> > > + struct input_dev *input_dev;
> > > + struct pcap_ts *pcap_ts;
> > > + int err = -ENOMEM;
> > > +
> > > + pcap_ts = kzalloc(sizeof(*pcap_ts), GFP_KERNEL);
> > > + if (!pcap_ts)
> > > + return err;
> > > +
> > > + pcap_ts->pcap = platform_get_drvdata(pdev);
> > > + platform_set_drvdata(pdev, pcap_ts);

> > Ewww... Don't mess with data that does not belong to you. Also I don't
> > see where you restore it so after unloading the driver reload with
> > probably lead to "inetersting" results.

> Dmitry can you suggest a better way to make the pcap_ts pointer get to
> pcap_ts_remove()? We need it in order to remove the input device.
> Or keeping this hack, restoring the original value on remove, can be
> acceptable?

> We will have to fix this also in all other pcap subdrivers.

Two options from other MFDs:

- Include the data for the input device in the main pcap data; this
removes the need to faff around with the
- Always find the main pcap data by using dev_get_drvdata() on the
parent device of the child, perhaps keeping a copy of a pointer to
it in the local data for simplicity.
--
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/