aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/g_ffs.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-05 18:18:00 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-05 18:18:00 -0400
commit64dc9e2e7320f079b97c46b106133b58b8e18d40 (patch)
treeab010dc1337d44e29c2b32b7f11788620a91fe4f /drivers/usb/gadget/g_ffs.c
parent01a60e76b6392547ad3dca3ac05b9c886fa5da45 (diff)
parent9b192de60b5a584ee4ed967fb6758773c75e4643 (diff)
Merge tag 'usb-for-v3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
Felipe writes: usb: patches for v3.10 merge window Here is the big Gadget & PHY pull request. Many of us have been really busy lately getting multiple drivers to a better position. Since this pull request is so large, I will divide it in sections so it's easier to grasp what's included. - cleanups: . UDC drivers no longer touch gadget->dev, that's now udc-core responsibility . Many more UDC drivers converted to usb_gadget_map/unmap_request() . UDC drivers no longer initialize DMA-related fields from gadget's device structure . UDC drivers don't touch gadget.dev.driver directly . UDC drivers don't assign gadget.dev.release directly . Removal of some unused DMA_ADDR_INVALID . Introduction of CONFIG_USB_PHY . All phy drivers have been moved to drivers/usb/phy and renamed to a common naming scheme . Fix PHY layer so it never returns a NULL pointer, also fix all callers to avoid using IS_ERR_OR_NULL() . Sparse fixes all over the place . drivers/usb/otg/ has been deleted . Marvel drivers (mv_udc, ehci-mv, mv_otg and mv_u3d) improved clock usage - new features: . UDC core now provides a generic way for tracking and reporting UDC's state (not attached, resuming, suspended, addressed, default, etc) . twl4030-usb learned that it shouldn't be enabled during init . Full DT support for DWC3 has been implemented . ab8500-usb learned about pinctrl framework . nop PHY learned about DeviceTree and regulators . DWC3 learned about suspend/resume . DWC3 can now be compiled in host-only and gadget-only (as well as DRD) configurations . UVC now enables streaming endpoint based on negotiated speed . isp1301 now implements the PHY API properly . configfs-based interface for gadget drivers which will lead to the removal of all code which just combines functions together to build functional gadget drivers. . f_serial and f_obex were converted to new configfs interface while maintaining old interface around. - non-critical fixes: . UVC gadget driver got fixes for Endpoint usage and stream calculation . ab8500-usb fixed unbalanced clock and regulator API usage . twl4030-usb got a fix for when OMAP3 is booted with cable connected . fusb300_udc got a fix for DMA usage . UVC got fixes for two assertions of the USB Video Class Compliance specification revision 1.1 . build warning issues caused by recent addition of __must_check to regulator API These are all changes which deserve a mention, all other changes are related to these one or minor spelling fixes and other similar tasks. Signed-of-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/g_ffs.c')
-rw-r--r--drivers/usb/gadget/g_ffs.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c
index 3b343b23e4b0..787a78e92aa2 100644
--- a/drivers/usb/gadget/g_ffs.c
+++ b/drivers/usb/gadget/g_ffs.c
@@ -13,7 +13,6 @@
13#define pr_fmt(fmt) "g_ffs: " fmt 13#define pr_fmt(fmt) "g_ffs: " fmt
14 14
15#include <linux/module.h> 15#include <linux/module.h>
16
17/* 16/*
18 * kbuild is not very cooperative with respect to linking separately 17 * kbuild is not very cooperative with respect to linking separately
19 * compiled library objects into one module. So for now we won't use 18 * compiled library objects into one module. So for now we won't use
@@ -38,13 +37,16 @@
38# include "u_ether.c" 37# include "u_ether.c"
39 38
40static u8 gfs_hostaddr[ETH_ALEN]; 39static u8 gfs_hostaddr[ETH_ALEN];
40static struct eth_dev *the_dev;
41# ifdef CONFIG_USB_FUNCTIONFS_ETH 41# ifdef CONFIG_USB_FUNCTIONFS_ETH
42static int eth_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]); 42static int eth_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN],
43 struct eth_dev *dev);
43# endif 44# endif
44#else 45#else
45# define gether_cleanup() do { } while (0) 46# define the_dev NULL
46# define gether_setup(gadget, hostaddr) ((int)0) 47# define gether_cleanup(dev) do { } while (0)
47# define gfs_hostaddr NULL 48# define gfs_hostaddr NULL
49struct eth_dev;
48#endif 50#endif
49 51
50#include "f_fs.c" 52#include "f_fs.c"
@@ -137,7 +139,8 @@ static struct usb_gadget_strings *gfs_dev_strings[] = {
137 139
138struct gfs_configuration { 140struct gfs_configuration {
139 struct usb_configuration c; 141 struct usb_configuration c;
140 int (*eth)(struct usb_configuration *c, u8 *ethaddr); 142 int (*eth)(struct usb_configuration *c, u8 *ethaddr,
143 struct eth_dev *dev);
141} gfs_configurations[] = { 144} gfs_configurations[] = {
142#ifdef CONFIG_USB_FUNCTIONFS_RNDIS 145#ifdef CONFIG_USB_FUNCTIONFS_RNDIS
143 { 146 {
@@ -346,10 +349,13 @@ static int gfs_bind(struct usb_composite_dev *cdev)
346 349
347 if (missing_funcs) 350 if (missing_funcs)
348 return -ENODEV; 351 return -ENODEV;
349 352#if defined CONFIG_USB_FUNCTIONFS_ETH || defined CONFIG_USB_FUNCTIONFS_RNDIS
350 ret = gether_setup(cdev->gadget, gfs_hostaddr); 353 the_dev = gether_setup(cdev->gadget, gfs_hostaddr);
351 if (unlikely(ret < 0)) 354#endif
355 if (IS_ERR(the_dev)) {
356 ret = PTR_ERR(the_dev);
352 goto error_quick; 357 goto error_quick;
358 }
353 gfs_ether_setup = true; 359 gfs_ether_setup = true;
354 360
355 ret = usb_string_ids_tab(cdev, gfs_strings); 361 ret = usb_string_ids_tab(cdev, gfs_strings);
@@ -386,7 +392,7 @@ error_unbind:
386 for (i = 0; i < func_num; i++) 392 for (i = 0; i < func_num; i++)
387 functionfs_unbind(ffs_tab[i].ffs_data); 393 functionfs_unbind(ffs_tab[i].ffs_data);
388error: 394error:
389 gether_cleanup(); 395 gether_cleanup(the_dev);
390error_quick: 396error_quick:
391 gfs_ether_setup = false; 397 gfs_ether_setup = false;
392 return ret; 398 return ret;
@@ -410,7 +416,7 @@ static int gfs_unbind(struct usb_composite_dev *cdev)
410 * do...? 416 * do...?
411 */ 417 */
412 if (gfs_ether_setup) 418 if (gfs_ether_setup)
413 gether_cleanup(); 419 gether_cleanup(the_dev);
414 gfs_ether_setup = false; 420 gfs_ether_setup = false;
415 421
416 for (i = func_num; i--; ) 422 for (i = func_num; i--; )
@@ -440,7 +446,7 @@ static int gfs_do_config(struct usb_configuration *c)
440 } 446 }
441 447
442 if (gc->eth) { 448 if (gc->eth) {
443 ret = gc->eth(c, gfs_hostaddr); 449 ret = gc->eth(c, gfs_hostaddr, the_dev);
444 if (unlikely(ret < 0)) 450 if (unlikely(ret < 0))
445 return ret; 451 return ret;
446 } 452 }
@@ -469,11 +475,12 @@ static int gfs_do_config(struct usb_configuration *c)
469 475
470#ifdef CONFIG_USB_FUNCTIONFS_ETH 476#ifdef CONFIG_USB_FUNCTIONFS_ETH
471 477
472static int eth_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]) 478static int eth_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN],
479 struct eth_dev *dev)
473{ 480{
474 return can_support_ecm(c->cdev->gadget) 481 return can_support_ecm(c->cdev->gadget)
475 ? ecm_bind_config(c, ethaddr) 482 ? ecm_bind_config(c, ethaddr, dev)
476 : geth_bind_config(c, ethaddr); 483 : geth_bind_config(c, ethaddr, dev);
477} 484}
478 485
479#endif 486#endif