Re: [PATCH 4/7] HID: sony: make the check for BUZZ_CONTROLLER more readable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 1 Feb 2016 09:41:01 -0500
Frank Praznik <frank.praznik@xxxxxxxxx> wrote:

> 
> > On Jan 28, 2016, at 12:23, Antonio Ospite <ao2@xxxxxx> wrote:
> > 
> > Use a positive test for BUZZ_CONTROLLER which is the particular case,
> > and leave the 'else' branch for the general case.
> > 
> > Signed-off-by: Antonio Ospite <ao2@xxxxxx>
> > ---
> > drivers/hid/hid-sony.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
> > index 8dcea69..3877101 100644
> > --- a/drivers/hid/hid-sony.c
> > +++ b/drivers/hid/hid-sony.c
> > @@ -1547,10 +1547,10 @@ static void buzz_set_leds(struct sony_sc *sc)
> > 
> > static void sony_set_leds(struct sony_sc *sc)
> > {
> > -	if (!(sc->quirks & BUZZ_CONTROLLER))
> > -		schedule_work(&sc->state_worker);
> > -	else
> > +	if (sc->quirks & BUZZ_CONTROLLER)
> > 		buzz_set_leds(sc);
> > +	else
> > +		schedule_work(&sc->state_worker);
> > }
> > 
> > static void sony_led_set_brightness(struct led_classdev *led,
> > -- 
> > 2.7.0
> > 
>
> My nitpick here is that moving the common case to the ‘else’ branch
> can mean more branch mispredictions.  This isn’t a particularly hot
> piece of code, but I still prefer common-case first.
>

Hi Frank,

I see your point. Let's drop 4/7 for now then.
Jiri, will you apply the other patches? They have Frank's ACK.

> Ultimately I’d really like to get rid of the special-case buzzer code
> and just use a state worker like all of the other devices, but I don’t
> have any buzzer controllers to test with and don’t know anyone who
> does.

Agreed, a proper refactoring would be indeed better than my 4/7
proposal.

Looking at the history, support for the buzz controller was added by
Colin Leitner <colin.leitner@xxxxxxxxx>

Ciao ciao,
   Antonio

-- 
Antonio Ospite
http://ao2.it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux