summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/f_phonet.c
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>2013-05-23 10:51:10 +0200
committerFelipe Balbi <balbi@ti.com>2013-06-10 17:30:46 +0300
commit0189e63ad8a06bcd9f74ca00490cf7aa7bae0cff (patch)
treec6d0b568a82731105f73f55044997aba4d3ed4af /drivers/usb/gadget/f_phonet.c
parent9b2252cace741e4843983d77ead80c3cf1d74e20 (diff)
downloadtalos-obmc-linux-0189e63ad8a06bcd9f74ca00490cf7aa7bae0cff.tar.gz
talos-obmc-linux-0189e63ad8a06bcd9f74ca00490cf7aa7bae0cff.zip
usb: gadget: phonet: move global dev variable to its user
cleanup patch only in preparation for configfs. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/f_phonet.c')
-rw-r--r--drivers/usb/gadget/f_phonet.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c
index b21ab558b6c0..f8df525da118 100644
--- a/drivers/usb/gadget/f_phonet.c
+++ b/drivers/usb/gadget/f_phonet.c
@@ -579,9 +579,8 @@ pn_unbind(struct usb_configuration *c, struct usb_function *f)
/*-------------------------------------------------------------------------*/
-static struct net_device *dev;
-
-int __init phonet_bind_config(struct usb_configuration *c)
+int __init phonet_bind_config(struct usb_configuration *c,
+ struct net_device *dev)
{
struct f_phonet *fp;
int err, size;
@@ -606,16 +605,16 @@ int __init phonet_bind_config(struct usb_configuration *c)
return err;
}
-int __init gphonet_setup(struct usb_gadget *gadget)
+struct net_device __init *gphonet_setup(struct usb_gadget *gadget)
{
+ struct net_device *dev;
struct phonet_port *port;
int err;
/* Create net device */
- BUG_ON(dev);
dev = alloc_netdev(sizeof(*port), "upnlink%d", pn_net_setup);
if (!dev)
- return -ENOMEM;
+ return ERR_PTR(-ENOMEM);
port = netdev_priv(dev);
spin_lock_init(&port->lock);
@@ -623,12 +622,15 @@ int __init gphonet_setup(struct usb_gadget *gadget)
SET_NETDEV_DEV(dev, &gadget->dev);
err = register_netdev(dev);
- if (err)
+ if (err) {
free_netdev(dev);
- return err;
+
+ return ERR_PTR(err);
+ }
+ return dev;
}
-void gphonet_cleanup(void)
+void gphonet_cleanup(struct net_device *dev)
{
unregister_netdev(dev);
}
OpenPOWER on IntegriCloud