From: Tejun Heo <htejun@gmail.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Jeff Garzik <jeff@garzik.org>, linux-ide@vger.kernel.org
Subject: [PATCH] libata: claim legacy SFF ctl ioport in legacy_dr
Date: Fri, 8 Jun 2007 21:30:28 +0900 [thread overview]
Message-ID: <20070608123028.GF29122@htj.dyndns.org> (raw)
In-Reply-To: <4669452B.4030101@gmail.com>
For legacy SFF port, cmd ioport is claimed in legacy_dr while ctl
ioport is claimed using resource-managed pci_request_region(). Move
ctl port claiming into legacy_dr for consistency. This also makes
legacy SFF code easier to use for non-PCI device.
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
ctl ports *were* claimed - this is why my wrong kernel test looked
fine. It was just done in a different place.
Thanks.
drivers/ata/libata-sff.c | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index e35d134..36d5f38 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -712,6 +712,7 @@ int ata_pci_prepare_native_host(struct pci_dev *pdev,
struct ata_legacy_devres {
unsigned int mask;
unsigned long cmd_port[2];
+ unsigned long ctl_port[2];
void __iomem * cmd_addr[2];
void __iomem * ctl_addr[2];
unsigned int irq[2];
@@ -746,6 +747,8 @@ static void ata_legacy_release(struct device *gdev, void *res)
ioport_unmap(this->ctl_addr[i]);
if (this->cmd_port[i])
release_region(this->cmd_port[i], 8);
+ if (this->ctl_port[i])
+ release_region(this->ctl_port[i], 1);
}
}
@@ -764,7 +767,7 @@ static int ata_init_legacy_port(struct ata_port *ap,
ctl_port = ATA_SECONDARY_CTL;
}
- /* request cmd_port */
+ /* request and map cmd/ctl ports */
if (request_region(cmd_port, 8, "libata"))
legacy_dr->cmd_port[port_no] = cmd_port;
else {
@@ -773,15 +776,30 @@ static int ata_init_legacy_port(struct ata_port *ap,
return -EBUSY;
}
- /* iomap cmd and ctl ports */
legacy_dr->cmd_addr[port_no] = ioport_map(cmd_port, 8);
- legacy_dr->ctl_addr[port_no] = ioport_map(ctl_port, 1);
- if (!legacy_dr->cmd_addr[port_no] || !legacy_dr->ctl_addr[port_no]) {
+ if (!legacy_dr->cmd_addr[port_no]) {
dev_printk(KERN_WARNING, host->dev,
- "failed to map cmd/ctl ports\n");
+ "failed to map cmd port\n");
return -ENOMEM;
}
+ if (ctl_port) {
+ if (request_region(ctl_port, 1, "libata"))
+ legacy_dr->ctl_port[port_no] = ctl_port;
+ else {
+ dev_printk(KERN_WARNING, host->dev,
+ "0x%0lX IDE port busy\n", ctl_port);
+ return -EBUSY;
+ }
+
+ legacy_dr->ctl_addr[port_no] = ioport_map(ctl_port, 1);
+ if (!legacy_dr->ctl_addr[port_no]) {
+ dev_printk(KERN_WARNING, host->dev,
+ "failed to map ctl port\n");
+ return -ENOMEM;
+ }
+ }
+
/* init IO addresses */
ap->ioaddr.cmd_addr = legacy_dr->cmd_addr[port_no];
ap->ioaddr.altstatus_addr = legacy_dr->ctl_addr[port_no];
@@ -1029,10 +1047,6 @@ int ata_pci_init_one(struct pci_dev *pdev,
pcim_pin_device(pdev);
if (rc)
goto err_out;
-
- /* request respective PCI regions, may fail */
- rc = pci_request_region(pdev, 1, DRV_NAME);
- rc = pci_request_region(pdev, 3, DRV_NAME);
}
/* init BMDMA, may fail */
next prev parent reply other threads:[~2007-06-08 12:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-04 23:51 legacy libata IDE missing reservation Jeff Garzik
2007-06-08 11:41 ` [PATCH] libata: claim ctl port for legacy SFF ports Tejun Heo
2007-06-08 11:51 ` Alan Cox
2007-06-08 12:01 ` Tejun Heo
2007-06-08 12:30 ` Tejun Heo [this message]
2007-06-08 12:50 ` Alan Cox
2007-06-08 13:55 ` Jeff Garzik
2007-06-08 14:12 ` Tejun Heo
2007-06-08 14:24 ` Jeff Garzik
2007-06-08 15:33 ` Alan Cox
2007-06-08 15:36 ` Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070608123028.GF29122@htj.dyndns.org \
--to=htejun@gmail.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=jeff@garzik.org \
--cc=linux-ide@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.