Skip to content

Commit f65a0b1

Browse files
committed
HID: do not inline some hid_hw_ functions
We don't gain much by having them as inline, and it actually prevents us to attach a probe to those helpers. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20211202095334.14399-5-benjamin.tissoires@redhat.com
1 parent 9e35620 commit f65a0b1

2 files changed

Lines changed: 70 additions & 62 deletions

File tree

drivers/hid/hid-core.c

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,6 +2126,70 @@ void hid_hw_close(struct hid_device *hdev)
21262126
}
21272127
EXPORT_SYMBOL_GPL(hid_hw_close);
21282128

2129+
/**
2130+
* hid_hw_request - send report request to device
2131+
*
2132+
* @hdev: hid device
2133+
* @report: report to send
2134+
* @reqtype: hid request type
2135+
*/
2136+
void hid_hw_request(struct hid_device *hdev,
2137+
struct hid_report *report, int reqtype)
2138+
{
2139+
if (hdev->ll_driver->request)
2140+
return hdev->ll_driver->request(hdev, report, reqtype);
2141+
2142+
__hid_request(hdev, report, reqtype);
2143+
}
2144+
EXPORT_SYMBOL_GPL(hid_hw_request);
2145+
2146+
/**
2147+
* hid_hw_raw_request - send report request to device
2148+
*
2149+
* @hdev: hid device
2150+
* @reportnum: report ID
2151+
* @buf: in/out data to transfer
2152+
* @len: length of buf
2153+
* @rtype: HID report type
2154+
* @reqtype: HID_REQ_GET_REPORT or HID_REQ_SET_REPORT
2155+
*
2156+
* Return: count of data transferred, negative if error
2157+
*
2158+
* Same behavior as hid_hw_request, but with raw buffers instead.
2159+
*/
2160+
int hid_hw_raw_request(struct hid_device *hdev,
2161+
unsigned char reportnum, __u8 *buf,
2162+
size_t len, unsigned char rtype, int reqtype)
2163+
{
2164+
if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
2165+
return -EINVAL;
2166+
2167+
return hdev->ll_driver->raw_request(hdev, reportnum, buf, len,
2168+
rtype, reqtype);
2169+
}
2170+
EXPORT_SYMBOL_GPL(hid_hw_raw_request);
2171+
2172+
/**
2173+
* hid_hw_output_report - send output report to device
2174+
*
2175+
* @hdev: hid device
2176+
* @buf: raw data to transfer
2177+
* @len: length of buf
2178+
*
2179+
* Return: count of data transferred, negative if error
2180+
*/
2181+
int hid_hw_output_report(struct hid_device *hdev, __u8 *buf, size_t len)
2182+
{
2183+
if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
2184+
return -EINVAL;
2185+
2186+
if (hdev->ll_driver->output_report)
2187+
return hdev->ll_driver->output_report(hdev, buf, len);
2188+
2189+
return -ENOSYS;
2190+
}
2191+
EXPORT_SYMBOL_GPL(hid_hw_output_report);
2192+
21292193
#ifdef CONFIG_PM
21302194
int hid_driver_suspend(struct hid_device *hdev, pm_message_t state)
21312195
{

include/linux/hid.h

Lines changed: 6 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,12 @@ int __must_check hid_hw_start(struct hid_device *hdev,
10661066
void hid_hw_stop(struct hid_device *hdev);
10671067
int __must_check hid_hw_open(struct hid_device *hdev);
10681068
void hid_hw_close(struct hid_device *hdev);
1069+
void hid_hw_request(struct hid_device *hdev,
1070+
struct hid_report *report, int reqtype);
1071+
int hid_hw_raw_request(struct hid_device *hdev,
1072+
unsigned char reportnum, __u8 *buf,
1073+
size_t len, unsigned char rtype, int reqtype);
1074+
int hid_hw_output_report(struct hid_device *hdev, __u8 *buf, size_t len);
10691075

10701076
/**
10711077
* hid_hw_power - requests underlying HW to go into given power mode
@@ -1083,68 +1089,6 @@ static inline int hid_hw_power(struct hid_device *hdev, int level)
10831089
}
10841090

10851091

1086-
/**
1087-
* hid_hw_request - send report request to device
1088-
*
1089-
* @hdev: hid device
1090-
* @report: report to send
1091-
* @reqtype: hid request type
1092-
*/
1093-
static inline void hid_hw_request(struct hid_device *hdev,
1094-
struct hid_report *report, int reqtype)
1095-
{
1096-
if (hdev->ll_driver->request)
1097-
return hdev->ll_driver->request(hdev, report, reqtype);
1098-
1099-
__hid_request(hdev, report, reqtype);
1100-
}
1101-
1102-
/**
1103-
* hid_hw_raw_request - send report request to device
1104-
*
1105-
* @hdev: hid device
1106-
* @reportnum: report ID
1107-
* @buf: in/out data to transfer
1108-
* @len: length of buf
1109-
* @rtype: HID report type
1110-
* @reqtype: HID_REQ_GET_REPORT or HID_REQ_SET_REPORT
1111-
*
1112-
* Return: count of data transferred, negative if error
1113-
*
1114-
* Same behavior as hid_hw_request, but with raw buffers instead.
1115-
*/
1116-
static inline int hid_hw_raw_request(struct hid_device *hdev,
1117-
unsigned char reportnum, __u8 *buf,
1118-
size_t len, unsigned char rtype, int reqtype)
1119-
{
1120-
if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
1121-
return -EINVAL;
1122-
1123-
return hdev->ll_driver->raw_request(hdev, reportnum, buf, len,
1124-
rtype, reqtype);
1125-
}
1126-
1127-
/**
1128-
* hid_hw_output_report - send output report to device
1129-
*
1130-
* @hdev: hid device
1131-
* @buf: raw data to transfer
1132-
* @len: length of buf
1133-
*
1134-
* Return: count of data transferred, negative if error
1135-
*/
1136-
static inline int hid_hw_output_report(struct hid_device *hdev, __u8 *buf,
1137-
size_t len)
1138-
{
1139-
if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
1140-
return -EINVAL;
1141-
1142-
if (hdev->ll_driver->output_report)
1143-
return hdev->ll_driver->output_report(hdev, buf, len);
1144-
1145-
return -ENOSYS;
1146-
}
1147-
11481092
/**
11491093
* hid_hw_idle - send idle request to device
11501094
*

0 commit comments

Comments
 (0)