diff mbox series

[v3,06/20] ASoC: fsl_micfil: use clear/set bits

Message ID 20220405075959.2744803-7-s.hauer@pengutronix.de (mailing list archive)
State Superseded
Headers show
Series ASoC: fsl_micfil: Driver updates | expand

Commit Message

Sascha Hauer April 5, 2022, 7:59 a.m. UTC
Instead regmap_update_bits() use the simpler variants
regmap_[set|clear]_bits() where appropriate.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 sound/soc/fsl/fsl_micfil.c | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

Comments

Shengjiu Wang April 7, 2022, 2:15 a.m. UTC | #1
On Tue, Apr 5, 2022 at 4:00 PM Sascha Hauer <s.hauer@pengutronix.de> wrote:

> Instead regmap_update_bits() use the simpler variants
> regmap_[set|clear]_bits() where appropriate.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  sound/soc/fsl/fsl_micfil.c | 26 ++++++++++----------------
>  1 file changed, 10 insertions(+), 16 deletions(-)
>
> diff --git a/sound/soc/fsl/fsl_micfil.c b/sound/soc/fsl/fsl_micfil.c
> index cfa8af668d921..70185f75d8a04 100644
> --- a/sound/soc/fsl/fsl_micfil.c
> +++ b/sound/soc/fsl/fsl_micfil.c
> @@ -168,19 +168,15 @@ static int fsl_micfil_reset(struct device *dev)
>         struct fsl_micfil *micfil = dev_get_drvdata(dev);
>         int ret;
>
> -       ret = regmap_update_bits(micfil->regmap,
> -                                REG_MICFIL_CTRL1,
> -                                MICFIL_CTRL1_MDIS,
> -                                0);
> +       ret = regmap_clear_bits(micfil->regmap, REG_MICFIL_CTRL1,
> +                               MICFIL_CTRL1_MDIS);
>         if (ret) {
>                 dev_err(dev, "failed to clear MDIS bit %d\n", ret);
>                 return ret;
>         }
>
> -       ret = regmap_update_bits(micfil->regmap,
> -                                REG_MICFIL_CTRL1,
> -                                MICFIL_CTRL1_SRES,
> -                                MICFIL_CTRL1_SRES);
> +       ret = regmap_set_bits(micfil->regmap, REG_MICFIL_CTRL1,
> +                             MICFIL_CTRL1_SRES);
>         if (ret) {
>                 dev_err(dev, "failed to reset MICFIL: %d\n", ret);
>                 return ret;
> @@ -252,9 +248,8 @@ static int fsl_micfil_trigger(struct snd_pcm_substream
> *substream, int cmd,
>                 }
>
>                 /* Enable the module */
> -               ret = regmap_update_bits(micfil->regmap, REG_MICFIL_CTRL1,
> -                                        MICFIL_CTRL1_PDMIEN,
> -                                        MICFIL_CTRL1_PDMIEN);
> +               ret = regmap_set_bits(micfil->regmap, REG_MICFIL_CTRL1,
> +                                     MICFIL_CTRL1_PDMIEN);
>                 if (ret) {
>                         dev_err(dev, "failed to enable the module\n");
>                         return ret;
> @@ -265,9 +260,8 @@ static int fsl_micfil_trigger(struct snd_pcm_substream
> *substream, int cmd,
>         case SNDRV_PCM_TRIGGER_SUSPEND:
>         case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
>                 /* Disable the module */
> -               ret = regmap_update_bits(micfil->regmap, REG_MICFIL_CTRL1,
> -                                        MICFIL_CTRL1_PDMIEN,
> -                                        0);
> +               ret = regmap_clear_bits(micfil->regmap, REG_MICFIL_CTRL1,
> +                                       MICFIL_CTRL1_PDMIEN);
>                 if (ret) {
>                         dev_err(dev, "failed to enable the module\n");
>                         return ret;
> @@ -332,8 +326,8 @@ static int fsl_micfil_hw_params(struct
> snd_pcm_substream *substream,
>         int ret;
>
>         /* 1. Disable the module */
> -       ret = regmap_update_bits(micfil->regmap, REG_MICFIL_CTRL1,
> -                                MICFIL_CTRL1_PDMIEN, 0);
> +       ret = regmap_clear_bits(micfil->regmap, REG_MICFIL_CTRL1,
> +                                MICFIL_CTRL1_PDMIEN);
>

Alignment should match open parenthesis?


>         if (ret) {
>                 dev_err(dev, "failed to disable the module\n");
>                 return ret;
> --
> 2.30.2
>
>
diff mbox series

Patch

diff --git a/sound/soc/fsl/fsl_micfil.c b/sound/soc/fsl/fsl_micfil.c
index cfa8af668d921..70185f75d8a04 100644
--- a/sound/soc/fsl/fsl_micfil.c
+++ b/sound/soc/fsl/fsl_micfil.c
@@ -168,19 +168,15 @@  static int fsl_micfil_reset(struct device *dev)
 	struct fsl_micfil *micfil = dev_get_drvdata(dev);
 	int ret;
 
-	ret = regmap_update_bits(micfil->regmap,
-				 REG_MICFIL_CTRL1,
-				 MICFIL_CTRL1_MDIS,
-				 0);
+	ret = regmap_clear_bits(micfil->regmap, REG_MICFIL_CTRL1,
+				MICFIL_CTRL1_MDIS);
 	if (ret) {
 		dev_err(dev, "failed to clear MDIS bit %d\n", ret);
 		return ret;
 	}
 
-	ret = regmap_update_bits(micfil->regmap,
-				 REG_MICFIL_CTRL1,
-				 MICFIL_CTRL1_SRES,
-				 MICFIL_CTRL1_SRES);
+	ret = regmap_set_bits(micfil->regmap, REG_MICFIL_CTRL1,
+			      MICFIL_CTRL1_SRES);
 	if (ret) {
 		dev_err(dev, "failed to reset MICFIL: %d\n", ret);
 		return ret;
@@ -252,9 +248,8 @@  static int fsl_micfil_trigger(struct snd_pcm_substream *substream, int cmd,
 		}
 
 		/* Enable the module */
-		ret = regmap_update_bits(micfil->regmap, REG_MICFIL_CTRL1,
-					 MICFIL_CTRL1_PDMIEN,
-					 MICFIL_CTRL1_PDMIEN);
+		ret = regmap_set_bits(micfil->regmap, REG_MICFIL_CTRL1,
+				      MICFIL_CTRL1_PDMIEN);
 		if (ret) {
 			dev_err(dev, "failed to enable the module\n");
 			return ret;
@@ -265,9 +260,8 @@  static int fsl_micfil_trigger(struct snd_pcm_substream *substream, int cmd,
 	case SNDRV_PCM_TRIGGER_SUSPEND:
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
 		/* Disable the module */
-		ret = regmap_update_bits(micfil->regmap, REG_MICFIL_CTRL1,
-					 MICFIL_CTRL1_PDMIEN,
-					 0);
+		ret = regmap_clear_bits(micfil->regmap, REG_MICFIL_CTRL1,
+					MICFIL_CTRL1_PDMIEN);
 		if (ret) {
 			dev_err(dev, "failed to enable the module\n");
 			return ret;
@@ -332,8 +326,8 @@  static int fsl_micfil_hw_params(struct snd_pcm_substream *substream,
 	int ret;
 
 	/* 1. Disable the module */
-	ret = regmap_update_bits(micfil->regmap, REG_MICFIL_CTRL1,
-				 MICFIL_CTRL1_PDMIEN, 0);
+	ret = regmap_clear_bits(micfil->regmap, REG_MICFIL_CTRL1,
+				 MICFIL_CTRL1_PDMIEN);
 	if (ret) {
 		dev_err(dev, "failed to disable the module\n");
 		return ret;