[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200521061248.GY89269@dtor-ws>
Date: Wed, 20 May 2020 23:12:48 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Sebastian Reichel <sebastian.reichel@...labora.com>
Cc: Ahmet Inan <inan@...tec.de>,
Martin Fuzzey <martin.fuzzey@...wbird.group>,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel@...labora.com
Subject: Re: [PATCHv3 3/5] Input: EXC3000: add EXC80H60 and EXC80H84 support
On Wed, May 20, 2020 at 11:20:03PM +0200, Sebastian Reichel wrote:
> Hi,
>
> On Wed, May 20, 2020 at 10:45:19AM -0700, Dmitry Torokhov wrote:
> > Hi Sebastian,
> >
> > On Wed, May 20, 2020 at 05:39:34PM +0200, Sebastian Reichel wrote:
> > >
> > > data->client = client;
> > > + data->info = device_get_match_data(&client->dev);
>
> The above is for DT (and ACPI, but driver has no ACPI table).
>
> > > + if (!data->info) {
> > > + enum eeti_dev_id eeti_dev_id =
> > > + i2c_match_id(exc3000_id, client)->driver_data;
> >
> > I believe i2c devices can be instantiated via sysfs, so I think we
> > better handle case where we can't find matching id. Also driver_data is
> > enough to store a pointer, maybe we can have individual structures
> > instead of using an array and indexing here?
>
> The above code is only for exactly this usecase (loading via sysfs).
> There is zero chance, that we cannot find matching id. The sysfs
> based probing works by providing the device address and the name
> listed in driver's id_table. I took the above code style from
> drivers/i2c/muxes/i2c-mux-ltc4306.c.
Ah, OK, so i2c does not provide the "new_id" attribute to extend the
match table.
>
> We can store the pointer directly in i2c_device_id's driver_data
> field, but that requires two type casts (field is ulong instead
> of pointer). The array variant feels a bit cleaner to me.
OK, fair enough. I'll wait for Rob to ack the yaml conversion and will
apply.
Thanks.
--
Dmitry
Powered by blists - more mailing lists