diff options
Diffstat (limited to 'drivers/ata')
59 files changed, 503 insertions, 1002 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index f031b8732330..ad1f59c1b3fc 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -2,11 +2,9 @@ | |||
2 | # SATA/PATA driver configuration | 2 | # SATA/PATA driver configuration |
3 | # | 3 | # |
4 | 4 | ||
5 | menu "Serial ATA (prod) and Parallel ATA (experimental) drivers" | 5 | menuconfig ATA |
6 | tristate "Serial ATA (prod) and Parallel ATA (experimental) drivers" | ||
6 | depends on HAS_IOMEM | 7 | depends on HAS_IOMEM |
7 | |||
8 | config ATA | ||
9 | tristate "ATA device support" | ||
10 | depends on BLOCK | 8 | depends on BLOCK |
11 | depends on !(M32R || M68K) || BROKEN | 9 | depends on !(M32R || M68K) || BROKEN |
12 | depends on !SUN4 || BROKEN | 10 | depends on !SUN4 || BROKEN |
@@ -24,6 +22,19 @@ config ATA_NONSTANDARD | |||
24 | bool | 22 | bool |
25 | default n | 23 | default n |
26 | 24 | ||
25 | config ATA_ACPI | ||
26 | bool | ||
27 | depends on ACPI && PCI | ||
28 | default y | ||
29 | help | ||
30 | This option adds support for ATA-related ACPI objects. | ||
31 | These ACPI objects add the ability to retrieve taskfiles | ||
32 | from the ACPI BIOS and write them to the disk controller. | ||
33 | These objects may be related to performance, security, | ||
34 | power management, or other areas. | ||
35 | You can disable this at kernel boot time by using the | ||
36 | option libata.noacpi=1 | ||
37 | |||
27 | config SATA_AHCI | 38 | config SATA_AHCI |
28 | tristate "AHCI SATA support" | 39 | tristate "AHCI SATA support" |
29 | depends on PCI | 40 | depends on PCI |
@@ -157,19 +168,6 @@ config SATA_INIC162X | |||
157 | help | 168 | help |
158 | This option enables support for Initio 162x Serial ATA. | 169 | This option enables support for Initio 162x Serial ATA. |
159 | 170 | ||
160 | config SATA_ACPI | ||
161 | bool | ||
162 | depends on ACPI && PCI | ||
163 | default y | ||
164 | help | ||
165 | This option adds support for SATA-related ACPI objects. | ||
166 | These ACPI objects add the ability to retrieve taskfiles | ||
167 | from the ACPI BIOS and write them to the disk controller. | ||
168 | These objects may be related to performance, security, | ||
169 | power management, or other areas. | ||
170 | You can disable this at kernel boot time by using the | ||
171 | option libata.noacpi=1 | ||
172 | |||
173 | config PATA_ALI | 171 | config PATA_ALI |
174 | tristate "ALi PATA support (Experimental)" | 172 | tristate "ALi PATA support (Experimental)" |
175 | depends on PCI && EXPERIMENTAL | 173 | depends on PCI && EXPERIMENTAL |
@@ -585,6 +583,4 @@ config PATA_SCC | |||
585 | 583 | ||
586 | If unsure, say N. | 584 | If unsure, say N. |
587 | 585 | ||
588 | endif | 586 | endif # ATA |
589 | endmenu | ||
590 | |||
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index 6f42a0e2812d..8149c68ac2c7 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile | |||
@@ -69,4 +69,4 @@ obj-$(CONFIG_ATA_GENERIC) += ata_generic.o | |||
69 | obj-$(CONFIG_PATA_LEGACY) += pata_legacy.o | 69 | obj-$(CONFIG_PATA_LEGACY) += pata_legacy.o |
70 | 70 | ||
71 | libata-objs := libata-core.o libata-scsi.o libata-sff.o libata-eh.o | 71 | libata-objs := libata-core.o libata-scsi.o libata-sff.o libata-eh.o |
72 | libata-$(CONFIG_SATA_ACPI) += libata-acpi.o | 72 | libata-$(CONFIG_ATA_ACPI) += libata-acpi.o |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index d9617892fc23..1ae443d7ab92 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -250,10 +250,6 @@ static struct scsi_host_template ahci_sht = { | |||
250 | .slave_configure = ata_scsi_slave_config, | 250 | .slave_configure = ata_scsi_slave_config, |
251 | .slave_destroy = ata_scsi_slave_destroy, | 251 | .slave_destroy = ata_scsi_slave_destroy, |
252 | .bios_param = ata_std_bios_param, | 252 | .bios_param = ata_std_bios_param, |
253 | #ifdef CONFIG_PM | ||
254 | .suspend = ata_scsi_device_suspend, | ||
255 | .resume = ata_scsi_device_resume, | ||
256 | #endif | ||
257 | }; | 253 | }; |
258 | 254 | ||
259 | static const struct ata_port_operations ahci_ops = { | 255 | static const struct ata_port_operations ahci_ops = { |
@@ -400,6 +396,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
400 | 396 | ||
401 | /* ATI */ | 397 | /* ATI */ |
402 | { PCI_VDEVICE(ATI, 0x4380), board_ahci_sb600 }, /* ATI SB600 */ | 398 | { PCI_VDEVICE(ATI, 0x4380), board_ahci_sb600 }, /* ATI SB600 */ |
399 | { PCI_VDEVICE(ATI, 0x4390), board_ahci_sb600 }, /* ATI SB700 */ | ||
403 | 400 | ||
404 | /* VIA */ | 401 | /* VIA */ |
405 | { PCI_VDEVICE(VIA, 0x3349), board_ahci_vt8251 }, /* VIA VT8251 */ | 402 | { PCI_VDEVICE(VIA, 0x3349), board_ahci_vt8251 }, /* VIA VT8251 */ |
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c index 92a491ddd030..c3d753296bc6 100644 --- a/drivers/ata/ata_generic.c +++ b/drivers/ata/ata_generic.c | |||
@@ -54,7 +54,7 @@ static int generic_set_mode(struct ata_port *ap, struct ata_device **unused) | |||
54 | 54 | ||
55 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 55 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
56 | struct ata_device *dev = &ap->device[i]; | 56 | struct ata_device *dev = &ap->device[i]; |
57 | if (ata_dev_ready(dev)) { | 57 | if (ata_dev_enabled(dev)) { |
58 | /* We don't really care */ | 58 | /* We don't really care */ |
59 | dev->pio_mode = XFER_PIO_0; | 59 | dev->pio_mode = XFER_PIO_0; |
60 | dev->dma_mode = XFER_MW_DMA_0; | 60 | dev->dma_mode = XFER_MW_DMA_0; |
@@ -90,10 +90,6 @@ static struct scsi_host_template generic_sht = { | |||
90 | .slave_configure = ata_scsi_slave_config, | 90 | .slave_configure = ata_scsi_slave_config, |
91 | .slave_destroy = ata_scsi_slave_destroy, | 91 | .slave_destroy = ata_scsi_slave_destroy, |
92 | .bios_param = ata_std_bios_param, | 92 | .bios_param = ata_std_bios_param, |
93 | #ifdef CONFIG_PM | ||
94 | .resume = ata_scsi_device_resume, | ||
95 | .suspend = ata_scsi_device_suspend, | ||
96 | #endif | ||
97 | }; | 93 | }; |
98 | 94 | ||
99 | static struct ata_port_operations generic_port_ops = { | 95 | static struct ata_port_operations generic_port_ops = { |
@@ -145,7 +141,7 @@ static int all_generic_ide; /* Set to claim all devices */ | |||
145 | static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 141 | static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
146 | { | 142 | { |
147 | u16 command; | 143 | u16 command; |
148 | static struct ata_port_info info = { | 144 | static const struct ata_port_info info = { |
149 | .sht = &generic_sht, | 145 | .sht = &generic_sht, |
150 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 146 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
151 | .pio_mask = 0x1f, | 147 | .pio_mask = 0x1f, |
@@ -153,7 +149,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id | |||
153 | .udma_mask = 0x3f, | 149 | .udma_mask = 0x3f, |
154 | .port_ops = &generic_port_ops | 150 | .port_ops = &generic_port_ops |
155 | }; | 151 | }; |
156 | static struct ata_port_info *port_info[2] = { &info, &info }; | 152 | const struct ata_port_info *ppi[] = { &info, NULL }; |
157 | 153 | ||
158 | /* Don't use the generic entry unless instructed to do so */ | 154 | /* Don't use the generic entry unless instructed to do so */ |
159 | if (id->driver_data == 1 && all_generic_ide == 0) | 155 | if (id->driver_data == 1 && all_generic_ide == 0) |
@@ -179,7 +175,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id | |||
179 | if (dev->vendor == PCI_VENDOR_ID_AL) | 175 | if (dev->vendor == PCI_VENDOR_ID_AL) |
180 | ata_pci_clear_simplex(dev); | 176 | ata_pci_clear_simplex(dev); |
181 | 177 | ||
182 | return ata_pci_init_one(dev, port_info, 2); | 178 | return ata_pci_init_one(dev, ppi); |
183 | } | 179 | } |
184 | 180 | ||
185 | static struct pci_device_id ata_generic[] = { | 181 | static struct pci_device_id ata_generic[] = { |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 4a795fdb6a02..13b6b1df2ac4 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -275,10 +275,6 @@ static struct scsi_host_template piix_sht = { | |||
275 | .slave_configure = ata_scsi_slave_config, | 275 | .slave_configure = ata_scsi_slave_config, |
276 | .slave_destroy = ata_scsi_slave_destroy, | 276 | .slave_destroy = ata_scsi_slave_destroy, |
277 | .bios_param = ata_std_bios_param, | 277 | .bios_param = ata_std_bios_param, |
278 | #ifdef CONFIG_PM | ||
279 | .resume = ata_scsi_device_resume, | ||
280 | .suspend = ata_scsi_device_suspend, | ||
281 | #endif | ||
282 | }; | 278 | }; |
283 | 279 | ||
284 | static const struct ata_port_operations piix_pata_ops = { | 280 | static const struct ata_port_operations piix_pata_ops = { |
@@ -1034,7 +1030,7 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1034 | static int printed_version; | 1030 | static int printed_version; |
1035 | struct device *dev = &pdev->dev; | 1031 | struct device *dev = &pdev->dev; |
1036 | struct ata_port_info port_info[2]; | 1032 | struct ata_port_info port_info[2]; |
1037 | struct ata_port_info *ppinfo[2] = { &port_info[0], &port_info[1] }; | 1033 | const struct ata_port_info *ppi[] = { &port_info[0], &port_info[1] }; |
1038 | struct piix_host_priv *hpriv; | 1034 | struct piix_host_priv *hpriv; |
1039 | unsigned long port_flags; | 1035 | unsigned long port_flags; |
1040 | 1036 | ||
@@ -1093,7 +1089,7 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1093 | port_info[1].mwdma_mask = 0; | 1089 | port_info[1].mwdma_mask = 0; |
1094 | port_info[1].udma_mask = 0; | 1090 | port_info[1].udma_mask = 0; |
1095 | } | 1091 | } |
1096 | return ata_pci_init_one(pdev, ppinfo, 2); | 1092 | return ata_pci_init_one(pdev, ppi); |
1097 | } | 1093 | } |
1098 | 1094 | ||
1099 | static int __init piix_init(void) | 1095 | static int __init piix_init(void) |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index cb3eab6e379d..ed4138e24b0c 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -270,8 +270,7 @@ out: | |||
270 | 270 | ||
271 | /** | 271 | /** |
272 | * do_drive_get_GTF - get the drive bootup default taskfile settings | 272 | * do_drive_get_GTF - get the drive bootup default taskfile settings |
273 | * @ap: the ata_port for the drive | 273 | * @dev: target ATA device |
274 | * @ix: target ata_device (drive) index | ||
275 | * @gtf_length: number of bytes of _GTF data returned at @gtf_address | 274 | * @gtf_length: number of bytes of _GTF data returned at @gtf_address |
276 | * @gtf_address: buffer containing _GTF taskfile arrays | 275 | * @gtf_address: buffer containing _GTF taskfile arrays |
277 | * | 276 | * |
@@ -286,20 +285,19 @@ out: | |||
286 | * The returned @gtf_length and @gtf_address are only valid if the | 285 | * The returned @gtf_length and @gtf_address are only valid if the |
287 | * function return value is 0. | 286 | * function return value is 0. |
288 | */ | 287 | */ |
289 | static int do_drive_get_GTF(struct ata_port *ap, int ix, | 288 | static int do_drive_get_GTF(struct ata_device *dev, unsigned int *gtf_length, |
290 | unsigned int *gtf_length, unsigned long *gtf_address, | 289 | unsigned long *gtf_address, unsigned long *obj_loc) |
291 | unsigned long *obj_loc) | ||
292 | { | 290 | { |
293 | acpi_status status; | 291 | struct ata_port *ap = dev->ap; |
294 | acpi_handle dev_handle = NULL; | 292 | acpi_status status; |
295 | acpi_handle chan_handle, drive_handle; | 293 | acpi_handle dev_handle = NULL; |
296 | acpi_integer pcidevfn = 0; | 294 | acpi_handle chan_handle, drive_handle; |
297 | u32 dev_adr; | 295 | acpi_integer pcidevfn = 0; |
298 | struct acpi_buffer output; | 296 | u32 dev_adr; |
299 | union acpi_object *out_obj; | 297 | struct acpi_buffer output; |
300 | struct device *dev = ap->host->dev; | 298 | union acpi_object *out_obj; |
301 | struct ata_device *atadev = &ap->device[ix]; | 299 | struct device *gdev = ap->host->dev; |
302 | int err = -ENODEV; | 300 | int err = -ENODEV; |
303 | 301 | ||
304 | *gtf_length = 0; | 302 | *gtf_length = 0; |
305 | *gtf_address = 0UL; | 303 | *gtf_address = 0UL; |
@@ -309,14 +307,14 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
309 | return 0; | 307 | return 0; |
310 | 308 | ||
311 | if (ata_msg_probe(ap)) | 309 | if (ata_msg_probe(ap)) |
312 | ata_dev_printk(atadev, KERN_DEBUG, "%s: ENTER: port#: %d\n", | 310 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER: port#: %d\n", |
313 | __FUNCTION__, ap->port_no); | 311 | __FUNCTION__, ap->port_no); |
314 | 312 | ||
315 | if (!ata_dev_enabled(atadev) || (ap->flags & ATA_FLAG_DISABLED)) { | 313 | if (!ata_dev_enabled(dev) || (ap->flags & ATA_FLAG_DISABLED)) { |
316 | if (ata_msg_probe(ap)) | 314 | if (ata_msg_probe(ap)) |
317 | ata_dev_printk(atadev, KERN_DEBUG, "%s: ERR: " | 315 | ata_dev_printk(dev, KERN_DEBUG, "%s: ERR: " |
318 | "ata_dev_present: %d, PORT_DISABLED: %lu\n", | 316 | "ata_dev_present: %d, PORT_DISABLED: %lu\n", |
319 | __FUNCTION__, ata_dev_enabled(atadev), | 317 | __FUNCTION__, ata_dev_enabled(dev), |
320 | ap->flags & ATA_FLAG_DISABLED); | 318 | ap->flags & ATA_FLAG_DISABLED); |
321 | goto out; | 319 | goto out; |
322 | } | 320 | } |
@@ -324,19 +322,19 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
324 | /* Don't continue if device has no _ADR method. | 322 | /* Don't continue if device has no _ADR method. |
325 | * _GTF is intended for known motherboard devices. */ | 323 | * _GTF is intended for known motherboard devices. */ |
326 | if (!(ap->cbl == ATA_CBL_SATA)) { | 324 | if (!(ap->cbl == ATA_CBL_SATA)) { |
327 | err = pata_get_dev_handle(dev, &dev_handle, &pcidevfn); | 325 | err = pata_get_dev_handle(gdev, &dev_handle, &pcidevfn); |
328 | if (err < 0) { | 326 | if (err < 0) { |
329 | if (ata_msg_probe(ap)) | 327 | if (ata_msg_probe(ap)) |
330 | ata_dev_printk(atadev, KERN_DEBUG, | 328 | ata_dev_printk(dev, KERN_DEBUG, |
331 | "%s: pata_get_dev_handle failed (%d)\n", | 329 | "%s: pata_get_dev_handle failed (%d)\n", |
332 | __FUNCTION__, err); | 330 | __FUNCTION__, err); |
333 | goto out; | 331 | goto out; |
334 | } | 332 | } |
335 | } else { | 333 | } else { |
336 | err = sata_get_dev_handle(dev, &dev_handle, &pcidevfn); | 334 | err = sata_get_dev_handle(gdev, &dev_handle, &pcidevfn); |
337 | if (err < 0) { | 335 | if (err < 0) { |
338 | if (ata_msg_probe(ap)) | 336 | if (ata_msg_probe(ap)) |
339 | ata_dev_printk(atadev, KERN_DEBUG, | 337 | ata_dev_printk(dev, KERN_DEBUG, |
340 | "%s: sata_get_dev_handle failed (%d\n", | 338 | "%s: sata_get_dev_handle failed (%d\n", |
341 | __FUNCTION__, err); | 339 | __FUNCTION__, err); |
342 | goto out; | 340 | goto out; |
@@ -344,7 +342,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
344 | } | 342 | } |
345 | 343 | ||
346 | /* Get this drive's _ADR info. if not already known. */ | 344 | /* Get this drive's _ADR info. if not already known. */ |
347 | if (!atadev->obj_handle) { | 345 | if (!dev->obj_handle) { |
348 | if (!(ap->cbl == ATA_CBL_SATA)) { | 346 | if (!(ap->cbl == ATA_CBL_SATA)) { |
349 | /* get child objects of dev_handle == channel objects, | 347 | /* get child objects of dev_handle == channel objects, |
350 | * + _their_ children == drive objects */ | 348 | * + _their_ children == drive objects */ |
@@ -352,7 +350,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
352 | chan_handle = acpi_get_child(dev_handle, | 350 | chan_handle = acpi_get_child(dev_handle, |
353 | ap->port_no); | 351 | ap->port_no); |
354 | if (ata_msg_probe(ap)) | 352 | if (ata_msg_probe(ap)) |
355 | ata_dev_printk(atadev, KERN_DEBUG, | 353 | ata_dev_printk(dev, KERN_DEBUG, |
356 | "%s: chan adr=%d: chan_handle=0x%p\n", | 354 | "%s: chan adr=%d: chan_handle=0x%p\n", |
357 | __FUNCTION__, ap->port_no, | 355 | __FUNCTION__, ap->port_no, |
358 | chan_handle); | 356 | chan_handle); |
@@ -361,26 +359,26 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
361 | goto out; | 359 | goto out; |
362 | } | 360 | } |
363 | /* TBD: could also check ACPI object VALID bits */ | 361 | /* TBD: could also check ACPI object VALID bits */ |
364 | drive_handle = acpi_get_child(chan_handle, ix); | 362 | drive_handle = acpi_get_child(chan_handle, dev->devno); |
365 | if (!drive_handle) { | 363 | if (!drive_handle) { |
366 | err = -ENODEV; | 364 | err = -ENODEV; |
367 | goto out; | 365 | goto out; |
368 | } | 366 | } |
369 | dev_adr = ix; | 367 | dev_adr = dev->devno; |
370 | atadev->obj_handle = drive_handle; | 368 | dev->obj_handle = drive_handle; |
371 | } else { /* for SATA mode */ | 369 | } else { /* for SATA mode */ |
372 | dev_adr = SATA_ADR_RSVD; | 370 | dev_adr = SATA_ADR_RSVD; |
373 | err = get_sata_adr(dev, dev_handle, pcidevfn, 0, | 371 | err = get_sata_adr(gdev, dev_handle, pcidevfn, 0, |
374 | ap, atadev, &dev_adr); | 372 | ap, dev, &dev_adr); |
375 | } | 373 | } |
376 | if (err < 0 || dev_adr == SATA_ADR_RSVD || | 374 | if (err < 0 || dev_adr == SATA_ADR_RSVD || |
377 | !atadev->obj_handle) { | 375 | !dev->obj_handle) { |
378 | if (ata_msg_probe(ap)) | 376 | if (ata_msg_probe(ap)) |
379 | ata_dev_printk(atadev, KERN_DEBUG, | 377 | ata_dev_printk(dev, KERN_DEBUG, |
380 | "%s: get_sata/pata_adr failed: " | 378 | "%s: get_sata/pata_adr failed: " |
381 | "err=%d, dev_adr=%u, obj_handle=0x%p\n", | 379 | "err=%d, dev_adr=%u, obj_handle=0x%p\n", |
382 | __FUNCTION__, err, dev_adr, | 380 | __FUNCTION__, err, dev_adr, |
383 | atadev->obj_handle); | 381 | dev->obj_handle); |
384 | goto out; | 382 | goto out; |
385 | } | 383 | } |
386 | } | 384 | } |
@@ -391,11 +389,11 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
391 | 389 | ||
392 | /* _GTF has no input parameters */ | 390 | /* _GTF has no input parameters */ |
393 | err = -EIO; | 391 | err = -EIO; |
394 | status = acpi_evaluate_object(atadev->obj_handle, "_GTF", | 392 | status = acpi_evaluate_object(dev->obj_handle, "_GTF", |
395 | NULL, &output); | 393 | NULL, &output); |
396 | if (ACPI_FAILURE(status)) { | 394 | if (ACPI_FAILURE(status)) { |
397 | if (ata_msg_probe(ap)) | 395 | if (ata_msg_probe(ap)) |
398 | ata_dev_printk(atadev, KERN_DEBUG, | 396 | ata_dev_printk(dev, KERN_DEBUG, |
399 | "%s: Run _GTF error: status = 0x%x\n", | 397 | "%s: Run _GTF error: status = 0x%x\n", |
400 | __FUNCTION__, status); | 398 | __FUNCTION__, status); |
401 | goto out; | 399 | goto out; |
@@ -403,7 +401,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
403 | 401 | ||
404 | if (!output.length || !output.pointer) { | 402 | if (!output.length || !output.pointer) { |
405 | if (ata_msg_probe(ap)) | 403 | if (ata_msg_probe(ap)) |
406 | ata_dev_printk(atadev, KERN_DEBUG, "%s: Run _GTF: " | 404 | ata_dev_printk(dev, KERN_DEBUG, "%s: Run _GTF: " |
407 | "length or ptr is NULL (0x%llx, 0x%p)\n", | 405 | "length or ptr is NULL (0x%llx, 0x%p)\n", |
408 | __FUNCTION__, | 406 | __FUNCTION__, |
409 | (unsigned long long)output.length, | 407 | (unsigned long long)output.length, |
@@ -416,7 +414,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
416 | if (out_obj->type != ACPI_TYPE_BUFFER) { | 414 | if (out_obj->type != ACPI_TYPE_BUFFER) { |
417 | kfree(output.pointer); | 415 | kfree(output.pointer); |
418 | if (ata_msg_probe(ap)) | 416 | if (ata_msg_probe(ap)) |
419 | ata_dev_printk(atadev, KERN_DEBUG, "%s: Run _GTF: " | 417 | ata_dev_printk(dev, KERN_DEBUG, "%s: Run _GTF: " |
420 | "error: expected object type of " | 418 | "error: expected object type of " |
421 | " ACPI_TYPE_BUFFER, got 0x%x\n", | 419 | " ACPI_TYPE_BUFFER, got 0x%x\n", |
422 | __FUNCTION__, out_obj->type); | 420 | __FUNCTION__, out_obj->type); |
@@ -427,7 +425,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
427 | if (!out_obj->buffer.length || !out_obj->buffer.pointer || | 425 | if (!out_obj->buffer.length || !out_obj->buffer.pointer || |
428 | out_obj->buffer.length % REGS_PER_GTF) { | 426 | out_obj->buffer.length % REGS_PER_GTF) { |
429 | if (ata_msg_drv(ap)) | 427 | if (ata_msg_drv(ap)) |
430 | ata_dev_printk(atadev, KERN_ERR, | 428 | ata_dev_printk(dev, KERN_ERR, |
431 | "%s: unexpected GTF length (%d) or addr (0x%p)\n", | 429 | "%s: unexpected GTF length (%d) or addr (0x%p)\n", |
432 | __FUNCTION__, out_obj->buffer.length, | 430 | __FUNCTION__, out_obj->buffer.length, |
433 | out_obj->buffer.pointer); | 431 | out_obj->buffer.pointer); |
@@ -439,7 +437,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
439 | *gtf_address = (unsigned long)out_obj->buffer.pointer; | 437 | *gtf_address = (unsigned long)out_obj->buffer.pointer; |
440 | *obj_loc = (unsigned long)out_obj; | 438 | *obj_loc = (unsigned long)out_obj; |
441 | if (ata_msg_probe(ap)) | 439 | if (ata_msg_probe(ap)) |
442 | ata_dev_printk(atadev, KERN_DEBUG, "%s: returning " | 440 | ata_dev_printk(dev, KERN_DEBUG, "%s: returning " |
443 | "gtf_length=%d, gtf_address=0x%lx, obj_loc=0x%lx\n", | 441 | "gtf_length=%d, gtf_address=0x%lx, obj_loc=0x%lx\n", |
444 | __FUNCTION__, *gtf_length, *gtf_address, *obj_loc); | 442 | __FUNCTION__, *gtf_length, *gtf_address, *obj_loc); |
445 | err = 0; | 443 | err = 0; |
@@ -449,7 +447,7 @@ out: | |||
449 | 447 | ||
450 | /** | 448 | /** |
451 | * taskfile_load_raw - send taskfile registers to host controller | 449 | * taskfile_load_raw - send taskfile registers to host controller |
452 | * @ap: Port to which output is sent | 450 | * @dev: target ATA device |
453 | * @gtf: raw ATA taskfile register set (0x1f1 - 0x1f7) | 451 | * @gtf: raw ATA taskfile register set (0x1f1 - 0x1f7) |
454 | * | 452 | * |
455 | * Outputs ATA taskfile to standard ATA host controller using MMIO | 453 | * Outputs ATA taskfile to standard ATA host controller using MMIO |
@@ -466,15 +464,15 @@ out: | |||
466 | * LOCKING: TBD: | 464 | * LOCKING: TBD: |
467 | * Inherited from caller. | 465 | * Inherited from caller. |
468 | */ | 466 | */ |
469 | static void taskfile_load_raw(struct ata_port *ap, | 467 | static void taskfile_load_raw(struct ata_device *dev, |
470 | struct ata_device *atadev, | 468 | const struct taskfile_array *gtf) |
471 | const struct taskfile_array *gtf) | ||
472 | { | 469 | { |
470 | struct ata_port *ap = dev->ap; | ||
473 | struct ata_taskfile tf; | 471 | struct ata_taskfile tf; |
474 | unsigned int err; | 472 | unsigned int err; |
475 | 473 | ||
476 | if (ata_msg_probe(ap)) | 474 | if (ata_msg_probe(ap)) |
477 | ata_dev_printk(atadev, KERN_DEBUG, "%s: (0x1f1-1f7): hex: " | 475 | ata_dev_printk(dev, KERN_DEBUG, "%s: (0x1f1-1f7): hex: " |
478 | "%02x %02x %02x %02x %02x %02x %02x\n", | 476 | "%02x %02x %02x %02x %02x %02x %02x\n", |
479 | __FUNCTION__, | 477 | __FUNCTION__, |
480 | gtf->tfa[0], gtf->tfa[1], gtf->tfa[2], | 478 | gtf->tfa[0], gtf->tfa[1], gtf->tfa[2], |
@@ -485,7 +483,7 @@ static void taskfile_load_raw(struct ata_port *ap, | |||
485 | && (gtf->tfa[6] == 0)) | 483 | && (gtf->tfa[6] == 0)) |
486 | return; | 484 | return; |
487 | 485 | ||
488 | ata_tf_init(atadev, &tf); | 486 | ata_tf_init(dev, &tf); |
489 | 487 | ||
490 | /* convert gtf to tf */ | 488 | /* convert gtf to tf */ |
491 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; /* TBD */ | 489 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; /* TBD */ |
@@ -498,17 +496,16 @@ static void taskfile_load_raw(struct ata_port *ap, | |||
498 | tf.device = gtf->tfa[5]; /* 0x1f6 */ | 496 | tf.device = gtf->tfa[5]; /* 0x1f6 */ |
499 | tf.command = gtf->tfa[6]; /* 0x1f7 */ | 497 | tf.command = gtf->tfa[6]; /* 0x1f7 */ |
500 | 498 | ||
501 | err = ata_exec_internal(atadev, &tf, NULL, DMA_NONE, NULL, 0); | 499 | err = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0); |
502 | if (err && ata_msg_probe(ap)) | 500 | if (err && ata_msg_probe(ap)) |
503 | ata_dev_printk(atadev, KERN_ERR, | 501 | ata_dev_printk(dev, KERN_ERR, |
504 | "%s: ata_exec_internal failed: %u\n", | 502 | "%s: ata_exec_internal failed: %u\n", |
505 | __FUNCTION__, err); | 503 | __FUNCTION__, err); |
506 | } | 504 | } |
507 | 505 | ||
508 | /** | 506 | /** |
509 | * do_drive_set_taskfiles - write the drive taskfile settings from _GTF | 507 | * do_drive_set_taskfiles - write the drive taskfile settings from _GTF |
510 | * @ap: the ata_port for the drive | 508 | * @dev: target ATA device |
511 | * @atadev: target ata_device | ||
512 | * @gtf_length: total number of bytes of _GTF taskfiles | 509 | * @gtf_length: total number of bytes of _GTF taskfiles |
513 | * @gtf_address: location of _GTF taskfile arrays | 510 | * @gtf_address: location of _GTF taskfile arrays |
514 | * | 511 | * |
@@ -517,30 +514,31 @@ static void taskfile_load_raw(struct ata_port *ap, | |||
517 | * Write {gtf_address, length gtf_length} in groups of | 514 | * Write {gtf_address, length gtf_length} in groups of |
518 | * REGS_PER_GTF bytes. | 515 | * REGS_PER_GTF bytes. |
519 | */ | 516 | */ |
520 | static int do_drive_set_taskfiles(struct ata_port *ap, | 517 | static int do_drive_set_taskfiles(struct ata_device *dev, |
521 | struct ata_device *atadev, unsigned int gtf_length, | 518 | unsigned int gtf_length, |
522 | unsigned long gtf_address) | 519 | unsigned long gtf_address) |
523 | { | 520 | { |
524 | int err = -ENODEV; | 521 | struct ata_port *ap = dev->ap; |
525 | int gtf_count = gtf_length / REGS_PER_GTF; | 522 | int err = -ENODEV; |
526 | int ix; | 523 | int gtf_count = gtf_length / REGS_PER_GTF; |
524 | int ix; | ||
527 | struct taskfile_array *gtf; | 525 | struct taskfile_array *gtf; |
528 | 526 | ||
529 | if (ata_msg_probe(ap)) | 527 | if (ata_msg_probe(ap)) |
530 | ata_dev_printk(atadev, KERN_DEBUG, "%s: ENTER: port#: %d\n", | 528 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER: port#: %d\n", |
531 | __FUNCTION__, ap->port_no); | 529 | __FUNCTION__, ap->port_no); |
532 | 530 | ||
533 | if (libata_noacpi || !(ap->cbl == ATA_CBL_SATA)) | 531 | if (libata_noacpi || !(ap->cbl == ATA_CBL_SATA)) |
534 | return 0; | 532 | return 0; |
535 | 533 | ||
536 | if (!ata_dev_enabled(atadev) || (ap->flags & ATA_FLAG_DISABLED)) | 534 | if (!ata_dev_enabled(dev) || (ap->flags & ATA_FLAG_DISABLED)) |
537 | goto out; | 535 | goto out; |
538 | if (!gtf_count) /* shouldn't be here */ | 536 | if (!gtf_count) /* shouldn't be here */ |
539 | goto out; | 537 | goto out; |
540 | 538 | ||
541 | if (gtf_length % REGS_PER_GTF) { | 539 | if (gtf_length % REGS_PER_GTF) { |
542 | if (ata_msg_drv(ap)) | 540 | if (ata_msg_drv(ap)) |
543 | ata_dev_printk(atadev, KERN_ERR, | 541 | ata_dev_printk(dev, KERN_ERR, |
544 | "%s: unexpected GTF length (%d)\n", | 542 | "%s: unexpected GTF length (%d)\n", |
545 | __FUNCTION__, gtf_length); | 543 | __FUNCTION__, gtf_length); |
546 | goto out; | 544 | goto out; |
@@ -551,7 +549,7 @@ static int do_drive_set_taskfiles(struct ata_port *ap, | |||
551 | (gtf_address + ix * REGS_PER_GTF); | 549 | (gtf_address + ix * REGS_PER_GTF); |
552 | 550 | ||
553 | /* send all TaskFile registers (0x1f1-0x1f7) *in*that*order* */ | 551 | /* send all TaskFile registers (0x1f1-0x1f7) *in*that*order* */ |
554 | taskfile_load_raw(ap, atadev, gtf); | 552 | taskfile_load_raw(dev, gtf); |
555 | } | 553 | } |
556 | 554 | ||
557 | err = 0; | 555 | err = 0; |
@@ -567,11 +565,11 @@ out: | |||
567 | */ | 565 | */ |
568 | int ata_acpi_exec_tfs(struct ata_port *ap) | 566 | int ata_acpi_exec_tfs(struct ata_port *ap) |
569 | { | 567 | { |
570 | int ix; | 568 | int ix; |
571 | int ret =0; | 569 | int ret = 0; |
572 | unsigned int gtf_length; | 570 | unsigned int gtf_length; |
573 | unsigned long gtf_address; | 571 | unsigned long gtf_address; |
574 | unsigned long obj_loc; | 572 | unsigned long obj_loc; |
575 | 573 | ||
576 | if (libata_noacpi) | 574 | if (libata_noacpi) |
577 | return 0; | 575 | return 0; |
@@ -584,11 +582,13 @@ int ata_acpi_exec_tfs(struct ata_port *ap) | |||
584 | return 0; | 582 | return 0; |
585 | 583 | ||
586 | for (ix = 0; ix < ATA_MAX_DEVICES; ix++) { | 584 | for (ix = 0; ix < ATA_MAX_DEVICES; ix++) { |
587 | if (!ata_dev_enabled(&ap->device[ix])) | 585 | struct ata_device *dev = &ap->device[ix]; |
586 | |||
587 | if (!ata_dev_enabled(dev)) | ||
588 | continue; | 588 | continue; |
589 | 589 | ||
590 | ret = do_drive_get_GTF(ap, ix, | 590 | ret = do_drive_get_GTF(dev, >f_length, >f_address, |
591 | >f_length, >f_address, &obj_loc); | 591 | &obj_loc); |
592 | if (ret < 0) { | 592 | if (ret < 0) { |
593 | if (ata_msg_probe(ap)) | 593 | if (ata_msg_probe(ap)) |
594 | ata_port_printk(ap, KERN_DEBUG, | 594 | ata_port_printk(ap, KERN_DEBUG, |
@@ -597,8 +597,7 @@ int ata_acpi_exec_tfs(struct ata_port *ap) | |||
597 | break; | 597 | break; |
598 | } | 598 | } |
599 | 599 | ||
600 | ret = do_drive_set_taskfiles(ap, &ap->device[ix], | 600 | ret = do_drive_set_taskfiles(dev, gtf_length, gtf_address); |
601 | gtf_length, gtf_address); | ||
602 | kfree((void *)obj_loc); | 601 | kfree((void *)obj_loc); |
603 | if (ret < 0) { | 602 | if (ret < 0) { |
604 | if (ata_msg_probe(ap)) | 603 | if (ata_msg_probe(ap)) |
@@ -614,8 +613,7 @@ int ata_acpi_exec_tfs(struct ata_port *ap) | |||
614 | 613 | ||
615 | /** | 614 | /** |
616 | * ata_acpi_push_id - send Identify data to drive | 615 | * ata_acpi_push_id - send Identify data to drive |
617 | * @ap: the ata_port for the drive | 616 | * @dev: target ATA device |
618 | * @ix: drive index | ||
619 | * | 617 | * |
620 | * _SDD ACPI object: for SATA mode only | 618 | * _SDD ACPI object: for SATA mode only |
621 | * Must be after Identify (Packet) Device -- uses its data | 619 | * Must be after Identify (Packet) Device -- uses its data |
@@ -623,57 +621,57 @@ int ata_acpi_exec_tfs(struct ata_port *ap) | |||
623 | * method and if it fails for whatever reason, we should still | 621 | * method and if it fails for whatever reason, we should still |
624 | * just keep going. | 622 | * just keep going. |
625 | */ | 623 | */ |
626 | int ata_acpi_push_id(struct ata_port *ap, unsigned int ix) | 624 | int ata_acpi_push_id(struct ata_device *dev) |
627 | { | 625 | { |
628 | acpi_handle handle; | 626 | struct ata_port *ap = dev->ap; |
629 | acpi_integer pcidevfn; | 627 | acpi_handle handle; |
630 | int err; | 628 | acpi_integer pcidevfn; |
631 | struct device *dev = ap->host->dev; | 629 | int err; |
632 | struct ata_device *atadev = &ap->device[ix]; | 630 | struct device *gdev = ap->host->dev; |
633 | u32 dev_adr; | 631 | u32 dev_adr; |
634 | acpi_status status; | 632 | acpi_status status; |
635 | struct acpi_object_list input; | 633 | struct acpi_object_list input; |
636 | union acpi_object in_params[1]; | 634 | union acpi_object in_params[1]; |
637 | 635 | ||
638 | if (libata_noacpi) | 636 | if (libata_noacpi) |
639 | return 0; | 637 | return 0; |
640 | 638 | ||
641 | if (ata_msg_probe(ap)) | 639 | if (ata_msg_probe(ap)) |
642 | ata_dev_printk(atadev, KERN_DEBUG, "%s: ix = %d, port#: %d\n", | 640 | ata_dev_printk(dev, KERN_DEBUG, "%s: ix = %d, port#: %d\n", |
643 | __FUNCTION__, ix, ap->port_no); | 641 | __FUNCTION__, dev->devno, ap->port_no); |
644 | 642 | ||
645 | /* Don't continue if not a SATA device. */ | 643 | /* Don't continue if not a SATA device. */ |
646 | if (!(ap->cbl == ATA_CBL_SATA)) { | 644 | if (!(ap->cbl == ATA_CBL_SATA)) { |
647 | if (ata_msg_probe(ap)) | 645 | if (ata_msg_probe(ap)) |
648 | ata_dev_printk(atadev, KERN_DEBUG, | 646 | ata_dev_printk(dev, KERN_DEBUG, |
649 | "%s: Not a SATA device\n", __FUNCTION__); | 647 | "%s: Not a SATA device\n", __FUNCTION__); |
650 | goto out; | 648 | goto out; |
651 | } | 649 | } |
652 | 650 | ||
653 | /* Don't continue if device has no _ADR method. | 651 | /* Don't continue if device has no _ADR method. |
654 | * _SDD is intended for known motherboard devices. */ | 652 | * _SDD is intended for known motherboard devices. */ |
655 | err = sata_get_dev_handle(dev, &handle, &pcidevfn); | 653 | err = sata_get_dev_handle(gdev, &handle, &pcidevfn); |
656 | if (err < 0) { | 654 | if (err < 0) { |
657 | if (ata_msg_probe(ap)) | 655 | if (ata_msg_probe(ap)) |
658 | ata_dev_printk(atadev, KERN_DEBUG, | 656 | ata_dev_printk(dev, KERN_DEBUG, |
659 | "%s: sata_get_dev_handle failed (%d\n", | 657 | "%s: sata_get_dev_handle failed (%d\n", |
660 | __FUNCTION__, err); | 658 | __FUNCTION__, err); |
661 | goto out; | 659 | goto out; |
662 | } | 660 | } |
663 | 661 | ||
664 | /* Get this drive's _ADR info, if not already known */ | 662 | /* Get this drive's _ADR info, if not already known */ |
665 | if (!atadev->obj_handle) { | 663 | if (!dev->obj_handle) { |
666 | dev_adr = SATA_ADR_RSVD; | 664 | dev_adr = SATA_ADR_RSVD; |
667 | err = get_sata_adr(dev, handle, pcidevfn, ix, ap, atadev, | 665 | err = get_sata_adr(gdev, handle, pcidevfn, dev->devno, ap, dev, |
668 | &dev_adr); | 666 | &dev_adr); |
669 | if (err < 0 || dev_adr == SATA_ADR_RSVD || | 667 | if (err < 0 || dev_adr == SATA_ADR_RSVD || |
670 | !atadev->obj_handle) { | 668 | !dev->obj_handle) { |
671 | if (ata_msg_probe(ap)) | 669 | if (ata_msg_probe(ap)) |
672 | ata_dev_printk(atadev, KERN_DEBUG, | 670 | ata_dev_printk(dev, KERN_DEBUG, |
673 | "%s: get_sata_adr failed: " | 671 | "%s: get_sata_adr failed: " |
674 | "err=%d, dev_adr=%u, obj_handle=0x%p\n", | 672 | "err=%d, dev_adr=%u, obj_handle=0x%p\n", |
675 | __FUNCTION__, err, dev_adr, | 673 | __FUNCTION__, err, dev_adr, |
676 | atadev->obj_handle); | 674 | dev->obj_handle); |
677 | goto out; | 675 | goto out; |
678 | } | 676 | } |
679 | } | 677 | } |
@@ -683,19 +681,19 @@ int ata_acpi_push_id(struct ata_port *ap, unsigned int ix) | |||
683 | input.count = 1; | 681 | input.count = 1; |
684 | input.pointer = in_params; | 682 | input.pointer = in_params; |
685 | in_params[0].type = ACPI_TYPE_BUFFER; | 683 | in_params[0].type = ACPI_TYPE_BUFFER; |
686 | in_params[0].buffer.length = sizeof(atadev->id[0]) * ATA_ID_WORDS; | 684 | in_params[0].buffer.length = sizeof(dev->id[0]) * ATA_ID_WORDS; |
687 | in_params[0].buffer.pointer = (u8 *)atadev->id; | 685 | in_params[0].buffer.pointer = (u8 *)dev->id; |
688 | /* Output buffer: _SDD has no output */ | 686 | /* Output buffer: _SDD has no output */ |
689 | 687 | ||
690 | /* It's OK for _SDD to be missing too. */ | 688 | /* It's OK for _SDD to be missing too. */ |
691 | swap_buf_le16(atadev->id, ATA_ID_WORDS); | 689 | swap_buf_le16(dev->id, ATA_ID_WORDS); |
692 | status = acpi_evaluate_object(atadev->obj_handle, "_SDD", &input, NULL); | 690 | status = acpi_evaluate_object(dev->obj_handle, "_SDD", &input, NULL); |
693 | swap_buf_le16(atadev->id, ATA_ID_WORDS); | 691 | swap_buf_le16(dev->id, ATA_ID_WORDS); |
694 | 692 | ||
695 | err = ACPI_FAILURE(status) ? -EIO : 0; | 693 | err = ACPI_FAILURE(status) ? -EIO : 0; |
696 | if (err < 0) { | 694 | if (err < 0) { |
697 | if (ata_msg_probe(ap)) | 695 | if (ata_msg_probe(ap)) |
698 | ata_dev_printk(atadev, KERN_DEBUG, | 696 | ata_dev_printk(dev, KERN_DEBUG, |
699 | "%s _SDD error: status = 0x%x\n", | 697 | "%s _SDD error: status = 0x%x\n", |
700 | __FUNCTION__, status); | 698 | __FUNCTION__, status); |
701 | } | 699 | } |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 4595d1f8cf60..4166407eb47c 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -101,6 +101,12 @@ int libata_noacpi = 1; | |||
101 | module_param_named(noacpi, libata_noacpi, int, 0444); | 101 | module_param_named(noacpi, libata_noacpi, int, 0444); |
102 | MODULE_PARM_DESC(noacpi, "Disables the use of ACPI in suspend/resume when set"); | 102 | MODULE_PARM_DESC(noacpi, "Disables the use of ACPI in suspend/resume when set"); |
103 | 103 | ||
104 | int ata_spindown_compat = 1; | ||
105 | module_param_named(spindown_compat, ata_spindown_compat, int, 0644); | ||
106 | MODULE_PARM_DESC(spindown_compat, "Enable backward compatible spindown " | ||
107 | "behavior. Will be removed. More info can be found in " | ||
108 | "Documentation/feature-removal-schedule.txt\n"); | ||
109 | |||
104 | MODULE_AUTHOR("Jeff Garzik"); | 110 | MODULE_AUTHOR("Jeff Garzik"); |
105 | MODULE_DESCRIPTION("Library module for ATA devices"); | 111 | MODULE_DESCRIPTION("Library module for ATA devices"); |
106 | MODULE_LICENSE("GPL"); | 112 | MODULE_LICENSE("GPL"); |
@@ -1654,7 +1660,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | |||
1654 | struct ata_taskfile tf; | 1660 | struct ata_taskfile tf; |
1655 | unsigned int err_mask = 0; | 1661 | unsigned int err_mask = 0; |
1656 | const char *reason; | 1662 | const char *reason; |
1657 | int tried_spinup = 0; | 1663 | int may_fallback = 1, tried_spinup = 0; |
1658 | int rc; | 1664 | int rc; |
1659 | 1665 | ||
1660 | if (ata_msg_ctl(ap)) | 1666 | if (ata_msg_ctl(ap)) |
@@ -1698,11 +1704,31 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | |||
1698 | return -ENOENT; | 1704 | return -ENOENT; |
1699 | } | 1705 | } |
1700 | 1706 | ||
1707 | /* Device or controller might have reported the wrong | ||
1708 | * device class. Give a shot at the other IDENTIFY if | ||
1709 | * the current one is aborted by the device. | ||
1710 | */ | ||
1711 | if (may_fallback && | ||
1712 | (err_mask == AC_ERR_DEV) && (tf.feature & ATA_ABORTED)) { | ||
1713 | may_fallback = 0; | ||
1714 | |||
1715 | if (class == ATA_DEV_ATA) | ||
1716 | class = ATA_DEV_ATAPI; | ||
1717 | else | ||
1718 | class = ATA_DEV_ATA; | ||
1719 | goto retry; | ||
1720 | } | ||
1721 | |||
1701 | rc = -EIO; | 1722 | rc = -EIO; |
1702 | reason = "I/O error"; | 1723 | reason = "I/O error"; |
1703 | goto err_out; | 1724 | goto err_out; |
1704 | } | 1725 | } |
1705 | 1726 | ||
1727 | /* Falling back doesn't make sense if ID data was read | ||
1728 | * successfully at least once. | ||
1729 | */ | ||
1730 | may_fallback = 0; | ||
1731 | |||
1706 | swap_buf_le16(id, ATA_ID_WORDS); | 1732 | swap_buf_le16(id, ATA_ID_WORDS); |
1707 | 1733 | ||
1708 | /* sanity check */ | 1734 | /* sanity check */ |
@@ -1843,7 +1869,7 @@ int ata_dev_configure(struct ata_device *dev) | |||
1843 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __FUNCTION__); | 1869 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __FUNCTION__); |
1844 | 1870 | ||
1845 | /* set _SDD */ | 1871 | /* set _SDD */ |
1846 | rc = ata_acpi_push_id(ap, dev->devno); | 1872 | rc = ata_acpi_push_id(dev); |
1847 | if (rc) { | 1873 | if (rc) { |
1848 | ata_dev_printk(dev, KERN_WARNING, "failed to set _SDD(%d)\n", | 1874 | ata_dev_printk(dev, KERN_WARNING, "failed to set _SDD(%d)\n", |
1849 | rc); | 1875 | rc); |
@@ -2860,7 +2886,7 @@ int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev) | |||
2860 | dev = &ap->device[i]; | 2886 | dev = &ap->device[i]; |
2861 | 2887 | ||
2862 | /* don't update suspended devices' xfer mode */ | 2888 | /* don't update suspended devices' xfer mode */ |
2863 | if (!ata_dev_ready(dev)) | 2889 | if (!ata_dev_enabled(dev)) |
2864 | continue; | 2890 | continue; |
2865 | 2891 | ||
2866 | rc = ata_dev_set_mode(dev); | 2892 | rc = ata_dev_set_mode(dev); |
@@ -5845,37 +5871,11 @@ static int ata_host_request_pm(struct ata_host *host, pm_message_t mesg, | |||
5845 | */ | 5871 | */ |
5846 | int ata_host_suspend(struct ata_host *host, pm_message_t mesg) | 5872 | int ata_host_suspend(struct ata_host *host, pm_message_t mesg) |
5847 | { | 5873 | { |
5848 | int i, j, rc; | 5874 | int rc; |
5849 | 5875 | ||
5850 | rc = ata_host_request_pm(host, mesg, 0, ATA_EHI_QUIET, 1); | 5876 | rc = ata_host_request_pm(host, mesg, 0, ATA_EHI_QUIET, 1); |
5851 | if (rc) | 5877 | if (rc == 0) |
5852 | goto fail; | 5878 | host->dev->power.power_state = mesg; |
5853 | |||
5854 | /* EH is quiescent now. Fail if we have any ready device. | ||
5855 | * This happens if hotplug occurs between completion of device | ||
5856 | * suspension and here. | ||
5857 | */ | ||
5858 | for (i = 0; i < host->n_ports; i++) { | ||
5859 | struct ata_port *ap = host->ports[i]; | ||
5860 | |||
5861 | for (j = 0; j < ATA_MAX_DEVICES; j++) { | ||
5862 | struct ata_device *dev = &ap->device[j]; | ||
5863 | |||
5864 | if (ata_dev_ready(dev)) { | ||
5865 | ata_port_printk(ap, KERN_WARNING, | ||
5866 | "suspend failed, device %d " | ||
5867 | "still active\n", dev->devno); | ||
5868 | rc = -EBUSY; | ||
5869 | goto fail; | ||
5870 | } | ||
5871 | } | ||
5872 | } | ||
5873 | |||
5874 | host->dev->power.power_state = mesg; | ||
5875 | return 0; | ||
5876 | |||
5877 | fail: | ||
5878 | ata_host_resume(host); | ||
5879 | return rc; | 5879 | return rc; |
5880 | } | 5880 | } |
5881 | 5881 | ||
@@ -5984,6 +5984,7 @@ struct ata_port *ata_port_alloc(struct ata_host *host) | |||
5984 | if (!ap) | 5984 | if (!ap) |
5985 | return NULL; | 5985 | return NULL; |
5986 | 5986 | ||
5987 | ap->pflags |= ATA_PFLAG_INITIALIZING; | ||
5987 | ap->lock = &host->lock; | 5988 | ap->lock = &host->lock; |
5988 | ap->flags = ATA_FLAG_DISABLED; | 5989 | ap->flags = ATA_FLAG_DISABLED; |
5989 | ap->print_id = -1; | 5990 | ap->print_id = -1; |
@@ -6352,6 +6353,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
6352 | ehi->action |= ATA_EH_SOFTRESET; | 6353 | ehi->action |= ATA_EH_SOFTRESET; |
6353 | ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET; | 6354 | ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET; |
6354 | 6355 | ||
6356 | ap->pflags &= ~ATA_PFLAG_INITIALIZING; | ||
6355 | ap->pflags |= ATA_PFLAG_LOADING; | 6357 | ap->pflags |= ATA_PFLAG_LOADING; |
6356 | ata_port_schedule_eh(ap); | 6358 | ata_port_schedule_eh(ap); |
6357 | 6359 | ||
@@ -6876,6 +6878,7 @@ EXPORT_SYMBOL_GPL(ata_timing_merge); | |||
6876 | #ifdef CONFIG_PCI | 6878 | #ifdef CONFIG_PCI |
6877 | EXPORT_SYMBOL_GPL(pci_test_config_bits); | 6879 | EXPORT_SYMBOL_GPL(pci_test_config_bits); |
6878 | EXPORT_SYMBOL_GPL(ata_pci_init_native_host); | 6880 | EXPORT_SYMBOL_GPL(ata_pci_init_native_host); |
6881 | EXPORT_SYMBOL_GPL(ata_pci_init_bmdma); | ||
6879 | EXPORT_SYMBOL_GPL(ata_pci_prepare_native_host); | 6882 | EXPORT_SYMBOL_GPL(ata_pci_prepare_native_host); |
6880 | EXPORT_SYMBOL_GPL(ata_pci_init_one); | 6883 | EXPORT_SYMBOL_GPL(ata_pci_init_one); |
6881 | EXPORT_SYMBOL_GPL(ata_pci_remove_one); | 6884 | EXPORT_SYMBOL_GPL(ata_pci_remove_one); |
@@ -6889,11 +6892,6 @@ EXPORT_SYMBOL_GPL(ata_pci_default_filter); | |||
6889 | EXPORT_SYMBOL_GPL(ata_pci_clear_simplex); | 6892 | EXPORT_SYMBOL_GPL(ata_pci_clear_simplex); |
6890 | #endif /* CONFIG_PCI */ | 6893 | #endif /* CONFIG_PCI */ |
6891 | 6894 | ||
6892 | #ifdef CONFIG_PM | ||
6893 | EXPORT_SYMBOL_GPL(ata_scsi_device_suspend); | ||
6894 | EXPORT_SYMBOL_GPL(ata_scsi_device_resume); | ||
6895 | #endif /* CONFIG_PM */ | ||
6896 | |||
6897 | EXPORT_SYMBOL_GPL(ata_eng_timeout); | 6895 | EXPORT_SYMBOL_GPL(ata_eng_timeout); |
6898 | EXPORT_SYMBOL_GPL(ata_port_schedule_eh); | 6896 | EXPORT_SYMBOL_GPL(ata_port_schedule_eh); |
6899 | EXPORT_SYMBOL_GPL(ata_port_abort); | 6897 | EXPORT_SYMBOL_GPL(ata_port_abort); |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 8256655ce7d9..5309c312f517 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -77,29 +77,12 @@ static void ata_eh_finish(struct ata_port *ap); | |||
77 | #ifdef CONFIG_PM | 77 | #ifdef CONFIG_PM |
78 | static void ata_eh_handle_port_suspend(struct ata_port *ap); | 78 | static void ata_eh_handle_port_suspend(struct ata_port *ap); |
79 | static void ata_eh_handle_port_resume(struct ata_port *ap); | 79 | static void ata_eh_handle_port_resume(struct ata_port *ap); |
80 | static int ata_eh_suspend(struct ata_port *ap, | ||
81 | struct ata_device **r_failed_dev); | ||
82 | static void ata_eh_prep_resume(struct ata_port *ap); | ||
83 | static int ata_eh_resume(struct ata_port *ap, struct ata_device **r_failed_dev); | ||
84 | #else /* CONFIG_PM */ | 80 | #else /* CONFIG_PM */ |
85 | static void ata_eh_handle_port_suspend(struct ata_port *ap) | 81 | static void ata_eh_handle_port_suspend(struct ata_port *ap) |
86 | { } | 82 | { } |
87 | 83 | ||
88 | static void ata_eh_handle_port_resume(struct ata_port *ap) | 84 | static void ata_eh_handle_port_resume(struct ata_port *ap) |
89 | { } | 85 | { } |
90 | |||
91 | static int ata_eh_suspend(struct ata_port *ap, struct ata_device **r_failed_dev) | ||
92 | { | ||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | static void ata_eh_prep_resume(struct ata_port *ap) | ||
97 | { } | ||
98 | |||
99 | static int ata_eh_resume(struct ata_port *ap, struct ata_device **r_failed_dev) | ||
100 | { | ||
101 | return 0; | ||
102 | } | ||
103 | #endif /* CONFIG_PM */ | 86 | #endif /* CONFIG_PM */ |
104 | 87 | ||
105 | static void ata_ering_record(struct ata_ering *ering, int is_io, | 88 | static void ata_ering_record(struct ata_ering *ering, int is_io, |
@@ -568,6 +551,9 @@ void ata_port_schedule_eh(struct ata_port *ap) | |||
568 | { | 551 | { |
569 | WARN_ON(!ap->ops->error_handler); | 552 | WARN_ON(!ap->ops->error_handler); |
570 | 553 | ||
554 | if (ap->pflags & ATA_PFLAG_INITIALIZING) | ||
555 | return; | ||
556 | |||
571 | ap->pflags |= ATA_PFLAG_EH_PENDING; | 557 | ap->pflags |= ATA_PFLAG_EH_PENDING; |
572 | scsi_schedule_eh(ap->scsi_host); | 558 | scsi_schedule_eh(ap->scsi_host); |
573 | 559 | ||
@@ -1791,7 +1777,7 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap, | |||
1791 | if (ehc->i.flags & ATA_EHI_DID_RESET) | 1777 | if (ehc->i.flags & ATA_EHI_DID_RESET) |
1792 | readid_flags |= ATA_READID_POSTRESET; | 1778 | readid_flags |= ATA_READID_POSTRESET; |
1793 | 1779 | ||
1794 | if (action & ATA_EH_REVALIDATE && ata_dev_ready(dev)) { | 1780 | if ((action & ATA_EH_REVALIDATE) && ata_dev_enabled(dev)) { |
1795 | if (ata_port_offline(ap)) { | 1781 | if (ata_port_offline(ap)) { |
1796 | rc = -EIO; | 1782 | rc = -EIO; |
1797 | goto err; | 1783 | goto err; |
@@ -1872,166 +1858,6 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap, | |||
1872 | return rc; | 1858 | return rc; |
1873 | } | 1859 | } |
1874 | 1860 | ||
1875 | #ifdef CONFIG_PM | ||
1876 | /** | ||
1877 | * ata_eh_suspend - handle suspend EH action | ||
1878 | * @ap: target host port | ||
1879 | * @r_failed_dev: result parameter to indicate failing device | ||
1880 | * | ||
1881 | * Handle suspend EH action. Disk devices are spinned down and | ||
1882 | * other types of devices are just marked suspended. Once | ||
1883 | * suspended, no EH action to the device is allowed until it is | ||
1884 | * resumed. | ||
1885 | * | ||
1886 | * LOCKING: | ||
1887 | * Kernel thread context (may sleep). | ||
1888 | * | ||
1889 | * RETURNS: | ||
1890 | * 0 on success, -errno otherwise | ||
1891 | */ | ||
1892 | static int ata_eh_suspend(struct ata_port *ap, struct ata_device **r_failed_dev) | ||
1893 | { | ||
1894 | struct ata_device *dev; | ||
1895 | int i, rc = 0; | ||
1896 | |||
1897 | DPRINTK("ENTER\n"); | ||
1898 | |||
1899 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | ||
1900 | unsigned long flags; | ||
1901 | unsigned int action, err_mask; | ||
1902 | |||
1903 | dev = &ap->device[i]; | ||
1904 | action = ata_eh_dev_action(dev); | ||
1905 | |||
1906 | if (!ata_dev_enabled(dev) || !(action & ATA_EH_SUSPEND)) | ||
1907 | continue; | ||
1908 | |||
1909 | WARN_ON(dev->flags & ATA_DFLAG_SUSPENDED); | ||
1910 | |||
1911 | ata_eh_about_to_do(ap, dev, ATA_EH_SUSPEND); | ||
1912 | |||
1913 | if (dev->class == ATA_DEV_ATA && !(action & ATA_EH_PM_FREEZE)) { | ||
1914 | /* flush cache */ | ||
1915 | rc = ata_flush_cache(dev); | ||
1916 | if (rc) | ||
1917 | break; | ||
1918 | |||
1919 | /* spin down */ | ||
1920 | err_mask = ata_do_simple_cmd(dev, ATA_CMD_STANDBYNOW1); | ||
1921 | if (err_mask) { | ||
1922 | ata_dev_printk(dev, KERN_ERR, "failed to " | ||
1923 | "spin down (err_mask=0x%x)\n", | ||
1924 | err_mask); | ||
1925 | rc = -EIO; | ||
1926 | break; | ||
1927 | } | ||
1928 | } | ||
1929 | |||
1930 | spin_lock_irqsave(ap->lock, flags); | ||
1931 | dev->flags |= ATA_DFLAG_SUSPENDED; | ||
1932 | spin_unlock_irqrestore(ap->lock, flags); | ||
1933 | |||
1934 | ata_eh_done(ap, dev, ATA_EH_SUSPEND); | ||
1935 | } | ||
1936 | |||
1937 | if (rc) | ||
1938 | *r_failed_dev = dev; | ||
1939 | |||
1940 | DPRINTK("EXIT\n"); | ||
1941 | return rc; | ||
1942 | } | ||
1943 | |||
1944 | /** | ||
1945 | * ata_eh_prep_resume - prep for resume EH action | ||
1946 | * @ap: target host port | ||
1947 | * | ||
1948 | * Clear SUSPENDED in preparation for scheduled resume actions. | ||
1949 | * This allows other parts of EH to access the devices being | ||
1950 | * resumed. | ||
1951 | * | ||
1952 | * LOCKING: | ||
1953 | * Kernel thread context (may sleep). | ||
1954 | */ | ||
1955 | static void ata_eh_prep_resume(struct ata_port *ap) | ||
1956 | { | ||
1957 | struct ata_device *dev; | ||
1958 | unsigned long flags; | ||
1959 | int i; | ||
1960 | |||
1961 | DPRINTK("ENTER\n"); | ||
1962 | |||
1963 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | ||
1964 | unsigned int action; | ||
1965 | |||
1966 | dev = &ap->device[i]; | ||
1967 | action = ata_eh_dev_action(dev); | ||
1968 | |||
1969 | if (!ata_dev_enabled(dev) || !(action & ATA_EH_RESUME)) | ||
1970 | continue; | ||
1971 | |||
1972 | spin_lock_irqsave(ap->lock, flags); | ||
1973 | dev->flags &= ~ATA_DFLAG_SUSPENDED; | ||
1974 | spin_unlock_irqrestore(ap->lock, flags); | ||
1975 | } | ||
1976 | |||
1977 | DPRINTK("EXIT\n"); | ||
1978 | } | ||
1979 | |||
1980 | /** | ||
1981 | * ata_eh_resume - handle resume EH action | ||
1982 | * @ap: target host port | ||
1983 | * @r_failed_dev: result parameter to indicate failing device | ||
1984 | * | ||
1985 | * Handle resume EH action. Target devices are already reset and | ||
1986 | * revalidated. Spinning up is the only operation left. | ||
1987 | * | ||
1988 | * LOCKING: | ||
1989 | * Kernel thread context (may sleep). | ||
1990 | * | ||
1991 | * RETURNS: | ||
1992 | * 0 on success, -errno otherwise | ||
1993 | */ | ||
1994 | static int ata_eh_resume(struct ata_port *ap, struct ata_device **r_failed_dev) | ||
1995 | { | ||
1996 | struct ata_device *dev; | ||
1997 | int i, rc = 0; | ||
1998 | |||
1999 | DPRINTK("ENTER\n"); | ||
2000 | |||
2001 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | ||
2002 | unsigned int action, err_mask; | ||
2003 | |||
2004 | dev = &ap->device[i]; | ||
2005 | action = ata_eh_dev_action(dev); | ||
2006 | |||
2007 | if (!ata_dev_enabled(dev) || !(action & ATA_EH_RESUME)) | ||
2008 | continue; | ||
2009 | |||
2010 | ata_eh_about_to_do(ap, dev, ATA_EH_RESUME); | ||
2011 | |||
2012 | if (dev->class == ATA_DEV_ATA && !(action & ATA_EH_PM_FREEZE)) { | ||
2013 | err_mask = ata_do_simple_cmd(dev, | ||
2014 | ATA_CMD_IDLEIMMEDIATE); | ||
2015 | if (err_mask) { | ||
2016 | ata_dev_printk(dev, KERN_ERR, "failed to " | ||
2017 | "spin up (err_mask=0x%x)\n", | ||
2018 | err_mask); | ||
2019 | rc = -EIO; | ||
2020 | break; | ||
2021 | } | ||
2022 | } | ||
2023 | |||
2024 | ata_eh_done(ap, dev, ATA_EH_RESUME); | ||
2025 | } | ||
2026 | |||
2027 | if (rc) | ||
2028 | *r_failed_dev = dev; | ||
2029 | |||
2030 | DPRINTK("EXIT\n"); | ||
2031 | return 0; | ||
2032 | } | ||
2033 | #endif /* CONFIG_PM */ | ||
2034 | |||
2035 | static int ata_port_nr_enabled(struct ata_port *ap) | 1861 | static int ata_port_nr_enabled(struct ata_port *ap) |
2036 | { | 1862 | { |
2037 | int i, cnt = 0; | 1863 | int i, cnt = 0; |
@@ -2057,17 +1883,6 @@ static int ata_eh_skip_recovery(struct ata_port *ap) | |||
2057 | struct ata_eh_context *ehc = &ap->eh_context; | 1883 | struct ata_eh_context *ehc = &ap->eh_context; |
2058 | int i; | 1884 | int i; |
2059 | 1885 | ||
2060 | /* skip if all possible devices are suspended */ | ||
2061 | for (i = 0; i < ata_port_max_devices(ap); i++) { | ||
2062 | struct ata_device *dev = &ap->device[i]; | ||
2063 | |||
2064 | if (!(dev->flags & ATA_DFLAG_SUSPENDED)) | ||
2065 | break; | ||
2066 | } | ||
2067 | |||
2068 | if (i == ata_port_max_devices(ap)) | ||
2069 | return 1; | ||
2070 | |||
2071 | /* thaw frozen port, resume link and recover failed devices */ | 1886 | /* thaw frozen port, resume link and recover failed devices */ |
2072 | if ((ap->pflags & ATA_PFLAG_FROZEN) || | 1887 | if ((ap->pflags & ATA_PFLAG_FROZEN) || |
2073 | (ehc->i.flags & ATA_EHI_RESUME_LINK) || ata_port_nr_enabled(ap)) | 1888 | (ehc->i.flags & ATA_EHI_RESUME_LINK) || ata_port_nr_enabled(ap)) |
@@ -2147,9 +1962,6 @@ static int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2147 | if (ap->pflags & ATA_PFLAG_UNLOADING) | 1962 | if (ap->pflags & ATA_PFLAG_UNLOADING) |
2148 | goto out; | 1963 | goto out; |
2149 | 1964 | ||
2150 | /* prep for resume */ | ||
2151 | ata_eh_prep_resume(ap); | ||
2152 | |||
2153 | /* skip EH if possible. */ | 1965 | /* skip EH if possible. */ |
2154 | if (ata_eh_skip_recovery(ap)) | 1966 | if (ata_eh_skip_recovery(ap)) |
2155 | ehc->i.action = 0; | 1967 | ehc->i.action = 0; |
@@ -2177,11 +1989,6 @@ static int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2177 | if (rc) | 1989 | if (rc) |
2178 | goto dev_fail; | 1990 | goto dev_fail; |
2179 | 1991 | ||
2180 | /* resume devices */ | ||
2181 | rc = ata_eh_resume(ap, &dev); | ||
2182 | if (rc) | ||
2183 | goto dev_fail; | ||
2184 | |||
2185 | /* configure transfer mode if necessary */ | 1992 | /* configure transfer mode if necessary */ |
2186 | if (ehc->i.flags & ATA_EHI_SETMODE) { | 1993 | if (ehc->i.flags & ATA_EHI_SETMODE) { |
2187 | rc = ata_set_mode(ap, &dev); | 1994 | rc = ata_set_mode(ap, &dev); |
@@ -2190,25 +1997,16 @@ static int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2190 | ehc->i.flags &= ~ATA_EHI_SETMODE; | 1997 | ehc->i.flags &= ~ATA_EHI_SETMODE; |
2191 | } | 1998 | } |
2192 | 1999 | ||
2193 | /* suspend devices */ | ||
2194 | rc = ata_eh_suspend(ap, &dev); | ||
2195 | if (rc) | ||
2196 | goto dev_fail; | ||
2197 | |||
2198 | goto out; | 2000 | goto out; |
2199 | 2001 | ||
2200 | dev_fail: | 2002 | dev_fail: |
2201 | ehc->tries[dev->devno]--; | 2003 | ehc->tries[dev->devno]--; |
2202 | 2004 | ||
2203 | switch (rc) { | 2005 | switch (rc) { |
2204 | case -EINVAL: | ||
2205 | /* eeek, something went very wrong, give up */ | ||
2206 | ehc->tries[dev->devno] = 0; | ||
2207 | break; | ||
2208 | |||
2209 | case -ENODEV: | 2006 | case -ENODEV: |
2210 | /* device missing or wrong IDENTIFY data, schedule probing */ | 2007 | /* device missing or wrong IDENTIFY data, schedule probing */ |
2211 | ehc->i.probe_mask |= (1 << dev->devno); | 2008 | ehc->i.probe_mask |= (1 << dev->devno); |
2009 | case -EINVAL: | ||
2212 | /* give it just one more chance */ | 2010 | /* give it just one more chance */ |
2213 | ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); | 2011 | ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1); |
2214 | case -EIO: | 2012 | case -EIO: |
@@ -2390,22 +2188,13 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap) | |||
2390 | * | 2188 | * |
2391 | * Resume @ap. | 2189 | * Resume @ap. |
2392 | * | 2190 | * |
2393 | * This function also waits upto one second until all devices | ||
2394 | * hanging off this port requests resume EH action. This is to | ||
2395 | * prevent invoking EH and thus reset multiple times on resume. | ||
2396 | * | ||
2397 | * On DPM resume, where some of devices might not be resumed | ||
2398 | * together, this may delay port resume upto one second, but such | ||
2399 | * DPM resumes are rare and 1 sec delay isn't too bad. | ||
2400 | * | ||
2401 | * LOCKING: | 2191 | * LOCKING: |
2402 | * Kernel thread context (may sleep). | 2192 | * Kernel thread context (may sleep). |
2403 | */ | 2193 | */ |
2404 | static void ata_eh_handle_port_resume(struct ata_port *ap) | 2194 | static void ata_eh_handle_port_resume(struct ata_port *ap) |
2405 | { | 2195 | { |
2406 | unsigned long timeout; | ||
2407 | unsigned long flags; | 2196 | unsigned long flags; |
2408 | int i, rc = 0; | 2197 | int rc = 0; |
2409 | 2198 | ||
2410 | /* are we resuming? */ | 2199 | /* are we resuming? */ |
2411 | spin_lock_irqsave(ap->lock, flags); | 2200 | spin_lock_irqsave(ap->lock, flags); |
@@ -2416,31 +2205,12 @@ static void ata_eh_handle_port_resume(struct ata_port *ap) | |||
2416 | } | 2205 | } |
2417 | spin_unlock_irqrestore(ap->lock, flags); | 2206 | spin_unlock_irqrestore(ap->lock, flags); |
2418 | 2207 | ||
2419 | /* spurious? */ | 2208 | WARN_ON(!(ap->pflags & ATA_PFLAG_SUSPENDED)); |
2420 | if (!(ap->pflags & ATA_PFLAG_SUSPENDED)) | ||
2421 | goto done; | ||
2422 | 2209 | ||
2423 | if (ap->ops->port_resume) | 2210 | if (ap->ops->port_resume) |
2424 | rc = ap->ops->port_resume(ap); | 2211 | rc = ap->ops->port_resume(ap); |
2425 | 2212 | ||
2426 | /* give devices time to request EH */ | 2213 | /* report result */ |
2427 | timeout = jiffies + HZ; /* 1s max */ | ||
2428 | while (1) { | ||
2429 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | ||
2430 | struct ata_device *dev = &ap->device[i]; | ||
2431 | unsigned int action = ata_eh_dev_action(dev); | ||
2432 | |||
2433 | if ((dev->flags & ATA_DFLAG_SUSPENDED) && | ||
2434 | !(action & ATA_EH_RESUME)) | ||
2435 | break; | ||
2436 | } | ||
2437 | |||
2438 | if (i == ATA_MAX_DEVICES || time_after(jiffies, timeout)) | ||
2439 | break; | ||
2440 | msleep(10); | ||
2441 | } | ||
2442 | |||
2443 | done: | ||
2444 | spin_lock_irqsave(ap->lock, flags); | 2214 | spin_lock_irqsave(ap->lock, flags); |
2445 | ap->pflags &= ~(ATA_PFLAG_PM_PENDING | ATA_PFLAG_SUSPENDED); | 2215 | ap->pflags &= ~(ATA_PFLAG_PM_PENDING | ATA_PFLAG_SUSPENDED); |
2446 | if (ap->pm_result) { | 2216 | if (ap->pm_result) { |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 9afba2ba489e..dd81fa78cdcf 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -510,133 +510,6 @@ static void ata_dump_status(unsigned id, struct ata_taskfile *tf) | |||
510 | } | 510 | } |
511 | } | 511 | } |
512 | 512 | ||
513 | #ifdef CONFIG_PM | ||
514 | /** | ||
515 | * ata_scsi_device_suspend - suspend ATA device associated with sdev | ||
516 | * @sdev: the SCSI device to suspend | ||
517 | * @mesg: target power management message | ||
518 | * | ||
519 | * Request suspend EH action on the ATA device associated with | ||
520 | * @sdev and wait for the operation to complete. | ||
521 | * | ||
522 | * LOCKING: | ||
523 | * Kernel thread context (may sleep). | ||
524 | * | ||
525 | * RETURNS: | ||
526 | * 0 on success, -errno otherwise. | ||
527 | */ | ||
528 | int ata_scsi_device_suspend(struct scsi_device *sdev, pm_message_t mesg) | ||
529 | { | ||
530 | struct ata_port *ap = ata_shost_to_port(sdev->host); | ||
531 | struct ata_device *dev = ata_scsi_find_dev(ap, sdev); | ||
532 | unsigned long flags; | ||
533 | unsigned int action; | ||
534 | int rc = 0; | ||
535 | |||
536 | if (!dev) | ||
537 | goto out; | ||
538 | |||
539 | spin_lock_irqsave(ap->lock, flags); | ||
540 | |||
541 | /* wait for the previous resume to complete */ | ||
542 | while (dev->flags & ATA_DFLAG_SUSPENDED) { | ||
543 | spin_unlock_irqrestore(ap->lock, flags); | ||
544 | ata_port_wait_eh(ap); | ||
545 | spin_lock_irqsave(ap->lock, flags); | ||
546 | } | ||
547 | |||
548 | /* if @sdev is already detached, nothing to do */ | ||
549 | if (sdev->sdev_state == SDEV_OFFLINE || | ||
550 | sdev->sdev_state == SDEV_CANCEL || sdev->sdev_state == SDEV_DEL) | ||
551 | goto out_unlock; | ||
552 | |||
553 | /* request suspend */ | ||
554 | action = ATA_EH_SUSPEND; | ||
555 | if (mesg.event != PM_EVENT_SUSPEND) | ||
556 | action |= ATA_EH_PM_FREEZE; | ||
557 | ap->eh_info.dev_action[dev->devno] |= action; | ||
558 | ap->eh_info.flags |= ATA_EHI_QUIET; | ||
559 | ata_port_schedule_eh(ap); | ||
560 | |||
561 | spin_unlock_irqrestore(ap->lock, flags); | ||
562 | |||
563 | /* wait for EH to do the job */ | ||
564 | ata_port_wait_eh(ap); | ||
565 | |||
566 | spin_lock_irqsave(ap->lock, flags); | ||
567 | |||
568 | /* If @sdev is still attached but the associated ATA device | ||
569 | * isn't suspended, the operation failed. | ||
570 | */ | ||
571 | if (sdev->sdev_state != SDEV_OFFLINE && | ||
572 | sdev->sdev_state != SDEV_CANCEL && sdev->sdev_state != SDEV_DEL && | ||
573 | !(dev->flags & ATA_DFLAG_SUSPENDED)) | ||
574 | rc = -EIO; | ||
575 | |||
576 | out_unlock: | ||
577 | spin_unlock_irqrestore(ap->lock, flags); | ||
578 | out: | ||
579 | if (rc == 0) | ||
580 | sdev->sdev_gendev.power.power_state = mesg; | ||
581 | return rc; | ||
582 | } | ||
583 | |||
584 | /** | ||
585 | * ata_scsi_device_resume - resume ATA device associated with sdev | ||
586 | * @sdev: the SCSI device to resume | ||
587 | * | ||
588 | * Request resume EH action on the ATA device associated with | ||
589 | * @sdev and return immediately. This enables parallel | ||
590 | * wakeup/spinup of devices. | ||
591 | * | ||
592 | * LOCKING: | ||
593 | * Kernel thread context (may sleep). | ||
594 | * | ||
595 | * RETURNS: | ||
596 | * 0. | ||
597 | */ | ||
598 | int ata_scsi_device_resume(struct scsi_device *sdev) | ||
599 | { | ||
600 | struct ata_port *ap = ata_shost_to_port(sdev->host); | ||
601 | struct ata_device *dev = ata_scsi_find_dev(ap, sdev); | ||
602 | struct ata_eh_info *ehi = &ap->eh_info; | ||
603 | unsigned long flags; | ||
604 | unsigned int action; | ||
605 | |||
606 | if (!dev) | ||
607 | goto out; | ||
608 | |||
609 | spin_lock_irqsave(ap->lock, flags); | ||
610 | |||
611 | /* if @sdev is already detached, nothing to do */ | ||
612 | if (sdev->sdev_state == SDEV_OFFLINE || | ||
613 | sdev->sdev_state == SDEV_CANCEL || sdev->sdev_state == SDEV_DEL) | ||
614 | goto out_unlock; | ||
615 | |||
616 | /* request resume */ | ||
617 | action = ATA_EH_RESUME; | ||
618 | if (sdev->sdev_gendev.power.power_state.event == PM_EVENT_SUSPEND) | ||
619 | __ata_ehi_hotplugged(ehi); | ||
620 | else | ||
621 | action |= ATA_EH_PM_FREEZE | ATA_EH_SOFTRESET; | ||
622 | ehi->dev_action[dev->devno] |= action; | ||
623 | |||
624 | /* We don't want autopsy and verbose EH messages. Disable | ||
625 | * those if we're the only device on this link. | ||
626 | */ | ||
627 | if (ata_port_max_devices(ap) == 1) | ||
628 | ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET; | ||
629 | |||
630 | ata_port_schedule_eh(ap); | ||
631 | |||
632 | out_unlock: | ||
633 | spin_unlock_irqrestore(ap->lock, flags); | ||
634 | out: | ||
635 | sdev->sdev_gendev.power.power_state = PMSG_ON; | ||
636 | return 0; | ||
637 | } | ||
638 | #endif /* CONFIG_PM */ | ||
639 | |||
640 | /** | 513 | /** |
641 | * ata_to_sense_error - convert ATA error to SCSI error | 514 | * ata_to_sense_error - convert ATA error to SCSI error |
642 | * @id: ATA device number | 515 | * @id: ATA device number |
@@ -929,6 +802,8 @@ int ata_scsi_slave_config(struct scsi_device *sdev) | |||
929 | 802 | ||
930 | blk_queue_max_phys_segments(sdev->request_queue, LIBATA_MAX_PRD); | 803 | blk_queue_max_phys_segments(sdev->request_queue, LIBATA_MAX_PRD); |
931 | 804 | ||
805 | sdev->manage_start_stop = 1; | ||
806 | |||
932 | if (dev) | 807 | if (dev) |
933 | ata_scsi_dev_config(sdev, dev); | 808 | ata_scsi_dev_config(sdev, dev); |
934 | 809 | ||
@@ -1069,9 +944,35 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc) | |||
1069 | } | 944 | } |
1070 | 945 | ||
1071 | tf->command = ATA_CMD_VERIFY; /* READ VERIFY */ | 946 | tf->command = ATA_CMD_VERIFY; /* READ VERIFY */ |
1072 | } else | 947 | } else { |
948 | /* XXX: This is for backward compatibility, will be | ||
949 | * removed. Read Documentation/feature-removal-schedule.txt | ||
950 | * for more info. | ||
951 | */ | ||
952 | if (ata_spindown_compat && | ||
953 | (system_state == SYSTEM_HALT || | ||
954 | system_state == SYSTEM_POWER_OFF)) { | ||
955 | static int warned = 0; | ||
956 | |||
957 | if (!warned) { | ||
958 | spin_unlock_irq(qc->ap->lock); | ||
959 | ata_dev_printk(qc->dev, KERN_WARNING, | ||
960 | "DISK MIGHT NOT BE SPUN DOWN PROPERLY. " | ||
961 | "UPDATE SHUTDOWN UTILITY\n"); | ||
962 | ata_dev_printk(qc->dev, KERN_WARNING, | ||
963 | "For more info, visit " | ||
964 | "http://linux-ata.org/shutdown.html\n"); | ||
965 | warned = 1; | ||
966 | ssleep(5); | ||
967 | spin_lock_irq(qc->ap->lock); | ||
968 | } | ||
969 | scmd->result = SAM_STAT_GOOD; | ||
970 | return 1; | ||
971 | } | ||
972 | |||
1073 | /* Issue ATA STANDBY IMMEDIATE command */ | 973 | /* Issue ATA STANDBY IMMEDIATE command */ |
1074 | tf->command = ATA_CMD_STANDBYNOW1; | 974 | tf->command = ATA_CMD_STANDBYNOW1; |
975 | } | ||
1075 | 976 | ||
1076 | /* | 977 | /* |
1077 | * Standby and Idle condition timers could be implemented but that | 978 | * Standby and Idle condition timers could be implemented but that |
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) | |||
544 | * RETURNS: | 544 | * RETURNS: |
545 | * 0 on success, -errno otherwise. | 545 | * 0 on success, -errno otherwise. |
546 | */ | 546 | */ |
547 | static int ata_pci_init_bmdma(struct ata_host *host) | 547 | int ata_pci_init_bmdma(struct ata_host *host) |
548 | { | 548 | { |
549 | struct device *gdev = host->dev; | 549 | struct device *gdev = host->dev; |
550 | struct pci_dev *pdev = to_pci_dev(gdev); | 550 | struct pci_dev *pdev = to_pci_dev(gdev); |
@@ -566,7 +566,7 @@ static int ata_pci_init_bmdma(struct ata_host *host) | |||
566 | } | 566 | } |
567 | host->iomap = pcim_iomap_table(pdev); | 567 | host->iomap = pcim_iomap_table(pdev); |
568 | 568 | ||
569 | for (i = 0; i < host->n_ports; i++) { | 569 | for (i = 0; i < 2; i++) { |
570 | struct ata_port *ap = host->ports[i]; | 570 | struct ata_port *ap = host->ports[i]; |
571 | void __iomem *bmdma = host->iomap[4] + 8 * i; | 571 | void __iomem *bmdma = host->iomap[4] + 8 * i; |
572 | 572 | ||
@@ -585,54 +585,52 @@ static int ata_pci_init_bmdma(struct ata_host *host) | |||
585 | /** | 585 | /** |
586 | * ata_pci_init_native_host - acquire native ATA resources and init host | 586 | * ata_pci_init_native_host - acquire native ATA resources and init host |
587 | * @host: target ATA host | 587 | * @host: target ATA host |
588 | * @port_mask: ports to consider | ||
589 | * | 588 | * |
590 | * Acquire native PCI ATA resources for @host and initialize | 589 | * Acquire native PCI ATA resources for @host and initialize the |
591 | * @host accordoingly. | 590 | * first two ports of @host accordingly. Ports marked dummy are |
591 | * skipped and allocation failure makes the port dummy. | ||
592 | * | 592 | * |
593 | * LOCKING: | 593 | * LOCKING: |
594 | * Inherited from calling layer (may sleep). | 594 | * Inherited from calling layer (may sleep). |
595 | * | 595 | * |
596 | * RETURNS: | 596 | * RETURNS: |
597 | * 0 on success, -errno otherwise. | 597 | * 0 if at least one port is initialized, -ENODEV if no port is |
598 | * available. | ||
598 | */ | 599 | */ |
599 | int ata_pci_init_native_host(struct ata_host *host, unsigned int port_mask) | 600 | int ata_pci_init_native_host(struct ata_host *host) |
600 | { | 601 | { |
601 | struct device *gdev = host->dev; | 602 | struct device *gdev = host->dev; |
602 | struct pci_dev *pdev = to_pci_dev(gdev); | 603 | struct pci_dev *pdev = to_pci_dev(gdev); |
604 | unsigned int mask = 0; | ||
603 | int i, rc; | 605 | int i, rc; |
604 | 606 | ||
605 | /* Discard disabled ports. Some controllers show their unused | ||
606 | * channels this way. Disabled ports are made dummy. | ||
607 | */ | ||
608 | for (i = 0; i < 2; i++) { | ||
609 | if ((port_mask & (1 << i)) && !ata_resources_present(pdev, i)) { | ||
610 | host->ports[i]->ops = &ata_dummy_port_ops; | ||
611 | port_mask &= ~(1 << i); | ||
612 | } | ||
613 | } | ||
614 | |||
615 | if (!port_mask) { | ||
616 | dev_printk(KERN_ERR, gdev, "no available port\n"); | ||
617 | return -ENODEV; | ||
618 | } | ||
619 | |||
620 | /* request, iomap BARs and init port addresses accordingly */ | 607 | /* request, iomap BARs and init port addresses accordingly */ |
621 | for (i = 0; i < 2; i++) { | 608 | for (i = 0; i < 2; i++) { |
622 | struct ata_port *ap = host->ports[i]; | 609 | struct ata_port *ap = host->ports[i]; |
623 | int base = i * 2; | 610 | int base = i * 2; |
624 | void __iomem * const *iomap; | 611 | void __iomem * const *iomap; |
625 | 612 | ||
626 | if (!(port_mask & (1 << i))) | 613 | if (ata_port_is_dummy(ap)) |
614 | continue; | ||
615 | |||
616 | /* Discard disabled ports. Some controllers show | ||
617 | * their unused channels this way. Disabled ports are | ||
618 | * made dummy. | ||
619 | */ | ||
620 | if (!ata_resources_present(pdev, i)) { | ||
621 | ap->ops = &ata_dummy_port_ops; | ||
627 | continue; | 622 | continue; |
623 | } | ||
628 | 624 | ||
629 | rc = pcim_iomap_regions(pdev, 0x3 << base, DRV_NAME); | 625 | rc = pcim_iomap_regions(pdev, 0x3 << base, DRV_NAME); |
630 | if (rc) { | 626 | if (rc) { |
631 | dev_printk(KERN_ERR, gdev, "failed to request/iomap " | 627 | dev_printk(KERN_WARNING, gdev, |
632 | "BARs for port %d (errno=%d)\n", i, rc); | 628 | "failed to request/iomap BARs for port %d " |
629 | "(errno=%d)\n", i, rc); | ||
633 | if (rc == -EBUSY) | 630 | if (rc == -EBUSY) |
634 | pcim_pin_device(pdev); | 631 | pcim_pin_device(pdev); |
635 | return rc; | 632 | ap->ops = &ata_dummy_port_ops; |
633 | continue; | ||
636 | } | 634 | } |
637 | host->iomap = iomap = pcim_iomap_table(pdev); | 635 | host->iomap = iomap = pcim_iomap_table(pdev); |
638 | 636 | ||
@@ -641,6 +639,13 @@ int ata_pci_init_native_host(struct ata_host *host, unsigned int port_mask) | |||
641 | ap->ioaddr.ctl_addr = (void __iomem *) | 639 | ap->ioaddr.ctl_addr = (void __iomem *) |
642 | ((unsigned long)iomap[base + 1] | ATA_PCI_CTL_OFS); | 640 | ((unsigned long)iomap[base + 1] | ATA_PCI_CTL_OFS); |
643 | ata_std_ports(&ap->ioaddr); | 641 | ata_std_ports(&ap->ioaddr); |
642 | |||
643 | mask |= 1 << i; | ||
644 | } | ||
645 | |||
646 | if (!mask) { | ||
647 | dev_printk(KERN_ERR, gdev, "no available native port\n"); | ||
648 | return -ENODEV; | ||
644 | } | 649 | } |
645 | 650 | ||
646 | return 0; | 651 | return 0; |
@@ -649,8 +654,7 @@ int ata_pci_init_native_host(struct ata_host *host, unsigned int port_mask) | |||
649 | /** | 654 | /** |
650 | * ata_pci_prepare_native_host - helper to prepare native PCI ATA host | 655 | * ata_pci_prepare_native_host - helper to prepare native PCI ATA host |
651 | * @pdev: target PCI device | 656 | * @pdev: target PCI device |
652 | * @ppi: array of port_info | 657 | * @ppi: array of port_info, must be enough for two ports |
653 | * @n_ports: number of ports to allocate | ||
654 | * @r_host: out argument for the initialized ATA host | 658 | * @r_host: out argument for the initialized ATA host |
655 | * | 659 | * |
656 | * Helper to allocate ATA host for @pdev, acquire all native PCI | 660 | * 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) | |||
664 | */ | 668 | */ |
665 | int ata_pci_prepare_native_host(struct pci_dev *pdev, | 669 | int ata_pci_prepare_native_host(struct pci_dev *pdev, |
666 | const struct ata_port_info * const * ppi, | 670 | const struct ata_port_info * const * ppi, |
667 | int n_ports, struct ata_host **r_host) | 671 | struct ata_host **r_host) |
668 | { | 672 | { |
669 | struct ata_host *host; | 673 | struct ata_host *host; |
670 | unsigned int port_mask; | ||
671 | int rc; | 674 | int rc; |
672 | 675 | ||
673 | if (!devres_open_group(&pdev->dev, NULL, GFP_KERNEL)) | 676 | if (!devres_open_group(&pdev->dev, NULL, GFP_KERNEL)) |
@@ -681,11 +684,7 @@ int ata_pci_prepare_native_host(struct pci_dev *pdev, | |||
681 | goto err_out; | 684 | goto err_out; |
682 | } | 685 | } |
683 | 686 | ||
684 | port_mask = ATA_PORT_PRIMARY; | 687 | rc = ata_pci_init_native_host(host); |
685 | if (n_ports > 1) | ||
686 | port_mask |= ATA_PORT_SECONDARY; | ||
687 | |||
688 | rc = ata_pci_init_native_host(host, port_mask); | ||
689 | if (rc) | 688 | if (rc) |
690 | goto err_out; | 689 | goto err_out; |
691 | 690 | ||
@@ -777,8 +776,11 @@ static int ata_init_legacy_port(struct ata_port *ap, | |||
777 | /* iomap cmd and ctl ports */ | 776 | /* iomap cmd and ctl ports */ |
778 | legacy_dr->cmd_addr[port_no] = ioport_map(cmd_port, 8); | 777 | legacy_dr->cmd_addr[port_no] = ioport_map(cmd_port, 8); |
779 | legacy_dr->ctl_addr[port_no] = ioport_map(ctl_port, 1); | 778 | legacy_dr->ctl_addr[port_no] = ioport_map(ctl_port, 1); |
780 | if (!legacy_dr->cmd_addr[port_no] || !legacy_dr->ctl_addr[port_no]) | 779 | if (!legacy_dr->cmd_addr[port_no] || !legacy_dr->ctl_addr[port_no]) { |
780 | dev_printk(KERN_WARNING, host->dev, | ||
781 | "failed to map cmd/ctl ports\n"); | ||
781 | return -ENOMEM; | 782 | return -ENOMEM; |
783 | } | ||
782 | 784 | ||
783 | /* init IO addresses */ | 785 | /* init IO addresses */ |
784 | ap->ioaddr.cmd_addr = legacy_dr->cmd_addr[port_no]; | 786 | ap->ioaddr.cmd_addr = legacy_dr->cmd_addr[port_no]; |
@@ -792,19 +794,20 @@ static int ata_init_legacy_port(struct ata_port *ap, | |||
792 | /** | 794 | /** |
793 | * ata_init_legacy_host - acquire legacy ATA resources and init ATA host | 795 | * ata_init_legacy_host - acquire legacy ATA resources and init ATA host |
794 | * @host: target ATA host | 796 | * @host: target ATA host |
795 | * @legacy_mask: out parameter, mask indicating ports is in legacy mode | ||
796 | * @was_busy: out parameter, indicates whether any port was busy | 797 | * @was_busy: out parameter, indicates whether any port was busy |
797 | * | 798 | * |
798 | * Acquire legacy ATA resources for ports. | 799 | * Acquire legacy ATA resources for the first two ports of @host |
800 | * and initialize it accordingly. Ports marked dummy are skipped | ||
801 | * and resource acquistion failure makes the port dummy. | ||
799 | * | 802 | * |
800 | * LOCKING: | 803 | * LOCKING: |
801 | * Inherited from calling layer (may sleep). | 804 | * Inherited from calling layer (may sleep). |
802 | * | 805 | * |
803 | * RETURNS: | 806 | * RETURNS: |
804 | * 0 on success, -errno otherwise. | 807 | * 0 if at least one port is initialized, -ENODEV if no port is |
808 | * available. | ||
805 | */ | 809 | */ |
806 | static int ata_init_legacy_host(struct ata_host *host, | 810 | static int ata_init_legacy_host(struct ata_host *host, int *was_busy) |
807 | unsigned int *legacy_mask, int *was_busy) | ||
808 | { | 811 | { |
809 | struct device *gdev = host->dev; | 812 | struct device *gdev = host->dev; |
810 | struct ata_legacy_devres *legacy_dr; | 813 | struct ata_legacy_devres *legacy_dr; |
@@ -821,22 +824,23 @@ static int ata_init_legacy_host(struct ata_host *host, | |||
821 | devres_add(gdev, legacy_dr); | 824 | devres_add(gdev, legacy_dr); |
822 | 825 | ||
823 | for (i = 0; i < 2; i++) { | 826 | for (i = 0; i < 2; i++) { |
824 | *legacy_mask &= ~(1 << i); | 827 | if (ata_port_is_dummy(host->ports[i])) |
828 | continue; | ||
829 | |||
825 | rc = ata_init_legacy_port(host->ports[i], legacy_dr); | 830 | rc = ata_init_legacy_port(host->ports[i], legacy_dr); |
826 | if (rc == 0) | 831 | if (rc == 0) |
827 | legacy_dr->mask |= 1 << i; | 832 | legacy_dr->mask |= 1 << i; |
828 | else if (rc == -EBUSY) | 833 | else { |
829 | (*was_busy)++; | 834 | if (rc == -EBUSY) |
830 | } | 835 | (*was_busy)++; |
831 | |||
832 | if (!legacy_dr->mask) | ||
833 | return -EBUSY; | ||
834 | |||
835 | for (i = 0; i < 2; i++) | ||
836 | if (!(legacy_dr->mask & (1 << i))) | ||
837 | host->ports[i]->ops = &ata_dummy_port_ops; | 836 | host->ports[i]->ops = &ata_dummy_port_ops; |
837 | } | ||
838 | } | ||
838 | 839 | ||
839 | *legacy_mask |= legacy_dr->mask; | 840 | if (!legacy_dr->mask) { |
841 | dev_printk(KERN_ERR, gdev, "no available legacy port\n"); | ||
842 | return -ENODEV; | ||
843 | } | ||
840 | 844 | ||
841 | devres_remove_group(gdev, NULL); | 845 | devres_remove_group(gdev, NULL); |
842 | return 0; | 846 | return 0; |
@@ -875,7 +879,7 @@ static int ata_request_legacy_irqs(struct ata_host *host, | |||
875 | legacy_dr = devres_find(host->dev, ata_legacy_release, NULL, NULL); | 879 | legacy_dr = devres_find(host->dev, ata_legacy_release, NULL, NULL); |
876 | BUG_ON(!legacy_dr); | 880 | BUG_ON(!legacy_dr); |
877 | 881 | ||
878 | for (i = 0; i < host->n_ports; i++) { | 882 | for (i = 0; i < 2; i++) { |
879 | unsigned int irq; | 883 | unsigned int irq; |
880 | 884 | ||
881 | /* FIXME: ATA_*_IRQ() should take generic device not pci_dev */ | 885 | /* FIXME: ATA_*_IRQ() should take generic device not pci_dev */ |
@@ -923,8 +927,7 @@ static int ata_request_legacy_irqs(struct ata_host *host, | |||
923 | /** | 927 | /** |
924 | * ata_pci_init_one - Initialize/register PCI IDE host controller | 928 | * ata_pci_init_one - Initialize/register PCI IDE host controller |
925 | * @pdev: Controller to be initialized | 929 | * @pdev: Controller to be initialized |
926 | * @port_info: Information from low-level host driver | 930 | * @ppi: array of port_info, must be enough for two ports |
927 | * @n_ports: Number of ports attached to host controller | ||
928 | * | 931 | * |
929 | * This is a helper function which can be called from a driver's | 932 | * This is a helper function which can be called from a driver's |
930 | * xxx_init_one() probe function if the hardware uses traditional | 933 | * xxx_init_one() probe function if the hardware uses traditional |
@@ -944,26 +947,34 @@ static int ata_request_legacy_irqs(struct ata_host *host, | |||
944 | * RETURNS: | 947 | * RETURNS: |
945 | * Zero on success, negative on errno-based value on error. | 948 | * Zero on success, negative on errno-based value on error. |
946 | */ | 949 | */ |
947 | 950 | int ata_pci_init_one(struct pci_dev *pdev, | |
948 | int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | 951 | const struct ata_port_info * const * ppi) |
949 | unsigned int n_ports) | ||
950 | { | 952 | { |
951 | struct device *dev = &pdev->dev; | 953 | struct device *dev = &pdev->dev; |
954 | const struct ata_port_info *pi = NULL; | ||
952 | struct ata_host *host = NULL; | 955 | struct ata_host *host = NULL; |
953 | const struct ata_port_info *port[2]; | ||
954 | u8 mask; | 956 | u8 mask; |
955 | unsigned int legacy_mode = 0; | 957 | int legacy_mode = 0; |
956 | int rc; | 958 | int i, rc; |
957 | 959 | ||
958 | DPRINTK("ENTER\n"); | 960 | DPRINTK("ENTER\n"); |
959 | 961 | ||
960 | if (!devres_open_group(dev, NULL, GFP_KERNEL)) | 962 | /* look up the first valid port_info */ |
961 | return -ENOMEM; | 963 | for (i = 0; i < 2 && ppi[i]; i++) { |
964 | if (ppi[i]->port_ops != &ata_dummy_port_ops) { | ||
965 | pi = ppi[i]; | ||
966 | break; | ||
967 | } | ||
968 | } | ||
962 | 969 | ||
963 | BUG_ON(n_ports < 1 || n_ports > 2); | 970 | if (!pi) { |
971 | dev_printk(KERN_ERR, &pdev->dev, | ||
972 | "no valid port_info specified\n"); | ||
973 | return -EINVAL; | ||
974 | } | ||
964 | 975 | ||
965 | port[0] = port_info[0]; | 976 | if (!devres_open_group(dev, NULL, GFP_KERNEL)) |
966 | port[1] = (n_ports > 1) ? port_info[1] : NULL; | 977 | return -ENOMEM; |
967 | 978 | ||
968 | /* FIXME: Really for ATA it isn't safe because the device may be | 979 | /* FIXME: Really for ATA it isn't safe because the device may be |
969 | multi-purpose and we want to leave it alone if it was already | 980 | 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, | |||
984 | pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8); | 995 | pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8); |
985 | mask = (1 << 2) | (1 << 0); | 996 | mask = (1 << 2) | (1 << 0); |
986 | if ((tmp8 & mask) != mask) | 997 | if ((tmp8 & mask) != mask) |
987 | legacy_mode = (1 << 3); | 998 | legacy_mode = 1; |
988 | #if defined(CONFIG_NO_ATA_LEGACY) | 999 | #if defined(CONFIG_NO_ATA_LEGACY) |
989 | /* Some platforms with PCI limits cannot address compat | 1000 | /* Some platforms with PCI limits cannot address compat |
990 | port space. In that case we punt if their firmware has | 1001 | 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, | |||
998 | } | 1009 | } |
999 | 1010 | ||
1000 | /* alloc and init host */ | 1011 | /* alloc and init host */ |
1001 | host = ata_host_alloc_pinfo(dev, port, n_ports); | 1012 | host = ata_host_alloc_pinfo(dev, ppi, 2); |
1002 | if (!host) { | 1013 | if (!host) { |
1003 | dev_printk(KERN_ERR, &pdev->dev, | 1014 | dev_printk(KERN_ERR, &pdev->dev, |
1004 | "failed to allocate ATA host\n"); | 1015 | "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, | |||
1007 | } | 1018 | } |
1008 | 1019 | ||
1009 | if (!legacy_mode) { | 1020 | if (!legacy_mode) { |
1010 | unsigned int port_mask; | 1021 | rc = ata_pci_init_native_host(host); |
1011 | |||
1012 | port_mask = ATA_PORT_PRIMARY; | ||
1013 | if (n_ports > 1) | ||
1014 | port_mask |= ATA_PORT_SECONDARY; | ||
1015 | |||
1016 | rc = ata_pci_init_native_host(host, port_mask); | ||
1017 | if (rc) | 1022 | if (rc) |
1018 | goto err_out; | 1023 | goto err_out; |
1019 | } else { | 1024 | } else { |
1020 | int was_busy = 0; | 1025 | int was_busy = 0; |
1021 | 1026 | ||
1022 | rc = ata_init_legacy_host(host, &legacy_mode, &was_busy); | 1027 | rc = ata_init_legacy_host(host, &was_busy); |
1023 | if (was_busy) | 1028 | if (was_busy) |
1024 | pcim_pin_device(pdev); | 1029 | pcim_pin_device(pdev); |
1025 | if (rc) | 1030 | if (rc) |
@@ -1040,8 +1045,7 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | |||
1040 | goto err_out; | 1045 | goto err_out; |
1041 | 1046 | ||
1042 | if (!legacy_mode) | 1047 | if (!legacy_mode) |
1043 | rc = devm_request_irq(dev, pdev->irq, | 1048 | rc = devm_request_irq(dev, pdev->irq, pi->port_ops->irq_handler, |
1044 | port_info[0]->port_ops->irq_handler, | ||
1045 | IRQF_SHARED, DRV_NAME, host); | 1049 | IRQF_SHARED, DRV_NAME, host); |
1046 | else { | 1050 | else { |
1047 | irq_handler_t handler[2] = { host->ops->irq_handler, | 1051 | 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, | |||
1055 | goto err_out; | 1059 | goto err_out; |
1056 | 1060 | ||
1057 | /* register */ | 1061 | /* register */ |
1058 | rc = ata_host_register(host, port_info[0]->sht); | 1062 | rc = ata_host_register(host, pi->sht); |
1059 | if (rc) | 1063 | if (rc) |
1060 | goto err_out; | 1064 | goto err_out; |
1061 | 1065 | ||
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 5f4d40cd3288..8b71b73a199c 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -58,6 +58,7 @@ extern int atapi_enabled; | |||
58 | extern int atapi_dmadir; | 58 | extern int atapi_dmadir; |
59 | extern int libata_fua; | 59 | extern int libata_fua; |
60 | extern int libata_noacpi; | 60 | extern int libata_noacpi; |
61 | extern int ata_spindown_compat; | ||
61 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev); | 62 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev); |
62 | extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, | 63 | extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, |
63 | u64 block, u32 n_block, unsigned int tf_flags, | 64 | u64 block, u32 n_block, unsigned int tf_flags, |
@@ -96,15 +97,15 @@ extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg); | |||
96 | extern struct ata_port *ata_port_alloc(struct ata_host *host); | 97 | extern struct ata_port *ata_port_alloc(struct ata_host *host); |
97 | 98 | ||
98 | /* libata-acpi.c */ | 99 | /* libata-acpi.c */ |
99 | #ifdef CONFIG_SATA_ACPI | 100 | #ifdef CONFIG_ATA_ACPI |
100 | extern int ata_acpi_exec_tfs(struct ata_port *ap); | 101 | extern int ata_acpi_exec_tfs(struct ata_port *ap); |
101 | extern int ata_acpi_push_id(struct ata_port *ap, unsigned int ix); | 102 | extern int ata_acpi_push_id(struct ata_device *dev); |
102 | #else | 103 | #else |
103 | static inline int ata_acpi_exec_tfs(struct ata_port *ap) | 104 | static inline int ata_acpi_exec_tfs(struct ata_port *ap) |
104 | { | 105 | { |
105 | return 0; | 106 | return 0; |
106 | } | 107 | } |
107 | static inline int ata_acpi_push_id(struct ata_port *ap, unsigned int ix) | 108 | static inline int ata_acpi_push_id(struct ata_device *dev) |
108 | { | 109 | { |
109 | return 0; | 110 | return 0; |
110 | } | 111 | } |
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c index d40edebb510a..3c55a5ff74c7 100644 --- a/drivers/ata/pata_ali.c +++ b/drivers/ata/pata_ali.c | |||
@@ -291,10 +291,6 @@ static struct scsi_host_template ali_sht = { | |||
291 | .slave_configure = ata_scsi_slave_config, | 291 | .slave_configure = ata_scsi_slave_config, |
292 | .slave_destroy = ata_scsi_slave_destroy, | 292 | .slave_destroy = ata_scsi_slave_destroy, |
293 | .bios_param = ata_std_bios_param, | 293 | .bios_param = ata_std_bios_param, |
294 | #ifdef CONFIG_PM | ||
295 | .resume = ata_scsi_device_resume, | ||
296 | .suspend = ata_scsi_device_suspend, | ||
297 | #endif | ||
298 | }; | 294 | }; |
299 | 295 | ||
300 | /* | 296 | /* |
@@ -522,14 +518,14 @@ static void ali_init_chipset(struct pci_dev *pdev) | |||
522 | 518 | ||
523 | static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 519 | static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
524 | { | 520 | { |
525 | static struct ata_port_info info_early = { | 521 | static const struct ata_port_info info_early = { |
526 | .sht = &ali_sht, | 522 | .sht = &ali_sht, |
527 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 523 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
528 | .pio_mask = 0x1f, | 524 | .pio_mask = 0x1f, |
529 | .port_ops = &ali_early_port_ops | 525 | .port_ops = &ali_early_port_ops |
530 | }; | 526 | }; |
531 | /* Revision 0x20 added DMA */ | 527 | /* Revision 0x20 added DMA */ |
532 | static struct ata_port_info info_20 = { | 528 | static const struct ata_port_info info_20 = { |
533 | .sht = &ali_sht, | 529 | .sht = &ali_sht, |
534 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, | 530 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, |
535 | .pio_mask = 0x1f, | 531 | .pio_mask = 0x1f, |
@@ -537,7 +533,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
537 | .port_ops = &ali_20_port_ops | 533 | .port_ops = &ali_20_port_ops |
538 | }; | 534 | }; |
539 | /* Revision 0x20 with support logic added UDMA */ | 535 | /* Revision 0x20 with support logic added UDMA */ |
540 | static struct ata_port_info info_20_udma = { | 536 | static const struct ata_port_info info_20_udma = { |
541 | .sht = &ali_sht, | 537 | .sht = &ali_sht, |
542 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, | 538 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, |
543 | .pio_mask = 0x1f, | 539 | .pio_mask = 0x1f, |
@@ -546,7 +542,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
546 | .port_ops = &ali_20_port_ops | 542 | .port_ops = &ali_20_port_ops |
547 | }; | 543 | }; |
548 | /* Revision 0xC2 adds UDMA66 */ | 544 | /* Revision 0xC2 adds UDMA66 */ |
549 | static struct ata_port_info info_c2 = { | 545 | static const struct ata_port_info info_c2 = { |
550 | .sht = &ali_sht, | 546 | .sht = &ali_sht, |
551 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, | 547 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, |
552 | .pio_mask = 0x1f, | 548 | .pio_mask = 0x1f, |
@@ -555,7 +551,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
555 | .port_ops = &ali_c2_port_ops | 551 | .port_ops = &ali_c2_port_ops |
556 | }; | 552 | }; |
557 | /* Revision 0xC3 is UDMA100 */ | 553 | /* Revision 0xC3 is UDMA100 */ |
558 | static struct ata_port_info info_c3 = { | 554 | static const struct ata_port_info info_c3 = { |
559 | .sht = &ali_sht, | 555 | .sht = &ali_sht, |
560 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, | 556 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, |
561 | .pio_mask = 0x1f, | 557 | .pio_mask = 0x1f, |
@@ -564,7 +560,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
564 | .port_ops = &ali_c2_port_ops | 560 | .port_ops = &ali_c2_port_ops |
565 | }; | 561 | }; |
566 | /* Revision 0xC4 is UDMA133 */ | 562 | /* Revision 0xC4 is UDMA133 */ |
567 | static struct ata_port_info info_c4 = { | 563 | static const struct ata_port_info info_c4 = { |
568 | .sht = &ali_sht, | 564 | .sht = &ali_sht, |
569 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, | 565 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, |
570 | .pio_mask = 0x1f, | 566 | .pio_mask = 0x1f, |
@@ -573,7 +569,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
573 | .port_ops = &ali_c2_port_ops | 569 | .port_ops = &ali_c2_port_ops |
574 | }; | 570 | }; |
575 | /* Revision 0xC5 is UDMA133 with LBA48 DMA */ | 571 | /* Revision 0xC5 is UDMA133 with LBA48 DMA */ |
576 | static struct ata_port_info info_c5 = { | 572 | static const struct ata_port_info info_c5 = { |
577 | .sht = &ali_sht, | 573 | .sht = &ali_sht, |
578 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 574 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
579 | .pio_mask = 0x1f, | 575 | .pio_mask = 0x1f, |
@@ -582,7 +578,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
582 | .port_ops = &ali_c5_port_ops | 578 | .port_ops = &ali_c5_port_ops |
583 | }; | 579 | }; |
584 | 580 | ||
585 | static struct ata_port_info *port_info[2]; | 581 | const struct ata_port_info *ppi[] = { NULL, NULL }; |
586 | u8 rev, tmp; | 582 | u8 rev, tmp; |
587 | struct pci_dev *isa_bridge; | 583 | struct pci_dev *isa_bridge; |
588 | 584 | ||
@@ -594,17 +590,17 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
594 | */ | 590 | */ |
595 | 591 | ||
596 | if (rev < 0x20) { | 592 | if (rev < 0x20) { |
597 | port_info[0] = port_info[1] = &info_early; | 593 | ppi[0] = &info_early; |
598 | } else if (rev < 0xC2) { | 594 | } else if (rev < 0xC2) { |
599 | port_info[0] = port_info[1] = &info_20; | 595 | ppi[0] = &info_20; |
600 | } else if (rev == 0xC2) { | 596 | } else if (rev == 0xC2) { |
601 | port_info[0] = port_info[1] = &info_c2; | 597 | ppi[0] = &info_c2; |
602 | } else if (rev == 0xC3) { | 598 | } else if (rev == 0xC3) { |
603 | port_info[0] = port_info[1] = &info_c3; | 599 | ppi[0] = &info_c3; |
604 | } else if (rev == 0xC4) { | 600 | } else if (rev == 0xC4) { |
605 | port_info[0] = port_info[1] = &info_c4; | 601 | ppi[0] = &info_c4; |
606 | } else | 602 | } else |
607 | port_info[0] = port_info[1] = &info_c5; | 603 | ppi[0] = &info_c5; |
608 | 604 | ||
609 | ali_init_chipset(pdev); | 605 | ali_init_chipset(pdev); |
610 | 606 | ||
@@ -613,10 +609,10 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
613 | /* Are we paired with a UDMA capable chip */ | 609 | /* Are we paired with a UDMA capable chip */ |
614 | pci_read_config_byte(isa_bridge, 0x5E, &tmp); | 610 | pci_read_config_byte(isa_bridge, 0x5E, &tmp); |
615 | if ((tmp & 0x1E) == 0x12) | 611 | if ((tmp & 0x1E) == 0x12) |
616 | port_info[0] = port_info[1] = &info_20_udma; | 612 | ppi[0] = &info_20_udma; |
617 | pci_dev_put(isa_bridge); | 613 | pci_dev_put(isa_bridge); |
618 | } | 614 | } |
619 | return ata_pci_init_one(pdev, port_info, 2); | 615 | return ata_pci_init_one(pdev, ppi); |
620 | } | 616 | } |
621 | 617 | ||
622 | #ifdef CONFIG_PM | 618 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c index 67c7e87dec04..b439351f1fd3 100644 --- a/drivers/ata/pata_amd.c +++ b/drivers/ata/pata_amd.c | |||
@@ -324,10 +324,6 @@ static struct scsi_host_template amd_sht = { | |||
324 | .slave_configure = ata_scsi_slave_config, | 324 | .slave_configure = ata_scsi_slave_config, |
325 | .slave_destroy = ata_scsi_slave_destroy, | 325 | .slave_destroy = ata_scsi_slave_destroy, |
326 | .bios_param = ata_std_bios_param, | 326 | .bios_param = ata_std_bios_param, |
327 | #ifdef CONFIG_PM | ||
328 | .resume = ata_scsi_device_resume, | ||
329 | .suspend = ata_scsi_device_suspend, | ||
330 | #endif | ||
331 | }; | 327 | }; |
332 | 328 | ||
333 | static struct ata_port_operations amd33_port_ops = { | 329 | static struct ata_port_operations amd33_port_ops = { |
@@ -542,7 +538,7 @@ static struct ata_port_operations nv133_port_ops = { | |||
542 | 538 | ||
543 | static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 539 | static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
544 | { | 540 | { |
545 | static struct ata_port_info info[10] = { | 541 | static const struct ata_port_info info[10] = { |
546 | { /* 0: AMD 7401 */ | 542 | { /* 0: AMD 7401 */ |
547 | .sht = &amd_sht, | 543 | .sht = &amd_sht, |
548 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 544 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
@@ -624,7 +620,7 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
624 | .port_ops = &amd100_port_ops | 620 | .port_ops = &amd100_port_ops |
625 | } | 621 | } |
626 | }; | 622 | }; |
627 | static struct ata_port_info *port_info[2]; | 623 | const struct ata_port_info *ppi[] = { NULL, NULL }; |
628 | static int printed_version; | 624 | static int printed_version; |
629 | int type = id->driver_data; | 625 | int type = id->driver_data; |
630 | u8 rev; | 626 | u8 rev; |
@@ -656,9 +652,8 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
656 | ata_pci_clear_simplex(pdev); | 652 | ata_pci_clear_simplex(pdev); |
657 | 653 | ||
658 | /* And fire it up */ | 654 | /* And fire it up */ |
659 | 655 | ppi[0] = &info[type]; | |
660 | port_info[0] = port_info[1] = &info[type]; | 656 | return ata_pci_init_one(pdev, ppi); |
661 | return ata_pci_init_one(pdev, port_info, 2); | ||
662 | } | 657 | } |
663 | 658 | ||
664 | #ifdef CONFIG_PM | 659 | #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 = { | |||
414 | static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | 414 | static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) |
415 | { | 415 | { |
416 | static int printed_version; | 416 | static int printed_version; |
417 | static struct ata_port_info info_6210 = { | 417 | static const struct ata_port_info info_6210 = { |
418 | .sht = &artop_sht, | 418 | .sht = &artop_sht, |
419 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 419 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
420 | .pio_mask = 0x1f, /* pio0-4 */ | 420 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -422,7 +422,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
422 | .udma_mask = ATA_UDMA2, | 422 | .udma_mask = ATA_UDMA2, |
423 | .port_ops = &artop6210_ops, | 423 | .port_ops = &artop6210_ops, |
424 | }; | 424 | }; |
425 | static struct ata_port_info info_626x = { | 425 | static const struct ata_port_info info_626x = { |
426 | .sht = &artop_sht, | 426 | .sht = &artop_sht, |
427 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 427 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
428 | .pio_mask = 0x1f, /* pio0-4 */ | 428 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -430,7 +430,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
430 | .udma_mask = ATA_UDMA4, | 430 | .udma_mask = ATA_UDMA4, |
431 | .port_ops = &artop6260_ops, | 431 | .port_ops = &artop6260_ops, |
432 | }; | 432 | }; |
433 | static struct ata_port_info info_626x_fast = { | 433 | static const struct ata_port_info info_626x_fast = { |
434 | .sht = &artop_sht, | 434 | .sht = &artop_sht, |
435 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 435 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
436 | .pio_mask = 0x1f, /* pio0-4 */ | 436 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -438,32 +438,30 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
438 | .udma_mask = ATA_UDMA5, | 438 | .udma_mask = ATA_UDMA5, |
439 | .port_ops = &artop6260_ops, | 439 | .port_ops = &artop6260_ops, |
440 | }; | 440 | }; |
441 | struct ata_port_info *port_info[2]; | 441 | const struct ata_port_info *ppi[] = { NULL, NULL }; |
442 | struct ata_port_info *info = NULL; | ||
443 | int ports = 2; | ||
444 | 442 | ||
445 | if (!printed_version++) | 443 | if (!printed_version++) |
446 | dev_printk(KERN_DEBUG, &pdev->dev, | 444 | dev_printk(KERN_DEBUG, &pdev->dev, |
447 | "version " DRV_VERSION "\n"); | 445 | "version " DRV_VERSION "\n"); |
448 | 446 | ||
449 | if (id->driver_data == 0) { /* 6210 variant */ | 447 | if (id->driver_data == 0) { /* 6210 variant */ |
450 | info = &info_6210; | 448 | ppi[0] = &info_6210; |
449 | ppi[1] = &ata_dummy_port_info; | ||
451 | /* BIOS may have left us in UDMA, clear it before libata probe */ | 450 | /* BIOS may have left us in UDMA, clear it before libata probe */ |
452 | pci_write_config_byte(pdev, 0x54, 0); | 451 | pci_write_config_byte(pdev, 0x54, 0); |
453 | /* For the moment (also lacks dsc) */ | 452 | /* For the moment (also lacks dsc) */ |
454 | printk(KERN_WARNING "ARTOP 6210 requires serialize functionality not yet supported by libata.\n"); | 453 | printk(KERN_WARNING "ARTOP 6210 requires serialize functionality not yet supported by libata.\n"); |
455 | printk(KERN_WARNING "Secondary ATA ports will not be activated.\n"); | 454 | printk(KERN_WARNING "Secondary ATA ports will not be activated.\n"); |
456 | ports = 1; | ||
457 | } | 455 | } |
458 | else if (id->driver_data == 1) /* 6260 */ | 456 | else if (id->driver_data == 1) /* 6260 */ |
459 | info = &info_626x; | 457 | ppi[0] = &info_626x; |
460 | else if (id->driver_data == 2) { /* 6260 or 6260 + fast */ | 458 | else if (id->driver_data == 2) { /* 6260 or 6260 + fast */ |
461 | unsigned long io = pci_resource_start(pdev, 4); | 459 | unsigned long io = pci_resource_start(pdev, 4); |
462 | u8 reg; | 460 | u8 reg; |
463 | 461 | ||
464 | info = &info_626x; | 462 | ppi[0] = &info_626x; |
465 | if (inb(io) & 0x10) | 463 | if (inb(io) & 0x10) |
466 | info = &info_626x_fast; | 464 | ppi[0] = &info_626x_fast; |
467 | /* Mac systems come up with some registers not set as we | 465 | /* Mac systems come up with some registers not set as we |
468 | will need them */ | 466 | will need them */ |
469 | 467 | ||
@@ -484,10 +482,9 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
484 | 482 | ||
485 | } | 483 | } |
486 | 484 | ||
487 | BUG_ON(info == NULL); | 485 | BUG_ON(ppi[0] == NULL); |
488 | 486 | ||
489 | port_info[0] = port_info[1] = info; | 487 | return ata_pci_init_one(pdev, ppi); |
490 | return ata_pci_init_one(pdev, port_info, ports); | ||
491 | } | 488 | } |
492 | 489 | ||
493 | static const struct pci_device_id artop_pci_tbl[] = { | 490 | static const struct pci_device_id artop_pci_tbl[] = { |
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c index 21515381b5b3..844914681a2a 100644 --- a/drivers/ata/pata_atiixp.c +++ b/drivers/ata/pata_atiixp.c | |||
@@ -229,10 +229,6 @@ static struct scsi_host_template atiixp_sht = { | |||
229 | .slave_configure = ata_scsi_slave_config, | 229 | .slave_configure = ata_scsi_slave_config, |
230 | .slave_destroy = ata_scsi_slave_destroy, | 230 | .slave_destroy = ata_scsi_slave_destroy, |
231 | .bios_param = ata_std_bios_param, | 231 | .bios_param = ata_std_bios_param, |
232 | #ifdef CONFIG_PM | ||
233 | .resume = ata_scsi_device_resume, | ||
234 | .suspend = ata_scsi_device_suspend, | ||
235 | #endif | ||
236 | }; | 232 | }; |
237 | 233 | ||
238 | static struct ata_port_operations atiixp_port_ops = { | 234 | static struct ata_port_operations atiixp_port_ops = { |
@@ -272,7 +268,7 @@ static struct ata_port_operations atiixp_port_ops = { | |||
272 | 268 | ||
273 | static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 269 | static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
274 | { | 270 | { |
275 | static struct ata_port_info info = { | 271 | static const struct ata_port_info info = { |
276 | .sht = &atiixp_sht, | 272 | .sht = &atiixp_sht, |
277 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 273 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
278 | .pio_mask = 0x1f, | 274 | .pio_mask = 0x1f, |
@@ -280,8 +276,8 @@ static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
280 | .udma_mask = 0x3F, | 276 | .udma_mask = 0x3F, |
281 | .port_ops = &atiixp_port_ops | 277 | .port_ops = &atiixp_port_ops |
282 | }; | 278 | }; |
283 | static struct ata_port_info *port_info[2] = { &info, &info }; | 279 | const struct ata_port_info *ppi[] = { &info, NULL }; |
284 | return ata_pci_init_one(dev, port_info, 2); | 280 | return ata_pci_init_one(dev, ppi); |
285 | } | 281 | } |
286 | 282 | ||
287 | static const struct pci_device_id atiixp[] = { | 283 | static const struct pci_device_id atiixp[] = { |
diff --git a/drivers/ata/pata_cmd640.c b/drivers/ata/pata_cmd640.c index 2105985a8013..ed00fa9d53be 100644 --- a/drivers/ata/pata_cmd640.c +++ b/drivers/ata/pata_cmd640.c | |||
@@ -181,10 +181,6 @@ static struct scsi_host_template cmd640_sht = { | |||
181 | .slave_configure = ata_scsi_slave_config, | 181 | .slave_configure = ata_scsi_slave_config, |
182 | .slave_destroy = ata_scsi_slave_destroy, | 182 | .slave_destroy = ata_scsi_slave_destroy, |
183 | .bios_param = ata_std_bios_param, | 183 | .bios_param = ata_std_bios_param, |
184 | #ifdef CONFIG_PM | ||
185 | .resume = ata_scsi_device_resume, | ||
186 | .suspend = ata_scsi_device_suspend, | ||
187 | #endif | ||
188 | }; | 184 | }; |
189 | 185 | ||
190 | static struct ata_port_operations cmd640_port_ops = { | 186 | static struct ata_port_operations cmd640_port_ops = { |
@@ -253,17 +249,16 @@ static void cmd640_hardware_init(struct pci_dev *pdev) | |||
253 | 249 | ||
254 | static int cmd640_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 250 | static int cmd640_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
255 | { | 251 | { |
256 | static struct ata_port_info info = { | 252 | static const struct ata_port_info info = { |
257 | .sht = &cmd640_sht, | 253 | .sht = &cmd640_sht, |
258 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 254 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
259 | .pio_mask = 0x1f, | 255 | .pio_mask = 0x1f, |
260 | .port_ops = &cmd640_port_ops | 256 | .port_ops = &cmd640_port_ops |
261 | }; | 257 | }; |
262 | 258 | const struct ata_port_info *ppi[] = { &info, NULL }; | |
263 | static struct ata_port_info *port_info[2] = { &info, &info }; | ||
264 | 259 | ||
265 | cmd640_hardware_init(pdev); | 260 | cmd640_hardware_init(pdev); |
266 | return ata_pci_init_one(pdev, port_info, 2); | 261 | return ata_pci_init_one(pdev, ppi); |
267 | } | 262 | } |
268 | 263 | ||
269 | static int cmd640_reinit_one(struct pci_dev *pdev) | 264 | static int cmd640_reinit_one(struct pci_dev *pdev) |
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c index 3989cc577fcd..2a79b335cfcc 100644 --- a/drivers/ata/pata_cmd64x.c +++ b/drivers/ata/pata_cmd64x.c | |||
@@ -266,10 +266,6 @@ static struct scsi_host_template cmd64x_sht = { | |||
266 | .slave_configure = ata_scsi_slave_config, | 266 | .slave_configure = ata_scsi_slave_config, |
267 | .slave_destroy = ata_scsi_slave_destroy, | 267 | .slave_destroy = ata_scsi_slave_destroy, |
268 | .bios_param = ata_std_bios_param, | 268 | .bios_param = ata_std_bios_param, |
269 | #ifdef CONFIG_PM | ||
270 | .resume = ata_scsi_device_resume, | ||
271 | .suspend = ata_scsi_device_suspend, | ||
272 | #endif | ||
273 | }; | 269 | }; |
274 | 270 | ||
275 | static struct ata_port_operations cmd64x_port_ops = { | 271 | static struct ata_port_operations cmd64x_port_ops = { |
@@ -381,7 +377,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
381 | { | 377 | { |
382 | u32 class_rev; | 378 | u32 class_rev; |
383 | 379 | ||
384 | static struct ata_port_info cmd_info[6] = { | 380 | static const struct ata_port_info cmd_info[6] = { |
385 | { /* CMD 643 - no UDMA */ | 381 | { /* CMD 643 - no UDMA */ |
386 | .sht = &cmd64x_sht, | 382 | .sht = &cmd64x_sht, |
387 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 383 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
@@ -428,11 +424,9 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
428 | .port_ops = &cmd648_port_ops | 424 | .port_ops = &cmd648_port_ops |
429 | } | 425 | } |
430 | }; | 426 | }; |
431 | static struct ata_port_info *port_info[2], *info; | 427 | const struct ata_port_info *ppi[] = { &cmd_info[id->driver_data], NULL }; |
432 | u8 mrdmode; | 428 | u8 mrdmode; |
433 | 429 | ||
434 | info = &cmd_info[id->driver_data]; | ||
435 | |||
436 | pci_read_config_dword(pdev, PCI_CLASS_REVISION, &class_rev); | 430 | pci_read_config_dword(pdev, PCI_CLASS_REVISION, &class_rev); |
437 | class_rev &= 0xFF; | 431 | class_rev &= 0xFF; |
438 | 432 | ||
@@ -442,10 +436,10 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
442 | if (pdev->device == PCI_DEVICE_ID_CMD_646) { | 436 | if (pdev->device == PCI_DEVICE_ID_CMD_646) { |
443 | /* Does UDMA work ? */ | 437 | /* Does UDMA work ? */ |
444 | if (class_rev > 4) | 438 | if (class_rev > 4) |
445 | info = &cmd_info[2]; | 439 | ppi[0] = &cmd_info[2]; |
446 | /* Early rev with other problems ? */ | 440 | /* Early rev with other problems ? */ |
447 | else if (class_rev == 1) | 441 | else if (class_rev == 1) |
448 | info = &cmd_info[3]; | 442 | ppi[0] = &cmd_info[3]; |
449 | } | 443 | } |
450 | 444 | ||
451 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 64); | 445 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 64); |
@@ -461,8 +455,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
461 | pci_write_config_byte(pdev, UDIDETCR0, 0xF0); | 455 | pci_write_config_byte(pdev, UDIDETCR0, 0xF0); |
462 | #endif | 456 | #endif |
463 | 457 | ||
464 | port_info[0] = port_info[1] = info; | 458 | return ata_pci_init_one(pdev, ppi); |
465 | return ata_pci_init_one(pdev, port_info, 2); | ||
466 | } | 459 | } |
467 | 460 | ||
468 | #ifdef CONFIG_PM | 461 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c index 79bef0d1fad3..83bcc5b32597 100644 --- a/drivers/ata/pata_cs5520.c +++ b/drivers/ata/pata_cs5520.c | |||
@@ -155,10 +155,6 @@ static struct scsi_host_template cs5520_sht = { | |||
155 | .slave_configure = ata_scsi_slave_config, | 155 | .slave_configure = ata_scsi_slave_config, |
156 | .slave_destroy = ata_scsi_slave_destroy, | 156 | .slave_destroy = ata_scsi_slave_destroy, |
157 | .bios_param = ata_std_bios_param, | 157 | .bios_param = ata_std_bios_param, |
158 | #ifdef CONFIG_PM | ||
159 | .resume = ata_scsi_device_resume, | ||
160 | .suspend = ata_scsi_device_suspend, | ||
161 | #endif | ||
162 | }; | 158 | }; |
163 | 159 | ||
164 | static struct ata_port_operations cs5520_port_ops = { | 160 | static struct ata_port_operations cs5520_port_ops = { |
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c index 29642d5ee189..1b67923d7a4e 100644 --- a/drivers/ata/pata_cs5530.c +++ b/drivers/ata/pata_cs5530.c | |||
@@ -176,10 +176,6 @@ static struct scsi_host_template cs5530_sht = { | |||
176 | .slave_configure = ata_scsi_slave_config, | 176 | .slave_configure = ata_scsi_slave_config, |
177 | .slave_destroy = ata_scsi_slave_destroy, | 177 | .slave_destroy = ata_scsi_slave_destroy, |
178 | .bios_param = ata_std_bios_param, | 178 | .bios_param = ata_std_bios_param, |
179 | #ifdef CONFIG_PM | ||
180 | .resume = ata_scsi_device_resume, | ||
181 | .suspend = ata_scsi_device_suspend, | ||
182 | #endif | ||
183 | }; | 179 | }; |
184 | 180 | ||
185 | static struct ata_port_operations cs5530_port_ops = { | 181 | static struct ata_port_operations cs5530_port_ops = { |
@@ -339,7 +335,7 @@ fail_put: | |||
339 | 335 | ||
340 | static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 336 | static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
341 | { | 337 | { |
342 | static struct ata_port_info info = { | 338 | static const struct ata_port_info info = { |
343 | .sht = &cs5530_sht, | 339 | .sht = &cs5530_sht, |
344 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 340 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
345 | .pio_mask = 0x1f, | 341 | .pio_mask = 0x1f, |
@@ -348,23 +344,23 @@ static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
348 | .port_ops = &cs5530_port_ops | 344 | .port_ops = &cs5530_port_ops |
349 | }; | 345 | }; |
350 | /* The docking connector doesn't do UDMA, and it seems not MWDMA */ | 346 | /* The docking connector doesn't do UDMA, and it seems not MWDMA */ |
351 | static struct ata_port_info info_palmax_secondary = { | 347 | static const struct ata_port_info info_palmax_secondary = { |
352 | .sht = &cs5530_sht, | 348 | .sht = &cs5530_sht, |
353 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 349 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
354 | .pio_mask = 0x1f, | 350 | .pio_mask = 0x1f, |
355 | .port_ops = &cs5530_port_ops | 351 | .port_ops = &cs5530_port_ops |
356 | }; | 352 | }; |
357 | static struct ata_port_info *port_info[2] = { &info, &info }; | 353 | const struct ata_port_info *ppi[] = { &info, NULL }; |
358 | 354 | ||
359 | /* Chip initialisation */ | 355 | /* Chip initialisation */ |
360 | if (cs5530_init_chip()) | 356 | if (cs5530_init_chip()) |
361 | return -ENODEV; | 357 | return -ENODEV; |
362 | 358 | ||
363 | if (cs5530_is_palmax()) | 359 | if (cs5530_is_palmax()) |
364 | port_info[1] = &info_palmax_secondary; | 360 | ppi[1] = &info_palmax_secondary; |
365 | 361 | ||
366 | /* Now kick off ATA set up */ | 362 | /* Now kick off ATA set up */ |
367 | return ata_pci_init_one(pdev, port_info, 2); | 363 | return ata_pci_init_one(pdev, ppi); |
368 | } | 364 | } |
369 | 365 | ||
370 | #ifdef CONFIG_PM | 366 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_cs5535.c b/drivers/ata/pata_cs5535.c index 22006ae71941..f37d4cd812a1 100644 --- a/drivers/ata/pata_cs5535.c +++ b/drivers/ata/pata_cs5535.c | |||
@@ -173,10 +173,6 @@ static struct scsi_host_template cs5535_sht = { | |||
173 | .slave_configure = ata_scsi_slave_config, | 173 | .slave_configure = ata_scsi_slave_config, |
174 | .slave_destroy = ata_scsi_slave_destroy, | 174 | .slave_destroy = ata_scsi_slave_destroy, |
175 | .bios_param = ata_std_bios_param, | 175 | .bios_param = ata_std_bios_param, |
176 | #ifdef CONFIG_PM | ||
177 | .resume = ata_scsi_device_resume, | ||
178 | .suspend = ata_scsi_device_suspend, | ||
179 | #endif | ||
180 | }; | 176 | }; |
181 | 177 | ||
182 | static struct ata_port_operations cs5535_port_ops = { | 178 | static struct ata_port_operations cs5535_port_ops = { |
@@ -227,7 +223,7 @@ static struct ata_port_operations cs5535_port_ops = { | |||
227 | 223 | ||
228 | static int cs5535_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 224 | static int cs5535_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
229 | { | 225 | { |
230 | static struct ata_port_info info = { | 226 | static const struct ata_port_info info = { |
231 | .sht = &cs5535_sht, | 227 | .sht = &cs5535_sht, |
232 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 228 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
233 | .pio_mask = 0x1f, | 229 | .pio_mask = 0x1f, |
@@ -235,7 +231,7 @@ static int cs5535_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
235 | .udma_mask = 0x1f, | 231 | .udma_mask = 0x1f, |
236 | .port_ops = &cs5535_port_ops | 232 | .port_ops = &cs5535_port_ops |
237 | }; | 233 | }; |
238 | struct ata_port_info *ports[1] = { &info }; | 234 | const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; |
239 | 235 | ||
240 | u32 timings, dummy; | 236 | u32 timings, dummy; |
241 | 237 | ||
@@ -247,7 +243,7 @@ static int cs5535_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
247 | rdmsr(ATAC_CH0D1_PIO, timings, dummy); | 243 | rdmsr(ATAC_CH0D1_PIO, timings, dummy); |
248 | if (CS5535_BAD_PIO(timings)) | 244 | if (CS5535_BAD_PIO(timings)) |
249 | wrmsr(ATAC_CH0D1_PIO, 0xF7F4F7F4UL, 0); | 245 | wrmsr(ATAC_CH0D1_PIO, 0xF7F4F7F4UL, 0); |
250 | return ata_pci_init_one(dev, ports, 1); | 246 | return ata_pci_init_one(dev, ppi); |
251 | } | 247 | } |
252 | 248 | ||
253 | static const struct pci_device_id cs5535[] = { | 249 | static const struct pci_device_id cs5535[] = { |
diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c index 6ec049c3b1dc..27b9f29c01e3 100644 --- a/drivers/ata/pata_cypress.c +++ b/drivers/ata/pata_cypress.c | |||
@@ -125,10 +125,6 @@ static struct scsi_host_template cy82c693_sht = { | |||
125 | .slave_configure = ata_scsi_slave_config, | 125 | .slave_configure = ata_scsi_slave_config, |
126 | .slave_destroy = ata_scsi_slave_destroy, | 126 | .slave_destroy = ata_scsi_slave_destroy, |
127 | .bios_param = ata_std_bios_param, | 127 | .bios_param = ata_std_bios_param, |
128 | #ifdef CONFIG_PM | ||
129 | .resume = ata_scsi_device_resume, | ||
130 | .suspend = ata_scsi_device_suspend, | ||
131 | #endif | ||
132 | }; | 128 | }; |
133 | 129 | ||
134 | static struct ata_port_operations cy82c693_port_ops = { | 130 | static struct ata_port_operations cy82c693_port_ops = { |
@@ -169,14 +165,14 @@ static struct ata_port_operations cy82c693_port_ops = { | |||
169 | 165 | ||
170 | static int cy82c693_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 166 | static int cy82c693_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
171 | { | 167 | { |
172 | static struct ata_port_info info = { | 168 | static const struct ata_port_info info = { |
173 | .sht = &cy82c693_sht, | 169 | .sht = &cy82c693_sht, |
174 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 170 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
175 | .pio_mask = 0x1f, | 171 | .pio_mask = 0x1f, |
176 | .mwdma_mask = 0x07, | 172 | .mwdma_mask = 0x07, |
177 | .port_ops = &cy82c693_port_ops | 173 | .port_ops = &cy82c693_port_ops |
178 | }; | 174 | }; |
179 | static struct ata_port_info *port_info[1] = { &info }; | 175 | const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; |
180 | 176 | ||
181 | /* Devfn 1 is the ATA primary. The secondary is magic and on devfn2. | 177 | /* Devfn 1 is the ATA primary. The secondary is magic and on devfn2. |
182 | For the moment we don't handle the secondary. FIXME */ | 178 | For the moment we don't handle the secondary. FIXME */ |
@@ -184,7 +180,7 @@ static int cy82c693_init_one(struct pci_dev *pdev, const struct pci_device_id *i | |||
184 | if (PCI_FUNC(pdev->devfn) != 1) | 180 | if (PCI_FUNC(pdev->devfn) != 1) |
185 | return -ENODEV; | 181 | return -ENODEV; |
186 | 182 | ||
187 | return ata_pci_init_one(pdev, port_info, 1); | 183 | return ata_pci_init_one(pdev, ppi); |
188 | } | 184 | } |
189 | 185 | ||
190 | static const struct pci_device_id cy82c693[] = { | 186 | static const struct pci_device_id cy82c693[] = { |
diff --git a/drivers/ata/pata_efar.c b/drivers/ata/pata_efar.c index d0f52e034906..079248a9b460 100644 --- a/drivers/ata/pata_efar.c +++ b/drivers/ata/pata_efar.c | |||
@@ -247,10 +247,6 @@ static struct scsi_host_template efar_sht = { | |||
247 | .slave_configure = ata_scsi_slave_config, | 247 | .slave_configure = ata_scsi_slave_config, |
248 | .slave_destroy = ata_scsi_slave_destroy, | 248 | .slave_destroy = ata_scsi_slave_destroy, |
249 | .bios_param = ata_std_bios_param, | 249 | .bios_param = ata_std_bios_param, |
250 | #ifdef CONFIG_PM | ||
251 | .resume = ata_scsi_device_resume, | ||
252 | .suspend = ata_scsi_device_suspend, | ||
253 | #endif | ||
254 | }; | 250 | }; |
255 | 251 | ||
256 | static const struct ata_port_operations efar_ops = { | 252 | static const struct ata_port_operations efar_ops = { |
@@ -305,7 +301,7 @@ static const struct ata_port_operations efar_ops = { | |||
305 | static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 301 | static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
306 | { | 302 | { |
307 | static int printed_version; | 303 | static int printed_version; |
308 | static struct ata_port_info info = { | 304 | static const struct ata_port_info info = { |
309 | .sht = &efar_sht, | 305 | .sht = &efar_sht, |
310 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 306 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
311 | .pio_mask = 0x1f, /* pio0-4 */ | 307 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -313,13 +309,13 @@ static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
313 | .udma_mask = 0x0f, /* UDMA 66 */ | 309 | .udma_mask = 0x0f, /* UDMA 66 */ |
314 | .port_ops = &efar_ops, | 310 | .port_ops = &efar_ops, |
315 | }; | 311 | }; |
316 | static struct ata_port_info *port_info[2] = { &info, &info }; | 312 | const struct ata_port_info *ppi[] = { &info, NULL }; |
317 | 313 | ||
318 | if (!printed_version++) | 314 | if (!printed_version++) |
319 | dev_printk(KERN_DEBUG, &pdev->dev, | 315 | dev_printk(KERN_DEBUG, &pdev->dev, |
320 | "version " DRV_VERSION "\n"); | 316 | "version " DRV_VERSION "\n"); |
321 | 317 | ||
322 | return ata_pci_init_one(pdev, port_info, 2); | 318 | return ata_pci_init_one(pdev, ppi); |
323 | } | 319 | } |
324 | 320 | ||
325 | static const struct pci_device_id efar_pci_tbl[] = { | 321 | static const struct pci_device_id efar_pci_tbl[] = { |
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c index e64e05e5c7fe..c6c8a8bb06d0 100644 --- a/drivers/ata/pata_hpt366.c +++ b/drivers/ata/pata_hpt366.c | |||
@@ -331,10 +331,6 @@ static struct scsi_host_template hpt36x_sht = { | |||
331 | .slave_configure = ata_scsi_slave_config, | 331 | .slave_configure = ata_scsi_slave_config, |
332 | .slave_destroy = ata_scsi_slave_destroy, | 332 | .slave_destroy = ata_scsi_slave_destroy, |
333 | .bios_param = ata_std_bios_param, | 333 | .bios_param = ata_std_bios_param, |
334 | #ifdef CONFIG_PM | ||
335 | .resume = ata_scsi_device_resume, | ||
336 | .suspend = ata_scsi_device_suspend, | ||
337 | #endif | ||
338 | }; | 334 | }; |
339 | 335 | ||
340 | /* | 336 | /* |
@@ -421,7 +417,7 @@ static void hpt36x_init_chipset(struct pci_dev *dev) | |||
421 | 417 | ||
422 | static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 418 | static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
423 | { | 419 | { |
424 | static struct ata_port_info info_hpt366 = { | 420 | static const struct ata_port_info info_hpt366 = { |
425 | .sht = &hpt36x_sht, | 421 | .sht = &hpt36x_sht, |
426 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 422 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
427 | .pio_mask = 0x1f, | 423 | .pio_mask = 0x1f, |
@@ -429,7 +425,8 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
429 | .udma_mask = 0x1f, | 425 | .udma_mask = 0x1f, |
430 | .port_ops = &hpt366_port_ops | 426 | .port_ops = &hpt366_port_ops |
431 | }; | 427 | }; |
432 | struct ata_port_info *port_info[2] = {&info_hpt366, &info_hpt366}; | 428 | struct ata_port_info info = info_hpt366; |
429 | const struct ata_port_info *ppi[] = { &info, NULL }; | ||
433 | 430 | ||
434 | u32 class_rev; | 431 | u32 class_rev; |
435 | u32 reg1; | 432 | u32 reg1; |
@@ -450,17 +447,17 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
450 | /* info_hpt366 is safe against re-entry so we can scribble on it */ | 447 | /* info_hpt366 is safe against re-entry so we can scribble on it */ |
451 | switch((reg1 & 0x700) >> 8) { | 448 | switch((reg1 & 0x700) >> 8) { |
452 | case 5: | 449 | case 5: |
453 | info_hpt366.private_data = &hpt366_40; | 450 | info.private_data = &hpt366_40; |
454 | break; | 451 | break; |
455 | case 9: | 452 | case 9: |
456 | info_hpt366.private_data = &hpt366_25; | 453 | info.private_data = &hpt366_25; |
457 | break; | 454 | break; |
458 | default: | 455 | default: |
459 | info_hpt366.private_data = &hpt366_33; | 456 | info.private_data = &hpt366_33; |
460 | break; | 457 | break; |
461 | } | 458 | } |
462 | /* Now kick off ATA set up */ | 459 | /* Now kick off ATA set up */ |
463 | return ata_pci_init_one(dev, port_info, 2); | 460 | return ata_pci_init_one(dev, ppi); |
464 | } | 461 | } |
465 | 462 | ||
466 | #ifdef CONFIG_PM | 463 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c index 1614e8c822a4..5a0a410654e2 100644 --- a/drivers/ata/pata_hpt37x.c +++ b/drivers/ata/pata_hpt37x.c | |||
@@ -887,7 +887,7 @@ static int hpt37x_calibrate_dpll(struct pci_dev *dev) | |||
887 | static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 887 | static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
888 | { | 888 | { |
889 | /* HPT370 - UDMA100 */ | 889 | /* HPT370 - UDMA100 */ |
890 | static struct ata_port_info info_hpt370 = { | 890 | static const struct ata_port_info info_hpt370 = { |
891 | .sht = &hpt37x_sht, | 891 | .sht = &hpt37x_sht, |
892 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 892 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
893 | .pio_mask = 0x1f, | 893 | .pio_mask = 0x1f, |
@@ -896,7 +896,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
896 | .port_ops = &hpt370_port_ops | 896 | .port_ops = &hpt370_port_ops |
897 | }; | 897 | }; |
898 | /* HPT370A - UDMA100 */ | 898 | /* HPT370A - UDMA100 */ |
899 | static struct ata_port_info info_hpt370a = { | 899 | static const struct ata_port_info info_hpt370a = { |
900 | .sht = &hpt37x_sht, | 900 | .sht = &hpt37x_sht, |
901 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 901 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
902 | .pio_mask = 0x1f, | 902 | .pio_mask = 0x1f, |
@@ -905,7 +905,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
905 | .port_ops = &hpt370a_port_ops | 905 | .port_ops = &hpt370a_port_ops |
906 | }; | 906 | }; |
907 | /* HPT370 - UDMA100 */ | 907 | /* HPT370 - UDMA100 */ |
908 | static struct ata_port_info info_hpt370_33 = { | 908 | static const struct ata_port_info info_hpt370_33 = { |
909 | .sht = &hpt37x_sht, | 909 | .sht = &hpt37x_sht, |
910 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 910 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
911 | .pio_mask = 0x1f, | 911 | .pio_mask = 0x1f, |
@@ -914,7 +914,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
914 | .port_ops = &hpt370_port_ops | 914 | .port_ops = &hpt370_port_ops |
915 | }; | 915 | }; |
916 | /* HPT370A - UDMA100 */ | 916 | /* HPT370A - UDMA100 */ |
917 | static struct ata_port_info info_hpt370a_33 = { | 917 | static const struct ata_port_info info_hpt370a_33 = { |
918 | .sht = &hpt37x_sht, | 918 | .sht = &hpt37x_sht, |
919 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 919 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
920 | .pio_mask = 0x1f, | 920 | .pio_mask = 0x1f, |
@@ -923,7 +923,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
923 | .port_ops = &hpt370a_port_ops | 923 | .port_ops = &hpt370a_port_ops |
924 | }; | 924 | }; |
925 | /* HPT371, 372 and friends - UDMA133 */ | 925 | /* HPT371, 372 and friends - UDMA133 */ |
926 | static struct ata_port_info info_hpt372 = { | 926 | static const struct ata_port_info info_hpt372 = { |
927 | .sht = &hpt37x_sht, | 927 | .sht = &hpt37x_sht, |
928 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 928 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
929 | .pio_mask = 0x1f, | 929 | .pio_mask = 0x1f, |
@@ -932,7 +932,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
932 | .port_ops = &hpt372_port_ops | 932 | .port_ops = &hpt372_port_ops |
933 | }; | 933 | }; |
934 | /* HPT371, 372 and friends - UDMA100 at 50MHz clock */ | 934 | /* HPT371, 372 and friends - UDMA100 at 50MHz clock */ |
935 | static struct ata_port_info info_hpt372_50 = { | 935 | static const struct ata_port_info info_hpt372_50 = { |
936 | .sht = &hpt37x_sht, | 936 | .sht = &hpt37x_sht, |
937 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 937 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
938 | .pio_mask = 0x1f, | 938 | .pio_mask = 0x1f, |
@@ -941,7 +941,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
941 | .port_ops = &hpt372_port_ops | 941 | .port_ops = &hpt372_port_ops |
942 | }; | 942 | }; |
943 | /* HPT374 - UDMA133 */ | 943 | /* HPT374 - UDMA133 */ |
944 | static struct ata_port_info info_hpt374 = { | 944 | static const struct ata_port_info info_hpt374 = { |
945 | .sht = &hpt37x_sht, | 945 | .sht = &hpt37x_sht, |
946 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 946 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
947 | .pio_mask = 0x1f, | 947 | .pio_mask = 0x1f, |
@@ -951,9 +951,10 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
951 | }; | 951 | }; |
952 | 952 | ||
953 | static const int MHz[4] = { 33, 40, 50, 66 }; | 953 | static const int MHz[4] = { 33, 40, 50, 66 }; |
954 | 954 | const struct ata_port_info *port; | |
955 | struct ata_port_info *port_info[2]; | 955 | void *private_data = NULL; |
956 | struct ata_port_info *port; | 956 | struct ata_port_info port_info; |
957 | const struct ata_port_info *ppi[] = { &port_info, NULL }; | ||
957 | 958 | ||
958 | u8 irqmask; | 959 | u8 irqmask; |
959 | u32 class_rev; | 960 | u32 class_rev; |
@@ -1124,13 +1125,13 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
1124 | return -ENODEV; | 1125 | return -ENODEV; |
1125 | } | 1126 | } |
1126 | if (clock_slot == 3) | 1127 | if (clock_slot == 3) |
1127 | port->private_data = (void *)hpt37x_timings_66; | 1128 | private_data = (void *)hpt37x_timings_66; |
1128 | else | 1129 | else |
1129 | port->private_data = (void *)hpt37x_timings_50; | 1130 | private_data = (void *)hpt37x_timings_50; |
1130 | 1131 | ||
1131 | printk(KERN_INFO "hpt37x: Bus clock %dMHz, using DPLL.\n", MHz[clock_slot]); | 1132 | printk(KERN_INFO "hpt37x: Bus clock %dMHz, using DPLL.\n", MHz[clock_slot]); |
1132 | } else { | 1133 | } else { |
1133 | port->private_data = (void *)chip_table->clocks[clock_slot]; | 1134 | private_data = (void *)chip_table->clocks[clock_slot]; |
1134 | /* | 1135 | /* |
1135 | * Perform a final fixup. Note that we will have used the | 1136 | * Perform a final fixup. Note that we will have used the |
1136 | * DPLL on the HPT372 which means we don't have to worry | 1137 | * 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) | |||
1144 | printk(KERN_INFO "hpt37x: %s: Bus clock %dMHz.\n", chip_table->name, MHz[clock_slot]); | 1145 | printk(KERN_INFO "hpt37x: %s: Bus clock %dMHz.\n", chip_table->name, MHz[clock_slot]); |
1145 | } | 1146 | } |
1146 | 1147 | ||
1147 | port_info[0] = port_info[1] = port; | ||
1148 | /* Now kick off ATA set up */ | 1148 | /* Now kick off ATA set up */ |
1149 | return ata_pci_init_one(dev, port_info, 2); | 1149 | port_info = *port; |
1150 | port_info.private_data = private_data; | ||
1151 | |||
1152 | return ata_pci_init_one(dev, ppi); | ||
1150 | } | 1153 | } |
1151 | 1154 | ||
1152 | static const struct pci_device_id hpt37x[] = { | 1155 | static const struct pci_device_id hpt37x[] = { |
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c index ea1037d67860..f25154aed75d 100644 --- a/drivers/ata/pata_hpt3x2n.c +++ b/drivers/ata/pata_hpt3x2n.c | |||
@@ -488,7 +488,7 @@ static int hpt3x2n_pci_clock(struct pci_dev *pdev) | |||
488 | static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 488 | static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
489 | { | 489 | { |
490 | /* HPT372N and friends - UDMA133 */ | 490 | /* HPT372N and friends - UDMA133 */ |
491 | static struct ata_port_info info = { | 491 | static const struct ata_port_info info = { |
492 | .sht = &hpt3x2n_sht, | 492 | .sht = &hpt3x2n_sht, |
493 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 493 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
494 | .pio_mask = 0x1f, | 494 | .pio_mask = 0x1f, |
@@ -496,8 +496,8 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
496 | .udma_mask = 0x7f, | 496 | .udma_mask = 0x7f, |
497 | .port_ops = &hpt3x2n_port_ops | 497 | .port_ops = &hpt3x2n_port_ops |
498 | }; | 498 | }; |
499 | struct ata_port_info *port_info[2]; | 499 | struct ata_port_info port = info; |
500 | struct ata_port_info *port = &info; | 500 | const struct ata_port_info *ppi[] = { &port, NULL }; |
501 | 501 | ||
502 | u8 irqmask; | 502 | u8 irqmask; |
503 | u32 class_rev; | 503 | u32 class_rev; |
@@ -585,9 +585,9 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
585 | 585 | ||
586 | /* Set our private data up. We only need a few flags so we use | 586 | /* Set our private data up. We only need a few flags so we use |
587 | it directly */ | 587 | it directly */ |
588 | port->private_data = NULL; | 588 | port.private_data = NULL; |
589 | if (pci_mhz > 60) { | 589 | if (pci_mhz > 60) { |
590 | port->private_data = (void *)PCI66; | 590 | port.private_data = (void *)PCI66; |
591 | /* | 591 | /* |
592 | * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in | 592 | * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in |
593 | * the MISC. register to stretch the UltraDMA Tss timing. | 593 | * 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) | |||
598 | } | 598 | } |
599 | 599 | ||
600 | /* Now kick off ATA set up */ | 600 | /* Now kick off ATA set up */ |
601 | port_info[0] = port_info[1] = port; | 601 | return ata_pci_init_one(dev, ppi); |
602 | return ata_pci_init_one(dev, port_info, 2); | ||
603 | } | 602 | } |
604 | 603 | ||
605 | static const struct pci_device_id hpt3x2n[] = { | 604 | static const struct pci_device_id hpt3x2n[] = { |
diff --git a/drivers/ata/pata_hpt3x3.c b/drivers/ata/pata_hpt3x3.c index ac28ec8c50aa..bbabe7902fbb 100644 --- a/drivers/ata/pata_hpt3x3.c +++ b/drivers/ata/pata_hpt3x3.c | |||
@@ -100,10 +100,6 @@ static struct scsi_host_template hpt3x3_sht = { | |||
100 | .slave_configure = ata_scsi_slave_config, | 100 | .slave_configure = ata_scsi_slave_config, |
101 | .slave_destroy = ata_scsi_slave_destroy, | 101 | .slave_destroy = ata_scsi_slave_destroy, |
102 | .bios_param = ata_std_bios_param, | 102 | .bios_param = ata_std_bios_param, |
103 | #ifdef CONFIG_PM | ||
104 | .resume = ata_scsi_device_resume, | ||
105 | .suspend = ata_scsi_device_suspend, | ||
106 | #endif | ||
107 | }; | 103 | }; |
108 | 104 | ||
109 | static struct ata_port_operations hpt3x3_port_ops = { | 105 | static struct ata_port_operations hpt3x3_port_ops = { |
@@ -175,7 +171,7 @@ static void hpt3x3_init_chipset(struct pci_dev *dev) | |||
175 | 171 | ||
176 | static int hpt3x3_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 172 | static int hpt3x3_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
177 | { | 173 | { |
178 | static struct ata_port_info info = { | 174 | static const struct ata_port_info info = { |
179 | .sht = &hpt3x3_sht, | 175 | .sht = &hpt3x3_sht, |
180 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 176 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
181 | .pio_mask = 0x1f, | 177 | .pio_mask = 0x1f, |
@@ -183,11 +179,11 @@ static int hpt3x3_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
183 | .udma_mask = 0x07, | 179 | .udma_mask = 0x07, |
184 | .port_ops = &hpt3x3_port_ops | 180 | .port_ops = &hpt3x3_port_ops |
185 | }; | 181 | }; |
186 | static struct ata_port_info *port_info[2] = { &info, &info }; | 182 | const struct ata_port_info *ppi[] = { &info, NULL }; |
187 | 183 | ||
188 | hpt3x3_init_chipset(dev); | 184 | hpt3x3_init_chipset(dev); |
189 | /* Now kick off ATA set up */ | 185 | /* Now kick off ATA set up */ |
190 | return ata_pci_init_one(dev, port_info, 2); | 186 | return ata_pci_init_one(dev, ppi); |
191 | } | 187 | } |
192 | 188 | ||
193 | #ifdef CONFIG_PM | 189 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_it8213.c b/drivers/ata/pata_it8213.c index 17bf9f3ed013..a769952646e1 100644 --- a/drivers/ata/pata_it8213.c +++ b/drivers/ata/pata_it8213.c | |||
@@ -257,10 +257,6 @@ static struct scsi_host_template it8213_sht = { | |||
257 | .dma_boundary = ATA_DMA_BOUNDARY, | 257 | .dma_boundary = ATA_DMA_BOUNDARY, |
258 | .slave_configure = ata_scsi_slave_config, | 258 | .slave_configure = ata_scsi_slave_config, |
259 | .bios_param = ata_std_bios_param, | 259 | .bios_param = ata_std_bios_param, |
260 | #ifdef CONFIG_PM | ||
261 | .resume = ata_scsi_device_resume, | ||
262 | .suspend = ata_scsi_device_suspend, | ||
263 | #endif | ||
264 | }; | 260 | }; |
265 | 261 | ||
266 | static const struct ata_port_operations it8213_ops = { | 262 | static const struct ata_port_operations it8213_ops = { |
@@ -315,7 +311,7 @@ static const struct ata_port_operations it8213_ops = { | |||
315 | static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 311 | static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
316 | { | 312 | { |
317 | static int printed_version; | 313 | static int printed_version; |
318 | static struct ata_port_info info = { | 314 | static const struct ata_port_info info = { |
319 | .sht = &it8213_sht, | 315 | .sht = &it8213_sht, |
320 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 316 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
321 | .pio_mask = 0x1f, /* pio0-4 */ | 317 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -323,14 +319,14 @@ static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *en | |||
323 | .udma_mask = 0x1f, /* UDMA 100 */ | 319 | .udma_mask = 0x1f, /* UDMA 100 */ |
324 | .port_ops = &it8213_ops, | 320 | .port_ops = &it8213_ops, |
325 | }; | 321 | }; |
326 | static struct ata_port_info *port_info[2] = { &info, &info }; | 322 | /* Current IT8213 stuff is single port */ |
323 | const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; | ||
327 | 324 | ||
328 | if (!printed_version++) | 325 | if (!printed_version++) |
329 | dev_printk(KERN_DEBUG, &pdev->dev, | 326 | dev_printk(KERN_DEBUG, &pdev->dev, |
330 | "version " DRV_VERSION "\n"); | 327 | "version " DRV_VERSION "\n"); |
331 | 328 | ||
332 | /* Current IT8213 stuff is single port */ | 329 | return ata_pci_init_one(pdev, ppi); |
333 | return ata_pci_init_one(pdev, port_info, 1); | ||
334 | } | 330 | } |
335 | 331 | ||
336 | static const struct pci_device_id it8213_pci_tbl[] = { | 332 | static const struct pci_device_id it8213_pci_tbl[] = { |
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index f1f8cec8c224..ff9a6fd36657 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c | |||
@@ -620,10 +620,6 @@ static struct scsi_host_template it821x_sht = { | |||
620 | .slave_configure = ata_scsi_slave_config, | 620 | .slave_configure = ata_scsi_slave_config, |
621 | .slave_destroy = ata_scsi_slave_destroy, | 621 | .slave_destroy = ata_scsi_slave_destroy, |
622 | .bios_param = ata_std_bios_param, | 622 | .bios_param = ata_std_bios_param, |
623 | #ifdef CONFIG_PM | ||
624 | .resume = ata_scsi_device_resume, | ||
625 | .suspend = ata_scsi_device_suspend, | ||
626 | #endif | ||
627 | }; | 623 | }; |
628 | 624 | ||
629 | static struct ata_port_operations it821x_smart_port_ops = { | 625 | static struct ata_port_operations it821x_smart_port_ops = { |
@@ -722,14 +718,14 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
722 | { | 718 | { |
723 | u8 conf; | 719 | u8 conf; |
724 | 720 | ||
725 | static struct ata_port_info info_smart = { | 721 | static const struct ata_port_info info_smart = { |
726 | .sht = &it821x_sht, | 722 | .sht = &it821x_sht, |
727 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 723 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
728 | .pio_mask = 0x1f, | 724 | .pio_mask = 0x1f, |
729 | .mwdma_mask = 0x07, | 725 | .mwdma_mask = 0x07, |
730 | .port_ops = &it821x_smart_port_ops | 726 | .port_ops = &it821x_smart_port_ops |
731 | }; | 727 | }; |
732 | static struct ata_port_info info_passthru = { | 728 | static const struct ata_port_info info_passthru = { |
733 | .sht = &it821x_sht, | 729 | .sht = &it821x_sht, |
734 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 730 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
735 | .pio_mask = 0x1f, | 731 | .pio_mask = 0x1f, |
@@ -737,8 +733,8 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
737 | .udma_mask = 0x7f, | 733 | .udma_mask = 0x7f, |
738 | .port_ops = &it821x_passthru_port_ops | 734 | .port_ops = &it821x_passthru_port_ops |
739 | }; | 735 | }; |
740 | static struct ata_port_info *port_info[2]; | ||
741 | 736 | ||
737 | const struct ata_port_info *ppi[] = { NULL, NULL }; | ||
742 | static char *mode[2] = { "pass through", "smart" }; | 738 | static char *mode[2] = { "pass through", "smart" }; |
743 | 739 | ||
744 | /* Force the card into bypass mode if so requested */ | 740 | /* Force the card into bypass mode if so requested */ |
@@ -751,11 +747,11 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
751 | 747 | ||
752 | printk(KERN_INFO DRV_NAME ": controller in %s mode.\n", mode[conf]); | 748 | printk(KERN_INFO DRV_NAME ": controller in %s mode.\n", mode[conf]); |
753 | if (conf == 0) | 749 | if (conf == 0) |
754 | port_info[0] = port_info[1] = &info_passthru; | 750 | ppi[0] = &info_passthru; |
755 | else | 751 | else |
756 | port_info[0] = port_info[1] = &info_smart; | 752 | ppi[0] = &info_smart; |
757 | 753 | ||
758 | return ata_pci_init_one(pdev, port_info, 2); | 754 | return ata_pci_init_one(pdev, ppi); |
759 | } | 755 | } |
760 | 756 | ||
761 | #ifdef CONFIG_PM | 757 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c index 420c343e5711..b994351fbcd0 100644 --- a/drivers/ata/pata_ixp4xx_cf.c +++ b/drivers/ata/pata_ixp4xx_cf.c | |||
@@ -31,7 +31,7 @@ static int ixp4xx_set_mode(struct ata_port *ap, struct ata_device **error) | |||
31 | 31 | ||
32 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 32 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
33 | struct ata_device *dev = &ap->device[i]; | 33 | struct ata_device *dev = &ap->device[i]; |
34 | if (ata_dev_ready(dev)) { | 34 | if (ata_dev_enabled(dev)) { |
35 | ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n"); | 35 | ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n"); |
36 | dev->pio_mode = XFER_PIO_0; | 36 | dev->pio_mode = XFER_PIO_0; |
37 | dev->xfer_mode = XFER_PIO_0; | 37 | dev->xfer_mode = XFER_PIO_0; |
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c index 1daf78ac6efb..8d799e87f752 100644 --- a/drivers/ata/pata_jmicron.c +++ b/drivers/ata/pata_jmicron.c | |||
@@ -138,10 +138,6 @@ static struct scsi_host_template jmicron_sht = { | |||
138 | .slave_destroy = ata_scsi_slave_destroy, | 138 | .slave_destroy = ata_scsi_slave_destroy, |
139 | /* Use standard CHS mapping rules */ | 139 | /* Use standard CHS mapping rules */ |
140 | .bios_param = ata_std_bios_param, | 140 | .bios_param = ata_std_bios_param, |
141 | #ifdef CONFIG_PM | ||
142 | .suspend = ata_scsi_device_suspend, | ||
143 | .resume = ata_scsi_device_resume, | ||
144 | #endif | ||
145 | }; | 141 | }; |
146 | 142 | ||
147 | static const struct ata_port_operations jmicron_ops = { | 143 | static const struct ata_port_operations jmicron_ops = { |
@@ -195,7 +191,7 @@ static const struct ata_port_operations jmicron_ops = { | |||
195 | 191 | ||
196 | static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | 192 | static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *id) |
197 | { | 193 | { |
198 | static struct ata_port_info info = { | 194 | static const struct ata_port_info info = { |
199 | .sht = &jmicron_sht, | 195 | .sht = &jmicron_sht, |
200 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 196 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
201 | 197 | ||
@@ -205,9 +201,9 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i | |||
205 | 201 | ||
206 | .port_ops = &jmicron_ops, | 202 | .port_ops = &jmicron_ops, |
207 | }; | 203 | }; |
208 | struct ata_port_info *port_info[2] = { &info, &info }; | 204 | const struct ata_port_info *ppi[] = { &info, NULL }; |
209 | 205 | ||
210 | return ata_pci_init_one(pdev, port_info, 2); | 206 | return ata_pci_init_one(pdev, ppi); |
211 | } | 207 | } |
212 | 208 | ||
213 | static const struct pci_device_id jmicron_pci_tbl[] = { | 209 | static const struct pci_device_id jmicron_pci_tbl[] = { |
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c index 837b7fe77dc7..edbfe0dbbf78 100644 --- a/drivers/ata/pata_marvell.c +++ b/drivers/ata/pata_marvell.c | |||
@@ -107,10 +107,6 @@ static struct scsi_host_template marvell_sht = { | |||
107 | .slave_destroy = ata_scsi_slave_destroy, | 107 | .slave_destroy = ata_scsi_slave_destroy, |
108 | /* Use standard CHS mapping rules */ | 108 | /* Use standard CHS mapping rules */ |
109 | .bios_param = ata_std_bios_param, | 109 | .bios_param = ata_std_bios_param, |
110 | #ifdef CONFIG_PM | ||
111 | .resume = ata_scsi_device_resume, | ||
112 | .suspend = ata_scsi_device_suspend, | ||
113 | #endif | ||
114 | }; | 110 | }; |
115 | 111 | ||
116 | static const struct ata_port_operations marvell_ops = { | 112 | static const struct ata_port_operations marvell_ops = { |
@@ -165,7 +161,7 @@ static const struct ata_port_operations marvell_ops = { | |||
165 | 161 | ||
166 | static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | 162 | static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *id) |
167 | { | 163 | { |
168 | static struct ata_port_info info = { | 164 | static const struct ata_port_info info = { |
169 | .sht = &marvell_sht, | 165 | .sht = &marvell_sht, |
170 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 166 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
171 | 167 | ||
@@ -175,7 +171,7 @@ static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *i | |||
175 | 171 | ||
176 | .port_ops = &marvell_ops, | 172 | .port_ops = &marvell_ops, |
177 | }; | 173 | }; |
178 | static struct ata_port_info info_sata = { | 174 | static const struct ata_port_info info_sata = { |
179 | .sht = &marvell_sht, | 175 | .sht = &marvell_sht, |
180 | /* Slave possible as its magically mapped not real */ | 176 | /* Slave possible as its magically mapped not real */ |
181 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 177 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
@@ -186,13 +182,12 @@ static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *i | |||
186 | 182 | ||
187 | .port_ops = &marvell_ops, | 183 | .port_ops = &marvell_ops, |
188 | }; | 184 | }; |
189 | struct ata_port_info *port_info[2] = { &info, &info_sata }; | 185 | const struct ata_port_info *ppi[] = { &info, &info_sata }; |
190 | int n_port = 2; | ||
191 | 186 | ||
192 | if (pdev->device == 0x6101) | 187 | if (pdev->device == 0x6101) |
193 | n_port = 1; | 188 | ppi[1] = &ata_dummy_port_info; |
194 | 189 | ||
195 | return ata_pci_init_one(pdev, port_info, n_port); | 190 | return ata_pci_init_one(pdev, ppi); |
196 | } | 191 | } |
197 | 192 | ||
198 | static const struct pci_device_id marvell_pci_tbl[] = { | 193 | static const struct pci_device_id marvell_pci_tbl[] = { |
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c index 9587a89f9683..368fac7d168b 100644 --- a/drivers/ata/pata_mpc52xx.c +++ b/drivers/ata/pata_mpc52xx.c | |||
@@ -280,10 +280,6 @@ static struct scsi_host_template mpc52xx_ata_sht = { | |||
280 | .dma_boundary = ATA_DMA_BOUNDARY, | 280 | .dma_boundary = ATA_DMA_BOUNDARY, |
281 | .slave_configure = ata_scsi_slave_config, | 281 | .slave_configure = ata_scsi_slave_config, |
282 | .bios_param = ata_std_bios_param, | 282 | .bios_param = ata_std_bios_param, |
283 | #ifdef CONFIG_PM | ||
284 | .suspend = ata_scsi_device_suspend, | ||
285 | .resume = ata_scsi_device_resume, | ||
286 | #endif | ||
287 | }; | 283 | }; |
288 | 284 | ||
289 | static struct ata_port_operations mpc52xx_ata_port_ops = { | 285 | static struct ata_port_operations mpc52xx_ata_port_ops = { |
diff --git a/drivers/ata/pata_mpiix.c b/drivers/ata/pata_mpiix.c index 3bfbd495f643..4ea42838297e 100644 --- a/drivers/ata/pata_mpiix.c +++ b/drivers/ata/pata_mpiix.c | |||
@@ -165,10 +165,6 @@ static struct scsi_host_template mpiix_sht = { | |||
165 | .slave_configure = ata_scsi_slave_config, | 165 | .slave_configure = ata_scsi_slave_config, |
166 | .slave_destroy = ata_scsi_slave_destroy, | 166 | .slave_destroy = ata_scsi_slave_destroy, |
167 | .bios_param = ata_std_bios_param, | 167 | .bios_param = ata_std_bios_param, |
168 | #ifdef CONFIG_PM | ||
169 | .resume = ata_scsi_device_resume, | ||
170 | .suspend = ata_scsi_device_suspend, | ||
171 | #endif | ||
172 | }; | 168 | }; |
173 | 169 | ||
174 | static struct ata_port_operations mpiix_port_ops = { | 170 | static struct ata_port_operations mpiix_port_ops = { |
diff --git a/drivers/ata/pata_netcell.c b/drivers/ata/pata_netcell.c index dbba5b77d79c..81f563458666 100644 --- a/drivers/ata/pata_netcell.c +++ b/drivers/ata/pata_netcell.c | |||
@@ -37,10 +37,6 @@ static struct scsi_host_template netcell_sht = { | |||
37 | .slave_destroy = ata_scsi_slave_destroy, | 37 | .slave_destroy = ata_scsi_slave_destroy, |
38 | /* Use standard CHS mapping rules */ | 38 | /* Use standard CHS mapping rules */ |
39 | .bios_param = ata_std_bios_param, | 39 | .bios_param = ata_std_bios_param, |
40 | #ifdef CONFIG_PM | ||
41 | .resume = ata_scsi_device_resume, | ||
42 | .suspend = ata_scsi_device_suspend, | ||
43 | #endif | ||
44 | }; | 40 | }; |
45 | 41 | ||
46 | static const struct ata_port_operations netcell_ops = { | 42 | static const struct ata_port_operations netcell_ops = { |
@@ -96,7 +92,7 @@ static const struct ata_port_operations netcell_ops = { | |||
96 | static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 92 | static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
97 | { | 93 | { |
98 | static int printed_version; | 94 | static int printed_version; |
99 | static struct ata_port_info info = { | 95 | static const struct ata_port_info info = { |
100 | .sht = &netcell_sht, | 96 | .sht = &netcell_sht, |
101 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 97 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
102 | /* Actually we don't really care about these as the | 98 | /* Actually we don't really care about these as the |
@@ -106,7 +102,7 @@ static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
106 | .udma_mask = 0x3f, /* UDMA 133 */ | 102 | .udma_mask = 0x3f, /* UDMA 133 */ |
107 | .port_ops = &netcell_ops, | 103 | .port_ops = &netcell_ops, |
108 | }; | 104 | }; |
109 | static struct ata_port_info *port_info[2] = { &info, &info }; | 105 | const struct ata_port_info *port_info[] = { &info, NULL }; |
110 | 106 | ||
111 | if (!printed_version++) | 107 | if (!printed_version++) |
112 | dev_printk(KERN_DEBUG, &pdev->dev, | 108 | dev_printk(KERN_DEBUG, &pdev->dev, |
@@ -116,7 +112,7 @@ static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
116 | ata_pci_clear_simplex(pdev); | 112 | ata_pci_clear_simplex(pdev); |
117 | 113 | ||
118 | /* And let the library code do the work */ | 114 | /* And let the library code do the work */ |
119 | return ata_pci_init_one(pdev, port_info, 2); | 115 | return ata_pci_init_one(pdev, port_info); |
120 | } | 116 | } |
121 | 117 | ||
122 | static const struct pci_device_id netcell_pci_tbl[] = { | 118 | static const struct pci_device_id netcell_pci_tbl[] = { |
diff --git a/drivers/ata/pata_ns87410.c b/drivers/ata/pata_ns87410.c index ebc58a907d26..ea70ec744879 100644 --- a/drivers/ata/pata_ns87410.c +++ b/drivers/ata/pata_ns87410.c | |||
@@ -158,10 +158,6 @@ static struct scsi_host_template ns87410_sht = { | |||
158 | .slave_configure = ata_scsi_slave_config, | 158 | .slave_configure = ata_scsi_slave_config, |
159 | .slave_destroy = ata_scsi_slave_destroy, | 159 | .slave_destroy = ata_scsi_slave_destroy, |
160 | .bios_param = ata_std_bios_param, | 160 | .bios_param = ata_std_bios_param, |
161 | #ifdef CONFIG_PM | ||
162 | .resume = ata_scsi_device_resume, | ||
163 | .suspend = ata_scsi_device_suspend, | ||
164 | #endif | ||
165 | }; | 161 | }; |
166 | 162 | ||
167 | static struct ata_port_operations ns87410_port_ops = { | 163 | static struct ata_port_operations ns87410_port_ops = { |
@@ -195,14 +191,14 @@ static struct ata_port_operations ns87410_port_ops = { | |||
195 | 191 | ||
196 | static int ns87410_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 192 | static int ns87410_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
197 | { | 193 | { |
198 | static struct ata_port_info info = { | 194 | static const struct ata_port_info info = { |
199 | .sht = &ns87410_sht, | 195 | .sht = &ns87410_sht, |
200 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 196 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
201 | .pio_mask = 0x0F, | 197 | .pio_mask = 0x0F, |
202 | .port_ops = &ns87410_port_ops | 198 | .port_ops = &ns87410_port_ops |
203 | }; | 199 | }; |
204 | static struct ata_port_info *port_info[2] = {&info, &info}; | 200 | const struct ata_port_info *ppi[] = { &info, NULL }; |
205 | return ata_pci_init_one(dev, port_info, 2); | 201 | return ata_pci_init_one(dev, ppi); |
206 | } | 202 | } |
207 | 203 | ||
208 | static const struct pci_device_id ns87410[] = { | 204 | static const struct pci_device_id ns87410[] = { |
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c index 4d75d32e5826..29c23ddd6550 100644 --- a/drivers/ata/pata_oldpiix.c +++ b/drivers/ata/pata_oldpiix.c | |||
@@ -234,10 +234,6 @@ static struct scsi_host_template oldpiix_sht = { | |||
234 | .slave_configure = ata_scsi_slave_config, | 234 | .slave_configure = ata_scsi_slave_config, |
235 | .slave_destroy = ata_scsi_slave_destroy, | 235 | .slave_destroy = ata_scsi_slave_destroy, |
236 | .bios_param = ata_std_bios_param, | 236 | .bios_param = ata_std_bios_param, |
237 | #ifdef CONFIG_PM | ||
238 | .resume = ata_scsi_device_resume, | ||
239 | .suspend = ata_scsi_device_suspend, | ||
240 | #endif | ||
241 | }; | 237 | }; |
242 | 238 | ||
243 | static const struct ata_port_operations oldpiix_pata_ops = { | 239 | static const struct ata_port_operations oldpiix_pata_ops = { |
@@ -293,20 +289,20 @@ static const struct ata_port_operations oldpiix_pata_ops = { | |||
293 | static int oldpiix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 289 | static int oldpiix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
294 | { | 290 | { |
295 | static int printed_version; | 291 | static int printed_version; |
296 | static struct ata_port_info info = { | 292 | static const struct ata_port_info info = { |
297 | .sht = &oldpiix_sht, | 293 | .sht = &oldpiix_sht, |
298 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 294 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
299 | .pio_mask = 0x1f, /* pio0-4 */ | 295 | .pio_mask = 0x1f, /* pio0-4 */ |
300 | .mwdma_mask = 0x07, /* mwdma1-2 */ | 296 | .mwdma_mask = 0x07, /* mwdma1-2 */ |
301 | .port_ops = &oldpiix_pata_ops, | 297 | .port_ops = &oldpiix_pata_ops, |
302 | }; | 298 | }; |
303 | static struct ata_port_info *port_info[2] = { &info, &info }; | 299 | const struct ata_port_info *ppi[] = { &info, NULL }; |
304 | 300 | ||
305 | if (!printed_version++) | 301 | if (!printed_version++) |
306 | dev_printk(KERN_DEBUG, &pdev->dev, | 302 | dev_printk(KERN_DEBUG, &pdev->dev, |
307 | "version " DRV_VERSION "\n"); | 303 | "version " DRV_VERSION "\n"); |
308 | 304 | ||
309 | return ata_pci_init_one(pdev, port_info, 2); | 305 | return ata_pci_init_one(pdev, ppi); |
310 | } | 306 | } |
311 | 307 | ||
312 | static const struct pci_device_id oldpiix_pci_tbl[] = { | 308 | static const struct pci_device_id oldpiix_pci_tbl[] = { |
diff --git a/drivers/ata/pata_opti.c b/drivers/ata/pata_opti.c index 0af8a2c77cc9..1c44653e1e06 100644 --- a/drivers/ata/pata_opti.c +++ b/drivers/ata/pata_opti.c | |||
@@ -179,10 +179,6 @@ static struct scsi_host_template opti_sht = { | |||
179 | .slave_configure = ata_scsi_slave_config, | 179 | .slave_configure = ata_scsi_slave_config, |
180 | .slave_destroy = ata_scsi_slave_destroy, | 180 | .slave_destroy = ata_scsi_slave_destroy, |
181 | .bios_param = ata_std_bios_param, | 181 | .bios_param = ata_std_bios_param, |
182 | #ifdef CONFIG_PM | ||
183 | .resume = ata_scsi_device_resume, | ||
184 | .suspend = ata_scsi_device_suspend, | ||
185 | #endif | ||
186 | }; | 182 | }; |
187 | 183 | ||
188 | static struct ata_port_operations opti_port_ops = { | 184 | static struct ata_port_operations opti_port_ops = { |
@@ -220,19 +216,19 @@ static struct ata_port_operations opti_port_ops = { | |||
220 | 216 | ||
221 | static int opti_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 217 | static int opti_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
222 | { | 218 | { |
223 | static struct ata_port_info info = { | 219 | static const struct ata_port_info info = { |
224 | .sht = &opti_sht, | 220 | .sht = &opti_sht, |
225 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 221 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
226 | .pio_mask = 0x1f, | 222 | .pio_mask = 0x1f, |
227 | .port_ops = &opti_port_ops | 223 | .port_ops = &opti_port_ops |
228 | }; | 224 | }; |
229 | static struct ata_port_info *port_info[2] = { &info, &info }; | 225 | const struct ata_port_info *ppi[] = { &info, NULL }; |
230 | static int printed_version; | 226 | static int printed_version; |
231 | 227 | ||
232 | if (!printed_version++) | 228 | if (!printed_version++) |
233 | dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); | 229 | dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); |
234 | 230 | ||
235 | return ata_pci_init_one(dev, port_info, 2); | 231 | return ata_pci_init_one(dev, ppi); |
236 | } | 232 | } |
237 | 233 | ||
238 | static const struct pci_device_id opti[] = { | 234 | static const struct pci_device_id opti[] = { |
diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c index 2843e480f216..3093b02286ce 100644 --- a/drivers/ata/pata_optidma.c +++ b/drivers/ata/pata_optidma.c | |||
@@ -363,10 +363,6 @@ static struct scsi_host_template optidma_sht = { | |||
363 | .slave_configure = ata_scsi_slave_config, | 363 | .slave_configure = ata_scsi_slave_config, |
364 | .slave_destroy = ata_scsi_slave_destroy, | 364 | .slave_destroy = ata_scsi_slave_destroy, |
365 | .bios_param = ata_std_bios_param, | 365 | .bios_param = ata_std_bios_param, |
366 | #ifdef CONFIG_PM | ||
367 | .resume = ata_scsi_device_resume, | ||
368 | .suspend = ata_scsi_device_suspend, | ||
369 | #endif | ||
370 | }; | 366 | }; |
371 | 367 | ||
372 | static struct ata_port_operations optidma_port_ops = { | 368 | static struct ata_port_operations optidma_port_ops = { |
@@ -486,14 +482,14 @@ done_nomsg: /* Wrong chip revision */ | |||
486 | 482 | ||
487 | static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 483 | static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
488 | { | 484 | { |
489 | static struct ata_port_info info_82c700 = { | 485 | static const struct ata_port_info info_82c700 = { |
490 | .sht = &optidma_sht, | 486 | .sht = &optidma_sht, |
491 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 487 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
492 | .pio_mask = 0x1f, | 488 | .pio_mask = 0x1f, |
493 | .mwdma_mask = 0x07, | 489 | .mwdma_mask = 0x07, |
494 | .port_ops = &optidma_port_ops | 490 | .port_ops = &optidma_port_ops |
495 | }; | 491 | }; |
496 | static struct ata_port_info info_82c700_udma = { | 492 | static const struct ata_port_info info_82c700_udma = { |
497 | .sht = &optidma_sht, | 493 | .sht = &optidma_sht, |
498 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 494 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
499 | .pio_mask = 0x1f, | 495 | .pio_mask = 0x1f, |
@@ -501,8 +497,7 @@ static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
501 | .udma_mask = 0x07, | 497 | .udma_mask = 0x07, |
502 | .port_ops = &optiplus_port_ops | 498 | .port_ops = &optiplus_port_ops |
503 | }; | 499 | }; |
504 | static struct ata_port_info *port_info[2]; | 500 | const struct ata_port_info *ppi[] = { &info_82c700, NULL }; |
505 | struct ata_port_info *info = &info_82c700; | ||
506 | static int printed_version; | 501 | static int printed_version; |
507 | 502 | ||
508 | if (!printed_version++) | 503 | if (!printed_version++) |
@@ -514,10 +509,9 @@ static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
514 | pci_clock = inb(0x1F5) & 1; /* 0 = 33Mhz, 1 = 25Mhz */ | 509 | pci_clock = inb(0x1F5) & 1; /* 0 = 33Mhz, 1 = 25Mhz */ |
515 | 510 | ||
516 | if (optiplus_with_udma(dev)) | 511 | if (optiplus_with_udma(dev)) |
517 | info = &info_82c700_udma; | 512 | ppi[0] = &info_82c700_udma; |
518 | 513 | ||
519 | port_info[0] = port_info[1] = info; | 514 | return ata_pci_init_one(dev, ppi); |
520 | return ata_pci_init_one(dev, port_info, 2); | ||
521 | } | 515 | } |
522 | 516 | ||
523 | static const struct pci_device_id optidma[] = { | 517 | static const struct pci_device_id optidma[] = { |
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index 11245e331f77..4d44c7555db1 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c | |||
@@ -397,6 +397,7 @@ static struct pcmcia_device_id pcmcia_devices[] = { | |||
397 | PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003), | 397 | PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003), |
398 | PCMCIA_DEVICE_PROD_ID1("TRANSCEND 512M ", 0xd0909443), | 398 | PCMCIA_DEVICE_PROD_ID1("TRANSCEND 512M ", 0xd0909443), |
399 | PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS1GCF80", 0x709b1bf1, 0x2a54d4b1), | 399 | PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS1GCF80", 0x709b1bf1, 0x2a54d4b1), |
400 | PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS2GCF120", 0x709b1bf1, 0x969aa4f2), | ||
400 | PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF120", 0x709b1bf1, 0xf54a91c8), | 401 | PCMCIA_DEVICE_PROD_ID12("TRANSCEND", "TS4GCF120", 0x709b1bf1, 0xf54a91c8), |
401 | PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852), | 402 | PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852), |
402 | PCMCIA_DEVICE_PROD_ID12("WEIDA", "TWTTI", 0xcc7cf69c, 0x212bb918), | 403 | PCMCIA_DEVICE_PROD_ID12("WEIDA", "TWTTI", 0xcc7cf69c, 0x212bb918), |
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c index ee636beb05e1..edbaf9d653b8 100644 --- a/drivers/ata/pata_pdc202xx_old.c +++ b/drivers/ata/pata_pdc202xx_old.c | |||
@@ -244,10 +244,6 @@ static struct scsi_host_template pdc202xx_sht = { | |||
244 | .slave_configure = ata_scsi_slave_config, | 244 | .slave_configure = ata_scsi_slave_config, |
245 | .slave_destroy = ata_scsi_slave_destroy, | 245 | .slave_destroy = ata_scsi_slave_destroy, |
246 | .bios_param = ata_std_bios_param, | 246 | .bios_param = ata_std_bios_param, |
247 | #ifdef CONFIG_PM | ||
248 | .resume = ata_scsi_device_resume, | ||
249 | .suspend = ata_scsi_device_suspend, | ||
250 | #endif | ||
251 | }; | 247 | }; |
252 | 248 | ||
253 | static struct ata_port_operations pdc2024x_port_ops = { | 249 | static struct ata_port_operations pdc2024x_port_ops = { |
@@ -321,7 +317,7 @@ static struct ata_port_operations pdc2026x_port_ops = { | |||
321 | 317 | ||
322 | static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 318 | static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
323 | { | 319 | { |
324 | static struct ata_port_info info[3] = { | 320 | static const struct ata_port_info info[3] = { |
325 | { | 321 | { |
326 | .sht = &pdc202xx_sht, | 322 | .sht = &pdc202xx_sht, |
327 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 323 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
@@ -348,9 +344,7 @@ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id | |||
348 | } | 344 | } |
349 | 345 | ||
350 | }; | 346 | }; |
351 | static struct ata_port_info *port_info[2]; | 347 | const struct ata_port_info *ppi[] = { &info[id->driver_data], NULL }; |
352 | |||
353 | port_info[0] = port_info[1] = &info[id->driver_data]; | ||
354 | 348 | ||
355 | if (dev->device == PCI_DEVICE_ID_PROMISE_20265) { | 349 | if (dev->device == PCI_DEVICE_ID_PROMISE_20265) { |
356 | struct pci_dev *bridge = dev->bus->self; | 350 | struct pci_dev *bridge = dev->bus->self; |
@@ -362,7 +356,7 @@ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id | |||
362 | return -ENODEV; | 356 | return -ENODEV; |
363 | } | 357 | } |
364 | } | 358 | } |
365 | return ata_pci_init_one(dev, port_info, 2); | 359 | return ata_pci_init_one(dev, ppi); |
366 | } | 360 | } |
367 | 361 | ||
368 | static const struct pci_device_id pdc202xx[] = { | 362 | static const struct pci_device_id pdc202xx[] = { |
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c index a0a650c7f272..1f6384895a4f 100644 --- a/drivers/ata/pata_platform.c +++ b/drivers/ata/pata_platform.c | |||
@@ -48,6 +48,8 @@ static int pata_platform_set_mode(struct ata_port *ap, struct ata_device **unuse | |||
48 | return 0; | 48 | return 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | static int ata_dummy_ret0(struct ata_port *ap) { return 0; } | ||
52 | |||
51 | static struct scsi_host_template pata_platform_sht = { | 53 | static struct scsi_host_template pata_platform_sht = { |
52 | .module = THIS_MODULE, | 54 | .module = THIS_MODULE, |
53 | .name = DRV_NAME, | 55 | .name = DRV_NAME, |
@@ -91,7 +93,7 @@ static struct ata_port_operations pata_platform_port_ops = { | |||
91 | .irq_on = ata_irq_on, | 93 | .irq_on = ata_irq_on, |
92 | .irq_ack = ata_irq_ack, | 94 | .irq_ack = ata_irq_ack, |
93 | 95 | ||
94 | .port_start = ata_port_start, | 96 | .port_start = ata_dummy_ret0, |
95 | }; | 97 | }; |
96 | 98 | ||
97 | static void pata_platform_setup_port(struct ata_ioports *ioaddr, | 99 | static void pata_platform_setup_port(struct ata_ioports *ioaddr, |
diff --git a/drivers/ata/pata_radisys.c b/drivers/ata/pata_radisys.c index 1c54673e008d..ba96b54f5b87 100644 --- a/drivers/ata/pata_radisys.c +++ b/drivers/ata/pata_radisys.c | |||
@@ -200,10 +200,6 @@ static struct scsi_host_template radisys_sht = { | |||
200 | .slave_configure = ata_scsi_slave_config, | 200 | .slave_configure = ata_scsi_slave_config, |
201 | .slave_destroy = ata_scsi_slave_destroy, | 201 | .slave_destroy = ata_scsi_slave_destroy, |
202 | .bios_param = ata_std_bios_param, | 202 | .bios_param = ata_std_bios_param, |
203 | #ifdef CONFIG_PM | ||
204 | .resume = ata_scsi_device_resume, | ||
205 | .suspend = ata_scsi_device_suspend, | ||
206 | #endif | ||
207 | }; | 203 | }; |
208 | 204 | ||
209 | static const struct ata_port_operations radisys_pata_ops = { | 205 | static const struct ata_port_operations radisys_pata_ops = { |
@@ -259,7 +255,7 @@ static const struct ata_port_operations radisys_pata_ops = { | |||
259 | static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 255 | static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
260 | { | 256 | { |
261 | static int printed_version; | 257 | static int printed_version; |
262 | static struct ata_port_info info = { | 258 | static const struct ata_port_info info = { |
263 | .sht = &radisys_sht, | 259 | .sht = &radisys_sht, |
264 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 260 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
265 | .pio_mask = 0x1f, /* pio0-4 */ | 261 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -267,13 +263,13 @@ static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
267 | .udma_mask = 0x14, /* UDMA33/66 only */ | 263 | .udma_mask = 0x14, /* UDMA33/66 only */ |
268 | .port_ops = &radisys_pata_ops, | 264 | .port_ops = &radisys_pata_ops, |
269 | }; | 265 | }; |
270 | static struct ata_port_info *port_info[2] = { &info, &info }; | 266 | const struct ata_port_info *ppi[] = { &info, NULL }; |
271 | 267 | ||
272 | if (!printed_version++) | 268 | if (!printed_version++) |
273 | dev_printk(KERN_DEBUG, &pdev->dev, | 269 | dev_printk(KERN_DEBUG, &pdev->dev, |
274 | "version " DRV_VERSION "\n"); | 270 | "version " DRV_VERSION "\n"); |
275 | 271 | ||
276 | return ata_pci_init_one(pdev, port_info, 2); | 272 | return ata_pci_init_one(pdev, ppi); |
277 | } | 273 | } |
278 | 274 | ||
279 | static const struct pci_device_id radisys_pci_tbl[] = { | 275 | static const struct pci_device_id radisys_pci_tbl[] = { |
diff --git a/drivers/ata/pata_rz1000.c b/drivers/ata/pata_rz1000.c index 85c45290eeee..2bfd7ef42af5 100644 --- a/drivers/ata/pata_rz1000.c +++ b/drivers/ata/pata_rz1000.c | |||
@@ -40,7 +40,7 @@ static int rz1000_set_mode(struct ata_port *ap, struct ata_device **unused) | |||
40 | 40 | ||
41 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 41 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
42 | struct ata_device *dev = &ap->device[i]; | 42 | struct ata_device *dev = &ap->device[i]; |
43 | if (ata_dev_ready(dev)) { | 43 | if (ata_dev_enabled(dev)) { |
44 | /* We don't really care */ | 44 | /* We don't really care */ |
45 | dev->pio_mode = XFER_PIO_0; | 45 | dev->pio_mode = XFER_PIO_0; |
46 | dev->xfer_mode = XFER_PIO_0; | 46 | dev->xfer_mode = XFER_PIO_0; |
@@ -69,10 +69,6 @@ static struct scsi_host_template rz1000_sht = { | |||
69 | .slave_configure = ata_scsi_slave_config, | 69 | .slave_configure = ata_scsi_slave_config, |
70 | .slave_destroy = ata_scsi_slave_destroy, | 70 | .slave_destroy = ata_scsi_slave_destroy, |
71 | .bios_param = ata_std_bios_param, | 71 | .bios_param = ata_std_bios_param, |
72 | #ifdef CONFIG_PM | ||
73 | .resume = ata_scsi_device_resume, | ||
74 | .suspend = ata_scsi_device_suspend, | ||
75 | #endif | ||
76 | }; | 72 | }; |
77 | 73 | ||
78 | static struct ata_port_operations rz1000_port_ops = { | 74 | static struct ata_port_operations rz1000_port_ops = { |
@@ -135,22 +131,20 @@ static int rz1000_fifo_disable(struct pci_dev *pdev) | |||
135 | static int rz1000_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 131 | static int rz1000_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
136 | { | 132 | { |
137 | static int printed_version; | 133 | static int printed_version; |
138 | struct ata_port_info *port_info[2]; | 134 | static const struct ata_port_info info = { |
139 | static struct ata_port_info info = { | ||
140 | .sht = &rz1000_sht, | 135 | .sht = &rz1000_sht, |
141 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 136 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
142 | .pio_mask = 0x1f, | 137 | .pio_mask = 0x1f, |
143 | .port_ops = &rz1000_port_ops | 138 | .port_ops = &rz1000_port_ops |
144 | }; | 139 | }; |
140 | const struct ata_port_info *ppi[] = { &info, NULL }; | ||
145 | 141 | ||
146 | if (!printed_version++) | 142 | if (!printed_version++) |
147 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | 143 | printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); |
148 | 144 | ||
149 | if (rz1000_fifo_disable(pdev) == 0) { | 145 | if (rz1000_fifo_disable(pdev) == 0) |
150 | port_info[0] = &info; | 146 | return ata_pci_init_one(pdev, ppi); |
151 | port_info[1] = &info; | 147 | |
152 | return ata_pci_init_one(pdev, port_info, 2); | ||
153 | } | ||
154 | printk(KERN_ERR DRV_NAME ": failed to disable read-ahead on chipset..\n"); | 148 | printk(KERN_ERR DRV_NAME ": failed to disable read-ahead on chipset..\n"); |
155 | /* Not safe to use so skip */ | 149 | /* Not safe to use so skip */ |
156 | return -ENODEV; | 150 | return -ENODEV; |
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c index 66e8ff467c8d..225013ecf4b6 100644 --- a/drivers/ata/pata_sc1200.c +++ b/drivers/ata/pata_sc1200.c | |||
@@ -194,10 +194,6 @@ static struct scsi_host_template sc1200_sht = { | |||
194 | .slave_configure = ata_scsi_slave_config, | 194 | .slave_configure = ata_scsi_slave_config, |
195 | .slave_destroy = ata_scsi_slave_destroy, | 195 | .slave_destroy = ata_scsi_slave_destroy, |
196 | .bios_param = ata_std_bios_param, | 196 | .bios_param = ata_std_bios_param, |
197 | #ifdef CONFIG_PM | ||
198 | .resume = ata_scsi_device_resume, | ||
199 | .suspend = ata_scsi_device_suspend, | ||
200 | #endif | ||
201 | }; | 197 | }; |
202 | 198 | ||
203 | static struct ata_port_operations sc1200_port_ops = { | 199 | static struct ata_port_operations sc1200_port_ops = { |
@@ -247,7 +243,7 @@ static struct ata_port_operations sc1200_port_ops = { | |||
247 | 243 | ||
248 | static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 244 | static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
249 | { | 245 | { |
250 | static struct ata_port_info info = { | 246 | static const struct ata_port_info info = { |
251 | .sht = &sc1200_sht, | 247 | .sht = &sc1200_sht, |
252 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, | 248 | .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, |
253 | .pio_mask = 0x1f, | 249 | .pio_mask = 0x1f, |
@@ -255,10 +251,10 @@ static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
255 | .udma_mask = 0x07, | 251 | .udma_mask = 0x07, |
256 | .port_ops = &sc1200_port_ops | 252 | .port_ops = &sc1200_port_ops |
257 | }; | 253 | }; |
258 | static struct ata_port_info *port_info[2] = { &info, &info }; | ||
259 | |||
260 | /* Can't enable port 2 yet, see top comments */ | 254 | /* Can't enable port 2 yet, see top comments */ |
261 | return ata_pci_init_one(dev, port_info, 1); | 255 | const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; |
256 | |||
257 | return ata_pci_init_one(dev, ppi); | ||
262 | } | 258 | } |
263 | 259 | ||
264 | static const struct pci_device_id sc1200[] = { | 260 | static const struct pci_device_id sc1200[] = { |
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c index 203f463ac39f..cca3aa225efe 100644 --- a/drivers/ata/pata_scc.c +++ b/drivers/ata/pata_scc.c | |||
@@ -984,10 +984,6 @@ static struct scsi_host_template scc_sht = { | |||
984 | .slave_configure = ata_scsi_slave_config, | 984 | .slave_configure = ata_scsi_slave_config, |
985 | .slave_destroy = ata_scsi_slave_destroy, | 985 | .slave_destroy = ata_scsi_slave_destroy, |
986 | .bios_param = ata_std_bios_param, | 986 | .bios_param = ata_std_bios_param, |
987 | #ifdef CONFIG_PM | ||
988 | .resume = ata_scsi_device_resume, | ||
989 | .suspend = ata_scsi_device_suspend, | ||
990 | #endif | ||
991 | }; | 987 | }; |
992 | 988 | ||
993 | static const struct ata_port_operations scc_pata_ops = { | 989 | static const struct ata_port_operations scc_pata_ops = { |
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c index b6e020383dd9..dee6e211949d 100644 --- a/drivers/ata/pata_serverworks.c +++ b/drivers/ata/pata_serverworks.c | |||
@@ -315,10 +315,6 @@ static struct scsi_host_template serverworks_sht = { | |||
315 | .slave_configure = ata_scsi_slave_config, | 315 | .slave_configure = ata_scsi_slave_config, |
316 | .slave_destroy = ata_scsi_slave_destroy, | 316 | .slave_destroy = ata_scsi_slave_destroy, |
317 | .bios_param = ata_std_bios_param, | 317 | .bios_param = ata_std_bios_param, |
318 | #ifdef CONFIG_PM | ||
319 | .resume = ata_scsi_device_resume, | ||
320 | .suspend = ata_scsi_device_suspend, | ||
321 | #endif | ||
322 | }; | 318 | }; |
323 | 319 | ||
324 | static struct ata_port_operations serverworks_osb4_port_ops = { | 320 | static struct ata_port_operations serverworks_osb4_port_ops = { |
@@ -479,8 +475,7 @@ static void serverworks_fixup_ht1000(struct pci_dev *pdev) | |||
479 | 475 | ||
480 | static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 476 | static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
481 | { | 477 | { |
482 | int ports = 2; | 478 | static const struct ata_port_info info[4] = { |
483 | static struct ata_port_info info[4] = { | ||
484 | { /* OSB4 */ | 479 | { /* OSB4 */ |
485 | .sht = &serverworks_sht, | 480 | .sht = &serverworks_sht, |
486 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 481 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
@@ -511,8 +506,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id | |||
511 | .port_ops = &serverworks_csb_port_ops | 506 | .port_ops = &serverworks_csb_port_ops |
512 | } | 507 | } |
513 | }; | 508 | }; |
514 | static struct ata_port_info *port_info[2]; | 509 | const struct ata_port_info *ppi[] = { &info[id->driver_data], NULL }; |
515 | struct ata_port_info *devinfo = &info[id->driver_data]; | ||
516 | 510 | ||
517 | /* Force master latency timer to 64 PCI clocks */ | 511 | /* Force master latency timer to 64 PCI clocks */ |
518 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40); | 512 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40); |
@@ -521,7 +515,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id | |||
521 | if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { | 515 | if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { |
522 | /* Select non UDMA capable OSB4 if we can't do fixups */ | 516 | /* Select non UDMA capable OSB4 if we can't do fixups */ |
523 | if ( serverworks_fixup_osb4(pdev) < 0) | 517 | if ( serverworks_fixup_osb4(pdev) < 0) |
524 | devinfo = &info[1]; | 518 | ppi[0] = &info[1]; |
525 | } | 519 | } |
526 | /* setup CSB5/CSB6 : South Bridge and IDE option RAID */ | 520 | /* setup CSB5/CSB6 : South Bridge and IDE option RAID */ |
527 | else if ((pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) || | 521 | else if ((pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) || |
@@ -531,11 +525,11 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id | |||
531 | /* If the returned btr is the newer revision then | 525 | /* If the returned btr is the newer revision then |
532 | select the right info block */ | 526 | select the right info block */ |
533 | if (serverworks_fixup_csb(pdev) == 3) | 527 | if (serverworks_fixup_csb(pdev) == 3) |
534 | devinfo = &info[3]; | 528 | ppi[0] = &info[3]; |
535 | 529 | ||
536 | /* Is this the 3rd channel CSB6 IDE ? */ | 530 | /* Is this the 3rd channel CSB6 IDE ? */ |
537 | if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) | 531 | if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) |
538 | ports = 1; | 532 | ppi[1] = &ata_dummy_port_info; |
539 | } | 533 | } |
540 | /* setup HT1000E */ | 534 | /* setup HT1000E */ |
541 | else if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE) | 535 | else if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE) |
@@ -544,8 +538,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id | |||
544 | if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) | 538 | if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) |
545 | ata_pci_clear_simplex(pdev); | 539 | ata_pci_clear_simplex(pdev); |
546 | 540 | ||
547 | port_info[0] = port_info[1] = devinfo; | 541 | return ata_pci_init_one(pdev, ppi); |
548 | return ata_pci_init_one(pdev, port_info, ports); | ||
549 | } | 542 | } |
550 | 543 | ||
551 | #ifdef CONFIG_PM | 544 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c index a5886f061c0b..440e2cb6ee75 100644 --- a/drivers/ata/pata_sil680.c +++ b/drivers/ata/pata_sil680.c | |||
@@ -232,10 +232,6 @@ static struct scsi_host_template sil680_sht = { | |||
232 | .slave_configure = ata_scsi_slave_config, | 232 | .slave_configure = ata_scsi_slave_config, |
233 | .slave_destroy = ata_scsi_slave_destroy, | 233 | .slave_destroy = ata_scsi_slave_destroy, |
234 | .bios_param = ata_std_bios_param, | 234 | .bios_param = ata_std_bios_param, |
235 | #ifdef CONFIG_PM | ||
236 | .suspend = ata_scsi_device_suspend, | ||
237 | .resume = ata_scsi_device_resume, | ||
238 | #endif | ||
239 | }; | 235 | }; |
240 | 236 | ||
241 | static struct ata_port_operations sil680_port_ops = { | 237 | static struct ata_port_operations sil680_port_ops = { |
@@ -345,7 +341,7 @@ static u8 sil680_init_chip(struct pci_dev *pdev) | |||
345 | 341 | ||
346 | static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 342 | static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
347 | { | 343 | { |
348 | static struct ata_port_info info = { | 344 | static const struct ata_port_info info = { |
349 | .sht = &sil680_sht, | 345 | .sht = &sil680_sht, |
350 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 346 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
351 | .pio_mask = 0x1f, | 347 | .pio_mask = 0x1f, |
@@ -353,7 +349,7 @@ static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
353 | .udma_mask = 0x7f, | 349 | .udma_mask = 0x7f, |
354 | .port_ops = &sil680_port_ops | 350 | .port_ops = &sil680_port_ops |
355 | }; | 351 | }; |
356 | static struct ata_port_info info_slow = { | 352 | static const struct ata_port_info info_slow = { |
357 | .sht = &sil680_sht, | 353 | .sht = &sil680_sht, |
358 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 354 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
359 | .pio_mask = 0x1f, | 355 | .pio_mask = 0x1f, |
@@ -361,7 +357,7 @@ static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
361 | .udma_mask = 0x3f, | 357 | .udma_mask = 0x3f, |
362 | .port_ops = &sil680_port_ops | 358 | .port_ops = &sil680_port_ops |
363 | }; | 359 | }; |
364 | static struct ata_port_info *port_info[2] = {&info, &info}; | 360 | const struct ata_port_info *ppi[] = { &info, NULL }; |
365 | static int printed_version; | 361 | static int printed_version; |
366 | 362 | ||
367 | if (!printed_version++) | 363 | if (!printed_version++) |
@@ -370,12 +366,12 @@ static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
370 | switch(sil680_init_chip(pdev)) | 366 | switch(sil680_init_chip(pdev)) |
371 | { | 367 | { |
372 | case 0: | 368 | case 0: |
373 | port_info[0] = port_info[1] = &info_slow; | 369 | ppi[0] = &info_slow; |
374 | break; | 370 | break; |
375 | case 0x30: | 371 | case 0x30: |
376 | return -ENODEV; | 372 | return -ENODEV; |
377 | } | 373 | } |
378 | return ata_pci_init_one(pdev, port_info, 2); | 374 | return ata_pci_init_one(pdev, ppi); |
379 | } | 375 | } |
380 | 376 | ||
381 | #ifdef CONFIG_PM | 377 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c index f5838cc11728..f2231267e011 100644 --- a/drivers/ata/pata_sis.c +++ b/drivers/ata/pata_sis.c | |||
@@ -38,8 +38,8 @@ | |||
38 | #define DRV_VERSION "0.5.1" | 38 | #define DRV_VERSION "0.5.1" |
39 | 39 | ||
40 | struct sis_chipset { | 40 | struct sis_chipset { |
41 | u16 device; /* PCI host ID */ | 41 | u16 device; /* PCI host ID */ |
42 | struct ata_port_info *info; /* Info block */ | 42 | const struct ata_port_info *info; /* Info block */ |
43 | /* Probably add family, cable detect type etc here to clean | 43 | /* Probably add family, cable detect type etc here to clean |
44 | up code later */ | 44 | up code later */ |
45 | }; | 45 | }; |
@@ -524,10 +524,6 @@ static struct scsi_host_template sis_sht = { | |||
524 | .slave_configure = ata_scsi_slave_config, | 524 | .slave_configure = ata_scsi_slave_config, |
525 | .slave_destroy = ata_scsi_slave_destroy, | 525 | .slave_destroy = ata_scsi_slave_destroy, |
526 | .bios_param = ata_std_bios_param, | 526 | .bios_param = ata_std_bios_param, |
527 | #ifdef CONFIG_PM | ||
528 | .resume = ata_scsi_device_resume, | ||
529 | .suspend = ata_scsi_device_suspend, | ||
530 | #endif | ||
531 | }; | 527 | }; |
532 | 528 | ||
533 | static const struct ata_port_operations sis_133_ops = { | 529 | static const struct ata_port_operations sis_133_ops = { |
@@ -700,7 +696,7 @@ static const struct ata_port_operations sis_old_ops = { | |||
700 | .port_start = ata_port_start, | 696 | .port_start = ata_port_start, |
701 | }; | 697 | }; |
702 | 698 | ||
703 | static struct ata_port_info sis_info = { | 699 | static const struct ata_port_info sis_info = { |
704 | .sht = &sis_sht, | 700 | .sht = &sis_sht, |
705 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 701 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
706 | .pio_mask = 0x1f, /* pio0-4 */ | 702 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -708,7 +704,7 @@ static struct ata_port_info sis_info = { | |||
708 | .udma_mask = 0, | 704 | .udma_mask = 0, |
709 | .port_ops = &sis_old_ops, | 705 | .port_ops = &sis_old_ops, |
710 | }; | 706 | }; |
711 | static struct ata_port_info sis_info33 = { | 707 | static const struct ata_port_info sis_info33 = { |
712 | .sht = &sis_sht, | 708 | .sht = &sis_sht, |
713 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 709 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
714 | .pio_mask = 0x1f, /* pio0-4 */ | 710 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -716,35 +712,35 @@ static struct ata_port_info sis_info33 = { | |||
716 | .udma_mask = ATA_UDMA2, /* UDMA 33 */ | 712 | .udma_mask = ATA_UDMA2, /* UDMA 33 */ |
717 | .port_ops = &sis_old_ops, | 713 | .port_ops = &sis_old_ops, |
718 | }; | 714 | }; |
719 | static struct ata_port_info sis_info66 = { | 715 | static const struct ata_port_info sis_info66 = { |
720 | .sht = &sis_sht, | 716 | .sht = &sis_sht, |
721 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 717 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
722 | .pio_mask = 0x1f, /* pio0-4 */ | 718 | .pio_mask = 0x1f, /* pio0-4 */ |
723 | .udma_mask = ATA_UDMA4, /* UDMA 66 */ | 719 | .udma_mask = ATA_UDMA4, /* UDMA 66 */ |
724 | .port_ops = &sis_66_ops, | 720 | .port_ops = &sis_66_ops, |
725 | }; | 721 | }; |
726 | static struct ata_port_info sis_info100 = { | 722 | static const struct ata_port_info sis_info100 = { |
727 | .sht = &sis_sht, | 723 | .sht = &sis_sht, |
728 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 724 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
729 | .pio_mask = 0x1f, /* pio0-4 */ | 725 | .pio_mask = 0x1f, /* pio0-4 */ |
730 | .udma_mask = ATA_UDMA5, | 726 | .udma_mask = ATA_UDMA5, |
731 | .port_ops = &sis_100_ops, | 727 | .port_ops = &sis_100_ops, |
732 | }; | 728 | }; |
733 | static struct ata_port_info sis_info100_early = { | 729 | static const struct ata_port_info sis_info100_early = { |
734 | .sht = &sis_sht, | 730 | .sht = &sis_sht, |
735 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 731 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
736 | .udma_mask = ATA_UDMA5, | 732 | .udma_mask = ATA_UDMA5, |
737 | .pio_mask = 0x1f, /* pio0-4 */ | 733 | .pio_mask = 0x1f, /* pio0-4 */ |
738 | .port_ops = &sis_66_ops, | 734 | .port_ops = &sis_66_ops, |
739 | }; | 735 | }; |
740 | struct ata_port_info sis_info133 = { | 736 | const struct ata_port_info sis_info133 = { |
741 | .sht = &sis_sht, | 737 | .sht = &sis_sht, |
742 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 738 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
743 | .pio_mask = 0x1f, /* pio0-4 */ | 739 | .pio_mask = 0x1f, /* pio0-4 */ |
744 | .udma_mask = ATA_UDMA6, | 740 | .udma_mask = ATA_UDMA6, |
745 | .port_ops = &sis_133_ops, | 741 | .port_ops = &sis_133_ops, |
746 | }; | 742 | }; |
747 | static struct ata_port_info sis_info133_early = { | 743 | static const struct ata_port_info sis_info133_early = { |
748 | .sht = &sis_sht, | 744 | .sht = &sis_sht, |
749 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 745 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
750 | .pio_mask = 0x1f, /* pio0-4 */ | 746 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -827,8 +823,8 @@ static void sis_fixup(struct pci_dev *pdev, struct sis_chipset *sis) | |||
827 | static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 823 | static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
828 | { | 824 | { |
829 | static int printed_version; | 825 | static int printed_version; |
830 | static struct ata_port_info *port_info[2]; | 826 | struct ata_port_info port; |
831 | struct ata_port_info *port; | 827 | const struct ata_port_info *ppi[] = { &port, NULL }; |
832 | struct pci_dev *host = NULL; | 828 | struct pci_dev *host = NULL; |
833 | struct sis_chipset *chipset = NULL; | 829 | struct sis_chipset *chipset = NULL; |
834 | struct sis_chipset *sets; | 830 | struct sis_chipset *sets; |
@@ -968,13 +964,12 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
968 | if (chipset == NULL) | 964 | if (chipset == NULL) |
969 | return -ENODEV; | 965 | return -ENODEV; |
970 | 966 | ||
971 | port = chipset->info; | 967 | port = *chipset->info; |
972 | port->private_data = chipset; | 968 | port.private_data = chipset; |
973 | 969 | ||
974 | sis_fixup(pdev, chipset); | 970 | sis_fixup(pdev, chipset); |
975 | 971 | ||
976 | port_info[0] = port_info[1] = port; | 972 | return ata_pci_init_one(pdev, ppi); |
977 | return ata_pci_init_one(pdev, port_info, 2); | ||
978 | } | 973 | } |
979 | 974 | ||
980 | static const struct pci_device_id sis_pci_tbl[] = { | 975 | static const struct pci_device_id sis_pci_tbl[] = { |
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c index 9aeffdbe2829..f48491ad5f3a 100644 --- a/drivers/ata/pata_sl82c105.c +++ b/drivers/ata/pata_sl82c105.c | |||
@@ -301,20 +301,22 @@ static int sl82c105_bridge_revision(struct pci_dev *pdev) | |||
301 | 301 | ||
302 | static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 302 | static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
303 | { | 303 | { |
304 | static struct ata_port_info info_dma = { | 304 | static const struct ata_port_info info_dma = { |
305 | .sht = &sl82c105_sht, | 305 | .sht = &sl82c105_sht, |
306 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 306 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
307 | .pio_mask = 0x1f, | 307 | .pio_mask = 0x1f, |
308 | .mwdma_mask = 0x07, | 308 | .mwdma_mask = 0x07, |
309 | .port_ops = &sl82c105_port_ops | 309 | .port_ops = &sl82c105_port_ops |
310 | }; | 310 | }; |
311 | static struct ata_port_info info_early = { | 311 | static const struct ata_port_info info_early = { |
312 | .sht = &sl82c105_sht, | 312 | .sht = &sl82c105_sht, |
313 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 313 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
314 | .pio_mask = 0x1f, | 314 | .pio_mask = 0x1f, |
315 | .port_ops = &sl82c105_port_ops | 315 | .port_ops = &sl82c105_port_ops |
316 | }; | 316 | }; |
317 | static struct ata_port_info *port_info[2] = { &info_early, &info_early }; | 317 | /* for now use only the first port */ |
318 | const struct ata_port_info *ppi[] = { &info_early, | ||
319 | &ata_dummy_port_info }; | ||
318 | u32 val; | 320 | u32 val; |
319 | int rev; | 321 | int rev; |
320 | 322 | ||
@@ -324,17 +326,14 @@ static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id | |||
324 | dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Unable to find bridge, disabling DMA.\n"); | 326 | dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Unable to find bridge, disabling DMA.\n"); |
325 | else if (rev <= 5) | 327 | else if (rev <= 5) |
326 | dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Early bridge revision, no DMA available.\n"); | 328 | dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Early bridge revision, no DMA available.\n"); |
327 | else { | 329 | else |
328 | port_info[0] = &info_dma; | 330 | ppi[0] = &info_dma; |
329 | port_info[1] = &info_dma; | ||
330 | } | ||
331 | 331 | ||
332 | pci_read_config_dword(dev, 0x40, &val); | 332 | pci_read_config_dword(dev, 0x40, &val); |
333 | val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; | 333 | val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; |
334 | pci_write_config_dword(dev, 0x40, val); | 334 | pci_write_config_dword(dev, 0x40, val); |
335 | 335 | ||
336 | 336 | return ata_pci_init_one(dev, ppi); | |
337 | return ata_pci_init_one(dev, port_info, 1); /* For now */ | ||
338 | } | 337 | } |
339 | 338 | ||
340 | static const struct pci_device_id sl82c105[] = { | 339 | static const struct pci_device_id sl82c105[] = { |
diff --git a/drivers/ata/pata_triflex.c b/drivers/ata/pata_triflex.c index 349887bf5b93..b1d3076dfe51 100644 --- a/drivers/ata/pata_triflex.c +++ b/drivers/ata/pata_triflex.c | |||
@@ -194,10 +194,6 @@ static struct scsi_host_template triflex_sht = { | |||
194 | .slave_configure = ata_scsi_slave_config, | 194 | .slave_configure = ata_scsi_slave_config, |
195 | .slave_destroy = ata_scsi_slave_destroy, | 195 | .slave_destroy = ata_scsi_slave_destroy, |
196 | .bios_param = ata_std_bios_param, | 196 | .bios_param = ata_std_bios_param, |
197 | #ifdef CONFIG_PM | ||
198 | .resume = ata_scsi_device_resume, | ||
199 | .suspend = ata_scsi_device_suspend, | ||
200 | #endif | ||
201 | }; | 197 | }; |
202 | 198 | ||
203 | static struct ata_port_operations triflex_port_ops = { | 199 | static struct ata_port_operations triflex_port_ops = { |
@@ -237,20 +233,20 @@ static struct ata_port_operations triflex_port_ops = { | |||
237 | 233 | ||
238 | static int triflex_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 234 | static int triflex_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
239 | { | 235 | { |
240 | static struct ata_port_info info = { | 236 | static const struct ata_port_info info = { |
241 | .sht = &triflex_sht, | 237 | .sht = &triflex_sht, |
242 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | 238 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, |
243 | .pio_mask = 0x1f, | 239 | .pio_mask = 0x1f, |
244 | .mwdma_mask = 0x07, | 240 | .mwdma_mask = 0x07, |
245 | .port_ops = &triflex_port_ops | 241 | .port_ops = &triflex_port_ops |
246 | }; | 242 | }; |
247 | static struct ata_port_info *port_info[2] = { &info, &info }; | 243 | const struct ata_port_info *ppi[] = { &info, NULL }; |
248 | static int printed_version; | 244 | static int printed_version; |
249 | 245 | ||
250 | if (!printed_version++) | 246 | if (!printed_version++) |
251 | dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); | 247 | dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); |
252 | 248 | ||
253 | return ata_pci_init_one(dev, port_info, 2); | 249 | return ata_pci_init_one(dev, ppi); |
254 | } | 250 | } |
255 | 251 | ||
256 | static const struct pci_device_id triflex[] = { | 252 | static const struct pci_device_id triflex[] = { |
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 362beb2f489c..e4c71f76bd55 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
@@ -301,10 +301,6 @@ static struct scsi_host_template via_sht = { | |||
301 | .slave_configure = ata_scsi_slave_config, | 301 | .slave_configure = ata_scsi_slave_config, |
302 | .slave_destroy = ata_scsi_slave_destroy, | 302 | .slave_destroy = ata_scsi_slave_destroy, |
303 | .bios_param = ata_std_bios_param, | 303 | .bios_param = ata_std_bios_param, |
304 | #ifdef CONFIG_PM | ||
305 | .resume = ata_scsi_device_resume, | ||
306 | .suspend = ata_scsi_device_suspend, | ||
307 | #endif | ||
308 | }; | 304 | }; |
309 | 305 | ||
310 | static struct ata_port_operations via_port_ops = { | 306 | static struct ata_port_operations via_port_ops = { |
@@ -425,7 +421,7 @@ static void via_config_fifo(struct pci_dev *pdev, unsigned int flags) | |||
425 | static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 421 | static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
426 | { | 422 | { |
427 | /* Early VIA without UDMA support */ | 423 | /* Early VIA without UDMA support */ |
428 | static struct ata_port_info via_mwdma_info = { | 424 | static const struct ata_port_info via_mwdma_info = { |
429 | .sht = &via_sht, | 425 | .sht = &via_sht, |
430 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, | 426 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, |
431 | .pio_mask = 0x1f, | 427 | .pio_mask = 0x1f, |
@@ -433,7 +429,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
433 | .port_ops = &via_port_ops | 429 | .port_ops = &via_port_ops |
434 | }; | 430 | }; |
435 | /* Ditto with IRQ masking required */ | 431 | /* Ditto with IRQ masking required */ |
436 | static struct ata_port_info via_mwdma_info_borked = { | 432 | static const struct ata_port_info via_mwdma_info_borked = { |
437 | .sht = &via_sht, | 433 | .sht = &via_sht, |
438 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, | 434 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, |
439 | .pio_mask = 0x1f, | 435 | .pio_mask = 0x1f, |
@@ -441,7 +437,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
441 | .port_ops = &via_port_ops_noirq, | 437 | .port_ops = &via_port_ops_noirq, |
442 | }; | 438 | }; |
443 | /* VIA UDMA 33 devices (and borked 66) */ | 439 | /* VIA UDMA 33 devices (and borked 66) */ |
444 | static struct ata_port_info via_udma33_info = { | 440 | static const struct ata_port_info via_udma33_info = { |
445 | .sht = &via_sht, | 441 | .sht = &via_sht, |
446 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, | 442 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, |
447 | .pio_mask = 0x1f, | 443 | .pio_mask = 0x1f, |
@@ -450,7 +446,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
450 | .port_ops = &via_port_ops | 446 | .port_ops = &via_port_ops |
451 | }; | 447 | }; |
452 | /* VIA UDMA 66 devices */ | 448 | /* VIA UDMA 66 devices */ |
453 | static struct ata_port_info via_udma66_info = { | 449 | static const struct ata_port_info via_udma66_info = { |
454 | .sht = &via_sht, | 450 | .sht = &via_sht, |
455 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, | 451 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, |
456 | .pio_mask = 0x1f, | 452 | .pio_mask = 0x1f, |
@@ -459,7 +455,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
459 | .port_ops = &via_port_ops | 455 | .port_ops = &via_port_ops |
460 | }; | 456 | }; |
461 | /* VIA UDMA 100 devices */ | 457 | /* VIA UDMA 100 devices */ |
462 | static struct ata_port_info via_udma100_info = { | 458 | static const struct ata_port_info via_udma100_info = { |
463 | .sht = &via_sht, | 459 | .sht = &via_sht, |
464 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, | 460 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, |
465 | .pio_mask = 0x1f, | 461 | .pio_mask = 0x1f, |
@@ -468,7 +464,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
468 | .port_ops = &via_port_ops | 464 | .port_ops = &via_port_ops |
469 | }; | 465 | }; |
470 | /* UDMA133 with bad AST (All current 133) */ | 466 | /* UDMA133 with bad AST (All current 133) */ |
471 | static struct ata_port_info via_udma133_info = { | 467 | static const struct ata_port_info via_udma133_info = { |
472 | .sht = &via_sht, | 468 | .sht = &via_sht, |
473 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, | 469 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, |
474 | .pio_mask = 0x1f, | 470 | .pio_mask = 0x1f, |
@@ -476,7 +472,8 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
476 | .udma_mask = 0x7f, /* FIXME: should check north bridge */ | 472 | .udma_mask = 0x7f, /* FIXME: should check north bridge */ |
477 | .port_ops = &via_port_ops | 473 | .port_ops = &via_port_ops |
478 | }; | 474 | }; |
479 | struct ata_port_info *port_info[2], *type; | 475 | struct ata_port_info type; |
476 | const struct ata_port_info *ppi[] = { &type, NULL }; | ||
480 | struct pci_dev *isa = NULL; | 477 | struct pci_dev *isa = NULL; |
481 | const struct via_isa_bridge *config; | 478 | const struct via_isa_bridge *config; |
482 | static int printed_version; | 479 | static int printed_version; |
@@ -521,25 +518,25 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
521 | switch(config->flags & VIA_UDMA) { | 518 | switch(config->flags & VIA_UDMA) { |
522 | case VIA_UDMA_NONE: | 519 | case VIA_UDMA_NONE: |
523 | if (config->flags & VIA_NO_UNMASK) | 520 | if (config->flags & VIA_NO_UNMASK) |
524 | type = &via_mwdma_info_borked; | 521 | type = via_mwdma_info_borked; |
525 | else | 522 | else |
526 | type = &via_mwdma_info; | 523 | type = via_mwdma_info; |
527 | break; | 524 | break; |
528 | case VIA_UDMA_33: | 525 | case VIA_UDMA_33: |
529 | type = &via_udma33_info; | 526 | type = via_udma33_info; |
530 | break; | 527 | break; |
531 | case VIA_UDMA_66: | 528 | case VIA_UDMA_66: |
532 | type = &via_udma66_info; | 529 | type = via_udma66_info; |
533 | /* The 66 MHz devices require we enable the clock */ | 530 | /* The 66 MHz devices require we enable the clock */ |
534 | pci_read_config_dword(pdev, 0x50, &timing); | 531 | pci_read_config_dword(pdev, 0x50, &timing); |
535 | timing |= 0x80008; | 532 | timing |= 0x80008; |
536 | pci_write_config_dword(pdev, 0x50, timing); | 533 | pci_write_config_dword(pdev, 0x50, timing); |
537 | break; | 534 | break; |
538 | case VIA_UDMA_100: | 535 | case VIA_UDMA_100: |
539 | type = &via_udma100_info; | 536 | type = via_udma100_info; |
540 | break; | 537 | break; |
541 | case VIA_UDMA_133: | 538 | case VIA_UDMA_133: |
542 | type = &via_udma133_info; | 539 | type = via_udma133_info; |
543 | break; | 540 | break; |
544 | default: | 541 | default: |
545 | WARN_ON(1); | 542 | WARN_ON(1); |
@@ -554,10 +551,9 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
554 | } | 551 | } |
555 | 552 | ||
556 | /* We have established the device type, now fire it up */ | 553 | /* We have established the device type, now fire it up */ |
557 | type->private_data = (void *)config; | 554 | type.private_data = (void *)config; |
558 | 555 | ||
559 | port_info[0] = port_info[1] = type; | 556 | return ata_pci_init_one(pdev, ppi); |
560 | return ata_pci_init_one(pdev, port_info, 2); | ||
561 | } | 557 | } |
562 | 558 | ||
563 | #ifdef CONFIG_PM | 559 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c index b3b62e985f19..bda5e7747c21 100644 --- a/drivers/ata/sata_inic162x.c +++ b/drivers/ata/sata_inic162x.c | |||
@@ -135,10 +135,6 @@ static struct scsi_host_template inic_sht = { | |||
135 | .slave_configure = inic_slave_config, | 135 | .slave_configure = inic_slave_config, |
136 | .slave_destroy = ata_scsi_slave_destroy, | 136 | .slave_destroy = ata_scsi_slave_destroy, |
137 | .bios_param = ata_std_bios_param, | 137 | .bios_param = ata_std_bios_param, |
138 | #ifdef CONFIG_PM | ||
139 | .suspend = ata_scsi_device_suspend, | ||
140 | .resume = ata_scsi_device_resume, | ||
141 | #endif | ||
142 | }; | 138 | }; |
143 | 139 | ||
144 | static const int scr_map[] = { | 140 | static const int scr_map[] = { |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index a097595d4dc7..4cea3ef75226 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -325,10 +325,6 @@ static struct scsi_host_template nv_sht = { | |||
325 | .slave_configure = ata_scsi_slave_config, | 325 | .slave_configure = ata_scsi_slave_config, |
326 | .slave_destroy = ata_scsi_slave_destroy, | 326 | .slave_destroy = ata_scsi_slave_destroy, |
327 | .bios_param = ata_std_bios_param, | 327 | .bios_param = ata_std_bios_param, |
328 | #ifdef CONFIG_PM | ||
329 | .suspend = ata_scsi_device_suspend, | ||
330 | .resume = ata_scsi_device_resume, | ||
331 | #endif | ||
332 | }; | 328 | }; |
333 | 329 | ||
334 | static struct scsi_host_template nv_adma_sht = { | 330 | static struct scsi_host_template nv_adma_sht = { |
@@ -347,10 +343,6 @@ static struct scsi_host_template nv_adma_sht = { | |||
347 | .slave_configure = nv_adma_slave_config, | 343 | .slave_configure = nv_adma_slave_config, |
348 | .slave_destroy = ata_scsi_slave_destroy, | 344 | .slave_destroy = ata_scsi_slave_destroy, |
349 | .bios_param = ata_std_bios_param, | 345 | .bios_param = ata_std_bios_param, |
350 | #ifdef CONFIG_PM | ||
351 | .suspend = ata_scsi_device_suspend, | ||
352 | .resume = ata_scsi_device_resume, | ||
353 | #endif | ||
354 | }; | 346 | }; |
355 | 347 | ||
356 | static const struct ata_port_operations nv_generic_ops = { | 348 | static const struct ata_port_operations nv_generic_ops = { |
@@ -465,7 +457,7 @@ static const struct ata_port_operations nv_adma_ops = { | |||
465 | .host_stop = nv_adma_host_stop, | 457 | .host_stop = nv_adma_host_stop, |
466 | }; | 458 | }; |
467 | 459 | ||
468 | static struct ata_port_info nv_port_info[] = { | 460 | static const struct ata_port_info nv_port_info[] = { |
469 | /* generic */ | 461 | /* generic */ |
470 | { | 462 | { |
471 | .sht = &nv_sht, | 463 | .sht = &nv_sht, |
@@ -1545,7 +1537,7 @@ static void nv_adma_error_handler(struct ata_port *ap) | |||
1545 | static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 1537 | static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) |
1546 | { | 1538 | { |
1547 | static int printed_version = 0; | 1539 | static int printed_version = 0; |
1548 | const struct ata_port_info *ppi[2]; | 1540 | const struct ata_port_info *ppi[] = { NULL, NULL }; |
1549 | struct ata_host *host; | 1541 | struct ata_host *host; |
1550 | struct nv_host_priv *hpriv; | 1542 | struct nv_host_priv *hpriv; |
1551 | int rc; | 1543 | int rc; |
@@ -1573,8 +1565,8 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1573 | type = ADMA; | 1565 | type = ADMA; |
1574 | } | 1566 | } |
1575 | 1567 | ||
1576 | ppi[0] = ppi[1] = &nv_port_info[type]; | 1568 | ppi[0] = &nv_port_info[type]; |
1577 | rc = ata_pci_prepare_native_host(pdev, ppi, 2, &host); | 1569 | rc = ata_pci_prepare_native_host(pdev, ppi, &host); |
1578 | if (rc) | 1570 | if (rc) |
1579 | return rc; | 1571 | return rc; |
1580 | 1572 | ||
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index 0a1e417f309c..e8483aadd11b 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c | |||
@@ -182,10 +182,6 @@ static struct scsi_host_template sil_sht = { | |||
182 | .slave_configure = ata_scsi_slave_config, | 182 | .slave_configure = ata_scsi_slave_config, |
183 | .slave_destroy = ata_scsi_slave_destroy, | 183 | .slave_destroy = ata_scsi_slave_destroy, |
184 | .bios_param = ata_std_bios_param, | 184 | .bios_param = ata_std_bios_param, |
185 | #ifdef CONFIG_PM | ||
186 | .suspend = ata_scsi_device_suspend, | ||
187 | .resume = ata_scsi_device_resume, | ||
188 | #endif | ||
189 | }; | 185 | }; |
190 | 186 | ||
191 | static const struct ata_port_operations sil_ops = { | 187 | static const struct ata_port_operations sil_ops = { |
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index b97ee9f31aec..a69d78cd8e9b 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -380,10 +380,6 @@ static struct scsi_host_template sil24_sht = { | |||
380 | .slave_configure = ata_scsi_slave_config, | 380 | .slave_configure = ata_scsi_slave_config, |
381 | .slave_destroy = ata_scsi_slave_destroy, | 381 | .slave_destroy = ata_scsi_slave_destroy, |
382 | .bios_param = ata_std_bios_param, | 382 | .bios_param = ata_std_bios_param, |
383 | #ifdef CONFIG_PM | ||
384 | .suspend = ata_scsi_device_suspend, | ||
385 | .resume = ata_scsi_device_resume, | ||
386 | #endif | ||
387 | }; | 383 | }; |
388 | 384 | ||
389 | static const struct ata_port_operations sil24_ops = { | 385 | static const struct ata_port_operations sil24_ops = { |
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c index d8ee062e82fc..ee66c5fa7ac8 100644 --- a/drivers/ata/sata_sis.c +++ b/drivers/ata/sata_sis.c | |||
@@ -129,7 +129,7 @@ static const struct ata_port_operations sis_ops = { | |||
129 | .port_start = ata_port_start, | 129 | .port_start = ata_port_start, |
130 | }; | 130 | }; |
131 | 131 | ||
132 | static struct ata_port_info sis_port_info = { | 132 | static const struct ata_port_info sis_port_info = { |
133 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, | 133 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, |
134 | .pio_mask = 0x1f, | 134 | .pio_mask = 0x1f, |
135 | .mwdma_mask = 0x7, | 135 | .mwdma_mask = 0x7, |
@@ -255,7 +255,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
255 | { | 255 | { |
256 | static int printed_version; | 256 | static int printed_version; |
257 | struct ata_port_info pi = sis_port_info; | 257 | struct ata_port_info pi = sis_port_info; |
258 | const struct ata_port_info *ppi[2] = { &pi, &pi }; | 258 | const struct ata_port_info *ppi[] = { &pi, NULL }; |
259 | struct ata_host *host; | 259 | struct ata_host *host; |
260 | u32 genctl, val; | 260 | u32 genctl, val; |
261 | u8 pmr; | 261 | u8 pmr; |
@@ -335,7 +335,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
335 | break; | 335 | break; |
336 | } | 336 | } |
337 | 337 | ||
338 | rc = ata_pci_prepare_native_host(pdev, ppi, 2, &host); | 338 | rc = ata_pci_prepare_native_host(pdev, ppi, &host); |
339 | if (rc) | 339 | if (rc) |
340 | return rc; | 340 | return rc; |
341 | 341 | ||
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c index f74e383de083..006f5e352658 100644 --- a/drivers/ata/sata_uli.c +++ b/drivers/ata/sata_uli.c | |||
@@ -125,7 +125,7 @@ static const struct ata_port_operations uli_ops = { | |||
125 | .port_start = ata_port_start, | 125 | .port_start = ata_port_start, |
126 | }; | 126 | }; |
127 | 127 | ||
128 | static struct ata_port_info uli_port_info = { | 128 | static const struct ata_port_info uli_port_info = { |
129 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 129 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
130 | ATA_FLAG_IGN_SIMPLEX, | 130 | ATA_FLAG_IGN_SIMPLEX, |
131 | .pio_mask = 0x1f, /* pio0-4 */ | 131 | .pio_mask = 0x1f, /* pio0-4 */ |
@@ -201,19 +201,33 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
201 | n_ports = 2; | 201 | n_ports = 2; |
202 | if (board_idx == uli_5287) | 202 | if (board_idx == uli_5287) |
203 | n_ports = 4; | 203 | n_ports = 4; |
204 | rc = ata_pci_prepare_native_host(pdev, ppi, n_ports, &host); | 204 | |
205 | if (rc) | 205 | /* allocate the host */ |
206 | return rc; | 206 | host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); |
207 | if (!host) | ||
208 | return -ENOMEM; | ||
207 | 209 | ||
208 | hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); | 210 | hpriv = devm_kzalloc(&pdev->dev, sizeof(*hpriv), GFP_KERNEL); |
209 | if (!hpriv) | 211 | if (!hpriv) |
210 | return -ENOMEM; | 212 | return -ENOMEM; |
211 | host->private_data = hpriv; | 213 | host->private_data = hpriv; |
212 | 214 | ||
215 | /* the first two ports are standard SFF */ | ||
216 | rc = ata_pci_init_native_host(host); | ||
217 | if (rc) | ||
218 | return rc; | ||
219 | |||
220 | rc = ata_pci_init_bmdma(host); | ||
221 | if (rc) | ||
222 | return rc; | ||
223 | |||
213 | iomap = host->iomap; | 224 | iomap = host->iomap; |
214 | 225 | ||
215 | switch (board_idx) { | 226 | switch (board_idx) { |
216 | case uli_5287: | 227 | case uli_5287: |
228 | /* If there are four, the last two live right after | ||
229 | * the standard SFF ports. | ||
230 | */ | ||
217 | hpriv->scr_cfg_addr[0] = ULI5287_BASE; | 231 | hpriv->scr_cfg_addr[0] = ULI5287_BASE; |
218 | hpriv->scr_cfg_addr[1] = ULI5287_BASE + ULI5287_OFFS; | 232 | hpriv->scr_cfg_addr[1] = ULI5287_BASE + ULI5287_OFFS; |
219 | 233 | ||
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index 939c9246fdd1..d105d2c189d2 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -116,10 +116,6 @@ static struct scsi_host_template svia_sht = { | |||
116 | .slave_configure = ata_scsi_slave_config, | 116 | .slave_configure = ata_scsi_slave_config, |
117 | .slave_destroy = ata_scsi_slave_destroy, | 117 | .slave_destroy = ata_scsi_slave_destroy, |
118 | .bios_param = ata_std_bios_param, | 118 | .bios_param = ata_std_bios_param, |
119 | #ifdef CONFIG_PM | ||
120 | .suspend = ata_scsi_device_suspend, | ||
121 | .resume = ata_scsi_device_resume, | ||
122 | #endif | ||
123 | }; | 119 | }; |
124 | 120 | ||
125 | static const struct ata_port_operations vt6420_sata_ops = { | 121 | static const struct ata_port_operations vt6420_sata_ops = { |
@@ -415,7 +411,7 @@ static int vt6420_prepare_host(struct pci_dev *pdev, struct ata_host **r_host) | |||
415 | struct ata_host *host; | 411 | struct ata_host *host; |
416 | int rc; | 412 | int rc; |
417 | 413 | ||
418 | rc = ata_pci_prepare_native_host(pdev, ppi, 2, &host); | 414 | rc = ata_pci_prepare_native_host(pdev, ppi, &host); |
419 | if (rc) | 415 | if (rc) |
420 | return rc; | 416 | return rc; |
421 | *r_host = host; | 417 | *r_host = host; |
diff --git a/drivers/ata/sis.h b/drivers/ata/sis.h index 231da8fc2200..0f2208d8d5ef 100644 --- a/drivers/ata/sis.h +++ b/drivers/ata/sis.h | |||
@@ -2,4 +2,4 @@ | |||
2 | struct ata_port_info; | 2 | struct ata_port_info; |
3 | 3 | ||
4 | /* pata_sis.c */ | 4 | /* pata_sis.c */ |
5 | extern struct ata_port_info sis_info133; | 5 | extern const struct ata_port_info sis_info133; |