[PATCH] Input: synaptics-rmi4 - Make interrupt support in I2C driver optional

From: Guenter Roeck
Date: Sun Oct 02 2016 - 13:36:35 EST


While interrupt support is necessary for the touchscreen to work as input
device, it is sometimes convenient to be able to instantiate the I2C
transport driver without it, for example for testing and for debugging
functionality which does not rely on interrupt support.

Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
---
Applies on top of the previously submitted patch fixing error handling.

drivers/input/rmi4/rmi_i2c.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/input/rmi4/rmi_i2c.c b/drivers/input/rmi4/rmi_i2c.c
index 1ebc2c1debae..c1f5ed0bce0b 100644
--- a/drivers/input/rmi4/rmi_i2c.c
+++ b/drivers/input/rmi4/rmi_i2c.c
@@ -321,9 +321,14 @@ static int rmi_i2c_probe(struct i2c_client *client,
if (retval)
return retval;

- retval = rmi_i2c_init_irq(client);
- if (retval < 0)
- return retval;
+ if (rmi_i2c->irq) {
+ retval = rmi_i2c_init_irq(client);
+ if (retval < 0)
+ return retval;
+ } else {
+ dev_warn(&client->dev,
+ "No interrupt support, touchscreen will not report input events\n");
+ }

dev_info(&client->dev, "registered rmi i2c driver at %#04x.\n",
client->addr);
--
2.5.0