hidraw.c (f68ec0c24755e5cdb779be6240925f2175311d84) hidraw.c (c500c9714011edab021591340042787722db9cf0)
1/*
2 * HID raw devices, giving access to raw HID events.
3 *
4 * In comparison to hiddev, this device does not process the
5 * hid events at all (no parsing, no lookups). This lets applications
6 * to work on raw hid events as they want to, and avoids a need to
7 * use a transport-specific userspace libhid/libusb libraries.
8 *

--- 167 unchanged lines hidden (view full) ---

176
177 list->hidraw = hidraw_table[minor];
178 mutex_init(&list->read_mutex);
179 list_add_tail(&list->node, &hidraw_table[minor]->list);
180 file->private_data = list;
181
182 dev = hidraw_table[minor];
183 if (!dev->open++)
1/*
2 * HID raw devices, giving access to raw HID events.
3 *
4 * In comparison to hiddev, this device does not process the
5 * hid events at all (no parsing, no lookups). This lets applications
6 * to work on raw hid events as they want to, and avoids a need to
7 * use a transport-specific userspace libhid/libusb libraries.
8 *

--- 167 unchanged lines hidden (view full) ---

176
177 list->hidraw = hidraw_table[minor];
178 mutex_init(&list->read_mutex);
179 list_add_tail(&list->node, &hidraw_table[minor]->list);
180 file->private_data = list;
181
182 dev = hidraw_table[minor];
183 if (!dev->open++)
184 dev->hid->hid_open(dev->hid);
184 dev->hid->ll_driver->open(dev->hid);
185
186out_unlock:
187 spin_unlock(&minors_lock);
188out:
189 unlock_kernel();
190 return err;
191
192}

--- 9 unchanged lines hidden (view full) ---

202 minor);
203 return -ENODEV;
204 }
205
206 list_del(&list->node);
207 dev = hidraw_table[minor];
208 if (!dev->open--) {
209 if (list->hidraw->exist)
185
186out_unlock:
187 spin_unlock(&minors_lock);
188out:
189 unlock_kernel();
190 return err;
191
192}

--- 9 unchanged lines hidden (view full) ---

202 minor);
203 return -ENODEV;
204 }
205
206 list_del(&list->node);
207 dev = hidraw_table[minor];
208 if (!dev->open--) {
209 if (list->hidraw->exist)
210 dev->hid->hid_close(dev->hid);
210 dev->hid->ll_driver->close(dev->hid);
211 else
212 kfree(list->hidraw);
213 }
214
215 kfree(list);
216
217 return 0;
218}

--- 143 unchanged lines hidden (view full) ---

362
363 spin_lock(&minors_lock);
364 hidraw_table[hidraw->minor] = NULL;
365 spin_unlock(&minors_lock);
366
367 device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));
368
369 if (hidraw->open) {
211 else
212 kfree(list->hidraw);
213 }
214
215 kfree(list);
216
217 return 0;
218}

--- 143 unchanged lines hidden (view full) ---

362
363 spin_lock(&minors_lock);
364 hidraw_table[hidraw->minor] = NULL;
365 spin_unlock(&minors_lock);
366
367 device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));
368
369 if (hidraw->open) {
370 hid->hid_close(hid);
370 hid->ll_driver->close(hid);
371 wake_up_interruptible(&hidraw->wait);
372 } else {
373 kfree(hidraw);
374 }
375}
376EXPORT_SYMBOL_GPL(hidraw_disconnect);
377
378int __init hidraw_init(void)

--- 37 unchanged lines hidden ---
371 wake_up_interruptible(&hidraw->wait);
372 } else {
373 kfree(hidraw);
374 }
375}
376EXPORT_SYMBOL_GPL(hidraw_disconnect);
377
378int __init hidraw_init(void)

--- 37 unchanged lines hidden ---