Commit fe1b28c9f0954047f20b20253596b5ca9aef4a32
Committed by
Lukasz Majewski
1 parent
68ae882596
Exists in
v2017.01-smarct4x
and in
37 other branches
usb, g_dnl: generalize DFU detach functions
In order to add detach functions for fastboot, make the DFU detach related functions common so they can be shared. Signed-off-by: Rob Herring <robh@kernel.org> Tested-by: Lukasz Majewski <l.majewski@samsung.com> [TestHW: Exynos4412-Trats2]
Showing 6 changed files with 25 additions and 23 deletions Side-by-side Diff
common/cmd_dfu.c
... | ... | @@ -38,10 +38,10 @@ |
38 | 38 | |
39 | 39 | int controller_index = simple_strtoul(usb_controller, NULL, 0); |
40 | 40 | board_usb_init(controller_index, USB_INIT_DEVICE); |
41 | - dfu_clear_detach(); | |
41 | + g_dnl_clear_detach(); | |
42 | 42 | g_dnl_register("usb_dnl_dfu"); |
43 | 43 | while (1) { |
44 | - if (dfu_detach()) { | |
44 | + if (g_dnl_detach()) { | |
45 | 45 | /* |
46 | 46 | * Check if USB bus reset is performed after detach, |
47 | 47 | * which indicates that -R switch has been passed to |
... | ... | @@ -74,7 +74,7 @@ |
74 | 74 | if (dfu_reset) |
75 | 75 | run_command("reset", 0); |
76 | 76 | |
77 | - dfu_clear_detach(); | |
77 | + g_dnl_clear_detach(); | |
78 | 78 | |
79 | 79 | return ret; |
80 | 80 | } |
drivers/dfu/dfu.c
... | ... | @@ -17,7 +17,6 @@ |
17 | 17 | #include <linux/list.h> |
18 | 18 | #include <linux/compiler.h> |
19 | 19 | |
20 | -static bool dfu_detach_request; | |
21 | 20 | static LIST_HEAD(dfu_list); |
22 | 21 | static int dfu_alt_num; |
23 | 22 | static int alt_num_cnt; |
... | ... | @@ -37,21 +36,6 @@ |
37 | 36 | __weak bool dfu_usb_get_reset(void) |
38 | 37 | { |
39 | 38 | return true; |
40 | -} | |
41 | - | |
42 | -bool dfu_detach(void) | |
43 | -{ | |
44 | - return dfu_detach_request; | |
45 | -} | |
46 | - | |
47 | -void dfu_trigger_detach(void) | |
48 | -{ | |
49 | - dfu_detach_request = true; | |
50 | -} | |
51 | - | |
52 | -void dfu_clear_detach(void) | |
53 | -{ | |
54 | - dfu_detach_request = false; | |
55 | 39 | } |
56 | 40 | |
57 | 41 | static int dfu_find_alt_num(const char *s) |
drivers/usb/gadget/f_dfu.c
drivers/usb/gadget/g_dnl.c
... | ... | @@ -163,6 +163,23 @@ |
163 | 163 | return -EOPNOTSUPP; |
164 | 164 | } |
165 | 165 | |
166 | +static bool g_dnl_detach_request; | |
167 | + | |
168 | +bool g_dnl_detach(void) | |
169 | +{ | |
170 | + return g_dnl_detach_request; | |
171 | +} | |
172 | + | |
173 | +void g_dnl_trigger_detach(void) | |
174 | +{ | |
175 | + g_dnl_detach_request = true; | |
176 | +} | |
177 | + | |
178 | +void g_dnl_clear_detach(void) | |
179 | +{ | |
180 | + g_dnl_detach_request = false; | |
181 | +} | |
182 | + | |
166 | 183 | static int g_dnl_get_bcd_device_number(struct usb_composite_dev *cdev) |
167 | 184 | { |
168 | 185 | struct usb_gadget *gadget = cdev->gadget; |
include/dfu.h
... | ... | @@ -150,9 +150,6 @@ |
150 | 150 | char *dfu_extract_token(char** e, int *n); |
151 | 151 | void dfu_trigger_reset(void); |
152 | 152 | int dfu_get_alt(char *name); |
153 | -bool dfu_detach(void); | |
154 | -void dfu_trigger_detach(void); | |
155 | -void dfu_clear_detach(void); | |
156 | 153 | int dfu_init_env_entities(char *interface, char *devstr); |
157 | 154 | unsigned char *dfu_get_buf(struct dfu_entity *dfu); |
158 | 155 | unsigned char *dfu_free_buf(void); |
include/g_dnl.h