mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 03:27:30 -04:00
HID: hid-belkin: clean up usage of 'driver_data'
The module is storing an integer inside the drvdata pointer, which is confusing, lets fix this and set the whole of 'hid_device_id' struct as the drvdata and then simply use its integer 'driver_data' field for quirks, which shall make the code cleaner, type-safe, consistent and more readable. This makes the cast to (void *) during storage a bit safer (just to suppress the const qualifier warning) and the cast to (unsigned long) during retrieval is removed. Signed-off-by: Pawel Zalewski (The Capable Hub) <pzalewski@thegoodpenguin.co.uk> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
This commit is contained in:
committed by
Benjamin Tissoires
parent
e6f4f084ec
commit
4de4b8a5dd
@@ -27,7 +27,8 @@ static int belkin_input_mapping(struct hid_device *hdev, struct hid_input *hi,
|
||||
struct hid_field *field, struct hid_usage *usage,
|
||||
unsigned long **bit, int *max)
|
||||
{
|
||||
unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
|
||||
const struct hid_device_id *id = hid_get_drvdata(hdev);
|
||||
unsigned long quirks = id->driver_data;
|
||||
|
||||
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER ||
|
||||
!(quirks & BELKIN_WKBD))
|
||||
@@ -48,7 +49,7 @@ static int belkin_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
||||
unsigned long quirks = id->driver_data;
|
||||
int ret;
|
||||
|
||||
hid_set_drvdata(hdev, (void *)quirks);
|
||||
hid_set_drvdata(hdev, (void *)id);
|
||||
|
||||
ret = hid_parse(hdev);
|
||||
if (ret) {
|
||||
|
||||
Reference in New Issue
Block a user