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: <7d474c3d-22ed-45d5-8224-caaf124b72a0@kernel.org>
Date: Wed, 24 Jul 2024 18:14:52 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Ramona Alexandra Nechita <ramona.nechita@...log.com>,
 linux-iio@...r.kernel.org
Cc: Jonathan Cameron <jic23@...nel.org>, Lars-Peter Clausen
 <lars@...afoo.de>, Cosmin Tanislav <cosmin.tanislav@...log.com>,
 Michael Hennerich <Michael.Hennerich@...log.com>,
 Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
 Conor Dooley <conor+dt@...nel.org>,
 Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
 Nuno Sa <nuno.sa@...log.com>, Marcelo Schmitt <marcelo.schmitt@...log.com>,
 Marius Cristea <marius.cristea@...rochip.com>,
 Ivan Mikhaylov <fr0st61te@...il.com>,
 Mike Looijmans <mike.looijmans@...ic.nl>,
 Marcus Folkesson <marcus.folkesson@...il.com>,
 Liam Beguin <liambeguin@...il.com>, linux-kernel@...r.kernel.org,
 devicetree@...r.kernel.org
Subject: Re: [PATCH v4 3/3] drivers: iio: adc: add support for ad777x family

On 24/07/2024 17:54, Ramona Alexandra Nechita wrote:
> Add support for AD7770, AD7771, AD7779 ADCs. The device is capable of
> sending out data both on DOUT lines interface,as on the SDO line.
> The driver currently implements only theSDO data streaming mode. SPI
> communication is used alternatively foraccessingregisters and streaming

Typo, please run spell check.

Please use subject prefixes matching the subsystem. You can get them for
example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory
your patch is touching. For bindings, the preferred subjects are
explained here:
https://www.kernel.org/doc/html/latest/devicetree/bindings/submitting-patches.html#i-for-patch-submitters

There is no "drivers".

> data. Register access are protected by crc8.
> 
> Signed-off-by: Ramona Alexandra Nechita <ramona.nechita@...log.com>
> ---
>  drivers/iio/adc/Kconfig  |  11 +
>  drivers/iio/adc/Makefile |   1 +
>  drivers/iio/adc/ad7779.c | 952 +++++++++++++++++++++++++++++++++++++++
>  3 files changed, 964 insertions(+)
>  create mode 100644 drivers/iio/adc/ad7779.c
> 

The driver has several trivial style issues. Please be sure such
trivialities are fixed. Get internal review on this. You do need to ask
community to tell you that you must run checkpatch. Or to tell them that
indentation/alignment is entirely broken. Grab some colleague of yours
and perform internal review first. This applies to entire Analog,
because there is increased amount of contributions from Analog and not
all of them look like passing basic sanity checks.

By sending code full of silly trivialities, community reviewers might
feel overwhelmed and quite grumpy.

> +
> +	indio_dev->trig = iio_trigger_get(st->trig);
> +
> +	init_completion(&st->completion);
> +
> +	ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev,
> +										  &iio_pollfunc_store_time,
> +										  &ad7779_trigger_handler,
> +										  &ad7779_buffer_setup_ops);

Sorry, tha's not a Linux coding style. Checkpatch will tell you that.

Please run scripts/checkpatch.pl and fix reported warnings. Then please
run `scripts/checkpatch.pl --strict` and (probably) fix more warnings.
Some warnings can be ignored, especially from --strict run, but the code
here looks like it needs a fix. Feel free to get in touch if the warning
is not clear.

> +	if (ret)
> +		return ret;
> +
> +	ret = ad7779_spi_write_mask(st, AD7779_REG_DOUT_FORMAT,
> +				    AD7779_DCLK_CLK_DIV_MSK,
> +				    FIELD_PREP(AD7779_DCLK_CLK_DIV_MSK, 7));
> +	if (ret)
> +		return ret;
> +
> +	return devm_iio_device_register(&spi->dev, indio_dev);
> +}
> +
> +static int __maybe_unused ad7779_suspend(struct device *dev)
> +{
> +	struct iio_dev *indio_dev = dev_get_drvdata(dev);
> +	struct ad7779_state *st = iio_priv(indio_dev);
> +	int ret;
> +
> +	ret = ad7779_spi_write_mask(st, AD7779_REG_GENERAL_USER_CONFIG_1,
> +				    AD7779_MOD_POWERMODE_MSK,
> +				    FIELD_PREP(AD7779_MOD_POWERMODE_MSK,
> +					       AD7779_LOW_POWER));
> +	if (ret)
> +		return ret;
> +
> +	st->power_mode = AD7779_LOW_POWER;
> +	return 0;
> +}
> +
> +static int __maybe_unused ad7779_resume(struct device *dev)
> +{
> +	struct iio_dev *indio_dev = dev_get_drvdata(dev);
> +	struct ad7779_state *st = iio_priv(indio_dev);
> +	int ret;
> +
> +	ret = ad7779_spi_write_mask(st, AD7779_REG_GENERAL_USER_CONFIG_1,
> +				    AD7779_MOD_POWERMODE_MSK,
> +				    FIELD_PREP(AD7779_MOD_POWERMODE_MSK,
> +					       AD7779_HIGH_POWER));
> +	if (ret)
> +		return ret;
> +
> +	st->power_mode = AD7779_HIGH_POWER;
> +
> +	return 0;
> +}
> +
> +static DEFINE_SIMPLE_DEV_PM_OPS(ad7779_pm_ops, ad7779_suspend, ad7779_resume);
> +
> +static const struct ad7779_chip_info ad7770_chip_info = {
> +	.name = "ad7770",
> +	.channels = ad7779_channels,
> +};
> +
> +static const struct ad7779_chip_info ad7771_chip_info = {
> +	.name = "ad7771",
> +	.channels = ad7779_channels_filter,
> +};
> +
> +static const struct ad7779_chip_info AD7779_chip_info = {
> +	.name = "AD7779",

Hm...

> +	.channels = ad7779_channels,
> +};
> +
> +static const struct spi_device_id ad7779_id[] = {
> +	{
> +		.name = "ad7770",
> +		.driver_data = (kernel_ulong_t)&ad7770_chip_info
> +	},
> +	{
> +		.name = "ad7771",
> +		.driver_data = (kernel_ulong_t)&ad7771_chip_info
> +	},
> +	{
> +		.name = "AD7779",

Eh...

> +		.driver_data = (kernel_ulong_t)&AD7779_chip_info
> +	},
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(spi, ad7779_id);
> +
> +static const struct of_device_id ad7779_of_table[] = {
> +	{
> +		.compatible = "adi,ad7770",
> +		.data = &ad7770_chip_info,
> +	},
> +	{
> +		.compatible = "adi,ad7771",
> +		.data = &ad7771_chip_info,
> +	},
> +	{
> +		.compatible = "adi,AD7779",

That's not a valid compatible. Only lower-case are allowed.

> +		.data = &AD7779_chip_info,
> +	},
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, ad7779_of_table);
> +

Best regards,
Krzysztof


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ