diff mbox

[v4,2/2] USB: quirks: Apply ALWAYS_POLL to all ELAN devices

Message ID 1448377325-4725-3-git-send-email-adrienverge@gmail.com (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show

Commit Message

Adrien Vergé Nov. 24, 2015, 3:02 p.m. UTC
All ELAN hid devices seem to require the ALWAYS_POLL quirk. Let's use
this quirk for all devices from this vendor, rather than maintaining a
list of all its known product IDs.

Tested-by: Adrien Vergé <adrienverge@gmail.com>
Signed-off-by: Adrien Vergé <adrienverge@gmail.com>
---
 drivers/hid/hid-ids.h           | 5 -----
 drivers/hid/usbhid/hid-quirks.c | 9 +++------
 2 files changed, 3 insertions(+), 11 deletions(-)

Comments

Benjamin Tissoires Nov. 24, 2015, 4:11 p.m. UTC | #1
On Tue, Nov 24, 2015 at 4:02 PM, Adrien Vergé <adrienverge@gmail.com> wrote:
> All ELAN hid devices seem to require the ALWAYS_POLL quirk. Let's use
> this quirk for all devices from this vendor, rather than maintaining a
> list of all its known product IDs.
>
> Tested-by: Adrien Vergé <adrienverge@gmail.com>
> Signed-off-by: Adrien Vergé <adrienverge@gmail.com>
> ---

The HID part is:
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin

>  drivers/hid/hid-ids.h           | 5 -----
>  drivers/hid/usbhid/hid-quirks.c | 9 +++------
>  2 files changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> index ac1feea..3c7e0c3 100644
> --- a/drivers/hid/hid-ids.h
> +++ b/drivers/hid/hid-ids.h
> @@ -316,11 +316,6 @@
>  #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001      0xa001
>
>  #define USB_VENDOR_ID_ELAN             0x04f3
> -#define USB_DEVICE_ID_ELAN_TOUCHSCREEN 0x0089
> -#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B    0x009b
> -#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103    0x0103
> -#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c    0x010c
> -#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F    0x016f
>
>  #define USB_VENDOR_ID_ELECOM           0x056e
>  #define USB_DEVICE_ID_ELECOM_BM084     0x0061
> diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
> index 94bb137..b1af008 100644
> --- a/drivers/hid/usbhid/hid-quirks.c
> +++ b/drivers/hid/usbhid/hid-quirks.c
> @@ -72,11 +72,7 @@ static const struct hid_blacklist {
>         { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
>         { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
>         { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT },
> -       { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL },
> -       { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL },
> -       { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103, HID_QUIRK_ALWAYS_POLL },
> -       { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c, HID_QUIRK_ALWAYS_POLL },
> -       { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL },
> +       { USB_VENDOR_ID_ELAN, HID_ANY_ID, HID_QUIRK_ALWAYS_POLL },
>         { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
>         { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
>         { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
> @@ -339,7 +335,8 @@ static const struct hid_blacklist *usbhid_exists_squirk(const u16 idVendor,
>
>         for (; hid_blacklist[n].idVendor; n++)
>                 if (hid_blacklist[n].idVendor == idVendor &&
> -                               hid_blacklist[n].idProduct == idProduct)
> +                       (hid_blacklist[n].idProduct == HID_ANY_ID ||
> +                               hid_blacklist[n].idProduct == idProduct))
>                         bl_entry = &hid_blacklist[n];
>
>         if (bl_entry != NULL)
> --
> 2.4.3
>
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
kernel test robot Nov. 24, 2015, 4:41 p.m. UTC | #2
Hi Adrien,

[auto build test WARNING on hid/for-next]
[also build test WARNING on v4.4-rc2 next-20151124]

url:    https://github.com/0day-ci/linux/commits/Adrien-Verg/Fixes-for-ELAN-touchscreens/20151124-230537
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git for-next
config: avr32-hammerhead_defconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=avr32 

All warnings (new ones prefixed by >>):

   drivers/hid/usbhid/hid-quirks.c: In function 'usbhid_exists_squirk':
>> drivers/hid/usbhid/hid-quirks.c:339: warning: comparison is always false due to limited range of data type

vim +339 drivers/hid/usbhid/hid-quirks.c

   323	 * @idProduct: the 16-bit USB product ID, in native byteorder
   324	 *
   325	 * Description:
   326	 *     Given a USB vendor ID and product ID, return a pointer to
   327	 *     the hid_blacklist entry associated with that device.
   328	 *
   329	 * Returns: pointer if quirk found, or NULL if no quirks found.
   330	 */
   331	static const struct hid_blacklist *usbhid_exists_squirk(const u16 idVendor,
   332			const u16 idProduct)
   333	{
   334		const struct hid_blacklist *bl_entry = NULL;
   335		int n = 0;
   336	
   337		for (; hid_blacklist[n].idVendor; n++)
   338			if (hid_blacklist[n].idVendor == idVendor &&
 > 339				(hid_blacklist[n].idProduct == HID_ANY_ID ||
   340					hid_blacklist[n].idProduct == idProduct))
   341				bl_entry = &hid_blacklist[n];
   342	
   343		if (bl_entry != NULL)
   344			dbg_hid("Found squirk 0x%x for USB HID vendor 0x%hx prod 0x%hx\n",
   345					bl_entry->quirks, bl_entry->idVendor, 
   346					bl_entry->idProduct);
   347		return bl_entry;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Greg Kroah-Hartman Dec. 1, 2015, 6:21 p.m. UTC | #3
On Tue, Nov 24, 2015 at 04:02:05PM +0100, Adrien Vergé wrote:
> All ELAN hid devices seem to require the ALWAYS_POLL quirk. Let's use
> this quirk for all devices from this vendor, rather than maintaining a
> list of all its known product IDs.
> 
> Tested-by: Adrien Vergé <adrienverge@gmail.com>
> Signed-off-by: Adrien Vergé <adrienverge@gmail.com>
> ---
>  drivers/hid/hid-ids.h           | 5 -----
>  drivers/hid/usbhid/hid-quirks.c | 9 +++------
>  2 files changed, 3 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> index ac1feea..3c7e0c3 100644
> --- a/drivers/hid/hid-ids.h
> +++ b/drivers/hid/hid-ids.h
> @@ -316,11 +316,6 @@
>  #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001	0xa001
>  
>  #define USB_VENDOR_ID_ELAN		0x04f3
> -#define USB_DEVICE_ID_ELAN_TOUCHSCREEN	0x0089
> -#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B	0x009b
> -#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103	0x0103
> -#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c	0x010c
> -#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F	0x016f
>  
>  #define USB_VENDOR_ID_ELECOM		0x056e
>  #define USB_DEVICE_ID_ELECOM_BM084	0x0061
> diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
> index 94bb137..b1af008 100644
> --- a/drivers/hid/usbhid/hid-quirks.c
> +++ b/drivers/hid/usbhid/hid-quirks.c
> @@ -72,11 +72,7 @@ static const struct hid_blacklist {
>  	{ USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
>  	{ USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
>  	{ USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT },
> -	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL },
> -	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL },
> -	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103, HID_QUIRK_ALWAYS_POLL },
> -	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c, HID_QUIRK_ALWAYS_POLL },
> -	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL },
> +	{ USB_VENDOR_ID_ELAN, HID_ANY_ID, HID_QUIRK_ALWAYS_POLL },
>  	{ USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
>  	{ USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
>  	{ USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
> @@ -339,7 +335,8 @@ static const struct hid_blacklist *usbhid_exists_squirk(const u16 idVendor,
>  
>  	for (; hid_blacklist[n].idVendor; n++)
>  		if (hid_blacklist[n].idVendor == idVendor &&
> -				hid_blacklist[n].idProduct == idProduct)
> +			(hid_blacklist[n].idProduct == HID_ANY_ID ||
> +				hid_blacklist[n].idProduct == idProduct))

Please fix the warning the kbuild infrastructure told you about here.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index ac1feea..3c7e0c3 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -316,11 +316,6 @@ 
 #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001	0xa001
 
 #define USB_VENDOR_ID_ELAN		0x04f3
-#define USB_DEVICE_ID_ELAN_TOUCHSCREEN	0x0089
-#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B	0x009b
-#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103	0x0103
-#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c	0x010c
-#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F	0x016f
 
 #define USB_VENDOR_ID_ELECOM		0x056e
 #define USB_DEVICE_ID_ELECOM_BM084	0x0061
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 94bb137..b1af008 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -72,11 +72,7 @@  static const struct hid_blacklist {
 	{ USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT },
-	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL },
-	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL },
-	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103, HID_QUIRK_ALWAYS_POLL },
-	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c, HID_QUIRK_ALWAYS_POLL },
-	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL },
+	{ USB_VENDOR_ID_ELAN, HID_ANY_ID, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
@@ -339,7 +335,8 @@  static const struct hid_blacklist *usbhid_exists_squirk(const u16 idVendor,
 
 	for (; hid_blacklist[n].idVendor; n++)
 		if (hid_blacklist[n].idVendor == idVendor &&
-				hid_blacklist[n].idProduct == idProduct)
+			(hid_blacklist[n].idProduct == HID_ANY_ID ||
+				hid_blacklist[n].idProduct == idProduct))
 			bl_entry = &hid_blacklist[n];
 
 	if (bl_entry != NULL)