[01/12] ASoC: codecs: rt1308: do not store status in state container

Message ID 20230517111416.424420-1-krzysztof.kozlowski@linaro.org
State New
Headers
Series [01/12] ASoC: codecs: rt1308: do not store status in state container |

Commit Message

Krzysztof Kozlowski May 17, 2023, 11:14 a.m. UTC
  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@linaro.org>
---
 sound/soc/codecs/rt1308-sdw.c | 5 +----
 sound/soc/codecs/rt1308-sdw.h | 1 -
 2 files changed, 1 insertion(+), 5 deletions(-)
  

Comments

Pierre-Louis Bossart May 17, 2023, 1:27 p.m. UTC | #1
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@linaro.org>

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@linux.intel.com>

> ---
>  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;
  
Mark Brown May 18, 2023, 5:20 p.m. UTC | #2
On Wed, 17 May 2023 13:14:05 +0200, 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.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[01/12] ASoC: codecs: rt1308: do not store status in state container
        commit: cc3ff544a296b5b4bb021f4dc415b53a6955b980
[02/12] ASoC: codecs: rt1316: do not store status in state container
        commit: 70207b95b2245502496443475c9fc4eb72ba3b66
[03/12] ASoC: codecs: rt1318: do not store status in state container
        commit: 28eb1e4224c3b3ff29fe4c29bcdc011d3a0ffd07
[04/12] ASoC: codecs: rt5682: do not store status in state container
        commit: 758665b15acc1adb21a833c6456746ffbce07ed7
[05/12] ASoC: codecs: rt700: do not store status in state container
        commit: 9564c9f691128bc2dc69de02f7eed205d9b2513f
[06/12] ASoC: codecs: rt711-sdca: do not store status in state container
        commit: 8322947e9228ef7f8c3dd13822d32c491f9488e7
[07/12] ASoC: codecs: rt711: do not store status in state container
        commit: 22e15c18b4a91c71bf66de06187b8a3199bb8cad
[08/12] ASoC: codecs: rt712-sdca-dmic: do not store status in state container
        commit: d7a79616fc723305094fd7391085428b7a893636
[09/12] ASoC: codecs: rt712-sdca: do not store status in state container
        commit: 5cd02f96f49a7e6d2f8b96ddc42092776b554873
[10/12] ASoC: codecs: rt715-sdca: do not store status in state container
        commit: cda72c89d082f5953fab9948fc1212ca0df11d96
[11/12] ASoC: codecs: rt715: do not store status in state container
        commit: 0315dac5406c9c0b8e334195aa01c4ec155adf47
[12/12] ASoC: codecs: rt722-sdca: do not store status in state container
        commit: b932f21f6678659bd434c0d47e3bebc94bae0a51

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
  

Patch

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;