Re: [PATCH v4 1/2] gpio: add GPO driver for PCA9570

From: Andy Shevchenko
Date: Sat Jul 04 2020 - 06:06:16 EST


On Fri, Jul 3, 2020 at 3:13 AM Sungbo Eo <mans0n@xxxxxxxxxx> wrote:
> On 2020-07-02 21:36, Andy Shevchenko wrote:
> >> + gpio->chip.ngpio = i2c_match_id(pca9570_id_table, client)->driver_data;
> >
> > Oh, avoid direct access to the table like this. And you may simply use
> > device_get_match_data().
>
> I'm not sure if it really does the same thing, but I'll try following
> your suggestion.

It's an agnostic way to get it from fwnode enumerated devices. Since
you are using ->probe_new() the driver should rely on fwnode, that's
why the OF table has to have driver data be defined.

--
With Best Regards,
Andy Shevchenko