libata: clean up SFF init mess

The intention of using port_mask in SFF init helpers was to eventually
support exoctic configurations such as combination of legacy and
native port on the same controller.  This never became actually
necessary and the related code always has been subtly broken one way
or the other.  Now that new init model is in place, there is no reason
to make common helpers capable of handling all corner cases.  Exotic
cases can simply dealt within LLDs as necessary.

This patch removes port_mask handling in SFF init helpers.  SFF init
helpers don't take n_ports argument and interpret it into port_mask
anymore.  All information is carried via port_info.  n_ports argument
is dropped and always two ports are allocated.  LLD can tell SFF to
skip certain port by marking it dummy.  Note that SFF code has been
treating unuvailable ports this way for a long time until recent
breakage fix from Linus and is consistent with how other drivers
handle with unavailable ports.

This fixes 1-port legacy host handling still broken after the recent
native mode fix and simplifies SFF init logic.  The following changes
are made...

* ata_pci_init_native_host() and ata_init_legacy_host() both now try
  to initialized whatever they can and mark failed ports dummy.  They
  return 0 if any port is successfully initialized.

* ata_pci_prepare_native_host() and ata_pci_init_one() now doesn't
  take n_ports argument.  All info should be specified via port_info
  array.  Always two ports are allocated.

* ata_pci_init_bmdma() exported to be used by LLDs in exotic cases.

* port_info handling in all LLDs are standardized - all port_info
  arrays are const stack variable named ppi.  Unless the second port
  is different from the first, its port_info is specified as NULL
  (tells libata that it's identical to the last non-NULL port_info).

* pata_hpt37x/hpt3x2n: don't modify static variable directly.  Make an
  on-stack copy instead as ata_piix does.

* pata_uli: It has 4 ports instead of 2.  Don't use
  ata_pci_prepare_native_host().  Allocate the host explicitly and use
  init helpers.  It's simple enough.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
Tejun Heo 2007-05-04 12:43:58 +02:00 committed by Jeff Garzik
parent 920a4b1038
commit 1626aeb881
43 changed files with 313 additions and 315 deletions

View file

@ -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) static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ {
u16 command; u16 command;
static struct ata_port_info info = { static const struct ata_port_info info = {
.sht = &generic_sht, .sht = &generic_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, .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, .udma_mask = 0x3f,
.port_ops = &generic_port_ops .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 */ /* Don't use the generic entry unless instructed to do so */
if (id->driver_data == 1 && all_generic_ide == 0) 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) if (dev->vendor == PCI_VENDOR_ID_AL)
ata_pci_clear_simplex(dev); 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[] = { static struct pci_device_id ata_generic[] = {

View file

@ -1030,7 +1030,7 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
static int printed_version; static int printed_version;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct ata_port_info port_info[2]; 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; struct piix_host_priv *hpriv;
unsigned long port_flags; 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].mwdma_mask = 0;
port_info[1].udma_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) static int __init piix_init(void)

View file

@ -6856,6 +6856,7 @@ EXPORT_SYMBOL_GPL(ata_timing_merge);
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
EXPORT_SYMBOL_GPL(pci_test_config_bits); EXPORT_SYMBOL_GPL(pci_test_config_bits);
EXPORT_SYMBOL_GPL(ata_pci_init_native_host); 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_prepare_native_host);
EXPORT_SYMBOL_GPL(ata_pci_init_one); EXPORT_SYMBOL_GPL(ata_pci_init_one);
EXPORT_SYMBOL_GPL(ata_pci_remove_one); EXPORT_SYMBOL_GPL(ata_pci_remove_one);

View file

@ -544,7 +544,7 @@ static int ata_resources_present(struct pci_dev *pdev, int port)
* RETURNS: * RETURNS:
* 0 on success, -errno otherwise. * 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 device *gdev = host->dev;
struct pci_dev *pdev = to_pci_dev(gdev); 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); 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]; struct ata_port *ap = host->ports[i];
void __iomem *bmdma = host->iomap[4] + 8 * 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 * ata_pci_init_native_host - acquire native ATA resources and init host
* @host: target ATA host * @host: target ATA host
* @port_mask: ports to consider
* *
* Acquire native PCI ATA resources for @host and initialize * Acquire native PCI ATA resources for @host and initialize the
* @host accordoingly. * first two ports of @host accordingly. Ports marked dummy are
* skipped and allocation failure makes the port dummy.
* *
* LOCKING: * LOCKING:
* Inherited from calling layer (may sleep). * Inherited from calling layer (may sleep).
* *
* RETURNS: * 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 device *gdev = host->dev;
struct pci_dev *pdev = to_pci_dev(gdev); struct pci_dev *pdev = to_pci_dev(gdev);
unsigned int mask = 0;
int i, rc; 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 */ /* request, iomap BARs and init port addresses accordingly */
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
struct ata_port *ap = host->ports[i]; struct ata_port *ap = host->ports[i];
int base = i * 2; int base = i * 2;
void __iomem * const *iomap; void __iomem * const *iomap;
if (!(port_mask & (1 << i))) if (ata_port_is_dummy(ap))
continue; 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); rc = pcim_iomap_regions(pdev, 0x3 << base, DRV_NAME);
if (rc) { if (rc) {
dev_printk(KERN_ERR, gdev, "failed to request/iomap " dev_printk(KERN_WARNING, gdev,
"BARs for port %d (errno=%d)\n", i, rc); "failed to request/iomap BARs for port %d "
"(errno=%d)\n", i, rc);
if (rc == -EBUSY) if (rc == -EBUSY)
pcim_pin_device(pdev); pcim_pin_device(pdev);
return rc; ap->ops = &ata_dummy_port_ops;
continue;
} }
host->iomap = iomap = pcim_iomap_table(pdev); 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 *) ap->ioaddr.ctl_addr = (void __iomem *)
((unsigned long)iomap[base + 1] | ATA_PCI_CTL_OFS); ((unsigned long)iomap[base + 1] | ATA_PCI_CTL_OFS);
ata_std_ports(&ap->ioaddr); ata_std_ports(&ap->ioaddr);
mask |= 1 << i;
}
if (!mask) {
dev_printk(KERN_ERR, gdev, "no available native port\n");
return -ENODEV;
} }
return 0; 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 * ata_pci_prepare_native_host - helper to prepare native PCI ATA host
* @pdev: target PCI device * @pdev: target PCI device
* @ppi: array of port_info * @ppi: array of port_info, must be enough for two ports
* @n_ports: number of ports to allocate
* @r_host: out argument for the initialized ATA host * @r_host: out argument for the initialized ATA host
* *
* Helper to allocate ATA host for @pdev, acquire all native PCI * 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, int ata_pci_prepare_native_host(struct pci_dev *pdev,
const struct ata_port_info * const * ppi, const struct ata_port_info * const * ppi,
int n_ports, struct ata_host **r_host) struct ata_host **r_host)
{ {
struct ata_host *host; struct ata_host *host;
unsigned int port_mask;
int rc; int rc;
if (!devres_open_group(&pdev->dev, NULL, GFP_KERNEL)) 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; goto err_out;
} }
port_mask = ATA_PORT_PRIMARY; rc = ata_pci_init_native_host(host);
if (n_ports > 1)
port_mask |= ATA_PORT_SECONDARY;
rc = ata_pci_init_native_host(host, port_mask);
if (rc) if (rc)
goto err_out; goto err_out;
@ -777,8 +776,11 @@ static int ata_init_legacy_port(struct ata_port *ap,
/* iomap cmd and ctl ports */ /* iomap cmd and ctl ports */
legacy_dr->cmd_addr[port_no] = ioport_map(cmd_port, 8); legacy_dr->cmd_addr[port_no] = ioport_map(cmd_port, 8);
legacy_dr->ctl_addr[port_no] = ioport_map(ctl_port, 1); 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; return -ENOMEM;
}
/* init IO addresses */ /* init IO addresses */
ap->ioaddr.cmd_addr = legacy_dr->cmd_addr[port_no]; 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 * ata_init_legacy_host - acquire legacy ATA resources and init ATA host
* @host: target 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 * @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: * LOCKING:
* Inherited from calling layer (may sleep). * Inherited from calling layer (may sleep).
* *
* RETURNS: * 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, static int ata_init_legacy_host(struct ata_host *host, int *was_busy)
unsigned int *legacy_mask, int *was_busy)
{ {
struct device *gdev = host->dev; struct device *gdev = host->dev;
struct ata_legacy_devres *legacy_dr; 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); devres_add(gdev, legacy_dr);
for (i = 0; i < 2; i++) { 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); rc = ata_init_legacy_port(host->ports[i], legacy_dr);
if (rc == 0) if (rc == 0)
legacy_dr->mask |= 1 << i; legacy_dr->mask |= 1 << i;
else if (rc == -EBUSY) else {
(*was_busy)++; if (rc == -EBUSY)
(*was_busy)++;
host->ports[i]->ops = &ata_dummy_port_ops;
}
} }
if (!legacy_dr->mask) if (!legacy_dr->mask) {
return -EBUSY; dev_printk(KERN_ERR, gdev, "no available legacy port\n");
return -ENODEV;
for (i = 0; i < 2; i++) }
if (!(legacy_dr->mask & (1 << i)))
host->ports[i]->ops = &ata_dummy_port_ops;
*legacy_mask |= legacy_dr->mask;
devres_remove_group(gdev, NULL); devres_remove_group(gdev, NULL);
return 0; 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); legacy_dr = devres_find(host->dev, ata_legacy_release, NULL, NULL);
BUG_ON(!legacy_dr); BUG_ON(!legacy_dr);
for (i = 0; i < host->n_ports; i++) { for (i = 0; i < 2; i++) {
unsigned int irq; unsigned int irq;
/* FIXME: ATA_*_IRQ() should take generic device not pci_dev */ /* 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 * ata_pci_init_one - Initialize/register PCI IDE host controller
* @pdev: Controller to be initialized * @pdev: Controller to be initialized
* @port_info: Information from low-level host driver * @ppi: array of port_info, must be enough for two ports
* @n_ports: Number of ports attached to host controller
* *
* This is a helper function which can be called from a driver's * This is a helper function which can be called from a driver's
* xxx_init_one() probe function if the hardware uses traditional * xxx_init_one() probe function if the hardware uses traditional
@ -944,27 +947,35 @@ static int ata_request_legacy_irqs(struct ata_host *host,
* RETURNS: * RETURNS:
* Zero on success, negative on errno-based value on error. * Zero on success, negative on errno-based value on error.
*/ */
int ata_pci_init_one(struct pci_dev *pdev,
int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, const struct ata_port_info * const * ppi)
unsigned int n_ports)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
const struct ata_port_info *pi = NULL;
struct ata_host *host = NULL; struct ata_host *host = NULL;
const struct ata_port_info *port[2];
u8 mask; u8 mask;
unsigned int legacy_mode = 0; int legacy_mode = 0;
int rc; int i, rc;
DPRINTK("ENTER\n"); DPRINTK("ENTER\n");
/* 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;
}
}
if (!pi) {
dev_printk(KERN_ERR, &pdev->dev,
"no valid port_info specified\n");
return -EINVAL;
}
if (!devres_open_group(dev, NULL, GFP_KERNEL)) if (!devres_open_group(dev, NULL, GFP_KERNEL))
return -ENOMEM; return -ENOMEM;
BUG_ON(n_ports < 1 || n_ports > 2);
port[0] = port_info[0];
port[1] = (n_ports > 1) ? port_info[1] : NULL;
/* FIXME: Really for ATA it isn't safe because the device may be /* 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 multi-purpose and we want to leave it alone if it was already
enabled. Secondly for shared use as Arjan says we want refcounting enabled. Secondly for shared use as Arjan says we want refcounting
@ -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); pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8);
mask = (1 << 2) | (1 << 0); mask = (1 << 2) | (1 << 0);
if ((tmp8 & mask) != mask) if ((tmp8 & mask) != mask)
legacy_mode = (1 << 3); legacy_mode = 1;
#if defined(CONFIG_NO_ATA_LEGACY) #if defined(CONFIG_NO_ATA_LEGACY)
/* Some platforms with PCI limits cannot address compat /* Some platforms with PCI limits cannot address compat
port space. In that case we punt if their firmware has 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 */ /* alloc and init host */
host = ata_host_alloc_pinfo(dev, port, n_ports); host = ata_host_alloc_pinfo(dev, ppi, 2);
if (!host) { if (!host) {
dev_printk(KERN_ERR, &pdev->dev, dev_printk(KERN_ERR, &pdev->dev,
"failed to allocate ATA host\n"); "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) { if (!legacy_mode) {
unsigned int port_mask; rc = ata_pci_init_native_host(host);
port_mask = ATA_PORT_PRIMARY;
if (n_ports > 1)
port_mask |= ATA_PORT_SECONDARY;
rc = ata_pci_init_native_host(host, port_mask);
if (rc) if (rc)
goto err_out; goto err_out;
} else { } else {
int was_busy = 0; 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) if (was_busy)
pcim_pin_device(pdev); pcim_pin_device(pdev);
if (rc) if (rc)
@ -1040,8 +1045,7 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
goto err_out; goto err_out;
if (!legacy_mode) if (!legacy_mode)
rc = devm_request_irq(dev, pdev->irq, rc = devm_request_irq(dev, pdev->irq, pi->port_ops->irq_handler,
port_info[0]->port_ops->irq_handler,
IRQF_SHARED, DRV_NAME, host); IRQF_SHARED, DRV_NAME, host);
else { else {
irq_handler_t handler[2] = { host->ops->irq_handler, 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; goto err_out;
/* register */ /* register */
rc = ata_host_register(host, port_info[0]->sht); rc = ata_host_register(host, pi->sht);
if (rc) if (rc)
goto err_out; goto err_out;

View file

@ -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 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, .sht = &ali_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
.port_ops = &ali_early_port_ops .port_ops = &ali_early_port_ops
}; };
/* Revision 0x20 added DMA */ /* Revision 0x20 added DMA */
static struct ata_port_info info_20 = { static const struct ata_port_info info_20 = {
.sht = &ali_sht, .sht = &ali_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48,
.pio_mask = 0x1f, .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 .port_ops = &ali_20_port_ops
}; };
/* Revision 0x20 with support logic added UDMA */ /* 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, .sht = &ali_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48,
.pio_mask = 0x1f, .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 .port_ops = &ali_20_port_ops
}; };
/* Revision 0xC2 adds UDMA66 */ /* Revision 0xC2 adds UDMA66 */
static struct ata_port_info info_c2 = { static const struct ata_port_info info_c2 = {
.sht = &ali_sht, .sht = &ali_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48,
.pio_mask = 0x1f, .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 .port_ops = &ali_c2_port_ops
}; };
/* Revision 0xC3 is UDMA100 */ /* Revision 0xC3 is UDMA100 */
static struct ata_port_info info_c3 = { static const struct ata_port_info info_c3 = {
.sht = &ali_sht, .sht = &ali_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48,
.pio_mask = 0x1f, .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 .port_ops = &ali_c2_port_ops
}; };
/* Revision 0xC4 is UDMA133 */ /* Revision 0xC4 is UDMA133 */
static struct ata_port_info info_c4 = { static const struct ata_port_info info_c4 = {
.sht = &ali_sht, .sht = &ali_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48,
.pio_mask = 0x1f, .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 .port_ops = &ali_c2_port_ops
}; };
/* Revision 0xC5 is UDMA133 with LBA48 DMA */ /* 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, .sht = &ali_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, .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 .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; u8 rev, tmp;
struct pci_dev *isa_bridge; 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) { if (rev < 0x20) {
port_info[0] = port_info[1] = &info_early; ppi[0] = &info_early;
} else if (rev < 0xC2) { } else if (rev < 0xC2) {
port_info[0] = port_info[1] = &info_20; ppi[0] = &info_20;
} else if (rev == 0xC2) { } else if (rev == 0xC2) {
port_info[0] = port_info[1] = &info_c2; ppi[0] = &info_c2;
} else if (rev == 0xC3) { } else if (rev == 0xC3) {
port_info[0] = port_info[1] = &info_c3; ppi[0] = &info_c3;
} else if (rev == 0xC4) { } else if (rev == 0xC4) {
port_info[0] = port_info[1] = &info_c4; ppi[0] = &info_c4;
} else } else
port_info[0] = port_info[1] = &info_c5; ppi[0] = &info_c5;
ali_init_chipset(pdev); 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 */ /* Are we paired with a UDMA capable chip */
pci_read_config_byte(isa_bridge, 0x5E, &tmp); pci_read_config_byte(isa_bridge, 0x5E, &tmp);
if ((tmp & 0x1E) == 0x12) if ((tmp & 0x1E) == 0x12)
port_info[0] = port_info[1] = &info_20_udma; ppi[0] = &info_20_udma;
pci_dev_put(isa_bridge); pci_dev_put(isa_bridge);
} }
return ata_pci_init_one(pdev, port_info, 2); return ata_pci_init_one(pdev, ppi);
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM

View file

@ -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 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 */ { /* 0: AMD 7401 */
.sht = &amd_sht, .sht = &amd_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .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 .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; static int printed_version;
int type = id->driver_data; int type = id->driver_data;
u8 rev; 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); ata_pci_clear_simplex(pdev);
/* And fire it up */ /* And fire it up */
ppi[0] = &info[type];
port_info[0] = port_info[1] = &info[type]; return ata_pci_init_one(pdev, ppi);
return ata_pci_init_one(pdev, port_info, 2);
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM

View file

@ -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 artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
{ {
static int printed_version; static int printed_version;
static struct ata_port_info info_6210 = { static const struct ata_port_info info_6210 = {
.sht = &artop_sht, .sht = &artop_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, /* pio0-4 */ .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, .udma_mask = ATA_UDMA2,
.port_ops = &artop6210_ops, .port_ops = &artop6210_ops,
}; };
static struct ata_port_info info_626x = { static const struct ata_port_info info_626x = {
.sht = &artop_sht, .sht = &artop_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, /* pio0-4 */ .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, .udma_mask = ATA_UDMA4,
.port_ops = &artop6260_ops, .port_ops = &artop6260_ops,
}; };
static struct ata_port_info info_626x_fast = { static const struct ata_port_info info_626x_fast = {
.sht = &artop_sht, .sht = &artop_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, /* pio0-4 */ .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, .udma_mask = ATA_UDMA5,
.port_ops = &artop6260_ops, .port_ops = &artop6260_ops,
}; };
struct ata_port_info *port_info[2]; const struct ata_port_info *ppi[] = { NULL, NULL };
struct ata_port_info *info = NULL;
int ports = 2;
if (!printed_version++) if (!printed_version++)
dev_printk(KERN_DEBUG, &pdev->dev, dev_printk(KERN_DEBUG, &pdev->dev,
"version " DRV_VERSION "\n"); "version " DRV_VERSION "\n");
if (id->driver_data == 0) { /* 6210 variant */ 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 */ /* BIOS may have left us in UDMA, clear it before libata probe */
pci_write_config_byte(pdev, 0x54, 0); pci_write_config_byte(pdev, 0x54, 0);
/* For the moment (also lacks dsc) */ /* For the moment (also lacks dsc) */
printk(KERN_WARNING "ARTOP 6210 requires serialize functionality not yet supported by libata.\n"); 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"); printk(KERN_WARNING "Secondary ATA ports will not be activated.\n");
ports = 1;
} }
else if (id->driver_data == 1) /* 6260 */ else if (id->driver_data == 1) /* 6260 */
info = &info_626x; ppi[0] = &info_626x;
else if (id->driver_data == 2) { /* 6260 or 6260 + fast */ else if (id->driver_data == 2) { /* 6260 or 6260 + fast */
unsigned long io = pci_resource_start(pdev, 4); unsigned long io = pci_resource_start(pdev, 4);
u8 reg; u8 reg;
info = &info_626x; ppi[0] = &info_626x;
if (inb(io) & 0x10) if (inb(io) & 0x10)
info = &info_626x_fast; ppi[0] = &info_626x_fast;
/* Mac systems come up with some registers not set as we /* Mac systems come up with some registers not set as we
will need them */ 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, ppi);
return ata_pci_init_one(pdev, port_info, ports);
} }
static const struct pci_device_id artop_pci_tbl[] = { static const struct pci_device_id artop_pci_tbl[] = {

View file

@ -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 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, .sht = &atiixp_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, .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, .udma_mask = 0x3F,
.port_ops = &atiixp_port_ops .port_ops = &atiixp_port_ops
}; };
static struct ata_port_info *port_info[2] = { &info, &info }; const struct ata_port_info *ppi[] = { &info, NULL };
return ata_pci_init_one(dev, port_info, 2); return ata_pci_init_one(dev, ppi);
} }
static const struct pci_device_id atiixp[] = { static const struct pci_device_id atiixp[] = {

View file

@ -249,17 +249,16 @@ static void cmd640_hardware_init(struct pci_dev *pdev)
static int cmd640_init_one(struct pci_dev *pdev, const struct pci_device_id *id) static int cmd640_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
{ {
static struct ata_port_info info = { static const struct ata_port_info info = {
.sht = &cmd640_sht, .sht = &cmd640_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
.port_ops = &cmd640_port_ops .port_ops = &cmd640_port_ops
}; };
const struct ata_port_info *ppi[] = { &info, NULL };
static struct ata_port_info *port_info[2] = { &info, &info };
cmd640_hardware_init(pdev); cmd640_hardware_init(pdev);
return ata_pci_init_one(pdev, port_info, 2); return ata_pci_init_one(pdev, ppi);
} }
static int cmd640_reinit_one(struct pci_dev *pdev) static int cmd640_reinit_one(struct pci_dev *pdev)

View file

@ -377,7 +377,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
{ {
u32 class_rev; u32 class_rev;
static struct ata_port_info cmd_info[6] = { static const struct ata_port_info cmd_info[6] = {
{ /* CMD 643 - no UDMA */ { /* CMD 643 - no UDMA */
.sht = &cmd64x_sht, .sht = &cmd64x_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
@ -424,11 +424,9 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.port_ops = &cmd648_port_ops .port_ops = &cmd648_port_ops
} }
}; };
static struct ata_port_info *port_info[2], *info; const struct ata_port_info *ppi[] = { &cmd_info[id->driver_data], NULL };
u8 mrdmode; u8 mrdmode;
info = &cmd_info[id->driver_data];
pci_read_config_dword(pdev, PCI_CLASS_REVISION, &class_rev); pci_read_config_dword(pdev, PCI_CLASS_REVISION, &class_rev);
class_rev &= 0xFF; class_rev &= 0xFF;
@ -438,10 +436,10 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
if (pdev->device == PCI_DEVICE_ID_CMD_646) { if (pdev->device == PCI_DEVICE_ID_CMD_646) {
/* Does UDMA work ? */ /* Does UDMA work ? */
if (class_rev > 4) if (class_rev > 4)
info = &cmd_info[2]; ppi[0] = &cmd_info[2];
/* Early rev with other problems ? */ /* Early rev with other problems ? */
else if (class_rev == 1) else if (class_rev == 1)
info = &cmd_info[3]; ppi[0] = &cmd_info[3];
} }
pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 64); pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 64);
@ -457,8 +455,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
pci_write_config_byte(pdev, UDIDETCR0, 0xF0); pci_write_config_byte(pdev, UDIDETCR0, 0xF0);
#endif #endif
port_info[0] = port_info[1] = info; return ata_pci_init_one(pdev, ppi);
return ata_pci_init_one(pdev, port_info, 2);
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM

View file

@ -335,7 +335,7 @@ static int cs5530_init_chip(void)
static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id) static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
{ {
static struct ata_port_info info = { static const struct ata_port_info info = {
.sht = &cs5530_sht, .sht = &cs5530_sht,
.flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -344,23 +344,23 @@ static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.port_ops = &cs5530_port_ops .port_ops = &cs5530_port_ops
}; };
/* The docking connector doesn't do UDMA, and it seems not MWDMA */ /* The docking connector doesn't do UDMA, and it seems not MWDMA */
static struct ata_port_info info_palmax_secondary = { static const struct ata_port_info info_palmax_secondary = {
.sht = &cs5530_sht, .sht = &cs5530_sht,
.flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
.port_ops = &cs5530_port_ops .port_ops = &cs5530_port_ops
}; };
static struct ata_port_info *port_info[2] = { &info, &info }; const struct ata_port_info *ppi[] = { &info, NULL };
/* Chip initialisation */ /* Chip initialisation */
if (cs5530_init_chip()) if (cs5530_init_chip())
return -ENODEV; return -ENODEV;
if (cs5530_is_palmax()) if (cs5530_is_palmax())
port_info[1] = &info_palmax_secondary; ppi[1] = &info_palmax_secondary;
/* Now kick off ATA set up */ /* Now kick off ATA set up */
return ata_pci_init_one(pdev, port_info, 2); return ata_pci_init_one(pdev, ppi);
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM

View file

@ -223,7 +223,7 @@ static struct ata_port_operations cs5535_port_ops = {
static int cs5535_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int cs5535_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 = &cs5535_sht, .sht = &cs5535_sht,
.flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -231,7 +231,7 @@ static int cs5535_init_one(struct pci_dev *dev, const struct pci_device_id *id)
.udma_mask = 0x1f, .udma_mask = 0x1f,
.port_ops = &cs5535_port_ops .port_ops = &cs5535_port_ops
}; };
struct ata_port_info *ports[1] = { &info }; const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info };
u32 timings, dummy; u32 timings, dummy;
@ -243,7 +243,7 @@ static int cs5535_init_one(struct pci_dev *dev, const struct pci_device_id *id)
rdmsr(ATAC_CH0D1_PIO, timings, dummy); rdmsr(ATAC_CH0D1_PIO, timings, dummy);
if (CS5535_BAD_PIO(timings)) if (CS5535_BAD_PIO(timings))
wrmsr(ATAC_CH0D1_PIO, 0xF7F4F7F4UL, 0); wrmsr(ATAC_CH0D1_PIO, 0xF7F4F7F4UL, 0);
return ata_pci_init_one(dev, ports, 1); return ata_pci_init_one(dev, ppi);
} }
static const struct pci_device_id cs5535[] = { static const struct pci_device_id cs5535[] = {

View file

@ -165,14 +165,14 @@ static struct ata_port_operations cy82c693_port_ops = {
static int cy82c693_init_one(struct pci_dev *pdev, const struct pci_device_id *id) static int cy82c693_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
{ {
static struct ata_port_info info = { static const struct ata_port_info info = {
.sht = &cy82c693_sht, .sht = &cy82c693_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
.mwdma_mask = 0x07, .mwdma_mask = 0x07,
.port_ops = &cy82c693_port_ops .port_ops = &cy82c693_port_ops
}; };
static struct ata_port_info *port_info[1] = { &info }; const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info };
/* Devfn 1 is the ATA primary. The secondary is magic and on devfn2. /* Devfn 1 is the ATA primary. The secondary is magic and on devfn2.
For the moment we don't handle the secondary. FIXME */ For the moment we don't handle the secondary. FIXME */
@ -180,7 +180,7 @@ static int cy82c693_init_one(struct pci_dev *pdev, const struct pci_device_id *i
if (PCI_FUNC(pdev->devfn) != 1) if (PCI_FUNC(pdev->devfn) != 1)
return -ENODEV; return -ENODEV;
return ata_pci_init_one(pdev, port_info, 1); return ata_pci_init_one(pdev, ppi);
} }
static const struct pci_device_id cy82c693[] = { static const struct pci_device_id cy82c693[] = {

View file

@ -301,7 +301,7 @@ static const struct ata_port_operations efar_ops = {
static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
static int printed_version; static int printed_version;
static struct ata_port_info info = { static const struct ata_port_info info = {
.sht = &efar_sht, .sht = &efar_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, /* pio0-4 */ .pio_mask = 0x1f, /* pio0-4 */
@ -309,13 +309,13 @@ static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
.udma_mask = 0x0f, /* UDMA 66 */ .udma_mask = 0x0f, /* UDMA 66 */
.port_ops = &efar_ops, .port_ops = &efar_ops,
}; };
static struct ata_port_info *port_info[2] = { &info, &info }; const struct ata_port_info *ppi[] = { &info, NULL };
if (!printed_version++) if (!printed_version++)
dev_printk(KERN_DEBUG, &pdev->dev, dev_printk(KERN_DEBUG, &pdev->dev,
"version " DRV_VERSION "\n"); "version " DRV_VERSION "\n");
return ata_pci_init_one(pdev, port_info, 2); return ata_pci_init_one(pdev, ppi);
} }
static const struct pci_device_id efar_pci_tbl[] = { static const struct pci_device_id efar_pci_tbl[] = {

View file

@ -417,7 +417,7 @@ static void hpt36x_init_chipset(struct pci_dev *dev)
static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ {
static struct ata_port_info info_hpt366 = { static const struct ata_port_info info_hpt366 = {
.sht = &hpt36x_sht, .sht = &hpt36x_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -425,7 +425,8 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
.udma_mask = 0x1f, .udma_mask = 0x1f,
.port_ops = &hpt366_port_ops .port_ops = &hpt366_port_ops
}; };
struct ata_port_info *port_info[2] = {&info_hpt366, &info_hpt366}; struct ata_port_info info = info_hpt366;
const struct ata_port_info *ppi[] = { &info, NULL };
u32 class_rev; u32 class_rev;
u32 reg1; u32 reg1;
@ -446,17 +447,17 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
/* info_hpt366 is safe against re-entry so we can scribble on it */ /* info_hpt366 is safe against re-entry so we can scribble on it */
switch((reg1 & 0x700) >> 8) { switch((reg1 & 0x700) >> 8) {
case 5: case 5:
info_hpt366.private_data = &hpt366_40; info.private_data = &hpt366_40;
break; break;
case 9: case 9:
info_hpt366.private_data = &hpt366_25; info.private_data = &hpt366_25;
break; break;
default: default:
info_hpt366.private_data = &hpt366_33; info.private_data = &hpt366_33;
break; break;
} }
/* Now kick off ATA set up */ /* Now kick off ATA set up */
return ata_pci_init_one(dev, port_info, 2); return ata_pci_init_one(dev, ppi);
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM

View file

@ -887,7 +887,7 @@ static int hpt37x_calibrate_dpll(struct pci_dev *dev)
static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ {
/* HPT370 - UDMA100 */ /* HPT370 - UDMA100 */
static struct ata_port_info info_hpt370 = { static const struct ata_port_info info_hpt370 = {
.sht = &hpt37x_sht, .sht = &hpt37x_sht,
.flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -896,7 +896,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
.port_ops = &hpt370_port_ops .port_ops = &hpt370_port_ops
}; };
/* HPT370A - UDMA100 */ /* HPT370A - UDMA100 */
static struct ata_port_info info_hpt370a = { static const struct ata_port_info info_hpt370a = {
.sht = &hpt37x_sht, .sht = &hpt37x_sht,
.flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -905,7 +905,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
.port_ops = &hpt370a_port_ops .port_ops = &hpt370a_port_ops
}; };
/* HPT370 - UDMA100 */ /* HPT370 - UDMA100 */
static struct ata_port_info info_hpt370_33 = { static const struct ata_port_info info_hpt370_33 = {
.sht = &hpt37x_sht, .sht = &hpt37x_sht,
.flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -914,7 +914,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
.port_ops = &hpt370_port_ops .port_ops = &hpt370_port_ops
}; };
/* HPT370A - UDMA100 */ /* HPT370A - UDMA100 */
static struct ata_port_info info_hpt370a_33 = { static const struct ata_port_info info_hpt370a_33 = {
.sht = &hpt37x_sht, .sht = &hpt37x_sht,
.flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -923,7 +923,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
.port_ops = &hpt370a_port_ops .port_ops = &hpt370a_port_ops
}; };
/* HPT371, 372 and friends - UDMA133 */ /* HPT371, 372 and friends - UDMA133 */
static struct ata_port_info info_hpt372 = { static const struct ata_port_info info_hpt372 = {
.sht = &hpt37x_sht, .sht = &hpt37x_sht,
.flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -932,7 +932,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
.port_ops = &hpt372_port_ops .port_ops = &hpt372_port_ops
}; };
/* HPT371, 372 and friends - UDMA100 at 50MHz clock */ /* HPT371, 372 and friends - UDMA100 at 50MHz clock */
static struct ata_port_info info_hpt372_50 = { static const struct ata_port_info info_hpt372_50 = {
.sht = &hpt37x_sht, .sht = &hpt37x_sht,
.flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -941,7 +941,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
.port_ops = &hpt372_port_ops .port_ops = &hpt372_port_ops
}; };
/* HPT374 - UDMA133 */ /* HPT374 - UDMA133 */
static struct ata_port_info info_hpt374 = { static const struct ata_port_info info_hpt374 = {
.sht = &hpt37x_sht, .sht = &hpt37x_sht,
.flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -951,9 +951,10 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
}; };
static const int MHz[4] = { 33, 40, 50, 66 }; static const int MHz[4] = { 33, 40, 50, 66 };
const struct ata_port_info *port;
struct ata_port_info *port_info[2]; void *private_data = NULL;
struct ata_port_info *port; struct ata_port_info port_info;
const struct ata_port_info *ppi[] = { &port_info, NULL };
u8 irqmask; u8 irqmask;
u32 class_rev; u32 class_rev;
@ -1124,13 +1125,13 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
return -ENODEV; return -ENODEV;
} }
if (clock_slot == 3) if (clock_slot == 3)
port->private_data = (void *)hpt37x_timings_66; private_data = (void *)hpt37x_timings_66;
else else
port->private_data = (void *)hpt37x_timings_50; private_data = (void *)hpt37x_timings_50;
printk(KERN_INFO "hpt37x: Bus clock %dMHz, using DPLL.\n", MHz[clock_slot]); printk(KERN_INFO "hpt37x: Bus clock %dMHz, using DPLL.\n", MHz[clock_slot]);
} else { } else {
port->private_data = (void *)chip_table->clocks[clock_slot]; private_data = (void *)chip_table->clocks[clock_slot];
/* /*
* Perform a final fixup. Note that we will have used the * Perform a final fixup. Note that we will have used the
* DPLL on the HPT372 which means we don't have to worry * DPLL on the HPT372 which means we don't have to worry
@ -1144,9 +1145,11 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
printk(KERN_INFO "hpt37x: %s: Bus clock %dMHz.\n", chip_table->name, MHz[clock_slot]); printk(KERN_INFO "hpt37x: %s: Bus clock %dMHz.\n", chip_table->name, MHz[clock_slot]);
} }
port_info[0] = port_info[1] = port;
/* Now kick off ATA set up */ /* Now kick off ATA set up */
return ata_pci_init_one(dev, port_info, 2); port_info = *port;
port_info.private_data = private_data;
return ata_pci_init_one(dev, ppi);
} }
static const struct pci_device_id hpt37x[] = { static const struct pci_device_id hpt37x[] = {

View file

@ -488,7 +488,7 @@ static int hpt3x2n_pci_clock(struct pci_dev *pdev)
static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ {
/* HPT372N and friends - UDMA133 */ /* HPT372N and friends - UDMA133 */
static struct ata_port_info info = { static const struct ata_port_info info = {
.sht = &hpt3x2n_sht, .sht = &hpt3x2n_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -496,8 +496,8 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
.udma_mask = 0x7f, .udma_mask = 0x7f,
.port_ops = &hpt3x2n_port_ops .port_ops = &hpt3x2n_port_ops
}; };
struct ata_port_info *port_info[2]; struct ata_port_info port = info;
struct ata_port_info *port = &info; const struct ata_port_info *ppi[] = { &port, NULL };
u8 irqmask; u8 irqmask;
u32 class_rev; u32 class_rev;
@ -585,9 +585,9 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
/* Set our private data up. We only need a few flags so we use /* Set our private data up. We only need a few flags so we use
it directly */ it directly */
port->private_data = NULL; port.private_data = NULL;
if (pci_mhz > 60) { if (pci_mhz > 60) {
port->private_data = (void *)PCI66; port.private_data = (void *)PCI66;
/* /*
* On HPT371N, if ATA clock is 66 MHz we must set bit 2 in * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in
* the MISC. register to stretch the UltraDMA Tss timing. * the MISC. register to stretch the UltraDMA Tss timing.
@ -598,8 +598,7 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
} }
/* Now kick off ATA set up */ /* Now kick off ATA set up */
port_info[0] = port_info[1] = port; return ata_pci_init_one(dev, ppi);
return ata_pci_init_one(dev, port_info, 2);
} }
static const struct pci_device_id hpt3x2n[] = { static const struct pci_device_id hpt3x2n[] = {

View file

@ -171,7 +171,7 @@ static void hpt3x3_init_chipset(struct pci_dev *dev)
static int hpt3x3_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int hpt3x3_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 = &hpt3x3_sht, .sht = &hpt3x3_sht,
.flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -179,11 +179,11 @@ static int hpt3x3_init_one(struct pci_dev *dev, const struct pci_device_id *id)
.udma_mask = 0x07, .udma_mask = 0x07,
.port_ops = &hpt3x3_port_ops .port_ops = &hpt3x3_port_ops
}; };
static struct ata_port_info *port_info[2] = { &info, &info }; const struct ata_port_info *ppi[] = { &info, NULL };
hpt3x3_init_chipset(dev); hpt3x3_init_chipset(dev);
/* Now kick off ATA set up */ /* Now kick off ATA set up */
return ata_pci_init_one(dev, port_info, 2); return ata_pci_init_one(dev, ppi);
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM

View file

@ -311,7 +311,7 @@ static const struct ata_port_operations it8213_ops = {
static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
static int printed_version; static int printed_version;
static struct ata_port_info info = { static const struct ata_port_info info = {
.sht = &it8213_sht, .sht = &it8213_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, /* pio0-4 */ .pio_mask = 0x1f, /* pio0-4 */
@ -319,14 +319,14 @@ static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *en
.udma_mask = 0x1f, /* UDMA 100 */ .udma_mask = 0x1f, /* UDMA 100 */
.port_ops = &it8213_ops, .port_ops = &it8213_ops,
}; };
static struct ata_port_info *port_info[2] = { &info, &info }; /* Current IT8213 stuff is single port */
const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info };
if (!printed_version++) if (!printed_version++)
dev_printk(KERN_DEBUG, &pdev->dev, dev_printk(KERN_DEBUG, &pdev->dev,
"version " DRV_VERSION "\n"); "version " DRV_VERSION "\n");
/* Current IT8213 stuff is single port */ return ata_pci_init_one(pdev, ppi);
return ata_pci_init_one(pdev, port_info, 1);
} }
static const struct pci_device_id it8213_pci_tbl[] = { static const struct pci_device_id it8213_pci_tbl[] = {

View file

@ -718,14 +718,14 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
{ {
u8 conf; u8 conf;
static struct ata_port_info info_smart = { static const struct ata_port_info info_smart = {
.sht = &it821x_sht, .sht = &it821x_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
.mwdma_mask = 0x07, .mwdma_mask = 0x07,
.port_ops = &it821x_smart_port_ops .port_ops = &it821x_smart_port_ops
}; };
static struct ata_port_info info_passthru = { static const struct ata_port_info info_passthru = {
.sht = &it821x_sht, .sht = &it821x_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -733,8 +733,8 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.udma_mask = 0x7f, .udma_mask = 0x7f,
.port_ops = &it821x_passthru_port_ops .port_ops = &it821x_passthru_port_ops
}; };
static struct ata_port_info *port_info[2];
const struct ata_port_info *ppi[] = { NULL, NULL };
static char *mode[2] = { "pass through", "smart" }; static char *mode[2] = { "pass through", "smart" };
/* Force the card into bypass mode if so requested */ /* Force the card into bypass mode if so requested */
@ -747,11 +747,11 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
printk(KERN_INFO DRV_NAME ": controller in %s mode.\n", mode[conf]); printk(KERN_INFO DRV_NAME ": controller in %s mode.\n", mode[conf]);
if (conf == 0) if (conf == 0)
port_info[0] = port_info[1] = &info_passthru; ppi[0] = &info_passthru;
else else
port_info[0] = port_info[1] = &info_smart; ppi[0] = &info_smart;
return ata_pci_init_one(pdev, port_info, 2); return ata_pci_init_one(pdev, ppi);
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM

View file

@ -191,7 +191,7 @@ static const struct ata_port_operations jmicron_ops = {
static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *id) static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
{ {
static struct ata_port_info info = { static const struct ata_port_info info = {
.sht = &jmicron_sht, .sht = &jmicron_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
@ -201,9 +201,9 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i
.port_ops = &jmicron_ops, .port_ops = &jmicron_ops,
}; };
struct ata_port_info *port_info[2] = { &info, &info }; const struct ata_port_info *ppi[] = { &info, NULL };
return ata_pci_init_one(pdev, port_info, 2); return ata_pci_init_one(pdev, ppi);
} }
static const struct pci_device_id jmicron_pci_tbl[] = { static const struct pci_device_id jmicron_pci_tbl[] = {

View file

@ -161,7 +161,7 @@ static const struct ata_port_operations marvell_ops = {
static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *id) static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
{ {
static struct ata_port_info info = { static const struct ata_port_info info = {
.sht = &marvell_sht, .sht = &marvell_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
@ -171,7 +171,7 @@ static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *i
.port_ops = &marvell_ops, .port_ops = &marvell_ops,
}; };
static struct ata_port_info info_sata = { static const struct ata_port_info info_sata = {
.sht = &marvell_sht, .sht = &marvell_sht,
/* Slave possible as its magically mapped not real */ /* Slave possible as its magically mapped not real */
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
@ -182,13 +182,12 @@ static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *i
.port_ops = &marvell_ops, .port_ops = &marvell_ops,
}; };
struct ata_port_info *port_info[2] = { &info, &info_sata }; const struct ata_port_info *ppi[] = { &info, &info_sata };
int n_port = 2;
if (pdev->device == 0x6101) if (pdev->device == 0x6101)
n_port = 1; ppi[1] = &ata_dummy_port_info;
return ata_pci_init_one(pdev, port_info, n_port); return ata_pci_init_one(pdev, ppi);
} }
static const struct pci_device_id marvell_pci_tbl[] = { static const struct pci_device_id marvell_pci_tbl[] = {

View file

@ -92,7 +92,7 @@ static const struct ata_port_operations netcell_ops = {
static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
static int printed_version; static int printed_version;
static struct ata_port_info info = { static const struct ata_port_info info = {
.sht = &netcell_sht, .sht = &netcell_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
/* Actually we don't really care about these as the /* Actually we don't really care about these as the
@ -102,7 +102,7 @@ static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *e
.udma_mask = 0x3f, /* UDMA 133 */ .udma_mask = 0x3f, /* UDMA 133 */
.port_ops = &netcell_ops, .port_ops = &netcell_ops,
}; };
static struct ata_port_info *port_info[2] = { &info, &info }; const struct ata_port_info *port_info[] = { &info, NULL };
if (!printed_version++) if (!printed_version++)
dev_printk(KERN_DEBUG, &pdev->dev, dev_printk(KERN_DEBUG, &pdev->dev,
@ -112,7 +112,7 @@ static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *e
ata_pci_clear_simplex(pdev); ata_pci_clear_simplex(pdev);
/* And let the library code do the work */ /* And let the library code do the work */
return ata_pci_init_one(pdev, port_info, 2); return ata_pci_init_one(pdev, port_info);
} }
static const struct pci_device_id netcell_pci_tbl[] = { static const struct pci_device_id netcell_pci_tbl[] = {

View file

@ -191,14 +191,14 @@ static struct ata_port_operations ns87410_port_ops = {
static int ns87410_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int ns87410_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 = &ns87410_sht, .sht = &ns87410_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x0F, .pio_mask = 0x0F,
.port_ops = &ns87410_port_ops .port_ops = &ns87410_port_ops
}; };
static struct ata_port_info *port_info[2] = {&info, &info}; const struct ata_port_info *ppi[] = { &info, NULL };
return ata_pci_init_one(dev, port_info, 2); return ata_pci_init_one(dev, ppi);
} }
static const struct pci_device_id ns87410[] = { static const struct pci_device_id ns87410[] = {

View file

@ -289,20 +289,20 @@ static const struct ata_port_operations oldpiix_pata_ops = {
static int oldpiix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) static int oldpiix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
static int printed_version; static int printed_version;
static struct ata_port_info info = { static const struct ata_port_info info = {
.sht = &oldpiix_sht, .sht = &oldpiix_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, /* pio0-4 */ .pio_mask = 0x1f, /* pio0-4 */
.mwdma_mask = 0x07, /* mwdma1-2 */ .mwdma_mask = 0x07, /* mwdma1-2 */
.port_ops = &oldpiix_pata_ops, .port_ops = &oldpiix_pata_ops,
}; };
static struct ata_port_info *port_info[2] = { &info, &info }; const struct ata_port_info *ppi[] = { &info, NULL };
if (!printed_version++) if (!printed_version++)
dev_printk(KERN_DEBUG, &pdev->dev, dev_printk(KERN_DEBUG, &pdev->dev,
"version " DRV_VERSION "\n"); "version " DRV_VERSION "\n");
return ata_pci_init_one(pdev, port_info, 2); return ata_pci_init_one(pdev, ppi);
} }
static const struct pci_device_id oldpiix_pci_tbl[] = { static const struct pci_device_id oldpiix_pci_tbl[] = {

View file

@ -216,19 +216,19 @@ static struct ata_port_operations opti_port_ops = {
static int opti_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int opti_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 = &opti_sht, .sht = &opti_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
.port_ops = &opti_port_ops .port_ops = &opti_port_ops
}; };
static struct ata_port_info *port_info[2] = { &info, &info }; const struct ata_port_info *ppi[] = { &info, NULL };
static int printed_version; static int printed_version;
if (!printed_version++) if (!printed_version++)
dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n");
return ata_pci_init_one(dev, port_info, 2); return ata_pci_init_one(dev, ppi);
} }
static const struct pci_device_id opti[] = { static const struct pci_device_id opti[] = {

View file

@ -482,14 +482,14 @@ static int optiplus_with_udma(struct pci_dev *pdev)
static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ {
static struct ata_port_info info_82c700 = { static const struct ata_port_info info_82c700 = {
.sht = &optidma_sht, .sht = &optidma_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
.mwdma_mask = 0x07, .mwdma_mask = 0x07,
.port_ops = &optidma_port_ops .port_ops = &optidma_port_ops
}; };
static struct ata_port_info info_82c700_udma = { static const struct ata_port_info info_82c700_udma = {
.sht = &optidma_sht, .sht = &optidma_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -497,8 +497,7 @@ static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id)
.udma_mask = 0x07, .udma_mask = 0x07,
.port_ops = &optiplus_port_ops .port_ops = &optiplus_port_ops
}; };
static struct ata_port_info *port_info[2]; const struct ata_port_info *ppi[] = { &info_82c700, NULL };
struct ata_port_info *info = &info_82c700;
static int printed_version; static int printed_version;
if (!printed_version++) if (!printed_version++)
@ -510,10 +509,9 @@ static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id)
pci_clock = inb(0x1F5) & 1; /* 0 = 33Mhz, 1 = 25Mhz */ pci_clock = inb(0x1F5) & 1; /* 0 = 33Mhz, 1 = 25Mhz */
if (optiplus_with_udma(dev)) if (optiplus_with_udma(dev))
info = &info_82c700_udma; ppi[0] = &info_82c700_udma;
port_info[0] = port_info[1] = info; return ata_pci_init_one(dev, ppi);
return ata_pci_init_one(dev, port_info, 2);
} }
static const struct pci_device_id optidma[] = { static const struct pci_device_id optidma[] = {

View file

@ -317,7 +317,7 @@ static struct ata_port_operations pdc2026x_port_ops = {
static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ {
static struct ata_port_info info[3] = { static const struct ata_port_info info[3] = {
{ {
.sht = &pdc202xx_sht, .sht = &pdc202xx_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
@ -344,9 +344,7 @@ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id
} }
}; };
static struct ata_port_info *port_info[2]; const struct ata_port_info *ppi[] = { &info[id->driver_data], NULL };
port_info[0] = port_info[1] = &info[id->driver_data];
if (dev->device == PCI_DEVICE_ID_PROMISE_20265) { if (dev->device == PCI_DEVICE_ID_PROMISE_20265) {
struct pci_dev *bridge = dev->bus->self; struct pci_dev *bridge = dev->bus->self;
@ -358,7 +356,7 @@ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id
return -ENODEV; return -ENODEV;
} }
} }
return ata_pci_init_one(dev, port_info, 2); return ata_pci_init_one(dev, ppi);
} }
static const struct pci_device_id pdc202xx[] = { static const struct pci_device_id pdc202xx[] = {

View file

@ -255,7 +255,7 @@ static const struct ata_port_operations radisys_pata_ops = {
static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
static int printed_version; static int printed_version;
static struct ata_port_info info = { static const struct ata_port_info info = {
.sht = &radisys_sht, .sht = &radisys_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, /* pio0-4 */ .pio_mask = 0x1f, /* pio0-4 */
@ -263,13 +263,13 @@ static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *e
.udma_mask = 0x14, /* UDMA33/66 only */ .udma_mask = 0x14, /* UDMA33/66 only */
.port_ops = &radisys_pata_ops, .port_ops = &radisys_pata_ops,
}; };
static struct ata_port_info *port_info[2] = { &info, &info }; const struct ata_port_info *ppi[] = { &info, NULL };
if (!printed_version++) if (!printed_version++)
dev_printk(KERN_DEBUG, &pdev->dev, dev_printk(KERN_DEBUG, &pdev->dev,
"version " DRV_VERSION "\n"); "version " DRV_VERSION "\n");
return ata_pci_init_one(pdev, port_info, 2); return ata_pci_init_one(pdev, ppi);
} }
static const struct pci_device_id radisys_pci_tbl[] = { static const struct pci_device_id radisys_pci_tbl[] = {

View file

@ -131,22 +131,20 @@ static int rz1000_fifo_disable(struct pci_dev *pdev)
static int rz1000_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) static int rz1000_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
static int printed_version; static int printed_version;
struct ata_port_info *port_info[2]; static const struct ata_port_info info = {
static struct ata_port_info info = {
.sht = &rz1000_sht, .sht = &rz1000_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
.port_ops = &rz1000_port_ops .port_ops = &rz1000_port_ops
}; };
const struct ata_port_info *ppi[] = { &info, NULL };
if (!printed_version++) if (!printed_version++)
printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n");
if (rz1000_fifo_disable(pdev) == 0) { if (rz1000_fifo_disable(pdev) == 0)
port_info[0] = &info; return ata_pci_init_one(pdev, ppi);
port_info[1] = &info;
return ata_pci_init_one(pdev, port_info, 2);
}
printk(KERN_ERR DRV_NAME ": failed to disable read-ahead on chipset..\n"); printk(KERN_ERR DRV_NAME ": failed to disable read-ahead on chipset..\n");
/* Not safe to use so skip */ /* Not safe to use so skip */
return -ENODEV; return -ENODEV;

View file

@ -243,7 +243,7 @@ static struct ata_port_operations sc1200_port_ops = {
static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int sc1200_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 = &sc1200_sht, .sht = &sc1200_sht,
.flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -251,10 +251,10 @@ static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
.udma_mask = 0x07, .udma_mask = 0x07,
.port_ops = &sc1200_port_ops .port_ops = &sc1200_port_ops
}; };
static struct ata_port_info *port_info[2] = { &info, &info };
/* Can't enable port 2 yet, see top comments */ /* Can't enable port 2 yet, see top comments */
return ata_pci_init_one(dev, port_info, 1); const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info };
return ata_pci_init_one(dev, ppi);
} }
static const struct pci_device_id sc1200[] = { static const struct pci_device_id sc1200[] = {

View file

@ -475,8 +475,7 @@ static void serverworks_fixup_ht1000(struct pci_dev *pdev)
static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id *id) static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
{ {
int ports = 2; static const struct ata_port_info info[4] = {
static struct ata_port_info info[4] = {
{ /* OSB4 */ { /* OSB4 */
.sht = &serverworks_sht, .sht = &serverworks_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
@ -507,8 +506,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id
.port_ops = &serverworks_csb_port_ops .port_ops = &serverworks_csb_port_ops
} }
}; };
static struct ata_port_info *port_info[2]; const struct ata_port_info *ppi[] = { &info[id->driver_data], NULL };
struct ata_port_info *devinfo = &info[id->driver_data];
/* Force master latency timer to 64 PCI clocks */ /* Force master latency timer to 64 PCI clocks */
pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40); pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40);
@ -517,7 +515,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id
if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) {
/* Select non UDMA capable OSB4 if we can't do fixups */ /* Select non UDMA capable OSB4 if we can't do fixups */
if ( serverworks_fixup_osb4(pdev) < 0) if ( serverworks_fixup_osb4(pdev) < 0)
devinfo = &info[1]; ppi[0] = &info[1];
} }
/* setup CSB5/CSB6 : South Bridge and IDE option RAID */ /* setup CSB5/CSB6 : South Bridge and IDE option RAID */
else if ((pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) || else if ((pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) ||
@ -527,11 +525,11 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id
/* If the returned btr is the newer revision then /* If the returned btr is the newer revision then
select the right info block */ select the right info block */
if (serverworks_fixup_csb(pdev) == 3) if (serverworks_fixup_csb(pdev) == 3)
devinfo = &info[3]; ppi[0] = &info[3];
/* Is this the 3rd channel CSB6 IDE ? */ /* Is this the 3rd channel CSB6 IDE ? */
if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)
ports = 1; ppi[1] = &ata_dummy_port_info;
} }
/* setup HT1000E */ /* setup HT1000E */
else if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE) else if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE)
@ -540,8 +538,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id
if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE)
ata_pci_clear_simplex(pdev); ata_pci_clear_simplex(pdev);
port_info[0] = port_info[1] = devinfo; return ata_pci_init_one(pdev, ppi);
return ata_pci_init_one(pdev, port_info, ports);
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM

View file

@ -341,7 +341,7 @@ static u8 sil680_init_chip(struct pci_dev *pdev)
static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id) static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
{ {
static struct ata_port_info info = { static const struct ata_port_info info = {
.sht = &sil680_sht, .sht = &sil680_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -349,7 +349,7 @@ static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.udma_mask = 0x7f, .udma_mask = 0x7f,
.port_ops = &sil680_port_ops .port_ops = &sil680_port_ops
}; };
static struct ata_port_info info_slow = { static const struct ata_port_info info_slow = {
.sht = &sil680_sht, .sht = &sil680_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -357,7 +357,7 @@ static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.udma_mask = 0x3f, .udma_mask = 0x3f,
.port_ops = &sil680_port_ops .port_ops = &sil680_port_ops
}; };
static struct ata_port_info *port_info[2] = {&info, &info}; const struct ata_port_info *ppi[] = { &info, NULL };
static int printed_version; static int printed_version;
if (!printed_version++) if (!printed_version++)
@ -366,12 +366,12 @@ static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
switch(sil680_init_chip(pdev)) switch(sil680_init_chip(pdev))
{ {
case 0: case 0:
port_info[0] = port_info[1] = &info_slow; ppi[0] = &info_slow;
break; break;
case 0x30: case 0x30:
return -ENODEV; return -ENODEV;
} }
return ata_pci_init_one(pdev, port_info, 2); return ata_pci_init_one(pdev, ppi);
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM

View file

@ -38,8 +38,8 @@
#define DRV_VERSION "0.5.1" #define DRV_VERSION "0.5.1"
struct sis_chipset { struct sis_chipset {
u16 device; /* PCI host ID */ u16 device; /* PCI host ID */
struct ata_port_info *info; /* Info block */ const struct ata_port_info *info; /* Info block */
/* Probably add family, cable detect type etc here to clean /* Probably add family, cable detect type etc here to clean
up code later */ up code later */
}; };
@ -696,7 +696,7 @@ static const struct ata_port_operations sis_old_ops = {
.port_start = ata_port_start, .port_start = ata_port_start,
}; };
static struct ata_port_info sis_info = { static const struct ata_port_info sis_info = {
.sht = &sis_sht, .sht = &sis_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, /* pio0-4 */ .pio_mask = 0x1f, /* pio0-4 */
@ -704,7 +704,7 @@ static struct ata_port_info sis_info = {
.udma_mask = 0, .udma_mask = 0,
.port_ops = &sis_old_ops, .port_ops = &sis_old_ops,
}; };
static struct ata_port_info sis_info33 = { static const struct ata_port_info sis_info33 = {
.sht = &sis_sht, .sht = &sis_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, /* pio0-4 */ .pio_mask = 0x1f, /* pio0-4 */
@ -712,35 +712,35 @@ static struct ata_port_info sis_info33 = {
.udma_mask = ATA_UDMA2, /* UDMA 33 */ .udma_mask = ATA_UDMA2, /* UDMA 33 */
.port_ops = &sis_old_ops, .port_ops = &sis_old_ops,
}; };
static struct ata_port_info sis_info66 = { static const struct ata_port_info sis_info66 = {
.sht = &sis_sht, .sht = &sis_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, /* pio0-4 */ .pio_mask = 0x1f, /* pio0-4 */
.udma_mask = ATA_UDMA4, /* UDMA 66 */ .udma_mask = ATA_UDMA4, /* UDMA 66 */
.port_ops = &sis_66_ops, .port_ops = &sis_66_ops,
}; };
static struct ata_port_info sis_info100 = { static const struct ata_port_info sis_info100 = {
.sht = &sis_sht, .sht = &sis_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, /* pio0-4 */ .pio_mask = 0x1f, /* pio0-4 */
.udma_mask = ATA_UDMA5, .udma_mask = ATA_UDMA5,
.port_ops = &sis_100_ops, .port_ops = &sis_100_ops,
}; };
static struct ata_port_info sis_info100_early = { static const struct ata_port_info sis_info100_early = {
.sht = &sis_sht, .sht = &sis_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.udma_mask = ATA_UDMA5, .udma_mask = ATA_UDMA5,
.pio_mask = 0x1f, /* pio0-4 */ .pio_mask = 0x1f, /* pio0-4 */
.port_ops = &sis_66_ops, .port_ops = &sis_66_ops,
}; };
struct ata_port_info sis_info133 = { const struct ata_port_info sis_info133 = {
.sht = &sis_sht, .sht = &sis_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, /* pio0-4 */ .pio_mask = 0x1f, /* pio0-4 */
.udma_mask = ATA_UDMA6, .udma_mask = ATA_UDMA6,
.port_ops = &sis_133_ops, .port_ops = &sis_133_ops,
}; };
static struct ata_port_info sis_info133_early = { static const struct ata_port_info sis_info133_early = {
.sht = &sis_sht, .sht = &sis_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, /* pio0-4 */ .pio_mask = 0x1f, /* pio0-4 */
@ -823,8 +823,8 @@ static void sis_fixup(struct pci_dev *pdev, struct sis_chipset *sis)
static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
static int printed_version; static int printed_version;
static struct ata_port_info *port_info[2]; struct ata_port_info port;
struct ata_port_info *port; const struct ata_port_info *ppi[] = { &port, NULL };
struct pci_dev *host = NULL; struct pci_dev *host = NULL;
struct sis_chipset *chipset = NULL; struct sis_chipset *chipset = NULL;
struct sis_chipset *sets; struct sis_chipset *sets;
@ -964,13 +964,12 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
if (chipset == NULL) if (chipset == NULL)
return -ENODEV; return -ENODEV;
port = chipset->info; port = *chipset->info;
port->private_data = chipset; port.private_data = chipset;
sis_fixup(pdev, chipset); sis_fixup(pdev, chipset);
port_info[0] = port_info[1] = port; return ata_pci_init_one(pdev, ppi);
return ata_pci_init_one(pdev, port_info, 2);
} }
static const struct pci_device_id sis_pci_tbl[] = { static const struct pci_device_id sis_pci_tbl[] = {

View file

@ -301,20 +301,22 @@ static int sl82c105_bridge_revision(struct pci_dev *pdev)
static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ {
static struct ata_port_info info_dma = { static const struct ata_port_info info_dma = {
.sht = &sl82c105_sht, .sht = &sl82c105_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
.mwdma_mask = 0x07, .mwdma_mask = 0x07,
.port_ops = &sl82c105_port_ops .port_ops = &sl82c105_port_ops
}; };
static struct ata_port_info info_early = { static const struct ata_port_info info_early = {
.sht = &sl82c105_sht, .sht = &sl82c105_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
.port_ops = &sl82c105_port_ops .port_ops = &sl82c105_port_ops
}; };
static struct ata_port_info *port_info[2] = { &info_early, &info_early }; /* for now use only the first port */
const struct ata_port_info *ppi[] = { &info_early,
&ata_dummy_port_info };
u32 val; u32 val;
int rev; int rev;
@ -324,17 +326,14 @@ static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id
dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Unable to find bridge, disabling DMA.\n"); dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Unable to find bridge, disabling DMA.\n");
else if (rev <= 5) else if (rev <= 5)
dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Early bridge revision, no DMA available.\n"); dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Early bridge revision, no DMA available.\n");
else { else
port_info[0] = &info_dma; ppi[0] = &info_dma;
port_info[1] = &info_dma;
}
pci_read_config_dword(dev, 0x40, &val); pci_read_config_dword(dev, 0x40, &val);
val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16;
pci_write_config_dword(dev, 0x40, val); pci_write_config_dword(dev, 0x40, val);
return ata_pci_init_one(dev, ppi);
return ata_pci_init_one(dev, port_info, 1); /* For now */
} }
static const struct pci_device_id sl82c105[] = { static const struct pci_device_id sl82c105[] = {

View file

@ -233,20 +233,20 @@ static struct ata_port_operations triflex_port_ops = {
static int triflex_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int triflex_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 = &triflex_sht, .sht = &triflex_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
.pio_mask = 0x1f, .pio_mask = 0x1f,
.mwdma_mask = 0x07, .mwdma_mask = 0x07,
.port_ops = &triflex_port_ops .port_ops = &triflex_port_ops
}; };
static struct ata_port_info *port_info[2] = { &info, &info }; const struct ata_port_info *ppi[] = { &info, NULL };
static int printed_version; static int printed_version;
if (!printed_version++) if (!printed_version++)
dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n");
return ata_pci_init_one(dev, port_info, 2); return ata_pci_init_one(dev, ppi);
} }
static const struct pci_device_id triflex[] = { static const struct pci_device_id triflex[] = {

View file

@ -421,7 +421,7 @@ static void via_config_fifo(struct pci_dev *pdev, unsigned int flags)
static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
{ {
/* Early VIA without UDMA support */ /* Early VIA without UDMA support */
static struct ata_port_info via_mwdma_info = { static const struct ata_port_info via_mwdma_info = {
.sht = &via_sht, .sht = &via_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -429,7 +429,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.port_ops = &via_port_ops .port_ops = &via_port_ops
}; };
/* Ditto with IRQ masking required */ /* Ditto with IRQ masking required */
static struct ata_port_info via_mwdma_info_borked = { static const struct ata_port_info via_mwdma_info_borked = {
.sht = &via_sht, .sht = &via_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -437,7 +437,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.port_ops = &via_port_ops_noirq, .port_ops = &via_port_ops_noirq,
}; };
/* VIA UDMA 33 devices (and borked 66) */ /* VIA UDMA 33 devices (and borked 66) */
static struct ata_port_info via_udma33_info = { static const struct ata_port_info via_udma33_info = {
.sht = &via_sht, .sht = &via_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -446,7 +446,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.port_ops = &via_port_ops .port_ops = &via_port_ops
}; };
/* VIA UDMA 66 devices */ /* VIA UDMA 66 devices */
static struct ata_port_info via_udma66_info = { static const struct ata_port_info via_udma66_info = {
.sht = &via_sht, .sht = &via_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -455,7 +455,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.port_ops = &via_port_ops .port_ops = &via_port_ops
}; };
/* VIA UDMA 100 devices */ /* VIA UDMA 100 devices */
static struct ata_port_info via_udma100_info = { static const struct ata_port_info via_udma100_info = {
.sht = &via_sht, .sht = &via_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -464,7 +464,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.port_ops = &via_port_ops .port_ops = &via_port_ops
}; };
/* UDMA133 with bad AST (All current 133) */ /* UDMA133 with bad AST (All current 133) */
static struct ata_port_info via_udma133_info = { static const struct ata_port_info via_udma133_info = {
.sht = &via_sht, .sht = &via_sht,
.flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING,
.pio_mask = 0x1f, .pio_mask = 0x1f,
@ -472,7 +472,8 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
.udma_mask = 0x7f, /* FIXME: should check north bridge */ .udma_mask = 0x7f, /* FIXME: should check north bridge */
.port_ops = &via_port_ops .port_ops = &via_port_ops
}; };
struct ata_port_info *port_info[2], *type; struct ata_port_info type;
const struct ata_port_info *ppi[] = { &type, NULL };
struct pci_dev *isa = NULL; struct pci_dev *isa = NULL;
const struct via_isa_bridge *config; const struct via_isa_bridge *config;
static int printed_version; static int printed_version;
@ -517,25 +518,25 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
switch(config->flags & VIA_UDMA) { switch(config->flags & VIA_UDMA) {
case VIA_UDMA_NONE: case VIA_UDMA_NONE:
if (config->flags & VIA_NO_UNMASK) if (config->flags & VIA_NO_UNMASK)
type = &via_mwdma_info_borked; type = via_mwdma_info_borked;
else else
type = &via_mwdma_info; type = via_mwdma_info;
break; break;
case VIA_UDMA_33: case VIA_UDMA_33:
type = &via_udma33_info; type = via_udma33_info;
break; break;
case VIA_UDMA_66: case VIA_UDMA_66:
type = &via_udma66_info; type = via_udma66_info;
/* The 66 MHz devices require we enable the clock */ /* The 66 MHz devices require we enable the clock */
pci_read_config_dword(pdev, 0x50, &timing); pci_read_config_dword(pdev, 0x50, &timing);
timing |= 0x80008; timing |= 0x80008;
pci_write_config_dword(pdev, 0x50, timing); pci_write_config_dword(pdev, 0x50, timing);
break; break;
case VIA_UDMA_100: case VIA_UDMA_100:
type = &via_udma100_info; type = via_udma100_info;
break; break;
case VIA_UDMA_133: case VIA_UDMA_133:
type = &via_udma133_info; type = via_udma133_info;
break; break;
default: default:
WARN_ON(1); WARN_ON(1);
@ -550,10 +551,9 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
} }
/* We have established the device type, now fire it up */ /* We have established the device type, now fire it up */
type->private_data = (void *)config; type.private_data = (void *)config;
port_info[0] = port_info[1] = type; return ata_pci_init_one(pdev, ppi);
return ata_pci_init_one(pdev, port_info, 2);
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM

View file

@ -457,7 +457,7 @@ static const struct ata_port_operations nv_adma_ops = {
.host_stop = nv_adma_host_stop, .host_stop = nv_adma_host_stop,
}; };
static struct ata_port_info nv_port_info[] = { static const struct ata_port_info nv_port_info[] = {
/* generic */ /* generic */
{ {
.sht = &nv_sht, .sht = &nv_sht,
@ -1537,7 +1537,7 @@ static void nv_adma_error_handler(struct ata_port *ap)
static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
static int printed_version = 0; static int printed_version = 0;
const struct ata_port_info *ppi[2]; const struct ata_port_info *ppi[] = { NULL, NULL };
struct ata_host *host; struct ata_host *host;
struct nv_host_priv *hpriv; struct nv_host_priv *hpriv;
int rc; int rc;
@ -1565,8 +1565,8 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
type = ADMA; type = ADMA;
} }
ppi[0] = ppi[1] = &nv_port_info[type]; ppi[0] = &nv_port_info[type];
rc = ata_pci_prepare_native_host(pdev, ppi, 2, &host); rc = ata_pci_prepare_native_host(pdev, ppi, &host);
if (rc) if (rc)
return rc; return rc;

View file

@ -129,7 +129,7 @@ static const struct ata_port_operations sis_ops = {
.port_start = ata_port_start, .port_start = ata_port_start,
}; };
static struct ata_port_info sis_port_info = { static const struct ata_port_info sis_port_info = {
.flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
.pio_mask = 0x1f, .pio_mask = 0x1f,
.mwdma_mask = 0x7, .mwdma_mask = 0x7,
@ -255,7 +255,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
static int printed_version; static int printed_version;
struct ata_port_info pi = sis_port_info; struct ata_port_info pi = sis_port_info;
const struct ata_port_info *ppi[2] = { &pi, &pi }; const struct ata_port_info *ppi[] = { &pi, NULL };
struct ata_host *host; struct ata_host *host;
u32 genctl, val; u32 genctl, val;
u8 pmr; u8 pmr;
@ -335,7 +335,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
break; break;
} }
rc = ata_pci_prepare_native_host(pdev, ppi, 2, &host); rc = ata_pci_prepare_native_host(pdev, ppi, &host);
if (rc) if (rc)
return rc; return rc;

View file

@ -125,7 +125,7 @@ static const struct ata_port_operations uli_ops = {
.port_start = ata_port_start, .port_start = ata_port_start,
}; };
static struct ata_port_info uli_port_info = { static const struct ata_port_info uli_port_info = {
.flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
ATA_FLAG_IGN_SIMPLEX, ATA_FLAG_IGN_SIMPLEX,
.pio_mask = 0x1f, /* pio0-4 */ .pio_mask = 0x1f, /* pio0-4 */
@ -201,19 +201,33 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
n_ports = 2; n_ports = 2;
if (board_idx == uli_5287) if (board_idx == uli_5287)
n_ports = 4; n_ports = 4;
rc = ata_pci_prepare_native_host(pdev, ppi, n_ports, &host);
if (rc) /* allocate the host */
return rc; host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports);
if (!host)
return -ENOMEM;
hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL);
if (!hpriv) if (!hpriv)
return -ENOMEM; return -ENOMEM;
host->private_data = hpriv; host->private_data = hpriv;
/* the first two ports are standard SFF */
rc = ata_pci_init_native_host(host);
if (rc)
return rc;
rc = ata_pci_init_bmdma(host);
if (rc)
return rc;
iomap = host->iomap; iomap = host->iomap;
switch (board_idx) { switch (board_idx) {
case uli_5287: case uli_5287:
/* If there are four, the last two live right after
* the standard SFF ports.
*/
hpriv->scr_cfg_addr[0] = ULI5287_BASE; hpriv->scr_cfg_addr[0] = ULI5287_BASE;
hpriv->scr_cfg_addr[1] = ULI5287_BASE + ULI5287_OFFS; hpriv->scr_cfg_addr[1] = ULI5287_BASE + ULI5287_OFFS;

View file

@ -415,7 +415,7 @@ static int vt6420_prepare_host(struct pci_dev *pdev, struct ata_host **r_host)
struct ata_host *host; struct ata_host *host;
int rc; int rc;
rc = ata_pci_prepare_native_host(pdev, ppi, 2, &host); rc = ata_pci_prepare_native_host(pdev, ppi, &host);
if (rc) if (rc)
return rc; return rc;
*r_host = host; *r_host = host;

View file

@ -2,4 +2,4 @@
struct ata_port_info; struct ata_port_info;
/* pata_sis.c */ /* pata_sis.c */
extern struct ata_port_info sis_info133; extern const struct ata_port_info sis_info133;

View file

@ -253,10 +253,6 @@ enum {
ATA_DMA_PAD_SZ = 4, ATA_DMA_PAD_SZ = 4,
ATA_DMA_PAD_BUF_SZ = ATA_DMA_PAD_SZ * ATA_MAX_QUEUE, ATA_DMA_PAD_BUF_SZ = ATA_DMA_PAD_SZ * ATA_MAX_QUEUE,
/* masks for port functions */
ATA_PORT_PRIMARY = (1 << 0),
ATA_PORT_SECONDARY = (1 << 1),
/* ering size */ /* ering size */
ATA_ERING_SIZE = 32, ATA_ERING_SIZE = 32,
@ -688,8 +684,8 @@ extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes);
extern void ata_port_disable(struct ata_port *); extern void ata_port_disable(struct ata_port *);
extern void ata_std_ports(struct ata_ioports *ioaddr); extern void ata_std_ports(struct ata_ioports *ioaddr);
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, extern int ata_pci_init_one (struct pci_dev *pdev,
unsigned int n_ports); const struct ata_port_info * const * ppi);
extern void ata_pci_remove_one (struct pci_dev *pdev); extern void ata_pci_remove_one (struct pci_dev *pdev);
#ifdef CONFIG_PM #ifdef CONFIG_PM
extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg); extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg);
@ -854,11 +850,11 @@ struct pci_bits {
unsigned long val; unsigned long val;
}; };
extern int ata_pci_init_native_host(struct ata_host *host, extern int ata_pci_init_native_host(struct ata_host *host);
unsigned int port_mask); extern int ata_pci_init_bmdma(struct ata_host *host);
extern int ata_pci_prepare_native_host(struct pci_dev *pdev, extern int ata_pci_prepare_native_host(struct pci_dev *pdev,
const struct ata_port_info * const * ppi, const struct ata_port_info * const * ppi,
int n_ports, struct ata_host **r_host); struct ata_host **r_host);
extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits);
extern unsigned long ata_pci_default_filter(struct ata_device *, unsigned long); extern unsigned long ata_pci_default_filter(struct ata_device *, unsigned long);
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */