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: <7c968006-0cdc-d4cf-622f-9cda52490aa1@cogentembedded.com>
Date:   Tue, 9 Apr 2019 13:36:12 +0300
From:   Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:     Bartosz Golaszewski <brgl@...ev.pl>, Sekhar Nori <nsekhar@...com>,
        Kevin Hilman <khilman@...nel.org>,
        Alan Stern <stern@...land.harvard.edu>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        linux-usb@...r.kernel.org,
        Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: Re: [PATCH v3 2/6] usb: ohci-da8xx: let the regulator framework keep
 track of use count

On 04/09/2019 11:28 AM, Bartosz Golaszewski wrote:

> From: Bartosz Golaszewski <bgolaszewski@...libre.com>
> 
> There's no reason to have a separate variable to keep track of the
> regulator state. The regulator core already does that. Remove
> reg_enabled from struct da8xx_ohci_hcd.
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@...libre.com>
> Acked-by: Alan Stern <stern@...land.harvard.edu>
> ---
>  drivers/usb/host/ohci-da8xx.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
> index ca8a94f15ac0..9c6d1f03b871 100644
> --- a/drivers/usb/host/ohci-da8xx.c
> +++ b/drivers/usb/host/ohci-da8xx.c
[...]
> @@ -100,21 +99,18 @@ static int ohci_da8xx_set_power(struct usb_hcd *hcd, int on)
>  	if (!da8xx_ohci->vbus_reg)
>  		return 0;
>  
> -	if (on && !da8xx_ohci->reg_enabled) {
> +	if (on) {
>  		ret = regulator_enable(da8xx_ohci->vbus_reg);
>  		if (ret) {
>  			dev_err(dev, "Failed to enable regulator: %d\n", ret);
>  			return ret;
>  		}
> -		da8xx_ohci->reg_enabled = 1;
> -
> -	} else if (!on && da8xx_ohci->reg_enabled) {
> +	} else if (!on) {

  This can be reduced to simple *else* now.

>  		ret = regulator_disable(da8xx_ohci->vbus_reg);
>  		if (ret) {
>  			dev_err(dev, "Failed  to disable regulator: %d\n", ret);
>  			return ret;
>  		}
> -		da8xx_ohci->reg_enabled = 0;
>  	}
>  
>  	return 0;

MBR, Sergei

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ