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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0ddfb0ab-10e0-471c-97e1-63018884e4f7@gmail.com>
Date: Sun, 11 Feb 2024 17:36:49 +0200
From: Arturas Moskvinas <arturas.moskvinas@...il.com>
To: Jonathan Cameron <jic23@...nel.org>
Cc: Jonathan.Cameron@...wei.com, oskar.andero@...il.com, lars@...afoo.de,
 lukas@...ner.de, linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
 arturas.moskvinas@...il.com
Subject: Re: [PATCH] iio: adc: mcp320x: Simplify device removal logic



On 2/10/24 17:58, Jonathan Cameron wrote:
>> Use devm_* APIs to enable regulator and to register in IIO infrastructure.
>>
>> Signed-off-by: Arturas Moskvinas <arturas.moskvinas@...il.com>
> 
> Don't get the same regulator twice so as automate turning it off.
> The devm_regulator_get_enable() call is carefully hiding the
> regulator for cases where the driver never accesses it.
> 
> Here we need it to read the voltage.
> 
> To convert such a case to fully devm managed, use a
> devm_add_action_or_reset() and a custom callback.
This is exactly the reason I wanted to use devm_regulator_get_enable() 
instead of devm_add_action_or_reset + custom callback which I saw in 
other ADCs code. It seems quite repetitive. Wondering if this could be 
addressed by regulator subsystem to provide device managed method which 
gets _enabled_ regulator resource and an automated disabling + resource 
freeing? We will loose fine grained information where failure happened 
exactly - getting resource or enabling regulator though...

>>   static void mcp320x_remove(struct spi_device *spi)
>>   {
>> -	struct iio_dev *indio_dev = spi_get_drvdata(spi);
>> -	struct mcp320x *adc = iio_priv(indio_dev);
>> -
>> -	iio_device_unregister(indio_dev);
>> -	regulator_disable(adc->reg);
>>   }
> Had the change otherwise been ok...
> 
> You should be able to remove this function completely now it is empty.
> https://elixir.bootlin.com/linux/latest/source/drivers/spi/spi.c#L446
> checks it's existence before calling it.
Ack, will address with V2 patch.

Arturas Moskvinas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ