]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
HID: Use DIV_ROUND_UP
authorJulia Lawall <julia@diku.dk>
Fri, 15 Feb 2008 12:53:11 +0000 (13:53 +0100)
committerJiri Kosina <jkosina@suse.cz>
Tue, 18 Mar 2008 10:20:30 +0000 (11:20 +0100)
The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /
(d)) but is perhaps more readable.

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/usbhid/hid-core.c

index b38e559b7a46073dab466375200002828f7602ab..d95979f0e028adb0f3090a724bbc481882eeeecb 100644 (file)
@@ -278,7 +278,7 @@ static int hid_submit_ctrl(struct hid_device *hid)
                usbhid->urbctrl->pipe = usb_rcvctrlpipe(hid_to_usb_dev(hid), 0);
                maxpacket = usb_maxpacket(hid_to_usb_dev(hid), usbhid->urbctrl->pipe, 0);
                if (maxpacket > 0) {
-                       padlen = (len + maxpacket - 1) / maxpacket;
+                       padlen = DIV_ROUND_UP(len, maxpacket);
                        padlen *= maxpacket;
                        if (padlen > usbhid->bufsize)
                                padlen = usbhid->bufsize;