On Mon, Aug 29, 2011 at 2:51 AM, Sebastian Andrzej Siewior <sebastian@xxxxxxxxxxxxx> wrote: > Make au1xxx use generic add code. > > Signed-off-by: Sebastian Andrzej Siewior <sebastian@xxxxxxxxxxxxx> > --- > drivers/usb/host/ehci-au1xxx.c | 74 ++++++++++++---------------------------- > 1 files changed, 22 insertions(+), 52 deletions(-) > > diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c > index 4363fea..43f6ff0 100644 > --- a/drivers/usb/host/ehci-au1xxx.c > +++ b/drivers/usb/host/ehci-au1xxx.c > @@ -72,7 +72,20 @@ static void au1xxx_stop_ehc(void) > static int au1xxx_ehci_setup(struct usb_hcd *hcd) > { > struct ehci_hcd *ehci = hcd_to_ehci(hcd); > - int ret = ehci_init(hcd); > + int ret; > + > + au1xxx_start_ehc(); > + > + ehci = hcd_to_ehci(hcd); > + ehci->caps = hcd->regs; > + ehci->regs = hcd->regs + > + HC_LENGTH(ehci, readl(&ehci->caps->hc_capbase)); > + /* cache this readonly data; minimize chip reads */ > + ehci->hcs_params = readl(&ehci->caps->hcs_params); > + > + ret = ehci_init(hcd); > + if (ret) > + au1xxx_stop_ehc(); > > ehci->need_io_watchdog = 0; > return ret; > @@ -133,9 +146,6 @@ static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev) > struct resource *res; > int ret; > > - if (usb_disabled()) > - return -ENODEV; > - > #if defined(CONFIG_SOC_AU1200) && defined(CONFIG_DMA_COHERENT) > /* Au1200 AB USB does not support coherent memory */ > if (!(read_c0_prid() & 0xff)) { > @@ -146,53 +156,16 @@ static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev) > } > #endif > > - if (pdev->resource[1].flags != IORESOURCE_IRQ) { > - pr_debug("resource[1] is not IORESOURCE_IRQ"); > - return -ENOMEM; > - } > - hcd = usb_create_hcd(&ehci_au1xxx_hc_driver, &pdev->dev, "Au1xxx"); > - if (!hcd) > - return -ENOMEM; > - > - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > - hcd->rsrc_start = res->start; > - hcd->rsrc_len = resource_size(res); > - > - if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { > - pr_debug("request_mem_region failed"); > - ret = -EBUSY; > - goto err1; > - } > - > - hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); > - if (!hcd->regs) { > - pr_debug("ioremap failed"); > - ret = -ENOMEM; > - goto err2; > - } > - > - au1xxx_start_ehc(); > - > - ehci = hcd_to_ehci(hcd); > - ehci->caps = hcd->regs; > - ehci->regs = hcd->regs + > - HC_LENGTH(ehci, readl(&ehci->caps->hc_capbase)); > - /* cache this readonly data; minimize chip reads */ > - ehci->hcs_params = readl(&ehci->caps->hcs_params); > - > - ret = usb_add_hcd(hcd, pdev->resource[1].start, > - IRQF_DISABLED | IRQF_SHARED); here the irqflag is set to IRQF_DISABLED | IRQF_SHARED. But your generic ehci_hcd_plat_add sets it to IRQF_SHARED always. > - if (ret == 0) { > - platform_set_drvdata(pdev, hcd); > - return ret; > + hcd = ehci_hcd_plat_add(pdev, ehci_au1xxx_hc_driver); > + if (IS_ERR(hcd)) { > + ret = PTR_ERR(hcd); > + goto err_add_hcd; > } > + platform_set_drvdata(pdev, hcd); > + return 0; > > +err_add_hcd: > au1xxx_stop_ehc(); > - iounmap(hcd->regs); > -err2: > - release_mem_region(hcd->rsrc_start, hcd->rsrc_len); > -err1: > - usb_put_hcd(hcd); > return ret; > } > > @@ -200,10 +173,7 @@ static int ehci_hcd_au1xxx_drv_remove(struct platform_device *pdev) > { > struct usb_hcd *hcd = platform_get_drvdata(pdev); > > - usb_remove_hcd(hcd); > - iounmap(hcd->regs); > - release_mem_region(hcd->rsrc_start, hcd->rsrc_len); > - usb_put_hcd(hcd); > + ehci_hcd_plat_cleanup(pdev, hcd); > au1xxx_stop_ehc(); > platform_set_drvdata(pdev, NULL); > > -- > 1.7.5.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html