Commit 34422a5e authored by Robert Baldyga's avatar Robert Baldyga Committed by Felipe Balbi

usb: gadget: f_eem: eliminate abuse of ep->driver data

Since ep->driver_data is not used for endpoint claiming, neither for
enabled/disabled state storing, we can reduce number of places where
we read or modify it's value, as now it has no particular meaning for
function or framework logic.

In case of f_ecm, ep->driver_data was used only for endpoint claiming
and marking endpoints as enabled, so we can simplify code by reducing
it.
Signed-off-by: default avatarRobert Baldyga <r.baldyga@samsung.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 4aab757c
...@@ -195,11 +195,8 @@ static int eem_set_alt(struct usb_function *f, unsigned intf, unsigned alt) ...@@ -195,11 +195,8 @@ static int eem_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
goto fail; goto fail;
if (intf == eem->ctrl_id) { if (intf == eem->ctrl_id) {
if (eem->port.in_ep->driver_data) {
DBG(cdev, "reset eem\n"); DBG(cdev, "reset eem\n");
gether_disconnect(&eem->port); gether_disconnect(&eem->port);
}
if (!eem->port.in_ep->desc || !eem->port.out_ep->desc) { if (!eem->port.in_ep->desc || !eem->port.out_ep->desc) {
DBG(cdev, "init eem\n"); DBG(cdev, "init eem\n");
...@@ -237,7 +234,7 @@ static void eem_disable(struct usb_function *f) ...@@ -237,7 +234,7 @@ static void eem_disable(struct usb_function *f)
DBG(cdev, "eem deactivated\n"); DBG(cdev, "eem deactivated\n");
if (eem->port.in_ep->driver_data) if (eem->port.in_ep->enabled)
gether_disconnect(&eem->port); gether_disconnect(&eem->port);
} }
...@@ -293,13 +290,11 @@ static int eem_bind(struct usb_configuration *c, struct usb_function *f) ...@@ -293,13 +290,11 @@ static int eem_bind(struct usb_configuration *c, struct usb_function *f)
if (!ep) if (!ep)
goto fail; goto fail;
eem->port.in_ep = ep; eem->port.in_ep = ep;
ep->driver_data = cdev; /* claim */
ep = usb_ep_autoconfig(cdev->gadget, &eem_fs_out_desc); ep = usb_ep_autoconfig(cdev->gadget, &eem_fs_out_desc);
if (!ep) if (!ep)
goto fail; goto fail;
eem->port.out_ep = ep; eem->port.out_ep = ep;
ep->driver_data = cdev; /* claim */
status = -ENOMEM; status = -ENOMEM;
...@@ -325,11 +320,6 @@ static int eem_bind(struct usb_configuration *c, struct usb_function *f) ...@@ -325,11 +320,6 @@ static int eem_bind(struct usb_configuration *c, struct usb_function *f)
return 0; return 0;
fail: fail:
if (eem->port.out_ep)
eem->port.out_ep->driver_data = NULL;
if (eem->port.in_ep)
eem->port.in_ep->driver_data = NULL;
ERROR(cdev, "%s: can't bind, err %d\n", f->name, status); ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
return status; return status;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment