linux_dsm_epyc7002/drivers/usb/gadget/function
Michal Nazarewicz ea920bb42d usb: gadget: f_fs: simplify ffs_dev name handling
Currently ffs_dev::name can be either allocated by the client of
the ffs_dev structure or by the f_fs.c core itself.  The former
is used by g_ffs while the latter happens with configfs.

Historically, g_ffs did not need to allocate separate buffer for
the name so what is now f_fs.c core never cared about freeing
that space.  With configfs the name needs to be copied since the
memory is not guaranteed to be availeble after ffs_set_inst_name
finishes.

The complication is therefore here to avoid allocations in the
g_ffs case but it complicates the code inproportinally to
benefits it provides.  In particular, g_ffs is considered
‘legacy’ so optimising for its sake is unlikely to be worth the
effort.

With that observation in mind, simplify the code by unifying the
code paths in g_ffs and configfs paths.  Furthermore, instead of
allocating a new buffer for the name, simply embed it in the
ffs_dev structure.  This further makes the memory management
less convoluted and error-prone.

The configfs interface for functionfs imposed a limit of 40
characters for the name so this results in a 41-byte buffer
added to the structure.  (For short names this may lead to
wasted memory but the actual amount is not immediately obvious
and depends on pointer size and which slab buckets the structure
and name would fall into).

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-04-11 10:58:22 +03:00
..
f_acm.c usb: gadget: acm: fix endianness in notifications 2017-03-22 11:20:52 +02:00
f_ecm.c usb: gadget: Update usb_assign_descriptors for SuperSpeedPlus 2016-03-04 15:14:23 +02:00
f_eem.c usb: gadget: prevent potenial null pointer dereference on skb->len 2016-09-06 10:44:03 +03:00
f_fs.c usb: gadget: f_fs: simplify ffs_dev name handling 2017-04-11 10:58:22 +03:00
f_hid.c usb: gadget: f_hid: fix: Don't access hidg->req without spinlock held 2017-03-22 11:21:10 +02:00
f_loopback.c usb: gadget: remove variable ret and remove unnecessary if statement 2016-09-09 13:38:37 +03:00
f_mass_storage.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/signal.h> 2017-03-02 08:42:29 +01:00
f_mass_storage.h usb: gadget: Add per-lun inquiry string 2016-08-25 12:13:13 +03:00
f_midi.c usb: gadget: remove useless parameter in alloc_ep_req() 2016-08-25 12:13:19 +03:00
f_ncm.c ktime: Cleanup ktime_set() usage 2016-12-25 17:21:22 +01:00
f_obex.c usb: gadget: Update usb_assign_descriptors for SuperSpeedPlus 2016-03-04 15:14:23 +02:00
f_phonet.c net: use core MTU range checking in misc drivers 2016-10-20 14:51:10 -04:00
f_printer.c usb: gadget: printer: Remove pnp_string static buffer 2017-01-24 11:04:08 +02:00
f_rndis.c usb: gadget: function: f_rndis: socket buffer may be NULL 2016-08-22 10:45:12 +03:00
f_serial.c usb: gadget: Update usb_assign_descriptors for SuperSpeedPlus 2016-03-04 15:14:23 +02:00
f_sourcesink.c usb: gadget: remove useless parameter in alloc_ep_req() 2016-08-25 12:13:19 +03:00
f_subset.c usb: gadget: Update usb_assign_descriptors for SuperSpeedPlus 2016-03-04 15:14:23 +02:00
f_tcm.c usb: gadget: Fix second argument of percpu_ida_alloc() 2016-12-09 10:20:08 -08:00
f_uac1.c usb: gadget: Update usb_assign_descriptors for SuperSpeedPlus 2016-03-04 15:14:23 +02:00
f_uac2.c usb: gadget: uac2: add req_number as parameter 2017-01-24 11:04:21 +02:00
f_uvc.c usb: gadget: f_uvc: Sanity check wMaxPacketSize for SuperSpeed 2017-03-22 11:21:09 +02:00
f_uvc.h
g_zero.h usb: gadget: define free_ep_req as universal function 2015-12-15 09:12:41 -06:00
Makefile usb: gadget: f_tcm: convert to new function interface with backward compatibility 2015-12-20 19:40:34 -08:00
ndis.h
rndis.c usb: gadget: Fix checkpatch error for braces 2016-11-18 13:54:41 +02:00
rndis.h usb: gadget: Fix checkpatch error for braces 2016-11-18 13:54:41 +02:00
storage_common.c usb: gadget: Add per-lun inquiry string 2016-08-25 12:13:13 +03:00
storage_common.h usb: gadget: Add per-lun inquiry string 2016-08-25 12:13:13 +03:00
tcm.h usb-gadget/tcm: Conversion to percpu_ida tag pre-allocation 2016-03-10 21:48:14 -08:00
u_ecm.h
u_eem.h
u_ether_configfs.h usb: gadget: ether: Add \n to each attribute of ethernet functions 2017-01-24 11:04:07 +02:00
u_ether.c usb: gadget: u_ether: conditionally align transfer size 2017-04-11 10:58:21 +03:00
u_ether.h usb: gadget: u_ether: add a flag to avoid skb_reserve() calling 2016-08-31 10:06:03 +03:00
u_fs.h usb: gadget: f_fs: simplify ffs_dev name handling 2017-04-11 10:58:22 +03:00
u_gether.h
u_hid.h
u_midi.h
u_ncm.h
u_phonet.h
u_printer.h usb: gadget: printer: Remove pnp_string static buffer 2017-01-24 11:04:08 +02:00
u_rndis.h usb: gadget: rndis: remove the limit of available rndis connections 2015-05-07 13:47:17 -05:00
u_serial.c usb: gadget: serial: fix possible Oops caused by calling kthread_stop(NULL) 2016-11-18 13:55:19 +02:00
u_serial.h
u_tcm.h usb: gadget: f_tcm: convert to new function interface with backward compatibility 2015-12-20 19:40:34 -08:00
u_uac1.c
u_uac1.h usb: gadget: remove gadget_chips.h 2015-08-06 09:35:20 -05:00
u_uac2.h usb: gadget: uac2: add req_number as parameter 2017-01-24 11:04:21 +02:00
u_uvc.h
uvc_configfs.c usb: gadget: uvc: Missing files for configfs interface 2017-04-11 10:57:59 +03:00
uvc_configfs.h
uvc_queue.c [media] vb2: replace void *alloc_ctxs by struct device *alloc_devs 2016-07-08 14:45:07 -03:00
uvc_queue.h [media] media: videobuf2: Restructure vb2_buffer 2015-10-01 09:04:43 -03:00
uvc_v4l2.c usb: gadget: Fix checkpatch error for braces 2016-11-18 13:54:41 +02:00
uvc_v4l2.h
uvc_video.c usb: gadget: composite: always set ep->mult to a sensible value 2016-10-31 11:15:33 +02:00
uvc_video.h
uvc.h usb: gadget: Fix checkpatch error for braces 2016-11-18 13:54:41 +02:00