X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fmips%2Fau1000%2Fcommon%2Fusbdev.c;h=447a9a4612a88d083074f880622dcca24d530478;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=21e2a91aadbe3faf1017d4f43abf9519959afb85;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/arch/mips/au1000/common/usbdev.c b/arch/mips/au1000/common/usbdev.c index 21e2a91aa..447a9a461 100644 --- a/arch/mips/au1000/common/usbdev.c +++ b/arch/mips/au1000/common/usbdev.c @@ -61,8 +61,6 @@ #define vdbg(fmt, arg...) do {} while (0) #endif -#define MAX(a,b) (((a)>(b))?(a):(b)) - #define ALLOC_FLAGS (in_interrupt () ? GFP_ATOMIC : GFP_KERNEL) #define EP_FIFO_DEPTH 8 @@ -211,9 +209,8 @@ dump_setup(struct usb_ctrlrequest* s) static inline usbdev_pkt_t * alloc_packet(endpoint_t * ep, int data_size, void* data) { - usbdev_pkt_t* pkt = - (usbdev_pkt_t *)kmalloc(sizeof(usbdev_pkt_t) + data_size, - ALLOC_FLAGS); + usbdev_pkt_t* pkt = kmalloc(sizeof(usbdev_pkt_t) + data_size, + ALLOC_FLAGS); if (!pkt) return NULL; pkt->ep_addr = ep->address; @@ -769,7 +766,7 @@ do_get_descriptor(struct usb_dev* dev, struct usb_ctrlrequest* setup) dev->conf_desc), 0); } else { - int len = dev->conf_desc->wTotalLength; + int len = le16_to_cpu(dev->conf_desc->wTotalLength); dbg("sending whole config desc," " size=%d, our size=%d", desc_len, len); desc_len = desc_len > len ? len : desc_len; @@ -1401,7 +1398,7 @@ usbdev_init(struct usb_device_descriptor* dev_desc, epd->bEndpointAddress |= (u8)ep->address; ep->direction = epd->bEndpointAddress & 0x80; ep->type = epd->bmAttributes & 0x03; - ep->max_pkt_size = epd->wMaxPacketSize; + ep->max_pkt_size = le16_to_cpu(epd->wMaxPacketSize); spin_lock_init(&ep->lock); ep->desc = epd; ep->reg = &ep_reg[ep->address]; @@ -1410,7 +1407,7 @@ usbdev_init(struct usb_device_descriptor* dev_desc, /* * initialize the full config descriptor */ - usbdev.full_conf_desc = fcd = kmalloc(config_desc->wTotalLength, + usbdev.full_conf_desc = fcd = kmalloc(le16_to_cpu(config_desc->wTotalLength), ALLOC_FLAGS); if (!fcd) { err("failed to alloc full config descriptor");