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: <Z7JRH8ITxA2KOozH@smile.fi.intel.com>
Date: Sun, 16 Feb 2025 22:57:03 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Svyatoslav Ryhel <clamor95@...il.com>
Cc: Jonathan Cameron <jic23@...nel.org>,
	Lars-Peter Clausen <lars@...afoo.de>, Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Thierry Reding <thierry.reding@...il.com>,
	Jonathan Hunter <jonathanh@...dia.com>,
	Javier Carrasco <javier.carrasco.cruz@...il.com>,
	Matti Vaittinen <mazziesaccount@...il.com>,
	Emil Gedenryd <emil.gedenryd@...s.com>,
	Arthur Becker <arthur.becker@...tec.com>,
	Mudit Sharma <muditsharma.info@...il.com>,
	Per-Daniel Olsson <perdaniel.olsson@...s.com>,
	Subhajit Ghosh <subhajit.ghosh@...aklogic.com>,
	Ivan Orlov <ivan.orlov0322@...il.com>,
	David Heidelberg <david@...t.cz>, linux-iio@...r.kernel.org,
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-tegra@...r.kernel.org
Subject: Re: [PATCH v3 2/3] iio: light: Add support for AL3000a illuminance
 sensor

On Sun, Feb 16, 2025 at 06:27:20PM +0200, Svyatoslav Ryhel wrote:
> AL3000a is a simple I2C-based ambient light sensor, which is
> closely related to AL3010 and AL3320a, but has significantly
> different way of processing data generated by the sensor.

...

> +static int al3000a_set_pwr_on(struct al3000a_data *data)
> +{
> +	struct device *dev = regmap_get_device(data->regmap);
> +	int ret;
> +
> +	ret = regulator_enable(data->vdd_supply);
> +	if (ret) {
> +		dev_err(dev, "failed to enable vdd power supply\n");
> +		return ret;
> +	}
> +
> +	ret = regmap_write(data->regmap, AL3000A_REG_SYSTEM, AL3000A_CONFIG_ENABLE);
> +	if (ret) {
> +		dev_err(dev, "failed to write system register\n");

> +		return ret;
> +	}
> +
> +	return 0;

	return ret;

> +}

...

> +static void al3000a_set_pwr_off(void *_data)
> +{
> +	struct al3000a_data *data = _data;
> +	struct device *dev = regmap_get_device(data->regmap);
> +	int ret;
> +
> +	ret = regmap_write(data->regmap, AL3000A_REG_SYSTEM, AL3000A_CONFIG_DISABLE);
> +	if (ret) {
> +		dev_err(dev, "failed to write system register\n");
> +		return;
> +	}
> +
> +	ret = regulator_disable(data->vdd_supply);
> +	if (ret) {
> +		dev_err(dev, "failed to disable vdd power supply\n");

> +		return;

This is not needed, but I understand the intention. To me, nevertheless, seems
better to return an error to upper layer.

> +	}
> +}
> +
> +static int al3000a_init(struct al3000a_data *data)
> +{
> +	int ret;
> +
> +	ret = al3000a_set_pwr_on(data);
> +	if (ret)
> +		return ret;
> +
> +	ret = regmap_write(data->regmap, AL3000A_REG_SYSTEM, AL3000A_CONFIG_RESET);
> +	if (ret)
> +		return ret;
> +
> +	ret = regmap_write(data->regmap, AL3000A_REG_SYSTEM, AL3000A_CONFIG_ENABLE);
> +	if (ret)
> +		return ret;
> +
> +	return 0;

	return regmap_write(...);

> +}

...

> +static const struct i2c_device_id al3000a_id[] = {
> +	{"al3000a", },

Remove redundant inner comma. And make style consistent with OF, i.e. surround
string with spaces.

> +	{}
> +};
> +MODULE_DEVICE_TABLE(i2c, al3010_id);

Copy'n'paste error, obviously. Please, test every version before sending.

> +
> +static const struct of_device_id al3000a_of_match[] = {
> +	{ .compatible = "dynaimage,al3000a" },
> +	{ /* sentinel */ }
> +};


-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ