Re: [PATCH 2/2] ASoC: max98927: Add reset-gpio support

From: Mark Brown
Date: Thu Sep 20 2018 - 12:19:16 EST


On Wed, Sep 12, 2018 at 08:19:55PM +0800, Cheng-Yi Chiang wrote:

> + /*
> + * Release reset GPIO because we are not going to use it.
> + */
> + devm_gpiod_put(dev, max98927->reset_gpio);

There is no need to do this, it's still potentially useful information
for userspace and it's also going to surprise anyone who tries to modify
the code to use this function at some other time (eg, when coming out of
suspend sometimes it's useful to reset the device).

> @@ -934,6 +1010,8 @@ static int max98927_i2c_probe(struct i2c_client *i2c,
> if (ret < 0)
> dev_err(&i2c->dev, "Failed to register component: %d\n", ret);
>
> + list_add(&max98927->list, &reset_list);
> +

I'm not seeing any locking of this list. This also feels like something
that shouldn't be in this driver but should be pushed up a level - it's
only going to do the right thing if the reset line is only shared with
other devices using this driver, if someone does something like put the
CODEC and an external speaker amp on the same reset pin then it won't
work. I'm not sure where the best place to do that is; drivers/reset
isn't really for this use case but feels right perhaps?

Can you perhaps split the basic reset handling out from this list
handling as a separate patch?

Attachment: signature.asc
Description: PGP signature