linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: jgarzik@pobox.com, alan@lxorguk.ukuu.org.uk, mlord@pobox.com,
	albertcc@tw.ibm.com, uchang@tw.ibm.com, forrest.zhao@intel.com,
	linux-ide@vger.kernel.org
Cc: Tejun Heo <htejun@gmail.com>
Subject: [PATCH 08/17] libata: update ata_pci_remove_one() using new PCI init helpers
Date: Mon, 7 Aug 2006 12:04:01 +0900	[thread overview]
Message-ID: <1154919841585-git-send-email-htejun@gmail.com> (raw)
In-Reply-To: <1154919839169-git-send-email-htejun@gmail.com>

Update ata_pci_remove_one() using new PCI init helpers.

* drvdata clearing is moved to ata_host_set_detach().

* if (!ops->host_stop) mmio_base is iounmapped.  This makes mmio_base
  release libata-pci's responsibility and will ease following
  host_stop and iomap updates.

* unused ata_host_set_remove() is killed.

Signed-off-by: Tejun Heo <htejun@gmail.com>

---

 drivers/scsi/libata-core.c |   60 ++++++++------------------------------------
 include/linux/libata.h     |    1 -
 2 files changed, 11 insertions(+), 50 deletions(-)

d05753cf46cbd57821b724073778fa0f3aae5680
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index cb22c04..bc326b8 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -5959,6 +5959,8 @@ void ata_host_set_detach(struct ata_host
 
 	for (i = 0; i < host_set->n_ports; i++)
 		ata_port_detach(host_set->ports[i]);
+
+	dev_set_drvdata(host_set->dev, NULL);
 }
 
 /**
@@ -5992,48 +5994,6 @@ void ata_host_set_free(struct ata_host_s
 }
 
 /**
- *	ata_host_set_remove - PCI layer callback for device removal
- *	@host_set: ATA host set that was removed
- *
- *	Unregister all objects associated with this host set. Free those
- *	objects.
- *
- *	LOCKING:
- *	Inherited from calling layer (may sleep).
- */
-void ata_host_set_remove(struct ata_host_set *host_set)
-{
-	unsigned int i;
-
-	ata_host_set_detach(host_set);
-
-	free_irq(host_set->irq, host_set);
-	if (host_set->irq2)
-		free_irq(host_set->irq2, host_set);
-
-	ata_host_set_stop(host_set);
-
-	for (i = 0; i < host_set->n_ports; i++) {
-		struct ata_port *ap = host_set->ports[i];
-
-		if ((ap->flags & ATA_FLAG_NO_LEGACY) == 0) {
-			struct ata_ioports *ioaddr = &ap->ioaddr;
-
-			/* FIXME: Add -ac IDE pci mods to remove these special cases */
-			if (ioaddr->cmd_addr == ATA_PRIMARY_CMD)
-				release_region(ATA_PRIMARY_CMD, 8);
-			else if (ioaddr->cmd_addr == ATA_SECONDARY_CMD)
-				release_region(ATA_SECONDARY_CMD, 8);
-		}
-	}
-
-	if (host_set->ops->host_stop)
-		host_set->ops->host_stop(host_set);
-
-	ata_host_set_free(host_set);
-}
-
-/**
  *	ata_std_ports - initialize ioaddr with standard port offsets.
  *	@ioaddr: IO address structure to be initialized
  *
@@ -6082,17 +6042,20 @@ void ata_pci_host_stop (struct ata_host_
  *	LOCKING:
  *	Inherited from PCI layer (may sleep).
  */
-
-void ata_pci_remove_one (struct pci_dev *pdev)
+void ata_pci_remove_one(struct pci_dev *pdev)
 {
 	struct device *dev = pci_dev_to_dev(pdev);
 	struct ata_host_set *host_set = dev_get_drvdata(dev);
 
-	ata_host_set_remove(host_set);
+	ata_host_set_detach(host_set);
+	ata_host_set_stop(host_set);
+
+	if (host_set->ops->host_stop)
+		host_set->ops->host_stop(host_set);
+	else if (host_set->mmio_base)
+		pci_iounmap(pdev, host_set->mmio_base);
 
-	pci_release_regions(pdev);
-	pci_disable_device(pdev);
-	dev_set_drvdata(dev, NULL);
+	ata_pci_host_set_destroy(host_set);
 }
 
 /* move to PCI subsystem */
@@ -6324,7 +6287,6 @@ EXPORT_SYMBOL_GPL(ata_device_add);
 EXPORT_SYMBOL_GPL(ata_host_set_detach);
 EXPORT_SYMBOL_GPL(ata_host_set_stop);
 EXPORT_SYMBOL_GPL(ata_host_set_free);
-EXPORT_SYMBOL_GPL(ata_host_set_remove);
 EXPORT_SYMBOL_GPL(ata_sg_init);
 EXPORT_SYMBOL_GPL(ata_sg_init_one);
 EXPORT_SYMBOL_GPL(ata_hsm_move);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index ed89959..1fe1b96 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -734,7 +734,6 @@ extern int ata_device_add(const struct a
 extern void ata_host_set_detach(struct ata_host_set *host_set);
 extern void ata_host_set_stop(struct ata_host_set *host_set);
 extern void ata_host_set_free(struct ata_host_set *host_set);
-extern void ata_host_set_remove(struct ata_host_set *host_set);
 extern int ata_scsi_detect(struct scsi_host_template *sht);
 extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
 extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
-- 
1.3.2



  parent reply	other threads:[~2006-08-07  3:04 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-07  3:03 [PATCHSET] libata: implement new initialization model w/ iomap support Tejun Heo
2006-08-07  3:04 ` [PATCH 04/17] libata: implement several LLD init helpers Tejun Heo
2006-08-09  5:01   ` Jeff Garzik
2006-08-09  5:08     ` Tejun Heo
2006-08-07  3:04 ` [PATCH 05/17] libata: implement PCI init helpers for new LLD init model Tejun Heo
2006-08-09  5:11   ` Jeff Garzik
2006-08-09  5:52     ` Tejun Heo
2006-08-09  6:41       ` Jeff Garzik
2006-08-09 11:00         ` Alan Cox
2006-08-10  7:12           ` Albert Lee
2006-08-10  7:27             ` Jeff Garzik
2006-08-10 12:36               ` Alan Cox
2006-08-10 12:22                 ` Tejun Heo
2006-08-09 12:54         ` Mark Lord
2006-08-09 11:02     ` Alan Cox
2006-08-09 11:13       ` Tejun Heo
2006-08-07  3:04 ` [PATCH 01/17] libata: implement ata_host_set_start/stop() Tejun Heo
2006-08-09  4:57   ` Jeff Garzik
2006-08-07  3:04 ` [PATCH 06/17] libata: reimplement ata_pci_init_one() using new init helpers Tejun Heo
2006-08-07  3:04 ` [PATCH 02/17] libata: implement ata_host_set_detach() and ata_host_set_free() Tejun Heo
2006-08-09  4:59   ` Jeff Garzik
2006-08-07  3:04 ` [PATCH 03/17] libata: separate out ata_host_set_alloc() and ata_host_set_attach() Tejun Heo
2006-08-09  5:00   ` Jeff Garzik
2006-08-07  3:04 ` [PATCH 11/17] libata: kill unused ->host_stop() operation and related functions Tejun Heo
2006-08-07  3:04 ` [PATCH 13/17] libata: move ->irq_handler from port_ops to port_info Tejun Heo
2006-08-07  3:04 ` [PATCH 12/17] libata: use LLD name where possible Tejun Heo
2006-08-07  3:04 ` [PATCH 10/17] libata: kill old init helpers Tejun Heo
2006-08-07  3:04 ` [PATCH 09/17] libata: use remove_one() for deinit instead of ->host_stop() Tejun Heo
2006-08-07  3:04 ` Tejun Heo [this message]
2006-08-07  3:04 ` [PATCH 15/17] libata: make ata_pci_acquire_resources() handle iomap Tejun Heo
2006-08-07  3:04 ` [PATCH 14/17] libata: make ata_host_set_alloc() take care of hpriv alloc/free Tejun Heo
2006-08-07  3:04 ` [PATCH 17/17] libata: kill unused ATA_FLAG_MMIO Tejun Heo
2006-08-07  3:08 ` [git-patches] libata: implement new initialization model w/ iomap support Tejun Heo

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=1154919841585-git-send-email-htejun@gmail.com \
    --to=htejun@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=albertcc@tw.ibm.com \
    --cc=forrest.zhao@intel.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=mlord@pobox.com \
    --cc=uchang@tw.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).