Re: [RFC 10/17] usb/ehci: make sh code use the new plat add code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 29, 2011 at 2:51 AM, Sebastian Andrzej Siewior
<sebastian@xxxxxxxxxxxxx> wrote:
> Make sh code use the new plat add code.
>
> Signed-off-by: Sebastian Andrzej Siewior <sebastian@xxxxxxxxxxxxx>
> ---
>  drivers/usb/host/ehci-sh.c |   67 +++----------------------------------------
>  1 files changed, 5 insertions(+), 62 deletions(-)
>
> diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c
> index a1a6935..937988a 100644
> --- a/drivers/usb/host/ehci-sh.c
> +++ b/drivers/usb/host/ehci-sh.c
> @@ -97,14 +97,9 @@ static const struct hc_driver ehci_sh_hc_driver = {
>
>  static int ehci_hcd_sh_probe(struct platform_device *pdev)
>  {
> -       const struct hc_driver *driver = &ehci_sh_hc_driver;
> -       struct resource *res;
>        struct ehci_sh_priv *priv;
>        struct usb_hcd *hcd;
> -       int irq, ret;
> -
> -       if (usb_disabled())
> -               return -ENODEV;
> +       int ret;
>
>        priv = kmalloc(sizeof(struct ehci_sh_priv), GFP_KERNEL);
>        if (!priv) {
> @@ -124,66 +119,17 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev)
>        clk_enable(priv->fclk);
>        clk_enable(priv->iclk);
>
> -       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -       if (!res) {
> -               dev_err(&pdev->dev,
> -                       "Found HC with no register addr. Check %s setup!\n",
> -                       dev_name(&pdev->dev));
> -               ret = -ENODEV;
> -               goto fail_create_hcd;
> -       }
> -
> -       irq = platform_get_irq(pdev, 0);
> -       if (irq <= 0) {
> -               dev_err(&pdev->dev,
> -                       "Found HC with no IRQ. Check %s setup!\n",
> -                       dev_name(&pdev->dev));
> -               ret = -ENODEV;
> -               goto fail_create_hcd;
> -       }
> -
> -       /* initialize hcd */
> -       hcd = usb_create_hcd(&ehci_sh_hc_driver, &pdev->dev,
> -                            dev_name(&pdev->dev));
> -       if (!hcd) {
> -               ret = -ENOMEM;
> +       hcd = ehci_hcd_plat_probe(pdev, &ehci_sh_hc_driver);
> +       if (IS_ERR(hcd)) {
> +               ret = PTR_ERR(hcd);
>                goto fail_create_hcd;
>        }
>
> -       hcd->rsrc_start = res->start;
> -       hcd->rsrc_len = resource_size(res);
> -
> -       if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,
> -                               driver->description)) {
> -               dev_dbg(&pdev->dev, "controller already in use\n");
> -               ret = -EBUSY;
> -               goto fail_request_resource;
> -       }
> -
> -       hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);
> -       if (hcd->regs == NULL) {
> -               dev_dbg(&pdev->dev, "error mapping memory\n");
> -               ret = -ENXIO;
> -               goto fail_ioremap;
> -       }
> -
> -       ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED);
> -       if (ret != 0) {
> -               dev_err(&pdev->dev, "Failed to add hcd");
> -               goto fail_add_hcd;
> -       }
> -
where do you call ehci_hcd_plat_add()? Am I missing something?

>        priv->hcd = hcd;
>        platform_set_drvdata(pdev, priv);
>
>        return ret;
>
> -fail_add_hcd:
> -       iounmap(hcd->regs);
> -fail_ioremap:
> -       release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
> -fail_request_resource:
> -       usb_put_hcd(hcd);
>  fail_create_hcd:
>        dev_err(&pdev->dev, "init %s fail, %d\n", dev_name(&pdev->dev), ret);
>
> @@ -201,10 +147,7 @@ static int __exit ehci_hcd_sh_remove(struct platform_device *pdev)
>        struct ehci_sh_priv *priv = platform_get_drvdata(pdev);
>        struct usb_hcd *hcd = priv->hcd;
>
> -       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);
>        platform_set_drvdata(pdev, NULL);
>
>        clk_disable(priv->fclk);
> --
> 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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux