[alsa-devel] [PATCH] ASoC: cs4271: free reset gpio in cs4271_remove()
Lars-Peter Clausen
lars at metafoo.de
Wed Feb 19 12:43:24 CET 2014
On 02/19/2014 12:24 PM, Daniel Mack wrote:
> On 02/19/2014 12:15 PM, Mark Brown wrote:
>> On Wed, Feb 19, 2014 at 12:07:12PM +0100, Daniel Mack wrote:
>>
>>> + if (gpio_is_valid(cs4271->gpio_nreset)) {
>>> /* Set codec to the reset state */
>>> gpio_set_value(cs4271->gpio_nreset, 0);
>>> + devm_gpio_free(codec->dev, cs4271->gpio_nreset);
>>> + }
>>
>> If it's being requested as a managed resource shouldn't it be being
>> freed automatically?
>>
>
> Nope, as the module itself will not go away necessarily. I hit the bug
> when unloading and reloading the machine driver. cs4271_probe(codec)
> will fail to acquire and drive the reset line, and the codec stays in reset.
>
In my opinion a better solution is to move the requesting of the GPIO from
the CODEC probe() function to the SPI/I2C probe() functions. Actually it
looks as if most of the code (if not all) in the CODEC probe() function
should be done when the driver is probed.
- Lars
More information about the Alsa-devel
mailing list