]> err.no Git - linux-2.6/commitdiff
[libata] init probe_ent->private_data in a common location
authorJeff Garzik <jeff@garzik.org>
Thu, 28 Sep 2006 07:48:18 +0000 (03:48 -0400)
committerJeff Garzik <jeff@garzik.org>
Thu, 28 Sep 2006 07:48:18 +0000 (03:48 -0400)
Don't write the same code twice, in two different functions, when they
both call the same initialization function, with the same private_data
pointer info.

Also, note a bug found with a FIXME.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/ata/libata-core.c
drivers/ata/libata-sff.c

index 396493cc98cec007f0bb95d45f47ac7247e26fdd..72644bdecbb0e63158c60328d83a0cea71313add 100644 (file)
@@ -5785,6 +5785,7 @@ ata_probe_ent_alloc(struct device *dev, const struct ata_port_info *port)
        probe_ent->mwdma_mask = port->mwdma_mask;
        probe_ent->udma_mask = port->udma_mask;
        probe_ent->port_ops = port->port_ops;
+       probe_ent->private_data = port->private_data;
 
        return probe_ent;
 }
index a620e235ccc2ab920a583249640df8f12612c67f..06daaa3736a2cbcd35efde2e377d0ad90cfc5d98 100644 (file)
@@ -828,7 +828,6 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int
 
        probe_ent->irq = pdev->irq;
        probe_ent->irq_flags = IRQF_SHARED;
-       probe_ent->private_data = port[0]->private_data;
 
        if (ports & ATA_PORT_PRIMARY) {
                probe_ent->port[p].cmd_addr = pci_resource_start(pdev, 0);
@@ -878,7 +877,6 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev,
                return NULL;
 
        probe_ent->n_ports = 2;
-       probe_ent->private_data = port[0]->private_data;
 
        if (port_mask & ATA_PORT_PRIMARY) {
                probe_ent->irq = ATA_PRIMARY_IRQ;
@@ -908,6 +906,8 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev,
                                probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
                }
                ata_std_ports(&probe_ent->port[1]);
+
+               /* FIXME: could be pointing to stack area; must copy */
                probe_ent->pinfo2 = port[1];
        } else
                probe_ent->dummy_port_mask |= ATA_PORT_SECONDARY;