Re: [PATCH 01/12] ASoC: codecs: rt1308: do not store status in state container
From: Pierre-Louis Bossart
Date: Wed May 17 2023 - 10:11:51 EST
On 5/17/23 06:14, Krzysztof Kozlowski wrote:
> Driver in its update status callback stores Soundwire device status in
> state container but it never uses it later. Simplify the code a bit.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
Good cleanup, not sure why we added this internal status many moons ago.
There's already a slave->status that's updated in
drivers/soundwire/bus.c, fewer state variables are better and in this
case there's no reason to keep a value that could be stale.
For the series
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>
> ---
> sound/soc/codecs/rt1308-sdw.c | 5 +----
> sound/soc/codecs/rt1308-sdw.h | 1 -
> 2 files changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/sound/soc/codecs/rt1308-sdw.c b/sound/soc/codecs/rt1308-sdw.c
> index 1797af824f60..313e97c94532 100644
> --- a/sound/soc/codecs/rt1308-sdw.c
> +++ b/sound/soc/codecs/rt1308-sdw.c
> @@ -304,9 +304,6 @@ static int rt1308_update_status(struct sdw_slave *slave,
> {
> struct rt1308_sdw_priv *rt1308 = dev_get_drvdata(&slave->dev);
>
> - /* Update the status */
> - rt1308->status = status;
> -
> if (status == SDW_SLAVE_UNATTACHED)
> rt1308->hw_init = false;
>
> @@ -314,7 +311,7 @@ static int rt1308_update_status(struct sdw_slave *slave,
> * Perform initialization only if slave status is present and
> * hw_init flag is false
> */
> - if (rt1308->hw_init || rt1308->status != SDW_SLAVE_ATTACHED)
> + if (rt1308->hw_init || status != SDW_SLAVE_ATTACHED)
> return 0;
>
> /* perform I/O transfers required for Slave initialization */
> diff --git a/sound/soc/codecs/rt1308-sdw.h b/sound/soc/codecs/rt1308-sdw.h
> index 04ff18fa18e2..f816c73e247e 100644
> --- a/sound/soc/codecs/rt1308-sdw.h
> +++ b/sound/soc/codecs/rt1308-sdw.h
> @@ -159,7 +159,6 @@ struct rt1308_sdw_priv {
> struct snd_soc_component *component;
> struct regmap *regmap;
> struct sdw_slave *sdw_slave;
> - enum sdw_slave_status status;
> struct sdw_bus_params params;
> bool hw_init;
> bool first_hw_init;