Skip to content

Commit

Permalink
usb: renesas: pipe: convert a long if into a XOR operation
Browse files Browse the repository at this point in the history
This is just a minor optimization for the long
if we have on the driver.

When we want to check that one input is true
and the other must be false, the bitwise XOR
operator will achieve that for us.

Tested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Felipe Balbi committed Dec 21, 2011
1 parent abfbe33 commit 14ff96e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/usb/renesas_usbhs/pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,7 @@ static u16 usbhsp_setup_pipecfg(struct usbhs_pipe *pipe,
if (dir_in)
usbhsp_flags_set(pipe, IS_DIR_HOST);

if ((is_host && !dir_in) ||
(!is_host && dir_in))
if (!!is_host ^ !!dir_in)
dir |= DIR_OUT;

if (!dir)
Expand Down

0 comments on commit 14ff96e

Please sign in to comment.