Skip to contentSkip to conversation

libata: various alloc/free cleanups

PATCH New Jeff Garzik 1 participant 1 message Jul 8, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libata: various alloc/free cleanups

Just checked this into libata-dev.git#iomap ...

 drivers/scsi/ahci.c        |   12 +-
 drivers/scsi/libata-core.c |  226 ++++++++++++++++++++++-----------------------
 include/linux/libata.h     |    2 
 3 files changed, 120 insertions(+), 120 deletions(-)

commit 64699e30b9bdd3c4b32fdd61d65adbb8891d8e82

Author: Jeff Garzik <[email protected]>
Date:   Sat Jul 8 11:22:52 2006 -0400

[libata] Kill ata_scsi_release(), use ata_host_set_free() in ahci

commit 297e88a5d7b7a02a55d8771c79e60e764862de12

Author: Jeff Garzik <[email protected]>
Date:   Sat Jul 8 11:02:53 2006 -0400

[libata] Move port alloc from ata_port_add() to ata_host_set_alloc()

Continue separating allocation code from registration code.

Also, update ata_host_set_alloc() to return struct ata_host_set* rather than int.

commit 94e4824fbce2546e87b34ff0a9d4c787919a1702

Author: Jeff Garzik <[email protected]>
Date:   Sat Jul 8 10:52:06 2006 -0400

[libata] Kill 'count' var in ata_device_add()

Eliminate redundant loop variable 'count'

commit eef6d8a82efa933bbd03db0f65826ec4525739b7

Author: Jeff Garzik <[email protected]>
Date:   Sat Jul 8 10:47:23 2006 -0400

[libata] Call ata_port_free() from ata_host_set_free()

To make allocation management more sane, call ata_port_free() from ata_host_set_free(), so that the container and contents are freed at the same time.

Call ata_host_set_free() during ata_device_add() error handling, and fix bugs in error handling path.

commit a0a341a99af13fd05576516a4a294faf48050482

Author: Jeff Garzik <[email protected]>
Date:   Sat Jul 8 10:10:20 2006 -0400

[libata] call ata_port_free() where appropriate

Basically s/scsi_host_put/ata_port_free/

commit 2ad961dac0bd74c03cfd5ad9536e6d2ee688fdf9

Author: Jeff Garzik <[email protected]>
Date:   Sat Jul 8 10:06:41 2006 -0400

[libata] manually inline ata_host_remove()

commit a66b87de99c03601ad04633d590e56c8ac2b2777

Author: Jeff Garzik <[email protected]>
Date:   Sat Jul 8 09:59:51 2006 -0400

[libata] break code out into ata_port_{alloc,free}

commit 2e32589afe216c84d630423b2330cf277c415729

Author: Jeff Garzik <[email protected]>
Date:   Sat Jul 8 09:48:00 2006 -0400

[libata] some function renaming

s/ata_host_add/ata_port_add/
s/ata_host_init/ata_port_init/

libata naming got stuck in the middle of a Great Renaming:

ata_host -> ata_port
ata_host_set -> ata_host

To eliminate confusion, let's just give up for now, and simply ensure that things are internally consistent.

commit 971bbe9b2c809b058143e1cb973f9ca4a778a3fa

Author: Jeff Garzik <[email protected]>
Date:   Sat Jul 8 09:44:00 2006 -0400

[libata] Split out code into new helper ata_host_set_alloc()

commit 396109fef236a18274e5bd89896496eddac40898

Author: Jeff Garzik <[email protected]>
Date:   Sat Jul 8 09:31:34 2006 -0400

[libata] Add helper ata_host_set_free()

drivers/scsi/ahci.c +8 -4
index 77e7202..32135f6 100644
@@ -1432,6 +1432,11 @@ static void ahci_remove_one (struct pci_
 	unsigned int i;
 	int have_msi;
 
+	/*
+	 * FIXME: fix code to allow a call to ata_host_set_remove(),
+	 * rather than duplicating much of its code here.
+	 */
+
 	for (i = 0; i < host_set->n_ports; i++)
 		ata_port_detach(host_set->ports[i]);
 
@@ -1440,14 +1445,13 @@ static void ahci_remove_one (struct pci_
 
 	for (i = 0; i < host_set->n_ports; i++) {
 		struct ata_port *ap = host_set->ports[i];
-
-		ata_scsi_release(ap->host);
-		scsi_host_put(ap->host);
+		ata_port_disable(ap);
+		ahci_port_stop(ap);
 	}
 
 	kfree(hpriv);
 	pci_iounmap(pdev, host_set->mmio_base);
-	kfree(host_set);
+	ata_host_set_free(host_set);
 
 	if (have_msi)
 		pci_disable_msi(pdev);
drivers/scsi/libata-core.c +111 -115

366 lines not on this page · raw message

include/linux/libata.h +1 -1
index 6cc497a..925aeca 100644
@@ -683,10 +683,10 @@ #endif /* CONFIG_PCI */
 extern int ata_device_add(const struct ata_probe_ent *ent);
 extern void ata_port_detach(struct ata_port *ap);
 extern void ata_host_set_remove(struct ata_host_set *host_set);
+extern void ata_host_set_free(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 *));
-extern int ata_scsi_release(struct Scsi_Host *host);
 extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
 extern int sata_scr_valid(struct ata_port *ap);
 extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val);