aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/most
diff options
context:
space:
mode:
authorChristian Gromm <christian.gromm@microchip.com>2018-05-08 11:44:57 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-08 13:41:49 +0200
commitcd2e7148e77d45cad32b8cb18bc55bfa66491181 (patch)
treef14a153fda9a919b6be445608fa10d439b824292 /drivers/staging/most
parentstaging: most: i2c: do not wait in work function (diff)
downloadlinux-dev-cd2e7148e77d45cad32b8cb18bc55bfa66491181.tar.xz
linux-dev-cd2e7148e77d45cad32b8cb18bc55bfa66491181.zip
staging: most: i2c: avoid polling in case of misconfig
This patch prevents the driver from falling back to polling mode in case of IRQ misconfiguration. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/most')
-rw-r--r--drivers/staging/most/i2c/i2c.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/staging/most/i2c/i2c.c b/drivers/staging/most/i2c/i2c.c
index a993e8e7c740..e03cb6c65c88 100644
--- a/drivers/staging/most/i2c/i2c.c
+++ b/drivers/staging/most/i2c/i2c.c
@@ -90,22 +90,24 @@ static int configure_channel(struct most_interface *most_iface,
}
if (channel_config->direction == MOST_CH_RX) {
- dev->polling_mode = polling_req || dev->client->irq <= 0;
+ dev->polling_mode = polling_req;
if (!dev->polling_mode) {
- pr_info("Requesting IRQ: %d\n", dev->client->irq);
+ if (dev->client->irq <= 0) {
+ pr_err("bad irq: %d\n", dev->client->irq);
+ return -ENOENT;
+ }
dev->rx.int_disabled = false;
ret = request_irq(dev->client->irq, most_irq_handler, 0,
dev->client->name, dev);
if (ret) {
- pr_info("IRQ request failed: %d, falling back to polling\n",
- ret);
- dev->polling_mode = true;
+ pr_err("request_irq(%d) failed: %d\n",
+ dev->client->irq, ret);
+ return ret;
}
+ } else if (scan_rate) {
+ pr_info("polling rate is %d Hz\n", scan_rate);
}
}
- if ((channel_config->direction == MOST_CH_RX) && (dev->polling_mode)) {
- pr_info("Using polling at rate: %d times/sec\n", scan_rate);
- }
dev->is_open[ch_idx] = true;
return 0;