Commit cd2e7148 authored by Christian Gromm's avatar Christian Gromm Committed by Greg Kroah-Hartman

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: default avatarChristian Gromm <christian.gromm@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 795ce218
...@@ -90,21 +90,23 @@ static int configure_channel(struct most_interface *most_iface, ...@@ -90,21 +90,23 @@ static int configure_channel(struct most_interface *most_iface,
} }
if (channel_config->direction == MOST_CH_RX) { 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) { 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; dev->rx.int_disabled = false;
ret = request_irq(dev->client->irq, most_irq_handler, 0, ret = request_irq(dev->client->irq, most_irq_handler, 0,
dev->client->name, dev); dev->client->name, dev);
if (ret) { if (ret) {
pr_info("IRQ request failed: %d, falling back to polling\n", pr_err("request_irq(%d) failed: %d\n",
ret); dev->client->irq, ret);
dev->polling_mode = true; 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; dev->is_open[ch_idx] = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment