[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZOdFOobezrVoMYJn@smile.fi.intel.com>
Date: Thu, 24 Aug 2023 14:55:38 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Mehdi Djait <mehdi.djait.k@...il.com>
Cc: jic23@...nel.org, mazziesaccount@...il.com,
krzysztof.kozlowski+dt@...aro.org, robh+dt@...nel.org,
lars@...afoo.de, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH v8 5/7] iio: accel: kionix-kx022a: Refactor driver and
add chip_info structure
On Wed, Aug 23, 2023 at 11:16:39PM +0200, Mehdi Djait wrote:
> Add the chip_info structure to the driver's private data to hold all
> the device specific infos.
> Refactor the kx022a driver implementation to make it more generic and
> extensible.
...
> + chip_info = device_get_match_data(&i2c->dev);
> + if (!chip_info) {
> + const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
> +
> + chip_info = (const struct kx022a_chip_info *)id->driver_data;
> + if (!chip_info)
> + return -EINVAL;
> + }
There is a new API for that, please use it.
...
> +/* kx022a Regmap configs */
regmap
...
> irq = fwnode_irq_get_byname(fwnode, "INT2");
> if (irq <= 0)
= 0 case is fixed now, means should never appear here,
but it's a material for another, separate change.
> return dev_err_probe(dev, irq, "No suitable IRQ\n");
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists