Skip to content

Commit 50223e4

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: HID: Remove duplicate Kconfig entry HID: consolidate connect and disconnect into core code HID: fix non-atomic allocation in hid_input_report
2 parents e258b80 + a2d693c commit 50223e4

5 files changed

Lines changed: 20 additions & 27 deletions

File tree

‎drivers/hid/Kconfig‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,6 @@ config HID_NTRIG
204204
---help---
205205
Support for N-Trig touch screen.
206206

207-
config HID_PANTHERLORD
208-
tristate "Pantherlord devices support" if EMBEDDED
209-
depends on USB_HID
210-
default !EMBEDDED
211-
---help---
212-
Support for PantherLord/GreenAsia based device support.
213-
214207
config HID_PANTHERLORD
215208
tristate "Pantherlord support" if EMBEDDED
216209
depends on USB_HID

‎drivers/hid/hid-core.c‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,8 +1089,7 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
10891089
return -1;
10901090
}
10911091

1092-
buf = kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE,
1093-
interrupt ? GFP_ATOMIC : GFP_KERNEL);
1092+
buf = kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_ATOMIC);
10941093

10951094
if (!buf) {
10961095
report = hid_get_report(report_enum, data);
@@ -1238,6 +1237,17 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
12381237
}
12391238
EXPORT_SYMBOL_GPL(hid_connect);
12401239

1240+
void hid_disconnect(struct hid_device *hdev)
1241+
{
1242+
if (hdev->claimed & HID_CLAIMED_INPUT)
1243+
hidinput_disconnect(hdev);
1244+
if (hdev->claimed & HID_CLAIMED_HIDDEV)
1245+
hdev->hiddev_disconnect(hdev);
1246+
if (hdev->claimed & HID_CLAIMED_HIDRAW)
1247+
hidraw_disconnect(hdev);
1248+
}
1249+
EXPORT_SYMBOL_GPL(hid_disconnect);
1250+
12411251
/* a list of devices for which there is a specialized driver on HID bus */
12421252
static const struct hid_device_id hid_blacklist[] = {
12431253
{ HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) },

‎drivers/hid/usbhid/hid-core.c‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,13 +1041,6 @@ static void usbhid_stop(struct hid_device *hid)
10411041

10421042
hid_cancel_delayed_stuff(usbhid);
10431043

1044-
if (hid->claimed & HID_CLAIMED_INPUT)
1045-
hidinput_disconnect(hid);
1046-
if (hid->claimed & HID_CLAIMED_HIDDEV)
1047-
hiddev_disconnect(hid);
1048-
if (hid->claimed & HID_CLAIMED_HIDRAW)
1049-
hidraw_disconnect(hid);
1050-
10511044
hid->claimed = 0;
10521045

10531046
usb_free_urb(usbhid->urbin);
@@ -1085,7 +1078,7 @@ static struct hid_ll_driver usb_hid_driver = {
10851078
.hidinput_input_event = usb_hidinput_input_event,
10861079
};
10871080

1088-
static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
1081+
static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *id)
10891082
{
10901083
struct usb_host_interface *interface = intf->cur_altsetting;
10911084
struct usb_device *dev = interface_to_usbdev(intf);
@@ -1117,6 +1110,7 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
11171110
hid->ff_init = hid_pidff_init;
11181111
#ifdef CONFIG_USB_HIDDEV
11191112
hid->hiddev_connect = hiddev_connect;
1113+
hid->hiddev_disconnect = hiddev_disconnect;
11201114
hid->hiddev_hid_event = hiddev_hid_event;
11211115
hid->hiddev_report_event = hiddev_report_event;
11221116
#endif
@@ -1177,7 +1171,7 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
11771171
return ret;
11781172
}
11791173

1180-
static void hid_disconnect(struct usb_interface *intf)
1174+
static void usbhid_disconnect(struct usb_interface *intf)
11811175
{
11821176
struct hid_device *hid = usb_get_intfdata(intf);
11831177
struct usbhid_device *usbhid;
@@ -1359,8 +1353,8 @@ MODULE_DEVICE_TABLE (usb, hid_usb_ids);
13591353

13601354
static struct usb_driver hid_driver = {
13611355
.name = "usbhid",
1362-
.probe = hid_probe,
1363-
.disconnect = hid_disconnect,
1356+
.probe = usbhid_probe,
1357+
.disconnect = usbhid_disconnect,
13641358
#ifdef CONFIG_PM
13651359
.suspend = hid_suspend,
13661360
.resume = hid_resume,

‎include/linux/hid.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ struct hid_device { /* device report descriptor */
494494

495495
/* hiddev event handler */
496496
int (*hiddev_connect)(struct hid_device *, unsigned int);
497+
void (*hiddev_disconnect)(struct hid_device *);
497498
void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field,
498499
struct hid_usage *, __s32);
499500
void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
@@ -691,6 +692,7 @@ struct hid_device *hid_allocate_device(void);
691692
int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
692693
int hid_check_keys_pressed(struct hid_device *hid);
693694
int hid_connect(struct hid_device *hid, unsigned int connect_mask);
695+
void hid_disconnect(struct hid_device *hid);
694696

695697
/**
696698
* hid_map_usage - map usage input bits
@@ -800,6 +802,7 @@ static inline int __must_check hid_hw_start(struct hid_device *hdev,
800802
*/
801803
static inline void hid_hw_stop(struct hid_device *hdev)
802804
{
805+
hid_disconnect(hdev);
803806
hdev->ll_driver->stop(hdev);
804807
}
805808

‎net/bluetooth/hidp/core.c‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -577,11 +577,6 @@ static int hidp_session(void *arg)
577577
}
578578

579579
if (session->hid) {
580-
if (session->hid->claimed & HID_CLAIMED_INPUT)
581-
hidinput_disconnect(session->hid);
582-
if (session->hid->claimed & HID_CLAIMED_HIDRAW)
583-
hidraw_disconnect(session->hid);
584-
585580
hid_destroy_device(session->hid);
586581
session->hid = NULL;
587582
}
@@ -747,8 +742,6 @@ static void hidp_stop(struct hid_device *hid)
747742
skb_queue_purge(&session->ctrl_transmit);
748743
skb_queue_purge(&session->intr_transmit);
749744

750-
if (hid->claimed & HID_CLAIMED_INPUT)
751-
hidinput_disconnect(hid);
752745
hid->claimed = 0;
753746
}
754747

0 commit comments

Comments
 (0)