aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>2011-10-31 03:01:29 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-11-14 14:51:19 -0500
commitb8cbbf803d5ad0971665dd502d784148464c6d1a (patch)
treef43e481d6d040f1e18c5c8756e291b679499d287 /drivers/usb
parent0de174b56ba70e5c0a26de9b5d2889260164d666 (diff)
usb: gadget: r8a66597-udc: fix for udc-newstyle
The udc-newstyle needs device_register in probe() of platform_device. If it doesn't call, kernel panic happens in the sysfs_create_dir() when we run modprobe a gadget driver. [ balbi@ti.com : fix compile warning introduced by this patch ] Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/r8a66597-udc.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c
index 68a826a1b866..38f99887b935 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -1742,7 +1742,6 @@ static int r8a66597_start(struct usb_gadget *gadget,
1742 struct usb_gadget_driver *driver) 1742 struct usb_gadget_driver *driver)
1743{ 1743{
1744 struct r8a66597 *r8a66597 = gadget_to_r8a66597(gadget); 1744 struct r8a66597 *r8a66597 = gadget_to_r8a66597(gadget);
1745 int retval;
1746 1745
1747 if (!driver 1746 if (!driver
1748 || driver->speed != USB_SPEED_HIGH 1747 || driver->speed != USB_SPEED_HIGH
@@ -1752,16 +1751,7 @@ static int r8a66597_start(struct usb_gadget *gadget,
1752 return -ENODEV; 1751 return -ENODEV;
1753 1752
1754 /* hook up the driver */ 1753 /* hook up the driver */
1755 driver->driver.bus = NULL;
1756 r8a66597->driver = driver; 1754 r8a66597->driver = driver;
1757 r8a66597->gadget.dev.driver = &driver->driver;
1758
1759 retval = device_add(&r8a66597->gadget.dev);
1760 if (retval) {
1761 dev_err(r8a66597_to_dev(r8a66597), "device_add error (%d)\n",
1762 retval);
1763 goto error;
1764 }
1765 1755
1766 init_controller(r8a66597); 1756 init_controller(r8a66597);
1767 r8a66597_bset(r8a66597, VBSE, INTENB0); 1757 r8a66597_bset(r8a66597, VBSE, INTENB0);
@@ -1775,12 +1765,6 @@ static int r8a66597_start(struct usb_gadget *gadget,
1775 } 1765 }
1776 1766
1777 return 0; 1767 return 0;
1778
1779error:
1780 r8a66597->driver = NULL;
1781 r8a66597->gadget.dev.driver = NULL;
1782
1783 return retval;
1784} 1768}
1785 1769
1786static int r8a66597_stop(struct usb_gadget *gadget, 1770static int r8a66597_stop(struct usb_gadget *gadget,
@@ -1794,7 +1778,6 @@ static int r8a66597_stop(struct usb_gadget *gadget,
1794 disable_controller(r8a66597); 1778 disable_controller(r8a66597);
1795 spin_unlock_irqrestore(&r8a66597->lock, flags); 1779 spin_unlock_irqrestore(&r8a66597->lock, flags);
1796 1780
1797 device_del(&r8a66597->gadget.dev);
1798 r8a66597->driver = NULL; 1781 r8a66597->driver = NULL;
1799 return 0; 1782 return 0;
1800} 1783}
@@ -1845,6 +1828,7 @@ static int __exit r8a66597_remove(struct platform_device *pdev)
1845 clk_put(r8a66597->clk); 1828 clk_put(r8a66597->clk);
1846 } 1829 }
1847#endif 1830#endif
1831 device_unregister(&r8a66597->gadget.dev);
1848 kfree(r8a66597); 1832 kfree(r8a66597);
1849 return 0; 1833 return 0;
1850} 1834}
@@ -1924,13 +1908,17 @@ static int __init r8a66597_probe(struct platform_device *pdev)
1924 r8a66597->irq_sense_low = irq_trigger == IRQF_TRIGGER_LOW; 1908 r8a66597->irq_sense_low = irq_trigger == IRQF_TRIGGER_LOW;
1925 1909
1926 r8a66597->gadget.ops = &r8a66597_gadget_ops; 1910 r8a66597->gadget.ops = &r8a66597_gadget_ops;
1927 device_initialize(&r8a66597->gadget.dev);
1928 dev_set_name(&r8a66597->gadget.dev, "gadget"); 1911 dev_set_name(&r8a66597->gadget.dev, "gadget");
1929 r8a66597->gadget.is_dualspeed = 1; 1912 r8a66597->gadget.is_dualspeed = 1;
1930 r8a66597->gadget.dev.parent = &pdev->dev; 1913 r8a66597->gadget.dev.parent = &pdev->dev;
1931 r8a66597->gadget.dev.dma_mask = pdev->dev.dma_mask; 1914 r8a66597->gadget.dev.dma_mask = pdev->dev.dma_mask;
1932 r8a66597->gadget.dev.release = pdev->dev.release; 1915 r8a66597->gadget.dev.release = pdev->dev.release;
1933 r8a66597->gadget.name = udc_name; 1916 r8a66597->gadget.name = udc_name;
1917 ret = device_register(&r8a66597->gadget.dev);
1918 if (ret < 0) {
1919 dev_err(&pdev->dev, "device_register failed\n");
1920 goto clean_up;
1921 }
1934 1922
1935 init_timer(&r8a66597->timer); 1923 init_timer(&r8a66597->timer);
1936 r8a66597->timer.function = r8a66597_timer; 1924 r8a66597->timer.function = r8a66597_timer;
@@ -1945,7 +1933,7 @@ static int __init r8a66597_probe(struct platform_device *pdev)
1945 dev_err(&pdev->dev, "cannot get clock \"%s\"\n", 1933 dev_err(&pdev->dev, "cannot get clock \"%s\"\n",
1946 clk_name); 1934 clk_name);
1947 ret = PTR_ERR(r8a66597->clk); 1935 ret = PTR_ERR(r8a66597->clk);
1948 goto clean_up; 1936 goto clean_up_dev;
1949 } 1937 }
1950 clk_enable(r8a66597->clk); 1938 clk_enable(r8a66597->clk);
1951 } 1939 }
@@ -2014,7 +2002,9 @@ clean_up2:
2014 clk_disable(r8a66597->clk); 2002 clk_disable(r8a66597->clk);
2015 clk_put(r8a66597->clk); 2003 clk_put(r8a66597->clk);
2016 } 2004 }
2005clean_up_dev:
2017#endif 2006#endif
2007 device_unregister(&r8a66597->gadget.dev);
2018clean_up: 2008clean_up:
2019 if (r8a66597) { 2009 if (r8a66597) {
2020 if (r8a66597->sudmac_reg) 2010 if (r8a66597->sudmac_reg)