mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-31 00:24:12 +00:00
minor usb driver cleanup
SVN-Revision: 8385
This commit is contained in:
parent
b682b4a79e
commit
cf2cfdf9ba
@ -89,7 +89,6 @@ MODULE_AUTHOR("Jeroen Vreeken (pe1rxq@amsat.org)");
|
||||
#define ADMHCD_REG_PORTSTATUS1 0x7c
|
||||
#define ADMHCD_REG_HOSTHEAD 0x80
|
||||
|
||||
|
||||
#define ADMHCD_NUMPORTS 2
|
||||
|
||||
struct admhcd_ed {
|
||||
@ -218,12 +217,12 @@ static struct admhcd_td *admhcd_td_alloc(struct admhcd_ed *ed, struct urb *urb)
|
||||
{
|
||||
struct admhcd_td *tdn, *td;
|
||||
|
||||
tdn = kmalloc(sizeof(struct admhcd_td), GFP_ATOMIC);
|
||||
tdn = kzalloc(sizeof(*tdn), GFP_ATOMIC);
|
||||
if (!tdn)
|
||||
return NULL;
|
||||
|
||||
tdn->real = tdn;
|
||||
tdn = (struct admhcd_td *)KSEG1ADDR(tdn);
|
||||
memset(tdn, 0, sizeof(struct admhcd_td));
|
||||
if (ed->cur == NULL) {
|
||||
ed->cur = tdn;
|
||||
ed->head = tdn;
|
||||
@ -284,10 +283,9 @@ static struct admhcd_ed *admhcd_get_ed(struct admhcd *ahcd,
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
found = kmalloc(sizeof(struct admhcd_ed), GFP_ATOMIC);
|
||||
found = kzalloc(sizeof(*found), GFP_ATOMIC);
|
||||
if (!found)
|
||||
goto out;
|
||||
memset(found, 0, sizeof(struct admhcd_ed));
|
||||
found->real = found;
|
||||
found->ep = ep;
|
||||
found = (struct admhcd_ed *)KSEG1ADDR(found);
|
||||
@ -342,7 +340,7 @@ static void admhcd_ed_start(struct admhcd *ahcd, struct admhcd_ed *ed)
|
||||
ahcd->dma_en |= ADMHCD_DMA_EN;
|
||||
}
|
||||
|
||||
static irqreturn_t adm5120hcd_irq(struct usb_hcd *hcd)
|
||||
static irqreturn_t admhcd_irq(struct usb_hcd *hcd)
|
||||
{
|
||||
struct admhcd *ahcd = hcd_to_admhcd(hcd);
|
||||
u32 intstatus;
|
||||
@ -350,12 +348,14 @@ static irqreturn_t adm5120hcd_irq(struct usb_hcd *hcd)
|
||||
intstatus = admhcd_reg_get(ahcd, ADMHCD_REG_INTSTATUS);
|
||||
if (intstatus & ADMHCD_INT_FATAL) {
|
||||
admhcd_reg_set(ahcd, ADMHCD_REG_INTSTATUS, ADMHCD_INT_FATAL);
|
||||
//
|
||||
/* FIXME: handle fatal interrupts */
|
||||
}
|
||||
|
||||
if (intstatus & ADMHCD_INT_SW) {
|
||||
admhcd_reg_set(ahcd, ADMHCD_REG_INTSTATUS, ADMHCD_INT_SW);
|
||||
//
|
||||
/* FIXME: handle software interrupts */
|
||||
}
|
||||
|
||||
if (intstatus & ADMHCD_INT_TD) {
|
||||
struct admhcd_ed *ed, *head;
|
||||
|
||||
@ -551,6 +551,7 @@ static void admhcd_endpoint_disable(struct usb_hcd *hcd, struct usb_host_endpoin
|
||||
}
|
||||
for (edt = head; edt->next != ed; edt = edt->next);
|
||||
edt->next = ed->next;
|
||||
|
||||
out_free:
|
||||
kfree(ed->real);
|
||||
out:
|
||||
@ -729,10 +730,10 @@ static int admhcd_start(struct usb_hcd *hcd)
|
||||
admhcd_reg_set(ahcd, ADMHCD_REG_LSTHRESH, 0x628);
|
||||
|
||||
/* Set interrupts */
|
||||
admhcd_reg_set(ahcd, ADMHCD_REG_INTENABLE,
|
||||
ADMHCD_INT_ACT | ADMHCD_INT_FATAL | ADMHCD_INT_SW | ADMHCD_INT_TD);
|
||||
admhcd_reg_set(ahcd, ADMHCD_REG_INTSTATUS,
|
||||
ADMHCD_INT_ACT | ADMHCD_INT_FATAL | ADMHCD_INT_SW | ADMHCD_INT_TD);
|
||||
admhcd_reg_set(ahcd, ADMHCD_REG_INTENABLE, ADMHCD_INT_ACT |
|
||||
ADMHCD_INT_FATAL | ADMHCD_INT_SW | ADMHCD_INT_TD);
|
||||
admhcd_reg_set(ahcd, ADMHCD_REG_INTSTATUS, ADMHCD_INT_ACT |
|
||||
ADMHCD_INT_FATAL | ADMHCD_INT_SW | ADMHCD_INT_TD);
|
||||
|
||||
/* Power on all ports */
|
||||
admhcd_reg_set(ahcd, ADMHCD_REG_RHDESCR, ADMHCD_NPS | ADMHCD_LPSC);
|
||||
@ -830,7 +831,7 @@ static struct hc_driver adm5120_hc_driver = {
|
||||
.description = hcd_name,
|
||||
.product_desc = "ADM5120 HCD",
|
||||
.hcd_priv_size = sizeof(struct admhcd),
|
||||
.irq = adm5120hcd_irq,
|
||||
.irq = admhcd_irq,
|
||||
.flags = HCD_USB11,
|
||||
.urb_enqueue = admhcd_urb_enqueue,
|
||||
.urb_dequeue = admhcd_urb_dequeue,
|
||||
|
Loading…
x
Reference in New Issue
Block a user