Re: [GIT PATCH] USB patches for 2.6.33-git

From: Linus Torvalds
Date: Mon Dec 14 2009 - 23:36:57 EST




On Mon, 14 Dec 2009, Russ Dill wrote:
> @@ -144,10 +144,9 @@ static int __find_interface(struct device *dev, void *data)
> return 0;
>
> intf = to_usb_interface(dev);
> - if (intf->minor != -1 && intf->minor == arg->minor) {
> - arg->interface = intf;
> + if (intf->minor != -1 && intf->minor == arg->minor &&
> + dev->driver == arg->drv)
> return 1;
> - }
> return 0;
> }

Btw, can we please write this somewhat more readably, and just do

if (dev->driver != arg->drv)
return 0;
intf = to_usb_interface(dev);
return intf->minor == arg->minor;

because the whole "intf->minor != -1" thing is pointless (we're going to
test it against 'arg->minor', and if that is -1, then the caller damn well
gets what he deserves anyway).

This way there are no complex multi-line crud expressions, and it all
looks simpler. No?

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/