]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/host/r8a66597-hcd.c
USB: use DIV_ROUND_UP
[linux-2.6-omap-h63xx.git] / drivers / usb / host / r8a66597-hcd.c
index 0a699efe6c9c818b1c3499cf73f627f0c5cf9907..afd4fbe7713cf71c2631c76469e35f697d3a9575 100644 (file)
@@ -44,6 +44,7 @@
 MODULE_DESCRIPTION("R8A66597 USB Host Controller Driver");
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Yoshihiro Shimoda");
+MODULE_ALIAS("platform:r8a66597_hcd");
 
 #define DRIVER_VERSION "29 May 2007"
 
@@ -834,7 +835,7 @@ static void init_pipe_info(struct r8a66597 *r8a66597, struct urb *urb,
        info.pipenum = get_empty_pipenum(r8a66597, ep);
        info.address = get_urb_to_r8a66597_addr(r8a66597, urb);
        info.epnum = ep->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
-       info.maxpacket = ep->wMaxPacketSize;
+       info.maxpacket = le16_to_cpu(ep->wMaxPacketSize);
        info.type = get_r8a66597_type(ep->bmAttributes
                                      & USB_ENDPOINT_XFERTYPE_MASK);
        info.bufnum = get_bufnum(info.pipenum);
@@ -925,7 +926,7 @@ static void prepare_setup_packet(struct r8a66597 *r8a66597,
        r8a66597_write(r8a66597, ~(SIGN | SACK), INTSTS1);
 
        for (i = 0; i < 4; i++) {
-               r8a66597_write(r8a66597, p[i], setup_addr);
+               r8a66597_write(r8a66597, cpu_to_le16(p[i]), setup_addr);
                setup_addr += 2;
        }
        r8a66597_write(r8a66597, SUREQ, DCPCTR);
@@ -959,9 +960,9 @@ static void prepare_packet_read(struct r8a66597 *r8a66597,
                                r8a66597_write(r8a66597, TRCLR,
                                                td->pipe->pipetre);
                                r8a66597_write(r8a66597,
-                                               (urb->transfer_buffer_length
-                                               + td->maxpacket - 1)
-                                               / td->maxpacket,
+                                               DIV_ROUND_UP
+                                                 (urb->transfer_buffer_length,
+                                                  td->maxpacket),
                                                td->pipe->pipetrn);
                                r8a66597_bset(r8a66597, TRENB,
                                                td->pipe->pipetre);
@@ -2027,7 +2028,7 @@ static int r8a66597_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
        case GetPortStatus:
                if (wIndex > R8A66597_MAX_ROOT_HUB)
                        goto error;
-               *(u32 *)buf = rh->port;
+               *(u32 *)buf = cpu_to_le32(rh->port);
                break;
        case SetPortFeature:
                if (wIndex > R8A66597_MAX_ROOT_HUB)
@@ -2126,8 +2127,8 @@ static int __init_or_module r8a66597_remove(struct platform_device *pdev)
        struct usb_hcd          *hcd = r8a66597_to_hcd(r8a66597);
 
        del_timer_sync(&r8a66597->rh_timer);
-       iounmap((void *)r8a66597->reg);
        usb_remove_hcd(hcd);
+       iounmap((void *)r8a66597->reg);
        usb_put_hcd(hcd);
        return 0;
 }
@@ -2197,7 +2198,7 @@ static int __init r8a66597_probe(struct platform_device *pdev)
        INIT_LIST_HEAD(&r8a66597->child_device);
 
        hcd->rsrc_start = res->start;
-       ret = usb_add_hcd(hcd, irq, 0);
+       ret = usb_add_hcd(hcd, irq, IRQF_DISABLED);
        if (ret != 0) {
                err("Failed to add hcd");
                goto clean_up;
@@ -2219,6 +2220,7 @@ static struct platform_driver r8a66597_driver = {
        .resume =       r8a66597_resume,
        .driver         = {
                .name = (char *) hcd_name,
+               .owner  = THIS_MODULE,
        },
 };