usb: gadget: configfs: use to_config_usb_cfg() in os_desc_link()
authorLinyu Yuan <quic_linyyuan@quicinc.com>
Thu, 18 Nov 2021 04:53:32 +0000 (12:53 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:39:40 +0000 (09:39 +0100)
[ Upstream commit 5d143ec451429891385a21617b292f2ceaa684ea ]

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>
Stable-dep-of: 89e7252d6c7e ("usb: gadget: configfs: Restrict symlink creation is UDC already binded")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/gadget/configfs.c

index 5ade844db4046fd7acca084a1c0e5e0e31a39c45..7d3b93dc154feae1a5173557a01b960ac32bc811 100644 (file)
@@ -890,9 +890,7 @@ static int os_desc_link(struct config_item *os_desc_ci,
        struct gadget_info *gi = container_of(to_config_group(os_desc_ci),
                                        struct gadget_info, os_desc_group);
        struct usb_composite_dev *cdev = &gi->cdev;
-       struct config_usb_cfg *c_target =
-               container_of(to_config_group(usb_cfg_ci),
-                            struct config_usb_cfg, group);
+       struct config_usb_cfg *c_target = to_config_usb_cfg(usb_cfg_ci);
        struct usb_configuration *c;
        int ret;