linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: i2c-hid: retrieve the GPIO parameters only when unset
@ 2016-11-21 11:50 Benjamin Tissoires
  2016-11-21 13:28 ` kbuild test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Tissoires @ 2016-11-21 11:50 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-input, linux-kernel

Instead of forcing the level triggers of the IRQ,
we can count on ACPI or OF to set it up for us.

This way, if some vendor decides to not follow the spec, well
we can handle those case (I have been requested this once already).

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

Hi Jiri,

I have been requested this once. I was not sure whether it was doable at the
time, but it actually appears that both ACPI and OF sets the irqflags for us.

So I think it would be good to trust the device description instead of
blindly overwriting it.

Cheers,
Benjamin

 drivers/hid/i2c-hid/i2c-hid.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index ce51879..0630499 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -858,13 +858,16 @@ static struct hid_ll_driver i2c_hid_ll_driver = {
 static int i2c_hid_init_irq(struct i2c_client *client)
 {
 	struct i2c_hid *ihid = i2c_get_clientdata(client);
+	unsigned long irqflags = 0;
 	int ret;
 
 	dev_dbg(&client->dev, "Requesting IRQ: %d\n", client->irq);
 
+	if (!irq_get_trigger_type(client->irq))
+		irqflags = IRQF_TRIGGER_LOW;
+
 	ret = request_threaded_irq(client->irq, NULL, i2c_hid_irq,
-			IRQF_TRIGGER_LOW | IRQF_ONESHOT,
-			client->name, ihid);
+				   irqflags | IRQF_ONESHOT, client->name, ihid);
 	if (ret < 0) {
 		dev_warn(&client->dev,
 			"Could not register for %s interrupt, irq = %d,"
-- 
2.7.4

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

* Re: [PATCH] HID: i2c-hid: retrieve the GPIO parameters only when unset
  2016-11-21 11:50 [PATCH] HID: i2c-hid: retrieve the GPIO parameters only when unset Benjamin Tissoires
@ 2016-11-21 13:28 ` kbuild test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kbuild test robot @ 2016-11-21 13:28 UTC (permalink / raw)
  To: Benjamin Tissoires; +Cc: kbuild-all, Jiri Kosina, linux-input, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1754 bytes --]

Hi Benjamin,

[auto build test ERROR on hid/for-next]
[also build test ERROR on next-20161117]
[cannot apply to v4.9-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Benjamin-Tissoires/HID-i2c-hid-retrieve-the-GPIO-parameters-only-when-unset/20161121-195550
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git for-next
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
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=arm 

All errors (new ones prefixed by >>):

   drivers/hid/i2c-hid/i2c-hid.c: In function 'i2c_hid_init_irq':
>> drivers/hid/i2c-hid/i2c-hid.c:866:7: error: implicit declaration of function 'irq_get_trigger_type' [-Werror=implicit-function-declaration]
     if (!irq_get_trigger_type(client->irq))
          ^~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/irq_get_trigger_type +866 drivers/hid/i2c-hid/i2c-hid.c

   860		struct i2c_hid *ihid = i2c_get_clientdata(client);
   861		unsigned long irqflags = 0;
   862		int ret;
   863	
   864		dev_dbg(&client->dev, "Requesting IRQ: %d\n", client->irq);
   865	
 > 866		if (!irq_get_trigger_type(client->irq))
   867			irqflags = IRQF_TRIGGER_LOW;
   868	
   869		ret = request_threaded_irq(client->irq, NULL, i2c_hid_irq,

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 59453 bytes --]

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

end of thread, other threads:[~2016-11-21 13:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-21 11:50 [PATCH] HID: i2c-hid: retrieve the GPIO parameters only when unset Benjamin Tissoires
2016-11-21 13:28 ` kbuild test robot

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