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]
Message-ID: <20170120102355.GG3824@ulmo.ba.sec>
Date:   Fri, 20 Jan 2017 11:23:55 +0100
From:   Thierry Reding <thierry.reding@...il.com>
To:     Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc:     linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
        David Lechner <david@...hnology.com>,
        Frieder Schrempf <frieder.schrempf@...eet.de>
Subject: Re: [PATCH v2 7/7] Input: pwm-beeper - switch to using "atomic" PWM
 API

On Thu, Jan 19, 2017 at 02:40:57PM -0800, Dmitry Torokhov wrote:
> The "atomic" API allows us to configure PWM period and duty cycle and
> enable it in one call.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
> ---
>  drivers/input/misc/pwm-beeper.c | 25 ++++++++++++++++---------
>  1 file changed, 16 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
> index 7b213e0ab06c..3408dc666afa 100644
> --- a/drivers/input/misc/pwm-beeper.c
> +++ b/drivers/input/misc/pwm-beeper.c
> @@ -37,13 +37,16 @@ struct pwm_beeper {
>  
>  static int pwm_beeper_on(struct pwm_beeper *beeper, unsigned long period)
>  {
> +	struct pwm_state state;
>  	int error;
>  
> -	error = pwm_config(beeper->pwm, period / 2, period);
> -	if (error)
> -		return error;
> +	pwm_get_state(beeper->pwm, &state);
>  
> -	error = pwm_enable(beeper->pwm);
> +	state.enabled = true;
> +	state.period = period;
> +	pwm_set_relative_duty_cycle(&state, 50, 100);
> +
> +	error = pwm_apply_state(beeper->pwm, &state);
>  	if (error)
>  		return error;
>  

I was going to say that you need to update pwm_beeper_off() to use the
atomic API as well, but I think I might keep pwm_disable() around for
cases such as this.

Reviewed-by: Thierry Reding <thierry.reding@...il.com>

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ