mirror of
https://github.com/torvalds/linux.git
synced 2024-11-29 15:41:36 +00:00
HID: convert defines of HID class requests into a proper enum
This allows to export the type in BTF and so in the automatically generated vmlinux.h. It will also add some static checks on the users when we change the ll driver API (see not below). Note that we need to also do change in the ll_driver API, but given that this will have a wider impact outside of this tree, we leave this as a TODO for the future. Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Link: https://lore.kernel.org/r/20220902132938.2409206-11-benjamin.tissoires@redhat.com
This commit is contained in:
parent
ead77b65ae
commit
735e1bb1b8
@ -1921,7 +1921,7 @@ static struct hid_report *hid_get_report(struct hid_report_enum *report_enum,
|
|||||||
* DO NOT USE in hid drivers directly, but through hid_hw_request instead.
|
* DO NOT USE in hid drivers directly, but through hid_hw_request instead.
|
||||||
*/
|
*/
|
||||||
int __hid_request(struct hid_device *hid, struct hid_report *report,
|
int __hid_request(struct hid_device *hid, struct hid_report *report,
|
||||||
int reqtype)
|
enum hid_class_request reqtype)
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
int ret;
|
int ret;
|
||||||
@ -2353,7 +2353,7 @@ EXPORT_SYMBOL_GPL(hid_hw_close);
|
|||||||
* @reqtype: hid request type
|
* @reqtype: hid request type
|
||||||
*/
|
*/
|
||||||
void hid_hw_request(struct hid_device *hdev,
|
void hid_hw_request(struct hid_device *hdev,
|
||||||
struct hid_report *report, int reqtype)
|
struct hid_report *report, enum hid_class_request reqtype)
|
||||||
{
|
{
|
||||||
if (hdev->ll_driver->request)
|
if (hdev->ll_driver->request)
|
||||||
return hdev->ll_driver->request(hdev, report, reqtype);
|
return hdev->ll_driver->request(hdev, report, reqtype);
|
||||||
@ -2378,7 +2378,7 @@ EXPORT_SYMBOL_GPL(hid_hw_request);
|
|||||||
*/
|
*/
|
||||||
int hid_hw_raw_request(struct hid_device *hdev,
|
int hid_hw_raw_request(struct hid_device *hdev,
|
||||||
unsigned char reportnum, __u8 *buf,
|
unsigned char reportnum, __u8 *buf,
|
||||||
size_t len, enum hid_report_type rtype, int reqtype)
|
size_t len, enum hid_report_type rtype, enum hid_class_request reqtype)
|
||||||
{
|
{
|
||||||
if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
|
if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -923,7 +923,7 @@ struct hid_field *hidinput_get_led_field(struct hid_device *hid);
|
|||||||
unsigned int hidinput_count_leds(struct hid_device *hid);
|
unsigned int hidinput_count_leds(struct hid_device *hid);
|
||||||
__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code);
|
__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code);
|
||||||
void hid_output_report(struct hid_report *report, __u8 *data);
|
void hid_output_report(struct hid_report *report, __u8 *data);
|
||||||
int __hid_request(struct hid_device *hid, struct hid_report *rep, int reqtype);
|
int __hid_request(struct hid_device *hid, struct hid_report *rep, enum hid_class_request reqtype);
|
||||||
u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags);
|
u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags);
|
||||||
struct hid_device *hid_allocate_device(void);
|
struct hid_device *hid_allocate_device(void);
|
||||||
struct hid_report *hid_register_report(struct hid_device *device,
|
struct hid_report *hid_register_report(struct hid_device *device,
|
||||||
@ -1100,10 +1100,11 @@ void hid_hw_stop(struct hid_device *hdev);
|
|||||||
int __must_check hid_hw_open(struct hid_device *hdev);
|
int __must_check hid_hw_open(struct hid_device *hdev);
|
||||||
void hid_hw_close(struct hid_device *hdev);
|
void hid_hw_close(struct hid_device *hdev);
|
||||||
void hid_hw_request(struct hid_device *hdev,
|
void hid_hw_request(struct hid_device *hdev,
|
||||||
struct hid_report *report, int reqtype);
|
struct hid_report *report, enum hid_class_request reqtype);
|
||||||
int hid_hw_raw_request(struct hid_device *hdev,
|
int hid_hw_raw_request(struct hid_device *hdev,
|
||||||
unsigned char reportnum, __u8 *buf,
|
unsigned char reportnum, __u8 *buf,
|
||||||
size_t len, enum hid_report_type rtype, int reqtype);
|
size_t len, enum hid_report_type rtype,
|
||||||
|
enum hid_class_request reqtype);
|
||||||
int hid_hw_output_report(struct hid_device *hdev, __u8 *buf, size_t len);
|
int hid_hw_output_report(struct hid_device *hdev, __u8 *buf, size_t len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1131,7 +1132,7 @@ static inline int hid_hw_power(struct hid_device *hdev, int level)
|
|||||||
* @reqtype: hid request type
|
* @reqtype: hid request type
|
||||||
*/
|
*/
|
||||||
static inline int hid_hw_idle(struct hid_device *hdev, int report, int idle,
|
static inline int hid_hw_idle(struct hid_device *hdev, int report, int idle,
|
||||||
int reqtype)
|
enum hid_class_request reqtype)
|
||||||
{
|
{
|
||||||
if (hdev->ll_driver->idle)
|
if (hdev->ll_driver->idle)
|
||||||
return hdev->ll_driver->idle(hdev, report, idle, reqtype);
|
return hdev->ll_driver->idle(hdev, report, idle, reqtype);
|
||||||
|
@ -58,12 +58,14 @@ enum hid_report_type {
|
|||||||
* HID class requests
|
* HID class requests
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define HID_REQ_GET_REPORT 0x01
|
enum hid_class_request {
|
||||||
#define HID_REQ_GET_IDLE 0x02
|
HID_REQ_GET_REPORT = 0x01,
|
||||||
#define HID_REQ_GET_PROTOCOL 0x03
|
HID_REQ_GET_IDLE = 0x02,
|
||||||
#define HID_REQ_SET_REPORT 0x09
|
HID_REQ_GET_PROTOCOL = 0x03,
|
||||||
#define HID_REQ_SET_IDLE 0x0A
|
HID_REQ_SET_REPORT = 0x09,
|
||||||
#define HID_REQ_SET_PROTOCOL 0x0B
|
HID_REQ_SET_IDLE = 0x0A,
|
||||||
|
HID_REQ_SET_PROTOCOL = 0x0B,
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* HID class descriptor types
|
* HID class descriptor types
|
||||||
|
Loading…
Reference in New Issue
Block a user