Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	Puranjay Mohan <puranjay12@gmail.com>,
	linux-iio@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH 1/4] iio: accel: adxl355: Simplify probe()
Date: Sat, 22 Jul 2023 17:25:21 +0100	[thread overview]
Message-ID: <20230722172521.3b4e34cf@jic23-huawei> (raw)
In-Reply-To: <20230716175218.130557-2-biju.das.jz@bp.renesas.com>

On Sun, 16 Jul 2023 18:52:15 +0100
Biju Das <biju.das.jz@bp.renesas.com> wrote:

> Simplify the probe() by replacing of_device_get_match_data() and
> i2c_match_id() by i2c_get_match_data() as we have similar I2C
> and DT-based matching table.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Applied to the togreg branch of iio.git, initially pushed out as testing
for 0-day to take a look at.

Thanks,

Jonathan

> ---
>  drivers/iio/accel/adxl355_i2c.c | 15 +++------------
>  1 file changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/iio/accel/adxl355_i2c.c b/drivers/iio/accel/adxl355_i2c.c
> index d5beea61479d..32398cde9608 100644
> --- a/drivers/iio/accel/adxl355_i2c.c
> +++ b/drivers/iio/accel/adxl355_i2c.c
> @@ -24,19 +24,10 @@ static int adxl355_i2c_probe(struct i2c_client *client)
>  {
>  	struct regmap *regmap;
>  	const struct adxl355_chip_info *chip_data;
> -	const struct i2c_device_id *adxl355;
>  
> -	chip_data = device_get_match_data(&client->dev);
> -	if (!chip_data) {
> -		adxl355 = to_i2c_driver(client->dev.driver)->id_table;
> -		if (!adxl355)
> -			return -EINVAL;
> -
> -		chip_data = (void *)i2c_match_id(adxl355, client)->driver_data;
> -
> -		if (!chip_data)
> -			return -EINVAL;
> -	}
> +	chip_data = i2c_get_match_data(client);
> +	if (!chip_data)
> +		return -ENODEV;
>  
>  	regmap = devm_regmap_init_i2c(client, &adxl355_i2c_regmap_config);
>  	if (IS_ERR(regmap)) {


  parent reply	other threads:[~2023-07-22 16:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-16 17:52 [PATCH 0/4] Use i2c_get_match_data() Biju Das
2023-07-16 17:52 ` [PATCH 1/4] iio: accel: adxl355: Simplify probe() Biju Das
2023-07-17  8:10   ` Geert Uytterhoeven
2023-07-17  8:15   ` Puranjay Mohan
2023-07-22 16:25   ` Jonathan Cameron [this message]
2023-07-16 17:52 ` [PATCH 2/4] iio: accel: adxl313: Use i2c_get_match_data Biju Das
2023-07-17  8:52   ` Geert Uytterhoeven
2023-07-22 16:28   ` Jonathan Cameron
2023-07-22 17:37     ` Biju Das
2023-07-16 17:52 ` [PATCH 3/4] iio: potentiometer: mcp4531: " Biju Das
2023-07-16 18:09   ` Biju Das
2023-07-16 17:52 ` [PATCH 4/4] iio: potentiometer: mcp4018: " Biju Das
2023-07-16 18:10   ` Biju Das
2023-07-20 19:17     ` Jonathan Cameron
2023-07-20 19:31       ` Biju Das

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230722172521.3b4e34cf@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=puranjay12@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox