Changeset fcdab1e in mainline
- Timestamp:
- 2018-01-12T11:42:00Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0fcccd9
- Parents:
- b233821
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/hid/usbhid/main.c
rb233821 rfcdab1e 137 137 } 138 138 139 /** 140 * Callback for when a device has just been from the driver. 141 * 142 * @param dev Structure representing the device. 143 * @return Error code. 144 */ 145 static int usb_hid_device_removed(usb_device_t *dev) 146 { 147 assert(dev); 148 usb_hid_dev_t *hid_dev = usb_device_data_get(dev); 149 assert(hid_dev); 150 151 usb_log_info("%s endpoints unregistered, joining polling fibril.\n", usb_device_get_name(dev)); 139 static int join_and_clean(usb_device_t *dev) 140 { 141 assert(dev); 142 usb_hid_dev_t *hid_dev = usb_device_data_get(dev); 143 assert(hid_dev); 152 144 153 145 /* Join polling fibril. */ … … 165 157 166 158 /** 159 * Callback for when a device has just been from the driver. 160 * 161 * @param dev Structure representing the device. 162 * @return Error code. 163 */ 164 static int usb_hid_device_removed(usb_device_t *dev) 165 { 166 assert(dev); 167 usb_hid_dev_t *hid_dev = usb_device_data_get(dev); 168 assert(hid_dev); 169 170 usb_log_info("%s endpoints unregistered, joining polling fibril.\n", usb_device_get_name(dev)); 171 return join_and_clean(dev); 172 } 173 174 /** 167 175 * Callback for removing a device from the driver. 168 176 * … … 178 186 usb_log_info("Device %s gone, joining the polling fibril.\n", usb_device_get_name(dev)); 179 187 usb_hid_prepare_deinit(hid_dev); 180 181 unsigned tries = 100; 182 /* Wait for fail. */ 183 while (hid_dev->running && tries--) { 184 async_usleep(100000); 185 } 186 if (hid_dev->running) { 187 usb_log_error("Can't remove hid, still running.\n"); 188 return EBUSY; 189 } 190 191 usb_hid_deinit(hid_dev); 192 usb_log_info("%s destruction complete.\n", usb_device_get_name(dev)); 193 194 return EOK; 188 return join_and_clean(dev); 195 189 } 196 190
Note:
See TracChangeset
for help on using the changeset viewer.