diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2015-01-21 00:55:40 +0200 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-01-27 09:38:03 -0600 |
commit | 7eb42c6e808a0a18b8493268d06e05c1654fbbb2 (patch) | |
tree | 75dc87a6630c536fdf3b696542dec4bdf6a86267 /drivers/usb/host/isp1760-if.c | |
parent | 9fdd84d23c76825f3fc3c0782ea433c52d41971a (diff) | |
download | linux-7eb42c6e808a0a18b8493268d06e05c1654fbbb2.tar.bz2 |
usb: isp1760: Use the gpio descriptor API
Switching to the managed gpio descriptor API simplifies both error and
cleanup code paths (by removing the need to free the gpio) and runtime
code (by removing manual handling of the active low flag). It also
permits handling the reset gpio entirely from within the HCD code,
sharing it between the different glue layers.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/host/isp1760-if.c')
-rw-r--r-- | drivers/usb/host/isp1760-if.c | 39 |
1 files changed, 7 insertions, 32 deletions
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c index 09254a43bc01..7e8e7f60ee57 100644 --- a/drivers/usb/host/isp1760-if.c +++ b/drivers/usb/host/isp1760-if.c @@ -24,7 +24,6 @@ #include <linux/of_platform.h> #include <linux/of_address.h> #include <linux/of_irq.h> -#include <linux/of_gpio.h> #endif #ifdef CONFIG_PCI @@ -34,7 +33,6 @@ #if defined(CONFIG_OF) && defined(CONFIG_OF_IRQ) struct isp1760 { struct usb_hcd *hcd; - int rst_gpio; }; static int of_isp1760_probe(struct platform_device *dev) @@ -47,7 +45,6 @@ static int of_isp1760_probe(struct platform_device *dev) resource_size_t res_len; int ret; unsigned int devflags = 0; - enum of_gpio_flags gpio_flags; u32 bus_width = 0; drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL); @@ -94,36 +91,17 @@ static int of_isp1760_probe(struct platform_device *dev) if (of_get_property(dp, "dreq-polarity", NULL) != NULL) devflags |= ISP1760_FLAG_DREQ_POL_HIGH; - drvdata->rst_gpio = of_get_gpio_flags(dp, 0, &gpio_flags); - if (gpio_is_valid(drvdata->rst_gpio)) { - ret = gpio_request(drvdata->rst_gpio, dev_name(&dev->dev)); - if (!ret) { - if (!(gpio_flags & OF_GPIO_ACTIVE_LOW)) { - devflags |= ISP1760_FLAG_RESET_ACTIVE_HIGH; - gpio_direction_output(drvdata->rst_gpio, 0); - } else { - gpio_direction_output(drvdata->rst_gpio, 1); - } - } else { - drvdata->rst_gpio = ret; - } - } - drvdata->hcd = isp1760_register(memory.start, res_len, virq, - IRQF_SHARED, drvdata->rst_gpio, - &dev->dev, dev_name(&dev->dev), - devflags); + IRQF_SHARED, &dev->dev, + dev_name(&dev->dev), devflags); if (IS_ERR(drvdata->hcd)) { ret = PTR_ERR(drvdata->hcd); - goto free_gpio; + goto release_reg; } platform_set_drvdata(dev, drvdata); return ret; -free_gpio: - if (gpio_is_valid(drvdata->rst_gpio)) - gpio_free(drvdata->rst_gpio); release_reg: release_mem_region(memory.start, res_len); free_data: @@ -140,9 +118,6 @@ static int of_isp1760_remove(struct platform_device *dev) release_mem_region(drvdata->hcd->rsrc_start, drvdata->hcd->rsrc_len); usb_put_hcd(drvdata->hcd); - if (gpio_is_valid(drvdata->rst_gpio)) - gpio_free(drvdata->rst_gpio); - kfree(drvdata); return 0; } @@ -279,8 +254,8 @@ static int isp1761_pci_probe(struct pci_dev *dev, dev->dev.dma_mask = NULL; hcd = isp1760_register(pci_mem_phy0, memlength, dev->irq, - IRQF_SHARED, -ENOENT, &dev->dev, dev_name(&dev->dev), - devflags); + IRQF_SHARED, &dev->dev, dev_name(&dev->dev), + devflags); if (IS_ERR(hcd)) { ret_status = -ENODEV; goto cleanup3; @@ -392,8 +367,8 @@ static int isp1760_plat_probe(struct platform_device *pdev) } hcd = isp1760_register(mem_res->start, mem_size, irq_res->start, - irqflags, -ENOENT, - &pdev->dev, dev_name(&pdev->dev), devflags); + irqflags, &pdev->dev, dev_name(&pdev->dev), + devflags); platform_set_drvdata(pdev, hcd); |