提交 101382ff 编写于 作者: R Robert Baldyga 提交者: Felipe Balbi

usb: gadget: f_phonet: 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_phonet we only need to store in ep->driver_data pointer to
struct f_phonet, as it's used in pn_tx_complete() and pn_rx_complete()
callbacks. All other uses of ep->driver_data are now meaningless and can
be safely removed.
Signed-off-by: NRobert Baldyga <r.baldyga@samsung.com>
Signed-off-by: NFelipe Balbi <balbi@ti.com>
上级 d277e1a3
...@@ -418,7 +418,7 @@ static int pn_set_alt(struct usb_function *f, unsigned intf, unsigned alt) ...@@ -418,7 +418,7 @@ static int pn_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
spin_lock(&port->lock); spin_lock(&port->lock);
if (fp->in_ep->driver_data) if (fp->in_ep->enabled)
__pn_reset(f); __pn_reset(f);
if (alt == 1) { if (alt == 1) {
...@@ -530,13 +530,11 @@ static int pn_bind(struct usb_configuration *c, struct usb_function *f) ...@@ -530,13 +530,11 @@ static int pn_bind(struct usb_configuration *c, struct usb_function *f)
if (!ep) if (!ep)
goto err; goto err;
fp->out_ep = ep; fp->out_ep = ep;
ep->driver_data = fp; /* Claim */
ep = usb_ep_autoconfig(gadget, &pn_fs_source_desc); ep = usb_ep_autoconfig(gadget, &pn_fs_source_desc);
if (!ep) if (!ep)
goto err; goto err;
fp->in_ep = ep; fp->in_ep = ep;
ep->driver_data = fp; /* Claim */
pn_hs_sink_desc.bEndpointAddress = pn_fs_sink_desc.bEndpointAddress; pn_hs_sink_desc.bEndpointAddress = pn_fs_sink_desc.bEndpointAddress;
pn_hs_source_desc.bEndpointAddress = pn_fs_source_desc.bEndpointAddress; pn_hs_source_desc.bEndpointAddress = pn_fs_source_desc.bEndpointAddress;
...@@ -575,10 +573,6 @@ static int pn_bind(struct usb_configuration *c, struct usb_function *f) ...@@ -575,10 +573,6 @@ static int pn_bind(struct usb_configuration *c, struct usb_function *f)
usb_ep_free_request(fp->out_ep, fp->out_reqv[i]); usb_ep_free_request(fp->out_ep, fp->out_reqv[i]);
usb_free_all_descriptors(f); usb_free_all_descriptors(f);
err: err:
if (fp->out_ep)
fp->out_ep->driver_data = NULL;
if (fp->in_ep)
fp->in_ep->driver_data = NULL;
ERROR(cdev, "USB CDC Phonet: cannot autoconfigure\n"); ERROR(cdev, "USB CDC Phonet: cannot autoconfigure\n");
return status; return status;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册