Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 265079
b: refs/heads/master
c: 478ff25
h: refs/heads/master
i:
  265077: efcd83b
  265075: 1352997
  265071: edd2310
v: v3
  • Loading branch information
Felipe Balbi committed Oct 13, 2011
1 parent 146e334 commit 4e1e013
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: af1d7056a5c1e5eaaf807ddd1423101db84668d0
refs/heads/master: 478ff25adef3d0ec394c8870fcf317c26839b482
37 changes: 8 additions & 29 deletions trunk/drivers/usb/gadget/r8a66597-udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1738,23 +1738,18 @@ static struct usb_ep_ops r8a66597_ep_ops = {
};

/*-------------------------------------------------------------------------*/
static struct r8a66597 *the_controller;

static int r8a66597_start(struct usb_gadget_driver *driver,
int (*bind)(struct usb_gadget *))
static int r8a66597_start(struct usb_gadget *gadget,
struct usb_gadget_driver *driver)
{
struct r8a66597 *r8a66597 = the_controller;
struct r8a66597 *r8a66597 = gadget_to_r8a66597(gadget);
int retval;

if (!driver
|| driver->speed != USB_SPEED_HIGH
|| !bind
|| !driver->setup)
return -EINVAL;
if (!r8a66597)
return -ENODEV;
if (r8a66597->driver)
return -EBUSY;

/* hook up the driver */
driver->driver.bus = NULL;
Expand All @@ -1768,14 +1763,6 @@ static int r8a66597_start(struct usb_gadget_driver *driver,
goto error;
}

retval = bind(&r8a66597->gadget);
if (retval) {
dev_err(r8a66597_to_dev(r8a66597),
"bind to driver error (%d)\n", retval);
device_del(&r8a66597->gadget.dev);
goto error;
}

init_controller(r8a66597);
r8a66597_bset(r8a66597, VBSE, INTENB0);
if (r8a66597_read(r8a66597, INTSTS0) & VBSTS) {
Expand All @@ -1796,23 +1783,17 @@ static int r8a66597_start(struct usb_gadget_driver *driver,
return retval;
}

static int r8a66597_stop(struct usb_gadget_driver *driver)
static int r8a66597_stop(struct usb_gadget *gadget,
struct usb_gadget_driver *driver)
{
struct r8a66597 *r8a66597 = the_controller;
struct r8a66597 *r8a66597 = gadget_to_r8a66597(gadget);
unsigned long flags;

if (driver != r8a66597->driver || !driver->unbind)
return -EINVAL;

spin_lock_irqsave(&r8a66597->lock, flags);
if (r8a66597->gadget.speed != USB_SPEED_UNKNOWN)
r8a66597_usb_disconnect(r8a66597);
r8a66597_bclr(r8a66597, VBSE, INTENB0);
disable_controller(r8a66597);
spin_unlock_irqrestore(&r8a66597->lock, flags);

driver->unbind(&r8a66597->gadget);

device_del(&r8a66597->gadget.dev);
r8a66597->driver = NULL;
return 0;
Expand Down Expand Up @@ -1842,8 +1823,8 @@ static int r8a66597_pullup(struct usb_gadget *gadget, int is_on)

static struct usb_gadget_ops r8a66597_gadget_ops = {
.get_frame = r8a66597_get_frame,
.start = r8a66597_start,
.stop = r8a66597_stop,
.udc_start = r8a66597_start,
.udc_stop = r8a66597_stop,
.pullup = r8a66597_pullup,
};

Expand Down Expand Up @@ -2010,8 +1991,6 @@ static int __init r8a66597_probe(struct platform_device *pdev)
r8a66597->pipenum2ep[0] = &r8a66597->ep[0];
r8a66597->epaddr2ep[0] = &r8a66597->ep[0];

the_controller = r8a66597;

r8a66597->ep0_req = r8a66597_alloc_request(&r8a66597->ep[0].ep,
GFP_KERNEL);
if (r8a66597->ep0_req == NULL)
Expand Down

0 comments on commit 4e1e013

Please sign in to comment.