mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 02:17:36 -04:00
Merge branch 'for-7.2/cleanup_driver_data' into for-linus
- semantic cleanup fixes for 'hid_device_id::driver_data' (Pawel Zalewski)
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
|
||||
#define VA_INVAL_LOGICAL_BOUNDARY 0x08
|
||||
|
||||
struct cp_device {
|
||||
unsigned long quirks;
|
||||
};
|
||||
|
||||
/*
|
||||
* Some USB barcode readers from cypress have usage min and usage max in
|
||||
* the wrong order
|
||||
@@ -70,7 +74,8 @@ static __u8 *va_logical_boundary_fixup(struct hid_device *hdev, __u8 *rdesc,
|
||||
static const __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
|
||||
unsigned int *rsize)
|
||||
{
|
||||
unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
|
||||
const struct cp_device *cp_device = hid_get_drvdata(hdev);
|
||||
unsigned long quirks = cp_device->quirks;
|
||||
|
||||
if (quirks & CP_RDESC_SWAPPED_MIN_MAX)
|
||||
rdesc = cp_rdesc_fixup(hdev, rdesc, rsize);
|
||||
@@ -84,7 +89,8 @@ static int cp_input_mapped(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 cp_device *cp_device = hid_get_drvdata(hdev);
|
||||
unsigned long quirks = cp_device->quirks;
|
||||
|
||||
if (!(quirks & CP_2WHEEL_MOUSE_HACK))
|
||||
return 0;
|
||||
@@ -100,22 +106,21 @@ static int cp_input_mapped(struct hid_device *hdev, struct hid_input *hi,
|
||||
static int cp_event(struct hid_device *hdev, struct hid_field *field,
|
||||
struct hid_usage *usage, __s32 value)
|
||||
{
|
||||
unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
|
||||
struct cp_device *cp_device = hid_get_drvdata(hdev);
|
||||
|
||||
if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput ||
|
||||
!usage->type || !(quirks & CP_2WHEEL_MOUSE_HACK))
|
||||
!usage->type || !(cp_device->quirks & CP_2WHEEL_MOUSE_HACK))
|
||||
return 0;
|
||||
|
||||
if (usage->hid == 0x00090005) {
|
||||
if (value)
|
||||
quirks |= CP_2WHEEL_MOUSE_HACK_ON;
|
||||
cp_device->quirks |= CP_2WHEEL_MOUSE_HACK_ON;
|
||||
else
|
||||
quirks &= ~CP_2WHEEL_MOUSE_HACK_ON;
|
||||
hid_set_drvdata(hdev, (void *)quirks);
|
||||
cp_device->quirks &= ~CP_2WHEEL_MOUSE_HACK_ON;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (usage->code == REL_WHEEL && (quirks & CP_2WHEEL_MOUSE_HACK_ON)) {
|
||||
if (usage->code == REL_WHEEL && (cp_device->quirks & CP_2WHEEL_MOUSE_HACK_ON)) {
|
||||
struct input_dev *input = field->hidinput->input;
|
||||
|
||||
input_event(input, usage->type, REL_HWHEEL, value);
|
||||
@@ -127,10 +132,17 @@ static int cp_event(struct hid_device *hdev, struct hid_field *field,
|
||||
|
||||
static int cp_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
||||
{
|
||||
unsigned long quirks = id->driver_data;
|
||||
int ret;
|
||||
struct cp_device *cp_device;
|
||||
|
||||
hid_set_drvdata(hdev, (void *)quirks);
|
||||
cp_device = devm_kzalloc(&hdev->dev, sizeof(*cp_device), GFP_KERNEL);
|
||||
|
||||
if (!cp_device)
|
||||
return -ENOMEM;
|
||||
|
||||
cp_device->quirks = id->driver_data;
|
||||
|
||||
hid_set_drvdata(hdev, cp_device);
|
||||
|
||||
ret = hid_parse(hdev);
|
||||
if (ret) {
|
||||
|
||||
@@ -28,7 +28,8 @@ static int gfrm_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 hdev_type = (unsigned long) hid_get_drvdata(hdev);
|
||||
const struct hid_device_id *id = hid_get_drvdata(hdev);
|
||||
unsigned long hdev_type = id->driver_data;
|
||||
|
||||
if (hdev_type == GFRM100) {
|
||||
if (usage->hid == (HID_UP_CONSUMER | 0x4)) {
|
||||
@@ -50,7 +51,8 @@ static int gfrm_input_mapping(struct hid_device *hdev, struct hid_input *hi,
|
||||
static int gfrm_raw_event(struct hid_device *hdev, struct hid_report *report,
|
||||
u8 *data, int size)
|
||||
{
|
||||
unsigned long hdev_type = (unsigned long) hid_get_drvdata(hdev);
|
||||
const struct hid_device_id *id = hid_get_drvdata(hdev);
|
||||
unsigned long hdev_type = id->driver_data;
|
||||
int ret = 0;
|
||||
|
||||
if (hdev_type != GFRM100)
|
||||
@@ -99,7 +101,7 @@ static int gfrm_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
||||
{
|
||||
int ret;
|
||||
|
||||
hid_set_drvdata(hdev, (void *) id->driver_data);
|
||||
hid_set_drvdata(hdev, (void *)id);
|
||||
|
||||
ret = hid_parse(hdev);
|
||||
if (ret)
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
|
||||
static const __u8 *ite_report_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int *rsize)
|
||||
{
|
||||
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 (quirks & QUIRK_TOUCHPAD_ON_OFF_REPORT) {
|
||||
/* For Acer Aspire Switch 10 SW5-012 keyboard-dock */
|
||||
@@ -44,7 +46,8 @@ static int ite_input_mapping(struct hid_device *hdev,
|
||||
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 ((quirks & QUIRK_TOUCHPAD_ON_OFF_REPORT) &&
|
||||
(usage->hid & HID_USAGE_PAGE) == 0x00880000) {
|
||||
@@ -94,7 +97,7 @@ static int ite_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
||||
{
|
||||
int ret;
|
||||
|
||||
hid_set_drvdata(hdev, (void *)id->driver_data);
|
||||
hid_set_drvdata(hdev, (void *)id);
|
||||
|
||||
ret = hid_open_report(hdev);
|
||||
if (ret)
|
||||
|
||||
Reference in New Issue
Block a user