[PATCH 1/2] libata: Support PIO polling-only hosts.

Paul Mundt
2007-11-07T08:11:25Z

By default ata_host_activate() expects a valid IRQ in order to
successfully register the host. This patch enables a special case
for registering polling-only hosts that either don't have IRQs
or have buggy IRQ generation (either in terms of handling or
sensing), which otherwise work fine.

Hosts that want to use polling mode can simply set ATA_FLAG_PIO_POLLING
and pass in a NULL IRQ handler or invalid (< 0) IRQ.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>

---

drivers/ata/libata-core.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index ec3ce12..a0cd6bb 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -7178,6 +7178,9 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
* request IRQ and register it. This helper takes necessasry
* arguments and performs the three steps in one go.
*
+ * A NULL @irq_handler or invalid IRQ skips the IRQ registration
+ * and expects the host to have set polling mode on the port.
+ *
* LOCKING:
* Inherited from calling layer (may sleep).
*
@@ -7194,6 +7197,10 @@ int ata_host_activate(struct ata_host *host, int irq,
if (rc)
return rc;

+ /* Special case for polling mode */
+ if (!irq_handler || irq < 0)
+ return ata_host_register(host, sht);
+
rc = devm_request_irq(host->dev, irq, irq_handler, irq_flags,
dev_driver_string(host->dev), host);
if (rc)