summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/ata_generic.c6
-rw-r--r--drivers/ata/ata_piix.c4
-rw-r--r--drivers/ata/libata-core.c1
-rw-r--r--drivers/ata/libata-sff.c162
-rw-r--r--drivers/ata/pata_ali.c32
-rw-r--r--drivers/ata/pata_amd.c9
-rw-r--r--drivers/ata/pata_artop.c25
-rw-r--r--drivers/ata/pata_atiixp.c6
-rw-r--r--drivers/ata/pata_cmd640.c7
-rw-r--r--drivers/ata/pata_cmd64x.c13
-rw-r--r--drivers/ata/pata_cs5530.c10
-rw-r--r--drivers/ata/pata_cs5535.c6
-rw-r--r--drivers/ata/pata_cypress.c6
-rw-r--r--drivers/ata/pata_efar.c6
-rw-r--r--drivers/ata/pata_hpt366.c13
-rw-r--r--drivers/ata/pata_hpt37x.c33
-rw-r--r--drivers/ata/pata_hpt3x2n.c13
-rw-r--r--drivers/ata/pata_hpt3x3.c6
-rw-r--r--drivers/ata/pata_it8213.c8
-rw-r--r--drivers/ata/pata_it821x.c12
-rw-r--r--drivers/ata/pata_jmicron.c6
-rw-r--r--drivers/ata/pata_marvell.c11
-rw-r--r--drivers/ata/pata_netcell.c6
-rw-r--r--drivers/ata/pata_ns87410.c6
-rw-r--r--drivers/ata/pata_oldpiix.c6
-rw-r--r--drivers/ata/pata_opti.c6
-rw-r--r--drivers/ata/pata_optidma.c12
-rw-r--r--drivers/ata/pata_pdc202xx_old.c8
-rw-r--r--drivers/ata/pata_radisys.c6
-rw-r--r--drivers/ata/pata_rz1000.c12
-rw-r--r--drivers/ata/pata_sc1200.c8
-rw-r--r--drivers/ata/pata_serverworks.c15
-rw-r--r--drivers/ata/pata_sil680.c10
-rw-r--r--drivers/ata/pata_sis.c29
-rw-r--r--drivers/ata/pata_sl82c105.c17
-rw-r--r--drivers/ata/pata_triflex.c6
-rw-r--r--drivers/ata/pata_via.c32
-rw-r--r--drivers/ata/sata_nv.c8
-rw-r--r--drivers/ata/sata_sis.c6
-rw-r--r--drivers/ata/sata_uli.c22
-rw-r--r--drivers/ata/sata_via.c2
-rw-r--r--drivers/ata/sis.h2
-rw-r--r--include/linux/libata.h14
43 files changed, 313 insertions, 315 deletions
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c
index 0f19e3223358..c3d753296bc6 100644
--- a/drivers/ata/ata_generic.c
+++ b/drivers/ata/ata_generic.c
@@ -141,7 +141,7 @@ static int all_generic_ide; /* Set to claim all devices */
static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
u16 command;
- static struct ata_port_info info = {
+ static const struct ata_port_info info = {
.sht = &generic_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f,
@@ -149,7 +149,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id
.udma_mask = 0x3f,
.port_ops = &generic_port_ops
};
- static struct ata_port_info *port_info[2] = { &info, &info };
+ const struct ata_port_info *ppi[] = { &info, NULL };
/* Don't use the generic entry unless instructed to do so */
if (id->driver_data == 1 && all_generic_ide == 0)
@@ -175,7 +175,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id
if (dev->vendor == PCI_VENDOR_ID_AL)
ata_pci_clear_simplex(dev);
- return ata_pci_init_one(dev, port_info, 2);
+ return ata_pci_init_one(dev, ppi);
}
static struct pci_device_id ata_generic[] = {
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 4f5a0dc7fb9c..13b6b1df2ac4 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -1030,7 +1030,7 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
static int printed_version;
struct device *dev = &pdev->dev;
struct ata_port_info port_info[2];
- struct ata_port_info *ppinfo[2] = { &port_info[0], &port_info[1] };
+ const struct ata_port_info *ppi[] = { &port_info[0], &port_info[1] };
struct piix_host_priv *hpriv;
unsigned long port_flags;
@@ -1089,7 +1089,7 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
port_info[1].mwdma_mask = 0;
port_info[1].udma_mask = 0;
}
- return ata_pci_init_one(pdev, ppinfo, 2);
+ return ata_pci_init_one(pdev, ppi);
}
static int __init piix_init(void)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index bf8f65b09591..9cff5c506573 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6856,6 +6856,7 @@ EXPORT_SYMBOL_GPL(ata_timing_merge);
#ifdef CONFIG_PCI
EXPORT_SYMBOL_GPL(pci_test_config_bits);
EXPORT_SYMBOL_GPL(ata_pci_init_native_host);
+EXPORT_SYMBOL_GPL(ata_pci_init_bmdma);
EXPORT_SYMBOL_GPL(ata_pci_prepare_native_host);
EXPORT_SYMBOL_GPL(ata_pci_init_one);
EXPORT_SYMBOL_GPL(ata_pci_remove_one);
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index d211db6b35a2..e35d13466c69 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -544,7 +544,7 @@ static int ata_resources_present(struct pci_dev *pdev, int port)
* RETURNS:
* 0 on success, -errno otherwise.
*/
-static int ata_pci_init_bmdma(struct ata_host *host)
+int ata_pci_init_bmdma(struct ata_host *host)
{
struct device *gdev = host->dev;
struct pci_dev *pdev = to_pci_dev(gdev);
@@ -566,7 +566,7 @@ static int ata_pci_init_bmdma(struct ata_host *host)
}
host->iomap = pcim_iomap_table(pdev);
- for (i = 0; i < host->n_ports; i++) {
+ for (i = 0; i < 2; i++) {
struct ata_port *ap = host->ports[i];
void __iomem *bmdma = host->iomap[4] + 8 * i;
@@ -585,54 +585,52 @@ static int ata_pci_init_bmdma(struct ata_host *host)
/**
* ata_pci_init_native_host - acquire native ATA resources and init host
* @host: target ATA host
- * @port_mask: ports to consider
*
- * Acquire native PCI ATA resources for @host and initialize
- * @host accordoingly.
+ * Acquire native PCI ATA resources for @host and initialize the
+ * first two ports of @host accordingly. Ports marked dummy are
+ * skipped and allocation failure makes the port dummy.
*
* LOCKING:
* Inherited from calling layer (may sleep).
*
* RETURNS:
- * 0 on success, -errno otherwise.
+ * 0 if at least one port is initialized, -ENODEV if no port is
+ * available.
*/
-int ata_pci_init_native_host(struct ata_host *host, unsigned int port_mask)
+int ata_pci_init_native_host(struct ata_host *host)
{
struct device *gdev = host->dev;
struct pci_dev *pdev = to_pci_dev(gdev);
+ unsigned int mask = 0;
int i, rc;
- /* Discard disabled ports. Some controllers show their unused
- * channels this way. Disabled ports are made dummy.
- */
- for (i = 0; i < 2; i++) {
- if ((port_mask & (1 << i)) && !ata_resources_present(pdev, i)) {
- host->ports[i]->ops = &ata_dummy_port_ops;
- port_mask &= ~(1 << i);
- }
- }
-
- if (!port_mask) {
- dev_printk(KERN_ERR, gdev, "no available port\n");
- return -ENODEV;
- }
-
/* request, iomap BARs and init port addresses accordingly */
for (i = 0; i < 2; i++) {
struct ata_port *ap = host->ports[i];
int base = i * 2;
void __iomem * const *iomap;
- if (!(port_mask & (1 << i)))
+ if (ata_port_is_dummy(ap))
+ continue;
+
+ /* Discard disabled ports. Some controllers show
+ * their unused channels this way. Disabled ports are
+ * made dummy.
+ */
+ if (!ata_resources_present(pdev, i)) {
+ ap->ops = &ata_dummy_port_ops;
continue;
+ }
rc = pcim_iomap_regions(pdev, 0x3 << base, DRV_NAME);
if (rc) {
- dev_printk(KERN_ERR, gdev, "failed to request/iomap "
- "BARs for port %d (errno=%d)\n", i, rc);
+ dev_printk(KERN_WARNING, gdev,
+ "failed to request/iomap BARs for port %d "
+ "(errno=%d)\n", i, rc);
if (rc == -EBUSY)
pcim_pin_device(pdev);
- return rc;
+ ap->ops = &ata_dummy_port_ops;
+ continue;
}
host->iomap = iomap = pcim_iomap_table(pdev);
@@ -641,6 +639,13 @@ int ata_pci_init_native_host(struct ata_host *host, unsigned int port_mask)
ap->ioaddr.ctl_addr = (void __iomem *)
((unsigned long)iomap[base + 1] | ATA_PCI_CTL_OFS);
ata_std_ports(&ap->ioaddr);
+
+ mask |= 1 << i;
+ }
+
+ if (!mask) {
+ dev_printk(KERN_ERR, gdev, "no available native port\n");
+ return -ENODEV;
}
return 0;
@@ -649,8 +654,7 @@ int ata_pci_init_native_host(struct ata_host *host, unsigned int port_mask)
/**
* ata_pci_prepare_native_host - helper to prepare native PCI ATA host
* @pdev: target PCI device
- * @ppi: array of port_info
- * @n_ports: number of ports to allocate
+ * @ppi: array of port_info, must be enough for two ports
* @r_host: out argument for the initialized ATA host
*
* Helper to allocate ATA host for @pdev, acquire all native PCI
@@ -664,10 +668,9 @@ int ata_pci_init_native_host(struct ata_host *host, unsigned int port_mask)
*/
int ata_pci_prepare_native_host(struct pci_dev *pdev,
const struct ata_port_info * const * ppi,
- int n_ports, struct ata_host **r_host)
+ struct ata_host **r_host)
{
struct ata_host *host;
- unsigned int port_mask;
int rc;
if (!devres_open_group(&pdev->dev, NULL, GFP_KERNEL))
@@ -681,11 +684,7 @@ int ata_pci_prepare_native_host(struct pci_dev *pdev,
goto err_out;
}
- port_mask = ATA_PORT_PRIMARY;
- if (n_ports > 1)
- port_mask |= ATA_PORT_SECONDARY;
-
- rc = ata_pci_init_native_host(host, port_mask);
+ rc = ata_pci_init_native_host(host);
if (rc)
goto err_out;
@@ -777,8 +776,11 @@ static int ata_init_legacy_port(struct ata_port *ap,
/* 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] || !legacy_dr->ctl_addr[port_no]) {
+ dev_printk(KERN_WARNING, host->dev,
+ "failed to map cmd/ctl ports\n");
return -ENOMEM;
+ }
/* init IO addresses */
ap->ioaddr.cmd_addr = legacy_dr->cmd_addr[port_no];
@@ -792,19 +794,20 @@ static int ata_init_legacy_port(struct ata_port *ap,
/**
* ata_init_legacy_host - acquire legacy ATA resources and init ATA host
* @host: target ATA host
- * @legacy_mask: out parameter, mask indicating ports is in legacy mode
* @was_busy: out parameter, indicates whether any port was busy
*
- * Acquire legacy ATA resources for ports.
+ * Acquire legacy ATA resources for the first two ports of @host
+ * and initialize it accordingly. Ports marked dummy are skipped
+ * and resource acquistion failure makes the port dummy.
*
* LOCKING:
* Inherited from calling layer (may sleep).
*
* RETURNS:
- * 0 on success, -errno otherwise.
+ * 0 if at least one port is initialized, -ENODEV if no port is
+ * available.
*/
-static int ata_init_legacy_host(struct ata_host *host,
- unsigned int *legacy_mask, int *was_busy)
+static int ata_init_legacy_host(struct ata_host *host, int *was_busy)
{
struct device *gdev = host->dev;
struct ata_legacy_devres *legacy_dr;
@@ -821,22 +824,23 @@ static int ata_init_legacy_host(struct ata_host *host,
devres_add(gdev, legacy_dr);
for (i = 0; i < 2; i++) {
- *legacy_mask &= ~(1 << i);
+ if (ata_port_is_dummy(host->ports[i]))
+ continue;
+
rc = ata_init_legacy_port(host->ports[i], legacy_dr);
if (rc == 0)
legacy_dr->mask |= 1 << i;
- else if (rc == -EBUSY)
- (*was_busy)++;
- }
-
- if (!legacy_dr->mask)
- return -EBUSY;
-
- for (i = 0; i < 2; i++)
- if (!(legacy_dr->mask & (1 << i)))
+ else {
+ if (rc == -EBUSY)
+ (*was_busy)++;
host->ports[i]->ops = &ata_dummy_port_ops;
+ }
+ }
- *legacy_mask |= legacy_dr->mask;
+ if (!legacy_dr->mask) {
+ dev_printk(KERN_ERR, gdev, "no available legacy port\n");
+ return -ENODEV;
+ }
devres_remove_group(gdev, NULL);
return 0;
@@ -875,7 +879,7 @@ static int ata_request_legacy_irqs(struct ata_host *host,
legacy_dr = devres_find(host->dev, ata_legacy_release, NULL, NULL);
BUG_ON(!legacy_dr);
- for (i = 0; i < host->n_ports; i++) {
+ for (i = 0; i < 2; i++) {
unsigned int irq;
/* FIXME: ATA_*_IRQ() should take generic device not pci_dev */
@@ -923,8 +927,7 @@ static int ata_request_legacy_irqs(struct ata_host *host,
/**
* ata_pci_init_one - Initialize/register PCI IDE host controller
* @pdev: Controller to be initialized
- * @port_info: Information from low-level host driver
- * @n_ports: Number of ports attached to host controller
+ * @ppi: array of port_info, must be enough for two ports
*
* This is a helper function which can be called from a driver's
* xxx_init_one() probe function if the hardware uses traditional
@@ -944,26 +947,34 @@ static int ata_request_legacy_irqs(struct ata_host *host,
* RETURNS:
* Zero on success, negative on errno-based value on error.
*/
-
-int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
- unsigned int n_ports)
+int ata_pci_init_one(struct pci_dev *pdev,
+ const struct ata_port_info * const * ppi)
{
struct device *dev = &pdev->dev;
+ const struct ata_port_info *pi = NULL;
struct ata_host *host = NULL;
- const struct ata_port_info *port[2];
u8 mask;
- unsigned int legacy_mode = 0;
- int rc;
+ int legacy_mode = 0;
+ int i, rc;
DPRINTK("ENTER\n");
- if (!devres_open_group(dev, NULL, GFP_KERNEL))
- return -ENOMEM;
+ /* look up the first valid port_info */
+ for (i = 0; i < 2 && ppi[i]; i++) {
+ if (ppi[i]->port_ops != &ata_dummy_port_ops) {
+ pi = ppi[i];
+ break;
+ }
+ }
- BUG_ON(n_ports < 1 || n_ports > 2);
+ if (!pi) {
+ dev_printk(KERN_ERR, &pdev->dev,
+ "no valid port_info specified\n");
+ return -EINVAL;
+ }
- port[0] = port_info[0];
- port[1] = (n_ports > 1) ? port_info[1] : NULL;
+ if (!devres_open_group(dev, NULL, GFP_KERNEL))
+ return -ENOMEM;
/* FIXME: Really for ATA it isn't safe because the device may be
multi-purpose and we want to leave it alone if it was already
@@ -984,7 +995,7 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8);
mask = (1 << 2) | (1 << 0);
if ((tmp8 & mask) != mask)
- legacy_mode = (1 << 3);
+ legacy_mode = 1;
#if defined(CONFIG_NO_ATA_LEGACY)
/* Some platforms with PCI limits cannot address compat
port space. In that case we punt if their firmware has
@@ -998,7 +1009,7 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
}
/* alloc and init host */
- host = ata_host_alloc_pinfo(dev, port, n_ports);
+ host = ata_host_alloc_pinfo(dev, ppi, 2);
if (!host) {
dev_printk(KERN_ERR, &pdev->dev,
"failed to allocate ATA host\n");
@@ -1007,19 +1018,13 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
}
if (!legacy_mode) {
- unsigned int port_mask;
-
- port_mask = ATA_PORT_PRIMARY;
- if (n_ports > 1)
- port_mask |= ATA_PORT_SECONDARY;
-
- rc = ata_pci_init_native_host(host, port_mask);
+ rc = ata_pci_init_native_host(host);
if (rc)
goto err_out;
} else {
int was_busy = 0;
- rc = ata_init_legacy_host(host, &legacy_mode, &was_busy);
+ rc = ata_init_legacy_host(host, &was_busy);
if (was_busy)
pcim_pin_device(pdev);
if (rc)
@@ -1040,8 +1045,7 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
goto err_out;
if (!legacy_mode)
- rc = devm_request_irq(dev, pdev->irq,
- port_info[0]->port_ops->irq_handler,
+ rc = devm_request_irq(dev, pdev->irq, pi->port_ops->irq_handler,
IRQF_SHARED, DRV_NAME, host);
else {
irq_handler_t handler[2] = { host->ops->irq_handler,
@@ -1055,7 +1059,7 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
goto err_out;
/* register */
- rc = ata_host_register(host, port_info[0]->sht);
+ rc = ata_host_register(host, pi->sht);
if (rc)
goto err_out;
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index 48c7531ae690..3c55a5ff74c7 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -518,14 +518,14 @@ static void ali_init_chipset(struct pci_dev *pdev)
static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
{
- static struct ata_port_info info_early = {
+ static const struct ata_port_info info_early = {
.sht = &ali_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f,
.port_ops = &ali_early_port_ops
};
/* Revision 0x20 added DMA */
- static struct ata_port_info info_20 = {
+ static const struct ata_port_info info_20 = {
.sht = &ali_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48,
.pio_mask = 0x1f,
@@ -533,7 +533,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.port_ops = &ali_20_port_ops
};
/* Revision 0x20 with support logic added UDMA */
- static struct ata_port_info info_20_udma = {
+ static const struct ata_port_info info_20_udma = {
.sht = &ali_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48,
.pio_mask = 0x1f,
@@ -542,7 +542,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.port_ops = &ali_20_port_ops
};
/* Revision 0xC2 adds UDMA66 */
- static struct ata_port_info info_c2 = {
+ static const struct ata_port_info info_c2 = {
.sht = &ali_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48,
.pio_mask = 0x1f,
@@ -551,7 +551,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.port_ops = &ali_c2_port_ops
};
/* Revision 0xC3 is UDMA100 */
- static struct ata_port_info info_c3 = {
+ static const struct ata_port_info info_c3 = {
.sht = &ali_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48,
.pio_mask = 0x1f,
@@ -560,7 +560,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.port_ops = &ali_c2_port_ops
};
/* Revision 0xC4 is UDMA133 */
- static struct ata_port_info info_c4 = {
+ static const struct ata_port_info info_c4 = {
.sht = &ali_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48,
.pio_mask = 0x1f,
@@ -569,7 +569,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.port_ops = &ali_c2_port_ops
};
/* Revision 0xC5 is UDMA133 with LBA48 DMA */
- static struct ata_port_info info_c5 = {
+ static const struct ata_port_info info_c5 = {
.sht = &ali_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f,
@@ -578,7 +578,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.port_ops = &ali_c5_port_ops
};
- static struct ata_port_info *port_info[2];
+ const struct ata_port_info *ppi[] = { NULL, NULL };
u8 rev, tmp;
struct pci_dev *isa_bridge;
@@ -590,17 +590,17 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
*/
if (rev < 0x20) {
- port_info[0] = port_info[1] = &info_early;
+ ppi[0] = &info_early;
} else if (rev < 0xC2) {
- port_info[0] = port_info[1] = &info_20;
+ ppi[0] = &info_20;
} else if (rev == 0xC2) {
- port_info[0] = port_info[1] = &info_c2;
+ ppi[0] = &info_c2;
} else if (rev == 0xC3) {
- port_info[0] = port_info[1] = &info_c3;
+ ppi[0] = &info_c3;
} else if (rev == 0xC4) {
- port_info[0] = port_info[1] = &info_c4;
+ ppi[0] = &info_c4;
} else
- port_info[0] = port_info[1] = &info_c5;
+ ppi[0] = &info_c5;
ali_init_chipset(pdev);
@@ -609,10 +609,10 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
/* Are we paired with a UDMA capable chip */
pci_read_config_byte(isa_bridge, 0x5E, &tmp);
if ((tmp & 0x1E) == 0x12)
- port_info[0] = port_info[1] = &info_20_udma;
+ ppi[0] = &info_20_udma;
pci_dev_put(isa_bridge);
}
- return ata_pci_init_one(pdev, port_info, 2);
+ return ata_pci_init_one(pdev, ppi);
}
#ifdef CONFIG_PM
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c
index 86a26186739c..b439351f1fd3 100644
--- a/drivers/ata/pata_amd.c
+++ b/drivers/ata/pata_amd.c
@@ -538,7 +538,7 @@ static struct ata_port_operations nv133_port_ops = {
static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
{
- static struct ata_port_info info[10] = {
+ static const struct ata_port_info info[10] = {
{ /* 0: AMD 7401 */
.sht = &amd_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
@@ -620,7 +620,7 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.port_ops = &amd100_port_ops
}
};
- static struct ata_port_info *port_info[2];
+ const struct ata_port_info *ppi[] = { NULL, NULL };
static int printed_version;
int type = id->driver_data;
u8 rev;
@@ -652,9 +652,8 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
ata_pci_clear_simplex(pdev);
/* And fire it up */
-
- port_info[0] = port_info[1] = &info[type];
- return ata_pci_init_one(pdev, port_info, 2);
+ ppi[0] = &info[type];
+ return ata_pci_init_one(pdev, ppi);
}
#ifdef CONFIG_PM
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c
index ef51940c3adb..9861059dd673 100644
--- a/drivers/ata/pata_artop.c
+++ b/drivers/ata/pata_artop.c
@@ -414,7 +414,7 @@ static const struct ata_port_operations artop6260_ops = {
static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
{
static int printed_version;
- static struct ata_port_info info_6210 = {
+ static const struct ata_port_info info_6210 = {
.sht = &artop_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, /* pio0-4 */
@@ -422,7 +422,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
.udma_mask = ATA_UDMA2,
.port_ops = &artop6210_ops,
};
- static struct ata_port_info info_626x = {
+ static const struct ata_port_info info_626x = {
.sht = &artop_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, /* pio0-4 */
@@ -430,7 +430,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
.udma_mask = ATA_UDMA4,
.port_ops = &artop6260_ops,
};
- static struct ata_port_info info_626x_fast = {
+ static const struct ata_port_info info_626x_fast = {
.sht = &artop_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, /* pio0-4 */
@@ -438,32 +438,30 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
.udma_mask = ATA_UDMA5,
.port_ops = &artop6260_ops,
};
- struct ata_port_info *port_info[2];
- struct ata_port_info *info = NULL;
- int ports = 2;
+ const struct ata_port_info *ppi[] = { NULL, NULL };
if (!printed_version++)
dev_printk(KERN_DEBUG, &pdev->dev,
"version " DRV_VERSION "\n");
if (id->driver_data == 0) { /* 6210 variant */
- info = &info_6210;
+ ppi[0] = &info_6210;
+ ppi[1] = &ata_dummy_port_info;
/* BIOS may have left us in UDMA, clear it before libata probe */
pci_write_config_byte(pdev, 0x54, 0);
/* For the moment (also lacks dsc) */
printk(KERN_WARNING "ARTOP 6210 requires serialize functionality not yet supported by libata.\n");
printk(KERN_WARNING "Secondary ATA ports will not be activated.\n");
- ports = 1;
}
else if (id->driver_data == 1) /* 6260 */
- info = &info_626x;
+ ppi[0] = &info_626x;
else if (id->driver_data == 2) { /* 6260 or 6260 + fast */
unsigned long io = pci_resource_start(pdev, 4);
u8 reg;
- info = &info_626x;
+ ppi[0] = &info_626x;
if (inb(io) & 0x10)
- info = &info_626x_fast;
+ ppi[0] = &info_626x_fast;
/* Mac systems come up with some registers not set as we
will need them */
@@ -484,10 +482,9 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
}
- BUG_ON(info == NULL);
+ BUG_ON(ppi[0] == NULL);
- port_info[0] = port_info[1] = info;
- return ata_pci_init_one(pdev, port_info, ports);
+ return ata_pci_init_one(pdev, ppi);
}
static const struct pci_device_id artop_pci_tbl[] = {
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c
index 3c2264dbdd67..844914681a2a 100644
--- a/drivers/ata/pata_atiixp.c
+++ b/drivers/ata/pata_atiixp.c
@@ -268,7 +268,7 @@ static struct ata_port_operations atiixp_port_ops = {
static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
- static struct ata_port_info info = {
+ static const struct ata_port_info info = {
.sht = &atiixp_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f,
@@ -276,8 +276,8 @@ static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id)
.udma_mask = 0x3F,
.port_ops = &atiixp_port_ops
};
- static struct ata_port_info *port_info[2] = { &info, &info };
- return ata_pci_init_one(dev, port_info, 2);
+ const struct ata_port_info *ppi[] = { &info, NULL };
+ return ata_pci_init_one(dev, ppi);
}
static const struct pci_device_id atiixp[] = {
diff --git a/drivers/ata/pata_cmd640.c b/drivers/ata/pata_cmd640.c
index 987dec935b5c..ed00fa9d53be 100644
--- a/drivers/ata/pata_cmd640.c
+++ b/drivers/ata/pata_cmd640.c
@@ -249,17 +249,16 @@ static void cmd640_hardware_init(struct pci_dev *pdev)
<