hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/usb/gadget/function/u_ether_configfs.h
....@@ -1,4 +1,4 @@
1
-// SPDX-License-Identifier: GPL-2.0
1
+/* SPDX-License-Identifier: GPL-2.0 */
22 /*
33 * u_ether_configfs.h
44 *
....@@ -7,7 +7,7 @@
77 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
88 * http://www.samsung.com
99 *
10
- * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
10
+ * Author: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
1111 */
1212
1313 #ifndef __U_ETHER_CONFIGFS_H
....@@ -148,7 +148,20 @@
148148 return ret; \
149149 } \
150150 \
151
- CONFIGFS_ATTR_RO(_f_##_opts_, ifname)
151
+ static ssize_t _f_##_opts_ifname_store(struct config_item *item, \
152
+ const char *page, size_t len)\
153
+ { \
154
+ struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item); \
155
+ int ret = -EBUSY; \
156
+ \
157
+ mutex_lock(&opts->lock); \
158
+ if (!opts->refcnt) \
159
+ ret = gether_set_ifname(opts->net, page, len); \
160
+ mutex_unlock(&opts->lock); \
161
+ return ret ?: len; \
162
+ } \
163
+ \
164
+ CONFIGFS_ATTR(_f_##_opts_, ifname)
152165
153166 #define USB_ETHER_CONFIGFS_ITEM_ATTR_U8_RW(_f_, _n_) \
154167 static ssize_t _f_##_opts_##_n_##_show(struct config_item *item,\