linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] HID: hid-input: Simplify expression and suppress gcc warning
@ 2015-05-27 22:09 James C Boyd
  2015-05-27 22:09 ` [PATCH 1/3] HID: hid-input: Add parentheses to quell " James C Boyd
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: James C Boyd @ 2015-05-27 22:09 UTC (permalink / raw)
  To: jkosina; +Cc: linux-input, linux-kernel

This patch set simplifies and formats an expression
as well as suppress a gcc warning.

James C Boyd (3):
  HID: hid-input: Add parenthesis to suppress gcc warning
  HID: hid-input: Simplified conditional expression
  HID: hid-input: Fix coding style issue

 drivers/hid/hid-input.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
--

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] HID: hid-input: Add parentheses to quell gcc warning
  2015-05-27 22:09 [PATCH 0/3] HID: hid-input: Simplify expression and suppress gcc warning James C Boyd
@ 2015-05-27 22:09 ` James C Boyd
  2015-05-27 22:09 ` [PATCH 2/3] HID: hid-input: Simplify conditional expression James C Boyd
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: James C Boyd @ 2015-05-27 22:09 UTC (permalink / raw)
  To: jkosina; +Cc: linux-input, linux-kernel

GCC reports a -Wlogical-not-parentheses warning here; therefore
add parentheses to shut it up and to express our intent more.

Signed-off-by: James C Boyd <jcboyd.dev@gmail.com>
---
 drivers/hid/hid-input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 008e89b..714b758 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1157,7 +1157,7 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
 		return;
 
 	/* report the usage code as scancode if the key status has changed */
-	if (usage->type == EV_KEY && !!test_bit(usage->code, input->key) != value)
+	if (usage->type == EV_KEY && (!!test_bit(usage->code, input->key)) != value)
 		input_event(input, EV_MSC, MSC_SCAN, usage->hid);
 
 	input_event(input, usage->type, usage->code, value);
--

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] HID: hid-input: Simplify conditional expression
  2015-05-27 22:09 [PATCH 0/3] HID: hid-input: Simplify expression and suppress gcc warning James C Boyd
  2015-05-27 22:09 ` [PATCH 1/3] HID: hid-input: Add parentheses to quell " James C Boyd
@ 2015-05-27 22:09 ` James C Boyd
  2015-05-27 22:09 ` [PATCH 3/3] HID: hid-input: Fix coding style issue James C Boyd
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: James C Boyd @ 2015-05-27 22:09 UTC (permalink / raw)
  To: jkosina; +Cc: linux-input, linux-kernel

There are too many bangs in this conditional; therefore
remove them while still maintaining the same logic.

Signed-off-by: James C Boyd <jcboyd.dev@gmail.com>
---
 drivers/hid/hid-input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 714b758..abf4fc6 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1157,7 +1157,7 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
 		return;
 
 	/* report the usage code as scancode if the key status has changed */
-	if (usage->type == EV_KEY && (!!test_bit(usage->code, input->key)) != value)
+	if (usage->type == EV_KEY && (!test_bit(usage->code, input->key)) == value)
 		input_event(input, EV_MSC, MSC_SCAN, usage->hid);
 
 	input_event(input, usage->type, usage->code, value);
-- 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] HID: hid-input: Fix coding style issue
  2015-05-27 22:09 [PATCH 0/3] HID: hid-input: Simplify expression and suppress gcc warning James C Boyd
  2015-05-27 22:09 ` [PATCH 1/3] HID: hid-input: Add parentheses to quell " James C Boyd
  2015-05-27 22:09 ` [PATCH 2/3] HID: hid-input: Simplify conditional expression James C Boyd
@ 2015-05-27 22:09 ` James C Boyd
  2015-05-28  0:52 ` [PATCH 0/3] HID: hid-input: Simplify expression and suppress gcc warning James C Boyd
  2015-05-28  8:44 ` Jiri Kosina
  4 siblings, 0 replies; 6+ messages in thread
From: James C Boyd @ 2015-05-27 22:09 UTC (permalink / raw)
  To: jkosina; +Cc: linux-input, linux-kernel

This line is too long; split it up.

Signed-off-by: James C Boyd <jcboyd.dev@gmail.com>
---
 drivers/hid/hid-input.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index abf4fc6..3511bbab 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1157,7 +1157,8 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
 		return;
 
 	/* report the usage code as scancode if the key status has changed */
-	if (usage->type == EV_KEY && (!test_bit(usage->code, input->key)) == value)
+	if (usage->type == EV_KEY &&
+	    (!test_bit(usage->code, input->key)) == value)
 		input_event(input, EV_MSC, MSC_SCAN, usage->hid);
 
 	input_event(input, usage->type, usage->code, value);
-- 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] HID: hid-input: Simplify expression and suppress gcc warning
  2015-05-27 22:09 [PATCH 0/3] HID: hid-input: Simplify expression and suppress gcc warning James C Boyd
                   ` (2 preceding siblings ...)
  2015-05-27 22:09 ` [PATCH 3/3] HID: hid-input: Fix coding style issue James C Boyd
@ 2015-05-28  0:52 ` James C Boyd
  2015-05-28  8:44 ` Jiri Kosina
  4 siblings, 0 replies; 6+ messages in thread
From: James C Boyd @ 2015-05-28  0:52 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-kernel, linux-input

On Wed, May 27, 2015 at 07:17:17PM -0500, James C Boyd wrote:
>   HID: hid-input: Add parenthesis to suppress gcc warning

I suppose I should also mention that gcc-5.1 was reporting
this dumb warning. I'll resend the patch set with that detail
mentioned if you'd like.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] HID: hid-input: Simplify expression and suppress gcc warning
  2015-05-27 22:09 [PATCH 0/3] HID: hid-input: Simplify expression and suppress gcc warning James C Boyd
                   ` (3 preceding siblings ...)
  2015-05-28  0:52 ` [PATCH 0/3] HID: hid-input: Simplify expression and suppress gcc warning James C Boyd
@ 2015-05-28  8:44 ` Jiri Kosina
  4 siblings, 0 replies; 6+ messages in thread
From: Jiri Kosina @ 2015-05-28  8:44 UTC (permalink / raw)
  To: James C Boyd; +Cc: linux-input, linux-kernel

On Wed, 27 May 2015, James C Boyd wrote:

> This patch set simplifies and formats an expression
> as well as suppress a gcc warning.

Applied to for-4.2/upstream. Thanks,

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-05-28  8:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-27 22:09 [PATCH 0/3] HID: hid-input: Simplify expression and suppress gcc warning James C Boyd
2015-05-27 22:09 ` [PATCH 1/3] HID: hid-input: Add parentheses to quell " James C Boyd
2015-05-27 22:09 ` [PATCH 2/3] HID: hid-input: Simplify conditional expression James C Boyd
2015-05-27 22:09 ` [PATCH 3/3] HID: hid-input: Fix coding style issue James C Boyd
2015-05-28  0:52 ` [PATCH 0/3] HID: hid-input: Simplify expression and suppress gcc warning James C Boyd
2015-05-28  8:44 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).