Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b417b8a authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Todd Kjos
Browse files

HID: add hid_is_usb() function to make it simpler for USB detection



commit f83baa0cb6cfc92ebaf7f9d3a99d7e34f2e77a8a upstream.

A number of HID drivers already call hid_is_using_ll_driver() but only
for the detection of if this is a USB device or not.  Make this more
obvious by creating hid_is_usb() and calling the function that way.

Also converts the existing hid_is_using_ll_driver() functions to use the
new call.

Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org
Cc: stable@vger.kernel.org
Tested-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Link: https://lore.kernel.org/r/20211201183503.2373082-1-gregkh@linuxfoundation.org


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Change-Id: I63ea5872261294c12fc05b42ba4c7515501e866e
parent c72022ce
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -760,6 +760,22 @@ struct hid_ll_driver {
	int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype);
};

extern struct hid_ll_driver i2c_hid_ll_driver;
extern struct hid_ll_driver hidp_hid_driver;
extern struct hid_ll_driver uhid_hid_driver;
extern struct hid_ll_driver usb_hid_driver;

static inline bool hid_is_using_ll_driver(struct hid_device *hdev,
		struct hid_ll_driver *driver)
{
	return hdev->ll_driver == driver;
}

static inline bool hid_is_usb(struct hid_device *hdev)
{
	return hid_is_using_ll_driver(hdev, &usb_hid_driver);
}

#define	PM_HINT_FULLON	1<<5
#define PM_HINT_NORMAL	1<<1