Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: David Heidelberg via B4 Relay <devnull+david.ixit.cz@kernel.org>
Cc: david@ixit.cz, Lars-Peter Clausen <lars@metafoo.de>,
	Svyatoslav Ryhel <clamor95@gmail.com>,
	Robert Eckelmann <longnoserob@gmail.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 12/13] iio: light: al3010: Implement regmap support
Date: Sun, 30 Mar 2025 18:45:38 +0100	[thread overview]
Message-ID: <20250330184538.5b5e6f39@jic23-huawei> (raw)
In-Reply-To: <20250319-al3010-iio-regmap-v2-12-1310729d0543@ixit.cz>

On Wed, 19 Mar 2025 21:59:51 +0100
David Heidelberg via B4 Relay <devnull+david.ixit.cz@kernel.org> wrote:

> From: David Heidelberg <david@ixit.cz>
> 
> Modernize and make driver a bit cleaner.
> 
> After the regmap implementation, the compiler is able to produce
> much smaller module.
> 
> Size before: 72 kB
> Size after:  58 kB
> 
> Signed-off-by: David Heidelberg <david@ixit.cz>
Just one real comment on your code. 
Also a passing musing that you can feel free to ignore!

Jonathan


>  static void al3010_set_pwr_off(void *_data)
>  {
>  	struct al3010_data *data = _data;
> +	struct device *dev = regmap_get_device(data->regmap);
> +	int ret;
>  
> -	i2c_smbus_write_byte_data(data->client, AL3010_REG_SYSTEM,
> -				  AL3010_CONFIG_DISABLE);
> +	ret = regmap_write(data->regmap, AL3010_REG_SYSTEM, AL3010_CONFIG_DISABLE);
> +	if (ret)
> +		dev_err(dev, "failed to write system register\n");

Unrelated to your patch, but I wonder if there is appetite for
		regmap_err(data->regmap, "failed to write system register\n");

A lot of drivers carry a local dev pointer because the regmap_get_device() stuff
is a bit clunky. They only use it in many paths for prints like this.

>  }


> @@ -204,7 +210,9 @@ static int al3010_suspend(struct device *dev)
>  
>  static int al3010_resume(struct device *dev)
>  {
> -	return al3010_set_pwr_on(to_i2c_client(dev));
> +	struct al3010_data *data = iio_priv(dev_get_drvdata(dev));

Why this change?

> +
> +	return al3010_set_pwr_on(data);
>  }
>  
>  static DEFINE_SIMPLE_DEV_PM_OPS(al3010_pm_ops, al3010_suspend, al3010_resume);
> 


  reply	other threads:[~2025-03-30 17:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-19 20:59 [PATCH v2 00/13] iio: light: Modernize al3010 and al3320a codebase David Heidelberg via B4 Relay
2025-03-19 20:59 ` [PATCH v2 01/13] iio: light: al3010: Use unsigned int for the indexing David Heidelberg via B4 Relay
2025-03-30 17:26   ` Jonathan Cameron
2025-03-19 20:59 ` [PATCH v2 02/13] iio: light: al3320a: " David Heidelberg via B4 Relay
2025-03-19 20:59 ` [PATCH v2 03/13] iio: light: al3010: Remove DRV_NAME definition David Heidelberg via B4 Relay
2025-03-30 17:27   ` Jonathan Cameron
2025-03-19 20:59 ` [PATCH v2 04/13] iio: light: al3320a: " David Heidelberg via B4 Relay
2025-03-19 20:59 ` [PATCH v2 05/13] iio: light: al3010: Abstract device reference in the probe function David Heidelberg via B4 Relay
2025-03-30 17:29   ` Jonathan Cameron
2025-03-19 20:59 ` [PATCH v2 06/13] iio: light: al3320a: " David Heidelberg via B4 Relay
2025-03-19 20:59 ` [PATCH v2 07/13] iio: light: al3010: Split set_pwr function into set_pwr_on and _off David Heidelberg via B4 Relay
2025-03-30 17:30   ` Jonathan Cameron
2025-03-19 20:59 ` [PATCH v2 08/13] iio: light: al3320a: " David Heidelberg via B4 Relay
2025-03-19 20:59 ` [PATCH v2 09/13] iio: light: al3010: Move devm_add_action_or_reset back to _probe David Heidelberg via B4 Relay
2025-03-30 17:34   ` Jonathan Cameron
2025-04-01 16:36     ` David Heidelberg
2025-03-19 20:59 ` [PATCH v2 10/13] iio: light: al3010: Improve al3010_init error handling with dev_err_probe David Heidelberg via B4 Relay
2025-03-30 17:36   ` Jonathan Cameron
2025-03-19 20:59 ` [PATCH v2 11/13] iio: light: al3320a: Improve " David Heidelberg via B4 Relay
2025-03-30 17:38   ` Jonathan Cameron
2025-03-19 20:59 ` [PATCH v2 12/13] iio: light: al3010: Implement regmap support David Heidelberg via B4 Relay
2025-03-30 17:45   ` Jonathan Cameron [this message]
2025-03-30 17:47     ` Jonathan Cameron
2025-03-19 20:59 ` [PATCH v2 13/13] iio: light: al3320a: " David Heidelberg via B4 Relay
2025-03-30 17:48   ` Jonathan Cameron

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=20250330184538.5b5e6f39@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=clamor95@gmail.com \
    --cc=david@ixit.cz \
    --cc=devnull+david.ixit.cz@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longnoserob@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