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: <b730a42a-600b-4207-8898-7e4a3b19203b@kernel.org>
Date:   Wed, 22 Nov 2023 11:01:45 +0100
From:   Krzysztof Kozlowski <krzk@...nel.org>
To:     marcelo.schmitt@...log.com, beniamin.bia@...log.com,
        paul.cercueil@...log.com, Michael.Hennerich@...log.com,
        lars@...afoo.de, jic23@...nel.org, marcelo.schmitt1@...il.com
Cc:     linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/7] iio: adc: Add support for AD7091R-8

On 21/11/2023 22:36, marcelo.schmitt@...log.com wrote:
> From: Marcelo Schmitt <marcelo.schmitt@...log.com>
> 
> Add support for Analog Devices AD7091R-2, AD7091R-4, and AD7091R-8
> low power 12-Bit SAR ADCs.
> Extend ad7091r-base driver so it can be used by AD7091R-8 drivers.
> 
> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@...log.com>
> ---
> 
> Device read/write might look odd due to the transfer protocol for these devices.
> I'm glad to hear any suggestions on how to make it better.
> 


...

> +
> +static int ad7091r8_gpio_setup(struct ad7091r_state *st)
> +{
> +	st->convst_gpio = devm_gpiod_get(st->dev, "adi,conversion-start",
> +					 GPIOD_OUT_LOW);
> +	if (IS_ERR(st->convst_gpio))
> +		return dev_err_probe(st->dev, PTR_ERR(st->convst_gpio),
> +				     "Error getting convst GPIO: %ld\n",
> +				     PTR_ERR(st->convst_gpio));

Don't print error code twice.

> +
> +	st->reset_gpio =  devm_gpiod_get_optional(st->dev, "reset",
> +						  GPIOD_OUT_HIGH);
> +	if (IS_ERR(st->reset_gpio))
> +		return PTR_ERR(st->reset_gpio);
> +
> +	if (st->reset_gpio) {
> +		fsleep(20);
> +		gpiod_set_value_cansleep(st->reset_gpio, 0);
> +	}
> +
> +	return 0;
> +}
> +
> +static int ad7091r8_spi_probe(struct spi_device *spi)
> +{
> +	const struct ad7091r_chip_info *chip_info;
> +	struct ad7091r_state *st;
> +	struct iio_dev *iio_dev;
> +	struct regmap *map;
> +	int ret;
> +
> +	chip_info = spi_get_device_match_data(spi);
> +	if (!chip_info)
> +		return -EINVAL;
> +
> +	iio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
> +	if (!iio_dev)
> +		return -ENOMEM;
> +
> +	st = iio_priv(iio_dev);
> +	st->dev = &spi->dev;
> +
> +	map = devm_regmap_init(&spi->dev, &ad7091r8_regmap_bus, st,
> +			       &ad7091r_spi_regmap_config[chip_info->type]);
> +
> +	if (IS_ERR(map))
> +		return dev_err_probe(&spi->dev, PTR_ERR(map),
> +				     "Error initializing spi regmap: %ld\n",
> +				     PTR_ERR(map));

Don't print error code twice.

Best regards,
Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ