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

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

Pull libata updates from Jeff Garzik:
"Notable changes:

- Updating libata to directly bind with ACPI / runtime power mgmt.
This is a pre-req for SATA ZPODD (CD-ROM power management).

Touches ACPI (exports++) and SCSI in minor ways. Has been in
linux-next for weeks.

The rest of this should come via SCSI tree, as it involves a lot of
updates to the 'sr' driver etc.

Other, minor changes:

- module_pci_driver() removes a lot of common boilerplate from each
PCI driver

- minor coding style, whitespace cleanups

- pata_pcmcia bug fix, caught by Coccinelle

- pata_imx, sata_dwc_460ex minor vendor updates

- ahci_platform: use simple PM ops, and thereby add hibernation cb's

- Add a few device-specific quirks"

* tag 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev: (23 commits)
[libata] pata_cmd64x: whitespace cleanup
libata-acpi: fix up for acpi_pm_device_sleep_state API
sata_dwc_460ex: device tree may specify dma_channel
ahci, trivial: fixed coding style issues related to braces
ahci_platform: add hibernation callbacks
libata-eh.c: local functions should not be exposed globally
libata-transport.c: local functions should not be exposed globally
sata_dwc_460ex: support hardreset
ata: use module_pci_driver
drivers/ata/pata_pcmcia.c: adjust suspicious bit operation
pata_imx: Convert to clk_prepare_enable/clk_disable_unprepare
ahci: Enable SB600 64bit DMA on MSI K9AGM2 (MS-7327) v2
[libata] Prevent interface errors with Seagate FreeAgent GoFlex
drivers/acpi/glue: revert accidental license-related 6b66d95895c bits
libata-acpi: add missing inlines in libata.h
libata: tell scsi layer device supports runtime power off
libata: detect Device Attention support
libata-acpi: register/unregister device to/from power resource
libata-acpi: add ata port runtime D3Cold support
libata-acpi: set acpi state for SATA port
...

+510 -959
+2 -2
drivers/acpi/glue.c
··· 39 39 } 40 40 return -ENODEV; 41 41 } 42 + EXPORT_SYMBOL_GPL(register_acpi_bus_type); 42 43 43 44 int unregister_acpi_bus_type(struct acpi_bus_type *type) 44 45 { ··· 55 54 } 56 55 return -ENODEV; 57 56 } 57 + EXPORT_SYMBOL_GPL(unregister_acpi_bus_type); 58 58 59 59 static struct acpi_bus_type *acpi_get_bus_type(struct bus_type *type) 60 60 { ··· 71 69 up_read(&bus_type_sem); 72 70 return ret; 73 71 } 74 - EXPORT_SYMBOL_GPL(register_acpi_bus_type); 75 72 76 73 static int acpi_find_bridge_device(struct device *dev, acpi_handle * handle) 77 74 { ··· 87 86 up_read(&bus_type_sem); 88 87 return ret; 89 88 } 90 - EXPORT_SYMBOL_GPL(unregister_acpi_bus_type); 91 89 92 90 /* Get device's handler per its address under its parent */ 93 91 struct acpi_find_child {
+2
drivers/acpi/power.c
··· 392 392 __acpi_power_resource_unregister_device(dev, 393 393 list->handles[i]); 394 394 } 395 + EXPORT_SYMBOL_GPL(acpi_power_resource_unregister_device); 395 396 396 397 static int __acpi_power_resource_register_device( 397 398 struct acpi_power_managed_device *powered_device, acpi_handle handle) ··· 463 462 printk(KERN_WARNING PREFIX "Invalid Power Resource to register!"); 464 463 return -ENODEV; 465 464 } 465 + EXPORT_SYMBOL_GPL(acpi_power_resource_register_device); 466 466 467 467 /** 468 468 * acpi_device_sleep_wake - execute _DSW (Device Sleep Wake) or (deprecated in
+2
drivers/acpi/sleep.c
··· 809 809 } 810 810 return d_max; 811 811 } 812 + EXPORT_SYMBOL(acpi_pm_device_sleep_state); 812 813 #endif /* CONFIG_PM */ 813 814 814 815 #ifdef CONFIG_PM_SLEEP ··· 846 845 847 846 return 0; 848 847 } 848 + EXPORT_SYMBOL(acpi_pm_device_run_wake); 849 849 850 850 /** 851 851 * acpi_pm_device_sleep_wake - enable or disable the system wake-up
+1 -12
drivers/ata/acard-ahci.c
··· 503 503 &acard_ahci_sht); 504 504 } 505 505 506 - static int __init acard_ahci_init(void) 507 - { 508 - return pci_register_driver(&acard_ahci_pci_driver); 509 - } 510 - 511 - static void __exit acard_ahci_exit(void) 512 - { 513 - pci_unregister_driver(&acard_ahci_pci_driver); 514 - } 506 + module_pci_driver(acard_ahci_pci_driver); 515 507 516 508 MODULE_AUTHOR("Jeff Garzik"); 517 509 MODULE_DESCRIPTION("ACard AHCI SATA low-level driver"); 518 510 MODULE_LICENSE("GPL"); 519 511 MODULE_DEVICE_TABLE(pci, acard_ahci_pci_tbl); 520 512 MODULE_VERSION(DRV_VERSION); 521 - 522 - module_init(acard_ahci_init); 523 - module_exit(acard_ahci_exit);
+28 -35
drivers/ata/ahci.c
··· 105 105 106 106 static const struct ata_port_info ahci_port_info[] = { 107 107 /* by features */ 108 - [board_ahci] = 109 - { 108 + [board_ahci] = { 110 109 .flags = AHCI_FLAG_COMMON, 111 110 .pio_mask = ATA_PIO4, 112 111 .udma_mask = ATA_UDMA6, 113 112 .port_ops = &ahci_ops, 114 113 }, 115 - [board_ahci_ign_iferr] = 116 - { 114 + [board_ahci_ign_iferr] = { 117 115 AHCI_HFLAGS (AHCI_HFLAG_IGN_IRQ_IF_ERR), 118 116 .flags = AHCI_FLAG_COMMON, 119 117 .pio_mask = ATA_PIO4, 120 118 .udma_mask = ATA_UDMA6, 121 119 .port_ops = &ahci_ops, 122 120 }, 123 - [board_ahci_nosntf] = 124 - { 121 + [board_ahci_nosntf] = { 125 122 AHCI_HFLAGS (AHCI_HFLAG_NO_SNTF), 126 123 .flags = AHCI_FLAG_COMMON, 127 124 .pio_mask = ATA_PIO4, 128 125 .udma_mask = ATA_UDMA6, 129 126 .port_ops = &ahci_ops, 130 127 }, 131 - [board_ahci_yes_fbs] = 132 - { 128 + [board_ahci_yes_fbs] = { 133 129 AHCI_HFLAGS (AHCI_HFLAG_YES_FBS), 134 130 .flags = AHCI_FLAG_COMMON, 135 131 .pio_mask = ATA_PIO4, ··· 133 137 .port_ops = &ahci_ops, 134 138 }, 135 139 /* by chipsets */ 136 - [board_ahci_mcp65] = 137 - { 140 + [board_ahci_mcp65] = { 138 141 AHCI_HFLAGS (AHCI_HFLAG_NO_FPDMA_AA | AHCI_HFLAG_NO_PMP | 139 142 AHCI_HFLAG_YES_NCQ), 140 143 .flags = AHCI_FLAG_COMMON | ATA_FLAG_NO_DIPM, ··· 141 146 .udma_mask = ATA_UDMA6, 142 147 .port_ops = &ahci_ops, 143 148 }, 144 - [board_ahci_mcp77] = 145 - { 149 + [board_ahci_mcp77] = { 146 150 AHCI_HFLAGS (AHCI_HFLAG_NO_FPDMA_AA | AHCI_HFLAG_NO_PMP), 147 151 .flags = AHCI_FLAG_COMMON, 148 152 .pio_mask = ATA_PIO4, 149 153 .udma_mask = ATA_UDMA6, 150 154 .port_ops = &ahci_ops, 151 155 }, 152 - [board_ahci_mcp89] = 153 - { 156 + [board_ahci_mcp89] = { 154 157 AHCI_HFLAGS (AHCI_HFLAG_NO_FPDMA_AA), 155 158 .flags = AHCI_FLAG_COMMON, 156 159 .pio_mask = ATA_PIO4, 157 160 .udma_mask = ATA_UDMA6, 158 161 .port_ops = &ahci_ops, 159 162 }, 160 - [board_ahci_mv] = 161 - { 163 + [board_ahci_mv] = { 162 164 AHCI_HFLAGS (AHCI_HFLAG_NO_NCQ | AHCI_HFLAG_NO_MSI | 163 165 AHCI_HFLAG_MV_PATA | AHCI_HFLAG_NO_PMP), 164 166 .flags = ATA_FLAG_SATA | ATA_FLAG_PIO_DMA, ··· 163 171 .udma_mask = ATA_UDMA6, 164 172 .port_ops = &ahci_ops, 165 173 }, 166 - [board_ahci_sb600] = 167 - { 174 + [board_ahci_sb600] = { 168 175 AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL | 169 176 AHCI_HFLAG_NO_MSI | AHCI_HFLAG_SECT255 | 170 177 AHCI_HFLAG_32BIT_ONLY), ··· 172 181 .udma_mask = ATA_UDMA6, 173 182 .port_ops = &ahci_pmp_retry_srst_ops, 174 183 }, 175 - [board_ahci_sb700] = /* for SB700 and SB800 */ 176 - { 184 + [board_ahci_sb700] = { /* for SB700 and SB800 */ 177 185 AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL), 178 186 .flags = AHCI_FLAG_COMMON, 179 187 .pio_mask = ATA_PIO4, 180 188 .udma_mask = ATA_UDMA6, 181 189 .port_ops = &ahci_pmp_retry_srst_ops, 182 190 }, 183 - [board_ahci_vt8251] = 184 - { 191 + [board_ahci_vt8251] = { 185 192 AHCI_HFLAGS (AHCI_HFLAG_NO_NCQ | AHCI_HFLAG_NO_PMP), 186 193 .flags = AHCI_FLAG_COMMON, 187 194 .pio_mask = ATA_PIO4, ··· 766 777 }, 767 778 }, 768 779 /* 780 + * All BIOS versions for the MSI K9AGM2 (MS-7327) support 781 + * 64bit DMA. 782 + * 783 + * This board also had the typo mentioned above in the 784 + * Manufacturer DMI field (fixed in BIOS version 1.5), so 785 + * match on DMI_BOARD_VENDOR of "MICRO-STAR INTER" again. 786 + */ 787 + { 788 + .ident = "MSI K9AGM2", 789 + .matches = { 790 + DMI_MATCH(DMI_BOARD_VENDOR, 791 + "MICRO-STAR INTER"), 792 + DMI_MATCH(DMI_BOARD_NAME, "MS-7327"), 793 + }, 794 + }, 795 + /* 769 796 * All BIOS versions for the Asus M3A support 64bit DMA. 770 797 * (all release versions from 0301 to 1206 were tested) 771 798 */ ··· 1238 1233 &ahci_sht); 1239 1234 } 1240 1235 1241 - static int __init ahci_init(void) 1242 - { 1243 - return pci_register_driver(&ahci_pci_driver); 1244 - } 1245 - 1246 - static void __exit ahci_exit(void) 1247 - { 1248 - pci_unregister_driver(&ahci_pci_driver); 1249 - } 1250 - 1236 + module_pci_driver(ahci_pci_driver); 1251 1237 1252 1238 MODULE_AUTHOR("Jeff Garzik"); 1253 1239 MODULE_DESCRIPTION("AHCI SATA low-level driver"); 1254 1240 MODULE_LICENSE("GPL"); 1255 1241 MODULE_DEVICE_TABLE(pci, ahci_pci_tbl); 1256 1242 MODULE_VERSION(DRV_VERSION); 1257 - 1258 - module_init(ahci_init); 1259 - module_exit(ahci_exit);
+3 -7
drivers/ata/ahci_platform.c
··· 15 15 #include <linux/kernel.h> 16 16 #include <linux/gfp.h> 17 17 #include <linux/module.h> 18 + #include <linux/pm.h> 18 19 #include <linux/init.h> 19 20 #include <linux/interrupt.h> 20 21 #include <linux/device.h> ··· 272 271 273 272 return 0; 274 273 } 275 - 276 - static struct dev_pm_ops ahci_pm_ops = { 277 - .suspend = &ahci_suspend, 278 - .resume = &ahci_resume, 279 - }; 280 274 #endif 275 + 276 + SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_suspend, ahci_resume); 281 277 282 278 static const struct of_device_id ahci_of_match[] = { 283 279 { .compatible = "calxeda,hb-ahci", }, ··· 289 291 .name = "ahci", 290 292 .owner = THIS_MODULE, 291 293 .of_match_table = ahci_of_match, 292 - #ifdef CONFIG_PM 293 294 .pm = &ahci_pm_ops, 294 - #endif 295 295 }, 296 296 .id_table = ahci_devtype, 297 297 };
+1 -14
drivers/ata/ata_generic.c
··· 255 255 #endif 256 256 }; 257 257 258 - static int __init ata_generic_init(void) 259 - { 260 - return pci_register_driver(&ata_generic_pci_driver); 261 - } 262 - 263 - 264 - static void __exit ata_generic_exit(void) 265 - { 266 - pci_unregister_driver(&ata_generic_pci_driver); 267 - } 268 - 258 + module_pci_driver(ata_generic_pci_driver); 269 259 270 260 MODULE_AUTHOR("Alan Cox"); 271 261 MODULE_DESCRIPTION("low-level driver for generic ATA"); 272 262 MODULE_LICENSE("GPL"); 273 263 MODULE_DEVICE_TABLE(pci, ata_generic); 274 264 MODULE_VERSION(DRV_VERSION); 275 - 276 - module_init(ata_generic_init); 277 - module_exit(ata_generic_exit); 278 265 279 266 module_param(all_generic_ide, int, 0);
+292 -116
drivers/ata/libata-acpi.c
··· 16 16 #include <linux/libata.h> 17 17 #include <linux/pci.h> 18 18 #include <linux/slab.h> 19 + #include <linux/pm_runtime.h> 19 20 #include <scsi/scsi_device.h> 20 21 #include "libata.h" 21 22 ··· 49 48 } 50 49 51 50 /** 52 - * ata_acpi_associate_sata_port - associate SATA port with ACPI objects 53 - * @ap: target SATA port 51 + * ata_ap_acpi_handle - provide the acpi_handle for an ata_port 52 + * @ap: the acpi_handle returned will correspond to this port 54 53 * 55 - * Look up ACPI objects associated with @ap and initialize acpi_handle 56 - * fields of @ap, the port and devices accordingly. 57 - * 58 - * LOCKING: 59 - * EH context. 60 - * 61 - * RETURNS: 62 - * 0 on success, -errno on failure. 54 + * Returns the acpi_handle for the ACPI namespace object corresponding to 55 + * the ata_port passed into the function, or NULL if no such object exists 63 56 */ 64 - void ata_acpi_associate_sata_port(struct ata_port *ap) 57 + acpi_handle ata_ap_acpi_handle(struct ata_port *ap) 65 58 { 66 - WARN_ON(!(ap->flags & ATA_FLAG_ACPI_SATA)); 59 + if (ap->flags & ATA_FLAG_ACPI_SATA) 60 + return NULL; 67 61 68 - if (!sata_pmp_attached(ap)) { 69 - u64 adr = SATA_ADR(ap->port_no, NO_PORT_MULT); 70 - 71 - ap->link.device->acpi_handle = 72 - acpi_get_child(ap->host->acpi_handle, adr); 73 - } else { 74 - struct ata_link *link; 75 - 76 - ap->link.device->acpi_handle = NULL; 77 - 78 - ata_for_each_link(link, ap, EDGE) { 79 - u64 adr = SATA_ADR(ap->port_no, link->pmp); 80 - 81 - link->device->acpi_handle = 82 - acpi_get_child(ap->host->acpi_handle, adr); 83 - } 84 - } 62 + /* 63 + * If acpi bind operation has already happened, we can get the handle 64 + * for the port by checking the corresponding scsi_host device's 65 + * firmware node, otherwise we will need to find out the handle from 66 + * its parent's acpi node. 67 + */ 68 + if (ap->scsi_host) 69 + return DEVICE_ACPI_HANDLE(&ap->scsi_host->shost_gendev); 70 + else 71 + return acpi_get_child(DEVICE_ACPI_HANDLE(ap->host->dev), 72 + ap->port_no); 85 73 } 74 + EXPORT_SYMBOL(ata_ap_acpi_handle); 86 75 87 - static void ata_acpi_associate_ide_port(struct ata_port *ap) 76 + /** 77 + * ata_dev_acpi_handle - provide the acpi_handle for an ata_device 78 + * @dev: the acpi_device returned will correspond to this port 79 + * 80 + * Returns the acpi_handle for the ACPI namespace object corresponding to 81 + * the ata_device passed into the function, or NULL if no such object exists 82 + */ 83 + acpi_handle ata_dev_acpi_handle(struct ata_device *dev) 88 84 { 89 - int max_devices, i; 85 + acpi_integer adr; 86 + struct ata_port *ap = dev->link->ap; 90 87 91 - ap->acpi_handle = acpi_get_child(ap->host->acpi_handle, ap->port_no); 92 - if (!ap->acpi_handle) 93 - return; 94 - 95 - max_devices = 1; 96 - if (ap->flags & ATA_FLAG_SLAVE_POSS) 97 - max_devices++; 98 - 99 - for (i = 0; i < max_devices; i++) { 100 - struct ata_device *dev = &ap->link.device[i]; 101 - 102 - dev->acpi_handle = acpi_get_child(ap->acpi_handle, i); 103 - } 104 - 105 - if (ata_acpi_gtm(ap, &ap->__acpi_init_gtm) == 0) 106 - ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; 88 + if (ap->flags & ATA_FLAG_ACPI_SATA) { 89 + if (!sata_pmp_attached(ap)) 90 + adr = SATA_ADR(ap->port_no, NO_PORT_MULT); 91 + else 92 + adr = SATA_ADR(ap->port_no, dev->link->pmp); 93 + return acpi_get_child(DEVICE_ACPI_HANDLE(ap->host->dev), adr); 94 + } else 95 + return acpi_get_child(ata_ap_acpi_handle(ap), dev->devno); 107 96 } 97 + EXPORT_SYMBOL(ata_dev_acpi_handle); 108 98 109 99 /* @ap and @dev are the same as ata_acpi_handle_hotplug() */ 110 100 static void ata_acpi_detach_device(struct ata_port *ap, struct ata_device *dev) ··· 221 229 }; 222 230 223 231 /** 224 - * ata_acpi_associate - associate ATA host with ACPI objects 225 - * @host: target ATA host 226 - * 227 - * Look up ACPI objects associated with @host and initialize 228 - * acpi_handle fields of @host, its ports and devices accordingly. 229 - * 230 - * LOCKING: 231 - * EH context. 232 - * 233 - * RETURNS: 234 - * 0 on success, -errno on failure. 235 - */ 236 - void ata_acpi_associate(struct ata_host *host) 237 - { 238 - int i, j; 239 - 240 - if (!is_pci_dev(host->dev) || libata_noacpi) 241 - return; 242 - 243 - host->acpi_handle = DEVICE_ACPI_HANDLE(host->dev); 244 - if (!host->acpi_handle) 245 - return; 246 - 247 - for (i = 0; i < host->n_ports; i++) { 248 - struct ata_port *ap = host->ports[i]; 249 - 250 - if (host->ports[0]->flags & ATA_FLAG_ACPI_SATA) 251 - ata_acpi_associate_sata_port(ap); 252 - else 253 - ata_acpi_associate_ide_port(ap); 254 - 255 - if (ap->acpi_handle) { 256 - /* we might be on a docking station */ 257 - register_hotplug_dock_device(ap->acpi_handle, 258 - &ata_acpi_ap_dock_ops, ap); 259 - } 260 - 261 - for (j = 0; j < ata_link_max_devices(&ap->link); j++) { 262 - struct ata_device *dev = &ap->link.device[j]; 263 - 264 - if (dev->acpi_handle) { 265 - /* we might be on a docking station */ 266 - register_hotplug_dock_device(dev->acpi_handle, 267 - &ata_acpi_dev_dock_ops, dev); 268 - } 269 - } 270 - } 271 - } 272 - 273 - /** 274 232 * ata_acpi_dissociate - dissociate ATA host from ACPI objects 275 233 * @host: target ATA host 276 234 * ··· 241 299 struct ata_port *ap = host->ports[i]; 242 300 const struct ata_acpi_gtm *gtm = ata_acpi_init_gtm(ap); 243 301 244 - if (ap->acpi_handle && gtm) 302 + if (ata_ap_acpi_handle(ap) && gtm) 245 303 ata_acpi_stm(ap, gtm); 246 304 } 247 305 } ··· 266 324 acpi_status status; 267 325 int rc = 0; 268 326 269 - status = acpi_evaluate_object(ap->acpi_handle, "_GTM", NULL, &output); 327 + status = acpi_evaluate_object(ata_ap_acpi_handle(ap), "_GTM", NULL, 328 + &output); 270 329 271 330 rc = -ENOENT; 272 331 if (status == AE_NOT_FOUND) ··· 337 394 input.count = 3; 338 395 input.pointer = in_params; 339 396 340 - status = acpi_evaluate_object(ap->acpi_handle, "_STM", &input, NULL); 397 + status = acpi_evaluate_object(ata_ap_acpi_handle(ap), "_STM", &input, 398 + NULL); 341 399 342 400 if (status == AE_NOT_FOUND) 343 401 return -ENOENT; ··· 395 451 __func__, ap->port_no); 396 452 397 453 /* _GTF has no input parameters */ 398 - status = acpi_evaluate_object(dev->acpi_handle, "_GTF", NULL, &output); 454 + status = acpi_evaluate_object(ata_dev_acpi_handle(dev), "_GTF", NULL, 455 + &output); 399 456 out_obj = dev->gtf_cache = output.pointer; 400 457 401 458 if (ACPI_FAILURE(status)) { ··· 762 817 763 818 /* It's OK for _SDD to be missing too. */ 764 819 swap_buf_le16(dev->id, ATA_ID_WORDS); 765 - status = acpi_evaluate_object(dev->acpi_handle, "_SDD", &input, NULL); 820 + status = acpi_evaluate_object(ata_dev_acpi_handle(dev), "_SDD", &input, 821 + NULL); 766 822 swap_buf_le16(dev->id, ATA_ID_WORDS); 767 823 768 824 if (status == AE_NOT_FOUND) ··· 813 867 const struct ata_acpi_gtm *gtm = ata_acpi_init_gtm(ap); 814 868 struct ata_device *dev; 815 869 816 - if (ap->acpi_handle && gtm) { 870 + if (ata_ap_acpi_handle(ap) && gtm) { 817 871 /* _GTM valid */ 818 872 819 873 /* restore timing parameters */ ··· 853 907 void ata_acpi_set_state(struct ata_port *ap, pm_message_t state) 854 908 { 855 909 struct ata_device *dev; 856 - 857 - if (!ap->acpi_handle || (ap->flags & ATA_FLAG_ACPI_SATA)) 858 - return; 910 + acpi_handle handle; 911 + int acpi_state; 859 912 860 913 /* channel first and then drives for power on and vica versa 861 914 for power off */ 862 - if (state.event == PM_EVENT_ON) 863 - acpi_bus_set_power(ap->acpi_handle, ACPI_STATE_D0); 915 + handle = ata_ap_acpi_handle(ap); 916 + if (handle && state.event == PM_EVENT_ON) 917 + acpi_bus_set_power(handle, ACPI_STATE_D0); 864 918 865 919 ata_for_each_dev(dev, &ap->link, ENABLED) { 866 - if (dev->acpi_handle) 867 - acpi_bus_set_power(dev->acpi_handle, 868 - state.event == PM_EVENT_ON ? 869 - ACPI_STATE_D0 : ACPI_STATE_D3); 920 + handle = ata_dev_acpi_handle(dev); 921 + if (!handle) 922 + continue; 923 + 924 + if (state.event != PM_EVENT_ON) { 925 + acpi_state = acpi_pm_device_sleep_state( 926 + &dev->sdev->sdev_gendev, NULL, ACPI_STATE_D3); 927 + if (acpi_state > 0) 928 + acpi_bus_set_power(handle, acpi_state); 929 + /* TBD: need to check if it's runtime pm request */ 930 + acpi_pm_device_run_wake( 931 + &dev->sdev->sdev_gendev, true); 932 + } else { 933 + /* Ditto */ 934 + acpi_pm_device_run_wake( 935 + &dev->sdev->sdev_gendev, false); 936 + acpi_bus_set_power(handle, ACPI_STATE_D0); 937 + } 870 938 } 871 - if (state.event != PM_EVENT_ON) 872 - acpi_bus_set_power(ap->acpi_handle, ACPI_STATE_D3); 939 + 940 + handle = ata_ap_acpi_handle(ap); 941 + if (handle && state.event != PM_EVENT_ON) 942 + acpi_bus_set_power(handle, ACPI_STATE_D3); 873 943 } 874 944 875 945 /** ··· 910 948 int nr_executed = 0; 911 949 int rc; 912 950 913 - if (!dev->acpi_handle) 951 + if (!ata_dev_acpi_handle(dev)) 914 952 return 0; 915 953 916 954 /* do we need to do _GTF? */ ··· 956 994 } 957 995 958 996 ata_dev_warn(dev, "ACPI: failed the second time, disabled\n"); 959 - dev->acpi_handle = NULL; 960 997 961 998 /* We can safely continue if no _GTF command has been executed 962 999 * and port is not frozen. ··· 978 1017 void ata_acpi_on_disable(struct ata_device *dev) 979 1018 { 980 1019 ata_acpi_clear_gtf(dev); 1020 + } 1021 + 1022 + static void ata_acpi_wake_dev(acpi_handle handle, u32 event, void *context) 1023 + { 1024 + struct ata_device *ata_dev = context; 1025 + 1026 + if (event == ACPI_NOTIFY_DEVICE_WAKE && ata_dev && 1027 + pm_runtime_suspended(&ata_dev->sdev->sdev_gendev)) 1028 + scsi_autopm_get_device(ata_dev->sdev); 1029 + } 1030 + 1031 + static void ata_acpi_add_pm_notifier(struct ata_device *dev) 1032 + { 1033 + struct acpi_device *acpi_dev; 1034 + acpi_handle handle; 1035 + acpi_status status; 1036 + 1037 + handle = ata_dev_acpi_handle(dev); 1038 + if (!handle) 1039 + return; 1040 + 1041 + status = acpi_bus_get_device(handle, &acpi_dev); 1042 + if (ACPI_FAILURE(status)) 1043 + return; 1044 + 1045 + if (dev->sdev->can_power_off) { 1046 + acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, 1047 + ata_acpi_wake_dev, dev); 1048 + device_set_run_wake(&dev->sdev->sdev_gendev, true); 1049 + } 1050 + } 1051 + 1052 + static void ata_acpi_remove_pm_notifier(struct ata_device *dev) 1053 + { 1054 + struct acpi_device *acpi_dev; 1055 + acpi_handle handle; 1056 + acpi_status status; 1057 + 1058 + handle = ata_dev_acpi_handle(dev); 1059 + if (!handle) 1060 + return; 1061 + 1062 + status = acpi_bus_get_device(handle, &acpi_dev); 1063 + if (ACPI_FAILURE(status)) 1064 + return; 1065 + 1066 + if (dev->sdev->can_power_off) { 1067 + device_set_run_wake(&dev->sdev->sdev_gendev, false); 1068 + acpi_remove_notify_handler(handle, ACPI_SYSTEM_NOTIFY, 1069 + ata_acpi_wake_dev); 1070 + } 1071 + } 1072 + 1073 + static void ata_acpi_register_power_resource(struct ata_device *dev) 1074 + { 1075 + struct scsi_device *sdev = dev->sdev; 1076 + acpi_handle handle; 1077 + struct device *device; 1078 + 1079 + handle = ata_dev_acpi_handle(dev); 1080 + if (!handle) 1081 + return; 1082 + 1083 + device = &sdev->sdev_gendev; 1084 + 1085 + acpi_power_resource_register_device(device, handle); 1086 + } 1087 + 1088 + static void ata_acpi_unregister_power_resource(struct ata_device *dev) 1089 + { 1090 + struct scsi_device *sdev = dev->sdev; 1091 + acpi_handle handle; 1092 + struct device *device; 1093 + 1094 + handle = ata_dev_acpi_handle(dev); 1095 + if (!handle) 1096 + return; 1097 + 1098 + device = &sdev->sdev_gendev; 1099 + 1100 + acpi_power_resource_unregister_device(device, handle); 1101 + } 1102 + 1103 + void ata_acpi_bind(struct ata_device *dev) 1104 + { 1105 + ata_acpi_add_pm_notifier(dev); 1106 + ata_acpi_register_power_resource(dev); 1107 + } 1108 + 1109 + void ata_acpi_unbind(struct ata_device *dev) 1110 + { 1111 + ata_acpi_remove_pm_notifier(dev); 1112 + ata_acpi_unregister_power_resource(dev); 1113 + } 1114 + 1115 + static int compat_pci_ata(struct ata_port *ap) 1116 + { 1117 + struct device *dev = ap->tdev.parent; 1118 + struct pci_dev *pdev; 1119 + 1120 + if (!is_pci_dev(dev)) 1121 + return 0; 1122 + 1123 + pdev = to_pci_dev(dev); 1124 + 1125 + if ((pdev->class >> 8) != PCI_CLASS_STORAGE_SATA && 1126 + (pdev->class >> 8) != PCI_CLASS_STORAGE_IDE) 1127 + return 0; 1128 + 1129 + return 1; 1130 + } 1131 + 1132 + static int ata_acpi_bind_host(struct ata_port *ap, acpi_handle *handle) 1133 + { 1134 + if (ap->flags & ATA_FLAG_ACPI_SATA) 1135 + return -ENODEV; 1136 + 1137 + *handle = acpi_get_child(DEVICE_ACPI_HANDLE(ap->tdev.parent), 1138 + ap->port_no); 1139 + 1140 + if (!*handle) 1141 + return -ENODEV; 1142 + 1143 + return 0; 1144 + } 1145 + 1146 + static int ata_acpi_bind_device(struct ata_port *ap, struct scsi_device *sdev, 1147 + acpi_handle *handle) 1148 + { 1149 + struct ata_device *ata_dev; 1150 + acpi_status status; 1151 + struct acpi_device *acpi_dev; 1152 + struct acpi_device_power_state *states; 1153 + 1154 + if (ap->flags & ATA_FLAG_ACPI_SATA) 1155 + ata_dev = &ap->link.device[sdev->channel]; 1156 + else 1157 + ata_dev = &ap->link.device[sdev->id]; 1158 + 1159 + *handle = ata_dev_acpi_handle(ata_dev); 1160 + 1161 + if (!*handle) 1162 + return -ENODEV; 1163 + 1164 + status = acpi_bus_get_device(*handle, &acpi_dev); 1165 + if (ACPI_FAILURE(status)) 1166 + return 0; 1167 + 1168 + /* 1169 + * If firmware has _PS3 or _PR3 for this device, 1170 + * and this ata ODD device support device attention, 1171 + * it means this device can be powered off 1172 + */ 1173 + states = acpi_dev->power.states; 1174 + if ((states[ACPI_STATE_D3_HOT].flags.valid || 1175 + states[ACPI_STATE_D3_COLD].flags.explicit_set) && 1176 + ata_dev->flags & ATA_DFLAG_DA) 1177 + sdev->can_power_off = 1; 1178 + 1179 + return 0; 1180 + } 1181 + 1182 + static int is_ata_port(const struct device *dev) 1183 + { 1184 + return dev->type == &ata_port_type; 1185 + } 1186 + 1187 + static struct ata_port *dev_to_ata_port(struct device *dev) 1188 + { 1189 + while (!is_ata_port(dev)) { 1190 + if (!dev->parent) 1191 + return NULL; 1192 + dev = dev->parent; 1193 + } 1194 + return to_ata_port(dev); 1195 + } 1196 + 1197 + static int ata_acpi_find_device(struct device *dev, acpi_handle *handle) 1198 + { 1199 + struct ata_port *ap = dev_to_ata_port(dev); 1200 + 1201 + if (!ap) 1202 + return -ENODEV; 1203 + 1204 + if (!compat_pci_ata(ap)) 1205 + return -ENODEV; 1206 + 1207 + if (scsi_is_host_device(dev)) 1208 + return ata_acpi_bind_host(ap, handle); 1209 + else if (scsi_is_sdev_device(dev)) { 1210 + struct scsi_device *sdev = to_scsi_device(dev); 1211 + 1212 + return ata_acpi_bind_device(ap, sdev, handle); 1213 + } else 1214 + return -ENODEV; 1215 + } 1216 + 1217 + static int ata_acpi_find_dummy(struct device *dev, acpi_handle *handle) 1218 + { 1219 + return -ENODEV; 1220 + } 1221 + 1222 + static struct acpi_bus_type ata_acpi_bus = { 1223 + .find_bridge = ata_acpi_find_dummy, 1224 + .find_device = ata_acpi_find_device, 1225 + }; 1226 + 1227 + int ata_acpi_register(void) 1228 + { 1229 + return scsi_register_acpi_bus_type(&ata_acpi_bus); 1230 + } 1231 + 1232 + void ata_acpi_unregister(void) 1233 + { 1234 + scsi_unregister_acpi_bus_type(&ata_acpi_bus); 981 1235 }
+7 -5
drivers/ata/libata-core.c
··· 2376 2376 dma_dir_string = ", DMADIR"; 2377 2377 } 2378 2378 2379 + if (ata_id_has_da(dev->id)) 2380 + dev->flags |= ATA_DFLAG_DA; 2381 + 2379 2382 /* print device info to dmesg */ 2380 2383 if (ata_msg_drv(ap) && print_info) 2381 2384 ata_dev_info(dev, ··· 4131 4128 4132 4129 /* Devices which aren't very happy with higher link speeds */ 4133 4130 { "WD My Book", NULL, ATA_HORKAGE_1_5_GBPS, }, 4131 + { "Seagate FreeAgent GoFlex", NULL, ATA_HORKAGE_1_5_GBPS, }, 4134 4132 4135 4133 /* 4136 4134 * Devices which choke on SETXFER. Applies only if both the ··· 5294 5290 return rc; 5295 5291 } 5296 5292 5297 - #define to_ata_port(d) container_of(d, struct ata_port, tdev) 5298 - 5299 5293 static int ata_port_suspend_common(struct device *dev, pm_message_t mesg) 5300 5294 { 5301 5295 struct ata_port *ap = to_ata_port(dev); ··· 6055 6053 if (rc) 6056 6054 goto err_tadd; 6057 6055 6058 - /* associate with ACPI nodes */ 6059 - ata_acpi_associate(host); 6060 - 6061 6056 /* set cable, sata_spd_limit and report */ 6062 6057 for (i = 0; i < host->n_ports; i++) { 6063 6058 struct ata_port *ap = host->ports[i]; ··· 6514 6515 6515 6516 ata_parse_force_param(); 6516 6517 6518 + ata_acpi_register(); 6519 + 6517 6520 rc = ata_sff_init(); 6518 6521 if (rc) { 6519 6522 kfree(ata_force_tbl); ··· 6542 6541 ata_release_transport(ata_scsi_transport_template); 6543 6542 libata_transport_exit(); 6544 6543 ata_sff_exit(); 6544 + ata_acpi_unregister(); 6545 6545 kfree(ata_force_tbl); 6546 6546 } 6547 6547
+1 -1
drivers/ata/libata-eh.c
··· 419 419 return rc; 420 420 } 421 421 422 - int ata_ering_clear_cb(struct ata_ering_entry *ent, void *void_arg) 422 + static int ata_ering_clear_cb(struct ata_ering_entry *ent, void *void_arg) 423 423 { 424 424 ent->eflags |= ATA_EFLAG_OLD_ER; 425 425 return 0;
-4
drivers/ata/libata-pmp.c
··· 529 529 ata_for_each_link(tlink, ap, EDGE) 530 530 sata_link_init_spd(tlink); 531 531 532 - ata_acpi_associate_sata_port(ap); 533 - 534 532 return 0; 535 533 536 534 fail: ··· 568 570 ap->nr_pmp_links = 0; 569 571 link->pmp = 0; 570 572 spin_unlock_irqrestore(ap->lock, flags); 571 - 572 - ata_acpi_associate_sata_port(ap); 573 573 } 574 574 575 575 /**
+3
drivers/ata/libata-scsi.c
··· 3445 3445 if (!IS_ERR(sdev)) { 3446 3446 dev->sdev = sdev; 3447 3447 scsi_device_put(sdev); 3448 + ata_acpi_bind(dev); 3448 3449 } else { 3449 3450 dev->sdev = NULL; 3450 3451 } ··· 3541 3540 */ 3542 3541 mutex_lock(&ap->scsi_host->scan_mutex); 3543 3542 spin_lock_irqsave(ap->lock, flags); 3543 + 3544 + ata_acpi_unbind(dev); 3544 3545 3545 3546 /* clearing dev->sdev is protected by host lock */ 3546 3547 sdev = dev->sdev;
+3 -3
drivers/ata/libata-transport.c
··· 232 232 * Returns: 233 233 * %1 if the device represents a ATA Port, %0 else 234 234 */ 235 - int ata_is_port(const struct device *dev) 235 + static int ata_is_port(const struct device *dev) 236 236 { 237 237 return dev->release == ata_tport_release; 238 238 } ··· 355 355 * Returns: 356 356 * %1 if the device represents a ATA link, %0 else 357 357 */ 358 - int ata_is_link(const struct device *dev) 358 + static int ata_is_link(const struct device *dev) 359 359 { 360 360 return dev->release == ata_tlink_release; 361 361 } ··· 572 572 * Returns: 573 573 * %1 if the device represents a ATA device, %0 else 574 574 */ 575 - int ata_is_ata_dev(const struct device *dev) 575 + static int ata_is_ata_dev(const struct device *dev) 576 576 { 577 577 return dev->release == ata_tdev_release; 578 578 }
+10 -5
drivers/ata/libata.h
··· 107 107 extern int ata_port_probe(struct ata_port *ap); 108 108 extern void __ata_port_probe(struct ata_port *ap); 109 109 110 + #define to_ata_port(d) container_of(d, struct ata_port, tdev) 111 + 110 112 /* libata-acpi.c */ 111 113 #ifdef CONFIG_ATA_ACPI 112 114 extern unsigned int ata_acpi_gtf_filter; 113 - 114 - extern void ata_acpi_associate_sata_port(struct ata_port *ap); 115 - extern void ata_acpi_associate(struct ata_host *host); 116 115 extern void ata_acpi_dissociate(struct ata_host *host); 117 116 extern int ata_acpi_on_suspend(struct ata_port *ap); 118 117 extern void ata_acpi_on_resume(struct ata_port *ap); 119 118 extern int ata_acpi_on_devcfg(struct ata_device *dev); 120 119 extern void ata_acpi_on_disable(struct ata_device *dev); 121 120 extern void ata_acpi_set_state(struct ata_port *ap, pm_message_t state); 121 + extern int ata_acpi_register(void); 122 + extern void ata_acpi_unregister(void); 123 + extern void ata_acpi_bind(struct ata_device *dev); 124 + extern void ata_acpi_unbind(struct ata_device *dev); 122 125 #else 123 - static inline void ata_acpi_associate_sata_port(struct ata_port *ap) { } 124 - static inline void ata_acpi_associate(struct ata_host *host) { } 125 126 static inline void ata_acpi_dissociate(struct ata_host *host) { } 126 127 static inline int ata_acpi_on_suspend(struct ata_port *ap) { return 0; } 127 128 static inline void ata_acpi_on_resume(struct ata_port *ap) { } ··· 130 129 static inline void ata_acpi_on_disable(struct ata_device *dev) { } 131 130 static inline void ata_acpi_set_state(struct ata_port *ap, 132 131 pm_message_t state) { } 132 + static inline int ata_acpi_register(void) { return 0; } 133 + static inline void ata_acpi_unregister(void) { } 134 + static inline void ata_acpi_bind(struct ata_device *dev) { } 135 + static inline void ata_acpi_unbind(struct ata_device *dev) { } 133 136 #endif 134 137 135 138 /* libata-scsi.c */
+3 -15
drivers/ata/pata_acpi.c
··· 39 39 { 40 40 struct ata_port *ap = link->ap; 41 41 struct pata_acpi *acpi = ap->private_data; 42 - if (ap->acpi_handle == NULL || ata_acpi_gtm(ap, &acpi->gtm) < 0) 42 + if (ata_ap_acpi_handle(ap) == NULL || ata_acpi_gtm(ap, &acpi->gtm) < 0) 43 43 return -ENODEV; 44 44 45 45 return ata_sff_prereset(link, deadline); ··· 195 195 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 196 196 struct pata_acpi *acpi; 197 197 198 - if (ap->acpi_handle == NULL) 198 + if (ata_ap_acpi_handle(ap) == NULL) 199 199 return -ENODEV; 200 200 201 201 acpi = ap->private_data = devm_kzalloc(&pdev->dev, sizeof(struct pata_acpi), GFP_KERNEL); ··· 273 273 #endif 274 274 }; 275 275 276 - static int __init pacpi_init(void) 277 - { 278 - return pci_register_driver(&pacpi_pci_driver); 279 - } 280 - 281 - static void __exit pacpi_exit(void) 282 - { 283 - pci_unregister_driver(&pacpi_pci_driver); 284 - } 285 - 286 - module_init(pacpi_init); 287 - module_exit(pacpi_exit); 276 + module_pci_driver(pacpi_pci_driver); 288 277 289 278 MODULE_AUTHOR("Alan Cox"); 290 279 MODULE_DESCRIPTION("SCSI low-level driver for ATA in ACPI mode"); 291 280 MODULE_LICENSE("GPL"); 292 281 MODULE_DEVICE_TABLE(pci, pacpi_pci_tbl); 293 282 MODULE_VERSION(DRV_VERSION); 294 -
+1 -12
drivers/ata/pata_amd.c
··· 632 632 #endif 633 633 }; 634 634 635 - static int __init amd_init(void) 636 - { 637 - return pci_register_driver(&amd_pci_driver); 638 - } 639 - 640 - static void __exit amd_exit(void) 641 - { 642 - pci_unregister_driver(&amd_pci_driver); 643 - } 635 + module_pci_driver(amd_pci_driver); 644 636 645 637 MODULE_AUTHOR("Alan Cox"); 646 638 MODULE_DESCRIPTION("low-level driver for AMD and Nvidia PATA IDE"); 647 639 MODULE_LICENSE("GPL"); 648 640 MODULE_DEVICE_TABLE(pci, amd); 649 641 MODULE_VERSION(DRV_VERSION); 650 - 651 - module_init(amd_init); 652 - module_exit(amd_exit);
+1 -12
drivers/ata/pata_artop.c
··· 451 451 #endif 452 452 }; 453 453 454 - static int __init artop_init(void) 455 - { 456 - return pci_register_driver(&artop_pci_driver); 457 - } 458 - 459 - static void __exit artop_exit(void) 460 - { 461 - pci_unregister_driver(&artop_pci_driver); 462 - } 463 - 464 - module_init(artop_init); 465 - module_exit(artop_exit); 454 + module_pci_driver(artop_pci_driver); 466 455 467 456 MODULE_AUTHOR("Alan Cox, Bartlomiej Zolnierkiewicz"); 468 457 MODULE_DESCRIPTION("SCSI low-level driver for ARTOP PATA");
+1 -13
drivers/ata/pata_atiixp.c
··· 289 289 #endif 290 290 }; 291 291 292 - static int __init atiixp_init(void) 293 - { 294 - return pci_register_driver(&atiixp_pci_driver); 295 - } 296 - 297 - 298 - static void __exit atiixp_exit(void) 299 - { 300 - pci_unregister_driver(&atiixp_pci_driver); 301 - } 292 + module_pci_driver(atiixp_pci_driver); 302 293 303 294 MODULE_AUTHOR("Alan Cox"); 304 295 MODULE_DESCRIPTION("low-level driver for ATI IXP200/300/400"); 305 296 MODULE_LICENSE("GPL"); 306 297 MODULE_DEVICE_TABLE(pci, atiixp); 307 298 MODULE_VERSION(DRV_VERSION); 308 - 309 - module_init(atiixp_init); 310 - module_exit(atiixp_exit);
+1 -12
drivers/ata/pata_atp867x.c
··· 565 565 #endif 566 566 }; 567 567 568 - static int __init atp867x_init(void) 569 - { 570 - return pci_register_driver(&atp867x_driver); 571 - } 572 - 573 - static void __exit atp867x_exit(void) 574 - { 575 - pci_unregister_driver(&atp867x_driver); 576 - } 568 + module_pci_driver(atp867x_driver); 577 569 578 570 MODULE_AUTHOR("John(Jung-Ik) Lee, Google Inc."); 579 571 MODULE_DESCRIPTION("low level driver for Artop/Acard 867x ATA controller"); 580 572 MODULE_LICENSE("GPL"); 581 573 MODULE_DEVICE_TABLE(pci, atp867x_pci_tbl); 582 574 MODULE_VERSION(DRV_VERSION); 583 - 584 - module_init(atp867x_init); 585 - module_exit(atp867x_exit);
+1 -12
drivers/ata/pata_cmd640.c
··· 263 263 #endif 264 264 }; 265 265 266 - static int __init cmd640_init(void) 267 - { 268 - return pci_register_driver(&cmd640_pci_driver); 269 - } 270 - 271 - static void __exit cmd640_exit(void) 272 - { 273 - pci_unregister_driver(&cmd640_pci_driver); 274 - } 266 + module_pci_driver(cmd640_pci_driver); 275 267 276 268 MODULE_AUTHOR("Alan Cox"); 277 269 MODULE_DESCRIPTION("low-level driver for CMD640 PATA controllers"); 278 270 MODULE_LICENSE("GPL"); 279 271 MODULE_DEVICE_TABLE(pci, cmd640); 280 272 MODULE_VERSION(DRV_VERSION); 281 - 282 - module_init(cmd640_init); 283 - module_exit(cmd640_exit);
+3 -14
drivers/ata/pata_cmd64x.c
··· 423 423 .port_ops = &cmd648_port_ops 424 424 } 425 425 }; 426 - const struct ata_port_info *ppi[] = { 426 + const struct ata_port_info *ppi[] = { 427 427 &cmd_info[id->driver_data], 428 428 &cmd_info[id->driver_data], 429 429 NULL ··· 478 478 if (port_ok && cntrl_ch0_ok && !(reg & CNTRL_CH0)) { 479 479 dev_printk(KERN_NOTICE, &pdev->dev, "Primary port is disabled\n"); 480 480 ppi[0] = &ata_dummy_port_info; 481 - 481 + 482 482 } 483 483 if (port_ok && !(reg & CNTRL_CH1)) { 484 484 dev_printk(KERN_NOTICE, &pdev->dev, "Secondary port is disabled\n"); ··· 525 525 #endif 526 526 }; 527 527 528 - static int __init cmd64x_init(void) 529 - { 530 - return pci_register_driver(&cmd64x_pci_driver); 531 - } 532 - 533 - static void __exit cmd64x_exit(void) 534 - { 535 - pci_unregister_driver(&cmd64x_pci_driver); 536 - } 528 + module_pci_driver(cmd64x_pci_driver); 537 529 538 530 MODULE_AUTHOR("Alan Cox"); 539 531 MODULE_DESCRIPTION("low-level driver for CMD64x series PATA controllers"); 540 532 MODULE_LICENSE("GPL"); 541 533 MODULE_DEVICE_TABLE(pci, cmd64x); 542 534 MODULE_VERSION(DRV_VERSION); 543 - 544 - module_init(cmd64x_init); 545 - module_exit(cmd64x_exit);
+1 -13
drivers/ata/pata_cs5520.c
··· 302 302 #endif 303 303 }; 304 304 305 - static int __init cs5520_init(void) 306 - { 307 - return pci_register_driver(&cs5520_pci_driver); 308 - } 309 - 310 - static void __exit cs5520_exit(void) 311 - { 312 - pci_unregister_driver(&cs5520_pci_driver); 313 - } 305 + module_pci_driver(cs5520_pci_driver); 314 306 315 307 MODULE_AUTHOR("Alan Cox"); 316 308 MODULE_DESCRIPTION("low-level driver for Cyrix CS5510/5520"); 317 309 MODULE_LICENSE("GPL"); 318 310 MODULE_DEVICE_TABLE(pci, pata_cs5520); 319 311 MODULE_VERSION(DRV_VERSION); 320 - 321 - module_init(cs5520_init); 322 - module_exit(cs5520_exit); 323 -
+1 -12
drivers/ata/pata_cs5530.c
··· 363 363 #endif 364 364 }; 365 365 366 - static int __init cs5530_init(void) 367 - { 368 - return pci_register_driver(&cs5530_pci_driver); 369 - } 370 - 371 - static void __exit cs5530_exit(void) 372 - { 373 - pci_unregister_driver(&cs5530_pci_driver); 374 - } 366 + module_pci_driver(cs5530_pci_driver); 375 367 376 368 MODULE_AUTHOR("Alan Cox"); 377 369 MODULE_DESCRIPTION("low-level driver for the Cyrix/NS/AMD 5530"); 378 370 MODULE_LICENSE("GPL"); 379 371 MODULE_DEVICE_TABLE(pci, cs5530); 380 372 MODULE_VERSION(DRV_VERSION); 381 - 382 - module_init(cs5530_init); 383 - module_exit(cs5530_exit);
+1 -12
drivers/ata/pata_cs5535.c
··· 207 207 #endif 208 208 }; 209 209 210 - static int __init cs5535_init(void) 211 - { 212 - return pci_register_driver(&cs5535_pci_driver); 213 - } 214 - 215 - static void __exit cs5535_exit(void) 216 - { 217 - pci_unregister_driver(&cs5535_pci_driver); 218 - } 210 + module_pci_driver(cs5535_pci_driver); 219 211 220 212 MODULE_AUTHOR("Alan Cox, Jens Altmann, Wolfgan Zuleger, Alexander Kiausch"); 221 213 MODULE_DESCRIPTION("low-level driver for the NS/AMD 5535"); 222 214 MODULE_LICENSE("GPL"); 223 215 MODULE_DEVICE_TABLE(pci, cs5535); 224 216 MODULE_VERSION(DRV_VERSION); 225 - 226 - module_init(cs5535_init); 227 - module_exit(cs5535_exit);
+1 -12
drivers/ata/pata_cs5536.c
··· 274 274 #endif 275 275 }; 276 276 277 - static int __init cs5536_init(void) 278 - { 279 - return pci_register_driver(&cs5536_pci_driver); 280 - } 281 - 282 - static void __exit cs5536_exit(void) 283 - { 284 - pci_unregister_driver(&cs5536_pci_driver); 285 - } 277 + module_pci_driver(cs5536_pci_driver); 286 278 287 279 MODULE_AUTHOR("Martin K. Petersen"); 288 280 MODULE_DESCRIPTION("low-level driver for the CS5536 IDE controller"); 289 281 MODULE_LICENSE("GPL"); 290 282 MODULE_DEVICE_TABLE(pci, cs5536); 291 283 MODULE_VERSION(DRV_VERSION); 292 - 293 - module_init(cs5536_init); 294 - module_exit(cs5536_exit);
+1 -14
drivers/ata/pata_cypress.c
··· 158 158 #endif 159 159 }; 160 160 161 - static int __init cy82c693_init(void) 162 - { 163 - return pci_register_driver(&cy82c693_pci_driver); 164 - } 165 - 166 - 167 - static void __exit cy82c693_exit(void) 168 - { 169 - pci_unregister_driver(&cy82c693_pci_driver); 170 - } 171 - 161 + module_pci_driver(cy82c693_pci_driver); 172 162 173 163 MODULE_AUTHOR("Alan Cox"); 174 164 MODULE_DESCRIPTION("low-level driver for the CY82C693 PATA controller"); 175 165 MODULE_LICENSE("GPL"); 176 166 MODULE_DEVICE_TABLE(pci, cy82c693); 177 167 MODULE_VERSION(DRV_VERSION); 178 - 179 - module_init(cy82c693_init); 180 - module_exit(cy82c693_exit);
+1 -13
drivers/ata/pata_efar.c
··· 295 295 #endif 296 296 }; 297 297 298 - static int __init efar_init(void) 299 - { 300 - return pci_register_driver(&efar_pci_driver); 301 - } 302 - 303 - static void __exit efar_exit(void) 304 - { 305 - pci_unregister_driver(&efar_pci_driver); 306 - } 307 - 308 - module_init(efar_init); 309 - module_exit(efar_exit); 298 + module_pci_driver(efar_pci_driver); 310 299 311 300 MODULE_AUTHOR("Alan Cox"); 312 301 MODULE_DESCRIPTION("SCSI low-level driver for EFAR PIIX clones"); 313 302 MODULE_LICENSE("GPL"); 314 303 MODULE_DEVICE_TABLE(pci, efar_pci_tbl); 315 304 MODULE_VERSION(DRV_VERSION); 316 -
+1 -12
drivers/ata/pata_hpt366.c
··· 418 418 #endif 419 419 }; 420 420 421 - static int __init hpt36x_init(void) 422 - { 423 - return pci_register_driver(&hpt36x_pci_driver); 424 - } 425 - 426 - static void __exit hpt36x_exit(void) 427 - { 428 - pci_unregister_driver(&hpt36x_pci_driver); 429 - } 421 + module_pci_driver(hpt36x_pci_driver); 430 422 431 423 MODULE_AUTHOR("Alan Cox"); 432 424 MODULE_DESCRIPTION("low-level driver for the Highpoint HPT366/368"); 433 425 MODULE_LICENSE("GPL"); 434 426 MODULE_DEVICE_TABLE(pci, hpt36x); 435 427 MODULE_VERSION(DRV_VERSION); 436 - 437 - module_init(hpt36x_init); 438 - module_exit(hpt36x_exit);
+1 -12
drivers/ata/pata_hpt37x.c
··· 1058 1058 .remove = ata_pci_remove_one 1059 1059 }; 1060 1060 1061 - static int __init hpt37x_init(void) 1062 - { 1063 - return pci_register_driver(&hpt37x_pci_driver); 1064 - } 1065 - 1066 - static void __exit hpt37x_exit(void) 1067 - { 1068 - pci_unregister_driver(&hpt37x_pci_driver); 1069 - } 1061 + module_pci_driver(hpt37x_pci_driver); 1070 1062 1071 1063 MODULE_AUTHOR("Alan Cox"); 1072 1064 MODULE_DESCRIPTION("low-level driver for the Highpoint HPT37x/30x"); 1073 1065 MODULE_LICENSE("GPL"); 1074 1066 MODULE_DEVICE_TABLE(pci, hpt37x); 1075 1067 MODULE_VERSION(DRV_VERSION); 1076 - 1077 - module_init(hpt37x_init); 1078 - module_exit(hpt37x_exit);
+1 -12
drivers/ata/pata_hpt3x2n.c
··· 621 621 .remove = ata_pci_remove_one 622 622 }; 623 623 624 - static int __init hpt3x2n_init(void) 625 - { 626 - return pci_register_driver(&hpt3x2n_pci_driver); 627 - } 628 - 629 - static void __exit hpt3x2n_exit(void) 630 - { 631 - pci_unregister_driver(&hpt3x2n_pci_driver); 632 - } 624 + module_pci_driver(hpt3x2n_pci_driver); 633 625 634 626 MODULE_AUTHOR("Alan Cox"); 635 627 MODULE_DESCRIPTION("low-level driver for the Highpoint HPT3xxN"); 636 628 MODULE_LICENSE("GPL"); 637 629 MODULE_DEVICE_TABLE(pci, hpt3x2n); 638 630 MODULE_VERSION(DRV_VERSION); 639 - 640 - module_init(hpt3x2n_init); 641 - module_exit(hpt3x2n_exit);
+1 -14
drivers/ata/pata_hpt3x3.c
··· 284 284 #endif 285 285 }; 286 286 287 - static int __init hpt3x3_init(void) 288 - { 289 - return pci_register_driver(&hpt3x3_pci_driver); 290 - } 291 - 292 - 293 - static void __exit hpt3x3_exit(void) 294 - { 295 - pci_unregister_driver(&hpt3x3_pci_driver); 296 - } 297 - 287 + module_pci_driver(hpt3x3_pci_driver); 298 288 299 289 MODULE_AUTHOR("Alan Cox"); 300 290 MODULE_DESCRIPTION("low-level driver for the Highpoint HPT343/363"); 301 291 MODULE_LICENSE("GPL"); 302 292 MODULE_DEVICE_TABLE(pci, hpt3x3); 303 293 MODULE_VERSION(DRV_VERSION); 304 - 305 - module_init(hpt3x3_init); 306 - module_exit(hpt3x3_exit);
+5 -5
drivers/ata/pata_imx.c
··· 118 118 return PTR_ERR(priv->clk); 119 119 } 120 120 121 - clk_enable(priv->clk); 121 + clk_prepare_enable(priv->clk); 122 122 123 123 host = ata_host_alloc(&pdev->dev, 1); 124 124 if (!host) ··· 162 162 &pata_imx_sht); 163 163 164 164 free_priv: 165 - clk_disable(priv->clk); 165 + clk_disable_unprepare(priv->clk); 166 166 clk_put(priv->clk); 167 167 return -ENOMEM; 168 168 } ··· 176 176 177 177 __raw_writel(0, priv->host_regs + PATA_IMX_ATA_INT_EN); 178 178 179 - clk_disable(priv->clk); 179 + clk_disable_unprepare(priv->clk); 180 180 clk_put(priv->clk); 181 181 182 182 return 0; ··· 194 194 __raw_writel(0, priv->host_regs + PATA_IMX_ATA_INT_EN); 195 195 priv->ata_ctl = 196 196 __raw_readl(priv->host_regs + PATA_IMX_ATA_CONTROL); 197 - clk_disable(priv->clk); 197 + clk_disable_unprepare(priv->clk); 198 198 } 199 199 200 200 return ret; ··· 205 205 struct ata_host *host = dev_get_drvdata(dev); 206 206 struct pata_imx_priv *priv = host->private_data; 207 207 208 - clk_enable(priv->clk); 208 + clk_prepare_enable(priv->clk); 209 209 210 210 __raw_writel(priv->ata_ctl, priv->host_regs + PATA_IMX_ATA_CONTROL); 211 211
+1 -12
drivers/ata/pata_it8213.c
··· 290 290 #endif 291 291 }; 292 292 293 - static int __init it8213_init(void) 294 - { 295 - return pci_register_driver(&it8213_pci_driver); 296 - } 297 - 298 - static void __exit it8213_exit(void) 299 - { 300 - pci_unregister_driver(&it8213_pci_driver); 301 - } 302 - 303 - module_init(it8213_init); 304 - module_exit(it8213_exit); 293 + module_pci_driver(it8213_pci_driver); 305 294 306 295 MODULE_AUTHOR("Alan Cox"); 307 296 MODULE_DESCRIPTION("SCSI low-level driver for the ITE 8213");
+1 -13
drivers/ata/pata_it821x.c
··· 972 972 #endif 973 973 }; 974 974 975 - static int __init it821x_init(void) 976 - { 977 - return pci_register_driver(&it821x_pci_driver); 978 - } 979 - 980 - static void __exit it821x_exit(void) 981 - { 982 - pci_unregister_driver(&it821x_pci_driver); 983 - } 975 + module_pci_driver(it821x_pci_driver); 984 976 985 977 MODULE_AUTHOR("Alan Cox"); 986 978 MODULE_DESCRIPTION("low-level driver for the IT8211/IT8212 IDE RAID controller"); ··· 980 988 MODULE_DEVICE_TABLE(pci, it821x); 981 989 MODULE_VERSION(DRV_VERSION); 982 990 983 - 984 991 module_param_named(noraid, it8212_noraid, int, S_IRUGO); 985 992 MODULE_PARM_DESC(noraid, "Force card into bypass mode"); 986 - 987 - module_init(it821x_init); 988 - module_exit(it821x_exit);
+1 -12
drivers/ata/pata_jmicron.c
··· 164 164 #endif 165 165 }; 166 166 167 - static int __init jmicron_init(void) 168 - { 169 - return pci_register_driver(&jmicron_pci_driver); 170 - } 171 - 172 - static void __exit jmicron_exit(void) 173 - { 174 - pci_unregister_driver(&jmicron_pci_driver); 175 - } 176 - 177 - module_init(jmicron_init); 178 - module_exit(jmicron_exit); 167 + module_pci_driver(jmicron_pci_driver); 179 168 180 169 MODULE_AUTHOR("Alan Cox"); 181 170 MODULE_DESCRIPTION("SCSI low-level driver for Jmicron PATA ports");
+1 -13
drivers/ata/pata_marvell.c
··· 178 178 #endif 179 179 }; 180 180 181 - static int __init marvell_init(void) 182 - { 183 - return pci_register_driver(&marvell_pci_driver); 184 - } 185 - 186 - static void __exit marvell_exit(void) 187 - { 188 - pci_unregister_driver(&marvell_pci_driver); 189 - } 190 - 191 - module_init(marvell_init); 192 - module_exit(marvell_exit); 181 + module_pci_driver(marvell_pci_driver); 193 182 194 183 MODULE_AUTHOR("Alan Cox"); 195 184 MODULE_DESCRIPTION("SCSI low-level driver for Marvell ATA in legacy mode"); 196 185 MODULE_LICENSE("GPL"); 197 186 MODULE_DEVICE_TABLE(pci, marvell_pci_tbl); 198 187 MODULE_VERSION(DRV_VERSION); 199 -
+1 -12
drivers/ata/pata_mpiix.c
··· 230 230 #endif 231 231 }; 232 232 233 - static int __init mpiix_init(void) 234 - { 235 - return pci_register_driver(&mpiix_pci_driver); 236 - } 237 - 238 - static void __exit mpiix_exit(void) 239 - { 240 - pci_unregister_driver(&mpiix_pci_driver); 241 - } 233 + module_pci_driver(mpiix_pci_driver); 242 234 243 235 MODULE_AUTHOR("Alan Cox"); 244 236 MODULE_DESCRIPTION("low-level driver for Intel MPIIX"); 245 237 MODULE_LICENSE("GPL"); 246 238 MODULE_DEVICE_TABLE(pci, mpiix); 247 239 MODULE_VERSION(DRV_VERSION); 248 - 249 - module_init(mpiix_init); 250 - module_exit(mpiix_exit);
+1 -13
drivers/ata/pata_netcell.c
··· 99 99 #endif 100 100 }; 101 101 102 - static int __init netcell_init(void) 103 - { 104 - return pci_register_driver(&netcell_pci_driver); 105 - } 106 - 107 - static void __exit netcell_exit(void) 108 - { 109 - pci_unregister_driver(&netcell_pci_driver); 110 - } 111 - 112 - module_init(netcell_init); 113 - module_exit(netcell_exit); 102 + module_pci_driver(netcell_pci_driver); 114 103 115 104 MODULE_AUTHOR("Alan Cox"); 116 105 MODULE_DESCRIPTION("SCSI low-level driver for Netcell PATA RAID"); 117 106 MODULE_LICENSE("GPL"); 118 107 MODULE_DEVICE_TABLE(pci, netcell_pci_tbl); 119 108 MODULE_VERSION(DRV_VERSION); 120 -
+1 -12
drivers/ata/pata_ninja32.c
··· 190 190 #endif 191 191 }; 192 192 193 - static int __init ninja32_init(void) 194 - { 195 - return pci_register_driver(&ninja32_pci_driver); 196 - } 197 - 198 - static void __exit ninja32_exit(void) 199 - { 200 - pci_unregister_driver(&ninja32_pci_driver); 201 - } 193 + module_pci_driver(ninja32_pci_driver); 202 194 203 195 MODULE_AUTHOR("Alan Cox"); 204 196 MODULE_DESCRIPTION("low-level driver for Ninja32 ATA"); 205 197 MODULE_LICENSE("GPL"); 206 198 MODULE_DEVICE_TABLE(pci, ninja32); 207 199 MODULE_VERSION(DRV_VERSION); 208 - 209 - module_init(ninja32_init); 210 - module_exit(ninja32_exit);
+1 -12
drivers/ata/pata_ns87410.c
··· 168 168 #endif 169 169 }; 170 170 171 - static int __init ns87410_init(void) 172 - { 173 - return pci_register_driver(&ns87410_pci_driver); 174 - } 175 - 176 - static void __exit ns87410_exit(void) 177 - { 178 - pci_unregister_driver(&ns87410_pci_driver); 179 - } 171 + module_pci_driver(ns87410_pci_driver); 180 172 181 173 MODULE_AUTHOR("Alan Cox"); 182 174 MODULE_DESCRIPTION("low-level driver for Nat Semi 87410"); 183 175 MODULE_LICENSE("GPL"); 184 176 MODULE_DEVICE_TABLE(pci, ns87410); 185 177 MODULE_VERSION(DRV_VERSION); 186 - 187 - module_init(ns87410_init); 188 - module_exit(ns87410_exit);
+1 -12
drivers/ata/pata_ns87415.c
··· 414 414 #endif 415 415 }; 416 416 417 - static int __init ns87415_init(void) 418 - { 419 - return pci_register_driver(&ns87415_pci_driver); 420 - } 421 - 422 - static void __exit ns87415_exit(void) 423 - { 424 - pci_unregister_driver(&ns87415_pci_driver); 425 - } 426 - 427 - module_init(ns87415_init); 428 - module_exit(ns87415_exit); 417 + module_pci_driver(ns87415_pci_driver); 429 418 430 419 MODULE_AUTHOR("Alan Cox"); 431 420 MODULE_DESCRIPTION("ATA low-level driver for NS87415 controllers");
+1 -13
drivers/ata/pata_oldpiix.c
··· 265 265 #endif 266 266 }; 267 267 268 - static int __init oldpiix_init(void) 269 - { 270 - return pci_register_driver(&oldpiix_pci_driver); 271 - } 272 - 273 - static void __exit oldpiix_exit(void) 274 - { 275 - pci_unregister_driver(&oldpiix_pci_driver); 276 - } 277 - 278 - module_init(oldpiix_init); 279 - module_exit(oldpiix_exit); 268 + module_pci_driver(oldpiix_pci_driver); 280 269 281 270 MODULE_AUTHOR("Alan Cox"); 282 271 MODULE_DESCRIPTION("SCSI low-level driver for early PIIX series controllers"); 283 272 MODULE_LICENSE("GPL"); 284 273 MODULE_DEVICE_TABLE(pci, oldpiix_pci_tbl); 285 274 MODULE_VERSION(DRV_VERSION); 286 -
+1 -13
drivers/ata/pata_opti.c
··· 191 191 #endif 192 192 }; 193 193 194 - static int __init opti_init(void) 195 - { 196 - return pci_register_driver(&opti_pci_driver); 197 - } 198 - 199 - static void __exit opti_exit(void) 200 - { 201 - pci_unregister_driver(&opti_pci_driver); 202 - } 203 - 194 + module_pci_driver(opti_pci_driver); 204 195 205 196 MODULE_AUTHOR("Alan Cox"); 206 197 MODULE_DESCRIPTION("low-level driver for Opti 621/621X"); 207 198 MODULE_LICENSE("GPL"); 208 199 MODULE_DEVICE_TABLE(pci, opti); 209 200 MODULE_VERSION(DRV_VERSION); 210 - 211 - module_init(opti_init); 212 - module_exit(opti_exit);
+1 -12
drivers/ata/pata_optidma.c
··· 447 447 #endif 448 448 }; 449 449 450 - static int __init optidma_init(void) 451 - { 452 - return pci_register_driver(&optidma_pci_driver); 453 - } 454 - 455 - static void __exit optidma_exit(void) 456 - { 457 - pci_unregister_driver(&optidma_pci_driver); 458 - } 450 + module_pci_driver(optidma_pci_driver); 459 451 460 452 MODULE_AUTHOR("Alan Cox"); 461 453 MODULE_DESCRIPTION("low-level driver for Opti Firestar/Firestar Plus"); 462 454 MODULE_LICENSE("GPL"); 463 455 MODULE_DEVICE_TABLE(pci, optidma); 464 456 MODULE_VERSION(DRV_VERSION); 465 - 466 - module_init(optidma_init); 467 - module_exit(optidma_exit);
+2 -1
drivers/ata/pata_pcmcia.c
··· 170 170 { 171 171 int *is_kme = priv_data; 172 172 173 - if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) { 173 + if ((pdev->resource[0]->flags & IO_DATA_PATH_WIDTH) 174 + != IO_DATA_PATH_WIDTH_8) { 174 175 pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; 175 176 pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 176 177 }
+1 -18
drivers/ata/pata_pdc2027x.c
··· 784 784 } 785 785 #endif 786 786 787 - /** 788 - * pdc2027x_init - Called after this module is loaded into the kernel. 789 - */ 790 - static int __init pdc2027x_init(void) 791 - { 792 - return pci_register_driver(&pdc2027x_pci_driver); 793 - } 794 - 795 - /** 796 - * pdc2027x_exit - Called before this module unloaded from the kernel 797 - */ 798 - static void __exit pdc2027x_exit(void) 799 - { 800 - pci_unregister_driver(&pdc2027x_pci_driver); 801 - } 802 - 803 - module_init(pdc2027x_init); 804 - module_exit(pdc2027x_exit); 787 + module_pci_driver(pdc2027x_pci_driver);
+1 -12
drivers/ata/pata_pdc202xx_old.c
··· 384 384 #endif 385 385 }; 386 386 387 - static int __init pdc202xx_init(void) 388 - { 389 - return pci_register_driver(&pdc202xx_pci_driver); 390 - } 391 - 392 - static void __exit pdc202xx_exit(void) 393 - { 394 - pci_unregister_driver(&pdc202xx_pci_driver); 395 - } 387 + module_pci_driver(pdc202xx_pci_driver); 396 388 397 389 MODULE_AUTHOR("Alan Cox"); 398 390 MODULE_DESCRIPTION("low-level driver for Promise 2024x and 20262-20267"); 399 391 MODULE_LICENSE("GPL"); 400 392 MODULE_DEVICE_TABLE(pci, pdc202xx); 401 393 MODULE_VERSION(DRV_VERSION); 402 - 403 - module_init(pdc202xx_init); 404 - module_exit(pdc202xx_exit);
+1 -15
drivers/ata/pata_piccolo.c
··· 117 117 #endif 118 118 }; 119 119 120 - static int __init ata_tosh_init(void) 121 - { 122 - return pci_register_driver(&ata_tosh_pci_driver); 123 - } 124 - 125 - 126 - static void __exit ata_tosh_exit(void) 127 - { 128 - pci_unregister_driver(&ata_tosh_pci_driver); 129 - } 130 - 120 + module_pci_driver(ata_tosh_pci_driver); 131 121 132 122 MODULE_AUTHOR("Alan Cox"); 133 123 MODULE_DESCRIPTION("Low level driver for Toshiba Piccolo ATA"); 134 124 MODULE_LICENSE("GPL"); 135 125 MODULE_DEVICE_TABLE(pci, ata_tosh); 136 126 MODULE_VERSION(DRV_VERSION); 137 - 138 - module_init(ata_tosh_init); 139 - module_exit(ata_tosh_exit); 140 -
+1 -13
drivers/ata/pata_radisys.c
··· 244 244 #endif 245 245 }; 246 246 247 - static int __init radisys_init(void) 248 - { 249 - return pci_register_driver(&radisys_pci_driver); 250 - } 251 - 252 - static void __exit radisys_exit(void) 253 - { 254 - pci_unregister_driver(&radisys_pci_driver); 255 - } 256 - 257 - module_init(radisys_init); 258 - module_exit(radisys_exit); 247 + module_pci_driver(radisys_pci_driver); 259 248 260 249 MODULE_AUTHOR("Alan Cox"); 261 250 MODULE_DESCRIPTION("SCSI low-level driver for Radisys R82600 controllers"); 262 251 MODULE_LICENSE("GPL"); 263 252 MODULE_DEVICE_TABLE(pci, radisys_pci_tbl); 264 253 MODULE_VERSION(DRV_VERSION); 265 -
+1 -12
drivers/ata/pata_rdc.c
··· 394 394 }; 395 395 396 396 397 - static int __init rdc_init(void) 398 - { 399 - return pci_register_driver(&rdc_pci_driver); 400 - } 401 - 402 - static void __exit rdc_exit(void) 403 - { 404 - pci_unregister_driver(&rdc_pci_driver); 405 - } 406 - 407 - module_init(rdc_init); 408 - module_exit(rdc_exit); 397 + module_pci_driver(rdc_pci_driver); 409 398 410 399 MODULE_AUTHOR("Alan Cox (based on ata_piix)"); 411 400 MODULE_DESCRIPTION("SCSI low-level driver for RDC PATA controllers");
+1 -13
drivers/ata/pata_rz1000.c
··· 140 140 #endif 141 141 }; 142 142 143 - static int __init rz1000_init(void) 144 - { 145 - return pci_register_driver(&rz1000_pci_driver); 146 - } 147 - 148 - static void __exit rz1000_exit(void) 149 - { 150 - pci_unregister_driver(&rz1000_pci_driver); 151 - } 143 + module_pci_driver(rz1000_pci_driver); 152 144 153 145 MODULE_AUTHOR("Alan Cox"); 154 146 MODULE_DESCRIPTION("low-level driver for RZ1000 PCI ATA"); 155 147 MODULE_LICENSE("GPL"); 156 148 MODULE_DEVICE_TABLE(pci, pata_rz1000); 157 149 MODULE_VERSION(DRV_VERSION); 158 - 159 - module_init(rz1000_init); 160 - module_exit(rz1000_exit); 161 -
+1 -12
drivers/ata/pata_sc1200.c
··· 261 261 #endif 262 262 }; 263 263 264 - static int __init sc1200_init(void) 265 - { 266 - return pci_register_driver(&sc1200_pci_driver); 267 - } 268 - 269 - static void __exit sc1200_exit(void) 270 - { 271 - pci_unregister_driver(&sc1200_pci_driver); 272 - } 264 + module_pci_driver(sc1200_pci_driver); 273 265 274 266 MODULE_AUTHOR("Alan Cox, Mark Lord"); 275 267 MODULE_DESCRIPTION("low-level driver for the NS/AMD SC1200"); 276 268 MODULE_LICENSE("GPL"); 277 269 MODULE_DEVICE_TABLE(pci, sc1200); 278 270 MODULE_VERSION(DRV_VERSION); 279 - 280 - module_init(sc1200_init); 281 - module_exit(sc1200_exit);
+1 -20
drivers/ata/pata_scc.c
··· 1103 1103 #endif 1104 1104 }; 1105 1105 1106 - static int __init scc_init (void) 1107 - { 1108 - int rc; 1109 - 1110 - DPRINTK("pci_register_driver\n"); 1111 - rc = pci_register_driver(&scc_pci_driver); 1112 - if (rc) 1113 - return rc; 1114 - 1115 - DPRINTK("done\n"); 1116 - return 0; 1117 - } 1118 - 1119 - static void __exit scc_exit (void) 1120 - { 1121 - pci_unregister_driver(&scc_pci_driver); 1122 - } 1123 - 1124 - module_init(scc_init); 1125 - module_exit(scc_exit); 1106 + module_pci_driver(scc_pci_driver); 1126 1107 1127 1108 MODULE_AUTHOR("Toshiba corp"); 1128 1109 MODULE_DESCRIPTION("SCSI low-level driver for Toshiba SCC PATA controller");
+1 -12
drivers/ata/pata_sch.c
··· 179 179 return ata_pci_bmdma_init_one(pdev, ppi, &sch_sht, NULL, 0); 180 180 } 181 181 182 - static int __init sch_init(void) 183 - { 184 - return pci_register_driver(&sch_pci_driver); 185 - } 186 - 187 - static void __exit sch_exit(void) 188 - { 189 - pci_unregister_driver(&sch_pci_driver); 190 - } 191 - 192 - module_init(sch_init); 193 - module_exit(sch_exit); 182 + module_pci_driver(sch_pci_driver);
+1 -12
drivers/ata/pata_serverworks.c
··· 475 475 #endif 476 476 }; 477 477 478 - static int __init serverworks_init(void) 479 - { 480 - return pci_register_driver(&serverworks_pci_driver); 481 - } 482 - 483 - static void __exit serverworks_exit(void) 484 - { 485 - pci_unregister_driver(&serverworks_pci_driver); 486 - } 478 + module_pci_driver(serverworks_pci_driver); 487 479 488 480 MODULE_AUTHOR("Alan Cox"); 489 481 MODULE_DESCRIPTION("low-level driver for Serverworks OSB4/CSB5/CSB6"); 490 482 MODULE_LICENSE("GPL"); 491 483 MODULE_DEVICE_TABLE(pci, serverworks); 492 484 MODULE_VERSION(DRV_VERSION); 493 - 494 - module_init(serverworks_init); 495 - module_exit(serverworks_exit);
+1 -12
drivers/ata/pata_sil680.c
··· 437 437 #endif 438 438 }; 439 439 440 - static int __init sil680_init(void) 441 - { 442 - return pci_register_driver(&sil680_pci_driver); 443 - } 444 - 445 - static void __exit sil680_exit(void) 446 - { 447 - pci_unregister_driver(&sil680_pci_driver); 448 - } 440 + module_pci_driver(sil680_pci_driver); 449 441 450 442 MODULE_AUTHOR("Alan Cox"); 451 443 MODULE_DESCRIPTION("low-level driver for SI680 PATA"); 452 444 MODULE_LICENSE("GPL"); 453 445 MODULE_DEVICE_TABLE(pci, sil680); 454 446 MODULE_VERSION(DRV_VERSION); 455 - 456 - module_init(sil680_init); 457 - module_exit(sil680_exit);
+1 -13
drivers/ata/pata_sis.c
··· 906 906 #endif 907 907 }; 908 908 909 - static int __init sis_init(void) 910 - { 911 - return pci_register_driver(&sis_pci_driver); 912 - } 913 - 914 - static void __exit sis_exit(void) 915 - { 916 - pci_unregister_driver(&sis_pci_driver); 917 - } 918 - 919 - module_init(sis_init); 920 - module_exit(sis_exit); 909 + module_pci_driver(sis_pci_driver); 921 910 922 911 MODULE_AUTHOR("Alan Cox"); 923 912 MODULE_DESCRIPTION("SCSI low-level driver for SiS ATA"); 924 913 MODULE_LICENSE("GPL"); 925 914 MODULE_DEVICE_TABLE(pci, sis_pci_tbl); 926 915 MODULE_VERSION(DRV_VERSION); 927 -
+1 -12
drivers/ata/pata_sl82c105.c
··· 372 372 #endif 373 373 }; 374 374 375 - static int __init sl82c105_init(void) 376 - { 377 - return pci_register_driver(&sl82c105_pci_driver); 378 - } 379 - 380 - static void __exit sl82c105_exit(void) 381 - { 382 - pci_unregister_driver(&sl82c105_pci_driver); 383 - } 375 + module_pci_driver(sl82c105_pci_driver); 384 376 385 377 MODULE_AUTHOR("Alan Cox"); 386 378 MODULE_DESCRIPTION("low-level driver for Sl82c105"); 387 379 MODULE_LICENSE("GPL"); 388 380 MODULE_DEVICE_TABLE(pci, sl82c105); 389 381 MODULE_VERSION(DRV_VERSION); 390 - 391 - module_init(sl82c105_init); 392 - module_exit(sl82c105_exit);
+1 -12
drivers/ata/pata_triflex.c
··· 240 240 #endif 241 241 }; 242 242 243 - static int __init triflex_init(void) 244 - { 245 - return pci_register_driver(&triflex_pci_driver); 246 - } 247 - 248 - static void __exit triflex_exit(void) 249 - { 250 - pci_unregister_driver(&triflex_pci_driver); 251 - } 243 + module_pci_driver(triflex_pci_driver); 252 244 253 245 MODULE_AUTHOR("Alan Cox"); 254 246 MODULE_DESCRIPTION("low-level driver for Compaq Triflex"); 255 247 MODULE_LICENSE("GPL"); 256 248 MODULE_DEVICE_TABLE(pci, triflex); 257 249 MODULE_VERSION(DRV_VERSION); 258 - 259 - module_init(triflex_init); 260 - module_exit(triflex_exit);
+1 -12
drivers/ata/pata_via.c
··· 711 711 #endif 712 712 }; 713 713 714 - static int __init via_init(void) 715 - { 716 - return pci_register_driver(&via_pci_driver); 717 - } 718 - 719 - static void __exit via_exit(void) 720 - { 721 - pci_unregister_driver(&via_pci_driver); 722 - } 714 + module_pci_driver(via_pci_driver); 723 715 724 716 MODULE_AUTHOR("Alan Cox"); 725 717 MODULE_DESCRIPTION("low-level driver for VIA PATA"); 726 718 MODULE_LICENSE("GPL"); 727 719 MODULE_DEVICE_TABLE(pci, via); 728 720 MODULE_VERSION(DRV_VERSION); 729 - 730 - module_init(via_init); 731 - module_exit(via_exit);
+1 -12
drivers/ata/pdc_adma.c
··· 660 660 &adma_ata_sht); 661 661 } 662 662 663 - static int __init adma_ata_init(void) 664 - { 665 - return pci_register_driver(&adma_ata_pci_driver); 666 - } 667 - 668 - static void __exit adma_ata_exit(void) 669 - { 670 - pci_unregister_driver(&adma_ata_pci_driver); 671 - } 663 + module_pci_driver(adma_ata_pci_driver); 672 664 673 665 MODULE_AUTHOR("Mark Lord"); 674 666 MODULE_DESCRIPTION("Pacific Digital Corporation ADMA low-level driver"); 675 667 MODULE_LICENSE("GPL"); 676 668 MODULE_DEVICE_TABLE(pci, adma_ata_pci_tbl); 677 669 MODULE_VERSION(DRV_VERSION); 678 - 679 - module_init(adma_ata_init); 680 - module_exit(adma_ata_exit);
+54 -18
drivers/ata/sata_dwc_460ex.c
··· 158 158 /* Assign HW handshaking interface (x) to destination / source peripheral */ 159 159 #define DMA_CFG_HW_HS_DEST(int_num) (((int_num) & 0xF) << 11) 160 160 #define DMA_CFG_HW_HS_SRC(int_num) (((int_num) & 0xF) << 7) 161 + #define DMA_CFG_HW_CH_PRIOR(int_num) (((int_num) & 0xF) << 5) 161 162 #define DMA_LLP_LMS(addr, master) (((addr) & 0xfffffffc) | (master)) 162 163 163 164 /* ··· 319 318 u32 dma_interrupt_count; 320 319 struct ahb_dma_regs *sata_dma_regs; 321 320 struct device *dwc_dev; 321 + int dma_channel; 322 322 }; 323 323 struct sata_dwc_host_priv host_pvt; 324 324 /* ··· 439 437 */ 440 438 static int dma_request_channel(void) 441 439 { 442 - int i; 443 - 444 - for (i = 0; i < DMA_NUM_CHANS; i++) { 445 - if (!(in_le32(&(host_pvt.sata_dma_regs->dma_chan_en.low)) &\ 446 - DMA_CHANNEL(i))) 447 - return i; 448 - } 449 - dev_err(host_pvt.dwc_dev, "%s NO channel chan_en: 0x%08x\n", __func__, 450 - in_le32(&(host_pvt.sata_dma_regs->dma_chan_en.low))); 440 + /* Check if the channel is not currently in use */ 441 + if (!(in_le32(&(host_pvt.sata_dma_regs->dma_chan_en.low)) & 442 + DMA_CHANNEL(host_pvt.dma_channel))) 443 + return host_pvt.dma_channel; 444 + dev_err(host_pvt.dwc_dev, "%s Channel %d is currently in use\n", 445 + __func__, host_pvt.dma_channel); 451 446 return -1; 452 447 } 453 448 ··· 480 481 dev_dbg(ap->dev, "eot=0x%08x err=0x%08x pending=%d active port=%d\n", 481 482 tfr_reg, err_reg, hsdevp->dma_pending[tag], port); 482 483 483 - for (chan = 0; chan < DMA_NUM_CHANS; chan++) { 484 + chan = host_pvt.dma_channel; 485 + if (chan >= 0) { 484 486 /* Check for end-of-transfer interrupt. */ 485 487 if (tfr_reg & DMA_CHANNEL(chan)) { 486 488 /* ··· 534 534 static int dma_request_interrupts(struct sata_dwc_device *hsdev, int irq) 535 535 { 536 536 int retval = 0; 537 - int chan; 537 + int chan = host_pvt.dma_channel; 538 538 539 - for (chan = 0; chan < DMA_NUM_CHANS; chan++) { 539 + if (chan >= 0) { 540 540 /* Unmask error interrupt */ 541 541 out_le32(&(host_pvt.sata_dma_regs)->interrupt_mask.error.low, 542 542 DMA_ENABLE_CHAN(chan)); ··· 575 575 int fis_len = 0; 576 576 dma_addr_t next_llp; 577 577 int bl; 578 + int sms_val, dms_val; 578 579 580 + sms_val = 0; 581 + dms_val = 1 + host_pvt.dma_channel; 579 582 dev_dbg(host_pvt.dwc_dev, "%s: sg=%p nelem=%d lli=%p dma_lli=0x%08x" 580 583 " dmadr=0x%08x\n", __func__, sg, num_elems, lli, (u32)dma_lli, 581 584 (u32)dmadr_addr); ··· 638 635 639 636 lli[idx].ctl.low = cpu_to_le32( 640 637 DMA_CTL_TTFC(DMA_CTL_TTFC_P2M_DMAC) | 641 - DMA_CTL_SMS(0) | 642 - DMA_CTL_DMS(1) | 638 + DMA_CTL_SMS(sms_val) | 639 + DMA_CTL_DMS(dms_val) | 643 640 DMA_CTL_SRC_MSIZE(bl) | 644 641 DMA_CTL_DST_MSIZE(bl) | 645 642 DMA_CTL_SINC_NOCHANGE | ··· 654 651 655 652 lli[idx].ctl.low = cpu_to_le32( 656 653 DMA_CTL_TTFC(DMA_CTL_TTFC_M2P_PER) | 657 - DMA_CTL_SMS(1) | 658 - DMA_CTL_DMS(0) | 654 + DMA_CTL_SMS(dms_val) | 655 + DMA_CTL_DMS(sms_val) | 659 656 DMA_CTL_SRC_MSIZE(bl) | 660 657 DMA_CTL_DST_MSIZE(bl) | 661 658 DMA_CTL_DINC_NOCHANGE | ··· 747 744 748 745 /* Program the CFG register. */ 749 746 out_le32(&(host_pvt.sata_dma_regs->chan_regs[dma_ch].cfg.high), 747 + DMA_CFG_HW_HS_SRC(dma_ch) | DMA_CFG_HW_HS_DEST(dma_ch) | 750 748 DMA_CFG_PROTCTL | DMA_CFG_FCMOD_REQ); 751 - out_le32(&(host_pvt.sata_dma_regs->chan_regs[dma_ch].cfg.low), 0); 749 + out_le32(&(host_pvt.sata_dma_regs->chan_regs[dma_ch].cfg.low), 750 + DMA_CFG_HW_CH_PRIOR(dma_ch)); 752 751 753 752 /* Program the address of the linked list */ 754 753 out_le32(&(host_pvt.sata_dma_regs->chan_regs[dma_ch].llp.low), ··· 1586 1581 1587 1582 static void sata_dwc_error_handler(struct ata_port *ap) 1588 1583 { 1589 - ap->link.flags |= ATA_LFLAG_NO_HRST; 1590 1584 ata_sff_error_handler(ap); 1585 + } 1586 + 1587 + int sata_dwc_hardreset(struct ata_link *link, unsigned int *class, 1588 + unsigned long deadline) 1589 + { 1590 + struct sata_dwc_device *hsdev = HSDEV_FROM_AP(link->ap); 1591 + int ret; 1592 + 1593 + ret = sata_sff_hardreset(link, class, deadline); 1594 + 1595 + sata_dwc_enable_interrupts(hsdev); 1596 + 1597 + /* Reconfigure the DMA control register */ 1598 + out_le32(&hsdev->sata_dwc_regs->dmacr, 1599 + SATA_DWC_DMACR_TXRXCH_CLEAR); 1600 + 1601 + /* Reconfigure the DMA Burst Transaction Size register */ 1602 + out_le32(&hsdev->sata_dwc_regs->dbtsr, 1603 + SATA_DWC_DBTSR_MWR(AHB_DMA_BRST_DFLT) | 1604 + SATA_DWC_DBTSR_MRD(AHB_DMA_BRST_DFLT)); 1605 + 1606 + return ret; 1591 1607 } 1592 1608 1593 1609 /* ··· 1630 1604 .inherits = &ata_sff_port_ops, 1631 1605 1632 1606 .error_handler = sata_dwc_error_handler, 1607 + .hardreset = sata_dwc_hardreset, 1633 1608 1634 1609 .qc_prep = sata_dwc_qc_prep, 1635 1610 .qc_issue = sata_dwc_qc_issue, ··· 1665 1638 struct ata_host *host; 1666 1639 struct ata_port_info pi = sata_dwc_port_info[0]; 1667 1640 const struct ata_port_info *ppi[] = { &pi, NULL }; 1641 + struct device_node *np = ofdev->dev.of_node; 1642 + u32 dma_chan; 1668 1643 1669 1644 /* Allocate DWC SATA device */ 1670 1645 hsdev = kzalloc(sizeof(*hsdev), GFP_KERNEL); ··· 1675 1646 err = -ENOMEM; 1676 1647 goto error; 1677 1648 } 1649 + 1650 + if (of_property_read_u32(np, "dma-channel", &dma_chan)) { 1651 + dev_warn(&ofdev->dev, "no dma-channel property set." 1652 + " Use channel 0\n"); 1653 + dma_chan = 0; 1654 + } 1655 + host_pvt.dma_channel = dma_chan; 1678 1656 1679 1657 /* Ioremap SATA registers */ 1680 1658 base = of_iomap(ofdev->dev.of_node, 0);
+1 -12
drivers/ata/sata_inic162x.c
··· 894 894 .remove = ata_pci_remove_one, 895 895 }; 896 896 897 - static int __init inic_init(void) 898 - { 899 - return pci_register_driver(&inic_pci_driver); 900 - } 901 - 902 - static void __exit inic_exit(void) 903 - { 904 - pci_unregister_driver(&inic_pci_driver); 905 - } 897 + module_pci_driver(inic_pci_driver); 906 898 907 899 MODULE_AUTHOR("Tejun Heo"); 908 900 MODULE_DESCRIPTION("low-level driver for Initio 162x SATA"); 909 901 MODULE_LICENSE("GPL v2"); 910 902 MODULE_DEVICE_TABLE(pci, inic_pci_tbl); 911 903 MODULE_VERSION(DRV_VERSION); 912 - 913 - module_init(inic_init); 914 - module_exit(inic_exit);
+1 -12
drivers/ata/sata_nv.c
··· 2510 2510 nv_ck804_host_stop(host); 2511 2511 } 2512 2512 2513 - static int __init nv_init(void) 2514 - { 2515 - return pci_register_driver(&nv_pci_driver); 2516 - } 2513 + module_pci_driver(nv_pci_driver); 2517 2514 2518 - static void __exit nv_exit(void) 2519 - { 2520 - pci_unregister_driver(&nv_pci_driver); 2521 - } 2522 - 2523 - module_init(nv_init); 2524 - module_exit(nv_exit); 2525 2515 module_param_named(adma, adma_enabled, bool, 0444); 2526 2516 MODULE_PARM_DESC(adma, "Enable use of ADMA (Default: false)"); 2527 2517 module_param_named(swncq, swncq_enabled, bool, 0444); 2528 2518 MODULE_PARM_DESC(swncq, "Enable use of SWNCQ (Default: true)"); 2529 2519 module_param_named(msi, msi_enabled, bool, 0444); 2530 2520 MODULE_PARM_DESC(msi, "Enable use of MSI (Default: false)"); 2531 -
+1 -12
drivers/ata/sata_promise.c
··· 1249 1249 &pdc_ata_sht); 1250 1250 } 1251 1251 1252 - static int __init pdc_ata_init(void) 1253 - { 1254 - return pci_register_driver(&pdc_ata_pci_driver); 1255 - } 1256 - 1257 - static void __exit pdc_ata_exit(void) 1258 - { 1259 - pci_unregister_driver(&pdc_ata_pci_driver); 1260 - } 1252 + module_pci_driver(pdc_ata_pci_driver); 1261 1253 1262 1254 MODULE_AUTHOR("Jeff Garzik"); 1263 1255 MODULE_DESCRIPTION("Promise ATA TX2/TX4/TX4000 low-level driver"); 1264 1256 MODULE_LICENSE("GPL"); 1265 1257 MODULE_DEVICE_TABLE(pci, pdc_ata_pci_tbl); 1266 1258 MODULE_VERSION(DRV_VERSION); 1267 - 1268 - module_init(pdc_ata_init); 1269 - module_exit(pdc_ata_exit);
+1 -12
drivers/ata/sata_qstor.c
··· 635 635 &qs_ata_sht); 636 636 } 637 637 638 - static int __init qs_ata_init(void) 639 - { 640 - return pci_register_driver(&qs_ata_pci_driver); 641 - } 642 - 643 - static void __exit qs_ata_exit(void) 644 - { 645 - pci_unregister_driver(&qs_ata_pci_driver); 646 - } 638 + module_pci_driver(qs_ata_pci_driver); 647 639 648 640 MODULE_AUTHOR("Mark Lord"); 649 641 MODULE_DESCRIPTION("Pacific Digital Corporation QStor SATA low-level driver"); 650 642 MODULE_LICENSE("GPL"); 651 643 MODULE_DEVICE_TABLE(pci, qs_ata_pci_tbl); 652 644 MODULE_VERSION(DRV_VERSION); 653 - 654 - module_init(qs_ata_init); 655 - module_exit(qs_ata_exit);
+1 -13
drivers/ata/sata_sil.c
··· 819 819 } 820 820 #endif 821 821 822 - static int __init sil_init(void) 823 - { 824 - return pci_register_driver(&sil_pci_driver); 825 - } 826 - 827 - static void __exit sil_exit(void) 828 - { 829 - pci_unregister_driver(&sil_pci_driver); 830 - } 831 - 832 - 833 - module_init(sil_init); 834 - module_exit(sil_exit); 822 + module_pci_driver(sil_pci_driver);
+1 -12
drivers/ata/sata_sil24.c
··· 1382 1382 } 1383 1383 #endif 1384 1384 1385 - static int __init sil24_init(void) 1386 - { 1387 - return pci_register_driver(&sil24_pci_driver); 1388 - } 1389 - 1390 - static void __exit sil24_exit(void) 1391 - { 1392 - pci_unregister_driver(&sil24_pci_driver); 1393 - } 1385 + module_pci_driver(sil24_pci_driver); 1394 1386 1395 1387 MODULE_AUTHOR("Tejun Heo"); 1396 1388 MODULE_DESCRIPTION("Silicon Image 3124/3132 SATA low-level driver"); 1397 1389 MODULE_LICENSE("GPL"); 1398 1390 MODULE_DEVICE_TABLE(pci, sil24_pci_tbl); 1399 - 1400 - module_init(sil24_init); 1401 - module_exit(sil24_exit);
+1 -12
drivers/ata/sata_sis.c
··· 308 308 IRQF_SHARED, &sis_sht); 309 309 } 310 310 311 - static int __init sis_init(void) 312 - { 313 - return pci_register_driver(&sis_pci_driver); 314 - } 315 - 316 - static void __exit sis_exit(void) 317 - { 318 - pci_unregister_driver(&sis_pci_driver); 319 - } 320 - 321 - module_init(sis_init); 322 - module_exit(sis_exit); 311 + module_pci_driver(sis_pci_driver);
+1 -12
drivers/ata/sata_svw.c
··· 525 525 .remove = ata_pci_remove_one, 526 526 }; 527 527 528 - static int __init k2_sata_init(void) 529 - { 530 - return pci_register_driver(&k2_sata_pci_driver); 531 - } 532 - 533 - static void __exit k2_sata_exit(void) 534 - { 535 - pci_unregister_driver(&k2_sata_pci_driver); 536 - } 528 + module_pci_driver(k2_sata_pci_driver); 537 529 538 530 MODULE_AUTHOR("Benjamin Herrenschmidt"); 539 531 MODULE_DESCRIPTION("low-level driver for K2 SATA controller"); 540 532 MODULE_LICENSE("GPL"); 541 533 MODULE_DEVICE_TABLE(pci, k2_sata_pci_tbl); 542 534 MODULE_VERSION(DRV_VERSION); 543 - 544 - module_init(k2_sata_init); 545 - module_exit(k2_sata_exit);
+1 -15
drivers/ata/sata_sx4.c
··· 1498 1498 IRQF_SHARED, &pdc_sata_sht); 1499 1499 } 1500 1500 1501 - 1502 - static int __init pdc_sata_init(void) 1503 - { 1504 - return pci_register_driver(&pdc_sata_pci_driver); 1505 - } 1506 - 1507 - 1508 - static void __exit pdc_sata_exit(void) 1509 - { 1510 - pci_unregister_driver(&pdc_sata_pci_driver); 1511 - } 1512 - 1501 + module_pci_driver(pdc_sata_pci_driver); 1513 1502 1514 1503 MODULE_AUTHOR("Jeff Garzik"); 1515 1504 MODULE_DESCRIPTION("Promise SATA low-level driver"); 1516 1505 MODULE_LICENSE("GPL"); 1517 1506 MODULE_DEVICE_TABLE(pci, pdc_sata_pci_tbl); 1518 1507 MODULE_VERSION(DRV_VERSION); 1519 - 1520 - module_init(pdc_sata_init); 1521 - module_exit(pdc_sata_exit);
+1 -13
drivers/ata/sata_uli.c
··· 243 243 IRQF_SHARED, &uli_sht); 244 244 } 245 245 246 - static int __init uli_init(void) 247 - { 248 - return pci_register_driver(&uli_pci_driver); 249 - } 250 - 251 - static void __exit uli_exit(void) 252 - { 253 - pci_unregister_driver(&uli_pci_driver); 254 - } 255 - 256 - 257 - module_init(uli_init); 258 - module_exit(uli_exit); 246 + module_pci_driver(uli_pci_driver);
+1 -12
drivers/ata/sata_via.c
··· 655 655 IRQF_SHARED, &svia_sht); 656 656 } 657 657 658 - static int __init svia_init(void) 659 - { 660 - return pci_register_driver(&svia_pci_driver); 661 - } 662 - 663 - static void __exit svia_exit(void) 664 - { 665 - pci_unregister_driver(&svia_pci_driver); 666 - } 667 - 668 - module_init(svia_init); 669 - module_exit(svia_exit); 658 + module_pci_driver(svia_pci_driver);
+1 -12
drivers/ata/sata_vsc.c
··· 436 436 .remove = ata_pci_remove_one, 437 437 }; 438 438 439 - static int __init vsc_sata_init(void) 440 - { 441 - return pci_register_driver(&vsc_sata_pci_driver); 442 - } 443 - 444 - static void __exit vsc_sata_exit(void) 445 - { 446 - pci_unregister_driver(&vsc_sata_pci_driver); 447 - } 439 + module_pci_driver(vsc_sata_pci_driver); 448 440 449 441 MODULE_AUTHOR("Jeremy Higdon"); 450 442 MODULE_DESCRIPTION("low-level driver for Vitesse VSC7174 SATA controller"); 451 443 MODULE_LICENSE("GPL"); 452 444 MODULE_DEVICE_TABLE(pci, vsc_sata_pci_tbl); 453 445 MODULE_VERSION(DRV_VERSION); 454 - 455 - module_init(vsc_sata_init); 456 - module_exit(vsc_sata_exit);
+17
drivers/scsi/scsi_lib.c
··· 68 68 69 69 struct kmem_cache *scsi_sdb_cache; 70 70 71 + #ifdef CONFIG_ACPI 72 + #include <acpi/acpi_bus.h> 73 + 74 + int scsi_register_acpi_bus_type(struct acpi_bus_type *bus) 75 + { 76 + bus->bus = &scsi_bus_type; 77 + return register_acpi_bus_type(bus); 78 + } 79 + EXPORT_SYMBOL_GPL(scsi_register_acpi_bus_type); 80 + 81 + void scsi_unregister_acpi_bus_type(struct acpi_bus_type *bus) 82 + { 83 + unregister_acpi_bus_type(bus); 84 + } 85 + EXPORT_SYMBOL_GPL(scsi_unregister_acpi_bus_type); 86 + #endif 87 + 71 88 /* 72 89 * When to reinvoke queueing after a resource shortage. It's 3 msecs to 73 90 * not change behaviour from the previous unplug mechanism, experimentation
+1
include/linux/ata.h
··· 578 578 ((u64) (id)[(n) + 0]) ) 579 579 580 580 #define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20) 581 + #define ata_id_has_da(id) ((id)[77] & (1 << 4)) 581 582 582 583 static inline bool ata_id_has_hipm(const u16 *id) 583 584 {
+4 -5
include/linux/libata.h
··· 161 161 ATA_DFLAG_DETACH = (1 << 24), 162 162 ATA_DFLAG_DETACHED = (1 << 25), 163 163 164 + ATA_DFLAG_DA = (1 << 26), /* device supports Device Attention */ 165 + 164 166 ATA_DEV_UNKNOWN = 0, /* unknown device */ 165 167 ATA_DEV_ATA = 1, /* ATA device */ 166 168 ATA_DEV_ATA_UNSUP = 2, /* ATA device (unsupported) */ ··· 547 545 struct mutex eh_mutex; 548 546 struct task_struct *eh_owner; 549 547 550 - #ifdef CONFIG_ATA_ACPI 551 - acpi_handle acpi_handle; 552 - #endif 553 548 struct ata_port *simplex_claimed; /* channel owning the DMA */ 554 549 struct ata_port *ports[0]; 555 550 }; ··· 614 615 struct scsi_device *sdev; /* attached SCSI device */ 615 616 void *private_data; 616 617 #ifdef CONFIG_ATA_ACPI 617 - acpi_handle acpi_handle; 618 618 union acpi_object *gtf_cache; 619 619 unsigned int gtf_filter; 620 620 #endif ··· 795 797 void *private_data; 796 798 797 799 #ifdef CONFIG_ATA_ACPI 798 - acpi_handle acpi_handle; 799 800 struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */ 800 801 #endif 801 802 /* owned by EH */ ··· 1113 1116 int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm); 1114 1117 unsigned long ata_acpi_gtm_xfermask(struct ata_device *dev, 1115 1118 const struct ata_acpi_gtm *gtm); 1119 + acpi_handle ata_ap_acpi_handle(struct ata_port *ap); 1120 + acpi_handle ata_dev_acpi_handle(struct ata_device *dev); 1116 1121 int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm); 1117 1122 #else 1118 1123 static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
+10
include/scsi/scsi.h
··· 216 216 scsi_varlen_cdb_length(cmnd) : COMMAND_SIZE(cmnd[0]); 217 217 } 218 218 219 + #ifdef CONFIG_ACPI 220 + struct acpi_bus_type; 221 + 222 + extern int 223 + scsi_register_acpi_bus_type(struct acpi_bus_type *bus); 224 + 225 + extern void 226 + scsi_unregister_acpi_bus_type(struct acpi_bus_type *bus); 227 + #endif 228 + 219 229 /* 220 230 * SCSI Architecture Model (SAM) Status codes. Taken from SAM-3 draft 221 231 * T10/1561-D Revision 4 Draft dated 7th November 2002.
+1
include/scsi/scsi_device.h
··· 154 154 unsigned no_read_capacity_16:1; /* Avoid READ_CAPACITY_16 cmds */ 155 155 unsigned try_rc_10_first:1; /* Try READ_CAPACACITY_10 first */ 156 156 unsigned is_visible:1; /* is the device visible in sysfs */ 157 + unsigned can_power_off:1; /* Device supports runtime power off */ 157 158 unsigned wce_default_on:1; /* Cache is ON by default */ 158 159 159 160 DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */