lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250330184538.5b5e6f39@jic23-huawei>
Date: Sun, 30 Mar 2025 18:45:38 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: David Heidelberg via B4 Relay <devnull+david.ixit.cz@...nel.org>
Cc: david@...t.cz, Lars-Peter Clausen <lars@...afoo.de>, Svyatoslav Ryhel
 <clamor95@...il.com>, Robert Eckelmann <longnoserob@...il.com>,
 linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 12/13] iio: light: al3010: Implement regmap support

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

> From: David Heidelberg <david@...t.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@...t.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);
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ