lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 15 Nov 2022 11:51:18 +0100
From:   Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
To:     Paul Cercueil <paul@...pouillou.net>
Cc:     Thierry Reding <thierry.reding@...il.com>, od@...ndingux.net,
        linux-pwm@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-mips@...r.kernel.org
Subject: Re: [PATCH 5/5] pwm: jz4740: Use regmap_{set,clear}_bits

Hello,

On Mon, Oct 24, 2022 at 09:52:13PM +0100, Paul Cercueil wrote:
> Simplify a bit the code by using regmap_set_bits() and
> regmap_clear_bits() instead of regmap_update_bits() when possible.
> 
> Signed-off-by: Paul Cercueil <paul@...pouillou.net>
> ---
>  drivers/pwm/pwm-jz4740.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c
> index c0afc0c316a8..22fcdca66081 100644
> --- a/drivers/pwm/pwm-jz4740.c
> +++ b/drivers/pwm/pwm-jz4740.c
> @@ -88,8 +88,7 @@ static int jz4740_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
>  	struct jz4740_pwm_chip *jz = to_jz4740(chip);
>  
>  	/* Enable PWM output */
> -	regmap_update_bits(jz->map, TCU_REG_TCSRc(pwm->hwpwm),
> -			   TCU_TCSR_PWM_EN, TCU_TCSR_PWM_EN);
> +	regmap_set_bits(jz->map, TCU_REG_TCSRc(pwm->hwpwm), TCU_TCSR_PWM_EN);
>  
>  	/* Start counter */
>  	regmap_write(jz->map, TCU_REG_TESR, BIT(pwm->hwpwm));
> @@ -129,8 +128,7 @@ static void jz4740_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
>  	 * In TCU2 mode (channel 1/2 on JZ4750+), this must be done before the
>  	 * counter is stopped, while in TCU1 mode the order does not matter.
>  	 */
> -	regmap_update_bits(jz->map, TCU_REG_TCSRc(pwm->hwpwm),
> -			   TCU_TCSR_PWM_EN, 0);
> +	regmap_clear_bits(jz->map, TCU_REG_TCSRc(pwm->hwpwm), TCU_TCSR_PWM_EN);
>  
>  	/* Stop counter */
>  	regmap_write(jz->map, TCU_REG_TECR, BIT(pwm->hwpwm));
> @@ -204,8 +202,8 @@ static int jz4740_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
>  	regmap_write(jz4740->map, TCU_REG_TDFRc(pwm->hwpwm), period);
>  
>  	/* Set abrupt shutdown */
> -	regmap_update_bits(jz4740->map, TCU_REG_TCSRc(pwm->hwpwm),
> -			   TCU_TCSR_PWM_SD, TCU_TCSR_PWM_SD);
> +	regmap_set_bits(jz4740->map, TCU_REG_TCSRc(pwm->hwpwm),
> +			TCU_TCSR_PWM_SD);

Nitpick: the regmap_set_bits call is short enough to be put on a single
line.

Other than that (and even if the line is kept as is):

Acked-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ