#
d9c61bb3 |
| 01-Sep-2024 |
Michael Grzeschik <m.grzeschik@pengutronix.de> |
usb: gadget: function: move u_f.h to include/linux/usb/func_utils.h
We move the func_utils.h header to include/linux/usb to be able to compile function drivers outside of the drivers/usb/gadget/func
usb: gadget: function: move u_f.h to include/linux/usb/func_utils.h
We move the func_utils.h header to include/linux/usb to be able to compile function drivers outside of the drivers/usb/gadget/function directory.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Link: https://lore.kernel.org/r/20240116-ml-topic-u9p-v12-1-9a27de5160e0@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
d1e14e06 |
| 10-Aug-2024 |
Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
usb: gadget: configfs: Constify struct config_item_type
'struct config_item_type' is not modified in this file.
Apparently, these structures are only used with config_group_init_type_name() which t
usb: gadget: configfs: Constify struct config_item_type
'struct config_item_type' is not modified in this file.
Apparently, these structures are only used with config_group_init_type_name() which takes a const struct config_item_type* as a 3rd argument.
Constifying this structure moves some data to a read-only section, so increase overall security, especially when the structure holds some function pointers.
On a x86_64, with allmodconfig: Before: ====== text data bss dec hex filename 40834 5112 64 46010 b3ba drivers/usb/gadget/configfs.o
After: ===== text data bss dec hex filename 41218 4728 64 46010 b3ba drivers/usb/gadget/configfs.o
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/513223e97082e1bb758e36d55c175ec9ea34a71c.1723323896.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
c343e66e |
| 10-Aug-2024 |
Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
usb: gadget: configfs: Make check_user_usb_string() static
"linux/usb/gadget_configfs.h" is only included in "drivers/usb/gadget/configfs.c", so there is no need to declare a function in the header
usb: gadget: configfs: Make check_user_usb_string() static
"linux/usb/gadget_configfs.h" is only included in "drivers/usb/gadget/configfs.c", so there is no need to declare a function in the header file. it is only used in this .c file.
It's better to have it static.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/958cb49dca1bff4254a3492c018efbf3b01918b4.1723323107.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
6d3c721e |
| 05-Jul-2024 |
Lee Jones <lee@kernel.org> |
usb: gadget: configfs: Prevent OOB read/write in usb_string_copy()
Userspace provided string 's' could trivially have the length zero. Left unchecked this will firstly result in an OOB read in the f
usb: gadget: configfs: Prevent OOB read/write in usb_string_copy()
Userspace provided string 's' could trivially have the length zero. Left unchecked this will firstly result in an OOB read in the form `if (str[0 - 1] == '\n') followed closely by an OOB write in the form `str[0 - 1] = '\0'`.
There is already a validating check to catch strings that are too long. Let's supply an additional check for invalid strings that are too short.
Signed-off-by: Lee Jones <lee@kernel.org> Cc: stable <stable@kernel.org> Link: https://lore.kernel.org/r/20240705074339.633717-1-lee@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
0466e7e6 |
| 13-Dec-2023 |
Lee Jones <lee@kernel.org> |
usb: gadget: configfs: Replace snprintf() with the safer scnprintf() variant
There is a general misunderstanding amongst engineers that {v}snprintf() returns the length of the data *actually* encode
usb: gadget: configfs: Replace snprintf() with the safer scnprintf() variant
There is a general misunderstanding amongst engineers that {v}snprintf() returns the length of the data *actually* encoded into the destination array. However, as per the C99 standard {v}snprintf() really returns the length of the data that *would have been* written if there were enough space for it. This misunderstanding has led to buffer-overruns in the past. It's generally considered safer to use the {v}scnprintf() variants in their place (or even sprintf() in simple cases). So let's do that.
Link: https://lwn.net/Articles/69419/ Link: https://github.com/KSPP/linux/issues/105 Signed-off-by: Lee Jones <lee@kernel.org> Link: https://lore.kernel.org/r/20231213164246.1021885-2-lee@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
38168e2d |
| 30-Nov-2023 |
Lee Jones <lee@kernel.org> |
usb: gadget: Remove snprintf() from sysfs call-backs and replace with sysfs_emit()
Since snprintf() has the documented, but still rather strange trait of returning the length of the data that *would
usb: gadget: Remove snprintf() from sysfs call-backs and replace with sysfs_emit()
Since snprintf() has the documented, but still rather strange trait of returning the length of the data that *would have been* written to the array if space were available, rather than the arguably more useful length of data *actually* written, it is usually considered wise to use something else instead in order to avoid confusion.
In the case of sysfs call-backs, new wrappers exist that do just that.
This patch replaces just one use of snprintf() found in the sysfs .show() call-back with the new sysfs_emit() helper.
Link: https://lwn.net/Articles/69419/ Link: https://github.com/KSPP/linux/issues/105 Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: linux-usb@vger.kernel.org Signed-off-by: Lee Jones <lee@kernel.org> Link: https://lore.kernel.org/r/20231130105459.3208986-5-lee@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
b93c2a68 |
| 24-Mar-2023 |
Elson Roy Serrao <quic_eserrao@quicinc.com> |
usb: gadget: Properly configure the device for remote wakeup
The wakeup bit in the bmAttributes field indicates whether the device is configured for remote wakeup. But this field should be allowed t
usb: gadget: Properly configure the device for remote wakeup
The wakeup bit in the bmAttributes field indicates whether the device is configured for remote wakeup. But this field should be allowed to set only if the UDC supports such wakeup mechanism. So configure this field based on UDC capability. Also inform the UDC whether the device is configured for remote wakeup by implementing a gadget op.
Reviewed-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Signed-off-by: Elson Roy Serrao <quic_eserrao@quicinc.com> Link: https://lore.kernel.org/r/1679694482-16430-2-git-send-email-quic_eserrao@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
8488a831 |
| 09-Feb-2023 |
Daniel Scally <dan.scally@ideasonboard.com> |
usb: gadget: configfs: Fix set but not used variable warning
Fix a -Wunused-but-set-variable warning in gadget_string_s_store()
Fixes: 15a7cf8caabe ("usb: gadget: configfs: Support arbitrary string
usb: gadget: configfs: Fix set but not used variable warning
Fix a -Wunused-but-set-variable warning in gadget_string_s_store()
Fixes: 15a7cf8caabe ("usb: gadget: configfs: Support arbitrary string descriptors") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Link: https://lore.kernel.org/r/20230209094359.1549629-1-dan.scally@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
c0335632 |
| 06-Feb-2023 |
Daniel Scally <dan.scally@ideasonboard.com> |
usb: gadget: configfs: Attach arbitrary strings to cdev
Attach any arbitrary strings that are defined to the composite dev. We handle the old-style manufacturer, product and serialnumbers strings in
usb: gadget: configfs: Attach arbitrary strings to cdev
Attach any arbitrary strings that are defined to the composite dev. We handle the old-style manufacturer, product and serialnumbers strings in the same function for simplicity.
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Link: https://lore.kernel.org/r/20230206161802.892954-8-dan.scally@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
15a7cf8c |
| 06-Feb-2023 |
Daniel Scally <dan.scally@ideasonboard.com> |
usb: gadget: configfs: Support arbitrary string descriptors
Add a framework to allow users to define arbitrary string descriptors for a USB Gadget. This is modelled as a new type of config item rath
usb: gadget: configfs: Support arbitrary string descriptors
Add a framework to allow users to define arbitrary string descriptors for a USB Gadget. This is modelled as a new type of config item rather than as hardcoded attributes so as to be as flexible as possible.
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Link: https://lore.kernel.org/r/20230206161802.892954-7-dan.scally@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
6e2a512d |
| 06-Feb-2023 |
Daniel Scally <dan.scally@ideasonboard.com> |
usb: gadget: configfs: Rename struct gadget_strings
The struct gadget_strings really represents a single language in configfs. Rename it to make that more clear.
Signed-off-by: Daniel Scally <dan.s
usb: gadget: configfs: Rename struct gadget_strings
The struct gadget_strings really represents a single language in configfs. Rename it to make that more clear.
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Link: https://lore.kernel.org/r/20230206161802.892954-6-dan.scally@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
9c0e6fbd |
| 02-Feb-2023 |
Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
usb: gadget: configfs: Use memcpy_and_pad()
Instead of zeroing some memory and then copying data in part or all of it, use memcpy_and_pad(). This avoids writing some memory twice and should save a f
usb: gadget: configfs: Use memcpy_and_pad()
Instead of zeroing some memory and then copying data in part or all of it, use memcpy_and_pad(). This avoids writing some memory twice and should save a few cycles.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230202151736.64552-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
89e7252d |
| 01-Feb-2023 |
Udipto Goswami <quic_ugoswami@quicinc.com> |
usb: gadget: configfs: Restrict symlink creation is UDC already binded
During enumeration or composition switch,a userspace process agnostic of the conventions of configs can try to create function
usb: gadget: configfs: Restrict symlink creation is UDC already binded
During enumeration or composition switch,a userspace process agnostic of the conventions of configs can try to create function symlinks even after the UDC is bound to current config which is not correct. Potentially it can create duplicates within the current config.
Prevent this by adding a check if udc_name already exists, then bail out of cfg_link.
Following is an example:
Step1: ln -s X1 ffs.a -->cfg_link --> usb_get_function(ffs.a) ->ffs_alloc
CFG->FUNC_LIST: <ffs.a> C->FUNCTION: <empty>
Step2: echo udc.name > /config/usb_gadget/g1/UDC --> UDC_store ->composite_bind ->usb_add_function
CFG->FUNC_LIST: <empty> C->FUNCTION: <ffs.a>
Step3: ln -s Y1 ffs.a -->cfg_link -->usb_get_function(ffs.a) ->ffs_alloc
CFG->FUNC_LIST: <ffs.a> C->FUNCTION: <ffs.a>
both the lists corresponds to the same function instance ffs.a but the usb_function* pointer is different because in step 3 ffs_alloc has created a new reference to usb_function* for ffs.a and added it to cfg_list.
Step4: Now a composition switch involving <ffs.b,ffs.a> is executed.
the composition switch will involve 3 things: 1. unlinking the previous functions existing 2. creating new symlinks 3. writing UDC
However, the composition switch is generally taken care by userspace process which creates the symlinks in its own nomenclature(X*) and removes only those. So it won't be able to remove Y1 which user had created by own.
Due to this the new symlinks cannot be created for ffs.a since the entry already exists in CFG->FUNC_LIST.
The state of the CFG->FUNC_LIST is as follows: CFG->FUNC_LIST: <ffs.a>
Fixes: 88af8bbe4ef7 ("usb: gadget: the start of the configfs interface") Signed-off-by: Krishna Kurapati PSSNV <quic_kriskura@quicinc.com> Signed-off-by: Udipto Goswami <quic_ugoswami@quicinc.com> Link: https://lore.kernel.org/r/20230201132308.31523-1-quic_ugoswami@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
582cef43 |
| 27-Jan-2023 |
Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
usg: gadget: Move validation out of lock in webusb_bcdVersion_store()
Validation has nothing to do with any protected data, move it out of the lock and make code neater.
Signed-off-by: Andy Shevche
usg: gadget: Move validation out of lock in webusb_bcdVersion_store()
Validation has nothing to do with any protected data, move it out of the lock and make code neater.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230127112638.84806-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
6f7fb48d |
| 20-Jan-2023 |
Andy Shevchenko <andriy.shevchenko@linux.intel.com> |
usb: gadget: Move kstrtox() out of lock
The kstrtox() calls operate on local (to the function) variables and do not need to be serialized. We may call them out of the lock.
Reviewed-by: John Keepin
usb: gadget: Move kstrtox() out of lock
The kstrtox() calls operate on local (to the function) variables and do not need to be serialized. We may call them out of the lock.
Reviewed-by: John Keeping <john@metanate.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230120182434.24245-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
93c47394 |
| 13-Jan-2023 |
Jó Ágila Bitsch <jgilab@gmail.com> |
usb: gadget: add WebUSB landing page support
There is a custom (non-USB IF) extension to the USB standard:
https://wicg.github.io/webusb/
This specification is published under the W3C Community Co
usb: gadget: add WebUSB landing page support
There is a custom (non-USB IF) extension to the USB standard:
https://wicg.github.io/webusb/
This specification is published under the W3C Community Contributor Agreement, which in particular allows to implement the specification without any royalties.
The specification allows USB gadgets to announce an URL to landing page and describes a Javascript interface for websites to interact with the USB gadget, if the user allows it. It is currently supported by Chromium-based browsers, such as Chrome, Edge and Opera on all major operating systems including Linux.
This patch adds optional support for Linux-based USB gadgets wishing to expose such a landing page.
During device enumeration, a host recognizes that the announced USB version is at least 2.01, which means, that there are BOS descriptors available. The device than announces WebUSB support using a platform device capability. This includes a vendor code under which the landing page URL can be retrieved using a vendor-specific request.
Previously, the BOS descriptors would unconditionally include an LPM related descriptor, as BOS descriptors were only ever sent when the device was LPM capable. As this is no longer the case, this patch puts this descriptor behind a lpm_capable condition.
Usage is modeled after os_desc descriptors: echo 1 > webusb/use echo "https://www.kernel.org" > webusb/landingPage
lsusb will report the device with the following lines: Platform Device Capability: bLength 24 bDescriptorType 16 bDevCapabilityType 5 bReserved 0 PlatformCapabilityUUID {3408b638-09a9-47a0-8bfd-a0768815b665} WebUSB: bcdVersion 1.00 bVendorCode 0 iLandingPage 1 https://www.kernel.org
Signed-off-by: Jó Ágila Bitsch <jgilab@gmail.com> Link: https://lore.kernel.org/r/Y8Crf8P2qAWuuk/F@jo-einhundert Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
7c075538 |
| 11-Jan-2023 |
Chanh Nguyen <chanh@os.amperecomputing.com> |
USB: gadget: Add ID numbers to configfs-gadget driver names
It is unable to use configfs to attach more than one gadget. When attaching the second gadget, it always fails and the kernel message prin
USB: gadget: Add ID numbers to configfs-gadget driver names
It is unable to use configfs to attach more than one gadget. When attaching the second gadget, it always fails and the kernel message prints out:
Error: Driver 'configfs-gadget' is already registered, aborting... UDC core: g1: driver registration failed: -16
This commit fixes the problem by using the gadget name as a suffix to each configfs_gadget's driver name, thus making the names distinct.
Fixes: fc274c1e9973 ("USB: gadget: Add a new bus for gadgets") Cc: stable <stable@kernel.org> Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> Tested-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Frank Li <frank.li@nxp.com> Link: https://lore.kernel.org/r/20230111065105.29205-1-chanh@os.amperecomputing.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
a8bc8cc1 |
| 01-Nov-2022 |
Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
usb: gadget: Use kstrtobool() instead of strtobool()
strtobool() is the same as kstrtobool(). However, the latter is more used within the kernel.
In order to remove strtobool() and slightly simplif
usb: gadget: Use kstrtobool() instead of strtobool()
strtobool() is the same as kstrtobool(). However, the latter is more used within the kernel.
In order to remove strtobool() and slightly simplify kstrtox.h, switch to the other function name.
While at it, include the corresponding header file (<linux/kstrtox.h>)
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/09bc980d8432a4b5f7d88388ec0df5b085583139.1667336095.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
af1969a2 |
| 24-Apr-2022 |
Alan Stern <stern@rowland.harvard.edu> |
USB: gadget: Rename usb_gadget_probe_driver()
In preparation for adding a "gadget" bus, this patch renames usb_gadget_probe_driver() to usb_gadget_register_driver(). The new name will be more accur
USB: gadget: Rename usb_gadget_probe_driver()
In preparation for adding a "gadget" bus, this patch renames usb_gadget_probe_driver() to usb_gadget_register_driver(). The new name will be more accurate, since gadget drivers will be registered on the gadget bus and the probing will be done by the driver core, not the UDC core.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Link: https://lore.kernel.org/r/YmSc29YZvxgT5fEJ@rowland.harvard.edu Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
bf95c4d4 |
| 13-Apr-2022 |
Vijayavardhan Vennapusa <vvreddy@codeaurora.org> |
usb: gadget: configfs: clear deactivation flag in configfs_composite_unbind()
If any function like UVC is deactivating gadget as part of composition switch which results in not calling pullup enable
usb: gadget: configfs: clear deactivation flag in configfs_composite_unbind()
If any function like UVC is deactivating gadget as part of composition switch which results in not calling pullup enablement, it is not getting enabled after switch to new composition due to this deactivation flag not cleared. This results in USB enumeration not happening after switch to new USB composition. Hence clear deactivation flag inside gadget structure in configfs_composite_unbind() before switch to new USB composition.
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org> Signed-off-by: Dan Vacura <w36195@motorola.com> Cc: stable <stable@kernel.org> Link: https://lore.kernel.org/r/20220413211038.72797-1-w36195@motorola.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
36f4c25c |
| 08-Mar-2022 |
Jakob Koschel <jakobkoschel@gmail.com> |
usb: gadget: configfs: remove using list iterator after loop body as a ptr
If the list does not contain the expected element, the value of list_for_each_entry() iterator will not point to a valid st
usb: gadget: configfs: remove using list iterator after loop body as a ptr
If the list does not contain the expected element, the value of list_for_each_entry() iterator will not point to a valid structure. To avoid type confusion in such case, the list iterator scope will be limited to list_for_each_entry() loop.
In preparation to limiting scope of a list iterator to the list traversal loop, use a dedicated pointer to point to the found element [1]. Determining if an element was found is then simply checking if the pointer is != NULL instead of using the potentially bogus pointer.
Link: https://lore.kernel.org/all/YhdfEIwI4EdtHdym@kroah.com/ Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com> Link: https://lore.kernel.org/r/20220308171818.384491-18-jakobkoschel@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
5284accc |
| 18-Nov-2021 |
Linyu Yuan <quic_linyyuan@quicinc.com> |
usb: gadget: configfs: use to_usb_function_instance() in cfg (un)link func
replace open-coded container_of() with to_usb_function_instance() helper.
Reviewed-by: Jack Pham <quic_jackp@quicinc.com>
usb: gadget: configfs: use to_usb_function_instance() in cfg (un)link func
replace open-coded container_of() with to_usb_function_instance() helper.
Reviewed-by: Jack Pham <quic_jackp@quicinc.com> Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com> Link: https://lore.kernel.org/r/1637211213-16400-5-git-send-email-quic_linyyuan@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
5d143ec4 |
| 18-Nov-2021 |
Linyu Yuan <quic_linyyuan@quicinc.com> |
usb: gadget: configfs: use to_config_usb_cfg() in os_desc_link()
replace open-coded container_of() with to_config_usb_cfg() helper.
Reviewed-by: Jack Pham <quic_jackp@quicinc.com> Signed-off-by: Li
usb: gadget: configfs: use to_config_usb_cfg() in os_desc_link()
replace open-coded container_of() with to_config_usb_cfg() helper.
Reviewed-by: Jack Pham <quic_jackp@quicinc.com> Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com> Link: https://lore.kernel.org/r/1637211213-16400-4-git-send-email-quic_linyyuan@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
ff5a938d |
| 18-Nov-2021 |
Linyu Yuan <quic_linyyuan@quicinc.com> |
usb: gadget: configfs: remove os_desc_attr_release()
it is not allow to create sub group under os_desc,
/sys/kernel/config/usb_gadget/dummy/os_desc # mkdir dummy mkdir: can't create directory 'dumm
usb: gadget: configfs: remove os_desc_attr_release()
it is not allow to create sub group under os_desc,
/sys/kernel/config/usb_gadget/dummy/os_desc # mkdir dummy mkdir: can't create directory 'dummy': Operation not permitted
no one will kmalloc() os_desc entry and kfree(os_desc) will never be called. static void os_desc_attr_release(struct config_item *item) { struct os_desc *os_desc = to_os_desc(item); kfree(os_desc); }
remove struct os_desc definition, to_os_desc() and os_desc_attr_release().
Reviewed-by: Jack Pham <quic_jackp@quicinc.com> Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com> Link: https://lore.kernel.org/r/1637211213-16400-3-git-send-email-quic_linyyuan@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
167a799c |
| 18-Nov-2021 |
Linyu Yuan <quic_linyyuan@quicinc.com> |
usb: gadget: configfs: simplify os_desc_item_to_gadget_info() helper
since os_desc_group is already a member of struct gadget_info, we can simply just use container_of() to retrieve the latter, with
usb: gadget: configfs: simplify os_desc_item_to_gadget_info() helper
since os_desc_group is already a member of struct gadget_info, we can simply just use container_of() to retrieve the latter, without needing to dereference the cg_item's parent pointer.
use os_desc_item_to_gadget_info() helper in os_desc (un)link function.
Reviewed-by: Jack Pham <quic_jackp@quicinc.com> Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com> Link: https://lore.kernel.org/r/1637211213-16400-2-git-send-email-quic_linyyuan@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|