#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
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;
{
u32 cs;
- warn(__FUNCTION__);
+ warn("%s", __FUNCTION__);
cs = au_readl(ep->reg->ctrl_stat) | USBDEV_CS_STALL;
au_writel(cs, ep->reg->ctrl_stat);
{
u32 cs;
- warn(__FUNCTION__);
+ warn("%s", __FUNCTION__);
cs = au_readl(ep->reg->ctrl_stat) & ~USBDEV_CS_STALL;
au_writel(cs, ep->reg->ctrl_stat);
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;
#endif
dev->ep0_stage = SETUP_STAGE;
break;
- }
+ }
spin_unlock(&ep0->lock);
- // we're done processing the packet, free it
- kfree(pkt);
+ // we're done processing the packet, free it
+ kfree(pkt);
}
clear_dma_done1(ep0->indma);
pkt = send_packet_complete(ep0);
- if (pkt)
- kfree(pkt);
+ kfree(pkt);
}
/*
endpoint_flush(ep);
}
- if (usbdev.full_conf_desc)
- kfree(usbdev.full_conf_desc);
+ kfree(usbdev.full_conf_desc);
}
int
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];
/*
* 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");