Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev

* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev:
pata_platform: don't use generic ata_port_start
Use menuconfig objects: libata
add the ATI SB700 SATA controller device id to AHCI pci table
Add the combined mode for ATI SB700
pata_pcmcia: recognize 2GB CompactFlash from Transcend
git-libata-all: sata_via build fix
libata-acpi: clean up parameters and misc stuff
libata-acpi: s/CONFIG_SATA_ACPI/CONFIG_ATA_ACPI/
libata: give devices one last chance even if recovery failed with -EINVAL
libata: fallback to the other IDENTIFY on device error, take#2
libata: ignore EH scheduling during initialization
libata: clean up SFF init mess
libata: implement libata.spindown_compat
libata: reimplement suspend/resume support using sdev->manage_start_stop

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