Commit 92c4a1b9 authored by Julia Lawall's avatar Julia Lawall Committed by Jiri Kosina

HID: Use DIV_ROUND_UP

The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /
(d)) but is perhaps more readable.
Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 790c9d8d
...@@ -278,7 +278,7 @@ static int hid_submit_ctrl(struct hid_device *hid) ...@@ -278,7 +278,7 @@ static int hid_submit_ctrl(struct hid_device *hid)
usbhid->urbctrl->pipe = usb_rcvctrlpipe(hid_to_usb_dev(hid), 0); usbhid->urbctrl->pipe = usb_rcvctrlpipe(hid_to_usb_dev(hid), 0);
maxpacket = usb_maxpacket(hid_to_usb_dev(hid), usbhid->urbctrl->pipe, 0); maxpacket = usb_maxpacket(hid_to_usb_dev(hid), usbhid->urbctrl->pipe, 0);
if (maxpacket > 0) { if (maxpacket > 0) {
padlen = (len + maxpacket - 1) / maxpacket; padlen = DIV_ROUND_UP(len, maxpacket);
padlen *= maxpacket; padlen *= maxpacket;
if (padlen > usbhid->bufsize) if (padlen > usbhid->bufsize)
padlen = usbhid->bufsize; padlen = usbhid->bufsize;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment