diff mbox

HID: i2c-hid: fix harmless test_bit() issue

Message ID 20150514083330.GB1665@mwanda (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show

Commit Message

Dan Carpenter May 14, 2015, 8:33 a.m. UTC
These defines are used like this:

	if (test_bit(I2C_HID_STARTED, &ihid->flags))

The intent was to use bits 0, 1, and 2 but because of the extra shifts
we're using bits 1, 2, and 4.  It's harmless becuase it's done
consistently but it's not the intent and static checkers will complain.

Fixes: 4a200c3b9a40 ('HID: i2c-hid: introduce HID over i2c specification implementation')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
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

Comments

Benjamin Tissoires May 14, 2015, 2:17 p.m. UTC | #1
On May 14 2015 or thereabouts, Dan Carpenter wrote:
> These defines are used like this:
> 
> 	if (test_bit(I2C_HID_STARTED, &ihid->flags))
> 
> The intent was to use bits 0, 1, and 2 but because of the extra shifts
> we're using bits 1, 2, and 4.  It's harmless becuase it's done
> consistently but it's not the intent and static checkers will complain.
> 
> Fixes: 4a200c3b9a40 ('HID: i2c-hid: introduce HID over i2c specification implementation')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Same as the other one: 

Oops. Looks good to me:

Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin


> 
> diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
> index 92d6cdf..cadec6a 100644
> --- a/drivers/hid/i2c-hid/i2c-hid.c
> +++ b/drivers/hid/i2c-hid/i2c-hid.c
> @@ -42,9 +42,9 @@
>  #include <linux/i2c/i2c-hid.h>
>  
>  /* flags */
> -#define I2C_HID_STARTED		(1 << 0)
> -#define I2C_HID_RESET_PENDING	(1 << 1)
> -#define I2C_HID_READ_PENDING	(1 << 2)
> +#define I2C_HID_STARTED		0
> +#define I2C_HID_RESET_PENDING	1
> +#define I2C_HID_READ_PENDING	2
>  
>  #define I2C_HID_PWR_ON		0x00
>  #define I2C_HID_PWR_SLEEP	0x01
--
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
Jiri Kosina May 18, 2015, 9:24 a.m. UTC | #2
On Thu, 14 May 2015, Dan Carpenter wrote:

> These defines are used like this:
> 
> 	if (test_bit(I2C_HID_STARTED, &ihid->flags))
> 
> The intent was to use bits 0, 1, and 2 but because of the extra shifts
> we're using bits 1, 2, and 4.  It's harmless becuase it's done
> consistently but it's not the intent and static checkers will complain.
> 
> Fixes: 4a200c3b9a40 ('HID: i2c-hid: introduce HID over i2c specification implementation')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied to for-4.2/upstream, thanks Dan.
diff mbox

Patch

diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 92d6cdf..cadec6a 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -42,9 +42,9 @@ 
 #include <linux/i2c/i2c-hid.h>
 
 /* flags */
-#define I2C_HID_STARTED		(1 << 0)
-#define I2C_HID_RESET_PENDING	(1 << 1)
-#define I2C_HID_READ_PENDING	(1 << 2)
+#define I2C_HID_STARTED		0
+#define I2C_HID_RESET_PENDING	1
+#define I2C_HID_READ_PENDING	2
 
 #define I2C_HID_PWR_ON		0x00
 #define I2C_HID_PWR_SLEEP	0x01