ANDROID: HID: Only utilise UHID provided exports if UHID is enabled
Commit "ANDROID: HID; Over-ride default maximum buffer size when using UHID" provided a means for the UHID driver to offer an alternative (smaller) report buffer size when dealing with user-space. The method used was an Android-only solution designed to prevent the KMI ABI from being broken (nb: the upstream solution was cleaner, but broke the ABI). Since this solution involved consuming resources exported by a subordinate driver, that driver would have to be enabled for the export to take place. Since all of our default configs enable UHID, an issue was not detected. However, for more specific kernel configs, where HID is enabled, but UHID is not, this leads to compile-time undefined symbol errors: ld.lld: error: undefined symbol: uhid_hid_driver This patch relies on the compiler to leave out unutilised sections of the code if the associated resources are not available. Bug: 260007429 Reported-by: Paul Lawrence <paullawrence@google.com> Reported-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Lee Jones <joneslee@google.com> Change-Id: I80b1aa7454c89d5c5e21f0268252ffb666efab97
This commit is contained in:
parent
1c4d2aa0c7
commit
7668cef283
1 changed files with 4 additions and 4 deletions
|
|
@ -293,7 +293,7 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
|
|||
offset = report->size;
|
||||
report->size += parser->global.report_size * parser->global.report_count;
|
||||
|
||||
if (parser->device->ll_driver == &uhid_hid_driver)
|
||||
if (IS_ENABLED(CONFIG_UHID) && parser->device->ll_driver == &uhid_hid_driver)
|
||||
max_buffer_size = UHID_DATA_MAX;
|
||||
|
||||
/* Total size check: Allow for possible report index byte */
|
||||
|
|
@ -1987,7 +1987,7 @@ int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *
|
|||
|
||||
rsize = hid_compute_report_size(report);
|
||||
|
||||
if (hid->ll_driver == &uhid_hid_driver)
|
||||
if (IS_ENABLED(CONFIG_UHID) && hid->ll_driver == &uhid_hid_driver)
|
||||
max_buffer_size = UHID_DATA_MAX;
|
||||
|
||||
if (report_enum->numbered && rsize >= max_buffer_size)
|
||||
|
|
@ -2398,7 +2398,7 @@ int hid_hw_raw_request(struct hid_device *hdev,
|
|||
{
|
||||
unsigned int max_buffer_size = HID_MAX_BUFFER_SIZE;
|
||||
|
||||
if (hdev->ll_driver == &uhid_hid_driver)
|
||||
if (IS_ENABLED(CONFIG_UHID) && hdev->ll_driver == &uhid_hid_driver)
|
||||
max_buffer_size = UHID_DATA_MAX;
|
||||
|
||||
if (len < 1 || len > max_buffer_size || !buf)
|
||||
|
|
@ -2422,7 +2422,7 @@ int hid_hw_output_report(struct hid_device *hdev, __u8 *buf, size_t len)
|
|||
{
|
||||
unsigned int max_buffer_size = HID_MAX_BUFFER_SIZE;
|
||||
|
||||
if (hdev->ll_driver == &uhid_hid_driver)
|
||||
if (IS_ENABLED(CONFIG_UHID) && hdev->ll_driver == &uhid_hid_driver)
|
||||
max_buffer_size = UHID_DATA_MAX;
|
||||
|
||||
if (len < 1 || len > max_buffer_size || !buf)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue