diff mbox

HID: rmi: fix some harmless BIT() mistakes

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

Commit Message

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

	if (!(test_bit(RMI_STARTED, &hdata->flags)))

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

Fixes: 9fb6bf02e3ad ('HID: rmi: introduce RMI driver for Synaptics touchpads')
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:16 p.m. UTC | #1
On May 14 2015 or thereabouts, Dan Carpenter wrote:
> These defines are used like this:
> 
> 	if (!(test_bit(RMI_STARTED, &hdata->flags)))
> 
> So the intent was to use bits 0, 1 and 2 but because of the extra BIT()
> shifts we're actually using 1, 2 and 4.  It's harmless because it's done
> consistently but static checkers will complain.
> 
> Fixes: 9fb6bf02e3ad ('HID: rmi: introduce RMI driver for Synaptics touchpads')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Oops. Looks good to me:

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

Cheers,
Benjamin

> 
> diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
> index 368ffdf..2f3e51d 100644
> --- a/drivers/hid/hid-rmi.c
> +++ b/drivers/hid/hid-rmi.c
> @@ -29,9 +29,9 @@
>  #define RMI_SET_RMI_MODE_REPORT_ID	0x0f /* Feature Report */
>  
>  /* flags */
> -#define RMI_READ_REQUEST_PENDING	BIT(0)
> -#define RMI_READ_DATA_PENDING		BIT(1)
> -#define RMI_STARTED			BIT(2)
> +#define RMI_READ_REQUEST_PENDING	0
> +#define RMI_READ_DATA_PENDING		1
> +#define RMI_STARTED			2
>  
>  /* device flags */
>  #define RMI_DEVICE			BIT(0)
--
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(RMI_STARTED, &hdata->flags)))
> 
> So the intent was to use bits 0, 1 and 2 but because of the extra BIT()
> shifts we're actually using 1, 2 and 4.  It's harmless because it's done
> consistently but static checkers will complain.
> 
> Fixes: 9fb6bf02e3ad ('HID: rmi: introduce RMI driver for Synaptics touchpads')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
> index 368ffdf..2f3e51d 100644
> --- a/drivers/hid/hid-rmi.c
> +++ b/drivers/hid/hid-rmi.c
> @@ -29,9 +29,9 @@
>  #define RMI_SET_RMI_MODE_REPORT_ID	0x0f /* Feature Report */
>  
>  /* flags */
> -#define RMI_READ_REQUEST_PENDING	BIT(0)
> -#define RMI_READ_DATA_PENDING		BIT(1)
> -#define RMI_STARTED			BIT(2)
> +#define RMI_READ_REQUEST_PENDING	0
> +#define RMI_READ_DATA_PENDING		1
> +#define RMI_STARTED			2

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

Patch

diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
index 368ffdf..2f3e51d 100644
--- a/drivers/hid/hid-rmi.c
+++ b/drivers/hid/hid-rmi.c
@@ -29,9 +29,9 @@ 
 #define RMI_SET_RMI_MODE_REPORT_ID	0x0f /* Feature Report */
 
 /* flags */
-#define RMI_READ_REQUEST_PENDING	BIT(0)
-#define RMI_READ_DATA_PENDING		BIT(1)
-#define RMI_STARTED			BIT(2)
+#define RMI_READ_REQUEST_PENDING	0
+#define RMI_READ_DATA_PENDING		1
+#define RMI_STARTED			2
 
 /* device flags */
 #define RMI_DEVICE			BIT(0)