[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y/TM4UihoGI/5Q71@kuha.fi.intel.com>
Date: Tue, 21 Feb 2023 15:53:37 +0200
From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>,
Raul E Rangel <rrangel@...omium.org>,
Wolfram Sang <wsa@...nel.org>, linux-kernel@...r.kernel.org,
linux-i2c@...r.kernel.org, linux-usb@...r.kernel.org,
Robin van der Gracht <robin@...tonic.nl>,
Miguel Ojeda <ojeda@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH v1 1/3] usb: typec: stusb160x: Make use of
device_get_match_data()
On Tue, Feb 21, 2023 at 03:33:05PM +0200, Andy Shevchenko wrote:
> Switching to use device_get_match_data() helps getting of
> i2c_of_match_device() API.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
> ---
> drivers/usb/typec/stusb160x.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/typec/stusb160x.c b/drivers/usb/typec/stusb160x.c
> index 494b371151e0..70d9f68d99c9 100644
> --- a/drivers/usb/typec/stusb160x.c
> +++ b/drivers/usb/typec/stusb160x.c
> @@ -11,6 +11,7 @@
> #include <linux/interrupt.h>
> #include <linux/kernel.h>
> #include <linux/module.h>
> +#include <linux/property.h>
> #include <linux/regmap.h>
> #include <linux/regulator/consumer.h>
> #include <linux/usb/role.h>
> @@ -633,9 +634,8 @@ MODULE_DEVICE_TABLE(of, stusb160x_of_match);
>
> static int stusb160x_probe(struct i2c_client *client)
> {
> + const struct regmap_config *regmap_config;
> struct stusb160x *chip;
> - const struct of_device_id *match;
> - struct regmap_config *regmap_config;
> struct fwnode_handle *fwnode;
> int ret;
>
> @@ -645,8 +645,8 @@ static int stusb160x_probe(struct i2c_client *client)
>
> i2c_set_clientdata(client, chip);
>
> - match = i2c_of_match_device(stusb160x_of_match, client);
> - regmap_config = (struct regmap_config *)match->data;
> + regmap_config = device_get_match_data(&client->dev);
> +
> chip->regmap = devm_regmap_init_i2c(client, regmap_config);
> if (IS_ERR(chip->regmap)) {
> ret = PTR_ERR(chip->regmap);
thanks,
--
heikki
Powered by blists - more mailing lists