Skip to content

Commit de6c507

Browse files
author
Jiri Kosina
committed
Merge branch 'for-4.14/wacom' into for-linus
- name generation improvement for Wacom devices from Jason Gerecke - Kconfig dependency fix for Wacom driver from Arnd Bergmann
2 parents 5c891d5 + 9d14201 commit de6c507

File tree

7 files changed

+48
-40
lines changed

7 files changed

+48
-40
lines changed

drivers/hid/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ config HID_UDRAW_PS3
924924

925925
config HID_WACOM
926926
tristate "Wacom Intuos/Graphire tablet support (USB)"
927-
depends on HID
927+
depends on USB_HID
928928
select POWER_SUPPLY
929929
select NEW_LEDS
930930
select LEDS_CLASS

drivers/hid/i2c-hid/i2c-hid.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ static int i2c_hid_power(struct hid_device *hid, int lvl)
780780
return 0;
781781
}
782782

783-
static struct hid_ll_driver i2c_hid_ll_driver = {
783+
struct hid_ll_driver i2c_hid_ll_driver = {
784784
.parse = i2c_hid_parse,
785785
.start = i2c_hid_start,
786786
.stop = i2c_hid_stop,
@@ -790,6 +790,7 @@ static struct hid_ll_driver i2c_hid_ll_driver = {
790790
.output_report = i2c_hid_output_report,
791791
.raw_request = i2c_hid_raw_request,
792792
};
793+
EXPORT_SYMBOL_GPL(i2c_hid_ll_driver);
793794

794795
static int i2c_hid_init_irq(struct i2c_client *client)
795796
{

drivers/hid/uhid.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ static int uhid_hid_output_report(struct hid_device *hid, __u8 *buf,
369369
return uhid_hid_output_raw(hid, buf, count, HID_OUTPUT_REPORT);
370370
}
371371

372-
static struct hid_ll_driver uhid_hid_driver = {
372+
struct hid_ll_driver uhid_hid_driver = {
373373
.start = uhid_hid_start,
374374
.stop = uhid_hid_stop,
375375
.open = uhid_hid_open,
@@ -378,6 +378,7 @@ static struct hid_ll_driver uhid_hid_driver = {
378378
.raw_request = uhid_hid_raw_request,
379379
.output_report = uhid_hid_output_report,
380380
};
381+
EXPORT_SYMBOL_GPL(uhid_hid_driver);
381382

382383
#ifdef CONFIG_COMPAT
383384

drivers/hid/usbhid/hid-core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ static int usbhid_idle(struct hid_device *hid, int report, int idle,
12651265
return hid_set_idle(dev, ifnum, report, idle);
12661266
}
12671267

1268-
static struct hid_ll_driver usb_hid_driver = {
1268+
struct hid_ll_driver usb_hid_driver = {
12691269
.parse = usbhid_parse,
12701270
.start = usbhid_start,
12711271
.stop = usbhid_stop,
@@ -1278,6 +1278,7 @@ static struct hid_ll_driver usb_hid_driver = {
12781278
.output_report = usbhid_output_report,
12791279
.idle = usbhid_idle,
12801280
};
1281+
EXPORT_SYMBOL_GPL(usb_hid_driver);
12811282

12821283
static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *id)
12831284
{

drivers/hid/wacom_sys.c

Lines changed: 28 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,10 +1671,7 @@ static ssize_t wacom_show_remote_mode(struct kobject *kobj,
16711671
u8 mode;
16721672

16731673
mode = wacom->led.groups[index].select;
1674-
if (mode >= 0 && mode < 3)
1675-
return snprintf(buf, PAGE_SIZE, "%d\n", mode);
1676-
else
1677-
return snprintf(buf, PAGE_SIZE, "%d\n", -1);
1674+
return sprintf(buf, "%d\n", mode < 3 ? mode : -1);
16781675
}
16791676

16801677
#define DEVICE_EKR_ATTR_GROUP(SET_ID) \
@@ -2028,41 +2025,37 @@ static void wacom_update_name(struct wacom *wacom, const char *suffix)
20282025

20292026
/* Generic devices name unspecified */
20302027
if ((features->type == HID_GENERIC) && !strcmp("Wacom HID", features->name)) {
2031-
if (strstr(wacom->hdev->name, "Wacom") ||
2032-
strstr(wacom->hdev->name, "wacom") ||
2033-
strstr(wacom->hdev->name, "WACOM")) {
2034-
/* name is in HID descriptor, use it */
2035-
strlcpy(name, wacom->hdev->name, sizeof(name));
2036-
2037-
/* strip out excess whitespaces */
2038-
while (1) {
2039-
char *gap = strstr(name, " ");
2040-
if (gap == NULL)
2041-
break;
2042-
/* shift everything including the terminator */
2043-
memmove(gap, gap+1, strlen(gap));
2044-
}
2028+
char *product_name = wacom->hdev->name;
20452029

2046-
/* strip off excessive prefixing */
2047-
if (strstr(name, "Wacom Co.,Ltd. Wacom ") == name) {
2048-
int n = strlen(name);
2049-
int x = strlen("Wacom Co.,Ltd. ");
2050-
memmove(name, name+x, n-x+1);
2051-
}
2052-
if (strstr(name, "Wacom Co., Ltd. Wacom ") == name) {
2053-
int n = strlen(name);
2054-
int x = strlen("Wacom Co., Ltd. ");
2055-
memmove(name, name+x, n-x+1);
2056-
}
2030+
if (hid_is_using_ll_driver(wacom->hdev, &usb_hid_driver)) {
2031+
struct usb_interface *intf = to_usb_interface(wacom->hdev->dev.parent);
2032+
struct usb_device *dev = interface_to_usbdev(intf);
2033+
product_name = dev->product;
2034+
}
20572035

2058-
/* get rid of trailing whitespace */
2059-
if (name[strlen(name)-1] == ' ')
2060-
name[strlen(name)-1] = '\0';
2036+
if (wacom->hdev->bus == BUS_I2C) {
2037+
snprintf(name, sizeof(name), "%s %X",
2038+
features->name, wacom->hdev->product);
2039+
} else if (strstr(product_name, "Wacom") ||
2040+
strstr(product_name, "wacom") ||
2041+
strstr(product_name, "WACOM")) {
2042+
strlcpy(name, product_name, sizeof(name));
20612043
} else {
2062-
/* no meaningful name retrieved. use product ID */
2063-
snprintf(name, sizeof(name),
2064-
"%s %X", features->name, wacom->hdev->product);
2044+
snprintf(name, sizeof(name), "Wacom %s", product_name);
20652045
}
2046+
2047+
/* strip out excess whitespaces */
2048+
while (1) {
2049+
char *gap = strstr(name, " ");
2050+
if (gap == NULL)
2051+
break;
2052+
/* shift everything including the terminator */
2053+
memmove(gap, gap+1, strlen(gap));
2054+
}
2055+
2056+
/* get rid of trailing whitespace */
2057+
if (name[strlen(name)-1] == ' ')
2058+
name[strlen(name)-1] = '\0';
20662059
} else {
20672060
strlcpy(name, features->name, sizeof(name));
20682061
}

include/linux/hid.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,17 @@ struct hid_ll_driver {
780780
int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype);
781781
};
782782

783+
extern struct hid_ll_driver i2c_hid_ll_driver;
784+
extern struct hid_ll_driver hidp_hid_driver;
785+
extern struct hid_ll_driver uhid_hid_driver;
786+
extern struct hid_ll_driver usb_hid_driver;
787+
788+
static inline bool hid_is_using_ll_driver(struct hid_device *hdev,
789+
struct hid_ll_driver *driver)
790+
{
791+
return hdev->ll_driver == driver;
792+
}
793+
783794
#define PM_HINT_FULLON 1<<5
784795
#define PM_HINT_NORMAL 1<<1
785796

net/bluetooth/hidp/core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ static void hidp_stop(struct hid_device *hid)
734734
hid->claimed = 0;
735735
}
736736

737-
static struct hid_ll_driver hidp_hid_driver = {
737+
struct hid_ll_driver hidp_hid_driver = {
738738
.parse = hidp_parse,
739739
.start = hidp_start,
740740
.stop = hidp_stop,
@@ -743,6 +743,7 @@ static struct hid_ll_driver hidp_hid_driver = {
743743
.raw_request = hidp_raw_request,
744744
.output_report = hidp_output_report,
745745
};
746+
EXPORT_SYMBOL_GPL(hidp_hid_driver);
746747

747748
/* This function sets up the hid device. It does not add it
748749
to the HID system. That is done in hidp_add_connection(). */

0 commit comments

Comments
 (0)