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:   Fri, 7 Apr 2017 21:33:35 +0930
From:   Jonathan Woithe <jwoithe@...t42.net>
To:     Micha?? K??pie?? <kernel@...pniu.pl>
Cc:     Darren Hart <dvhart@...radead.org>,
        Andy Shevchenko <andy@...radead.org>,
        platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 03/11] platform/x86: fujitsu-laptop: merge
 set_lcd_level_alt() into set_lcd_level()

On Fri, Apr 07, 2017 at 09:23:47PM +0930, I wrote:
> On Wed, Apr 05, 2017 at 08:49:02AM +0200, Micha?? K??pie?? wrote:
> > diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
> > index 59107a599d22..2f563aa00592 100644
> > --- a/drivers/platform/x86/fujitsu-laptop.c
> > +++ b/drivers/platform/x86/fujitsu-laptop.c
> > @@ -360,41 +360,26 @@ static int set_lcd_level(int level)
> >  {
> >  	acpi_status status = AE_OK;
> >  	acpi_handle handle = NULL;
> > -
> > -	vdbg_printk(FUJLAPTOP_DBG_TRACE, "set lcd level via SBLL [%d]\n",
> > -		    level);
> > -
> > -	if (level < 0 || level >= fujitsu_bl->max_brightness)
> > -		return -EINVAL;
> > -
> > -	status = acpi_get_handle(fujitsu_bl->acpi_handle, "SBLL", &handle);
> > -	if (ACPI_FAILURE(status)) {
> > -		vdbg_printk(FUJLAPTOP_DBG_ERROR, "SBLL not present\n");
> > -		return -ENODEV;
> > +	char *method;
> > +
> > +	switch (use_alt_lcd_levels) {
> > +	case 1:
> > +		method = "SBL2";
> > +		break;
> > +	default:
> > +		method = "SBLL";
> > +		break;
> >  	}
> 
> This is not necessary something actionable, but I am wondering about the
> rationale of using a switch statement here given that there really are only
> two options.  In my mind at least a simple "if" clause would be clearer and
> easier to read (with or without the braces):
> 
>   if (use_alt_lcd_levels) {
>           method = "SBL2";
>   } else {
>           method = "SBLL";
>   }

Ah, the reason for the use of the switch was to prepare the way for patch 
06/11 which adds an autodetection value to the definition of
use_alt_lcd_levels.  All good.

Regards
  jonathan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ