Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Something
Saturday, April 27th, 2013 at 10:26:07pm UTC 

  1. diff --git a/drivers/usb/gadget/jz4740_udc.c b/drivers/usb/gadget/jz4740_udc.c
  2. index 8d36434..3824bfb 100644
  3. --- a/drivers/usb/gadget/jz4740_udc.c
  4. +++ b/drivers/usb/gadget/jz4740_udc.c
  5. @@ -37,7 +37,6 @@
  6.  #include <asm/byteorder.h>
  7.  #include <asm/io.h>
  8.  #include <asm/irq.h>
  9. -#include <asm/system.h>
  10.  #include <asm/mach-jz4740/clock.h>
  11.  
  12.  #include "jz4740_udc.h"
  13. @@ -160,9 +159,10 @@ static struct jz4740_udc jz4740_udc_controller;
  14.  /*
  15.   * Local declarations.
  16.   */
  17. -static int jz4740_udc_start(struct usb_gadget_driver *driver,
  18. -              int (*bind)(struct usb_gadget *));
  19. -static int jz4740_udc_stop(struct usb_gadget_driver *driver);
  20. +static int jz4740_udc_start(struct usb_gadget *g,
  21. +                         struct usb_gadget_driver *driver);
  22. +static int jz4740_udc_stop(struct usb_gadget *g,
  23. +                        struct usb_gadget_driver *driver);
  24.  static void jz4740_ep0_kick(struct jz4740_udc *dev, struct jz4740_ep *ep);
  25.  static void jz4740_handle_ep0(struct jz4740_udc *dev, uint32_t intr);
  26.  
  27. @@ -416,36 +416,15 @@ static void udc_enable(struct jz4740_udc *dev)
  28.   * Register entry point for the peripheral controller driver.
  29.   */
  30.  
  31. -static int jz4740_udc_start(struct usb_gadget_driver *driver,
  32. -              int (*bind)(struct usb_gadget *))
  33. +static int jz4740_udc_start(struct usb_gadget *g,
  34. +                         struct usb_gadget_driver *driver)
  35.  {
  36. -       struct jz4740_udc *dev = &jz4740_udc_controller;
  37. -       int retval;
  38. -
  39. -       if (!driver || !bind)
  40. -              return -EINVAL;
  41. -
  42. -       if (!dev)
  43. -              return -ENODEV;
  44. -
  45. -       if (dev->driver)
  46. -              return -EBUSY;
  47. +       struct jz4740_udc *dev = to_jz4740_udc(g);
  48.  
  49.         /* hook up the driver */
  50.         dev->driver = driver;
  51.         dev->gadget.dev.driver = &driver->driver;
  52.  
  53. -       retval = bind(&dev->gadget);
  54. -       if (retval) {
  55. -              DEBUG("%s: bind to driver %s --> error %d\n", dev->gadget.name,
  56. -                          driver->driver.name, retval);
  57. -              dev->driver = 0;
  58. -              return retval;
  59. -       }
  60. -
  61. -       /* then enable host detection and ep0; and we're ready
  62. -        * for set_configuration as well as eventual disconnect.
  63. -        */
  64.         udc_enable(dev);
  65.  
  66.         DEBUG("%s: registered gadget driver '%s'\n", dev->gadget.name,
  67. @@ -491,19 +470,13 @@ static void stop_activity(struct jz4740_udc *dev,
  68.  /*
  69.   * Unregister entry point for the peripheral controller driver.
  70.   */
  71. -static int jz4740_udc_stop(struct usb_gadget_driver *driver)
  72. +static int jz4740_udc_stop(struct usb_gadget *g,
  73. +                        struct usb_gadget_driver *driver)
  74.  {
  75. -       struct jz4740_udc *dev = &jz4740_udc_controller;
  76. +       struct jz4740_udc *dev = to_jz4740_udc(g);
  77.         unsigned long flags;
  78.         DEBUG("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
  79.  
  80. -       if (!dev)
  81. -              return -ENODEV;
  82. -       if (!driver || driver != dev->driver)
  83. -              return -EINVAL;
  84. -       if (!driver->unbind)
  85. -              return -EBUSY;
  86. -
  87.         spin_lock_irqsave(&dev->lock, flags);
  88.         dev->driver = 0;
  89.         stop_activity(dev, driver);
  90. @@ -1933,11 +1906,11 @@ static int jz4740_udc_pullup(struct usb_gadget *_gadget, int on)
  91.  
  92.  
  93.  static const struct usb_gadget_ops jz4740_udc_ops = {
  94. -       .get_frame = jz4740_udc_get_frame,
  95. -       .wakeup = jz4740_udc_wakeup,
  96. -       .pullup = jz4740_udc_pullup,
  97. -       .start = jz4740_udc_start,
  98. -       .stop = jz4740_udc_stop,
  99. +       .get_frame     = jz4740_udc_get_frame,
  100. +       .wakeup                = jz4740_udc_wakeup,
  101. +       .pullup                = jz4740_udc_pullup,
  102. +       .udc_start     = jz4740_udc_start,
  103. +       .udc_stop      = jz4740_udc_stop,
  104.  };
  105.  
  106.  static struct usb_ep_ops jz4740_ep_ops = {
  107. @@ -2037,7 +2010,7 @@ static struct jz4740_udc jz4740_udc_controller = {
  108.         },
  109.  };
  110.  
  111. -static int __devinit jz4740_udc_probe(struct platform_device *pdev)
  112. +static int jz4740_udc_probe(struct platform_device *pdev)
  113.  {
  114.         struct jz4740_udc *jz4740_udc = &jz4740_udc_controller;
  115.         int ret;
  116. @@ -2120,7 +2093,7 @@ err_device_unregister:
  117.         return ret;
  118.  }
  119.  
  120. -static int __devexit jz4740_udc_remove(struct platform_device *pdev)
  121. +static int jz4740_udc_remove(struct platform_device *pdev)
  122.  {
  123.         struct jz4740_udc *dev = platform_get_drvdata(pdev);
  124.  
  125. @@ -2172,7 +2145,7 @@ static SIMPLE_DEV_PM_OPS(jz4740_udc_pm_ops, jz4740_udc_suspend, jz4740_udc_resum
  126.  
  127.  static struct platform_driver udc_driver = {
  128.         .probe  = jz4740_udc_probe,
  129. -       .remove                = __devexit_p(jz4740_udc_remove),
  130. +       .remove                = jz4740_udc_remove,
  131.         .driver                = {
  132.                .name  = "jz-udc",
  133.                .owner = THIS_MODULE,
  134. diff --git a/drivers/usb/gadget/jz4740_udc.h b/drivers/usb/gadget/jz4740_udc.h
  135. index 53fd1da..9247fe6 100644
  136. --- a/drivers/usb/gadget/jz4740_udc.h
  137. +++ b/drivers/usb/gadget/jz4740_udc.h
  138. @@ -86,6 +86,7 @@ struct jz4740_udc {
  139.         struct clk *clk;
  140.  };
  141.  
  142. +#define        to_jz4740_udc(g)        (container_of((g), struct jz4740_udc, gadget))
  143.  #define ep_maxpacket(EP)       ((EP)->ep.maxpacket)
  144.  
  145.  static inline bool ep_is_in(const struct jz4740_ep *ep)

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right