diff options
author | David S. Miller <davem@davemloft.net> | 2008-06-10 05:22:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-10 05:22:26 -0400 |
commit | 65b53e4cc90e59936733b3b95b9451d2ca47528d (patch) | |
tree | 29932718192962671c48c3fd1ea017a6112459e8 /drivers | |
parent | 788c0a53164c05c5ccdb1472474372b72ba74644 (diff) | |
parent | 2e761e0532a784816e7e822dbaaece8c5d4be14d (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/tg3.c
drivers/net/wireless/rt2x00/rt2x00dev.c
net/mac80211/ieee80211_i.h
Diffstat (limited to 'drivers')
321 files changed, 7229 insertions, 3144 deletions
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index e48a3ea03117..2509809a36cf 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -565,7 +565,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
565 | 565 | ||
566 | acpi_os_release_mutex(method_desc->method. | 566 | acpi_os_release_mutex(method_desc->method. |
567 | mutex->mutex.os_mutex); | 567 | mutex->mutex.os_mutex); |
568 | method_desc->method.mutex->mutex.thread_id = 0; | 568 | method_desc->method.mutex->mutex.thread_id = NULL; |
569 | } | 569 | } |
570 | } | 570 | } |
571 | 571 | ||
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index c873ab40cd0e..a8bf3d713e28 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c | |||
@@ -326,7 +326,7 @@ acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc) | |||
326 | 326 | ||
327 | /* Clear mutex info */ | 327 | /* Clear mutex info */ |
328 | 328 | ||
329 | obj_desc->mutex.thread_id = 0; | 329 | obj_desc->mutex.thread_id = NULL; |
330 | return_ACPI_STATUS(status); | 330 | return_ACPI_STATUS(status); |
331 | } | 331 | } |
332 | 332 | ||
@@ -463,7 +463,7 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) | |||
463 | /* Mark mutex unowned */ | 463 | /* Mark mutex unowned */ |
464 | 464 | ||
465 | obj_desc->mutex.owner_thread = NULL; | 465 | obj_desc->mutex.owner_thread = NULL; |
466 | obj_desc->mutex.thread_id = 0; | 466 | obj_desc->mutex.thread_id = NULL; |
467 | 467 | ||
468 | /* Update Thread sync_level (Last mutex is the important one) */ | 468 | /* Update Thread sync_level (Last mutex is the important one) */ |
469 | 469 | ||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 97f83fb2ee2e..544b7d6c617c 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -502,10 +502,10 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
502 | { PCI_VDEVICE(NVIDIA, 0x0bcd), board_ahci }, /* MCP7B */ | 502 | { PCI_VDEVICE(NVIDIA, 0x0bcd), board_ahci }, /* MCP7B */ |
503 | { PCI_VDEVICE(NVIDIA, 0x0bce), board_ahci }, /* MCP7B */ | 503 | { PCI_VDEVICE(NVIDIA, 0x0bce), board_ahci }, /* MCP7B */ |
504 | { PCI_VDEVICE(NVIDIA, 0x0bcf), board_ahci }, /* MCP7B */ | 504 | { PCI_VDEVICE(NVIDIA, 0x0bcf), board_ahci }, /* MCP7B */ |
505 | { PCI_VDEVICE(NVIDIA, 0x0bd0), board_ahci }, /* MCP7B */ | 505 | { PCI_VDEVICE(NVIDIA, 0x0bc4), board_ahci }, /* MCP7B */ |
506 | { PCI_VDEVICE(NVIDIA, 0x0bd1), board_ahci }, /* MCP7B */ | 506 | { PCI_VDEVICE(NVIDIA, 0x0bc5), board_ahci }, /* MCP7B */ |
507 | { PCI_VDEVICE(NVIDIA, 0x0bd2), board_ahci }, /* MCP7B */ | 507 | { PCI_VDEVICE(NVIDIA, 0x0bc6), board_ahci }, /* MCP7B */ |
508 | { PCI_VDEVICE(NVIDIA, 0x0bd3), board_ahci }, /* MCP7B */ | 508 | { PCI_VDEVICE(NVIDIA, 0x0bc7), board_ahci }, /* MCP7B */ |
509 | 509 | ||
510 | /* SiS */ | 510 | /* SiS */ |
511 | { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */ | 511 | { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */ |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index a9027b8fbdd5..3548ee7014ca 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -247,10 +247,11 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
247 | { 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | 247 | { 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, |
248 | /* SATA Controller 2 IDE (ICH8) */ | 248 | /* SATA Controller 2 IDE (ICH8) */ |
249 | { 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 249 | { 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
250 | /* Mobile SATA Controller IDE (ICH8M) */ | ||
251 | { 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | ||
252 | /* Mobile SATA Controller IDE (ICH8M), Apple */ | 250 | /* Mobile SATA Controller IDE (ICH8M), Apple */ |
253 | { 0x8086, 0x2828, 0x106b, 0x00a0, 0, 0, ich8m_apple_sata }, | 251 | { 0x8086, 0x2828, 0x106b, 0x00a0, 0, 0, ich8m_apple_sata }, |
252 | { 0x8086, 0x2828, 0x106b, 0x00a1, 0, 0, ich8m_apple_sata }, | ||
253 | /* Mobile SATA Controller IDE (ICH8M) */ | ||
254 | { 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | ||
254 | /* SATA Controller IDE (ICH9) */ | 255 | /* SATA Controller IDE (ICH9) */ |
255 | { 0x8086, 0x2920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | 256 | { 0x8086, 0x2920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, |
256 | /* SATA Controller IDE (ICH9) */ | 257 | /* SATA Controller IDE (ICH9) */ |
@@ -526,7 +527,7 @@ static struct ata_port_info piix_port_info[] = { | |||
526 | 527 | ||
527 | [ich8m_apple_sata] = | 528 | [ich8m_apple_sata] = |
528 | { | 529 | { |
529 | .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SIDPR, | 530 | .flags = PIIX_SATA_FLAGS, |
530 | .pio_mask = 0x1f, /* pio0-4 */ | 531 | .pio_mask = 0x1f, /* pio0-4 */ |
531 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 532 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
532 | .udma_mask = ATA_UDMA6, | 533 | .udma_mask = ATA_UDMA6, |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index 70b77e0899a8..dbf6ca781f66 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -118,8 +118,8 @@ static void ata_acpi_associate_ide_port(struct ata_port *ap) | |||
118 | ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; | 118 | ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; |
119 | } | 119 | } |
120 | 120 | ||
121 | static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev, | 121 | static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device |
122 | u32 event) | 122 | *dev, u32 event) |
123 | { | 123 | { |
124 | char event_string[12]; | 124 | char event_string[12]; |
125 | char *envp[] = { event_string, NULL }; | 125 | char *envp[] = { event_string, NULL }; |
@@ -127,6 +127,9 @@ static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev, | |||
127 | struct kobject *kobj = NULL; | 127 | struct kobject *kobj = NULL; |
128 | int wait = 0; | 128 | int wait = 0; |
129 | unsigned long flags; | 129 | unsigned long flags; |
130 | acpi_handle handle, tmphandle; | ||
131 | unsigned long sta; | ||
132 | acpi_status status; | ||
130 | 133 | ||
131 | if (!ap) | 134 | if (!ap) |
132 | ap = dev->link->ap; | 135 | ap = dev->link->ap; |
@@ -134,32 +137,57 @@ static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev, | |||
134 | 137 | ||
135 | spin_lock_irqsave(ap->lock, flags); | 138 | spin_lock_irqsave(ap->lock, flags); |
136 | 139 | ||
140 | if (dev) | ||
141 | handle = dev->acpi_handle; | ||
142 | else | ||
143 | handle = ap->acpi_handle; | ||
144 | |||
145 | status = acpi_get_handle(handle, "_EJ0", &tmphandle); | ||
146 | if (ACPI_FAILURE(status)) { | ||
147 | /* This device is not ejectable */ | ||
148 | spin_unlock_irqrestore(ap->lock, flags); | ||
149 | return; | ||
150 | } | ||
151 | |||
152 | status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); | ||
153 | if (ACPI_FAILURE(status)) { | ||
154 | printk ("Unable to determine bay status\n"); | ||
155 | spin_unlock_irqrestore(ap->lock, flags); | ||
156 | return; | ||
157 | } | ||
158 | |||
137 | switch (event) { | 159 | switch (event) { |
138 | case ACPI_NOTIFY_BUS_CHECK: | 160 | case ACPI_NOTIFY_BUS_CHECK: |
139 | case ACPI_NOTIFY_DEVICE_CHECK: | 161 | case ACPI_NOTIFY_DEVICE_CHECK: |
140 | ata_ehi_push_desc(ehi, "ACPI event"); | 162 | ata_ehi_push_desc(ehi, "ACPI event"); |
141 | ata_ehi_hotplugged(ehi); | 163 | if (!sta) { |
142 | ata_port_freeze(ap); | 164 | /* Device has been unplugged */ |
143 | break; | 165 | if (dev) |
144 | 166 | dev->flags |= ATA_DFLAG_DETACH; | |
145 | case ACPI_NOTIFY_EJECT_REQUEST: | 167 | else { |
146 | ata_ehi_push_desc(ehi, "ACPI event"); | 168 | struct ata_link *tlink; |
147 | if (dev) | 169 | struct ata_device *tdev; |
148 | dev->flags |= ATA_DFLAG_DETACH; | 170 | |
149 | else { | 171 | ata_port_for_each_link(tlink, ap) { |
150 | struct ata_link *tlink; | 172 | ata_link_for_each_dev(tdev, tlink) { |
151 | struct ata_device *tdev; | 173 | tdev->flags |= |
152 | 174 | ATA_DFLAG_DETACH; | |
153 | ata_port_for_each_link(tlink, ap) | 175 | } |
154 | ata_link_for_each_dev(tdev, tlink) | 176 | } |
155 | tdev->flags |= ATA_DFLAG_DETACH; | 177 | } |
178 | ata_port_schedule_eh(ap); | ||
179 | wait = 1; | ||
180 | } else { | ||
181 | ata_ehi_hotplugged(ehi); | ||
182 | ata_port_freeze(ap); | ||
156 | } | 183 | } |
157 | |||
158 | ata_port_schedule_eh(ap); | ||
159 | wait = 1; | ||
160 | break; | ||
161 | } | 184 | } |
162 | 185 | ||
186 | spin_unlock_irqrestore(ap->lock, flags); | ||
187 | |||
188 | if (wait) | ||
189 | ata_port_wait_eh(ap); | ||
190 | |||
163 | if (dev) { | 191 | if (dev) { |
164 | if (dev->sdev) | 192 | if (dev->sdev) |
165 | kobj = &dev->sdev->sdev_gendev.kobj; | 193 | kobj = &dev->sdev->sdev_gendev.kobj; |
@@ -170,11 +198,6 @@ static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev, | |||
170 | sprintf(event_string, "BAY_EVENT=%d", event); | 198 | sprintf(event_string, "BAY_EVENT=%d", event); |
171 | kobject_uevent_env(kobj, KOBJ_CHANGE, envp); | 199 | kobject_uevent_env(kobj, KOBJ_CHANGE, envp); |
172 | } | 200 | } |
173 | |||
174 | spin_unlock_irqrestore(ap->lock, flags); | ||
175 | |||
176 | if (wait) | ||
177 | ata_port_wait_eh(ap); | ||
178 | } | 201 | } |
179 | 202 | ||
180 | static void ata_acpi_dev_notify(acpi_handle handle, u32 event, void *data) | 203 | static void ata_acpi_dev_notify(acpi_handle handle, u32 event, void *data) |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 927b692d723c..cc816ca623d3 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -2126,6 +2126,13 @@ int ata_dev_configure(struct ata_device *dev) | |||
2126 | dev->horkage |= ata_dev_blacklisted(dev); | 2126 | dev->horkage |= ata_dev_blacklisted(dev); |
2127 | ata_force_horkage(dev); | 2127 | ata_force_horkage(dev); |
2128 | 2128 | ||
2129 | if (dev->horkage & ATA_HORKAGE_DISABLE) { | ||
2130 | ata_dev_printk(dev, KERN_INFO, | ||
2131 | "unsupported device, disabling\n"); | ||
2132 | ata_dev_disable(dev); | ||
2133 | return 0; | ||
2134 | } | ||
2135 | |||
2129 | /* let ACPI work its magic */ | 2136 | /* let ACPI work its magic */ |
2130 | rc = ata_acpi_on_devcfg(dev); | 2137 | rc = ata_acpi_on_devcfg(dev); |
2131 | if (rc) | 2138 | if (rc) |
@@ -3490,22 +3497,11 @@ int sata_link_resume(struct ata_link *link, const unsigned long *params, | |||
3490 | if ((rc = sata_link_debounce(link, params, deadline))) | 3497 | if ((rc = sata_link_debounce(link, params, deadline))) |
3491 | return rc; | 3498 | return rc; |
3492 | 3499 | ||
3493 | /* Clear SError. PMP and some host PHYs require this to | 3500 | /* clear SError, some PHYs require this even for SRST to work */ |
3494 | * operate and clearing should be done before checking PHY | ||
3495 | * online status to avoid race condition (hotplugging between | ||
3496 | * link resume and status check). | ||
3497 | */ | ||
3498 | if (!(rc = sata_scr_read(link, SCR_ERROR, &serror))) | 3501 | if (!(rc = sata_scr_read(link, SCR_ERROR, &serror))) |
3499 | rc = sata_scr_write(link, SCR_ERROR, serror); | 3502 | rc = sata_scr_write(link, SCR_ERROR, serror); |
3500 | if (rc == 0 || rc == -EINVAL) { | ||
3501 | unsigned long flags; | ||
3502 | 3503 | ||
3503 | spin_lock_irqsave(link->ap->lock, flags); | 3504 | return rc != -EINVAL ? rc : 0; |
3504 | link->eh_info.serror = 0; | ||
3505 | spin_unlock_irqrestore(link->ap->lock, flags); | ||
3506 | rc = 0; | ||
3507 | } | ||
3508 | return rc; | ||
3509 | } | 3505 | } |
3510 | 3506 | ||
3511 | /** | 3507 | /** |
@@ -3653,9 +3649,13 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing, | |||
3653 | if (check_ready) | 3649 | if (check_ready) |
3654 | rc = ata_wait_ready(link, deadline, check_ready); | 3650 | rc = ata_wait_ready(link, deadline, check_ready); |
3655 | out: | 3651 | out: |
3656 | if (rc && rc != -EAGAIN) | 3652 | if (rc && rc != -EAGAIN) { |
3653 | /* online is set iff link is online && reset succeeded */ | ||
3654 | if (online) | ||
3655 | *online = false; | ||
3657 | ata_link_printk(link, KERN_ERR, | 3656 | ata_link_printk(link, KERN_ERR, |
3658 | "COMRESET failed (errno=%d)\n", rc); | 3657 | "COMRESET failed (errno=%d)\n", rc); |
3658 | } | ||
3659 | DPRINTK("EXIT, rc=%d\n", rc); | 3659 | DPRINTK("EXIT, rc=%d\n", rc); |
3660 | return rc; | 3660 | return rc; |
3661 | } | 3661 | } |
@@ -3700,8 +3700,14 @@ int sata_std_hardreset(struct ata_link *link, unsigned int *class, | |||
3700 | */ | 3700 | */ |
3701 | void ata_std_postreset(struct ata_link *link, unsigned int *classes) | 3701 | void ata_std_postreset(struct ata_link *link, unsigned int *classes) |
3702 | { | 3702 | { |
3703 | u32 serror; | ||
3704 | |||
3703 | DPRINTK("ENTER\n"); | 3705 | DPRINTK("ENTER\n"); |
3704 | 3706 | ||
3707 | /* reset complete, clear SError */ | ||
3708 | if (!sata_scr_read(link, SCR_ERROR, &serror)) | ||
3709 | sata_scr_write(link, SCR_ERROR, serror); | ||
3710 | |||
3705 | /* print link status */ | 3711 | /* print link status */ |
3706 | sata_print_link_status(link); | 3712 | sata_print_link_status(link); |
3707 | 3713 | ||
@@ -3894,8 +3900,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
3894 | { "SAMSUNG CD-ROM SN-124", "N001", ATA_HORKAGE_NODMA }, | 3900 | { "SAMSUNG CD-ROM SN-124", "N001", ATA_HORKAGE_NODMA }, |
3895 | { "Seagate STT20000A", NULL, ATA_HORKAGE_NODMA }, | 3901 | { "Seagate STT20000A", NULL, ATA_HORKAGE_NODMA }, |
3896 | /* Odd clown on sil3726/4726 PMPs */ | 3902 | /* Odd clown on sil3726/4726 PMPs */ |
3897 | { "Config Disk", NULL, ATA_HORKAGE_NODMA | | 3903 | { "Config Disk", NULL, ATA_HORKAGE_DISABLE }, |
3898 | ATA_HORKAGE_SKIP_PM }, | ||
3899 | 3904 | ||
3900 | /* Weird ATAPI devices */ | 3905 | /* Weird ATAPI devices */ |
3901 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, | 3906 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, |
@@ -5398,7 +5403,7 @@ static void ata_host_stop(struct device *gendev, void *res) | |||
5398 | */ | 5403 | */ |
5399 | static void ata_finalize_port_ops(struct ata_port_operations *ops) | 5404 | static void ata_finalize_port_ops(struct ata_port_operations *ops) |
5400 | { | 5405 | { |
5401 | static spinlock_t lock = SPIN_LOCK_UNLOCKED; | 5406 | static DEFINE_SPINLOCK(lock); |
5402 | const struct ata_port_operations *cur; | 5407 | const struct ata_port_operations *cur; |
5403 | void **begin = (void **)ops; | 5408 | void **begin = (void **)ops; |
5404 | void **end = (void **)&ops->inherits; | 5409 | void **end = (void **)&ops->inherits; |
@@ -5616,7 +5621,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
5616 | spin_lock_irqsave(ap->lock, flags); | 5621 | spin_lock_irqsave(ap->lock, flags); |
5617 | 5622 | ||
5618 | ehi->probe_mask |= ATA_ALL_DEVICES; | 5623 | ehi->probe_mask |= ATA_ALL_DEVICES; |
5619 | ehi->action |= ATA_EH_RESET; | 5624 | ehi->action |= ATA_EH_RESET | ATA_EH_LPM; |
5620 | ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET; | 5625 | ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET; |
5621 | 5626 | ||
5622 | ap->pflags &= ~ATA_PFLAG_INITIALIZING; | 5627 | ap->pflags &= ~ATA_PFLAG_INITIALIZING; |
@@ -5649,7 +5654,6 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
5649 | struct ata_port *ap = host->ports[i]; | 5654 | struct ata_port *ap = host->ports[i]; |
5650 | 5655 | ||
5651 | ata_scsi_scan_host(ap, 1); | 5656 | ata_scsi_scan_host(ap, 1); |
5652 | ata_lpm_schedule(ap, ap->pm_policy); | ||
5653 | } | 5657 | } |
5654 | 5658 | ||
5655 | return 0; | 5659 | return 0; |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 62e033146bed..7894d83ea1eb 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -1308,12 +1308,7 @@ static void ata_eh_analyze_serror(struct ata_link *link) | |||
1308 | unsigned int err_mask = 0, action = 0; | 1308 | unsigned int err_mask = 0, action = 0; |
1309 | u32 hotplug_mask; | 1309 | u32 hotplug_mask; |
1310 | 1310 | ||
1311 | if (serror & SERR_PERSISTENT) { | 1311 | if (serror & (SERR_PERSISTENT | SERR_DATA)) { |
1312 | err_mask |= AC_ERR_ATA_BUS; | ||
1313 | action |= ATA_EH_RESET; | ||
1314 | } | ||
1315 | if (serror & | ||
1316 | (SERR_DATA_RECOVERED | SERR_COMM_RECOVERED | SERR_DATA)) { | ||
1317 | err_mask |= AC_ERR_ATA_BUS; | 1312 | err_mask |= AC_ERR_ATA_BUS; |
1318 | action |= ATA_EH_RESET; | 1313 | action |= ATA_EH_RESET; |
1319 | } | 1314 | } |
@@ -2047,19 +2042,11 @@ static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset, | |||
2047 | unsigned int *classes, unsigned long deadline) | 2042 | unsigned int *classes, unsigned long deadline) |
2048 | { | 2043 | { |
2049 | struct ata_device *dev; | 2044 | struct ata_device *dev; |
2050 | int rc; | ||
2051 | 2045 | ||
2052 | ata_link_for_each_dev(dev, link) | 2046 | ata_link_for_each_dev(dev, link) |
2053 | classes[dev->devno] = ATA_DEV_UNKNOWN; | 2047 | classes[dev->devno] = ATA_DEV_UNKNOWN; |
2054 | 2048 | ||
2055 | rc = reset(link, classes, deadline); | 2049 | return reset(link, classes, deadline); |
2056 | |||
2057 | /* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */ | ||
2058 | ata_link_for_each_dev(dev, link) | ||
2059 | if (classes[dev->devno] == ATA_DEV_UNKNOWN) | ||
2060 | classes[dev->devno] = ATA_DEV_NONE; | ||
2061 | |||
2062 | return rc; | ||
2063 | } | 2050 | } |
2064 | 2051 | ||
2065 | static int ata_eh_followup_srst_needed(struct ata_link *link, | 2052 | static int ata_eh_followup_srst_needed(struct ata_link *link, |
@@ -2096,9 +2083,11 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2096 | ata_reset_fn_t reset; | 2083 | ata_reset_fn_t reset; |
2097 | unsigned long flags; | 2084 | unsigned long flags; |
2098 | u32 sstatus; | 2085 | u32 sstatus; |
2099 | int rc; | 2086 | int nr_known, rc; |
2100 | 2087 | ||
2101 | /* about to reset */ | 2088 | /* |
2089 | * Prepare to reset | ||
2090 | */ | ||
2102 | spin_lock_irqsave(ap->lock, flags); | 2091 | spin_lock_irqsave(ap->lock, flags); |
2103 | ap->pflags |= ATA_PFLAG_RESETTING; | 2092 | ap->pflags |= ATA_PFLAG_RESETTING; |
2104 | spin_unlock_irqrestore(ap->lock, flags); | 2093 | spin_unlock_irqrestore(ap->lock, flags); |
@@ -2124,16 +2113,8 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2124 | ap->ops->set_piomode(ap, dev); | 2113 | ap->ops->set_piomode(ap, dev); |
2125 | } | 2114 | } |
2126 | 2115 | ||
2127 | if (!softreset && !hardreset) { | ||
2128 | if (verbose) | ||
2129 | ata_link_printk(link, KERN_INFO, "no reset method " | ||
2130 | "available, skipping reset\n"); | ||
2131 | if (!(lflags & ATA_LFLAG_ASSUME_CLASS)) | ||
2132 | lflags |= ATA_LFLAG_ASSUME_ATA; | ||
2133 | goto done; | ||
2134 | } | ||
2135 | |||
2136 | /* prefer hardreset */ | 2116 | /* prefer hardreset */ |
2117 | reset = NULL; | ||
2137 | ehc->i.action &= ~ATA_EH_RESET; | 2118 | ehc->i.action &= ~ATA_EH_RESET; |
2138 | if (hardreset) { | 2119 | if (hardreset) { |
2139 | reset = hardreset; | 2120 | reset = hardreset; |
@@ -2141,11 +2122,6 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2141 | } else if (softreset) { | 2122 | } else if (softreset) { |
2142 | reset = softreset; | 2123 | reset = softreset; |
2143 | ehc->i.action = ATA_EH_SOFTRESET; | 2124 | ehc->i.action = ATA_EH_SOFTRESET; |
2144 | } else { | ||
2145 | ata_link_printk(link, KERN_ERR, "BUG: no reset method, " | ||
2146 | "please report to linux-ide@vger.kernel.org\n"); | ||
2147 | dump_stack(); | ||
2148 | return -EINVAL; | ||
2149 | } | 2125 | } |
2150 | 2126 | ||
2151 | if (prereset) { | 2127 | if (prereset) { |
@@ -2165,55 +2141,71 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2165 | "prereset failed (errno=%d)\n", rc); | 2141 | "prereset failed (errno=%d)\n", rc); |
2166 | goto out; | 2142 | goto out; |
2167 | } | 2143 | } |
2168 | } | ||
2169 | 2144 | ||
2170 | /* prereset() might have cleared ATA_EH_RESET */ | 2145 | /* prereset() might have cleared ATA_EH_RESET. If so, |
2171 | if (!(ehc->i.action & ATA_EH_RESET)) { | 2146 | * bang classes and return. |
2172 | /* prereset told us not to reset, bang classes and return */ | 2147 | */ |
2173 | ata_link_for_each_dev(dev, link) | 2148 | if (reset && !(ehc->i.action & ATA_EH_RESET)) { |
2174 | classes[dev->devno] = ATA_DEV_NONE; | 2149 | ata_link_for_each_dev(dev, link) |
2175 | rc = 0; | 2150 | classes[dev->devno] = ATA_DEV_NONE; |
2176 | goto out; | 2151 | rc = 0; |
2152 | goto out; | ||
2153 | } | ||
2177 | } | 2154 | } |
2178 | 2155 | ||
2179 | retry: | 2156 | retry: |
2157 | /* | ||
2158 | * Perform reset | ||
2159 | */ | ||
2160 | if (ata_is_host_link(link)) | ||
2161 | ata_eh_freeze_port(ap); | ||
2162 | |||
2180 | deadline = jiffies + ata_eh_reset_timeouts[try++]; | 2163 | deadline = jiffies + ata_eh_reset_timeouts[try++]; |
2181 | 2164 | ||
2182 | /* shut up during boot probing */ | 2165 | if (reset) { |
2183 | if (verbose) | 2166 | if (verbose) |
2184 | ata_link_printk(link, KERN_INFO, "%s resetting link\n", | 2167 | ata_link_printk(link, KERN_INFO, "%s resetting link\n", |
2185 | reset == softreset ? "soft" : "hard"); | 2168 | reset == softreset ? "soft" : "hard"); |
2186 | 2169 | ||
2187 | /* mark that this EH session started with reset */ | 2170 | /* mark that this EH session started with reset */ |
2188 | if (reset == hardreset) | 2171 | if (reset == hardreset) |
2189 | ehc->i.flags |= ATA_EHI_DID_HARDRESET; | 2172 | ehc->i.flags |= ATA_EHI_DID_HARDRESET; |
2190 | else | 2173 | else |
2191 | ehc->i.flags |= ATA_EHI_DID_SOFTRESET; | 2174 | ehc->i.flags |= ATA_EHI_DID_SOFTRESET; |
2192 | 2175 | ||
2193 | rc = ata_do_reset(link, reset, classes, deadline); | 2176 | rc = ata_do_reset(link, reset, classes, deadline); |
2194 | 2177 | ||
2195 | if (reset == hardreset && | 2178 | if (reset == hardreset && |
2196 | ata_eh_followup_srst_needed(link, rc, classify, classes)) { | 2179 | ata_eh_followup_srst_needed(link, rc, classify, classes)) { |
2197 | /* okay, let's do follow-up softreset */ | 2180 | /* okay, let's do follow-up softreset */ |
2198 | reset = softreset; | 2181 | reset = softreset; |
2199 | 2182 | ||
2200 | if (!reset) { | 2183 | if (!reset) { |
2201 | ata_link_printk(link, KERN_ERR, | 2184 | ata_link_printk(link, KERN_ERR, |
2202 | "follow-up softreset required " | 2185 | "follow-up softreset required " |
2203 | "but no softreset avaliable\n"); | 2186 | "but no softreset avaliable\n"); |
2204 | rc = -EINVAL; | 2187 | rc = -EINVAL; |
2205 | goto fail; | 2188 | goto fail; |
2189 | } | ||
2190 | |||
2191 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); | ||
2192 | rc = ata_do_reset(link, reset, classes, deadline); | ||
2206 | } | 2193 | } |
2207 | 2194 | ||
2208 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); | 2195 | /* -EAGAIN can happen if we skipped followup SRST */ |
2209 | rc = ata_do_reset(link, reset, classes, deadline); | 2196 | if (rc && rc != -EAGAIN) |
2197 | goto fail; | ||
2198 | } else { | ||
2199 | if (verbose) | ||
2200 | ata_link_printk(link, KERN_INFO, "no reset method " | ||
2201 | "available, skipping reset\n"); | ||
2202 | if (!(lflags & ATA_LFLAG_ASSUME_CLASS)) | ||
2203 | lflags |= ATA_LFLAG_ASSUME_ATA; | ||
2210 | } | 2204 | } |
2211 | 2205 | ||
2212 | /* -EAGAIN can happen if we skipped followup SRST */ | 2206 | /* |
2213 | if (rc && rc != -EAGAIN) | 2207 | * Post-reset processing |
2214 | goto fail; | 2208 | */ |
2215 | |||
2216 | done: | ||
2217 | ata_link_for_each_dev(dev, link) { | 2209 | ata_link_for_each_dev(dev, link) { |
2218 | /* After the reset, the device state is PIO 0 and the | 2210 | /* After the reset, the device state is PIO 0 and the |
2219 | * controller state is undefined. Reset also wakes up | 2211 | * controller state is undefined. Reset also wakes up |
@@ -2236,9 +2228,53 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2236 | if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) | 2228 | if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) |
2237 | link->sata_spd = (sstatus >> 4) & 0xf; | 2229 | link->sata_spd = (sstatus >> 4) & 0xf; |
2238 | 2230 | ||
2231 | /* thaw the port */ | ||
2232 | if (ata_is_host_link(link)) | ||
2233 | ata_eh_thaw_port(ap); | ||
2234 | |||
2235 | /* postreset() should clear hardware SError. Although SError | ||
2236 | * is cleared during link resume, clearing SError here is | ||
2237 | * necessary as some PHYs raise hotplug events after SRST. | ||
2238 | * This introduces race condition where hotplug occurs between | ||
2239 | * reset and here. This race is mediated by cross checking | ||
2240 | * link onlineness and classification result later. | ||
2241 | */ | ||
2239 | if (postreset) | 2242 | if (postreset) |
2240 | postreset(link, classes); | 2243 | postreset(link, classes); |
2241 | 2244 | ||
2245 | /* clear cached SError */ | ||
2246 | spin_lock_irqsave(link->ap->lock, flags); | ||
2247 | link->eh_info.serror = 0; | ||
2248 | spin_unlock_irqrestore(link->ap->lock, flags); | ||
2249 | |||
2250 | /* Make sure onlineness and classification result correspond. | ||
2251 | * Hotplug could have happened during reset and some | ||
2252 | * controllers fail to wait while a drive is spinning up after | ||
2253 | * being hotplugged causing misdetection. By cross checking | ||
2254 | * link onlineness and classification result, those conditions | ||
2255 | * can be reliably detected and retried. | ||
2256 | */ | ||
2257 | nr_known = 0; | ||
2258 | ata_link_for_each_dev(dev, link) { | ||
2259 | /* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */ | ||
2260 | if (classes[dev->devno] == ATA_DEV_UNKNOWN) | ||
2261 | classes[dev->devno] = ATA_DEV_NONE; | ||
2262 | else | ||
2263 | nr_known++; | ||
2264 | } | ||
2265 | |||
2266 | if (classify && !nr_known && ata_link_online(link)) { | ||
2267 | if (try < max_tries) { | ||
2268 | ata_link_printk(link, KERN_WARNING, "link online but " | ||
2269 | "device misclassified, retrying\n"); | ||
2270 | rc = -EAGAIN; | ||
2271 | goto fail; | ||
2272 | } | ||
2273 | ata_link_printk(link, KERN_WARNING, | ||
2274 | "link online but device misclassified, " | ||
2275 | "device detection might fail\n"); | ||
2276 | } | ||
2277 | |||
2242 | /* reset successful, schedule revalidation */ | 2278 | /* reset successful, schedule revalidation */ |
2243 | ata_eh_done(link, NULL, ATA_EH_RESET); | 2279 | ata_eh_done(link, NULL, ATA_EH_RESET); |
2244 | ehc->i.action |= ATA_EH_REVALIDATE; | 2280 | ehc->i.action |= ATA_EH_REVALIDATE; |
@@ -2587,7 +2623,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2587 | struct ata_link *link; | 2623 | struct ata_link *link; |
2588 | struct ata_device *dev; | 2624 | struct ata_device *dev; |
2589 | int nr_failed_devs, nr_disabled_devs; | 2625 | int nr_failed_devs, nr_disabled_devs; |
2590 | int reset, rc; | 2626 | int rc; |
2591 | unsigned long flags; | 2627 | unsigned long flags; |
2592 | 2628 | ||
2593 | DPRINTK("ENTER\n"); | 2629 | DPRINTK("ENTER\n"); |
@@ -2630,7 +2666,6 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2630 | rc = 0; | 2666 | rc = 0; |
2631 | nr_failed_devs = 0; | 2667 | nr_failed_devs = 0; |
2632 | nr_disabled_devs = 0; | 2668 | nr_disabled_devs = 0; |
2633 | reset = 0; | ||
2634 | 2669 | ||
2635 | /* if UNLOADING, finish immediately */ | 2670 | /* if UNLOADING, finish immediately */ |
2636 | if (ap->pflags & ATA_PFLAG_UNLOADING) | 2671 | if (ap->pflags & ATA_PFLAG_UNLOADING) |
@@ -2644,40 +2679,24 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
2644 | if (ata_eh_skip_recovery(link)) | 2679 | if (ata_eh_skip_recovery(link)) |
2645 | ehc->i.action = 0; | 2680 | ehc->i.action = 0; |
2646 | 2681 | ||
2647 | /* do we need to reset? */ | ||
2648 | if (ehc->i.action & ATA_EH_RESET) | ||
2649 | reset = 1; | ||
2650 | |||
2651 | ata_link_for_each_dev(dev, link) | 2682 | ata_link_for_each_dev(dev, link) |
2652 | ehc->classes[dev->devno] = ATA_DEV_UNKNOWN; | 2683 | ehc->classes[dev->devno] = ATA_DEV_UNKNOWN; |
2653 | } | 2684 | } |
2654 | 2685 | ||
2655 | /* reset */ | 2686 | /* reset */ |
2656 | if (reset) { | 2687 | ata_port_for_each_link(link, ap) { |
2657 | /* if PMP is attached, this function only deals with | 2688 | struct ata_eh_context *ehc = &link->eh_context; |
2658 | * downstream links, port should stay thawed. | ||
2659 | */ | ||
2660 | if (!sata_pmp_attached(ap)) | ||
2661 | ata_eh_freeze_port(ap); | ||
2662 | |||
2663 | ata_port_for_each_link(link, ap) { | ||
2664 | struct ata_eh_context *ehc = &link->eh_context; | ||
2665 | 2689 | ||
2666 | if (!(ehc->i.action & ATA_EH_RESET)) | 2690 | if (!(ehc->i.action & ATA_EH_RESET)) |
2667 | continue; | 2691 | continue; |
2668 | 2692 | ||
2669 | rc = ata_eh_reset(link, ata_link_nr_vacant(link), | 2693 | rc = ata_eh_reset(link, ata_link_nr_vacant(link), |
2670 | prereset, softreset, hardreset, | 2694 | prereset, softreset, hardreset, postreset); |
2671 | postreset); | 2695 | if (rc) { |
2672 | if (rc) { | 2696 | ata_link_printk(link, KERN_ERR, |
2673 | ata_link_printk(link, KERN_ERR, | 2697 | "reset failed, giving up\n"); |
2674 | "reset failed, giving up\n"); | 2698 | goto out; |
2675 | goto out; | ||
2676 | } | ||
2677 | } | 2699 | } |
2678 | |||
2679 | if (!sata_pmp_attached(ap)) | ||
2680 | ata_eh_thaw_port(ap); | ||
2681 | } | 2700 | } |
2682 | 2701 | ||
2683 | /* the rest */ | 2702 | /* the rest */ |
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c index ff1822a7da38..7daf4c0f6216 100644 --- a/drivers/ata/libata-pmp.c +++ b/drivers/ata/libata-pmp.c | |||
@@ -48,7 +48,7 @@ static unsigned int sata_pmp_read(struct ata_link *link, int reg, u32 *r_val) | |||
48 | tf.device = link->pmp; | 48 | tf.device = link->pmp; |
49 | 49 | ||
50 | err_mask = ata_exec_internal(pmp_dev, &tf, NULL, DMA_NONE, NULL, 0, | 50 | err_mask = ata_exec_internal(pmp_dev, &tf, NULL, DMA_NONE, NULL, 0, |
51 | SATA_PMP_SCR_TIMEOUT); | 51 | SATA_PMP_RW_TIMEOUT); |
52 | if (err_mask) | 52 | if (err_mask) |
53 | return err_mask; | 53 | return err_mask; |
54 | 54 | ||
@@ -88,7 +88,7 @@ static unsigned int sata_pmp_write(struct ata_link *link, int reg, u32 val) | |||
88 | tf.lbah = (val >> 24) & 0xff; | 88 | tf.lbah = (val >> 24) & 0xff; |
89 | 89 | ||
90 | return ata_exec_internal(pmp_dev, &tf, NULL, DMA_NONE, NULL, 0, | 90 | return ata_exec_internal(pmp_dev, &tf, NULL, DMA_NONE, NULL, 0, |
91 | SATA_PMP_SCR_TIMEOUT); | 91 | SATA_PMP_RW_TIMEOUT); |
92 | } | 92 | } |
93 | 93 | ||
94 | /** | 94 | /** |
@@ -257,19 +257,6 @@ static int sata_pmp_configure(struct ata_device *dev, int print_info) | |||
257 | goto fail; | 257 | goto fail; |
258 | } | 258 | } |
259 | 259 | ||
260 | /* turn off notification till fan-out ports are reset and configured */ | ||
261 | if (gscr[SATA_PMP_GSCR_FEAT_EN] & SATA_PMP_FEAT_NOTIFY) { | ||
262 | gscr[SATA_PMP_GSCR_FEAT_EN] &= ~SATA_PMP_FEAT_NOTIFY; | ||
263 | |||
264 | err_mask = sata_pmp_write(dev->link, SATA_PMP_GSCR_FEAT_EN, | ||
265 | gscr[SATA_PMP_GSCR_FEAT_EN]); | ||
266 | if (err_mask) { | ||
267 | rc = -EIO; | ||
268 | reason = "failed to write GSCR_FEAT_EN"; | ||
269 | goto fail; | ||
270 | } | ||
271 | } | ||
272 | |||
273 | if (print_info) { | 260 | if (print_info) { |
274 | ata_dev_printk(dev, KERN_INFO, "Port Multiplier %s, " | 261 | ata_dev_printk(dev, KERN_INFO, "Port Multiplier %s, " |
275 | "0x%04x:0x%04x r%d, %d ports, feat 0x%x/0x%x\n", | 262 | "0x%04x:0x%04x r%d, %d ports, feat 0x%x/0x%x\n", |
@@ -335,9 +322,12 @@ static void sata_pmp_quirks(struct ata_port *ap) | |||
335 | if (vendor == 0x1095 && devid == 0x3726) { | 322 | if (vendor == 0x1095 && devid == 0x3726) { |
336 | /* sil3726 quirks */ | 323 | /* sil3726 quirks */ |
337 | ata_port_for_each_link(link, ap) { | 324 | ata_port_for_each_link(link, ap) { |
338 | /* class code report is unreliable */ | 325 | /* Class code report is unreliable and SRST |
326 | * times out under certain configurations. | ||
327 | */ | ||
339 | if (link->pmp < 5) | 328 | if (link->pmp < 5) |
340 | link->flags |= ATA_LFLAG_ASSUME_ATA; | 329 | link->flags |= ATA_LFLAG_NO_SRST | |
330 | ATA_LFLAG_ASSUME_ATA; | ||
341 | 331 | ||
342 | /* port 5 is for SEMB device and it doesn't like SRST */ | 332 | /* port 5 is for SEMB device and it doesn't like SRST */ |
343 | if (link->pmp == 5) | 333 | if (link->pmp == 5) |
@@ -700,8 +690,6 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap, | |||
700 | if (ehc->i.action & ATA_EH_RESET) { | 690 | if (ehc->i.action & ATA_EH_RESET) { |
701 | struct ata_link *tlink; | 691 | struct ata_link *tlink; |
702 | 692 | ||
703 | ata_eh_freeze_port(ap); | ||
704 | |||
705 | /* reset */ | 693 | /* reset */ |
706 | rc = ata_eh_reset(link, 0, prereset, softreset, hardreset, | 694 | rc = ata_eh_reset(link, 0, prereset, softreset, hardreset, |
707 | postreset); | 695 | postreset); |
@@ -711,8 +699,6 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap, | |||
711 | goto fail; | 699 | goto fail; |
712 | } | 700 | } |
713 | 701 | ||
714 | ata_eh_thaw_port(ap); | ||
715 | |||
716 | /* PMP is reset, SErrors cannot be trusted, scan all */ | 702 | /* PMP is reset, SErrors cannot be trusted, scan all */ |
717 | ata_port_for_each_link(tlink, ap) { | 703 | ata_port_for_each_link(tlink, ap) { |
718 | struct ata_eh_context *ehc = &tlink->eh_context; | 704 | struct ata_eh_context *ehc = &tlink->eh_context; |
@@ -864,6 +850,7 @@ static int sata_pmp_eh_recover(struct ata_port *ap) | |||
864 | struct ata_link *pmp_link = &ap->link; | 850 | struct ata_link *pmp_link = &ap->link; |
865 | struct ata_device *pmp_dev = pmp_link->device; | 851 | struct ata_device *pmp_dev = pmp_link->device; |
866 | struct ata_eh_context *pmp_ehc = &pmp_link->eh_context; | 852 | struct ata_eh_context *pmp_ehc = &pmp_link->eh_context; |
853 | u32 *gscr = pmp_dev->gscr; | ||
867 | struct ata_link *link; | 854 | struct ata_link *link; |
868 | struct ata_device *dev; | 855 | struct ata_device *dev; |
869 | unsigned int err_mask; | 856 | unsigned int err_mask; |
@@ -901,6 +888,22 @@ static int sata_pmp_eh_recover(struct ata_port *ap) | |||
901 | if (rc) | 888 | if (rc) |
902 | goto pmp_fail; | 889 | goto pmp_fail; |
903 | 890 | ||
891 | /* PHY event notification can disturb reset and other recovery | ||
892 | * operations. Turn it off. | ||
893 | */ | ||
894 | if (gscr[SATA_PMP_GSCR_FEAT_EN] & SATA_PMP_FEAT_NOTIFY) { | ||
895 | gscr[SATA_PMP_GSCR_FEAT_EN] &= ~SATA_PMP_FEAT_NOTIFY; | ||
896 | |||
897 | err_mask = sata_pmp_write(pmp_link, SATA_PMP_GSCR_FEAT_EN, | ||
898 | gscr[SATA_PMP_GSCR_FEAT_EN]); | ||
899 | if (err_mask) { | ||
900 | ata_link_printk(pmp_link, KERN_WARNING, | ||
901 | "failed to disable NOTIFY (err_mask=0x%x)\n", | ||
902 | err_mask); | ||
903 | goto pmp_fail; | ||
904 | } | ||
905 | } | ||
906 | |||
904 | /* handle disabled links */ | 907 | /* handle disabled links */ |
905 | rc = sata_pmp_eh_handle_disabled_links(ap); | 908 | rc = sata_pmp_eh_handle_disabled_links(ap); |
906 | if (rc) | 909 | if (rc) |
@@ -923,10 +926,10 @@ static int sata_pmp_eh_recover(struct ata_port *ap) | |||
923 | 926 | ||
924 | /* enable notification */ | 927 | /* enable notification */ |
925 | if (pmp_dev->flags & ATA_DFLAG_AN) { | 928 | if (pmp_dev->flags & ATA_DFLAG_AN) { |
926 | pmp_dev->gscr[SATA_PMP_GSCR_FEAT_EN] |= SATA_PMP_FEAT_NOTIFY; | 929 | gscr[SATA_PMP_GSCR_FEAT_EN] |= SATA_PMP_FEAT_NOTIFY; |
927 | 930 | ||
928 | err_mask = sata_pmp_write(pmp_dev->link, SATA_PMP_GSCR_FEAT_EN, | 931 | err_mask = sata_pmp_write(pmp_link, SATA_PMP_GSCR_FEAT_EN, |
929 | pmp_dev->gscr[SATA_PMP_GSCR_FEAT_EN]); | 932 | gscr[SATA_PMP_GSCR_FEAT_EN]); |
930 | if (err_mask) { | 933 | if (err_mask) { |
931 | ata_dev_printk(pmp_dev, KERN_ERR, "failed to write " | 934 | ata_dev_printk(pmp_dev, KERN_ERR, "failed to write " |
932 | "PMP_FEAT_EN (Emask=0x%x)\n", err_mask); | 935 | "PMP_FEAT_EN (Emask=0x%x)\n", err_mask); |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 3ce43920e459..2e6e1622dc6d 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -1082,12 +1082,6 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc) | |||
1082 | if (((cdb[4] >> 4) & 0xf) != 0) | 1082 | if (((cdb[4] >> 4) & 0xf) != 0) |
1083 | goto invalid_fld; /* power conditions not supported */ | 1083 | goto invalid_fld; /* power conditions not supported */ |
1084 | 1084 | ||
1085 | if (qc->dev->horkage & ATA_HORKAGE_SKIP_PM) { | ||
1086 | /* the device lacks PM support, finish without doing anything */ | ||
1087 | scmd->result = SAM_STAT_GOOD; | ||
1088 | return 1; | ||
1089 | } | ||
1090 | |||
1091 | if (cdb[4] & 0x1) { | 1085 | if (cdb[4] & 0x1) { |
1092 | tf->nsect = 1; /* 1 sector, lba=0 */ | 1086 | tf->nsect = 1; /* 1 sector, lba=0 */ |
1093 | 1087 | ||
@@ -1643,6 +1637,7 @@ defer: | |||
1643 | 1637 | ||
1644 | /** | 1638 | /** |
1645 | * ata_scsi_rbuf_get - Map response buffer. | 1639 | * ata_scsi_rbuf_get - Map response buffer. |
1640 | * @cmd: SCSI command containing buffer to be mapped. | ||
1646 | * @flags: unsigned long variable to store irq enable status | 1641 | * @flags: unsigned long variable to store irq enable status |
1647 | * @copy_in: copy in from user buffer | 1642 | * @copy_in: copy in from user buffer |
1648 | * | 1643 | * |
@@ -1960,7 +1955,7 @@ static unsigned int ata_msense_ctl_mode(u8 *buf) | |||
1960 | 1955 | ||
1961 | /** | 1956 | /** |
1962 | * ata_msense_rw_recovery - Simulate MODE SENSE r/w error recovery page | 1957 | * ata_msense_rw_recovery - Simulate MODE SENSE r/w error recovery page |
1963 | * @bufp: output buffer | 1958 | * @buf: output buffer |
1964 | * | 1959 | * |
1965 | * Generate a generic MODE SENSE r/w error recovery page. | 1960 | * Generate a generic MODE SENSE r/w error recovery page. |
1966 | * | 1961 | * |
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c index fcabe46f262b..0f3e659db99a 100644 --- a/drivers/ata/pata_ali.c +++ b/drivers/ata/pata_ali.c | |||
@@ -177,11 +177,11 @@ static void ali_program_modes(struct ata_port *ap, struct ata_device *adev, stru | |||
177 | u8 udma; | 177 | u8 udma; |
178 | 178 | ||
179 | if (t != NULL) { | 179 | if (t != NULL) { |
180 | t->setup = FIT(t->setup, 1, 8) & 7; | 180 | t->setup = clamp_val(t->setup, 1, 8) & 7; |
181 | t->act8b = FIT(t->act8b, 1, 8) & 7; | 181 | t->act8b = clamp_val(t->act8b, 1, 8) & 7; |
182 | t->rec8b = FIT(t->rec8b, 1, 16) & 15; | 182 | t->rec8b = clamp_val(t->rec8b, 1, 16) & 15; |
183 | t->active = FIT(t->active, 1, 8) & 7; | 183 | t->active = clamp_val(t->active, 1, 8) & 7; |
184 | t->recover = FIT(t->recover, 1, 16) & 15; | 184 | t->recover = clamp_val(t->recover, 1, 16) & 15; |
185 | 185 | ||
186 | pci_write_config_byte(pdev, cas, t->setup); | 186 | pci_write_config_byte(pdev, cas, t->setup); |
187 | pci_write_config_byte(pdev, cbt, (t->act8b << 4) | t->rec8b); | 187 | pci_write_config_byte(pdev, cbt, (t->act8b << 4) | t->rec8b); |
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c index 26665c396485..57dd00f463d3 100644 --- a/drivers/ata/pata_amd.c +++ b/drivers/ata/pata_amd.c | |||
@@ -84,32 +84,32 @@ static void timing_setup(struct ata_port *ap, struct ata_device *adev, int offse | |||
84 | 84 | ||
85 | /* Configure the address set up timing */ | 85 | /* Configure the address set up timing */ |
86 | pci_read_config_byte(pdev, offset + 0x0C, &t); | 86 | pci_read_config_byte(pdev, offset + 0x0C, &t); |
87 | t = (t & ~(3 << ((3 - dn) << 1))) | ((FIT(at.setup, 1, 4) - 1) << ((3 - dn) << 1)); | 87 | t = (t & ~(3 << ((3 - dn) << 1))) | ((clamp_val(at.setup, 1, 4) - 1) << ((3 - dn) << 1)); |
88 | pci_write_config_byte(pdev, offset + 0x0C , t); | 88 | pci_write_config_byte(pdev, offset + 0x0C , t); |
89 | 89 | ||
90 | /* Configure the 8bit I/O timing */ | 90 | /* Configure the 8bit I/O timing */ |
91 | pci_write_config_byte(pdev, offset + 0x0E + (1 - (dn >> 1)), | 91 | pci_write_config_byte(pdev, offset + 0x0E + (1 - (dn >> 1)), |
92 | ((FIT(at.act8b, 1, 16) - 1) << 4) | (FIT(at.rec8b, 1, 16) - 1)); | 92 | ((clamp_val(at.act8b, 1, 16) - 1) << 4) | (clamp_val(at.rec8b, 1, 16) - 1)); |
93 | 93 | ||
94 | /* Drive timing */ | 94 | /* Drive timing */ |
95 | pci_write_config_byte(pdev, offset + 0x08 + (3 - dn), | 95 | pci_write_config_byte(pdev, offset + 0x08 + (3 - dn), |
96 | ((FIT(at.active, 1, 16) - 1) << 4) | (FIT(at.recover, 1, 16) - 1)); | 96 | ((clamp_val(at.active, 1, 16) - 1) << 4) | (clamp_val(at.recover, 1, 16) - 1)); |
97 | 97 | ||
98 | switch (clock) { | 98 | switch (clock) { |
99 | case 1: | 99 | case 1: |
100 | t = at.udma ? (0xc0 | (FIT(at.udma, 2, 5) - 2)) : 0x03; | 100 | t = at.udma ? (0xc0 | (clamp_val(at.udma, 2, 5) - 2)) : 0x03; |
101 | break; | 101 | break; |
102 | 102 | ||
103 | case 2: | 103 | case 2: |
104 | t = at.udma ? (0xc0 | amd_cyc2udma[FIT(at.udma, 2, 10)]) : 0x03; | 104 | t = at.udma ? (0xc0 | amd_cyc2udma[clamp_val(at.udma, 2, 10)]) : 0x03; |
105 | break; | 105 | break; |
106 | 106 | ||
107 | case 3: | 107 | case 3: |
108 | t = at.udma ? (0xc0 | amd_cyc2udma[FIT(at.udma, 1, 10)]) : 0x03; | 108 | t = at.udma ? (0xc0 | amd_cyc2udma[clamp_val(at.udma, 1, 10)]) : 0x03; |
109 | break; | 109 | break; |
110 | 110 | ||
111 | case 4: | 111 | case 4: |
112 | t = at.udma ? (0xc0 | amd_cyc2udma[FIT(at.udma, 1, 15)]) : 0x03; | 112 | t = at.udma ? (0xc0 | amd_cyc2udma[clamp_val(at.udma, 1, 15)]) : 0x03; |
113 | break; | 113 | break; |
114 | 114 | ||
115 | default: | 115 | default: |
diff --git a/drivers/ata/pata_at32.c b/drivers/ata/pata_at32.c index 5e104385d6a3..82fb6e273169 100644 --- a/drivers/ata/pata_at32.c +++ b/drivers/ata/pata_at32.c | |||
@@ -291,8 +291,6 @@ static int __init pata_at32_probe(struct platform_device *pdev) | |||
291 | if (!info) | 291 | if (!info) |
292 | return -ENOMEM; | 292 | return -ENOMEM; |
293 | 293 | ||
294 | memset(info, 0, sizeof(struct at32_ide_info)); | ||
295 | |||
296 | info->irq = irq; | 294 | info->irq = irq; |
297 | info->cs = board->cs; | 295 | info->cs = board->cs; |
298 | 296 | ||
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c index 9ab89732cf94..55516103626a 100644 --- a/drivers/ata/pata_bf54x.c +++ b/drivers/ata/pata_bf54x.c | |||
@@ -911,7 +911,10 @@ static void bfin_bmdma_start(struct ata_queued_cmd *qc) | |||
911 | /* Reset all transfer count */ | 911 | /* Reset all transfer count */ |
912 | ATAPI_SET_CONTROL(base, ATAPI_GET_CONTROL(base) | TFRCNT_RST); | 912 | ATAPI_SET_CONTROL(base, ATAPI_GET_CONTROL(base) | TFRCNT_RST); |
913 | 913 | ||
914 | /* Set transfer length to buffer len */ | 914 | /* Set ATAPI state machine contorl in terminate sequence */ |
915 | ATAPI_SET_CONTROL(base, ATAPI_GET_CONTROL(base) | END_ON_TERM); | ||
916 | |||
917 | /* Set transfer length to buffer len */ | ||
915 | for_each_sg(qc->sg, sg, qc->n_elem, si) { | 918 | for_each_sg(qc->sg, sg, qc->n_elem, si) { |
916 | ATAPI_SET_XFER_LEN(base, (sg_dma_len(sg) >> 1)); | 919 | ATAPI_SET_XFER_LEN(base, (sg_dma_len(sg) >> 1)); |
917 | } | 920 | } |
diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c index a9c3218e22fd..2ff62608ae37 100644 --- a/drivers/ata/pata_cypress.c +++ b/drivers/ata/pata_cypress.c | |||
@@ -62,14 +62,14 @@ static void cy82c693_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
62 | return; | 62 | return; |
63 | } | 63 | } |
64 | 64 | ||
65 | time_16 = FIT(t.recover, 0, 15) | (FIT(t.active, 0, 15) << 4); | 65 | time_16 = clamp_val(t.recover, 0, 15) | (clamp_val(t.active, 0, 15) << 4); |
66 | time_8 = FIT(t.act8b, 0, 15) | (FIT(t.rec8b, 0, 15) << 4); | 66 | time_8 = clamp_val(t.act8b, 0, 15) | (clamp_val(t.rec8b, 0, 15) << 4); |
67 | 67 | ||
68 | if (adev->devno == 0) { | 68 | if (adev->devno == 0) { |
69 | pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr); | 69 | pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr); |
70 | 70 | ||
71 | addr &= ~0x0F; /* Mask bits */ | 71 | addr &= ~0x0F; /* Mask bits */ |
72 | addr |= FIT(t.setup, 0, 15); | 72 | addr |= clamp_val(t.setup, 0, 15); |
73 | 73 | ||
74 | pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr); | 74 | pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr); |
75 | pci_write_config_byte(pdev, CY82_IDE_MASTER_IOR, time_16); | 75 | pci_write_config_byte(pdev, CY82_IDE_MASTER_IOR, time_16); |
@@ -79,7 +79,7 @@ static void cy82c693_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
79 | pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr); | 79 | pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr); |
80 | 80 | ||
81 | addr &= ~0xF0; /* Mask bits */ | 81 | addr &= ~0xF0; /* Mask bits */ |
82 | addr |= (FIT(t.setup, 0, 15) << 4); | 82 | addr |= (clamp_val(t.setup, 0, 15) << 4); |
83 | 83 | ||
84 | pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr); | 84 | pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr); |
85 | pci_write_config_byte(pdev, CY82_IDE_SLAVE_IOR, time_16); | 85 | pci_write_config_byte(pdev, CY82_IDE_SLAVE_IOR, time_16); |
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c index 7af4b29cc422..fe7cc8ed4ea4 100644 --- a/drivers/ata/pata_legacy.c +++ b/drivers/ata/pata_legacy.c | |||
@@ -343,8 +343,8 @@ static void ht6560a_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
343 | /* Get the timing data in cycles. For now play safe at 50Mhz */ | 343 | /* Get the timing data in cycles. For now play safe at 50Mhz */ |
344 | ata_timing_compute(adev, adev->pio_mode, &t, 20000, 1000); | 344 | ata_timing_compute(adev, adev->pio_mode, &t, 20000, 1000); |
345 | 345 | ||
346 | active = FIT(t.active, 2, 15); | 346 | active = clamp_val(t.active, 2, 15); |
347 | recover = FIT(t.recover, 4, 15); | 347 | recover = clamp_val(t.recover, 4, 15); |
348 | 348 | ||
349 | inb(0x3E6); | 349 | inb(0x3E6); |
350 | inb(0x3E6); | 350 | inb(0x3E6); |
@@ -377,8 +377,8 @@ static void ht6560b_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
377 | /* Get the timing data in cycles. For now play safe at 50Mhz */ | 377 | /* Get the timing data in cycles. For now play safe at 50Mhz */ |
378 | ata_timing_compute(adev, adev->pio_mode, &t, 20000, 1000); | 378 | ata_timing_compute(adev, adev->pio_mode, &t, 20000, 1000); |
379 | 379 | ||
380 | active = FIT(t.active, 2, 15); | 380 | active = clamp_val(t.active, 2, 15); |
381 | recover = FIT(t.recover, 2, 16); | 381 | recover = clamp_val(t.recover, 2, 16); |
382 | recover &= 0x15; | 382 | recover &= 0x15; |
383 | 383 | ||
384 | inb(0x3E6); | 384 | inb(0x3E6); |
@@ -462,9 +462,9 @@ static void opti82c611a_set_piomode(struct ata_port *ap, | |||
462 | ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP); | 462 | ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP); |
463 | } | 463 | } |
464 | 464 | ||
465 | active = FIT(t.active, 2, 17) - 2; | 465 | active = clamp_val(t.active, 2, 17) - 2; |
466 | recover = FIT(t.recover, 1, 16) - 1; | 466 | recover = clamp_val(t.recover, 1, 16) - 1; |
467 | setup = FIT(t.setup, 1, 4) - 1; | 467 | setup = clamp_val(t.setup, 1, 4) - 1; |
468 | 468 | ||
469 | /* Select the right timing bank for write timing */ | 469 | /* Select the right timing bank for write timing */ |
470 | rc = ioread8(ap->ioaddr.lbal_addr); | 470 | rc = ioread8(ap->ioaddr.lbal_addr); |
@@ -541,9 +541,9 @@ static void opti82c46x_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
541 | ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP); | 541 | ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP); |
542 | } | 542 | } |
543 | 543 | ||
544 | active = FIT(t.active, 2, 17) - 2; | 544 | active = clamp_val(t.active, 2, 17) - 2; |
545 | recover = FIT(t.recover, 1, 16) - 1; | 545 | recover = clamp_val(t.recover, 1, 16) - 1; |
546 | setup = FIT(t.setup, 1, 4) - 1; | 546 | setup = clamp_val(t.setup, 1, 4) - 1; |
547 | 547 | ||
548 | /* Select the right timing bank for write timing */ | 548 | /* Select the right timing bank for write timing */ |
549 | rc = ioread8(ap->ioaddr.lbal_addr); | 549 | rc = ioread8(ap->ioaddr.lbal_addr); |
@@ -624,11 +624,11 @@ static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
624 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); | 624 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); |
625 | 625 | ||
626 | if (ld_qdi->fast) { | 626 | if (ld_qdi->fast) { |
627 | active = 8 - FIT(t.active, 1, 8); | 627 | active = 8 - clamp_val(t.active, 1, 8); |
628 | recovery = 18 - FIT(t.recover, 3, 18); | 628 | recovery = 18 - clamp_val(t.recover, 3, 18); |
629 | } else { | 629 | } else { |
630 | active = 9 - FIT(t.active, 2, 9); | 630 | active = 9 - clamp_val(t.active, 2, 9); |
631 | recovery = 15 - FIT(t.recover, 0, 15); | 631 | recovery = 15 - clamp_val(t.recover, 0, 15); |
632 | } | 632 | } |
633 | timing = (recovery << 4) | active | 0x08; | 633 | timing = (recovery << 4) | active | 0x08; |
634 | 634 | ||
@@ -658,11 +658,11 @@ static void qdi6580dp_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
658 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); | 658 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); |
659 | 659 | ||
660 | if (ld_qdi->fast) { | 660 | if (ld_qdi->fast) { |
661 | active = 8 - FIT(t.active, 1, 8); | 661 | active = 8 - clamp_val(t.active, 1, 8); |
662 | recovery = 18 - FIT(t.recover, 3, 18); | 662 | recovery = 18 - clamp_val(t.recover, 3, 18); |
663 | } else { | 663 | } else { |
664 | active = 9 - FIT(t.active, 2, 9); | 664 | active = 9 - clamp_val(t.active, 2, 9); |
665 | recovery = 15 - FIT(t.recover, 0, 15); | 665 | recovery = 15 - clamp_val(t.recover, 0, 15); |
666 | } | 666 | } |
667 | timing = (recovery << 4) | active | 0x08; | 667 | timing = (recovery << 4) | active | 0x08; |
668 | 668 | ||
@@ -695,11 +695,11 @@ static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
695 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); | 695 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); |
696 | 696 | ||
697 | if (ld_qdi->fast) { | 697 | if (ld_qdi->fast) { |
698 | active = 8 - FIT(t.active, 1, 8); | 698 | active = 8 - clamp_val(t.active, 1, 8); |
699 | recovery = 18 - FIT(t.recover, 3, 18); | 699 | recovery = 18 - clamp_val(t.recover, 3, 18); |
700 | } else { | 700 | } else { |
701 | active = 9 - FIT(t.active, 2, 9); | 701 | active = 9 - clamp_val(t.active, 2, 9); |
702 | recovery = 15 - FIT(t.recover, 0, 15); | 702 | recovery = 15 - clamp_val(t.recover, 0, 15); |
703 | } | 703 | } |
704 | timing = (recovery << 4) | active | 0x08; | 704 | timing = (recovery << 4) | active | 0x08; |
705 | ld_qdi->clock[adev->devno] = timing; | 705 | ld_qdi->clock[adev->devno] = timing; |
@@ -830,8 +830,8 @@ static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
830 | else | 830 | else |
831 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); | 831 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); |
832 | 832 | ||
833 | active = (FIT(t.active, 3, 17) - 1) & 0x0F; | 833 | active = (clamp_val(t.active, 3, 17) - 1) & 0x0F; |
834 | recovery = (FIT(t.recover, 1, 15) + 1) & 0x0F; | 834 | recovery = (clamp_val(t.recover, 1, 15) + 1) & 0x0F; |
835 | timing = (active << 4) | recovery; | 835 | timing = (active << 4) | recovery; |
836 | winbond_writecfg(ld_winbond->timing, timing, reg); | 836 | winbond_writecfg(ld_winbond->timing, timing, reg); |
837 | 837 | ||
@@ -842,7 +842,7 @@ static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
842 | reg |= 0x08; /* FIFO off */ | 842 | reg |= 0x08; /* FIFO off */ |
843 | if (!ata_pio_need_iordy(adev)) | 843 | if (!ata_pio_need_iordy(adev)) |
844 | reg |= 0x02; /* IORDY off */ | 844 | reg |= 0x02; /* IORDY off */ |
845 | reg |= (FIT(t.setup, 0, 3) << 6); | 845 | reg |= (clamp_val(t.setup, 0, 3) << 6); |
846 | winbond_writecfg(ld_winbond->timing, timing + 1, reg); | 846 | winbond_writecfg(ld_winbond->timing, timing + 1, reg); |
847 | } | 847 | } |
848 | 848 | ||
diff --git a/drivers/ata/pata_ns87410.c b/drivers/ata/pata_ns87410.c index 76d2455bc453..be756b7ef07e 100644 --- a/drivers/ata/pata_ns87410.c +++ b/drivers/ata/pata_ns87410.c | |||
@@ -91,9 +91,9 @@ static void ns87410_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
91 | return; | 91 | return; |
92 | } | 92 | } |
93 | 93 | ||
94 | at.active = FIT(at.active, 2, 16) - 2; | 94 | at.active = clamp_val(at.active, 2, 16) - 2; |
95 | at.setup = FIT(at.setup, 1, 4) - 1; | 95 | at.setup = clamp_val(at.setup, 1, 4) - 1; |
96 | at.recover = FIT(at.recover, 1, 12) - 1; | 96 | at.recover = clamp_val(at.recover, 1, 12) - 1; |
97 | 97 | ||
98 | idetcr = (at.setup << 6) | (recoverbits[at.recover] << 3) | activebits[at.active]; | 98 | idetcr = (at.setup << 6) | (recoverbits[at.recover] << 3) | activebits[at.active]; |
99 | 99 | ||
diff --git a/drivers/ata/pata_ns87415.c b/drivers/ata/pata_ns87415.c index ae92b0049bd5..e0aa7eaaee0a 100644 --- a/drivers/ata/pata_ns87415.c +++ b/drivers/ata/pata_ns87415.c | |||
@@ -66,8 +66,8 @@ static void ns87415_set_mode(struct ata_port *ap, struct ata_device *adev, u8 mo | |||
66 | 66 | ||
67 | ata_timing_compute(adev, adev->pio_mode, &t, T, 0); | 67 | ata_timing_compute(adev, adev->pio_mode, &t, T, 0); |
68 | 68 | ||
69 | clocking = 17 - FIT(t.active, 2, 17); | 69 | clocking = 17 - clamp_val(t.active, 2, 17); |
70 | clocking |= (16 - FIT(t.recover, 1, 16)) << 4; | 70 | clocking |= (16 - clamp_val(t.recover, 1, 16)) << 4; |
71 | /* Use the same timing for read and write bytes */ | 71 | /* Use the same timing for read and write bytes */ |
72 | clocking |= (clocking << 8); | 72 | clocking |= (clocking << 8); |
73 | pci_write_config_word(dev, timing, clocking); | 73 | pci_write_config_word(dev, timing, clocking); |
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c index bf45cf017753..97e5b090d7c2 100644 --- a/drivers/ata/pata_qdi.c +++ b/drivers/ata/pata_qdi.c | |||
@@ -60,11 +60,11 @@ static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
60 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); | 60 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); |
61 | 61 | ||
62 | if (qdi->fast) { | 62 | if (qdi->fast) { |
63 | active = 8 - FIT(t.active, 1, 8); | 63 | active = 8 - clamp_val(t.active, 1, 8); |
64 | recovery = 18 - FIT(t.recover, 3, 18); | 64 | recovery = 18 - clamp_val(t.recover, 3, 18); |
65 | } else { | 65 | } else { |
66 | active = 9 - FIT(t.active, 2, 9); | 66 | active = 9 - clamp_val(t.active, 2, 9); |
67 | recovery = 15 - FIT(t.recover, 0, 15); | 67 | recovery = 15 - clamp_val(t.recover, 0, 15); |
68 | } | 68 | } |
69 | timing = (recovery << 4) | active | 0x08; | 69 | timing = (recovery << 4) | active | 0x08; |
70 | 70 | ||
@@ -84,11 +84,11 @@ static void qdi6580_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
84 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); | 84 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); |
85 | 85 | ||
86 | if (qdi->fast) { | 86 | if (qdi->fast) { |
87 | active = 8 - FIT(t.active, 1, 8); | 87 | active = 8 - clamp_val(t.active, 1, 8); |
88 | recovery = 18 - FIT(t.recover, 3, 18); | 88 | recovery = 18 - clamp_val(t.recover, 3, 18); |
89 | } else { | 89 | } else { |
90 | active = 9 - FIT(t.active, 2, 9); | 90 | active = 9 - clamp_val(t.active, 2, 9); |
91 | recovery = 15 - FIT(t.recover, 0, 15); | 91 | recovery = 15 - clamp_val(t.recover, 0, 15); |
92 | } | 92 | } |
93 | timing = (recovery << 4) | active | 0x08; | 93 | timing = (recovery << 4) | active | 0x08; |
94 | 94 | ||
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c index 70d94fb28a5f..69877bd81815 100644 --- a/drivers/ata/pata_sl82c105.c +++ b/drivers/ata/pata_sl82c105.c | |||
@@ -216,7 +216,7 @@ static int sl82c105_qc_defer(struct ata_queued_cmd *qc) | |||
216 | struct ata_port *alt = host->ports[1 ^ qc->ap->port_no]; | 216 | struct ata_port *alt = host->ports[1 ^ qc->ap->port_no]; |
217 | int rc; | 217 | int rc; |
218 | 218 | ||
219 | /* First apply the usual rules */ | 219 | /* First apply the usual rules */ |
220 | rc = ata_std_qc_defer(qc); | 220 | rc = ata_std_qc_defer(qc); |
221 | if (rc != 0) | 221 | if (rc != 0) |
222 | return rc; | 222 | return rc; |
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 2fea6cbe7755..708ed144ede9 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
@@ -259,15 +259,15 @@ static void via_do_set_mode(struct ata_port *ap, struct ata_device *adev, int mo | |||
259 | 259 | ||
260 | pci_read_config_byte(pdev, 0x4C, &setup); | 260 | pci_read_config_byte(pdev, 0x4C, &setup); |
261 | setup &= ~(3 << shift); | 261 | setup &= ~(3 << shift); |
262 | setup |= FIT(t.setup, 1, 4) << shift; /* 1,4 or 1,4 - 1 FIXME */ | 262 | setup |= clamp_val(t.setup, 1, 4) << shift; /* 1,4 or 1,4 - 1 FIXME */ |
263 | pci_write_config_byte(pdev, 0x4C, setup); | 263 | pci_write_config_byte(pdev, 0x4C, setup); |
264 | } | 264 | } |
265 | 265 | ||
266 | /* Load the PIO mode bits */ | 266 | /* Load the PIO mode bits */ |
267 | pci_write_config_byte(pdev, 0x4F - ap->port_no, | 267 | pci_write_config_byte(pdev, 0x4F - ap->port_no, |
268 | ((FIT(t.act8b, 1, 16) - 1) << 4) | (FIT(t.rec8b, 1, 16) - 1)); | 268 | ((clamp_val(t.act8b, 1, 16) - 1) << 4) | (clamp_val(t.rec8b, 1, 16) - 1)); |
269 | pci_write_config_byte(pdev, 0x48 + offset, | 269 | pci_write_config_byte(pdev, 0x48 + offset, |
270 | ((FIT(t.active, 1, 16) - 1) << 4) | (FIT(t.recover, 1, 16) - 1)); | 270 | ((clamp_val(t.active, 1, 16) - 1) << 4) | (clamp_val(t.recover, 1, 16) - 1)); |
271 | 271 | ||
272 | /* Load the UDMA bits according to type */ | 272 | /* Load the UDMA bits according to type */ |
273 | switch(udma_type) { | 273 | switch(udma_type) { |
@@ -275,16 +275,16 @@ static void via_do_set_mode(struct ata_port *ap, struct ata_device *adev, int mo | |||
275 | /* BUG() ? */ | 275 | /* BUG() ? */ |
276 | /* fall through */ | 276 | /* fall through */ |
277 | case 33: | 277 | case 33: |
278 | ut = t.udma ? (0xe0 | (FIT(t.udma, 2, 5) - 2)) : 0x03; | 278 | ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 5) - 2)) : 0x03; |
279 | break; | 279 | break; |
280 | case 66: | 280 | case 66: |
281 | ut = t.udma ? (0xe8 | (FIT(t.udma, 2, 9) - 2)) : 0x0f; | 281 | ut = t.udma ? (0xe8 | (clamp_val(t.udma, 2, 9) - 2)) : 0x0f; |
282 | break; | 282 | break; |
283 | case 100: | 283 | case 100: |
284 | ut = t.udma ? (0xe0 | (FIT(t.udma, 2, 9) - 2)) : 0x07; | 284 | ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 9) - 2)) : 0x07; |
285 | break; | 285 | break; |
286 | case 133: | 286 | case 133: |
287 | ut = t.udma ? (0xe0 | (FIT(t.udma, 2, 9) - 2)) : 0x07; | 287 | ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 9) - 2)) : 0x07; |
288 | break; | 288 | break; |
289 | } | 289 | } |
290 | 290 | ||
diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c index 6e52a3573fbf..474528f8fe3d 100644 --- a/drivers/ata/pata_winbond.c +++ b/drivers/ata/pata_winbond.c | |||
@@ -75,8 +75,8 @@ static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
75 | else | 75 | else |
76 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); | 76 | ata_timing_compute(adev, adev->pio_mode, &t, 30303, 1000); |
77 | 77 | ||
78 | active = (FIT(t.active, 3, 17) - 1) & 0x0F; | 78 | active = (clamp_val(t.active, 3, 17) - 1) & 0x0F; |
79 | recovery = (FIT(t.recover, 1, 15) + 1) & 0x0F; | 79 | recovery = (clamp_val(t.recover, 1, 15) + 1) & 0x0F; |
80 | timing = (active << 4) | recovery; | 80 | timing = (active << 4) | recovery; |
81 | winbond_writecfg(winbond->config, timing, reg); | 81 | winbond_writecfg(winbond->config, timing, reg); |
82 | 82 | ||
@@ -87,7 +87,7 @@ static void winbond_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
87 | reg |= 0x08; /* FIFO off */ | 87 | reg |= 0x08; /* FIFO off */ |
88 | if (!ata_pio_need_iordy(adev)) | 88 | if (!ata_pio_need_iordy(adev)) |
89 | reg |= 0x02; /* IORDY off */ | 89 | reg |= 0x02; /* IORDY off */ |
90 | reg |= (FIT(t.setup, 0, 3) << 6); | 90 | reg |= (clamp_val(t.setup, 0, 3) << 6); |
91 | winbond_writecfg(winbond->config, timing + 1, reg); | 91 | winbond_writecfg(winbond->config, timing + 1, reg); |
92 | } | 92 | } |
93 | 93 | ||
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index 853559e32315..3924e7209a44 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c | |||
@@ -34,7 +34,7 @@ enum { | |||
34 | 34 | ||
35 | SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 35 | SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
36 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | | 36 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | |
37 | ATA_FLAG_NCQ), | 37 | ATA_FLAG_PMP | ATA_FLAG_NCQ), |
38 | 38 | ||
39 | SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH, | 39 | SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH, |
40 | SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */ | 40 | SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */ |
@@ -395,7 +395,7 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc) | |||
395 | cd = (struct command_desc *)pp->cmdentry + tag; | 395 | cd = (struct command_desc *)pp->cmdentry + tag; |
396 | cd_paddr = pp->cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE; | 396 | cd_paddr = pp->cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE; |
397 | 397 | ||
398 | ata_tf_to_fis(&qc->tf, 0, 1, (u8 *) &cd->cfis); | 398 | ata_tf_to_fis(&qc->tf, qc->dev->link->pmp, 1, (u8 *) &cd->cfis); |
399 | 399 | ||
400 | VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n", | 400 | VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n", |
401 | cd->cfis[0], cd->cfis[1], cd->cfis[2]); | 401 | cd->cfis[0], cd->cfis[1], cd->cfis[2]); |
@@ -438,6 +438,8 @@ static unsigned int sata_fsl_qc_issue(struct ata_queued_cmd *qc) | |||
438 | ioread32(CA + hcr_base), | 438 | ioread32(CA + hcr_base), |
439 | ioread32(CE + hcr_base), ioread32(CC + hcr_base)); | 439 | ioread32(CE + hcr_base), ioread32(CC + hcr_base)); |
440 | 440 | ||
441 | iowrite32(qc->dev->link->pmp, CQPMP + hcr_base); | ||
442 | |||
441 | /* Simply queue command to the controller/device */ | 443 | /* Simply queue command to the controller/device */ |
442 | iowrite32(1 << tag, CQ + hcr_base); | 444 | iowrite32(1 << tag, CQ + hcr_base); |
443 | 445 | ||
@@ -558,11 +560,36 @@ static void sata_fsl_thaw(struct ata_port *ap) | |||
558 | ioread32(hcr_base + HCONTROL), ioread32(hcr_base + HSTATUS)); | 560 | ioread32(hcr_base + HCONTROL), ioread32(hcr_base + HSTATUS)); |
559 | } | 561 | } |
560 | 562 | ||
563 | static void sata_fsl_pmp_attach(struct ata_port *ap) | ||
564 | { | ||
565 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | ||
566 | void __iomem *hcr_base = host_priv->hcr_base; | ||
567 | u32 temp; | ||
568 | |||
569 | temp = ioread32(hcr_base + HCONTROL); | ||
570 | iowrite32((temp | HCONTROL_PMP_ATTACHED), hcr_base + HCONTROL); | ||
571 | } | ||
572 | |||
573 | static void sata_fsl_pmp_detach(struct ata_port *ap) | ||
574 | { | ||
575 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | ||
576 | void __iomem *hcr_base = host_priv->hcr_base; | ||
577 | u32 temp; | ||
578 | |||
579 | temp = ioread32(hcr_base + HCONTROL); | ||
580 | temp &= ~HCONTROL_PMP_ATTACHED; | ||
581 | iowrite32(temp, hcr_base + HCONTROL); | ||
582 | |||
583 | /* enable interrupts on the controller/port */ | ||
584 | temp = ioread32(hcr_base + HCONTROL); | ||
585 | iowrite32((temp | DEFAULT_PORT_IRQ_ENABLE_MASK), hcr_base + HCONTROL); | ||
586 | |||
587 | } | ||
588 | |||
561 | static int sata_fsl_port_start(struct ata_port *ap) | 589 | static int sata_fsl_port_start(struct ata_port *ap) |
562 | { | 590 | { |
563 | struct device *dev = ap->host->dev; | 591 | struct device *dev = ap->host->dev; |
564 | struct sata_fsl_port_priv *pp; | 592 | struct sata_fsl_port_priv *pp; |
565 | int retval; | ||
566 | void *mem; | 593 | void *mem; |
567 | dma_addr_t mem_dma; | 594 | dma_addr_t mem_dma; |
568 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | 595 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; |
@@ -688,12 +715,13 @@ static int sata_fsl_prereset(struct ata_link *link, unsigned long deadline) | |||
688 | } | 715 | } |
689 | 716 | ||
690 | static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, | 717 | static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, |
691 | unsigned long deadline) | 718 | unsigned long deadline) |
692 | { | 719 | { |
693 | struct ata_port *ap = link->ap; | 720 | struct ata_port *ap = link->ap; |
694 | struct sata_fsl_port_priv *pp = ap->private_data; | 721 | struct sata_fsl_port_priv *pp = ap->private_data; |
695 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | 722 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; |
696 | void __iomem *hcr_base = host_priv->hcr_base; | 723 | void __iomem *hcr_base = host_priv->hcr_base; |
724 | int pmp = sata_srst_pmp(link); | ||
697 | u32 temp; | 725 | u32 temp; |
698 | struct ata_taskfile tf; | 726 | struct ata_taskfile tf; |
699 | u8 *cfis; | 727 | u8 *cfis; |
@@ -703,6 +731,9 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class, | |||
703 | 731 | ||
704 | DPRINTK("in xx_softreset\n"); | 732 | DPRINTK("in xx_softreset\n"); |
705 | 733 | ||
734 | if (pmp != SATA_PMP_CTRL_PORT) | ||
735 | goto issue_srst; | ||
736 | |||
706 | try_offline_again: | 737 | try_offline_again: |
707 | /* | 738 | /* |
708 | * Force host controller to go off-line, aborting current operations | 739 | * Force host controller to go off-line, aborting current operations |
@@ -746,6 +777,7 @@ try_offline_again: | |||
746 | 777 | ||
747 | temp = ioread32(hcr_base + HCONTROL); | 778 | temp = ioread32(hcr_base + HCONTROL); |
748 | temp |= (HCONTROL_ONLINE_PHY_RST | HCONTROL_SNOOP_ENABLE); | 779 | temp |= (HCONTROL_ONLINE_PHY_RST | HCONTROL_SNOOP_ENABLE); |
780 | temp |= HCONTROL_PMP_ATTACHED; | ||
749 | iowrite32(temp, hcr_base + HCONTROL); | 781 | iowrite32(temp, hcr_base + HCONTROL); |
750 | 782 | ||
751 | temp = ata_wait_register(hcr_base + HSTATUS, ONLINE, 0, 1, 500); | 783 | temp = ata_wait_register(hcr_base + HSTATUS, ONLINE, 0, 1, 500); |
@@ -771,7 +803,8 @@ try_offline_again: | |||
771 | ata_port_printk(ap, KERN_WARNING, | 803 | ata_port_printk(ap, KERN_WARNING, |
772 | "No Device OR PHYRDY change,Hstatus = 0x%x\n", | 804 | "No Device OR PHYRDY change,Hstatus = 0x%x\n", |
773 | ioread32(hcr_base + HSTATUS)); | 805 | ioread32(hcr_base + HSTATUS)); |
774 | goto err; | 806 | *class = ATA_DEV_NONE; |
807 | goto out; | ||
775 | } | 808 | } |
776 | 809 | ||
777 | /* | 810 | /* |
@@ -783,7 +816,8 @@ try_offline_again: | |||
783 | 816 | ||
784 | if ((temp & 0xFF) != 0x18) { | 817 | if ((temp & 0xFF) != 0x18) { |
785 | ata_port_printk(ap, KERN_WARNING, "No Signature Update\n"); | 818 | ata_port_printk(ap, KERN_WARNING, "No Signature Update\n"); |
786 | goto err; | 819 | *class = ATA_DEV_NONE; |
820 | goto out; | ||
787 | } else { | 821 | } else { |
788 | ata_port_printk(ap, KERN_INFO, | 822 | ata_port_printk(ap, KERN_INFO, |
789 | "Signature Update detected @ %d msecs\n", | 823 | "Signature Update detected @ %d msecs\n", |
@@ -798,6 +832,7 @@ try_offline_again: | |||
798 | * reached here, we can send a command to the target device | 832 | * reached here, we can send a command to the target device |
799 | */ | 833 | */ |
800 | 834 | ||
835 | issue_srst: | ||
801 | DPRINTK("Sending SRST/device reset\n"); | 836 | DPRINTK("Sending SRST/device reset\n"); |
802 | 837 | ||
803 | ata_tf_init(link->device, &tf); | 838 | ata_tf_init(link->device, &tf); |
@@ -808,7 +843,7 @@ try_offline_again: | |||
808 | SRST_CMD | CMD_DESC_SNOOP_ENABLE, 0, 0, 5); | 843 | SRST_CMD | CMD_DESC_SNOOP_ENABLE, 0, 0, 5); |
809 | 844 | ||
810 | tf.ctl |= ATA_SRST; /* setup SRST bit in taskfile control reg */ | 845 | tf.ctl |= ATA_SRST; /* setup SRST bit in taskfile control reg */ |
811 | ata_tf_to_fis(&tf, 0, 0, cfis); | 846 | ata_tf_to_fis(&tf, pmp, 0, cfis); |
812 | 847 | ||
813 | DPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x, 0x%x\n", | 848 | DPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x, 0x%x\n", |
814 | cfis[0], cfis[1], cfis[2], cfis[3]); | 849 | cfis[0], cfis[1], cfis[2], cfis[3]); |
@@ -854,8 +889,10 @@ try_offline_again: | |||
854 | sata_fsl_setup_cmd_hdr_entry(pp, 0, CMD_DESC_SNOOP_ENABLE, 0, 0, 5); | 889 | sata_fsl_setup_cmd_hdr_entry(pp, 0, CMD_DESC_SNOOP_ENABLE, 0, 0, 5); |
855 | 890 | ||
856 | tf.ctl &= ~ATA_SRST; /* 2nd H2D Ctl. register FIS */ | 891 | tf.ctl &= ~ATA_SRST; /* 2nd H2D Ctl. register FIS */ |
857 | ata_tf_to_fis(&tf, 0, 0, cfis); | 892 | ata_tf_to_fis(&tf, pmp, 0, cfis); |
858 | 893 | ||
894 | if (pmp != SATA_PMP_CTRL_PORT) | ||
895 | iowrite32(pmp, CQPMP + hcr_base); | ||
859 | iowrite32(1, CQ + hcr_base); | 896 | iowrite32(1, CQ + hcr_base); |
860 | msleep(150); /* ?? */ | 897 | msleep(150); /* ?? */ |
861 | 898 | ||
@@ -886,12 +923,21 @@ try_offline_again: | |||
886 | VPRINTK("cereg = 0x%x\n", ioread32(hcr_base + CE)); | 923 | VPRINTK("cereg = 0x%x\n", ioread32(hcr_base + CE)); |
887 | } | 924 | } |
888 | 925 | ||
926 | out: | ||
889 | return 0; | 927 | return 0; |
890 | 928 | ||
891 | err: | 929 | err: |
892 | return -EIO; | 930 | return -EIO; |
893 | } | 931 | } |
894 | 932 | ||
933 | static void sata_fsl_error_handler(struct ata_port *ap) | ||
934 | { | ||
935 | |||
936 | DPRINTK("in xx_error_handler\n"); | ||
937 | sata_pmp_error_handler(ap); | ||
938 | |||
939 | } | ||
940 | |||
895 | static void sata_fsl_post_internal_cmd(struct ata_queued_cmd *qc) | 941 | static void sata_fsl_post_internal_cmd(struct ata_queued_cmd *qc) |
896 | { | 942 | { |
897 | if (qc->flags & ATA_QCFLAG_FAILED) | 943 | if (qc->flags & ATA_QCFLAG_FAILED) |
@@ -905,18 +951,21 @@ static void sata_fsl_post_internal_cmd(struct ata_queued_cmd *qc) | |||
905 | 951 | ||
906 | static void sata_fsl_error_intr(struct ata_port *ap) | 952 | static void sata_fsl_error_intr(struct ata_port *ap) |
907 | { | 953 | { |
908 | struct ata_link *link = &ap->link; | ||
909 | struct ata_eh_info *ehi = &link->eh_info; | ||
910 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | 954 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; |
911 | void __iomem *hcr_base = host_priv->hcr_base; | 955 | void __iomem *hcr_base = host_priv->hcr_base; |
912 | u32 hstatus, dereg, cereg = 0, SError = 0; | 956 | u32 hstatus, dereg=0, cereg = 0, SError = 0; |
913 | unsigned int err_mask = 0, action = 0; | 957 | unsigned int err_mask = 0, action = 0; |
914 | struct ata_queued_cmd *qc; | 958 | int freeze = 0, abort=0; |
915 | int freeze = 0; | 959 | struct ata_link *link = NULL; |
960 | struct ata_queued_cmd *qc = NULL; | ||
961 | struct ata_eh_info *ehi; | ||
916 | 962 | ||
917 | hstatus = ioread32(hcr_base + HSTATUS); | 963 | hstatus = ioread32(hcr_base + HSTATUS); |
918 | cereg = ioread32(hcr_base + CE); | 964 | cereg = ioread32(hcr_base + CE); |
919 | 965 | ||
966 | /* first, analyze and record host port events */ | ||
967 | link = &ap->link; | ||
968 | ehi = &link->eh_info; | ||
920 | ata_ehi_clear_desc(ehi); | 969 | ata_ehi_clear_desc(ehi); |
921 | 970 | ||
922 | /* | 971 | /* |
@@ -926,42 +975,28 @@ static void sata_fsl_error_intr(struct ata_port *ap) | |||
926 | sata_fsl_scr_read(ap, SCR_ERROR, &SError); | 975 | sata_fsl_scr_read(ap, SCR_ERROR, &SError); |
927 | if (unlikely(SError & 0xFFFF0000)) { | 976 | if (unlikely(SError & 0xFFFF0000)) { |
928 | sata_fsl_scr_write(ap, SCR_ERROR, SError); | 977 | sata_fsl_scr_write(ap, SCR_ERROR, SError); |
929 | err_mask |= AC_ERR_ATA_BUS; | ||
930 | } | 978 | } |
931 | 979 | ||
932 | DPRINTK("error_intr,hStat=0x%x,CE=0x%x,DE =0x%x,SErr=0x%x\n", | 980 | DPRINTK("error_intr,hStat=0x%x,CE=0x%x,DE =0x%x,SErr=0x%x\n", |
933 | hstatus, cereg, ioread32(hcr_base + DE), SError); | 981 | hstatus, cereg, ioread32(hcr_base + DE), SError); |
934 | 982 | ||
935 | /* handle single device errors */ | 983 | /* handle fatal errors */ |
936 | if (cereg) { | 984 | if (hstatus & FATAL_ERROR_DECODE) { |
937 | /* | 985 | ehi->err_mask |= AC_ERR_ATA_BUS; |
938 | * clear the command error, also clears queue to the device | 986 | ehi->action |= ATA_EH_SOFTRESET; |
939 | * in error, and we can (re)issue commands to this device. | ||
940 | * When a device is in error all commands queued into the | ||
941 | * host controller and at the device are considered aborted | ||
942 | * and the queue for that device is stopped. Now, after | ||
943 | * clearing the device error, we can issue commands to the | ||
944 | * device to interrogate it to find the source of the error. | ||
945 | */ | ||
946 | dereg = ioread32(hcr_base + DE); | ||
947 | iowrite32(dereg, hcr_base + DE); | ||
948 | iowrite32(cereg, hcr_base + CE); | ||
949 | 987 | ||
950 | DPRINTK("single device error, CE=0x%x, DE=0x%x\n", | ||
951 | ioread32(hcr_base + CE), ioread32(hcr_base + DE)); | ||
952 | /* | 988 | /* |
953 | * We should consider this as non fatal error, and TF must | 989 | * Ignore serror in case of fatal errors as we always want |
954 | * be updated as done below. | 990 | * to do a soft-reset of the FSL SATA controller. Analyzing |
991 | * serror may cause libata to schedule a hard-reset action, | ||
992 | * and hard-reset currently does not do controller | ||
993 | * offline/online, causing command timeouts and leads to an | ||
994 | * un-recoverable state, hence make libATA ignore | ||
995 | * autopsy in case of fatal errors. | ||
955 | */ | 996 | */ |
956 | 997 | ||
957 | err_mask |= AC_ERR_DEV; | 998 | ehi->flags |= ATA_EHI_NO_AUTOPSY; |
958 | } | ||
959 | 999 | ||
960 | /* handle fatal errors */ | ||
961 | if (hstatus & FATAL_ERROR_DECODE) { | ||
962 | err_mask |= AC_ERR_ATA_BUS; | ||
963 | action |= ATA_EH_RESET; | ||
964 | /* how will fatal error interrupts be completed ?? */ | ||
965 | freeze = 1; | 1000 | freeze = 1; |
966 | } | 1001 | } |
967 | 1002 | ||
@@ -971,30 +1006,83 @@ static void sata_fsl_error_intr(struct ata_port *ap) | |||
971 | 1006 | ||
972 | /* Setup a soft-reset EH action */ | 1007 | /* Setup a soft-reset EH action */ |
973 | ata_ehi_hotplugged(ehi); | 1008 | ata_ehi_hotplugged(ehi); |
1009 | ata_ehi_push_desc(ehi, "%s", "PHY RDY changed"); | ||
974 | freeze = 1; | 1010 | freeze = 1; |
975 | } | 1011 | } |
976 | 1012 | ||
977 | /* record error info */ | 1013 | /* handle single device errors */ |
978 | qc = ata_qc_from_tag(ap, link->active_tag); | 1014 | if (cereg) { |
1015 | /* | ||
1016 | * clear the command error, also clears queue to the device | ||
1017 | * in error, and we can (re)issue commands to this device. | ||
1018 | * When a device is in error all commands queued into the | ||
1019 | * host controller and at the device are considered aborted | ||
1020 | * and the queue for that device is stopped. Now, after | ||
1021 | * clearing the device error, we can issue commands to the | ||
1022 | * device to interrogate it to find the source of the error. | ||
1023 | */ | ||
1024 | abort = 1; | ||
1025 | |||
1026 | DPRINTK("single device error, CE=0x%x, DE=0x%x\n", | ||
1027 | ioread32(hcr_base + CE), ioread32(hcr_base + DE)); | ||
979 | 1028 | ||
980 | if (qc) | 1029 | /* find out the offending link and qc */ |
1030 | if (ap->nr_pmp_links) { | ||
1031 | dereg = ioread32(hcr_base + DE); | ||
1032 | iowrite32(dereg, hcr_base + DE); | ||
1033 | iowrite32(cereg, hcr_base + CE); | ||
1034 | |||
1035 | if (dereg < ap->nr_pmp_links) { | ||
1036 | link = &ap->pmp_link[dereg]; | ||
1037 | ehi = &link->eh_info; | ||
1038 | qc = ata_qc_from_tag(ap, link->active_tag); | ||
1039 | /* | ||
1040 | * We should consider this as non fatal error, | ||
1041 | * and TF must be updated as done below. | ||
1042 | */ | ||
1043 | |||
1044 | err_mask |= AC_ERR_DEV; | ||
1045 | |||
1046 | } else { | ||
1047 | err_mask |= AC_ERR_HSM; | ||
1048 | action |= ATA_EH_HARDRESET; | ||
1049 | freeze = 1; | ||
1050 | } | ||
1051 | } else { | ||
1052 | dereg = ioread32(hcr_base + DE); | ||
1053 | iowrite32(dereg, hcr_base + DE); | ||
1054 | iowrite32(cereg, hcr_base + CE); | ||
1055 | |||
1056 | qc = ata_qc_from_tag(ap, link->active_tag); | ||
1057 | /* | ||
1058 | * We should consider this as non fatal error, | ||
1059 | * and TF must be updated as done below. | ||
1060 | */ | ||
1061 | err_mask |= AC_ERR_DEV; | ||
1062 | } | ||
1063 | } | ||
1064 | |||
1065 | /* record error info */ | ||
1066 | if (qc) { | ||
981 | qc->err_mask |= err_mask; | 1067 | qc->err_mask |= err_mask; |
982 | else | 1068 | } else |
983 | ehi->err_mask |= err_mask; | 1069 | ehi->err_mask |= err_mask; |
984 | 1070 | ||
985 | ehi->action |= action; | 1071 | ehi->action |= action; |
986 | ehi->serror |= SError; | ||
987 | 1072 | ||
988 | /* freeze or abort */ | 1073 | /* freeze or abort */ |
989 | if (freeze) | 1074 | if (freeze) |
990 | ata_port_freeze(ap); | 1075 | ata_port_freeze(ap); |
991 | else | 1076 | else if (abort) { |
992 | ata_port_abort(ap); | 1077 | if (qc) |
1078 | ata_link_abort(qc->dev->link); | ||
1079 | else | ||
1080 | ata_port_abort(ap); | ||
1081 | } | ||
993 | } | 1082 | } |
994 | 1083 | ||
995 | static void sata_fsl_host_intr(struct ata_port *ap) | 1084 | static void sata_fsl_host_intr(struct ata_port *ap) |
996 | { | 1085 | { |
997 | struct ata_link *link = &ap->link; | ||
998 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; | 1086 | struct sata_fsl_host_priv *host_priv = ap->host->private_data; |
999 | void __iomem *hcr_base = host_priv->hcr_base; | 1087 | void __iomem *hcr_base = host_priv->hcr_base; |
1000 | u32 hstatus, qc_active = 0; | 1088 | u32 hstatus, qc_active = 0; |
@@ -1017,10 +1105,19 @@ static void sata_fsl_host_intr(struct ata_port *ap) | |||
1017 | return; | 1105 | return; |
1018 | } | 1106 | } |
1019 | 1107 | ||
1020 | if (link->sactive) { /* only true for NCQ commands */ | 1108 | /* Read command completed register */ |
1109 | qc_active = ioread32(hcr_base + CC); | ||
1110 | |||
1111 | VPRINTK("Status of all queues :\n"); | ||
1112 | VPRINTK("qc_active/CC = 0x%x, CA = 0x%x, CE=0x%x,CQ=0x%x,apqa=0x%x\n", | ||
1113 | qc_active, | ||
1114 | ioread32(hcr_base + CA), | ||
1115 | ioread32(hcr_base + CE), | ||
1116 | ioread32(hcr_base + CQ), | ||
1117 | ap->qc_active); | ||
1118 | |||
1119 | if (qc_active & ap->qc_active) { | ||
1021 | int i; | 1120 | int i; |
1022 | /* Read command completed register */ | ||
1023 | qc_active = ioread32(hcr_base + CC); | ||
1024 | /* clear CC bit, this will also complete the interrupt */ | 1121 | /* clear CC bit, this will also complete the interrupt */ |
1025 | iowrite32(qc_active, hcr_base + CC); | 1122 | iowrite32(qc_active, hcr_base + CC); |
1026 | 1123 | ||
@@ -1032,8 +1129,9 @@ static void sata_fsl_host_intr(struct ata_port *ap) | |||
1032 | for (i = 0; i < SATA_FSL_QUEUE_DEPTH; i++) { | 1129 | for (i = 0; i < SATA_FSL_QUEUE_DEPTH; i++) { |
1033 | if (qc_active & (1 << i)) { | 1130 | if (qc_active & (1 << i)) { |
1034 | qc = ata_qc_from_tag(ap, i); | 1131 | qc = ata_qc_from_tag(ap, i); |
1035 | if (qc) | 1132 | if (qc) { |
1036 | ata_qc_complete(qc); | 1133 | ata_qc_complete(qc); |
1134 | } | ||
1037 | DPRINTK | 1135 | DPRINTK |
1038 | ("completing ncq cmd,tag=%d,CC=0x%x,CA=0x%x\n", | 1136 | ("completing ncq cmd,tag=%d,CC=0x%x,CA=0x%x\n", |
1039 | i, ioread32(hcr_base + CC), | 1137 | i, ioread32(hcr_base + CC), |
@@ -1042,19 +1140,21 @@ static void sata_fsl_host_intr(struct ata_port *ap) | |||
1042 | } | 1140 | } |
1043 | return; | 1141 | return; |
1044 | 1142 | ||
1045 | } else if (ap->qc_active) { | 1143 | } else if ((ap->qc_active & (1 << ATA_TAG_INTERNAL))) { |
1046 | iowrite32(1, hcr_base + CC); | 1144 | iowrite32(1, hcr_base + CC); |
1047 | qc = ata_qc_from_tag(ap, link->active_tag); | 1145 | qc = ata_qc_from_tag(ap, ATA_TAG_INTERNAL); |
1048 | 1146 | ||
1049 | DPRINTK("completing non-ncq cmd, tag=%d,CC=0x%x\n", | 1147 | DPRINTK("completing non-ncq cmd, CC=0x%x\n", |
1050 | link->active_tag, ioread32(hcr_base + CC)); | 1148 | ioread32(hcr_base + CC)); |
1051 | 1149 | ||
1052 | if (qc) | 1150 | if (qc) { |
1053 | ata_qc_complete(qc); | 1151 | ata_qc_complete(qc); |
1152 | } | ||
1054 | } else { | 1153 | } else { |
1055 | /* Spurious Interrupt!! */ | 1154 | /* Spurious Interrupt!! */ |
1056 | DPRINTK("spurious interrupt!!, CC = 0x%x\n", | 1155 | DPRINTK("spurious interrupt!!, CC = 0x%x\n", |
1057 | ioread32(hcr_base + CC)); | 1156 | ioread32(hcr_base + CC)); |
1157 | iowrite32(qc_active, hcr_base + CC); | ||
1058 | return; | 1158 | return; |
1059 | } | 1159 | } |
1060 | } | 1160 | } |
@@ -1130,9 +1230,6 @@ static int sata_fsl_init_controller(struct ata_host *host) | |||
1130 | iowrite32(0x00000FFFF, hcr_base + CE); | 1230 | iowrite32(0x00000FFFF, hcr_base + CE); |
1131 | iowrite32(0x00000FFFF, hcr_base + DE); | 1231 | iowrite32(0x00000FFFF, hcr_base + DE); |
1132 | 1232 | ||
1133 | /* initially assuming no Port multiplier, set CQPMP to 0 */ | ||
1134 | iowrite32(0x0, hcr_base + CQPMP); | ||
1135 | |||
1136 | /* | 1233 | /* |
1137 | * host controller will be brought on-line, during xx_port_start() | 1234 | * host controller will be brought on-line, during xx_port_start() |
1138 | * callback, that should also initiate the OOB, COMINIT sequence | 1235 | * callback, that should also initiate the OOB, COMINIT sequence |
@@ -1154,8 +1251,8 @@ static struct scsi_host_template sata_fsl_sht = { | |||
1154 | .dma_boundary = ATA_DMA_BOUNDARY, | 1251 | .dma_boundary = ATA_DMA_BOUNDARY, |
1155 | }; | 1252 | }; |
1156 | 1253 | ||
1157 | static const struct ata_port_operations sata_fsl_ops = { | 1254 | static struct ata_port_operations sata_fsl_ops = { |
1158 | .inherits = &sata_port_ops, | 1255 | .inherits = &sata_pmp_port_ops, |
1159 | 1256 | ||
1160 | .qc_prep = sata_fsl_qc_prep, | 1257 | .qc_prep = sata_fsl_qc_prep, |
1161 | .qc_issue = sata_fsl_qc_issue, | 1258 | .qc_issue = sata_fsl_qc_issue, |
@@ -1168,10 +1265,15 @@ static const struct ata_port_operations sata_fsl_ops = { | |||
1168 | .thaw = sata_fsl_thaw, | 1265 | .thaw = sata_fsl_thaw, |
1169 | .prereset = sata_fsl_prereset, | 1266 | .prereset = sata_fsl_prereset, |
1170 | .softreset = sata_fsl_softreset, | 1267 | .softreset = sata_fsl_softreset, |
1268 | .pmp_softreset = sata_fsl_softreset, | ||
1269 | .error_handler = sata_fsl_error_handler, | ||
1171 | .post_internal_cmd = sata_fsl_post_internal_cmd, | 1270 | .post_internal_cmd = sata_fsl_post_internal_cmd, |
1172 | 1271 | ||
1173 | .port_start = sata_fsl_port_start, | 1272 | .port_start = sata_fsl_port_start, |
1174 | .port_stop = sata_fsl_port_stop, | 1273 | .port_stop = sata_fsl_port_stop, |
1274 | |||
1275 | .pmp_attach = sata_fsl_pmp_attach, | ||
1276 | .pmp_detach = sata_fsl_pmp_detach, | ||
1175 | }; | 1277 | }; |
1176 | 1278 | ||
1177 | static const struct ata_port_info sata_fsl_port_info[] = { | 1279 | static const struct ata_port_info sata_fsl_port_info[] = { |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index bb73b2222627..acf347f71a2f 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -72,7 +72,7 @@ | |||
72 | #include <linux/libata.h> | 72 | #include <linux/libata.h> |
73 | 73 | ||
74 | #define DRV_NAME "sata_mv" | 74 | #define DRV_NAME "sata_mv" |
75 | #define DRV_VERSION "1.20" | 75 | #define DRV_VERSION "1.24" |
76 | 76 | ||
77 | enum { | 77 | enum { |
78 | /* BAR's are enumerated in terms of pci_resource_start() terms */ | 78 | /* BAR's are enumerated in terms of pci_resource_start() terms */ |
@@ -122,14 +122,17 @@ enum { | |||
122 | /* Host Flags */ | 122 | /* Host Flags */ |
123 | MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */ | 123 | MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */ |
124 | MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */ | 124 | MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */ |
125 | /* SoC integrated controllers, no PCI interface */ | ||
126 | MV_FLAG_SOC = (1 << 28), | ||
127 | 125 | ||
128 | MV_COMMON_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 126 | MV_COMMON_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
129 | ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI | | 127 | ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI | |
130 | ATA_FLAG_PIO_POLLING, | 128 | ATA_FLAG_PIO_POLLING, |
129 | |||
131 | MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE, | 130 | MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE, |
132 | 131 | ||
132 | MV_GENIIE_FLAGS = MV_COMMON_FLAGS | MV_6XXX_FLAGS | | ||
133 | ATA_FLAG_PMP | ATA_FLAG_ACPI_SATA | | ||
134 | ATA_FLAG_NCQ | ATA_FLAG_AN, | ||
135 | |||
133 | CRQB_FLAG_READ = (1 << 0), | 136 | CRQB_FLAG_READ = (1 << 0), |
134 | CRQB_TAG_SHIFT = 1, | 137 | CRQB_TAG_SHIFT = 1, |
135 | CRQB_IOID_SHIFT = 6, /* CRQB Gen-II/IIE IO Id shift */ | 138 | CRQB_IOID_SHIFT = 6, /* CRQB Gen-II/IIE IO Id shift */ |
@@ -197,13 +200,6 @@ enum { | |||
197 | HC_MAIN_RSVD = (0x7f << 25), /* bits 31-25 */ | 200 | HC_MAIN_RSVD = (0x7f << 25), /* bits 31-25 */ |
198 | HC_MAIN_RSVD_5 = (0x1fff << 19), /* bits 31-19 */ | 201 | HC_MAIN_RSVD_5 = (0x1fff << 19), /* bits 31-19 */ |
199 | HC_MAIN_RSVD_SOC = (0x3fffffb << 6), /* bits 31-9, 7-6 */ | 202 | HC_MAIN_RSVD_SOC = (0x3fffffb << 6), /* bits 31-9, 7-6 */ |
200 | HC_MAIN_MASKED_IRQS = (TRAN_LO_DONE | TRAN_HI_DONE | | ||
201 | PORTS_0_3_COAL_DONE | PORTS_4_7_COAL_DONE | | ||
202 | PORTS_0_7_COAL_DONE | GPIO_INT | TWSI_INT | | ||
203 | HC_MAIN_RSVD), | ||
204 | HC_MAIN_MASKED_IRQS_5 = (PORTS_0_3_COAL_DONE | PORTS_4_7_COAL_DONE | | ||
205 | HC_MAIN_RSVD_5), | ||
206 | HC_MAIN_MASKED_IRQS_SOC = (PORTS_0_3_COAL_DONE | HC_MAIN_RSVD_SOC), | ||
207 | 203 | ||
208 | /* SATAHC registers */ | 204 | /* SATAHC registers */ |
209 | HC_CFG_OFS = 0, | 205 | HC_CFG_OFS = 0, |
@@ -221,6 +217,7 @@ enum { | |||
221 | SATA_STATUS_OFS = 0x300, /* ctrl, err regs follow status */ | 217 | SATA_STATUS_OFS = 0x300, /* ctrl, err regs follow status */ |
222 | SATA_ACTIVE_OFS = 0x350, | 218 | SATA_ACTIVE_OFS = 0x350, |
223 | SATA_FIS_IRQ_CAUSE_OFS = 0x364, | 219 | SATA_FIS_IRQ_CAUSE_OFS = 0x364, |
220 | SATA_FIS_IRQ_AN = (1 << 9), /* async notification */ | ||
224 | 221 | ||
225 | LTMODE_OFS = 0x30c, | 222 | LTMODE_OFS = 0x30c, |
226 | LTMODE_BIT8 = (1 << 8), /* unknown, but necessary */ | 223 | LTMODE_BIT8 = (1 << 8), /* unknown, but necessary */ |
@@ -357,12 +354,12 @@ enum { | |||
357 | MV_HP_ERRATA_50XXB2 = (1 << 2), | 354 | MV_HP_ERRATA_50XXB2 = (1 << 2), |
358 | MV_HP_ERRATA_60X1B2 = (1 << 3), | 355 | MV_HP_ERRATA_60X1B2 = (1 << 3), |
359 | MV_HP_ERRATA_60X1C0 = (1 << 4), | 356 | MV_HP_ERRATA_60X1C0 = (1 << 4), |
360 | MV_HP_ERRATA_XX42A0 = (1 << 5), | ||
361 | MV_HP_GEN_I = (1 << 6), /* Generation I: 50xx */ | 357 | MV_HP_GEN_I = (1 << 6), /* Generation I: 50xx */ |
362 | MV_HP_GEN_II = (1 << 7), /* Generation II: 60xx */ | 358 | MV_HP_GEN_II = (1 << 7), /* Generation II: 60xx */ |
363 | MV_HP_GEN_IIE = (1 << 8), /* Generation IIE: 6042/7042 */ | 359 | MV_HP_GEN_IIE = (1 << 8), /* Generation IIE: 6042/7042 */ |
364 | MV_HP_PCIE = (1 << 9), /* PCIe bus/regs: 7042 */ | 360 | MV_HP_PCIE = (1 << 9), /* PCIe bus/regs: 7042 */ |
365 | MV_HP_CUT_THROUGH = (1 << 10), /* can use EDMA cut-through */ | 361 | MV_HP_CUT_THROUGH = (1 << 10), /* can use EDMA cut-through */ |
362 | MV_HP_FLAG_SOC = (1 << 11), /* SystemOnChip, no PCI */ | ||
366 | 363 | ||
367 | /* Port private flags (pp_flags) */ | 364 | /* Port private flags (pp_flags) */ |
368 | MV_PP_FLAG_EDMA_EN = (1 << 0), /* is EDMA engine enabled? */ | 365 | MV_PP_FLAG_EDMA_EN = (1 << 0), /* is EDMA engine enabled? */ |
@@ -375,7 +372,7 @@ enum { | |||
375 | #define IS_GEN_II(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_II) | 372 | #define IS_GEN_II(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_II) |
376 | #define IS_GEN_IIE(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_IIE) | 373 | #define IS_GEN_IIE(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_IIE) |
377 | #define IS_PCIE(hpriv) ((hpriv)->hp_flags & MV_HP_PCIE) | 374 | #define IS_PCIE(hpriv) ((hpriv)->hp_flags & MV_HP_PCIE) |
378 | #define HAS_PCI(host) (!((host)->ports[0]->flags & MV_FLAG_SOC)) | 375 | #define IS_SOC(hpriv) ((hpriv)->hp_flags & MV_HP_FLAG_SOC) |
379 | 376 | ||
380 | #define WINDOW_CTRL(i) (0x20030 + ((i) << 4)) | 377 | #define WINDOW_CTRL(i) (0x20030 + ((i) << 4)) |
381 | #define WINDOW_BASE(i) (0x20034 + ((i) << 4)) | 378 | #define WINDOW_BASE(i) (0x20034 + ((i) << 4)) |
@@ -459,6 +456,7 @@ struct mv_port_signal { | |||
459 | 456 | ||
460 | struct mv_host_priv { | 457 | struct mv_host_priv { |
461 | u32 hp_flags; | 458 | u32 hp_flags; |
459 | u32 main_irq_mask; | ||
462 | struct mv_port_signal signal[8]; | 460 | struct mv_port_signal signal[8]; |
463 | const struct mv_hw_ops *ops; | 461 | const struct mv_hw_ops *ops; |
464 | int n_ports; | 462 | int n_ports; |
@@ -640,25 +638,19 @@ static const struct ata_port_info mv_port_info[] = { | |||
640 | .port_ops = &mv6_ops, | 638 | .port_ops = &mv6_ops, |
641 | }, | 639 | }, |
642 | { /* chip_6042 */ | 640 | { /* chip_6042 */ |
643 | .flags = MV_COMMON_FLAGS | MV_6XXX_FLAGS | | 641 | .flags = MV_GENIIE_FLAGS, |
644 | ATA_FLAG_PMP | ATA_FLAG_ACPI_SATA | | ||
645 | ATA_FLAG_NCQ, | ||
646 | .pio_mask = 0x1f, /* pio0-4 */ | 642 | .pio_mask = 0x1f, /* pio0-4 */ |
647 | .udma_mask = ATA_UDMA6, | 643 | .udma_mask = ATA_UDMA6, |
648 | .port_ops = &mv_iie_ops, | 644 | .port_ops = &mv_iie_ops, |
649 | }, | 645 | }, |
650 | { /* chip_7042 */ | 646 | { /* chip_7042 */ |
651 | .flags = MV_COMMON_FLAGS | MV_6XXX_FLAGS | | 647 | .flags = MV_GENIIE_FLAGS, |
652 | ATA_FLAG_PMP | ATA_FLAG_ACPI_SATA | | ||
653 | ATA_FLAG_NCQ, | ||
654 | .pio_mask = 0x1f, /* pio0-4 */ | 648 | .pio_mask = 0x1f, /* pio0-4 */ |
655 | .udma_mask = ATA_UDMA6, | 649 | .udma_mask = ATA_UDMA6, |
656 | .port_ops = &mv_iie_ops, | 650 | .port_ops = &mv_iie_ops, |
657 | }, | 651 | }, |
658 | { /* chip_soc */ | 652 | { /* chip_soc */ |
659 | .flags = MV_COMMON_FLAGS | MV_6XXX_FLAGS | | 653 | .flags = MV_GENIIE_FLAGS, |
660 | ATA_FLAG_PMP | ATA_FLAG_ACPI_SATA | | ||
661 | ATA_FLAG_NCQ | MV_FLAG_SOC, | ||
662 | .pio_mask = 0x1f, /* pio0-4 */ | 654 | .pio_mask = 0x1f, /* pio0-4 */ |
663 | .udma_mask = ATA_UDMA6, | 655 | .udma_mask = ATA_UDMA6, |
664 | .port_ops = &mv_iie_ops, | 656 | .port_ops = &mv_iie_ops, |
@@ -818,12 +810,7 @@ static void mv_set_edma_ptrs(void __iomem *port_mmio, | |||
818 | writel((pp->crqb_dma >> 16) >> 16, port_mmio + EDMA_REQ_Q_BASE_HI_OFS); | 810 | writel((pp->crqb_dma >> 16) >> 16, port_mmio + EDMA_REQ_Q_BASE_HI_OFS); |
819 | writelfl((pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK) | index, | 811 | writelfl((pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK) | index, |
820 | port_mmio + EDMA_REQ_Q_IN_PTR_OFS); | 812 | port_mmio + EDMA_REQ_Q_IN_PTR_OFS); |
821 | 813 | writelfl(index, port_mmio + EDMA_REQ_Q_OUT_PTR_OFS); | |
822 | if (hpriv->hp_flags & MV_HP_ERRATA_XX42A0) | ||
823 | writelfl((pp->crqb_dma & 0xffffffff) | index, | ||
824 | port_mmio + EDMA_REQ_Q_OUT_PTR_OFS); | ||
825 | else | ||
826 | writelfl(index, port_mmio + EDMA_REQ_Q_OUT_PTR_OFS); | ||
827 | 814 | ||
828 | /* | 815 | /* |
829 | * initialize response queue | 816 | * initialize response queue |
@@ -833,17 +820,38 @@ static void mv_set_edma_ptrs(void __iomem *port_mmio, | |||
833 | 820 | ||
834 | WARN_ON(pp->crpb_dma & 0xff); | 821 | WARN_ON(pp->crpb_dma & 0xff); |
835 | writel((pp->crpb_dma >> 16) >> 16, port_mmio + EDMA_RSP_Q_BASE_HI_OFS); | 822 | writel((pp->crpb_dma >> 16) >> 16, port_mmio + EDMA_RSP_Q_BASE_HI_OFS); |
836 | 823 | writelfl(index, port_mmio + EDMA_RSP_Q_IN_PTR_OFS); | |
837 | if (hpriv->hp_flags & MV_HP_ERRATA_XX42A0) | ||
838 | writelfl((pp->crpb_dma & 0xffffffff) | index, | ||
839 | port_mmio + EDMA_RSP_Q_IN_PTR_OFS); | ||
840 | else | ||
841 | writelfl(index, port_mmio + EDMA_RSP_Q_IN_PTR_OFS); | ||
842 | |||
843 | writelfl((pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK) | index, | 824 | writelfl((pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK) | index, |
844 | port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); | 825 | port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); |
845 | } | 826 | } |
846 | 827 | ||
828 | static void mv_set_main_irq_mask(struct ata_host *host, | ||
829 | u32 disable_bits, u32 enable_bits) | ||
830 | { | ||
831 | struct mv_host_priv *hpriv = host->private_data; | ||
832 | u32 old_mask, new_mask; | ||
833 | |||
834 | old_mask = hpriv->main_irq_mask; | ||
835 | new_mask = (old_mask & ~disable_bits) | enable_bits; | ||
836 | if (new_mask != old_mask) { | ||
837 | hpriv->main_irq_mask = new_mask; | ||
838 | writelfl(new_mask, hpriv->main_irq_mask_addr); | ||
839 | } | ||
840 | } | ||
841 | |||
842 | static void mv_enable_port_irqs(struct ata_port *ap, | ||
843 | unsigned int port_bits) | ||
844 | { | ||
845 | unsigned int shift, hardport, port = ap->port_no; | ||
846 | u32 disable_bits, enable_bits; | ||
847 | |||
848 | MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport); | ||
849 | |||
850 | disable_bits = (DONE_IRQ | ERR_IRQ) << shift; | ||
851 | enable_bits = port_bits << shift; | ||
852 | mv_set_main_irq_mask(ap->host, disable_bits, enable_bits); | ||
853 | } | ||
854 | |||
847 | /** | 855 | /** |
848 | * mv_start_dma - Enable eDMA engine | 856 | * mv_start_dma - Enable eDMA engine |
849 | * @base: port base address | 857 | * @base: port base address |
@@ -886,9 +894,11 @@ static void mv_start_dma(struct ata_port *ap, void __iomem *port_mmio, | |||
886 | mv_edma_cfg(ap, want_ncq); | 894 | mv_edma_cfg(ap, want_ncq); |
887 | 895 | ||
888 | /* clear FIS IRQ Cause */ | 896 | /* clear FIS IRQ Cause */ |
889 | writelfl(0, port_mmio + SATA_FIS_IRQ_CAUSE_OFS); | 897 | if (IS_GEN_IIE(hpriv)) |
898 | writelfl(0, port_mmio + SATA_FIS_IRQ_CAUSE_OFS); | ||
890 | 899 | ||
891 | mv_set_edma_ptrs(port_mmio, hpriv, pp); | 900 | mv_set_edma_ptrs(port_mmio, hpriv, pp); |
901 | mv_enable_port_irqs(ap, DONE_IRQ|ERR_IRQ); | ||
892 | 902 | ||
893 | writelfl(EDMA_EN, port_mmio + EDMA_CMD_OFS); | 903 | writelfl(EDMA_EN, port_mmio + EDMA_CMD_OFS); |
894 | pp->pp_flags |= MV_PP_FLAG_EDMA_EN; | 904 | pp->pp_flags |= MV_PP_FLAG_EDMA_EN; |
@@ -1231,7 +1241,7 @@ static void mv_edma_cfg(struct ata_port *ap, int want_ncq) | |||
1231 | 1241 | ||
1232 | cfg |= (1 << 23); /* do not mask PM field in rx'd FIS */ | 1242 | cfg |= (1 << 23); /* do not mask PM field in rx'd FIS */ |
1233 | cfg |= (1 << 22); /* enab 4-entry host queue cache */ | 1243 | cfg |= (1 << 22); /* enab 4-entry host queue cache */ |
1234 | if (HAS_PCI(ap->host)) | 1244 | if (!IS_SOC(hpriv)) |
1235 | cfg |= (1 << 18); /* enab early completion */ | 1245 | cfg |= (1 << 18); /* enab early completion */ |
1236 | if (hpriv->hp_flags & MV_HP_CUT_THROUGH) | 1246 | if (hpriv->hp_flags & MV_HP_CUT_THROUGH) |
1237 | cfg |= (1 << 17); /* enab cut-thru (dis stor&forwrd) */ | 1247 | cfg |= (1 << 17); /* enab cut-thru (dis stor&forwrd) */ |
@@ -1341,6 +1351,7 @@ out_port_free_dma_mem: | |||
1341 | static void mv_port_stop(struct ata_port *ap) | 1351 | static void mv_port_stop(struct ata_port *ap) |
1342 | { | 1352 | { |
1343 | mv_stop_edma(ap); | 1353 | mv_stop_edma(ap); |
1354 | mv_enable_port_irqs(ap, 0); | ||
1344 | mv_port_free_dma_mem(ap); | 1355 | mv_port_free_dma_mem(ap); |
1345 | } | 1356 | } |
1346 | 1357 | ||
@@ -1582,6 +1593,7 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc) | |||
1582 | * shadow block, etc registers. | 1593 | * shadow block, etc registers. |
1583 | */ | 1594 | */ |
1584 | mv_stop_edma(ap); | 1595 | mv_stop_edma(ap); |
1596 | mv_enable_port_irqs(ap, ERR_IRQ); | ||
1585 | mv_pmp_select(ap, qc->dev->link->pmp); | 1597 | mv_pmp_select(ap, qc->dev->link->pmp); |
1586 | return ata_sff_qc_issue(qc); | 1598 | return ata_sff_qc_issue(qc); |
1587 | } | 1599 | } |
@@ -1670,6 +1682,18 @@ static void mv_pmp_eh_prep(struct ata_port *ap, unsigned int pmp_map) | |||
1670 | } | 1682 | } |
1671 | } | 1683 | } |
1672 | 1684 | ||
1685 | static int mv_req_q_empty(struct ata_port *ap) | ||
1686 | { | ||
1687 | void __iomem *port_mmio = mv_ap_base(ap); | ||
1688 | u32 in_ptr, out_ptr; | ||
1689 | |||
1690 | in_ptr = (readl(port_mmio + EDMA_REQ_Q_IN_PTR_OFS) | ||
1691 | >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK; | ||
1692 | out_ptr = (readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) | ||
1693 | >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK; | ||
1694 | return (in_ptr == out_ptr); /* 1 == queue_is_empty */ | ||
1695 | } | ||
1696 | |||
1673 | static int mv_handle_fbs_ncq_dev_err(struct ata_port *ap) | 1697 | static int mv_handle_fbs_ncq_dev_err(struct ata_port *ap) |
1674 | { | 1698 | { |
1675 | struct mv_port_priv *pp = ap->private_data; | 1699 | struct mv_port_priv *pp = ap->private_data; |
@@ -1703,7 +1727,7 @@ static int mv_handle_fbs_ncq_dev_err(struct ata_port *ap) | |||
1703 | ap->qc_active, failed_links, | 1727 | ap->qc_active, failed_links, |
1704 | ap->nr_active_links); | 1728 | ap->nr_active_links); |
1705 | 1729 | ||
1706 | if (ap->nr_active_links <= failed_links) { | 1730 | if (ap->nr_active_links <= failed_links && mv_req_q_empty(ap)) { |
1707 | mv_process_crpb_entries(ap, pp); | 1731 | mv_process_crpb_entries(ap, pp); |
1708 | mv_stop_edma(ap); | 1732 | mv_stop_edma(ap); |
1709 | mv_eh_freeze(ap); | 1733 | mv_eh_freeze(ap); |
@@ -1812,6 +1836,7 @@ static void mv_err_intr(struct ata_port *ap) | |||
1812 | { | 1836 | { |
1813 | void __iomem *port_mmio = mv_ap_base(ap); | 1837 | void __iomem *port_mmio = mv_ap_base(ap); |
1814 | u32 edma_err_cause, eh_freeze_mask, serr = 0; | 1838 | u32 edma_err_cause, eh_freeze_mask, serr = 0; |
1839 | u32 fis_cause = 0; | ||
1815 | struct mv_port_priv *pp = ap->private_data; | 1840 | struct mv_port_priv *pp = ap->private_data; |
1816 | struct mv_host_priv *hpriv = ap->host->private_data; | 1841 | struct mv_host_priv *hpriv = ap->host->private_data; |
1817 | unsigned int action = 0, err_mask = 0; | 1842 | unsigned int action = 0, err_mask = 0; |
@@ -1821,16 +1846,19 @@ static void mv_err_intr(struct ata_port *ap) | |||
1821 | 1846 | ||
1822 | /* | 1847 | /* |
1823 | * Read and clear the SError and err_cause bits. | 1848 | * Read and clear the SError and err_cause bits. |
1849 | * For GenIIe, if EDMA_ERR_TRANS_IRQ_7 is set, we also must read/clear | ||
1850 | * the FIS_IRQ_CAUSE register before clearing edma_err_cause. | ||
1824 | */ | 1851 | */ |
1825 | sata_scr_read(&ap->link, SCR_ERROR, &serr); | 1852 | sata_scr_read(&ap->link, SCR_ERROR, &serr); |
1826 | sata_scr_write_flush(&ap->link, SCR_ERROR, serr); | 1853 | sata_scr_write_flush(&ap->link, SCR_ERROR, serr); |
1827 | 1854 | ||
1828 | edma_err_cause = readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); | 1855 | edma_err_cause = readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); |
1856 | if (IS_GEN_IIE(hpriv) && (edma_err_cause & EDMA_ERR_TRANS_IRQ_7)) { | ||
1857 | fis_cause = readl(port_mmio + SATA_FIS_IRQ_CAUSE_OFS); | ||
1858 | writelfl(~fis_cause, port_mmio + SATA_FIS_IRQ_CAUSE_OFS); | ||
1859 | } | ||
1829 | writelfl(~edma_err_cause, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); | 1860 | writelfl(~edma_err_cause, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); |
1830 | 1861 | ||
1831 | ata_port_printk(ap, KERN_INFO, "%s: err_cause=%08x pp_flags=0x%x\n", | ||
1832 | __func__, edma_err_cause, pp->pp_flags); | ||
1833 | |||
1834 | if (edma_err_cause & EDMA_ERR_DEV) { | 1862 | if (edma_err_cause & EDMA_ERR_DEV) { |
1835 | /* | 1863 | /* |
1836 | * Device errors during FIS-based switching operation | 1864 | * Device errors during FIS-based switching operation |
@@ -1844,6 +1872,18 @@ static void mv_err_intr(struct ata_port *ap) | |||
1844 | ata_ehi_clear_desc(ehi); | 1872 | ata_ehi_clear_desc(ehi); |
1845 | ata_ehi_push_desc(ehi, "edma_err_cause=%08x pp_flags=%08x", | 1873 | ata_ehi_push_desc(ehi, "edma_err_cause=%08x pp_flags=%08x", |
1846 | edma_err_cause, pp->pp_flags); | 1874 | edma_err_cause, pp->pp_flags); |
1875 | |||
1876 | if (IS_GEN_IIE(hpriv) && (edma_err_cause & EDMA_ERR_TRANS_IRQ_7)) { | ||
1877 | ata_ehi_push_desc(ehi, "fis_cause=%08x", fis_cause); | ||
1878 | if (fis_cause & SATA_FIS_IRQ_AN) { | ||
1879 | u32 ec = edma_err_cause & | ||
1880 | ~(EDMA_ERR_TRANS_IRQ_7 | EDMA_ERR_IRQ_TRANSIENT); | ||
1881 | sata_async_notification(ap); | ||
1882 | if (!ec) | ||
1883 | return; /* Just an AN; no need for the nukes */ | ||
1884 | ata_ehi_push_desc(ehi, "SDB notify"); | ||
1885 | } | ||
1886 | } | ||
1847 | /* | 1887 | /* |
1848 | * All generations share these EDMA error cause bits: | 1888 | * All generations share these EDMA error cause bits: |
1849 | */ | 1889 | */ |
@@ -2162,20 +2202,20 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance) | |||
2162 | struct ata_host *host = dev_instance; | 2202 | struct ata_host *host = dev_instance; |
2163 | struct mv_host_priv *hpriv = host->private_data; | 2203 | struct mv_host_priv *hpriv = host->private_data; |
2164 | unsigned int handled = 0; | 2204 | unsigned int handled = 0; |
2165 | u32 main_irq_cause, main_irq_mask; | 2205 | u32 main_irq_cause, pending_irqs; |
2166 | 2206 | ||
2167 | spin_lock(&host->lock); | 2207 | spin_lock(&host->lock); |
2168 | main_irq_cause = readl(hpriv->main_irq_cause_addr); | 2208 | main_irq_cause = readl(hpriv->main_irq_cause_addr); |
2169 | main_irq_mask = readl(hpriv->main_irq_mask_addr); | 2209 | pending_irqs = main_irq_cause & hpriv->main_irq_mask; |
2170 | /* | 2210 | /* |
2171 | * Deal with cases where we either have nothing pending, or have read | 2211 | * Deal with cases where we either have nothing pending, or have read |
2172 | * a bogus register value which can indicate HW removal or PCI fault. | 2212 | * a bogus register value which can indicate HW removal or PCI fault. |
2173 | */ | 2213 | */ |
2174 | if ((main_irq_cause & main_irq_mask) && (main_irq_cause != 0xffffffffU)) { | 2214 | if (pending_irqs && main_irq_cause != 0xffffffffU) { |
2175 | if (unlikely((main_irq_cause & PCI_ERR) && HAS_PCI(host))) | 2215 | if (unlikely((pending_irqs & PCI_ERR) && !IS_SOC(hpriv))) |
2176 | handled = mv_pci_error(host, hpriv->base); | 2216 | handled = mv_pci_error(host, hpriv->base); |
2177 | else | 2217 | else |
2178 | handled = mv_host_intr(host, main_irq_cause); | 2218 | handled = mv_host_intr(host, pending_irqs); |
2179 | } | 2219 | } |
2180 | spin_unlock(&host->lock); | 2220 | spin_unlock(&host->lock); |
2181 | return IRQ_RETVAL(handled); | 2221 | return IRQ_RETVAL(handled); |
@@ -2373,7 +2413,6 @@ static void mv_reset_pci_bus(struct ata_host *host, void __iomem *mmio) | |||
2373 | ZERO(MV_PCI_DISC_TIMER); | 2413 | ZERO(MV_PCI_DISC_TIMER); |
2374 | ZERO(MV_PCI_MSI_TRIGGER); | 2414 | ZERO(MV_PCI_MSI_TRIGGER); |
2375 | writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT_OFS); | 2415 | writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT_OFS); |
2376 | ZERO(PCI_HC_MAIN_IRQ_MASK_OFS); | ||
2377 | ZERO(MV_PCI_SERR_MASK); | 2416 | ZERO(MV_PCI_SERR_MASK); |
2378 | ZERO(hpriv->irq_cause_ofs); | 2417 | ZERO(hpriv->irq_cause_ofs); |
2379 | ZERO(hpriv->irq_mask_ofs); | 2418 | ZERO(hpriv->irq_mask_ofs); |
@@ -2495,7 +2534,7 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, | |||
2495 | hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0); | 2534 | hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0); |
2496 | int fix_phy_mode4 = | 2535 | int fix_phy_mode4 = |
2497 | hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0); | 2536 | hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0); |
2498 | u32 m2, tmp; | 2537 | u32 m2, m3; |
2499 | 2538 | ||
2500 | if (fix_phy_mode2) { | 2539 | if (fix_phy_mode2) { |
2501 | m2 = readl(port_mmio + PHY_MODE2); | 2540 | m2 = readl(port_mmio + PHY_MODE2); |
@@ -2512,28 +2551,37 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, | |||
2512 | udelay(200); | 2551 | udelay(200); |
2513 | } | 2552 | } |
2514 | 2553 | ||
2515 | /* who knows what this magic does */ | 2554 | /* |
2516 | tmp = readl(port_mmio + PHY_MODE3); | 2555 | * Gen-II/IIe PHY_MODE3 errata RM#2: |
2517 | tmp &= ~0x7F800000; | 2556 | * Achieves better receiver noise performance than the h/w default: |
2518 | tmp |= 0x2A800000; | 2557 | */ |
2519 | writel(tmp, port_mmio + PHY_MODE3); | 2558 | m3 = readl(port_mmio + PHY_MODE3); |
2559 | m3 = (m3 & 0x1f) | (0x5555601 << 5); | ||
2560 | |||
2561 | /* Guideline 88F5182 (GL# SATA-S11) */ | ||
2562 | if (IS_SOC(hpriv)) | ||
2563 | m3 &= ~0x1c; | ||
2520 | 2564 | ||
2521 | if (fix_phy_mode4) { | 2565 | if (fix_phy_mode4) { |
2522 | u32 m4; | 2566 | u32 m4; |
2523 | 2567 | ||
2524 | m4 = readl(port_mmio + PHY_MODE4); | 2568 | m4 = readl(port_mmio + PHY_MODE4); |
2525 | 2569 | ||
2526 | if (hp_flags & MV_HP_ERRATA_60X1B2) | ||
2527 | tmp = readl(port_mmio + PHY_MODE3); | ||
2528 | |||
2529 | /* workaround for errata FEr SATA#10 (part 1) */ | 2570 | /* workaround for errata FEr SATA#10 (part 1) */ |
2530 | m4 = (m4 & ~(1 << 1)) | (1 << 0); | 2571 | m4 = (m4 & ~(1 << 1)) | (1 << 0); |
2531 | 2572 | ||
2532 | writel(m4, port_mmio + PHY_MODE4); | 2573 | /* enforce bit restrictions on GenIIe devices */ |
2574 | if (IS_GEN_IIE(hpriv)) | ||
2575 | m4 = (m4 & ~0x5DE3FFFC) | (1 << 2); | ||
2533 | 2576 | ||
2534 | if (hp_flags & MV_HP_ERRATA_60X1B2) | 2577 | writel(m4, port_mmio + PHY_MODE4); |
2535 | writel(tmp, port_mmio + PHY_MODE3); | ||
2536 | } | 2578 | } |
2579 | /* | ||
2580 | * Workaround for 60x1-B2 errata SATA#13: | ||
2581 | * Any write to PHY_MODE4 (above) may corrupt PHY_MODE3, | ||
2582 | * so we must always rewrite PHY_MODE3 after PHY_MODE4. | ||
2583 | */ | ||
2584 | writel(m3, port_mmio + PHY_MODE3); | ||
2537 | 2585 | ||
2538 | /* Revert values of pre-emphasis and signal amps to the saved ones */ | 2586 | /* Revert values of pre-emphasis and signal amps to the saved ones */ |
2539 | m2 = readl(port_mmio + PHY_MODE2); | 2587 | m2 = readl(port_mmio + PHY_MODE2); |
@@ -2728,6 +2776,7 @@ static int mv_hardreset(struct ata_link *link, unsigned int *class, | |||
2728 | 2776 | ||
2729 | rc = sata_link_hardreset(link, timing, deadline + extra, | 2777 | rc = sata_link_hardreset(link, timing, deadline + extra, |
2730 | &online, NULL); | 2778 | &online, NULL); |
2779 | rc = online ? -EAGAIN : rc; | ||
2731 | if (rc) | 2780 | if (rc) |
2732 | return rc; | 2781 | return rc; |
2733 | sata_scr_read(link, SCR_STATUS, &sstatus); | 2782 | sata_scr_read(link, SCR_STATUS, &sstatus); |
@@ -2744,32 +2793,18 @@ static int mv_hardreset(struct ata_link *link, unsigned int *class, | |||
2744 | 2793 | ||
2745 | static void mv_eh_freeze(struct ata_port *ap) | 2794 | static void mv_eh_freeze(struct ata_port *ap) |
2746 | { | 2795 | { |
2747 | struct mv_host_priv *hpriv = ap->host->private_data; | ||
2748 | unsigned int shift, hardport, port = ap->port_no; | ||
2749 | u32 main_irq_mask; | ||
2750 | |||
2751 | /* FIXME: handle coalescing completion events properly */ | ||
2752 | |||
2753 | mv_stop_edma(ap); | 2796 | mv_stop_edma(ap); |
2754 | MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport); | 2797 | mv_enable_port_irqs(ap, 0); |
2755 | |||
2756 | /* disable assertion of portN err, done events */ | ||
2757 | main_irq_mask = readl(hpriv->main_irq_mask_addr); | ||
2758 | main_irq_mask &= ~((DONE_IRQ | ERR_IRQ) << shift); | ||
2759 | writelfl(main_irq_mask, hpriv->main_irq_mask_addr); | ||
2760 | } | 2798 | } |
2761 | 2799 | ||
2762 | static void mv_eh_thaw(struct ata_port *ap) | 2800 | static void mv_eh_thaw(struct ata_port *ap) |
2763 | { | 2801 | { |
2764 | struct mv_host_priv *hpriv = ap->host->private_data; | 2802 | struct mv_host_priv *hpriv = ap->host->private_data; |
2765 | unsigned int shift, hardport, port = ap->port_no; | 2803 | unsigned int port = ap->port_no; |
2804 | unsigned int hardport = mv_hardport_from_port(port); | ||
2766 | void __iomem *hc_mmio = mv_hc_base_from_port(hpriv->base, port); | 2805 | void __iomem *hc_mmio = mv_hc_base_from_port(hpriv->base, port); |
2767 | void __iomem *port_mmio = mv_ap_base(ap); | 2806 | void __iomem *port_mmio = mv_ap_base(ap); |
2768 | u32 main_irq_mask, hc_irq_cause; | 2807 | u32 hc_irq_cause; |
2769 | |||
2770 | /* FIXME: handle coalescing completion events properly */ | ||
2771 | |||
2772 | MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport); | ||
2773 | 2808 | ||
2774 | /* clear EDMA errors on this port */ | 2809 | /* clear EDMA errors on this port */ |
2775 | writel(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); | 2810 | writel(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); |
@@ -2779,10 +2814,7 @@ static void mv_eh_thaw(struct ata_port *ap) | |||
2779 | hc_irq_cause &= ~((DEV_IRQ | DMA_IRQ) << hardport); | 2814 | hc_irq_cause &= ~((DEV_IRQ | DMA_IRQ) << hardport); |
2780 | writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS); | 2815 | writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS); |
2781 | 2816 | ||
2782 | /* enable assertion of portN err, done events */ | 2817 | mv_enable_port_irqs(ap, ERR_IRQ); |
2783 | main_irq_mask = readl(hpriv->main_irq_mask_addr); | ||
2784 | main_irq_mask |= ((DONE_IRQ | ERR_IRQ) << shift); | ||
2785 | writelfl(main_irq_mask, hpriv->main_irq_mask_addr); | ||
2786 | } | 2818 | } |
2787 | 2819 | ||
2788 | /** | 2820 | /** |
@@ -2840,7 +2872,7 @@ static unsigned int mv_in_pcix_mode(struct ata_host *host) | |||
2840 | void __iomem *mmio = hpriv->base; | 2872 | void __iomem *mmio = hpriv->base; |
2841 | u32 reg; | 2873 | u32 reg; |
2842 | 2874 | ||
2843 | if (!HAS_PCI(host) || !IS_PCIE(hpriv)) | 2875 | if (IS_SOC(hpriv) || !IS_PCIE(hpriv)) |
2844 | return 0; /* not PCI-X capable */ | 2876 | return 0; /* not PCI-X capable */ |
2845 | reg = readl(mmio + MV_PCI_MODE_OFS); | 2877 | reg = readl(mmio + MV_PCI_MODE_OFS); |
2846 | if ((reg & MV_PCI_MODE_MASK) == 0) | 2878 | if ((reg & MV_PCI_MODE_MASK) == 0) |
@@ -2967,10 +2999,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx) | |||
2967 | hp_flags |= MV_HP_CUT_THROUGH; | 2999 | hp_flags |= MV_HP_CUT_THROUGH; |
2968 | 3000 | ||
2969 | switch (pdev->revision) { | 3001 | switch (pdev->revision) { |
2970 | case 0x0: | 3002 | case 0x2: /* Rev.B0: the first/only public release */ |
2971 | hp_flags |= MV_HP_ERRATA_XX42A0; | ||
2972 | break; | ||
2973 | case 0x1: | ||
2974 | hp_flags |= MV_HP_ERRATA_60X1C0; | 3003 | hp_flags |= MV_HP_ERRATA_60X1C0; |
2975 | break; | 3004 | break; |
2976 | default: | 3005 | default: |
@@ -2982,7 +3011,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx) | |||
2982 | break; | 3011 | break; |
2983 | case chip_soc: | 3012 | case chip_soc: |
2984 | hpriv->ops = &mv_soc_ops; | 3013 | hpriv->ops = &mv_soc_ops; |
2985 | hp_flags |= MV_HP_ERRATA_60X1C0; | 3014 | hp_flags |= MV_HP_FLAG_SOC | MV_HP_ERRATA_60X1C0; |
2986 | break; | 3015 | break; |
2987 | 3016 | ||
2988 | default: | 3017 | default: |
@@ -3026,16 +3055,16 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx) | |||
3026 | if (rc) | 3055 | if (rc) |
3027 | goto done; | 3056 | goto done; |
3028 | 3057 | ||
3029 | if (HAS_PCI(host)) { | 3058 | if (IS_SOC(hpriv)) { |
3030 | hpriv->main_irq_cause_addr = mmio + PCI_HC_MAIN_IRQ_CAUSE_OFS; | ||
3031 | hpriv->main_irq_mask_addr = mmio + PCI_HC_MAIN_IRQ_MASK_OFS; | ||
3032 | } else { | ||
3033 | hpriv->main_irq_cause_addr = mmio + SOC_HC_MAIN_IRQ_CAUSE_OFS; | 3059 | hpriv->main_irq_cause_addr = mmio + SOC_HC_MAIN_IRQ_CAUSE_OFS; |
3034 | hpriv->main_irq_mask_addr = mmio + SOC_HC_MAIN_IRQ_MASK_OFS; | 3060 | hpriv->main_irq_mask_addr = mmio + SOC_HC_MAIN_IRQ_MASK_OFS; |
3061 | } else { | ||
3062 | hpriv->main_irq_cause_addr = mmio + PCI_HC_MAIN_IRQ_CAUSE_OFS; | ||
3063 | hpriv->main_irq_mask_addr = mmio + PCI_HC_MAIN_IRQ_MASK_OFS; | ||
3035 | } | 3064 | } |
3036 | 3065 | ||
3037 | /* global interrupt mask: 0 == mask everything */ | 3066 | /* global interrupt mask: 0 == mask everything */ |
3038 | writel(0, hpriv->main_irq_mask_addr); | 3067 | mv_set_main_irq_mask(host, ~0, 0); |
3039 | 3068 | ||
3040 | n_hc = mv_get_hc_count(host->ports[0]->flags); | 3069 | n_hc = mv_get_hc_count(host->ports[0]->flags); |
3041 | 3070 | ||
@@ -3057,7 +3086,7 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx) | |||
3057 | mv_port_init(&ap->ioaddr, port_mmio); | 3086 | mv_port_init(&ap->ioaddr, port_mmio); |
3058 | 3087 | ||
3059 | #ifdef CONFIG_PCI | 3088 | #ifdef CONFIG_PCI |
3060 | if (HAS_PCI(host)) { | 3089 | if (!IS_SOC(hpriv)) { |
3061 | unsigned int offset = port_mmio - mmio; | 3090 | unsigned int offset = port_mmio - mmio; |
3062 | ata_port_pbar_desc(ap, MV_PRIMARY_BAR, -1, "mmio"); | 3091 | ata_port_pbar_desc(ap, MV_PRIMARY_BAR, -1, "mmio"); |
3063 | ata_port_pbar_desc(ap, MV_PRIMARY_BAR, offset, "port"); | 3092 | ata_port_pbar_desc(ap, MV_PRIMARY_BAR, offset, "port"); |
@@ -3077,31 +3106,18 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx) | |||
3077 | writelfl(0, hc_mmio + HC_IRQ_CAUSE_OFS); | 3106 | writelfl(0, hc_mmio + HC_IRQ_CAUSE_OFS); |
3078 | } | 3107 | } |
3079 | 3108 | ||
3080 | if (HAS_PCI(host)) { | 3109 | if (!IS_SOC(hpriv)) { |
3081 | /* Clear any currently outstanding host interrupt conditions */ | 3110 | /* Clear any currently outstanding host interrupt conditions */ |
3082 | writelfl(0, mmio + hpriv->irq_cause_ofs); | 3111 | writelfl(0, mmio + hpriv->irq_cause_ofs); |
3083 | 3112 | ||
3084 | /* and unmask interrupt generation for host regs */ | 3113 | /* and unmask interrupt generation for host regs */ |
3085 | writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); | 3114 | writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); |
3086 | if (IS_GEN_I(hpriv)) | 3115 | |
3087 | writelfl(~HC_MAIN_MASKED_IRQS_5, | 3116 | /* |
3088 | hpriv->main_irq_mask_addr); | 3117 | * enable only global host interrupts for now. |
3089 | else | 3118 | * The per-port interrupts get done later as ports are set up. |
3090 | writelfl(~HC_MAIN_MASKED_IRQS, | 3119 | */ |
3091 | hpriv->main_irq_mask_addr); | 3120 | mv_set_main_irq_mask(host, 0, PCI_ERR); |
3092 | |||
3093 | VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x " | ||
3094 | "PCI int cause/mask=0x%08x/0x%08x\n", | ||
3095 | readl(hpriv->main_irq_cause_addr), | ||
3096 | readl(hpriv->main_irq_mask_addr), | ||
3097 | readl(mmio + hpriv->irq_cause_ofs), | ||
3098 | readl(mmio + hpriv->irq_mask_ofs)); | ||
3099 | } else { | ||
3100 | writelfl(~HC_MAIN_MASKED_IRQS_SOC, | ||
3101 | hpriv->main_irq_mask_addr); | ||
3102 | VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x\n", | ||
3103 | readl(hpriv->main_irq_cause_addr), | ||
3104 | readl(hpriv->main_irq_mask_addr)); | ||
3105 | } | 3121 | } |
3106 | done: | 3122 | done: |
3107 | return rc; | 3123 | return rc; |
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index 5a10dc5048ad..030665ba76b7 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c | |||
@@ -53,7 +53,15 @@ enum { | |||
53 | PDC_MMIO_BAR = 3, | 53 | PDC_MMIO_BAR = 3, |
54 | PDC_MAX_PRD = LIBATA_MAX_PRD - 1, /* -1 for ASIC PRD bug workaround */ | 54 | PDC_MAX_PRD = LIBATA_MAX_PRD - 1, /* -1 for ASIC PRD bug workaround */ |
55 | 55 | ||
56 | /* register offsets */ | 56 | /* host register offsets (from host->iomap[PDC_MMIO_BAR]) */ |
57 | PDC_INT_SEQMASK = 0x40, /* Mask of asserted SEQ INTs */ | ||
58 | PDC_FLASH_CTL = 0x44, /* Flash control register */ | ||
59 | PDC_SATA_PLUG_CSR = 0x6C, /* SATA Plug control/status reg */ | ||
60 | PDC2_SATA_PLUG_CSR = 0x60, /* SATAII Plug control/status reg */ | ||
61 | PDC_TBG_MODE = 0x41C, /* TBG mode (not SATAII) */ | ||
62 | PDC_SLEW_CTL = 0x470, /* slew rate control reg (not SATAII) */ | ||
63 | |||
64 | /* per-port ATA register offsets (from ap->ioaddr.cmd_addr) */ | ||
57 | PDC_FEATURE = 0x04, /* Feature/Error reg (per port) */ | 65 | PDC_FEATURE = 0x04, /* Feature/Error reg (per port) */ |
58 | PDC_SECTOR_COUNT = 0x08, /* Sector count reg (per port) */ | 66 | PDC_SECTOR_COUNT = 0x08, /* Sector count reg (per port) */ |
59 | PDC_SECTOR_NUMBER = 0x0C, /* Sector number reg (per port) */ | 67 | PDC_SECTOR_NUMBER = 0x0C, /* Sector number reg (per port) */ |
@@ -63,14 +71,11 @@ enum { | |||
63 | PDC_COMMAND = 0x1C, /* Command/status reg (per port) */ | 71 | PDC_COMMAND = 0x1C, /* Command/status reg (per port) */ |
64 | PDC_ALTSTATUS = 0x38, /* Alternate-status/device-control reg (per port) */ | 72 | PDC_ALTSTATUS = 0x38, /* Alternate-status/device-control reg (per port) */ |
65 | PDC_PKT_SUBMIT = 0x40, /* Command packet pointer addr */ | 73 | PDC_PKT_SUBMIT = 0x40, /* Command packet pointer addr */ |
66 | PDC_INT_SEQMASK = 0x40, /* Mask of asserted SEQ INTs */ | ||
67 | PDC_FLASH_CTL = 0x44, /* Flash control register */ | ||
68 | PDC_GLOBAL_CTL = 0x48, /* Global control/status (per port) */ | 74 | PDC_GLOBAL_CTL = 0x48, /* Global control/status (per port) */ |
69 | PDC_CTLSTAT = 0x60, /* IDE control and status (per port) */ | 75 | PDC_CTLSTAT = 0x60, /* IDE control and status (per port) */ |
70 | PDC_SATA_PLUG_CSR = 0x6C, /* SATA Plug control/status reg */ | 76 | |
71 | PDC2_SATA_PLUG_CSR = 0x60, /* SATAII Plug control/status reg */ | 77 | /* per-port SATA register offsets (from ap->ioaddr.scr_addr) */ |
72 | PDC_TBG_MODE = 0x41C, /* TBG mode (not SATAII) */ | 78 | PDC_PHYMODE4 = 0x14, |
73 | PDC_SLEW_CTL = 0x470, /* slew rate control reg (not SATAII) */ | ||
74 | 79 | ||
75 | /* PDC_GLOBAL_CTL bit definitions */ | 80 | /* PDC_GLOBAL_CTL bit definitions */ |
76 | PDC_PH_ERR = (1 << 8), /* PCI error while loading packet */ | 81 | PDC_PH_ERR = (1 << 8), /* PCI error while loading packet */ |
@@ -134,7 +139,7 @@ struct pdc_port_priv { | |||
134 | 139 | ||
135 | static int pdc_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); | 140 | static int pdc_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); |
136 | static int pdc_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); | 141 | static int pdc_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); |
137 | static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); | 142 | static int pdc_ata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
138 | static int pdc_common_port_start(struct ata_port *ap); | 143 | static int pdc_common_port_start(struct ata_port *ap); |
139 | static int pdc_sata_port_start(struct ata_port *ap); | 144 | static int pdc_sata_port_start(struct ata_port *ap); |
140 | static void pdc_qc_prep(struct ata_queued_cmd *qc); | 145 | static void pdc_qc_prep(struct ata_queued_cmd *qc); |
@@ -332,12 +337,12 @@ static int pdc_sata_port_start(struct ata_port *ap) | |||
332 | 337 | ||
333 | /* fix up PHYMODE4 align timing */ | 338 | /* fix up PHYMODE4 align timing */ |
334 | if (ap->flags & PDC_FLAG_GEN_II) { | 339 | if (ap->flags & PDC_FLAG_GEN_II) { |
335 | void __iomem *mmio = ap->ioaddr.scr_addr; | 340 | void __iomem *sata_mmio = ap->ioaddr.scr_addr; |
336 | unsigned int tmp; | 341 | unsigned int tmp; |
337 | 342 | ||
338 | tmp = readl(mmio + 0x014); | 343 | tmp = readl(sata_mmio + PDC_PHYMODE4); |
339 | tmp = (tmp & ~3) | 1; /* set bits 1:0 = 0:1 */ | 344 | tmp = (tmp & ~3) | 1; /* set bits 1:0 = 0:1 */ |
340 | writel(tmp, mmio + 0x014); | 345 | writel(tmp, sata_mmio + PDC_PHYMODE4); |
341 | } | 346 | } |
342 | 347 | ||
343 | return 0; | 348 | return 0; |
@@ -345,32 +350,32 @@ static int pdc_sata_port_start(struct ata_port *ap) | |||
345 | 350 | ||
346 | static void pdc_reset_port(struct ata_port *ap) | 351 | static void pdc_reset_port(struct ata_port *ap) |
347 | { | 352 | { |
348 | void __iomem *mmio = ap->ioaddr.cmd_addr + PDC_CTLSTAT; | 353 | void __iomem *ata_ctlstat_mmio = ap->ioaddr.cmd_addr + PDC_CTLSTAT; |
349 | unsigned int i; | 354 | unsigned int i; |
350 | u32 tmp; | 355 | u32 tmp; |
351 | 356 | ||
352 | for (i = 11; i > 0; i--) { | 357 | for (i = 11; i > 0; i--) { |
353 | tmp = readl(mmio); | 358 | tmp = readl(ata_ctlstat_mmio); |
354 | if (tmp & PDC_RESET) | 359 | if (tmp & PDC_RESET) |
355 | break; | 360 | break; |
356 | 361 | ||
357 | udelay(100); | 362 | udelay(100); |
358 | 363 | ||
359 | tmp |= PDC_RESET; | 364 | tmp |= PDC_RESET; |
360 | writel(tmp, mmio); | 365 | writel(tmp, ata_ctlstat_mmio); |
361 | } | 366 | } |
362 | 367 | ||
363 | tmp &= ~PDC_RESET; | 368 | tmp &= ~PDC_RESET; |
364 | writel(tmp, mmio); | 369 | writel(tmp, ata_ctlstat_mmio); |
365 | readl(mmio); /* flush */ | 370 | readl(ata_ctlstat_mmio); /* flush */ |
366 | } | 371 | } |
367 | 372 | ||
368 | static int pdc_pata_cable_detect(struct ata_port *ap) | 373 | static int pdc_pata_cable_detect(struct ata_port *ap) |
369 | { | 374 | { |
370 | u8 tmp; | 375 | u8 tmp; |
371 | void __iomem *mmio = ap->ioaddr.cmd_addr + PDC_CTLSTAT + 0x03; | 376 | void __iomem *ata_mmio = ap->ioaddr.cmd_addr; |
372 | 377 | ||
373 | tmp = readb(mmio); | 378 | tmp = readb(ata_mmio + PDC_CTLSTAT + 3); |
374 | if (tmp & 0x01) | 379 | if (tmp & 0x01) |
375 | return ATA_CBL_PATA40; | 380 | return ATA_CBL_PATA40; |
376 | return ATA_CBL_PATA80; | 381 | return ATA_CBL_PATA80; |
@@ -557,31 +562,25 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc) | |||
557 | switch (qc->tf.protocol) { | 562 | switch (qc->tf.protocol) { |
558 | case ATA_PROT_DMA: | 563 | case ATA_PROT_DMA: |
559 | pdc_fill_sg(qc); | 564 | pdc_fill_sg(qc); |
560 | /* fall through */ | 565 | /*FALLTHROUGH*/ |
561 | |||
562 | case ATA_PROT_NODATA: | 566 | case ATA_PROT_NODATA: |
563 | i = pdc_pkt_header(&qc->tf, qc->ap->prd_dma, | 567 | i = pdc_pkt_header(&qc->tf, qc->ap->prd_dma, |
564 | qc->dev->devno, pp->pkt); | 568 | qc->dev->devno, pp->pkt); |
565 | |||
566 | if (qc->tf.flags & ATA_TFLAG_LBA48) | 569 | if (qc->tf.flags & ATA_TFLAG_LBA48) |
567 | i = pdc_prep_lba48(&qc->tf, pp->pkt, i); | 570 | i = pdc_prep_lba48(&qc->tf, pp->pkt, i); |
568 | else | 571 | else |
569 | i = pdc_prep_lba28(&qc->tf, pp->pkt, i); | 572 | i = pdc_prep_lba28(&qc->tf, pp->pkt, i); |
570 | |||
571 | pdc_pkt_footer(&qc->tf, pp->pkt, i); | 573 | pdc_pkt_footer(&qc->tf, pp->pkt, i); |
572 | break; | 574 | break; |
573 | |||
574 | case ATAPI_PROT_PIO: | 575 | case ATAPI_PROT_PIO: |
575 | pdc_fill_sg(qc); | 576 | pdc_fill_sg(qc); |
576 | break; | 577 | break; |
577 | |||
578 | case ATAPI_PROT_DMA: | 578 | case ATAPI_PROT_DMA: |
579 | pdc_fill_sg(qc); | 579 | pdc_fill_sg(qc); |
580 | /*FALLTHROUGH*/ | 580 | /*FALLTHROUGH*/ |
581 | case ATAPI_PROT_NODATA: | 581 | case ATAPI_PROT_NODATA: |
582 | pdc_atapi_pkt(qc); | 582 | pdc_atapi_pkt(qc); |
583 | break; | 583 | break; |
584 | |||
585 | default: | 584 | default: |
586 | break; | 585 | break; |
587 | } | 586 | } |
@@ -611,7 +610,7 @@ static unsigned int pdc_sata_ata_port_to_ata_no(const struct ata_port *ap) | |||
611 | unsigned int nr_ports = pdc_sata_nr_ports(ap); | 610 | unsigned int nr_ports = pdc_sata_nr_ports(ap); |
612 | unsigned int i; | 611 | unsigned int i; |
613 | 612 | ||
614 | for(i = 0; i < nr_ports && host->ports[i] != ap; ++i) | 613 | for (i = 0; i < nr_ports && host->ports[i] != ap; ++i) |
615 | ; | 614 | ; |
616 | BUG_ON(i >= nr_ports); | 615 | BUG_ON(i >= nr_ports); |
617 | return pdc_port_no_to_ata_no(i, pdc_is_sataii_tx4(ap->flags)); | 616 | return pdc_port_no_to_ata_no(i, pdc_is_sataii_tx4(ap->flags)); |
@@ -624,14 +623,14 @@ static unsigned int pdc_sata_hotplug_offset(const struct ata_port *ap) | |||
624 | 623 | ||
625 | static void pdc_freeze(struct ata_port *ap) | 624 | static void pdc_freeze(struct ata_port *ap) |
626 | { | 625 | { |
627 | void __iomem *mmio = ap->ioaddr.cmd_addr; | 626 | void __iomem *ata_mmio = ap->ioaddr.cmd_addr; |
628 | u32 tmp; | 627 | u32 tmp; |
629 | 628 | ||
630 | tmp = readl(mmio + PDC_CTLSTAT); | 629 | tmp = readl(ata_mmio + PDC_CTLSTAT); |
631 | tmp |= PDC_IRQ_DISABLE; | 630 | tmp |= PDC_IRQ_DISABLE; |
632 | tmp &= ~PDC_DMA_ENABLE; | 631 | tmp &= ~PDC_DMA_ENABLE; |
633 | writel(tmp, mmio + PDC_CTLSTAT); | 632 | writel(tmp, ata_mmio + PDC_CTLSTAT); |
634 | readl(mmio + PDC_CTLSTAT); /* flush */ | 633 | readl(ata_mmio + PDC_CTLSTAT); /* flush */ |
635 | } | 634 | } |
636 | 635 | ||
637 | static void pdc_sata_freeze(struct ata_port *ap) | 636 | static void pdc_sata_freeze(struct ata_port *ap) |
@@ -659,17 +658,17 @@ static void pdc_sata_freeze(struct ata_port *ap) | |||
659 | 658 | ||
660 | static void pdc_thaw(struct ata_port *ap) | 659 | static void pdc_thaw(struct ata_port *ap) |
661 | { | 660 | { |
662 | void __iomem *mmio = ap->ioaddr.cmd_addr; | 661 | void __iomem *ata_mmio = ap->ioaddr.cmd_addr; |
663 | u32 tmp; | 662 | u32 tmp; |
664 | 663 | ||
665 | /* clear IRQ */ | 664 | /* clear IRQ */ |
666 | readl(mmio + PDC_INT_SEQMASK); | 665 | readl(ata_mmio + PDC_COMMAND); |
667 | 666 | ||
668 | /* turn IRQ back on */ | 667 | /* turn IRQ back on */ |
669 | tmp = readl(mmio + PDC_CTLSTAT); | 668 | tmp = readl(ata_mmio + PDC_CTLSTAT); |
670 | tmp &= ~PDC_IRQ_DISABLE; | 669 | tmp &= ~PDC_IRQ_DISABLE; |
671 | writel(tmp, mmio + PDC_CTLSTAT); | 670 | writel(tmp, ata_mmio + PDC_CTLSTAT); |
672 | readl(mmio + PDC_CTLSTAT); /* flush */ | 671 | readl(ata_mmio + PDC_CTLSTAT); /* flush */ |
673 | } | 672 | } |
674 | 673 | ||
675 | static void pdc_sata_thaw(struct ata_port *ap) | 674 | static void pdc_sata_thaw(struct ata_port *ap) |
@@ -743,11 +742,11 @@ static void pdc_error_intr(struct ata_port *ap, struct ata_queued_cmd *qc, | |||
743 | ata_port_abort(ap); | 742 | ata_port_abort(ap); |
744 | } | 743 | } |
745 | 744 | ||
746 | static inline unsigned int pdc_host_intr(struct ata_port *ap, | 745 | static unsigned int pdc_host_intr(struct ata_port *ap, |
747 | struct ata_queued_cmd *qc) | 746 | struct ata_queued_cmd *qc) |
748 | { | 747 | { |
749 | unsigned int handled = 0; | 748 | unsigned int handled = 0; |
750 | void __iomem *port_mmio = ap->ioaddr.cmd_addr; | 749 | void __iomem *ata_mmio = ap->ioaddr.cmd_addr; |
751 | u32 port_status, err_mask; | 750 | u32 port_status, err_mask; |
752 | 751 | ||
753 | err_mask = PDC_ERR_MASK; | 752 | err_mask = PDC_ERR_MASK; |
@@ -755,7 +754,7 @@ static inline unsigned int pdc_host_intr(struct ata_port *ap, | |||
755 | err_mask &= ~PDC1_ERR_MASK; | 754 | err_mask &= ~PDC1_ERR_MASK; |
756 | else | 755 | else |
757 | err_mask &= ~PDC2_ERR_MASK; | 756 | err_mask &= ~PDC2_ERR_MASK; |
758 | port_status = readl(port_mmio + PDC_GLOBAL_CTL); | 757 | port_status = readl(ata_mmio + PDC_GLOBAL_CTL); |
759 | if (unlikely(port_status & err_mask)) { | 758 | if (unlikely(port_status & err_mask)) { |
760 | pdc_error_intr(ap, qc, port_status, err_mask); | 759 | pdc_error_intr(ap, qc, port_status, err_mask); |
761 | return 1; | 760 | return 1; |
@@ -770,7 +769,6 @@ static inline unsigned int pdc_host_intr(struct ata_port *ap, | |||
770 | ata_qc_complete(qc); | 769 | ata_qc_complete(qc); |
771 | handled = 1; | 770 | handled = 1; |
772 | break; | 771 | break; |
773 | |||
774 | default: | 772 | default: |
775 | ap->stats.idle_irq++; | 773 | ap->stats.idle_irq++; |
776 | break; | 774 | break; |
@@ -781,10 +779,9 @@ static inline unsigned int pdc_host_intr(struct ata_port *ap, | |||
781 | 779 | ||
782 | static void pdc_irq_clear(struct ata_port *ap) | 780 | static void pdc_irq_clear(struct ata_port *ap) |
783 | { | 781 | { |
784 | struct ata_host *host = ap->host; | 782 | void __iomem *ata_mmio = ap->ioaddr.cmd_addr; |
785 | void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; | ||
786 | 783 | ||
787 | readl(mmio + PDC_INT_SEQMASK); | 784 | readl(ata_mmio + PDC_COMMAND); |
788 | } | 785 | } |
789 | 786 | ||
790 | static irqreturn_t pdc_interrupt(int irq, void *dev_instance) | 787 | static irqreturn_t pdc_interrupt(int irq, void *dev_instance) |
@@ -794,7 +791,7 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance) | |||
794 | u32 mask = 0; | 791 | u32 mask = 0; |
795 | unsigned int i, tmp; | 792 | unsigned int i, tmp; |
796 | unsigned int handled = 0; | 793 | unsigned int handled = 0; |
797 | void __iomem *mmio_base; | 794 | void __iomem *host_mmio; |
798 | unsigned int hotplug_offset, ata_no; | 795 | unsigned int hotplug_offset, ata_no; |
799 | u32 hotplug_status; | 796 | u32 hotplug_status; |
800 | int is_sataii_tx4; | 797 | int is_sataii_tx4; |
@@ -806,7 +803,7 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance) | |||
806 | return IRQ_NONE; | 803 | return IRQ_NONE; |
807 | } | 804 | } |
808 | 805 | ||
809 | mmio_base = host->iomap[PDC_MMIO_BAR]; | 806 | host_mmio = host->iomap[PDC_MMIO_BAR]; |
810 | 807 | ||
811 | spin_lock(&host->lock); | 808 | spin_lock(&host->lock); |
812 | 809 | ||
@@ -815,26 +812,26 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance) | |||
815 | hotplug_offset = PDC2_SATA_PLUG_CSR; | 812 | hotplug_offset = PDC2_SATA_PLUG_CSR; |
816 | else | 813 | else |
817 | hotplug_offset = PDC_SATA_PLUG_CSR; | 814 | hotplug_offset = PDC_SATA_PLUG_CSR; |
818 | hotplug_status = readl(mmio_base + hotplug_offset); | 815 | hotplug_status = readl(host_mmio + hotplug_offset); |
819 | if (hotplug_status & 0xff) | 816 | if (hotplug_status & 0xff) |
820 | writel(hotplug_status | 0xff, mmio_base + hotplug_offset); | 817 | writel(hotplug_status | 0xff, host_mmio + hotplug_offset); |
821 | hotplug_status &= 0xff; /* clear uninteresting bits */ | 818 | hotplug_status &= 0xff; /* clear uninteresting bits */ |
822 | 819 | ||
823 | /* reading should also clear interrupts */ | 820 | /* reading should also clear interrupts */ |
824 | mask = readl(mmio_base + PDC_INT_SEQMASK); | 821 | mask = readl(host_mmio + PDC_INT_SEQMASK); |
825 | 822 | ||
826 | if (mask == 0xffffffff && hotplug_status == 0) { | 823 | if (mask == 0xffffffff && hotplug_status == 0) { |
827 | VPRINTK("QUICK EXIT 2\n"); | 824 | VPRINTK("QUICK EXIT 2\n"); |
828 | goto done_irq; | 825 | goto done_irq; |
829 | } | 826 | } |
830 | 827 | ||
831 | mask &= 0xffff; /* only 16 tags possible */ | 828 | mask &= 0xffff; /* only 16 SEQIDs possible */ |
832 | if (mask == 0 && hotplug_status == 0) { | 829 | if (mask == 0 && hotplug_status == 0) { |
833 | VPRINTK("QUICK EXIT 3\n"); | 830 | VPRINTK("QUICK EXIT 3\n"); |
834 | goto done_irq; | 831 | goto done_irq; |
835 | } | 832 | } |
836 | 833 | ||
837 | writel(mask, mmio_base + PDC_INT_SEQMASK); | 834 | writel(mask, host_mmio + PDC_INT_SEQMASK); |
838 | 835 | ||
839 | is_sataii_tx4 = pdc_is_sataii_tx4(host->ports[0]->flags); | 836 | is_sataii_tx4 = pdc_is_sataii_tx4(host->ports[0]->flags); |
840 | 837 | ||
@@ -875,23 +872,24 @@ done_irq: | |||
875 | return IRQ_RETVAL(handled); | 872 | return IRQ_RETVAL(handled); |
876 | } | 873 | } |
877 | 874 | ||
878 | static inline void pdc_packet_start(struct ata_queued_cmd *qc) | 875 | static void pdc_packet_start(struct ata_queued_cmd *qc) |
879 | { | 876 | { |
880 | struct ata_port *ap = qc->ap; | 877 | struct ata_port *ap = qc->ap; |
881 | struct pdc_port_priv *pp = ap->private_data; | 878 | struct pdc_port_priv *pp = ap->private_data; |
882 | void __iomem *mmio = ap->host->iomap[PDC_MMIO_BAR]; | 879 | void __iomem *host_mmio = ap->host->iomap[PDC_MMIO_BAR]; |
880 | void __iomem *ata_mmio = ap->ioaddr.cmd_addr; | ||
883 | unsigned int port_no = ap->port_no; | 881 | unsigned int port_no = ap->port_no; |
884 | u8 seq = (u8) (port_no + 1); | 882 | u8 seq = (u8) (port_no + 1); |
885 | 883 | ||
886 | VPRINTK("ENTER, ap %p\n", ap); | 884 | VPRINTK("ENTER, ap %p\n", ap); |
887 | 885 | ||
888 | writel(0x00000001, mmio + (seq * 4)); | 886 | writel(0x00000001, host_mmio + (seq * 4)); |
889 | readl(mmio + (seq * 4)); /* flush */ | 887 | readl(host_mmio + (seq * 4)); /* flush */ |
890 | 888 | ||
891 | pp->pkt[2] = seq; | 889 | pp->pkt[2] = seq; |
892 | wmb(); /* flush PRD, pkt writes */ | 890 | wmb(); /* flush PRD, pkt writes */ |
893 | writel(pp->pkt_dma, ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); | 891 | writel(pp->pkt_dma, ata_mmio + PDC_PKT_SUBMIT); |
894 | readl(ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT); /* flush */ | 892 | readl(ata_mmio + PDC_PKT_SUBMIT); /* flush */ |
895 | } | 893 | } |
896 | 894 | ||
897 | static unsigned int pdc_qc_issue(struct ata_queued_cmd *qc) | 895 | static unsigned int pdc_qc_issue(struct ata_queued_cmd *qc) |
@@ -909,11 +907,9 @@ static unsigned int pdc_qc_issue(struct ata_queued_cmd *qc) | |||
909 | case ATA_PROT_DMA: | 907 | case ATA_PROT_DMA: |
910 | pdc_packet_start(qc); | 908 | pdc_packet_start(qc); |
911 | return 0; | 909 | return 0; |
912 | |||
913 | default: | 910 | default: |
914 | break; | 911 | break; |
915 | } | 912 | } |
916 | |||
917 | return ata_sff_qc_issue(qc); | 913 | return ata_sff_qc_issue(qc); |
918 | } | 914 | } |
919 | 915 | ||
@@ -987,7 +983,7 @@ static void pdc_ata_setup_port(struct ata_port *ap, | |||
987 | 983 | ||
988 | static void pdc_host_init(struct ata_host *host) | 984 | static void pdc_host_init(struct ata_host *host) |
989 | { | 985 | { |
990 | void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; | 986 | void __iomem *host_mmio = host->iomap[PDC_MMIO_BAR]; |
991 | int is_gen2 = host->ports[0]->flags & PDC_FLAG_GEN_II; | 987 | int is_gen2 = host->ports[0]->flags & PDC_FLAG_GEN_II; |
992 | int hotplug_offset; | 988 | int hotplug_offset; |
993 | u32 tmp; | 989 | u32 tmp; |
@@ -1004,38 +1000,38 @@ static void pdc_host_init(struct ata_host *host) | |||
1004 | */ | 1000 | */ |
1005 | 1001 | ||
1006 | /* enable BMR_BURST, maybe change FIFO_SHD to 8 dwords */ | 1002 | /* enable BMR_BURST, maybe change FIFO_SHD to 8 dwords */ |
1007 | tmp = readl(mmio + PDC_FLASH_CTL); | 1003 | tmp = readl(host_mmio + PDC_FLASH_CTL); |
1008 | tmp |= 0x02000; /* bit 13 (enable bmr burst) */ | 1004 | tmp |= 0x02000; /* bit 13 (enable bmr burst) */ |
1009 | if (!is_gen2) | 1005 | if (!is_gen2) |
1010 | tmp |= 0x10000; /* bit 16 (fifo threshold at 8 dw) */ | 1006 | tmp |= 0x10000; /* bit 16 (fifo threshold at 8 dw) */ |
1011 | writel(tmp, mmio + PDC_FLASH_CTL); | 1007 | writel(tmp, host_mmio + PDC_FLASH_CTL); |
1012 | 1008 | ||
1013 | /* clear plug/unplug flags for all ports */ | 1009 | /* clear plug/unplug flags for all ports */ |
1014 | tmp = readl(mmio + hotplug_offset); | 1010 | tmp = readl(host_mmio + hotplug_offset); |
1015 | writel(tmp | 0xff, mmio + hotplug_offset); | 1011 | writel(tmp | 0xff, host_mmio + hotplug_offset); |
1016 | 1012 | ||
1017 | /* unmask plug/unplug ints */ | 1013 | /* unmask plug/unplug ints */ |
1018 | tmp = readl(mmio + hotplug_offset); | 1014 | tmp = readl(host_mmio + hotplug_offset); |
1019 | writel(tmp & ~0xff0000, mmio + hotplug_offset); | 1015 | writel(tmp & ~0xff0000, host_mmio + hotplug_offset); |
1020 | 1016 | ||
1021 | /* don't initialise TBG or SLEW on 2nd generation chips */ | 1017 | /* don't initialise TBG or SLEW on 2nd generation chips */ |
1022 | if (is_gen2) | 1018 | if (is_gen2) |
1023 | return; | 1019 | return; |
1024 | 1020 | ||
1025 | /* reduce TBG clock to 133 Mhz. */ | 1021 | /* reduce TBG clock to 133 Mhz. */ |
1026 | tmp = readl(mmio + PDC_TBG_MODE); | 1022 | tmp = readl(host_mmio + PDC_TBG_MODE); |
1027 | tmp &= ~0x30000; /* clear bit 17, 16*/ | 1023 | tmp &= ~0x30000; /* clear bit 17, 16*/ |
1028 | tmp |= 0x10000; /* set bit 17:16 = 0:1 */ | 1024 | tmp |= 0x10000; /* set bit 17:16 = 0:1 */ |
1029 | writel(tmp, mmio + PDC_TBG_MODE); | 1025 | writel(tmp, host_mmio + PDC_TBG_MODE); |
1030 | 1026 | ||
1031 | readl(mmio + PDC_TBG_MODE); /* flush */ | 1027 | readl(host_mmio + PDC_TBG_MODE); /* flush */ |
1032 | msleep(10); | 1028 | msleep(10); |
1033 | 1029 | ||
1034 | /* adjust slew rate control register. */ | 1030 | /* adjust slew rate control register. */ |
1035 | tmp = readl(mmio + PDC_SLEW_CTL); | 1031 | tmp = readl(host_mmio + PDC_SLEW_CTL); |
1036 | tmp &= 0xFFFFF03F; /* clear bit 11 ~ 6 */ | 1032 | tmp &= 0xFFFFF03F; /* clear bit 11 ~ 6 */ |
1037 | tmp |= 0x00000900; /* set bit 11-9 = 100b , bit 8-6 = 100 */ | 1033 | tmp |= 0x00000900; /* set bit 11-9 = 100b , bit 8-6 = 100 */ |
1038 | writel(tmp, mmio + PDC_SLEW_CTL); | 1034 | writel(tmp, host_mmio + PDC_SLEW_CTL); |
1039 | } | 1035 | } |
1040 | 1036 | ||
1041 | static int pdc_ata_init_one(struct pci_dev *pdev, | 1037 | static int pdc_ata_init_one(struct pci_dev *pdev, |
@@ -1045,7 +1041,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev, | |||
1045 | const struct ata_port_info *pi = &pdc_port_info[ent->driver_data]; | 1041 | const struct ata_port_info *pi = &pdc_port_info[ent->driver_data]; |
1046 | const struct ata_port_info *ppi[PDC_MAX_PORTS]; | 1042 | const struct ata_port_info *ppi[PDC_MAX_PORTS]; |
1047 | struct ata_host *host; | 1043 | struct ata_host *host; |
1048 | void __iomem *base; | 1044 | void __iomem *host_mmio; |
1049 | int n_ports, i, rc; | 1045 | int n_ports, i, rc; |
1050 | int is_sataii_tx4; | 1046 | int is_sataii_tx4; |
1051 | 1047 | ||
@@ -1062,7 +1058,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev, | |||
1062 | pcim_pin_device(pdev); | 1058 | pcim_pin_device(pdev); |
1063 | if (rc) | 1059 | if (rc) |
1064 | return rc; | 1060 | return rc; |
1065 | base = pcim_iomap_table(pdev)[PDC_MMIO_BAR]; | 1061 | host_mmio = pcim_iomap_table(pdev)[PDC_MMIO_BAR]; |
1066 | 1062 | ||
1067 | /* determine port configuration and setup host */ | 1063 | /* determine port configuration and setup host */ |
1068 | n_ports = 2; | 1064 | n_ports = 2; |
@@ -1072,7 +1068,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev, | |||
1072 | ppi[i] = pi; | 1068 | ppi[i] = pi; |
1073 | 1069 | ||
1074 | if (pi->flags & PDC_FLAG_SATA_PATA) { | 1070 | if (pi->flags & PDC_FLAG_SATA_PATA) { |
1075 | u8 tmp = readb(base + PDC_FLASH_CTL+1); | 1071 | u8 tmp = readb(host_mmio + PDC_FLASH_CTL + 1); |
1076 | if (!(tmp & 0x80)) | 1072 | if (!(tmp & 0x80)) |
1077 | ppi[n_ports++] = pi + 1; | 1073 | ppi[n_ports++] = pi + 1; |
1078 | } | 1074 | } |
@@ -1088,13 +1084,13 @@ static int pdc_ata_init_one(struct pci_dev *pdev, | |||
1088 | for (i = 0; i < host->n_ports; i++) { | 1084 | for (i = 0; i < host->n_ports; i++) { |
1089 | struct ata_port *ap = host->ports[i]; | 1085 | struct ata_port *ap = host->ports[i]; |
1090 | unsigned int ata_no = pdc_port_no_to_ata_no(i, is_sataii_tx4); | 1086 | unsigned int ata_no = pdc_port_no_to_ata_no(i, is_sataii_tx4); |
1091 | unsigned int port_offset = 0x200 + ata_no * 0x80; | 1087 | unsigned int ata_offset = 0x200 + ata_no * 0x80; |
1092 | unsigned int scr_offset = 0x400 + ata_no * 0x100; | 1088 | unsigned int scr_offset = 0x400 + ata_no * 0x100; |
1093 | 1089 | ||
1094 | pdc_ata_setup_port(ap, base + port_offset, base + scr_offset); | 1090 | pdc_ata_setup_port(ap, host_mmio + ata_offset, host_mmio + scr_offset); |
1095 | 1091 | ||
1096 | ata_port_pbar_desc(ap, PDC_MMIO_BAR, -1, "mmio"); | 1092 | ata_port_pbar_desc(ap, PDC_MMIO_BAR, -1, "mmio"); |
1097 | ata_port_pbar_desc(ap, PDC_MMIO_BAR, port_offset, "port"); | 1093 | ata_port_pbar_desc(ap, PDC_MMIO_BAR, ata_offset, "ata"); |
1098 | } | 1094 | } |
1099 | 1095 | ||
1100 | /* initialize adapter */ | 1096 | /* initialize adapter */ |
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index 27a110110077..8ee6b5b4ede7 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -899,14 +899,25 @@ static bool sil24_qc_fill_rtf(struct ata_queued_cmd *qc) | |||
899 | 899 | ||
900 | static void sil24_pmp_attach(struct ata_port *ap) | 900 | static void sil24_pmp_attach(struct ata_port *ap) |
901 | { | 901 | { |
902 | u32 *gscr = ap->link.device->gscr; | ||
903 | |||
902 | sil24_config_pmp(ap, 1); | 904 | sil24_config_pmp(ap, 1); |
903 | sil24_init_port(ap); | 905 | sil24_init_port(ap); |
906 | |||
907 | if (sata_pmp_gscr_vendor(gscr) == 0x11ab && | ||
908 | sata_pmp_gscr_devid(gscr) == 0x4140) { | ||
909 | ata_port_printk(ap, KERN_INFO, | ||
910 | "disabling NCQ support due to sil24-mv4140 quirk\n"); | ||
911 | ap->flags &= ~ATA_FLAG_NCQ; | ||
912 | } | ||
904 | } | 913 | } |
905 | 914 | ||
906 | static void sil24_pmp_detach(struct ata_port *ap) | 915 | static void sil24_pmp_detach(struct ata_port *ap) |
907 | { | 916 | { |
908 | sil24_init_port(ap); | 917 | sil24_init_port(ap); |
909 | sil24_config_pmp(ap, 0); | 918 | sil24_config_pmp(ap, 0); |
919 | |||
920 | ap->flags |= ATA_FLAG_NCQ; | ||
910 | } | 921 | } |
911 | 922 | ||
912 | static int sil24_pmp_hardreset(struct ata_link *link, unsigned int *class, | 923 | static int sil24_pmp_hardreset(struct ata_link *link, unsigned int *class, |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 3eeac5a78581..422cfcad486d 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -760,6 +760,21 @@ static void device_remove_class_symlinks(struct device *dev) | |||
760 | } | 760 | } |
761 | 761 | ||
762 | /** | 762 | /** |
763 | * dev_set_name - set a device name | ||
764 | * @dev: device | ||
765 | */ | ||
766 | int dev_set_name(struct device *dev, const char *fmt, ...) | ||
767 | { | ||
768 | va_list vargs; | ||
769 | |||
770 | va_start(vargs, fmt); | ||
771 | vsnprintf(dev->bus_id, sizeof(dev->bus_id), fmt, vargs); | ||
772 | va_end(vargs); | ||
773 | return 0; | ||
774 | } | ||
775 | EXPORT_SYMBOL_GPL(dev_set_name); | ||
776 | |||
777 | /** | ||
763 | * device_add - add device to device hierarchy. | 778 | * device_add - add device to device hierarchy. |
764 | * @dev: device. | 779 | * @dev: device. |
765 | * | 780 | * |
@@ -1084,11 +1099,13 @@ static void device_create_release(struct device *dev) | |||
1084 | } | 1099 | } |
1085 | 1100 | ||
1086 | /** | 1101 | /** |
1087 | * device_create - creates a device and registers it with sysfs | 1102 | * device_create_vargs - creates a device and registers it with sysfs |
1088 | * @class: pointer to the struct class that this device should be registered to | 1103 | * @class: pointer to the struct class that this device should be registered to |
1089 | * @parent: pointer to the parent struct device of this new device, if any | 1104 | * @parent: pointer to the parent struct device of this new device, if any |
1090 | * @devt: the dev_t for the char device to be added | 1105 | * @devt: the dev_t for the char device to be added |
1106 | * @drvdata: the data to be added to the device for callbacks | ||
1091 | * @fmt: string for the device's name | 1107 | * @fmt: string for the device's name |
1108 | * @args: va_list for the device's name | ||
1092 | * | 1109 | * |
1093 | * This function can be used by char device classes. A struct device | 1110 | * This function can be used by char device classes. A struct device |
1094 | * will be created in sysfs, registered to the specified class. | 1111 | * will be created in sysfs, registered to the specified class. |
@@ -1104,10 +1121,10 @@ static void device_create_release(struct device *dev) | |||
1104 | * Note: the struct class passed to this function must have previously | 1121 | * Note: the struct class passed to this function must have previously |
1105 | * been created with a call to class_create(). | 1122 | * been created with a call to class_create(). |
1106 | */ | 1123 | */ |
1107 | struct device *device_create(struct class *class, struct device *parent, | 1124 | struct device *device_create_vargs(struct class *class, struct device *parent, |
1108 | dev_t devt, const char *fmt, ...) | 1125 | dev_t devt, void *drvdata, const char *fmt, |
1126 | va_list args) | ||
1109 | { | 1127 | { |
1110 | va_list args; | ||
1111 | struct device *dev = NULL; | 1128 | struct device *dev = NULL; |
1112 | int retval = -ENODEV; | 1129 | int retval = -ENODEV; |
1113 | 1130 | ||
@@ -1124,10 +1141,9 @@ struct device *device_create(struct class *class, struct device *parent, | |||
1124 | dev->class = class; | 1141 | dev->class = class; |
1125 | dev->parent = parent; | 1142 | dev->parent = parent; |
1126 | dev->release = device_create_release; | 1143 | dev->release = device_create_release; |
1144 | dev_set_drvdata(dev, drvdata); | ||
1127 | 1145 | ||
1128 | va_start(args, fmt); | ||
1129 | vsnprintf(dev->bus_id, BUS_ID_SIZE, fmt, args); | 1146 | vsnprintf(dev->bus_id, BUS_ID_SIZE, fmt, args); |
1130 | va_end(args); | ||
1131 | retval = device_register(dev); | 1147 | retval = device_register(dev); |
1132 | if (retval) | 1148 | if (retval) |
1133 | goto error; | 1149 | goto error; |
@@ -1138,6 +1154,78 @@ error: | |||
1138 | kfree(dev); | 1154 | kfree(dev); |
1139 | return ERR_PTR(retval); | 1155 | return ERR_PTR(retval); |
1140 | } | 1156 | } |
1157 | EXPORT_SYMBOL_GPL(device_create_vargs); | ||
1158 | |||
1159 | /** | ||
1160 | * device_create_drvdata - creates a device and registers it with sysfs | ||
1161 | * @class: pointer to the struct class that this device should be registered to | ||
1162 | * @parent: pointer to the parent struct device of this new device, if any | ||
1163 | * @devt: the dev_t for the char device to be added | ||
1164 | * @drvdata: the data to be added to the device for callbacks | ||
1165 | * @fmt: string for the device's name | ||
1166 | * | ||
1167 | * This function can be used by char device classes. A struct device | ||
1168 | * will be created in sysfs, registered to the specified class. | ||
1169 | * | ||
1170 | * A "dev" file will be created, showing the dev_t for the device, if | ||
1171 | * the dev_t is not 0,0. | ||
1172 | * If a pointer to a parent struct device is passed in, the newly created | ||
1173 | * struct device will be a child of that device in sysfs. | ||
1174 | * The pointer to the struct device will be returned from the call. | ||
1175 | * Any further sysfs files that might be required can be created using this | ||
1176 | * pointer. | ||
1177 | * | ||
1178 | * Note: the struct class passed to this function must have previously | ||
1179 | * been created with a call to class_create(). | ||
1180 | */ | ||
1181 | struct device *device_create_drvdata(struct class *class, | ||
1182 | struct device *parent, | ||
1183 | dev_t devt, | ||
1184 | void *drvdata, | ||
1185 | const char *fmt, ...) | ||
1186 | { | ||
1187 | va_list vargs; | ||
1188 | struct device *dev; | ||
1189 | |||
1190 | va_start(vargs, fmt); | ||
1191 | dev = device_create_vargs(class, parent, devt, drvdata, fmt, vargs); | ||
1192 | va_end(vargs); | ||
1193 | return dev; | ||
1194 | } | ||
1195 | EXPORT_SYMBOL_GPL(device_create_drvdata); | ||
1196 | |||
1197 | /** | ||
1198 | * device_create - creates a device and registers it with sysfs | ||
1199 | * @class: pointer to the struct class that this device should be registered to | ||
1200 | * @parent: pointer to the parent struct device of this new device, if any | ||
1201 | * @devt: the dev_t for the char device to be added | ||
1202 | * @fmt: string for the device's name | ||
1203 | * | ||
1204 | * This function can be used by char device classes. A struct device | ||
1205 | * will be created in sysfs, registered to the specified class. | ||
1206 | * | ||
1207 | * A "dev" file will be created, showing the dev_t for the device, if | ||
1208 | * the dev_t is not 0,0. | ||
1209 | * If a pointer to a parent struct device is passed in, the newly created | ||
1210 | * struct device will be a child of that device in sysfs. | ||
1211 | * The pointer to the struct device will be returned from the call. | ||
1212 | * Any further sysfs files that might be required can be created using this | ||
1213 | * pointer. | ||
1214 | * | ||
1215 | * Note: the struct class passed to this function must have previously | ||
1216 | * been created with a call to class_create(). | ||
1217 | */ | ||
1218 | struct device *device_create(struct class *class, struct device *parent, | ||
1219 | dev_t devt, const char *fmt, ...) | ||
1220 | { | ||
1221 | va_list vargs; | ||
1222 | struct device *dev; | ||
1223 | |||
1224 | va_start(vargs, fmt); | ||
1225 | dev = device_create_vargs(class, parent, devt, NULL, fmt, vargs); | ||
1226 | va_end(vargs); | ||
1227 | return dev; | ||
1228 | } | ||
1141 | EXPORT_SYMBOL_GPL(device_create); | 1229 | EXPORT_SYMBOL_GPL(device_create); |
1142 | 1230 | ||
1143 | static int __match_devt(struct device *dev, void *data) | 1231 | static int __match_devt(struct device *dev, void *data) |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 7b76fd3b93a4..45cc3d9eacb8 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -418,7 +418,7 @@ void __suspend_report_result(const char *function, void *fn, int ret) | |||
418 | { | 418 | { |
419 | if (ret) { | 419 | if (ret) { |
420 | printk(KERN_ERR "%s(): ", function); | 420 | printk(KERN_ERR "%s(): ", function); |
421 | print_fn_descriptor_symbol("%s() returns ", (unsigned long)fn); | 421 | print_fn_descriptor_symbol("%s returns ", fn); |
422 | printk("%d\n", ret); | 422 | printk("%d\n", ret); |
423 | } | 423 | } |
424 | } | 424 | } |
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c index c9751b2b57e6..7516baff3bb9 100644 --- a/drivers/block/amiflop.c +++ b/drivers/block/amiflop.c | |||
@@ -1714,10 +1714,10 @@ static int __init amiga_floppy_init(void) | |||
1714 | int i, ret; | 1714 | int i, ret; |
1715 | 1715 | ||
1716 | if (!MACH_IS_AMIGA) | 1716 | if (!MACH_IS_AMIGA) |
1717 | return -ENXIO; | 1717 | return -ENODEV; |
1718 | 1718 | ||
1719 | if (!AMIGAHW_PRESENT(AMI_FLOPPY)) | 1719 | if (!AMIGAHW_PRESENT(AMI_FLOPPY)) |
1720 | return -ENXIO; | 1720 | return -ENODEV; |
1721 | 1721 | ||
1722 | if (register_blkdev(FLOPPY_MAJOR,"fd")) | 1722 | if (register_blkdev(FLOPPY_MAJOR,"fd")) |
1723 | return -EBUSY; | 1723 | return -EBUSY; |
@@ -1755,7 +1755,7 @@ static int __init amiga_floppy_init(void) | |||
1755 | if (!floppy_queue) | 1755 | if (!floppy_queue) |
1756 | goto out_queue; | 1756 | goto out_queue; |
1757 | 1757 | ||
1758 | ret = -ENXIO; | 1758 | ret = -ENODEV; |
1759 | if (fd_probe_drives() < 1) /* No usable drives */ | 1759 | if (fd_probe_drives() < 1) /* No usable drives */ |
1760 | goto out_probe; | 1760 | goto out_probe; |
1761 | 1761 | ||
diff --git a/drivers/block/brd.c b/drivers/block/brd.c index a196ef7f147f..680cdfc00b90 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c | |||
@@ -447,6 +447,7 @@ static struct brd_device *brd_alloc(int i) | |||
447 | disk->fops = &brd_fops; | 447 | disk->fops = &brd_fops; |
448 | disk->private_data = brd; | 448 | disk->private_data = brd; |
449 | disk->queue = brd->brd_queue; | 449 | disk->queue = brd->brd_queue; |
450 | disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO; | ||
450 | sprintf(disk->disk_name, "ram%d", i); | 451 | sprintf(disk->disk_name, "ram%d", i); |
451 | set_capacity(disk, rd_size * 2); | 452 | set_capacity(disk, rd_size * 2); |
452 | 453 | ||
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c index ebfe038d859e..f1c8feb5510b 100644 --- a/drivers/block/viodasd.c +++ b/drivers/block/viodasd.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * Authors: Dave Boutcher <boutcher@us.ibm.com> | 3 | * Authors: Dave Boutcher <boutcher@us.ibm.com> |
4 | * Ryan Arnold <ryanarn@us.ibm.com> | 4 | * Ryan Arnold <ryanarn@us.ibm.com> |
5 | * Colin Devilbiss <devilbis@us.ibm.com> | 5 | * Colin Devilbiss <devilbis@us.ibm.com> |
6 | * Stephen Rothwell <sfr@au1.ibm.com> | 6 | * Stephen Rothwell |
7 | * | 7 | * |
8 | * (C) Copyright 2000-2004 IBM Corporation | 8 | * (C) Copyright 2000-2004 IBM Corporation |
9 | * | 9 | * |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 84e064ffee52..dd7ea203f940 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -260,6 +260,10 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
260 | if (virtio_has_feature(vdev, VIRTIO_BLK_F_BARRIER)) | 260 | if (virtio_has_feature(vdev, VIRTIO_BLK_F_BARRIER)) |
261 | blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_TAG, NULL); | 261 | blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_TAG, NULL); |
262 | 262 | ||
263 | /* If disk is read-only in the host, the guest should obey */ | ||
264 | if (virtio_has_feature(vdev, VIRTIO_BLK_F_RO)) | ||
265 | set_disk_ro(vblk->disk, 1); | ||
266 | |||
263 | /* Host must always specify the capacity. */ | 267 | /* Host must always specify the capacity. */ |
264 | vdev->config->get(vdev, offsetof(struct virtio_blk_config, capacity), | 268 | vdev->config->get(vdev, offsetof(struct virtio_blk_config, capacity), |
265 | &cap, sizeof(cap)); | 269 | &cap, sizeof(cap)); |
@@ -311,6 +315,7 @@ static void virtblk_remove(struct virtio_device *vdev) | |||
311 | /* Stop all the virtqueues. */ | 315 | /* Stop all the virtqueues. */ |
312 | vdev->config->reset(vdev); | 316 | vdev->config->reset(vdev); |
313 | 317 | ||
318 | del_gendisk(vblk->disk); | ||
314 | blk_cleanup_queue(vblk->disk->queue); | 319 | blk_cleanup_queue(vblk->disk->queue); |
315 | put_disk(vblk->disk); | 320 | put_disk(vblk->disk); |
316 | mempool_destroy(vblk->pool); | 321 | mempool_destroy(vblk->pool); |
@@ -325,7 +330,7 @@ static struct virtio_device_id id_table[] = { | |||
325 | 330 | ||
326 | static unsigned int features[] = { | 331 | static unsigned int features[] = { |
327 | VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, | 332 | VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, |
328 | VIRTIO_BLK_F_GEOMETRY, | 333 | VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, |
329 | }; | 334 | }; |
330 | 335 | ||
331 | static struct virtio_driver virtio_blk = { | 336 | static struct virtio_driver virtio_blk = { |
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c index 2d5853cbd4b0..be20a67f1fa8 100644 --- a/drivers/block/z2ram.c +++ b/drivers/block/z2ram.c | |||
@@ -332,7 +332,7 @@ z2_init(void) | |||
332 | int ret; | 332 | int ret; |
333 | 333 | ||
334 | if (!MACH_IS_AMIGA) | 334 | if (!MACH_IS_AMIGA) |
335 | return -ENXIO; | 335 | return -ENODEV; |
336 | 336 | ||
337 | ret = -EBUSY; | 337 | ret = -EBUSY; |
338 | if (register_blkdev(Z2RAM_MAJOR, DEVICE_NAME)) | 338 | if (register_blkdev(Z2RAM_MAJOR, DEVICE_NAME)) |
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c index 5245a4a0ba74..9d0dfe6e0d63 100644 --- a/drivers/cdrom/viocd.c +++ b/drivers/cdrom/viocd.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Authors: Dave Boutcher <boutcher@us.ibm.com> | 6 | * Authors: Dave Boutcher <boutcher@us.ibm.com> |
7 | * Ryan Arnold <ryanarn@us.ibm.com> | 7 | * Ryan Arnold <ryanarn@us.ibm.com> |
8 | * Colin Devilbiss <devilbis@us.ibm.com> | 8 | * Colin Devilbiss <devilbis@us.ibm.com> |
9 | * Stephen Rothwell <sfr@au1.ibm.com> | 9 | * Stephen Rothwell |
10 | * | 10 | * |
11 | * (C) Copyright 2000-2004 IBM Corporation | 11 | * (C) Copyright 2000-2004 IBM Corporation |
12 | * | 12 | * |
diff --git a/drivers/char/drm/drm.h b/drivers/char/drm/drm.h index 6874f31ca8ca..3a05c6d5ebe1 100644 --- a/drivers/char/drm/drm.h +++ b/drivers/char/drm/drm.h | |||
@@ -471,7 +471,6 @@ struct drm_irq_busid { | |||
471 | enum drm_vblank_seq_type { | 471 | enum drm_vblank_seq_type { |
472 | _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ | 472 | _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ |
473 | _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ | 473 | _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ |
474 | _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ | ||
475 | _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ | 474 | _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ |
476 | _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ | 475 | _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ |
477 | _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking */ | 476 | _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking */ |
@@ -504,21 +503,6 @@ union drm_wait_vblank { | |||
504 | struct drm_wait_vblank_reply reply; | 503 | struct drm_wait_vblank_reply reply; |
505 | }; | 504 | }; |
506 | 505 | ||
507 | enum drm_modeset_ctl_cmd { | ||
508 | _DRM_PRE_MODESET = 1, | ||
509 | _DRM_POST_MODESET = 2, | ||
510 | }; | ||
511 | |||
512 | /** | ||
513 | * DRM_IOCTL_MODESET_CTL ioctl argument type | ||
514 | * | ||
515 | * \sa drmModesetCtl(). | ||
516 | */ | ||
517 | struct drm_modeset_ctl { | ||
518 | unsigned long arg; | ||
519 | enum drm_modeset_ctl_cmd cmd; | ||
520 | }; | ||
521 | |||
522 | /** | 506 | /** |
523 | * DRM_IOCTL_AGP_ENABLE ioctl argument type. | 507 | * DRM_IOCTL_AGP_ENABLE ioctl argument type. |
524 | * | 508 | * |
@@ -603,7 +587,6 @@ struct drm_set_version { | |||
603 | #define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client) | 587 | #define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client) |
604 | #define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) | 588 | #define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) |
605 | #define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version) | 589 | #define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version) |
606 | #define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl) | ||
607 | 590 | ||
608 | #define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) | 591 | #define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) |
609 | #define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) | 592 | #define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) |
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index 213b3ca3468e..0764b662b339 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h | |||
@@ -100,8 +100,10 @@ struct drm_device; | |||
100 | #define DRIVER_HAVE_DMA 0x20 | 100 | #define DRIVER_HAVE_DMA 0x20 |
101 | #define DRIVER_HAVE_IRQ 0x40 | 101 | #define DRIVER_HAVE_IRQ 0x40 |
102 | #define DRIVER_IRQ_SHARED 0x80 | 102 | #define DRIVER_IRQ_SHARED 0x80 |
103 | #define DRIVER_IRQ_VBL 0x100 | ||
103 | #define DRIVER_DMA_QUEUE 0x200 | 104 | #define DRIVER_DMA_QUEUE 0x200 |
104 | #define DRIVER_FB_DMA 0x400 | 105 | #define DRIVER_FB_DMA 0x400 |
106 | #define DRIVER_IRQ_VBL2 0x800 | ||
105 | 107 | ||
106 | /***********************************************************************/ | 108 | /***********************************************************************/ |
107 | /** \name Begin the DRM... */ | 109 | /** \name Begin the DRM... */ |
@@ -577,52 +579,10 @@ struct drm_driver { | |||
577 | int (*context_dtor) (struct drm_device *dev, int context); | 579 | int (*context_dtor) (struct drm_device *dev, int context); |
578 | int (*kernel_context_switch) (struct drm_device *dev, int old, | 580 | int (*kernel_context_switch) (struct drm_device *dev, int old, |
579 | int new); | 581 | int new); |
580 | void (*kernel_context_switch_unlock) (struct drm_device * dev); | 582 | void (*kernel_context_switch_unlock) (struct drm_device *dev); |
581 | /** | 583 | int (*vblank_wait) (struct drm_device *dev, unsigned int *sequence); |
582 | * get_vblank_counter - get raw hardware vblank counter | 584 | int (*vblank_wait2) (struct drm_device *dev, unsigned int *sequence); |
583 | * @dev: DRM device | 585 | int (*dri_library_name) (struct drm_device *dev, char *buf); |
584 | * @crtc: counter to fetch | ||
585 | * | ||
586 | * Driver callback for fetching a raw hardware vblank counter | ||
587 | * for @crtc. If a device doesn't have a hardware counter, the | ||
588 | * driver can simply return the value of drm_vblank_count and | ||
589 | * make the enable_vblank() and disable_vblank() hooks into no-ops, | ||
590 | * leaving interrupts enabled at all times. | ||
591 | * | ||
592 | * Wraparound handling and loss of events due to modesetting is dealt | ||
593 | * with in the DRM core code. | ||
594 | * | ||
595 | * RETURNS | ||
596 | * Raw vblank counter value. | ||
597 | */ | ||
598 | u32 (*get_vblank_counter) (struct drm_device *dev, int crtc); | ||
599 | |||
600 | /** | ||
601 | * enable_vblank - enable vblank interrupt events | ||
602 | * @dev: DRM device | ||
603 | * @crtc: which irq to enable | ||
604 | * | ||
605 | * Enable vblank interrupts for @crtc. If the device doesn't have | ||
606 | * a hardware vblank counter, this routine should be a no-op, since | ||
607 | * interrupts will have to stay on to keep the count accurate. | ||
608 | * | ||
609 | * RETURNS | ||
610 | * Zero on success, appropriate errno if the given @crtc's vblank | ||
611 | * interrupt cannot be enabled. | ||
612 | */ | ||
613 | int (*enable_vblank) (struct drm_device *dev, int crtc); | ||
614 | |||
615 | /** | ||
616 | * disable_vblank - disable vblank interrupt events | ||
617 | * @dev: DRM device | ||
618 | * @crtc: which irq to enable | ||
619 | * | ||
620 | * Disable vblank interrupts for @crtc. If the device doesn't have | ||
621 | * a hardware vblank counter, this routine should be a no-op, since | ||
622 | * interrupts will have to stay on to keep the count accurate. | ||
623 | */ | ||
624 | void (*disable_vblank) (struct drm_device *dev, int crtc); | ||
625 | int (*dri_library_name) (struct drm_device *dev, char * buf); | ||
626 | 586 | ||
627 | /** | 587 | /** |
628 | * Called by \c drm_device_is_agp. Typically used to determine if a | 588 | * Called by \c drm_device_is_agp. Typically used to determine if a |
@@ -641,7 +601,7 @@ struct drm_driver { | |||
641 | 601 | ||
642 | irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); | 602 | irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); |
643 | void (*irq_preinstall) (struct drm_device *dev); | 603 | void (*irq_preinstall) (struct drm_device *dev); |
644 | int (*irq_postinstall) (struct drm_device *dev); | 604 | void (*irq_postinstall) (struct drm_device *dev); |
645 | void (*irq_uninstall) (struct drm_device *dev); | 605 | void (*irq_uninstall) (struct drm_device *dev); |
646 | void (*reclaim_buffers) (struct drm_device *dev, | 606 | void (*reclaim_buffers) (struct drm_device *dev, |
647 | struct drm_file * file_priv); | 607 | struct drm_file * file_priv); |
@@ -770,21 +730,13 @@ struct drm_device { | |||
770 | /** \name VBLANK IRQ support */ | 730 | /** \name VBLANK IRQ support */ |
771 | /*@{ */ | 731 | /*@{ */ |
772 | 732 | ||
773 | wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */ | 733 | wait_queue_head_t vbl_queue; /**< VBLANK wait queue */ |
774 | atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */ | 734 | atomic_t vbl_received; |
735 | atomic_t vbl_received2; /**< number of secondary VBLANK interrupts */ | ||
775 | spinlock_t vbl_lock; | 736 | spinlock_t vbl_lock; |
776 | struct list_head *vbl_sigs; /**< signal list to send on VBLANK */ | 737 | struct list_head vbl_sigs; /**< signal list to send on VBLANK */ |
777 | atomic_t vbl_signal_pending; /* number of signals pending on all crtcs*/ | 738 | struct list_head vbl_sigs2; /**< signals to send on secondary VBLANK */ |
778 | atomic_t *vblank_refcount; /* number of users of vblank interrupts per crtc */ | 739 | unsigned int vbl_pending; |
779 | u32 *last_vblank; /* protected by dev->vbl_lock, used */ | ||
780 | /* for wraparound handling */ | ||
781 | u32 *vblank_offset; /* used to track how many vblanks */ | ||
782 | int *vblank_enabled; /* so we don't call enable more than | ||
783 | once per disable */ | ||
784 | u32 *vblank_premodeset; /* were lost during modeset */ | ||
785 | struct timer_list vblank_disable_timer; | ||
786 | |||
787 | unsigned long max_vblank_count; /**< size of vblank counter register */ | ||
788 | spinlock_t tasklet_lock; /**< For drm_locked_tasklet */ | 740 | spinlock_t tasklet_lock; /**< For drm_locked_tasklet */ |
789 | void (*locked_tasklet_func)(struct drm_device *dev); | 741 | void (*locked_tasklet_func)(struct drm_device *dev); |
790 | 742 | ||
@@ -804,7 +756,6 @@ struct drm_device { | |||
804 | #ifdef __alpha__ | 756 | #ifdef __alpha__ |
805 | struct pci_controller *hose; | 757 | struct pci_controller *hose; |
806 | #endif | 758 | #endif |
807 | int num_crtcs; /**< Number of CRTCs on this device */ | ||
808 | struct drm_sg_mem *sg; /**< Scatter gather memory */ | 759 | struct drm_sg_mem *sg; /**< Scatter gather memory */ |
809 | void *dev_private; /**< device private data */ | 760 | void *dev_private; /**< device private data */ |
810 | struct drm_sigdata sigdata; /**< For block_all_signals */ | 761 | struct drm_sigdata sigdata; /**< For block_all_signals */ |
@@ -1039,19 +990,11 @@ extern void drm_driver_irq_preinstall(struct drm_device *dev); | |||
1039 | extern void drm_driver_irq_postinstall(struct drm_device *dev); | 990 | extern void drm_driver_irq_postinstall(struct drm_device *dev); |
1040 | extern void drm_driver_irq_uninstall(struct drm_device *dev); | 991 | extern void drm_driver_irq_uninstall(struct drm_device *dev); |
1041 | 992 | ||
1042 | extern int drm_vblank_init(struct drm_device *dev, int num_crtcs); | 993 | extern int drm_wait_vblank(struct drm_device *dev, void *data, |
1043 | extern int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *filp); | ||
1044 | extern int drm_vblank_wait(struct drm_device * dev, unsigned int *vbl_seq); | ||
1045 | extern void drm_locked_tasklet(struct drm_device *dev, void(*func)(struct drm_device*)); | ||
1046 | extern u32 drm_vblank_count(struct drm_device *dev, int crtc); | ||
1047 | extern void drm_update_vblank_count(struct drm_device *dev, int crtc); | ||
1048 | extern void drm_handle_vblank(struct drm_device *dev, int crtc); | ||
1049 | extern int drm_vblank_get(struct drm_device *dev, int crtc); | ||
1050 | extern void drm_vblank_put(struct drm_device *dev, int crtc); | ||
1051 | |||
1052 | /* Modesetting support */ | ||
1053 | extern int drm_modeset_ctl(struct drm_device *dev, void *data, | ||
1054 | struct drm_file *file_priv); | 994 | struct drm_file *file_priv); |
995 | extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); | ||
996 | extern void drm_vbl_send_signals(struct drm_device *dev); | ||
997 | extern void drm_locked_tasklet(struct drm_device *dev, void(*func)(struct drm_device*)); | ||
1055 | 998 | ||
1056 | /* AGP/GART support (drm_agpsupport.h) */ | 999 | /* AGP/GART support (drm_agpsupport.h) */ |
1057 | extern struct drm_agp_head *drm_agp_init(struct drm_device *dev); | 1000 | extern struct drm_agp_head *drm_agp_init(struct drm_device *dev); |
diff --git a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c index 68f0da801ed8..d2e6da85f58a 100644 --- a/drivers/char/drm/drm_fops.c +++ b/drivers/char/drm/drm_fops.c | |||
@@ -323,7 +323,6 @@ int drm_release(struct inode *inode, struct file *filp) | |||
323 | struct drm_file *file_priv = filp->private_data; | 323 | struct drm_file *file_priv = filp->private_data; |
324 | struct drm_device *dev = file_priv->minor->dev; | 324 | struct drm_device *dev = file_priv->minor->dev; |
325 | int retcode = 0; | 325 | int retcode = 0; |
326 | unsigned long irqflags; | ||
327 | 326 | ||
328 | lock_kernel(); | 327 | lock_kernel(); |
329 | 328 | ||
@@ -355,11 +354,9 @@ int drm_release(struct inode *inode, struct file *filp) | |||
355 | */ | 354 | */ |
356 | 355 | ||
357 | do{ | 356 | do{ |
358 | spin_lock_irqsave(&dev->lock.spinlock, | 357 | spin_lock_bh(&dev->lock.spinlock); |
359 | irqflags); | ||
360 | locked = dev->lock.idle_has_lock; | 358 | locked = dev->lock.idle_has_lock; |
361 | spin_unlock_irqrestore(&dev->lock.spinlock, | 359 | spin_unlock_bh(&dev->lock.spinlock); |
362 | irqflags); | ||
363 | if (locked) | 360 | if (locked) |
364 | break; | 361 | break; |
365 | schedule(); | 362 | schedule(); |
diff --git a/drivers/char/drm/drm_irq.c b/drivers/char/drm/drm_irq.c index 286f9d61e7d5..089c015c01d1 100644 --- a/drivers/char/drm/drm_irq.c +++ b/drivers/char/drm/drm_irq.c | |||
@@ -71,117 +71,6 @@ int drm_irq_by_busid(struct drm_device *dev, void *data, | |||
71 | return 0; | 71 | return 0; |
72 | } | 72 | } |
73 | 73 | ||
74 | static void vblank_disable_fn(unsigned long arg) | ||
75 | { | ||
76 | struct drm_device *dev = (struct drm_device *)arg; | ||
77 | unsigned long irqflags; | ||
78 | int i; | ||
79 | |||
80 | for (i = 0; i < dev->num_crtcs; i++) { | ||
81 | spin_lock_irqsave(&dev->vbl_lock, irqflags); | ||
82 | if (atomic_read(&dev->vblank_refcount[i]) == 0 && | ||
83 | dev->vblank_enabled[i]) { | ||
84 | dev->driver->disable_vblank(dev, i); | ||
85 | dev->vblank_enabled[i] = 0; | ||
86 | } | ||
87 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | static void drm_vblank_cleanup(struct drm_device *dev) | ||
92 | { | ||
93 | /* Bail if the driver didn't call drm_vblank_init() */ | ||
94 | if (dev->num_crtcs == 0) | ||
95 | return; | ||
96 | |||
97 | del_timer(&dev->vblank_disable_timer); | ||
98 | |||
99 | vblank_disable_fn((unsigned long)dev); | ||
100 | |||
101 | drm_free(dev->vbl_queue, sizeof(*dev->vbl_queue) * dev->num_crtcs, | ||
102 | DRM_MEM_DRIVER); | ||
103 | drm_free(dev->vbl_sigs, sizeof(*dev->vbl_sigs) * dev->num_crtcs, | ||
104 | DRM_MEM_DRIVER); | ||
105 | drm_free(dev->_vblank_count, sizeof(*dev->_vblank_count) * | ||
106 | dev->num_crtcs, DRM_MEM_DRIVER); | ||
107 | drm_free(dev->vblank_refcount, sizeof(*dev->vblank_refcount) * | ||
108 | dev->num_crtcs, DRM_MEM_DRIVER); | ||
109 | drm_free(dev->vblank_enabled, sizeof(*dev->vblank_enabled) * | ||
110 | dev->num_crtcs, DRM_MEM_DRIVER); | ||
111 | drm_free(dev->last_vblank, sizeof(*dev->last_vblank) * dev->num_crtcs, | ||
112 | DRM_MEM_DRIVER); | ||
113 | drm_free(dev->vblank_premodeset, sizeof(*dev->vblank_premodeset) * | ||
114 | dev->num_crtcs, DRM_MEM_DRIVER); | ||
115 | drm_free(dev->vblank_offset, sizeof(*dev->vblank_offset) * dev->num_crtcs, | ||
116 | DRM_MEM_DRIVER); | ||
117 | |||
118 | dev->num_crtcs = 0; | ||
119 | } | ||
120 | |||
121 | int drm_vblank_init(struct drm_device *dev, int num_crtcs) | ||
122 | { | ||
123 | int i, ret = -ENOMEM; | ||
124 | |||
125 | setup_timer(&dev->vblank_disable_timer, vblank_disable_fn, | ||
126 | (unsigned long)dev); | ||
127 | spin_lock_init(&dev->vbl_lock); | ||
128 | atomic_set(&dev->vbl_signal_pending, 0); | ||
129 | dev->num_crtcs = num_crtcs; | ||
130 | |||
131 | dev->vbl_queue = drm_alloc(sizeof(wait_queue_head_t) * num_crtcs, | ||
132 | DRM_MEM_DRIVER); | ||
133 | if (!dev->vbl_queue) | ||
134 | goto err; | ||
135 | |||
136 | dev->vbl_sigs = drm_alloc(sizeof(struct list_head) * num_crtcs, | ||
137 | DRM_MEM_DRIVER); | ||
138 | if (!dev->vbl_sigs) | ||
139 | goto err; | ||
140 | |||
141 | dev->_vblank_count = drm_alloc(sizeof(atomic_t) * num_crtcs, | ||
142 | DRM_MEM_DRIVER); | ||
143 | if (!dev->_vblank_count) | ||
144 | goto err; | ||
145 | |||
146 | dev->vblank_refcount = drm_alloc(sizeof(atomic_t) * num_crtcs, | ||
147 | DRM_MEM_DRIVER); | ||
148 | if (!dev->vblank_refcount) | ||
149 | goto err; | ||
150 | |||
151 | dev->vblank_enabled = drm_calloc(num_crtcs, sizeof(int), | ||
152 | DRM_MEM_DRIVER); | ||
153 | if (!dev->vblank_enabled) | ||
154 | goto err; | ||
155 | |||
156 | dev->last_vblank = drm_calloc(num_crtcs, sizeof(u32), DRM_MEM_DRIVER); | ||
157 | if (!dev->last_vblank) | ||
158 | goto err; | ||
159 | |||
160 | dev->vblank_premodeset = drm_calloc(num_crtcs, sizeof(u32), | ||
161 | DRM_MEM_DRIVER); | ||
162 | if (!dev->vblank_premodeset) | ||
163 | goto err; | ||
164 | |||
165 | dev->vblank_offset = drm_calloc(num_crtcs, sizeof(u32), DRM_MEM_DRIVER); | ||
166 | if (!dev->vblank_offset) | ||
167 | goto err; | ||
168 | |||
169 | /* Zero per-crtc vblank stuff */ | ||
170 | for (i = 0; i < num_crtcs; i++) { | ||
171 | init_waitqueue_head(&dev->vbl_queue[i]); | ||
172 | INIT_LIST_HEAD(&dev->vbl_sigs[i]); | ||
173 | atomic_set(&dev->_vblank_count[i], 0); | ||
174 | atomic_set(&dev->vblank_refcount[i], 0); | ||
175 | } | ||
176 | |||
177 | return 0; | ||
178 | |||
179 | err: | ||
180 | drm_vblank_cleanup(dev); | ||
181 | return ret; | ||
182 | } | ||
183 | EXPORT_SYMBOL(drm_vblank_init); | ||
184 | |||
185 | /** | 74 | /** |
186 | * Install IRQ handler. | 75 | * Install IRQ handler. |
187 | * | 76 | * |
@@ -220,6 +109,17 @@ static int drm_irq_install(struct drm_device * dev) | |||
220 | 109 | ||
221 | DRM_DEBUG("irq=%d\n", dev->irq); | 110 | DRM_DEBUG("irq=%d\n", dev->irq); |
222 | 111 | ||
112 | if (drm_core_check_feature(dev, DRIVER_IRQ_VBL)) { | ||
113 | init_waitqueue_head(&dev->vbl_queue); | ||
114 | |||
115 | spin_lock_init(&dev->vbl_lock); | ||
116 | |||
117 | INIT_LIST_HEAD(&dev->vbl_sigs); | ||
118 | INIT_LIST_HEAD(&dev->vbl_sigs2); | ||
119 | |||
120 | dev->vbl_pending = 0; | ||
121 | } | ||
122 | |||
223 | /* Before installing handler */ | 123 | /* Before installing handler */ |
224 | dev->driver->irq_preinstall(dev); | 124 | dev->driver->irq_preinstall(dev); |
225 | 125 | ||
@@ -237,14 +137,9 @@ static int drm_irq_install(struct drm_device * dev) | |||
237 | } | 137 | } |
238 | 138 | ||
239 | /* After installing handler */ | 139 | /* After installing handler */ |
240 | ret = dev->driver->irq_postinstall(dev); | 140 | dev->driver->irq_postinstall(dev); |
241 | if (ret < 0) { | ||
242 | mutex_lock(&dev->struct_mutex); | ||
243 | dev->irq_enabled = 0; | ||
244 | mutex_unlock(&dev->struct_mutex); | ||
245 | } | ||
246 | 141 | ||
247 | return ret; | 142 | return 0; |
248 | } | 143 | } |
249 | 144 | ||
250 | /** | 145 | /** |
@@ -275,8 +170,6 @@ int drm_irq_uninstall(struct drm_device * dev) | |||
275 | 170 | ||
276 | free_irq(dev->irq, dev); | 171 | free_irq(dev->irq, dev); |
277 | 172 | ||
278 | drm_vblank_cleanup(dev); | ||
279 | |||
280 | dev->locked_tasklet_func = NULL; | 173 | dev->locked_tasklet_func = NULL; |
281 | 174 | ||
282 | return 0; | 175 | return 0; |
@@ -321,148 +214,6 @@ int drm_control(struct drm_device *dev, void *data, | |||
321 | } | 214 | } |
322 | 215 | ||
323 | /** | 216 | /** |
324 | * drm_vblank_count - retrieve "cooked" vblank counter value | ||
325 | * @dev: DRM device | ||
326 | * @crtc: which counter to retrieve | ||
327 | * | ||
328 | * Fetches the "cooked" vblank count value that represents the number of | ||
329 | * vblank events since the system was booted, including lost events due to | ||
330 | * modesetting activity. | ||
331 | */ | ||
332 | u32 drm_vblank_count(struct drm_device *dev, int crtc) | ||
333 | { | ||
334 | return atomic_read(&dev->_vblank_count[crtc]) + | ||
335 | dev->vblank_offset[crtc]; | ||
336 | } | ||
337 | EXPORT_SYMBOL(drm_vblank_count); | ||
338 | |||
339 | /** | ||
340 | * drm_update_vblank_count - update the master vblank counter | ||
341 | * @dev: DRM device | ||
342 | * @crtc: counter to update | ||
343 | * | ||
344 | * Call back into the driver to update the appropriate vblank counter | ||
345 | * (specified by @crtc). Deal with wraparound, if it occurred, and | ||
346 | * update the last read value so we can deal with wraparound on the next | ||
347 | * call if necessary. | ||
348 | */ | ||
349 | void drm_update_vblank_count(struct drm_device *dev, int crtc) | ||
350 | { | ||
351 | unsigned long irqflags; | ||
352 | u32 cur_vblank, diff; | ||
353 | |||
354 | /* | ||
355 | * Interrupts were disabled prior to this call, so deal with counter | ||
356 | * wrap if needed. | ||
357 | * NOTE! It's possible we lost a full dev->max_vblank_count events | ||
358 | * here if the register is small or we had vblank interrupts off for | ||
359 | * a long time. | ||
360 | */ | ||
361 | cur_vblank = dev->driver->get_vblank_counter(dev, crtc); | ||
362 | spin_lock_irqsave(&dev->vbl_lock, irqflags); | ||
363 | if (cur_vblank < dev->last_vblank[crtc]) { | ||
364 | diff = dev->max_vblank_count - | ||
365 | dev->last_vblank[crtc]; | ||
366 | diff += cur_vblank; | ||
367 | } else { | ||
368 | diff = cur_vblank - dev->last_vblank[crtc]; | ||
369 | } | ||
370 | dev->last_vblank[crtc] = cur_vblank; | ||
371 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); | ||
372 | |||
373 | atomic_add(diff, &dev->_vblank_count[crtc]); | ||
374 | } | ||
375 | EXPORT_SYMBOL(drm_update_vblank_count); | ||
376 | |||
377 | /** | ||
378 | * drm_vblank_get - get a reference count on vblank events | ||
379 | * @dev: DRM device | ||
380 | * @crtc: which CRTC to own | ||
381 | * | ||
382 | * Acquire a reference count on vblank events to avoid having them disabled | ||
383 | * while in use. Note callers will probably want to update the master counter | ||
384 | * using drm_update_vblank_count() above before calling this routine so that | ||
385 | * wakeups occur on the right vblank event. | ||
386 | * | ||
387 | * RETURNS | ||
388 | * Zero on success, nonzero on failure. | ||
389 | */ | ||
390 | int drm_vblank_get(struct drm_device *dev, int crtc) | ||
391 | { | ||
392 | unsigned long irqflags; | ||
393 | int ret = 0; | ||
394 | |||
395 | spin_lock_irqsave(&dev->vbl_lock, irqflags); | ||
396 | /* Going from 0->1 means we have to enable interrupts again */ | ||
397 | if (atomic_add_return(1, &dev->vblank_refcount[crtc]) == 1 && | ||
398 | !dev->vblank_enabled[crtc]) { | ||
399 | ret = dev->driver->enable_vblank(dev, crtc); | ||
400 | if (ret) | ||
401 | atomic_dec(&dev->vblank_refcount[crtc]); | ||
402 | else | ||
403 | dev->vblank_enabled[crtc] = 1; | ||
404 | } | ||
405 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); | ||
406 | |||
407 | return ret; | ||
408 | } | ||
409 | EXPORT_SYMBOL(drm_vblank_get); | ||
410 | |||
411 | /** | ||
412 | * drm_vblank_put - give up ownership of vblank events | ||
413 | * @dev: DRM device | ||
414 | * @crtc: which counter to give up | ||
415 | * | ||
416 | * Release ownership of a given vblank counter, turning off interrupts | ||
417 | * if possible. | ||
418 | */ | ||
419 | void drm_vblank_put(struct drm_device *dev, int crtc) | ||
420 | { | ||
421 | /* Last user schedules interrupt disable */ | ||
422 | if (atomic_dec_and_test(&dev->vblank_refcount[crtc])) | ||
423 | mod_timer(&dev->vblank_disable_timer, jiffies + 5*DRM_HZ); | ||
424 | } | ||
425 | EXPORT_SYMBOL(drm_vblank_put); | ||
426 | |||
427 | /** | ||
428 | * drm_modeset_ctl - handle vblank event counter changes across mode switch | ||
429 | * @DRM_IOCTL_ARGS: standard ioctl arguments | ||
430 | * | ||
431 | * Applications should call the %_DRM_PRE_MODESET and %_DRM_POST_MODESET | ||
432 | * ioctls around modesetting so that any lost vblank events are accounted for. | ||
433 | */ | ||
434 | int drm_modeset_ctl(struct drm_device *dev, void *data, | ||
435 | struct drm_file *file_priv) | ||
436 | { | ||
437 | struct drm_modeset_ctl *modeset = data; | ||
438 | int crtc, ret = 0; | ||
439 | u32 new; | ||
440 | |||
441 | crtc = modeset->arg; | ||
442 | if (crtc >= dev->num_crtcs) { | ||
443 | ret = -EINVAL; | ||
444 | goto out; | ||
445 | } | ||
446 | |||
447 | switch (modeset->cmd) { | ||
448 | case _DRM_PRE_MODESET: | ||
449 | dev->vblank_premodeset[crtc] = | ||
450 | dev->driver->get_vblank_counter(dev, crtc); | ||
451 | break; | ||
452 | case _DRM_POST_MODESET: | ||
453 | new = dev->driver->get_vblank_counter(dev, crtc); | ||
454 | dev->vblank_offset[crtc] = dev->vblank_premodeset[crtc] - new; | ||
455 | break; | ||
456 | default: | ||
457 | ret = -EINVAL; | ||
458 | break; | ||
459 | } | ||
460 | |||
461 | out: | ||
462 | return ret; | ||
463 | } | ||
464 | |||
465 | /** | ||
466 | * Wait for VBLANK. | 217 | * Wait for VBLANK. |
467 | * | 218 | * |
468 | * \param inode device inode. | 219 | * \param inode device inode. |
@@ -481,13 +232,12 @@ out: | |||
481 | * | 232 | * |
482 | * If a signal is not requested, then calls vblank_wait(). | 233 | * If a signal is not requested, then calls vblank_wait(). |
483 | */ | 234 | */ |
484 | int drm_wait_vblank(struct drm_device *dev, void *data, | 235 | int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_priv) |
485 | struct drm_file *file_priv) | ||
486 | { | 236 | { |
487 | union drm_wait_vblank *vblwait = data; | 237 | union drm_wait_vblank *vblwait = data; |
488 | struct timeval now; | 238 | struct timeval now; |
489 | int ret = 0; | 239 | int ret = 0; |
490 | unsigned int flags, seq, crtc; | 240 | unsigned int flags, seq; |
491 | 241 | ||
492 | if ((!dev->irq) || (!dev->irq_enabled)) | 242 | if ((!dev->irq) || (!dev->irq_enabled)) |
493 | return -EINVAL; | 243 | return -EINVAL; |
@@ -501,13 +251,13 @@ int drm_wait_vblank(struct drm_device *dev, void *data, | |||
501 | } | 251 | } |
502 | 252 | ||
503 | flags = vblwait->request.type & _DRM_VBLANK_FLAGS_MASK; | 253 | flags = vblwait->request.type & _DRM_VBLANK_FLAGS_MASK; |
504 | crtc = flags & _DRM_VBLANK_SECONDARY ? 1 : 0; | ||
505 | 254 | ||
506 | if (crtc >= dev->num_crtcs) | 255 | if (!drm_core_check_feature(dev, (flags & _DRM_VBLANK_SECONDARY) ? |
256 | DRIVER_IRQ_VBL2 : DRIVER_IRQ_VBL)) | ||
507 | return -EINVAL; | 257 | return -EINVAL; |
508 | 258 | ||
509 | drm_update_vblank_count(dev, crtc); | 259 | seq = atomic_read((flags & _DRM_VBLANK_SECONDARY) ? &dev->vbl_received2 |
510 | seq = drm_vblank_count(dev, crtc); | 260 | : &dev->vbl_received); |
511 | 261 | ||
512 | switch (vblwait->request.type & _DRM_VBLANK_TYPES_MASK) { | 262 | switch (vblwait->request.type & _DRM_VBLANK_TYPES_MASK) { |
513 | case _DRM_VBLANK_RELATIVE: | 263 | case _DRM_VBLANK_RELATIVE: |
@@ -526,7 +276,8 @@ int drm_wait_vblank(struct drm_device *dev, void *data, | |||
526 | 276 | ||
527 | if (flags & _DRM_VBLANK_SIGNAL) { | 277 | if (flags & _DRM_VBLANK_SIGNAL) { |
528 | unsigned long irqflags; | 278 | unsigned long irqflags; |
529 | struct list_head *vbl_sigs = &dev->vbl_sigs[crtc]; | 279 | struct list_head *vbl_sigs = (flags & _DRM_VBLANK_SECONDARY) |
280 | ? &dev->vbl_sigs2 : &dev->vbl_sigs; | ||
530 | struct drm_vbl_sig *vbl_sig; | 281 | struct drm_vbl_sig *vbl_sig; |
531 | 282 | ||
532 | spin_lock_irqsave(&dev->vbl_lock, irqflags); | 283 | spin_lock_irqsave(&dev->vbl_lock, irqflags); |
@@ -547,26 +298,22 @@ int drm_wait_vblank(struct drm_device *dev, void *data, | |||
547 | } | 298 | } |
548 | } | 299 | } |
549 | 300 | ||
550 | if (atomic_read(&dev->vbl_signal_pending) >= 100) { | 301 | if (dev->vbl_pending >= 100) { |
551 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); | 302 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); |
552 | return -EBUSY; | 303 | return -EBUSY; |
553 | } | 304 | } |
554 | 305 | ||
306 | dev->vbl_pending++; | ||
307 | |||
555 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); | 308 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); |
556 | 309 | ||
557 | vbl_sig = drm_calloc(1, sizeof(struct drm_vbl_sig), | 310 | if (! |
558 | DRM_MEM_DRIVER); | 311 | (vbl_sig = |
559 | if (!vbl_sig) | 312 | drm_alloc(sizeof(struct drm_vbl_sig), DRM_MEM_DRIVER))) { |
560 | return -ENOMEM; | 313 | return -ENOMEM; |
561 | |||
562 | ret = drm_vblank_get(dev, crtc); | ||
563 | if (ret) { | ||
564 | drm_free(vbl_sig, sizeof(struct drm_vbl_sig), | ||
565 | DRM_MEM_DRIVER); | ||
566 | return ret; | ||
567 | } | 314 | } |
568 | 315 | ||
569 | atomic_inc(&dev->vbl_signal_pending); | 316 | memset((void *)vbl_sig, 0, sizeof(*vbl_sig)); |
570 | 317 | ||
571 | vbl_sig->sequence = vblwait->request.sequence; | 318 | vbl_sig->sequence = vblwait->request.sequence; |
572 | vbl_sig->info.si_signo = vblwait->request.signal; | 319 | vbl_sig->info.si_signo = vblwait->request.signal; |
@@ -580,20 +327,17 @@ int drm_wait_vblank(struct drm_device *dev, void *data, | |||
580 | 327 | ||
581 | vblwait->reply.sequence = seq; | 328 | vblwait->reply.sequence = seq; |
582 | } else { | 329 | } else { |
583 | unsigned long cur_vblank; | 330 | if (flags & _DRM_VBLANK_SECONDARY) { |
584 | 331 | if (dev->driver->vblank_wait2) | |
585 | ret = drm_vblank_get(dev, crtc); | 332 | ret = dev->driver->vblank_wait2(dev, &vblwait->request.sequence); |
586 | if (ret) | 333 | } else if (dev->driver->vblank_wait) |
587 | return ret; | 334 | ret = |
588 | DRM_WAIT_ON(ret, dev->vbl_queue[crtc], 3 * DRM_HZ, | 335 | dev->driver->vblank_wait(dev, |
589 | (((cur_vblank = drm_vblank_count(dev, crtc)) | 336 | &vblwait->request.sequence); |
590 | - vblwait->request.sequence) <= (1 << 23))); | ||
591 | drm_vblank_put(dev, crtc); | ||
592 | do_gettimeofday(&now); | ||
593 | 337 | ||
338 | do_gettimeofday(&now); | ||
594 | vblwait->reply.tval_sec = now.tv_sec; | 339 | vblwait->reply.tval_sec = now.tv_sec; |
595 | vblwait->reply.tval_usec = now.tv_usec; | 340 | vblwait->reply.tval_usec = now.tv_usec; |
596 | vblwait->reply.sequence = cur_vblank; | ||
597 | } | 341 | } |
598 | 342 | ||
599 | done: | 343 | done: |
@@ -604,57 +348,44 @@ int drm_wait_vblank(struct drm_device *dev, void *data, | |||
604 | * Send the VBLANK signals. | 348 | * Send the VBLANK signals. |
605 | * | 349 | * |
606 | * \param dev DRM device. | 350 | * \param dev DRM device. |
607 | * \param crtc CRTC where the vblank event occurred | ||
608 | * | 351 | * |
609 | * Sends a signal for each task in drm_device::vbl_sigs and empties the list. | 352 | * Sends a signal for each task in drm_device::vbl_sigs and empties the list. |
610 | * | 353 | * |
611 | * If a signal is not requested, then calls vblank_wait(). | 354 | * If a signal is not requested, then calls vblank_wait(). |
612 | */ | 355 | */ |
613 | static void drm_vbl_send_signals(struct drm_device * dev, int crtc) | 356 | void drm_vbl_send_signals(struct drm_device * dev) |
614 | { | 357 | { |
615 | struct drm_vbl_sig *vbl_sig, *tmp; | ||
616 | struct list_head *vbl_sigs; | ||
617 | unsigned int vbl_seq; | ||
618 | unsigned long flags; | 358 | unsigned long flags; |
359 | int i; | ||
619 | 360 | ||
620 | spin_lock_irqsave(&dev->vbl_lock, flags); | 361 | spin_lock_irqsave(&dev->vbl_lock, flags); |
621 | 362 | ||
622 | vbl_sigs = &dev->vbl_sigs[crtc]; | 363 | for (i = 0; i < 2; i++) { |
623 | vbl_seq = drm_vblank_count(dev, crtc); | 364 | struct drm_vbl_sig *vbl_sig, *tmp; |
365 | struct list_head *vbl_sigs = i ? &dev->vbl_sigs2 : &dev->vbl_sigs; | ||
366 | unsigned int vbl_seq = atomic_read(i ? &dev->vbl_received2 : | ||
367 | &dev->vbl_received); | ||
624 | 368 | ||
625 | list_for_each_entry_safe(vbl_sig, tmp, vbl_sigs, head) { | 369 | list_for_each_entry_safe(vbl_sig, tmp, vbl_sigs, head) { |
626 | if ((vbl_seq - vbl_sig->sequence) <= (1 << 23)) { | 370 | if ((vbl_seq - vbl_sig->sequence) <= (1 << 23)) { |
627 | vbl_sig->info.si_code = vbl_seq; | 371 | vbl_sig->info.si_code = vbl_seq; |
628 | send_sig_info(vbl_sig->info.si_signo, | 372 | send_sig_info(vbl_sig->info.si_signo, |
629 | &vbl_sig->info, vbl_sig->task); | 373 | &vbl_sig->info, vbl_sig->task); |
630 | 374 | ||
631 | list_del(&vbl_sig->head); | 375 | list_del(&vbl_sig->head); |
632 | 376 | ||
633 | drm_free(vbl_sig, sizeof(*vbl_sig), | 377 | drm_free(vbl_sig, sizeof(*vbl_sig), |
634 | DRM_MEM_DRIVER); | 378 | DRM_MEM_DRIVER); |
635 | atomic_dec(&dev->vbl_signal_pending); | 379 | |
636 | drm_vblank_put(dev, crtc); | 380 | dev->vbl_pending--; |
637 | } | 381 | } |
382 | } | ||
638 | } | 383 | } |
639 | 384 | ||
640 | spin_unlock_irqrestore(&dev->vbl_lock, flags); | 385 | spin_unlock_irqrestore(&dev->vbl_lock, flags); |
641 | } | 386 | } |
642 | 387 | ||
643 | /** | 388 | EXPORT_SYMBOL(drm_vbl_send_signals); |
644 | * drm_handle_vblank - handle a vblank event | ||
645 | * @dev: DRM device | ||
646 | * @crtc: where this event occurred | ||
647 | * | ||
648 | * Drivers should call this routine in their vblank interrupt handlers to | ||
649 | * update the vblank counter and send any signals that may be pending. | ||
650 | */ | ||
651 | void drm_handle_vblank(struct drm_device *dev, int crtc) | ||
652 | { | ||
653 | drm_update_vblank_count(dev, crtc); | ||
654 | DRM_WAKEUP(&dev->vbl_queue[crtc]); | ||
655 | drm_vbl_send_signals(dev, crtc); | ||
656 | } | ||
657 | EXPORT_SYMBOL(drm_handle_vblank); | ||
658 | 389 | ||
659 | /** | 390 | /** |
660 | * Tasklet wrapper function. | 391 | * Tasklet wrapper function. |
diff --git a/drivers/char/drm/drm_lock.c b/drivers/char/drm/drm_lock.c index 12dcdd1832f0..0998723cde79 100644 --- a/drivers/char/drm/drm_lock.c +++ b/drivers/char/drm/drm_lock.c | |||
@@ -53,7 +53,6 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
53 | DECLARE_WAITQUEUE(entry, current); | 53 | DECLARE_WAITQUEUE(entry, current); |
54 | struct drm_lock *lock = data; | 54 | struct drm_lock *lock = data; |
55 | int ret = 0; | 55 | int ret = 0; |
56 | unsigned long irqflags; | ||
57 | 56 | ||
58 | ++file_priv->lock_count; | 57 | ++file_priv->lock_count; |
59 | 58 | ||
@@ -72,9 +71,9 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
72 | return -EINVAL; | 71 | return -EINVAL; |
73 | 72 | ||
74 | add_wait_queue(&dev->lock.lock_queue, &entry); | 73 | add_wait_queue(&dev->lock.lock_queue, &entry); |
75 | spin_lock_irqsave(&dev->lock.spinlock, irqflags); | 74 | spin_lock_bh(&dev->lock.spinlock); |
76 | dev->lock.user_waiters++; | 75 | dev->lock.user_waiters++; |
77 | spin_unlock_irqrestore(&dev->lock.spinlock, irqflags); | 76 | spin_unlock_bh(&dev->lock.spinlock); |
78 | for (;;) { | 77 | for (;;) { |
79 | __set_current_state(TASK_INTERRUPTIBLE); | 78 | __set_current_state(TASK_INTERRUPTIBLE); |
80 | if (!dev->lock.hw_lock) { | 79 | if (!dev->lock.hw_lock) { |
@@ -96,9 +95,9 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
96 | break; | 95 | break; |
97 | } | 96 | } |
98 | } | 97 | } |
99 | spin_lock_irqsave(&dev->lock.spinlock, irqflags); | 98 | spin_lock_bh(&dev->lock.spinlock); |
100 | dev->lock.user_waiters--; | 99 | dev->lock.user_waiters--; |
101 | spin_unlock_irqrestore(&dev->lock.spinlock, irqflags); | 100 | spin_unlock_bh(&dev->lock.spinlock); |
102 | __set_current_state(TASK_RUNNING); | 101 | __set_current_state(TASK_RUNNING); |
103 | remove_wait_queue(&dev->lock.lock_queue, &entry); | 102 | remove_wait_queue(&dev->lock.lock_queue, &entry); |
104 | 103 | ||
@@ -199,9 +198,8 @@ int drm_lock_take(struct drm_lock_data *lock_data, | |||
199 | { | 198 | { |
200 | unsigned int old, new, prev; | 199 | unsigned int old, new, prev; |
201 | volatile unsigned int *lock = &lock_data->hw_lock->lock; | 200 | volatile unsigned int *lock = &lock_data->hw_lock->lock; |
202 | unsigned long irqflags; | ||
203 | 201 | ||
204 | spin_lock_irqsave(&lock_data->spinlock, irqflags); | 202 | spin_lock_bh(&lock_data->spinlock); |
205 | do { | 203 | do { |
206 | old = *lock; | 204 | old = *lock; |
207 | if (old & _DRM_LOCK_HELD) | 205 | if (old & _DRM_LOCK_HELD) |
@@ -213,7 +211,7 @@ int drm_lock_take(struct drm_lock_data *lock_data, | |||
213 | } | 211 | } |
214 | prev = cmpxchg(lock, old, new); | 212 | prev = cmpxchg(lock, old, new); |
215 | } while (prev != old); | 213 | } while (prev != old); |
216 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); | 214 | spin_unlock_bh(&lock_data->spinlock); |
217 | 215 | ||
218 | if (_DRM_LOCKING_CONTEXT(old) == context) { | 216 | if (_DRM_LOCKING_CONTEXT(old) == context) { |
219 | if (old & _DRM_LOCK_HELD) { | 217 | if (old & _DRM_LOCK_HELD) { |
@@ -274,16 +272,15 @@ int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context) | |||
274 | { | 272 | { |
275 | unsigned int old, new, prev; | 273 | unsigned int old, new, prev; |
276 | volatile unsigned int *lock = &lock_data->hw_lock->lock; | 274 | volatile unsigned int *lock = &lock_data->hw_lock->lock; |
277 | unsigned long irqflags; | ||
278 | 275 | ||
279 | spin_lock_irqsave(&lock_data->spinlock, irqflags); | 276 | spin_lock_bh(&lock_data->spinlock); |
280 | if (lock_data->kernel_waiters != 0) { | 277 | if (lock_data->kernel_waiters != 0) { |
281 | drm_lock_transfer(lock_data, 0); | 278 | drm_lock_transfer(lock_data, 0); |
282 | lock_data->idle_has_lock = 1; | 279 | lock_data->idle_has_lock = 1; |
283 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); | 280 | spin_unlock_bh(&lock_data->spinlock); |
284 | return 1; | 281 | return 1; |
285 | } | 282 | } |
286 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); | 283 | spin_unlock_bh(&lock_data->spinlock); |
287 | 284 | ||
288 | do { | 285 | do { |
289 | old = *lock; | 286 | old = *lock; |
@@ -347,20 +344,19 @@ static int drm_notifier(void *priv) | |||
347 | void drm_idlelock_take(struct drm_lock_data *lock_data) | 344 | void drm_idlelock_take(struct drm_lock_data *lock_data) |
348 | { | 345 | { |
349 | int ret = 0; | 346 | int ret = 0; |
350 | unsigned long irqflags; | ||
351 | 347 | ||
352 | spin_lock_irqsave(&lock_data->spinlock, irqflags); | 348 | spin_lock_bh(&lock_data->spinlock); |
353 | lock_data->kernel_waiters++; | 349 | lock_data->kernel_waiters++; |
354 | if (!lock_data->idle_has_lock) { | 350 | if (!lock_data->idle_has_lock) { |
355 | 351 | ||
356 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); | 352 | spin_unlock_bh(&lock_data->spinlock); |
357 | ret = drm_lock_take(lock_data, DRM_KERNEL_CONTEXT); | 353 | ret = drm_lock_take(lock_data, DRM_KERNEL_CONTEXT); |
358 | spin_lock_irqsave(&lock_data->spinlock, irqflags); | 354 | spin_lock_bh(&lock_data->spinlock); |
359 | 355 | ||
360 | if (ret == 1) | 356 | if (ret == 1) |
361 | lock_data->idle_has_lock = 1; | 357 | lock_data->idle_has_lock = 1; |
362 | } | 358 | } |
363 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); | 359 | spin_unlock_bh(&lock_data->spinlock); |
364 | } | 360 | } |
365 | EXPORT_SYMBOL(drm_idlelock_take); | 361 | EXPORT_SYMBOL(drm_idlelock_take); |
366 | 362 | ||
@@ -368,9 +364,8 @@ void drm_idlelock_release(struct drm_lock_data *lock_data) | |||
368 | { | 364 | { |
369 | unsigned int old, prev; | 365 | unsigned int old, prev; |
370 | volatile unsigned int *lock = &lock_data->hw_lock->lock; | 366 | volatile unsigned int *lock = &lock_data->hw_lock->lock; |
371 | unsigned long irqflags; | ||
372 | 367 | ||
373 | spin_lock_irqsave(&lock_data->spinlock, irqflags); | 368 | spin_lock_bh(&lock_data->spinlock); |
374 | if (--lock_data->kernel_waiters == 0) { | 369 | if (--lock_data->kernel_waiters == 0) { |
375 | if (lock_data->idle_has_lock) { | 370 | if (lock_data->idle_has_lock) { |
376 | do { | 371 | do { |
@@ -381,7 +376,7 @@ void drm_idlelock_release(struct drm_lock_data *lock_data) | |||
381 | lock_data->idle_has_lock = 0; | 376 | lock_data->idle_has_lock = 0; |
382 | } | 377 | } |
383 | } | 378 | } |
384 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); | 379 | spin_unlock_bh(&lock_data->spinlock); |
385 | } | 380 | } |
386 | EXPORT_SYMBOL(drm_idlelock_release); | 381 | EXPORT_SYMBOL(drm_idlelock_release); |
387 | 382 | ||
diff --git a/drivers/char/drm/drm_sysfs.c b/drivers/char/drm/drm_sysfs.c index 9a32169e88fb..af211a0ef179 100644 --- a/drivers/char/drm/drm_sysfs.c +++ b/drivers/char/drm/drm_sysfs.c | |||
@@ -34,8 +34,6 @@ static int drm_sysfs_suspend(struct device *dev, pm_message_t state) | |||
34 | struct drm_minor *drm_minor = to_drm_minor(dev); | 34 | struct drm_minor *drm_minor = to_drm_minor(dev); |
35 | struct drm_device *drm_dev = drm_minor->dev; | 35 | struct drm_device *drm_dev = drm_minor->dev; |
36 | 36 | ||
37 | printk(KERN_ERR "%s\n", __func__); | ||
38 | |||
39 | if (drm_dev->driver->suspend) | 37 | if (drm_dev->driver->suspend) |
40 | return drm_dev->driver->suspend(drm_dev, state); | 38 | return drm_dev->driver->suspend(drm_dev, state); |
41 | 39 | ||
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c index f47e46e3529f..88974342933c 100644 --- a/drivers/char/drm/i915_dma.c +++ b/drivers/char/drm/i915_dma.c | |||
@@ -415,13 +415,10 @@ static void i915_emit_breadcrumb(struct drm_device *dev) | |||
415 | drm_i915_private_t *dev_priv = dev->dev_private; | 415 | drm_i915_private_t *dev_priv = dev->dev_private; |
416 | RING_LOCALS; | 416 | RING_LOCALS; |
417 | 417 | ||
418 | if (++dev_priv->counter > BREADCRUMB_MASK) { | 418 | dev_priv->sarea_priv->last_enqueue = ++dev_priv->counter; |
419 | dev_priv->counter = 1; | ||
420 | DRM_DEBUG("Breadcrumb counter wrapped around\n"); | ||
421 | } | ||
422 | 419 | ||
423 | if (dev_priv->sarea_priv) | 420 | if (dev_priv->counter > 0x7FFFFFFFUL) |
424 | dev_priv->sarea_priv->last_enqueue = dev_priv->counter; | 421 | dev_priv->sarea_priv->last_enqueue = dev_priv->counter = 1; |
425 | 422 | ||
426 | BEGIN_LP_RING(4); | 423 | BEGIN_LP_RING(4); |
427 | OUT_RING(CMD_STORE_DWORD_IDX); | 424 | OUT_RING(CMD_STORE_DWORD_IDX); |
@@ -431,26 +428,6 @@ static void i915_emit_breadcrumb(struct drm_device *dev) | |||
431 | ADVANCE_LP_RING(); | 428 | ADVANCE_LP_RING(); |
432 | } | 429 | } |
433 | 430 | ||
434 | int i915_emit_mi_flush(struct drm_device *dev, uint32_t flush) | ||
435 | { | ||
436 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
437 | uint32_t flush_cmd = CMD_MI_FLUSH; | ||
438 | RING_LOCALS; | ||
439 | |||
440 | flush_cmd |= flush; | ||
441 | |||
442 | i915_kernel_lost_context(dev); | ||
443 | |||
444 | BEGIN_LP_RING(4); | ||
445 | OUT_RING(flush_cmd); | ||
446 | OUT_RING(0); | ||
447 | OUT_RING(0); | ||
448 | OUT_RING(0); | ||
449 | ADVANCE_LP_RING(); | ||
450 | |||
451 | return 0; | ||
452 | } | ||
453 | |||
454 | static int i915_dispatch_cmdbuffer(struct drm_device * dev, | 431 | static int i915_dispatch_cmdbuffer(struct drm_device * dev, |
455 | drm_i915_cmdbuffer_t * cmd) | 432 | drm_i915_cmdbuffer_t * cmd) |
456 | { | 433 | { |
@@ -534,74 +511,52 @@ static int i915_dispatch_batchbuffer(struct drm_device * dev, | |||
534 | return 0; | 511 | return 0; |
535 | } | 512 | } |
536 | 513 | ||
537 | static void i915_do_dispatch_flip(struct drm_device * dev, int plane, int sync) | 514 | static int i915_dispatch_flip(struct drm_device * dev) |
538 | { | 515 | { |
539 | drm_i915_private_t *dev_priv = dev->dev_private; | 516 | drm_i915_private_t *dev_priv = dev->dev_private; |
540 | u32 num_pages, current_page, next_page, dspbase; | ||
541 | int shift = 2 * plane, x, y; | ||
542 | RING_LOCALS; | 517 | RING_LOCALS; |
543 | 518 | ||
544 | /* Calculate display base offset */ | 519 | DRM_DEBUG("%s: page=%d pfCurrentPage=%d\n", |
545 | num_pages = dev_priv->sarea_priv->third_handle ? 3 : 2; | 520 | __FUNCTION__, |
546 | current_page = (dev_priv->sarea_priv->pf_current_page >> shift) & 0x3; | 521 | dev_priv->current_page, |
547 | next_page = (current_page + 1) % num_pages; | 522 | dev_priv->sarea_priv->pf_current_page); |
548 | 523 | ||
549 | switch (next_page) { | 524 | i915_kernel_lost_context(dev); |
550 | default: | 525 | |
551 | case 0: | 526 | BEGIN_LP_RING(2); |
552 | dspbase = dev_priv->sarea_priv->front_offset; | 527 | OUT_RING(INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE); |
553 | break; | 528 | OUT_RING(0); |
554 | case 1: | 529 | ADVANCE_LP_RING(); |
555 | dspbase = dev_priv->sarea_priv->back_offset; | ||
556 | break; | ||
557 | case 2: | ||
558 | dspbase = dev_priv->sarea_priv->third_offset; | ||
559 | break; | ||
560 | } | ||
561 | 530 | ||
562 | if (plane == 0) { | 531 | BEGIN_LP_RING(6); |
563 | x = dev_priv->sarea_priv->planeA_x; | 532 | OUT_RING(CMD_OP_DISPLAYBUFFER_INFO | ASYNC_FLIP); |
564 | y = dev_priv->sarea_priv->planeA_y; | 533 | OUT_RING(0); |
534 | if (dev_priv->current_page == 0) { | ||
535 | OUT_RING(dev_priv->back_offset); | ||
536 | dev_priv->current_page = 1; | ||
565 | } else { | 537 | } else { |
566 | x = dev_priv->sarea_priv->planeB_x; | 538 | OUT_RING(dev_priv->front_offset); |
567 | y = dev_priv->sarea_priv->planeB_y; | 539 | dev_priv->current_page = 0; |
568 | } | 540 | } |
541 | OUT_RING(0); | ||
542 | ADVANCE_LP_RING(); | ||
569 | 543 | ||
570 | dspbase += (y * dev_priv->sarea_priv->pitch + x) * dev_priv->cpp; | 544 | BEGIN_LP_RING(2); |
545 | OUT_RING(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_PLANE_A_FLIP); | ||
546 | OUT_RING(0); | ||
547 | ADVANCE_LP_RING(); | ||
571 | 548 | ||
572 | DRM_DEBUG("plane=%d current_page=%d dspbase=0x%x\n", plane, current_page, | 549 | dev_priv->sarea_priv->last_enqueue = dev_priv->counter++; |
573 | dspbase); | ||
574 | 550 | ||
575 | BEGIN_LP_RING(4); | 551 | BEGIN_LP_RING(4); |
576 | OUT_RING(sync ? 0 : | 552 | OUT_RING(CMD_STORE_DWORD_IDX); |
577 | (MI_WAIT_FOR_EVENT | (plane ? MI_WAIT_FOR_PLANE_B_FLIP : | 553 | OUT_RING(20); |
578 | MI_WAIT_FOR_PLANE_A_FLIP))); | 554 | OUT_RING(dev_priv->counter); |
579 | OUT_RING(CMD_OP_DISPLAYBUFFER_INFO | (sync ? 0 : ASYNC_FLIP) | | 555 | OUT_RING(0); |
580 | (plane ? DISPLAY_PLANE_B : DISPLAY_PLANE_A)); | ||
581 | OUT_RING(dev_priv->sarea_priv->pitch * dev_priv->cpp); | ||
582 | OUT_RING(dspbase); | ||
583 | ADVANCE_LP_RING(); | 556 | ADVANCE_LP_RING(); |
584 | 557 | ||
585 | dev_priv->sarea_priv->pf_current_page &= ~(0x3 << shift); | 558 | dev_priv->sarea_priv->pf_current_page = dev_priv->current_page; |
586 | dev_priv->sarea_priv->pf_current_page |= next_page << shift; | 559 | return 0; |
587 | } | ||
588 | |||
589 | void i915_dispatch_flip(struct drm_device * dev, int planes, int sync) | ||
590 | { | ||
591 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
592 | int i; | ||
593 | |||
594 | DRM_DEBUG("planes=0x%x pfCurrentPage=%d\n", | ||
595 | planes, dev_priv->sarea_priv->pf_current_page); | ||
596 | |||
597 | i915_emit_mi_flush(dev, MI_READ_FLUSH | MI_EXE_FLUSH); | ||
598 | |||
599 | for (i = 0; i < 2; i++) | ||
600 | if (planes & (1 << i)) | ||
601 | i915_do_dispatch_flip(dev, i, sync); | ||
602 | |||
603 | i915_emit_breadcrumb(dev); | ||
604 | |||
605 | } | 560 | } |
606 | 561 | ||
607 | static int i915_quiescent(struct drm_device * dev) | 562 | static int i915_quiescent(struct drm_device * dev) |
@@ -624,6 +579,7 @@ static int i915_batchbuffer(struct drm_device *dev, void *data, | |||
624 | struct drm_file *file_priv) | 579 | struct drm_file *file_priv) |
625 | { | 580 | { |
626 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 581 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
582 | u32 *hw_status = dev_priv->hw_status_page; | ||
627 | drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *) | 583 | drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *) |
628 | dev_priv->sarea_priv; | 584 | dev_priv->sarea_priv; |
629 | drm_i915_batchbuffer_t *batch = data; | 585 | drm_i915_batchbuffer_t *batch = data; |
@@ -646,7 +602,7 @@ static int i915_batchbuffer(struct drm_device *dev, void *data, | |||
646 | 602 | ||
647 | ret = i915_dispatch_batchbuffer(dev, batch); | 603 | ret = i915_dispatch_batchbuffer(dev, batch); |
648 | 604 | ||
649 | sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); | 605 | sarea_priv->last_dispatch = (int)hw_status[5]; |
650 | return ret; | 606 | return ret; |
651 | } | 607 | } |
652 | 608 | ||
@@ -654,6 +610,7 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data, | |||
654 | struct drm_file *file_priv) | 610 | struct drm_file *file_priv) |
655 | { | 611 | { |
656 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 612 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
613 | u32 *hw_status = dev_priv->hw_status_page; | ||
657 | drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *) | 614 | drm_i915_sarea_t *sarea_priv = (drm_i915_sarea_t *) |
658 | dev_priv->sarea_priv; | 615 | dev_priv->sarea_priv; |
659 | drm_i915_cmdbuffer_t *cmdbuf = data; | 616 | drm_i915_cmdbuffer_t *cmdbuf = data; |
@@ -678,51 +635,18 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data, | |||
678 | return ret; | 635 | return ret; |
679 | } | 636 | } |
680 | 637 | ||
681 | sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); | 638 | sarea_priv->last_dispatch = (int)hw_status[5]; |
682 | return 0; | ||
683 | } | ||
684 | |||
685 | static int i915_do_cleanup_pageflip(struct drm_device * dev) | ||
686 | { | ||
687 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
688 | int i, planes, num_pages = dev_priv->sarea_priv->third_handle ? 3 : 2; | ||
689 | |||
690 | DRM_DEBUG("\n"); | ||
691 | |||
692 | for (i = 0, planes = 0; i < 2; i++) | ||
693 | if (dev_priv->sarea_priv->pf_current_page & (0x3 << (2 * i))) { | ||
694 | dev_priv->sarea_priv->pf_current_page = | ||
695 | (dev_priv->sarea_priv->pf_current_page & | ||
696 | ~(0x3 << (2 * i))) | ((num_pages - 1) << (2 * i)); | ||
697 | |||
698 | planes |= 1 << i; | ||
699 | } | ||
700 | |||
701 | if (planes) | ||
702 | i915_dispatch_flip(dev, planes, 0); | ||
703 | |||
704 | return 0; | 639 | return 0; |
705 | } | 640 | } |
706 | 641 | ||
707 | static int i915_flip_bufs(struct drm_device *dev, void *data, | 642 | static int i915_flip_bufs(struct drm_device *dev, void *data, |
708 | struct drm_file *file_priv) | 643 | struct drm_file *file_priv) |
709 | { | 644 | { |
710 | drm_i915_flip_t *param = data; | 645 | DRM_DEBUG("%s\n", __FUNCTION__); |
711 | |||
712 | DRM_DEBUG("\n"); | ||
713 | 646 | ||
714 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 647 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
715 | 648 | ||
716 | /* This is really planes */ | 649 | return i915_dispatch_flip(dev); |
717 | if (param->pipes & ~0x3) { | ||
718 | DRM_ERROR("Invalid planes 0x%x, only <= 0x3 is valid\n", | ||
719 | param->pipes); | ||
720 | return -EINVAL; | ||
721 | } | ||
722 | |||
723 | i915_dispatch_flip(dev, param->pipes, 0); | ||
724 | |||
725 | return 0; | ||
726 | } | 650 | } |
727 | 651 | ||
728 | static int i915_getparam(struct drm_device *dev, void *data, | 652 | static int i915_getparam(struct drm_device *dev, void *data, |
@@ -883,8 +807,6 @@ void i915_driver_lastclose(struct drm_device * dev) | |||
883 | if (!dev_priv) | 807 | if (!dev_priv) |
884 | return; | 808 | return; |
885 | 809 | ||
886 | if (drm_getsarea(dev) && dev_priv->sarea_priv) | ||
887 | i915_do_cleanup_pageflip(dev); | ||
888 | if (dev_priv->agp_heap) | 810 | if (dev_priv->agp_heap) |
889 | i915_mem_takedown(&(dev_priv->agp_heap)); | 811 | i915_mem_takedown(&(dev_priv->agp_heap)); |
890 | 812 | ||
diff --git a/drivers/char/drm/i915_drm.h b/drivers/char/drm/i915_drm.h index 0431c00e2289..05c66cf03a9e 100644 --- a/drivers/char/drm/i915_drm.h +++ b/drivers/char/drm/i915_drm.h | |||
@@ -105,29 +105,14 @@ typedef struct _drm_i915_sarea { | |||
105 | unsigned int rotated_tiled; | 105 | unsigned int rotated_tiled; |
106 | unsigned int rotated2_tiled; | 106 | unsigned int rotated2_tiled; |
107 | 107 | ||
108 | int planeA_x; | 108 | int pipeA_x; |
109 | int planeA_y; | 109 | int pipeA_y; |
110 | int planeA_w; | 110 | int pipeA_w; |
111 | int planeA_h; | 111 | int pipeA_h; |
112 | int planeB_x; | 112 | int pipeB_x; |
113 | int planeB_y; | 113 | int pipeB_y; |
114 | int planeB_w; | 114 | int pipeB_w; |
115 | int planeB_h; | 115 | int pipeB_h; |
116 | |||
117 | /* Triple buffering */ | ||
118 | drm_handle_t third_handle; | ||
119 | int third_offset; | ||
120 | int third_size; | ||
121 | unsigned int third_tiled; | ||
122 | |||
123 | /* buffer object handles for the static buffers. May change | ||
124 | * over the lifetime of the client, though it doesn't in our current | ||
125 | * implementation. | ||
126 | */ | ||
127 | unsigned int front_bo_handle; | ||
128 | unsigned int back_bo_handle; | ||
129 | unsigned int third_bo_handle; | ||
130 | unsigned int depth_bo_handle; | ||
131 | } drm_i915_sarea_t; | 116 | } drm_i915_sarea_t; |
132 | 117 | ||
133 | /* Flags for perf_boxes | 118 | /* Flags for perf_boxes |
@@ -161,7 +146,7 @@ typedef struct _drm_i915_sarea { | |||
161 | 146 | ||
162 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) | 147 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) |
163 | #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) | 148 | #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) |
164 | #define DRM_IOCTL_I915_FLIP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FLIP, drm_i915_flip_t) | 149 | #define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP) |
165 | #define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t) | 150 | #define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t) |
166 | #define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t) | 151 | #define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t) |
167 | #define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t) | 152 | #define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t) |
@@ -176,18 +161,6 @@ typedef struct _drm_i915_sarea { | |||
176 | #define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) | 161 | #define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) |
177 | #define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) | 162 | #define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) |
178 | 163 | ||
179 | /* Asynchronous page flipping: | ||
180 | */ | ||
181 | typedef struct drm_i915_flip { | ||
182 | /* | ||
183 | * This is really talking about planes, and we could rename it | ||
184 | * except for the fact that some of the duplicated i915_drm.h files | ||
185 | * out there check for HAVE_I915_FLIP and so might pick up this | ||
186 | * version. | ||
187 | */ | ||
188 | int pipes; | ||
189 | } drm_i915_flip_t; | ||
190 | |||
191 | /* Allow drivers to submit batchbuffers directly to hardware, relying | 164 | /* Allow drivers to submit batchbuffers directly to hardware, relying |
192 | * on the security mechanisms provided by hardware. | 165 | * on the security mechanisms provided by hardware. |
193 | */ | 166 | */ |
diff --git a/drivers/char/drm/i915_drv.c b/drivers/char/drm/i915_drv.c index bb8f1b2fb383..e8f3d682e3b1 100644 --- a/drivers/char/drm/i915_drv.c +++ b/drivers/char/drm/i915_drv.c | |||
@@ -147,7 +147,7 @@ static void i915_save_vga(struct drm_device *dev) | |||
147 | i915_write_indexed(cr_index, cr_data, 0x11, | 147 | i915_write_indexed(cr_index, cr_data, 0x11, |
148 | i915_read_indexed(cr_index, cr_data, 0x11) & | 148 | i915_read_indexed(cr_index, cr_data, 0x11) & |
149 | (~0x80)); | 149 | (~0x80)); |
150 | for (i = 0; i < 0x24; i++) | 150 | for (i = 0; i <= 0x24; i++) |
151 | dev_priv->saveCR[i] = | 151 | dev_priv->saveCR[i] = |
152 | i915_read_indexed(cr_index, cr_data, i); | 152 | i915_read_indexed(cr_index, cr_data, i); |
153 | /* Make sure we don't turn off CR group 0 writes */ | 153 | /* Make sure we don't turn off CR group 0 writes */ |
@@ -156,7 +156,7 @@ static void i915_save_vga(struct drm_device *dev) | |||
156 | /* Attribute controller registers */ | 156 | /* Attribute controller registers */ |
157 | inb(st01); | 157 | inb(st01); |
158 | dev_priv->saveAR_INDEX = inb(VGA_AR_INDEX); | 158 | dev_priv->saveAR_INDEX = inb(VGA_AR_INDEX); |
159 | for (i = 0; i < 20; i++) | 159 | for (i = 0; i <= 0x14; i++) |
160 | dev_priv->saveAR[i] = i915_read_ar(st01, i, 0); | 160 | dev_priv->saveAR[i] = i915_read_ar(st01, i, 0); |
161 | inb(st01); | 161 | inb(st01); |
162 | outb(dev_priv->saveAR_INDEX, VGA_AR_INDEX); | 162 | outb(dev_priv->saveAR_INDEX, VGA_AR_INDEX); |
@@ -206,7 +206,7 @@ static void i915_restore_vga(struct drm_device *dev) | |||
206 | /* CRT controller regs */ | 206 | /* CRT controller regs */ |
207 | /* Enable CR group 0 writes */ | 207 | /* Enable CR group 0 writes */ |
208 | i915_write_indexed(cr_index, cr_data, 0x11, dev_priv->saveCR[0x11]); | 208 | i915_write_indexed(cr_index, cr_data, 0x11, dev_priv->saveCR[0x11]); |
209 | for (i = 0; i < 0x24; i++) | 209 | for (i = 0; i <= 0x24; i++) |
210 | i915_write_indexed(cr_index, cr_data, i, dev_priv->saveCR[i]); | 210 | i915_write_indexed(cr_index, cr_data, i, dev_priv->saveCR[i]); |
211 | 211 | ||
212 | /* Graphics controller regs */ | 212 | /* Graphics controller regs */ |
@@ -223,7 +223,7 @@ static void i915_restore_vga(struct drm_device *dev) | |||
223 | 223 | ||
224 | /* Attribute controller registers */ | 224 | /* Attribute controller registers */ |
225 | inb(st01); | 225 | inb(st01); |
226 | for (i = 0; i < 20; i++) | 226 | for (i = 0; i <= 0x14; i++) |
227 | i915_write_ar(st01, i, dev_priv->saveAR[i], 0); | 227 | i915_write_ar(st01, i, dev_priv->saveAR[i], 0); |
228 | inb(st01); /* switch back to index mode */ | 228 | inb(st01); /* switch back to index mode */ |
229 | outb(dev_priv->saveAR_INDEX | 0x20, VGA_AR_INDEX); | 229 | outb(dev_priv->saveAR_INDEX | 0x20, VGA_AR_INDEX); |
@@ -256,6 +256,9 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state) | |||
256 | pci_save_state(dev->pdev); | 256 | pci_save_state(dev->pdev); |
257 | pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); | 257 | pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); |
258 | 258 | ||
259 | /* Display arbitration control */ | ||
260 | dev_priv->saveDSPARB = I915_READ(DSPARB); | ||
261 | |||
259 | /* Pipe & plane A info */ | 262 | /* Pipe & plane A info */ |
260 | dev_priv->savePIPEACONF = I915_READ(PIPEACONF); | 263 | dev_priv->savePIPEACONF = I915_READ(PIPEACONF); |
261 | dev_priv->savePIPEASRC = I915_READ(PIPEASRC); | 264 | dev_priv->savePIPEASRC = I915_READ(PIPEASRC); |
@@ -349,6 +352,7 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state) | |||
349 | dev_priv->saveVGACNTRL = I915_READ(VGACNTRL); | 352 | dev_priv->saveVGACNTRL = I915_READ(VGACNTRL); |
350 | 353 | ||
351 | /* Clock gating state */ | 354 | /* Clock gating state */ |
355 | dev_priv->saveD_STATE = I915_READ(D_STATE); | ||
352 | dev_priv->saveDSPCLK_GATE_D = I915_READ(DSPCLK_GATE_D); | 356 | dev_priv->saveDSPCLK_GATE_D = I915_READ(DSPCLK_GATE_D); |
353 | 357 | ||
354 | /* Cache mode state */ | 358 | /* Cache mode state */ |
@@ -388,6 +392,8 @@ static int i915_resume(struct drm_device *dev) | |||
388 | 392 | ||
389 | pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB); | 393 | pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB); |
390 | 394 | ||
395 | I915_WRITE(DSPARB, dev_priv->saveDSPARB); | ||
396 | |||
391 | /* Pipe & plane A info */ | 397 | /* Pipe & plane A info */ |
392 | /* Prime the clock */ | 398 | /* Prime the clock */ |
393 | if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) { | 399 | if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) { |
@@ -507,6 +513,7 @@ static int i915_resume(struct drm_device *dev) | |||
507 | udelay(150); | 513 | udelay(150); |
508 | 514 | ||
509 | /* Clock gating state */ | 515 | /* Clock gating state */ |
516 | I915_WRITE (D_STATE, dev_priv->saveD_STATE); | ||
510 | I915_WRITE (DSPCLK_GATE_D, dev_priv->saveDSPCLK_GATE_D); | 517 | I915_WRITE (DSPCLK_GATE_D, dev_priv->saveDSPCLK_GATE_D); |
511 | 518 | ||
512 | /* Cache mode state */ | 519 | /* Cache mode state */ |
@@ -533,7 +540,8 @@ static struct drm_driver driver = { | |||
533 | */ | 540 | */ |
534 | .driver_features = | 541 | .driver_features = |
535 | DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | /* DRIVER_USE_MTRR |*/ | 542 | DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | /* DRIVER_USE_MTRR |*/ |
536 | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED, | 543 | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL | |
544 | DRIVER_IRQ_VBL2, | ||
537 | .load = i915_driver_load, | 545 | .load = i915_driver_load, |
538 | .unload = i915_driver_unload, | 546 | .unload = i915_driver_unload, |
539 | .lastclose = i915_driver_lastclose, | 547 | .lastclose = i915_driver_lastclose, |
@@ -541,9 +549,8 @@ static struct drm_driver driver = { | |||
541 | .suspend = i915_suspend, | 549 | .suspend = i915_suspend, |
542 | .resume = i915_resume, | 550 | .resume = i915_resume, |
543 | .device_is_agp = i915_driver_device_is_agp, | 551 | .device_is_agp = i915_driver_device_is_agp, |
544 | .get_vblank_counter = i915_get_vblank_counter, | 552 | .vblank_wait = i915_driver_vblank_wait, |
545 | .enable_vblank = i915_enable_vblank, | 553 | .vblank_wait2 = i915_driver_vblank_wait2, |
546 | .disable_vblank = i915_disable_vblank, | ||
547 | .irq_preinstall = i915_driver_irq_preinstall, | 554 | .irq_preinstall = i915_driver_irq_preinstall, |
548 | .irq_postinstall = i915_driver_irq_postinstall, | 555 | .irq_postinstall = i915_driver_irq_postinstall, |
549 | .irq_uninstall = i915_driver_irq_uninstall, | 556 | .irq_uninstall = i915_driver_irq_uninstall, |
diff --git a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h index db7001f22561..1b20f7c0639c 100644 --- a/drivers/char/drm/i915_drv.h +++ b/drivers/char/drm/i915_drv.h | |||
@@ -76,9 +76,8 @@ struct mem_block { | |||
76 | typedef struct _drm_i915_vbl_swap { | 76 | typedef struct _drm_i915_vbl_swap { |
77 | struct list_head head; | 77 | struct list_head head; |
78 | drm_drawable_t drw_id; | 78 | drm_drawable_t drw_id; |
79 | unsigned int plane; | 79 | unsigned int pipe; |
80 | unsigned int sequence; | 80 | unsigned int sequence; |
81 | int flip; | ||
82 | } drm_i915_vbl_swap_t; | 81 | } drm_i915_vbl_swap_t; |
83 | 82 | ||
84 | typedef struct drm_i915_private { | 83 | typedef struct drm_i915_private { |
@@ -91,7 +90,7 @@ typedef struct drm_i915_private { | |||
91 | drm_dma_handle_t *status_page_dmah; | 90 | drm_dma_handle_t *status_page_dmah; |
92 | void *hw_status_page; | 91 | void *hw_status_page; |
93 | dma_addr_t dma_status_page; | 92 | dma_addr_t dma_status_page; |
94 | uint32_t counter; | 93 | unsigned long counter; |
95 | unsigned int status_gfx_addr; | 94 | unsigned int status_gfx_addr; |
96 | drm_local_map_t hws_map; | 95 | drm_local_map_t hws_map; |
97 | 96 | ||
@@ -104,18 +103,13 @@ typedef struct drm_i915_private { | |||
104 | 103 | ||
105 | wait_queue_head_t irq_queue; | 104 | wait_queue_head_t irq_queue; |
106 | atomic_t irq_received; | 105 | atomic_t irq_received; |
107 | atomic_t irq_emited; | 106 | atomic_t irq_emitted; |
108 | 107 | ||
109 | int tex_lru_log_granularity; | 108 | int tex_lru_log_granularity; |
110 | int allow_batchbuffer; | 109 | int allow_batchbuffer; |
111 | struct mem_block *agp_heap; | 110 | struct mem_block *agp_heap; |
112 | unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds; | 111 | unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds; |
113 | int vblank_pipe; | 112 | int vblank_pipe; |
114 | spinlock_t user_irq_lock; | ||
115 | int user_irq_refcount; | ||
116 | int fence_irq_on; | ||
117 | uint32_t irq_enable_reg; | ||
118 | int irq_enabled; | ||
119 | 113 | ||
120 | spinlock_t swaps_lock; | 114 | spinlock_t swaps_lock; |
121 | drm_i915_vbl_swap_t vbl_swaps; | 115 | drm_i915_vbl_swap_t vbl_swaps; |
@@ -125,6 +119,7 @@ typedef struct drm_i915_private { | |||
125 | u8 saveLBB; | 119 | u8 saveLBB; |
126 | u32 saveDSPACNTR; | 120 | u32 saveDSPACNTR; |
127 | u32 saveDSPBCNTR; | 121 | u32 saveDSPBCNTR; |
122 | u32 saveDSPARB; | ||
128 | u32 savePIPEACONF; | 123 | u32 savePIPEACONF; |
129 | u32 savePIPEBCONF; | 124 | u32 savePIPEBCONF; |
130 | u32 savePIPEASRC; | 125 | u32 savePIPEASRC; |
@@ -194,6 +189,7 @@ typedef struct drm_i915_private { | |||
194 | u32 saveIIR; | 189 | u32 saveIIR; |
195 | u32 saveIMR; | 190 | u32 saveIMR; |
196 | u32 saveCACHE_MODE_0; | 191 | u32 saveCACHE_MODE_0; |
192 | u32 saveD_STATE; | ||
197 | u32 saveDSPCLK_GATE_D; | 193 | u32 saveDSPCLK_GATE_D; |
198 | u32 saveMI_ARB_STATE; | 194 | u32 saveMI_ARB_STATE; |
199 | u32 saveSWF0[16]; | 195 | u32 saveSWF0[16]; |
@@ -203,10 +199,10 @@ typedef struct drm_i915_private { | |||
203 | u8 saveSR[8]; | 199 | u8 saveSR[8]; |
204 | u8 saveGR[25]; | 200 | u8 saveGR[25]; |
205 | u8 saveAR_INDEX; | 201 | u8 saveAR_INDEX; |
206 | u8 saveAR[20]; | 202 | u8 saveAR[21]; |
207 | u8 saveDACMASK; | 203 | u8 saveDACMASK; |
208 | u8 saveDACDATA[256*3]; /* 256 3-byte colors */ | 204 | u8 saveDACDATA[256*3]; /* 256 3-byte colors */ |
209 | u8 saveCR[36]; | 205 | u8 saveCR[37]; |
210 | } drm_i915_private_t; | 206 | } drm_i915_private_t; |
211 | 207 | ||
212 | extern struct drm_ioctl_desc i915_ioctls[]; | 208 | extern struct drm_ioctl_desc i915_ioctls[]; |
@@ -222,7 +218,7 @@ extern void i915_driver_preclose(struct drm_device *dev, | |||
222 | extern int i915_driver_device_is_agp(struct drm_device * dev); | 218 | extern int i915_driver_device_is_agp(struct drm_device * dev); |
223 | extern long i915_compat_ioctl(struct file *filp, unsigned int cmd, | 219 | extern long i915_compat_ioctl(struct file *filp, unsigned int cmd, |
224 | unsigned long arg); | 220 | unsigned long arg); |
225 | extern void i915_dispatch_flip(struct drm_device * dev, int pipes, int sync); | 221 | |
226 | /* i915_irq.c */ | 222 | /* i915_irq.c */ |
227 | extern int i915_irq_emit(struct drm_device *dev, void *data, | 223 | extern int i915_irq_emit(struct drm_device *dev, void *data, |
228 | struct drm_file *file_priv); | 224 | struct drm_file *file_priv); |
@@ -233,7 +229,7 @@ extern int i915_driver_vblank_wait(struct drm_device *dev, unsigned int *sequenc | |||
233 | extern int i915_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence); | 229 | extern int i915_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence); |
234 | extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS); | 230 | extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS); |
235 | extern void i915_driver_irq_preinstall(struct drm_device * dev); | 231 | extern void i915_driver_irq_preinstall(struct drm_device * dev); |
236 | extern int i915_driver_irq_postinstall(struct drm_device * dev); | 232 | extern void i915_driver_irq_postinstall(struct drm_device * dev); |
237 | extern void i915_driver_irq_uninstall(struct drm_device * dev); | 233 | extern void i915_driver_irq_uninstall(struct drm_device * dev); |
238 | extern int i915_vblank_pipe_set(struct drm_device *dev, void *data, | 234 | extern int i915_vblank_pipe_set(struct drm_device *dev, void *data, |
239 | struct drm_file *file_priv); | 235 | struct drm_file *file_priv); |
@@ -241,9 +237,6 @@ extern int i915_vblank_pipe_get(struct drm_device *dev, void *data, | |||
241 | struct drm_file *file_priv); | 237 | struct drm_file *file_priv); |
242 | extern int i915_vblank_swap(struct drm_device *dev, void *data, | 238 | extern int i915_vblank_swap(struct drm_device *dev, void *data, |
243 | struct drm_file *file_priv); | 239 | struct drm_file *file_priv); |
244 | extern int i915_enable_vblank(struct drm_device *dev, int crtc); | ||
245 | extern void i915_disable_vblank(struct drm_device *dev, int crtc); | ||
246 | extern u32 i915_get_vblank_counter(struct drm_device *dev, int crtc); | ||
247 | 240 | ||
248 | /* i915_mem.c */ | 241 | /* i915_mem.c */ |
249 | extern int i915_mem_alloc(struct drm_device *dev, void *data, | 242 | extern int i915_mem_alloc(struct drm_device *dev, void *data, |
@@ -388,91 +381,21 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); | |||
388 | 381 | ||
389 | /* Interrupt bits: | 382 | /* Interrupt bits: |
390 | */ | 383 | */ |
391 | #define I915_PIPE_CONTROL_NOTIFY_INTERRUPT (1<<18) | 384 | #define USER_INT_FLAG (1<<1) |
392 | #define I915_DISPLAY_PORT_INTERRUPT (1<<17) | 385 | #define VSYNC_PIPEB_FLAG (1<<5) |
393 | #define I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT (1<<15) | 386 | #define VSYNC_PIPEA_FLAG (1<<7) |
394 | #define I915_GMCH_THERMAL_SENSOR_EVENT_INTERRUPT (1<<14) | 387 | #define HWB_OOM_FLAG (1<<13) /* binner out of memory */ |
395 | #define I915_HWB_OOM_INTERRUPT (1<<13) /* binner out of memory */ | ||
396 | #define I915_SYNC_STATUS_INTERRUPT (1<<12) | ||
397 | #define I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT (1<<11) | ||
398 | #define I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT (1<<10) | ||
399 | #define I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT (1<<9) | ||
400 | #define I915_DISPLAY_PLANE_C_FLIP_PENDING_INTERRUPT (1<<8) | ||
401 | #define I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT (1<<7) | ||
402 | #define I915_DISPLAY_PIPE_A_EVENT_INTERRUPT (1<<6) | ||
403 | #define I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT (1<<5) | ||
404 | #define I915_DISPLAY_PIPE_B_EVENT_INTERRUPT (1<<4) | ||
405 | #define I915_DEBUG_INTERRUPT (1<<2) | ||
406 | #define I915_USER_INTERRUPT (1<<1) | ||
407 | |||
408 | 388 | ||
409 | #define I915REG_HWSTAM 0x02098 | 389 | #define I915REG_HWSTAM 0x02098 |
410 | #define I915REG_INT_IDENTITY_R 0x020a4 | 390 | #define I915REG_INT_IDENTITY_R 0x020a4 |
411 | #define I915REG_INT_MASK_R 0x020a8 | 391 | #define I915REG_INT_MASK_R 0x020a8 |
412 | #define I915REG_INT_ENABLE_R 0x020a0 | 392 | #define I915REG_INT_ENABLE_R 0x020a0 |
413 | #define I915REG_INSTPM 0x020c0 | ||
414 | |||
415 | #define PIPEADSL 0x70000 | ||
416 | #define PIPEBDSL 0x71000 | ||
417 | 393 | ||
418 | #define I915REG_PIPEASTAT 0x70024 | 394 | #define I915REG_PIPEASTAT 0x70024 |
419 | #define I915REG_PIPEBSTAT 0x71024 | 395 | #define I915REG_PIPEBSTAT 0x71024 |
420 | /* | ||
421 | * The two pipe frame counter registers are not synchronized, so | ||
422 | * reading a stable value is somewhat tricky. The following code | ||
423 | * should work: | ||
424 | * | ||
425 | * do { | ||
426 | * high1 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >> | ||
427 | * PIPE_FRAME_HIGH_SHIFT; | ||
428 | * low1 = ((INREG(PIPEAFRAMEPIXEL) & PIPE_FRAME_LOW_MASK) >> | ||
429 | * PIPE_FRAME_LOW_SHIFT); | ||
430 | * high2 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >> | ||
431 | * PIPE_FRAME_HIGH_SHIFT); | ||
432 | * } while (high1 != high2); | ||
433 | * frame = (high1 << 8) | low1; | ||
434 | */ | ||
435 | #define PIPEAFRAMEHIGH 0x70040 | ||
436 | #define PIPEBFRAMEHIGH 0x71040 | ||
437 | #define PIPE_FRAME_HIGH_MASK 0x0000ffff | ||
438 | #define PIPE_FRAME_HIGH_SHIFT 0 | ||
439 | #define PIPEAFRAMEPIXEL 0x70044 | ||
440 | #define PIPEBFRAMEPIXEL 0x71044 | ||
441 | 396 | ||
442 | #define PIPE_FRAME_LOW_MASK 0xff000000 | 397 | #define I915_VBLANK_INTERRUPT_ENABLE (1UL<<17) |
443 | #define PIPE_FRAME_LOW_SHIFT 24 | 398 | #define I915_VBLANK_CLEAR (1UL<<1) |
444 | /* | ||
445 | * Pixel within the current frame is counted in the PIPEAFRAMEPIXEL register | ||
446 | * and is 24 bits wide. | ||
447 | */ | ||
448 | #define PIPE_PIXEL_MASK 0x00ffffff | ||
449 | #define PIPE_PIXEL_SHIFT 0 | ||
450 | |||
451 | #define I915_FIFO_UNDERRUN_STATUS (1UL<<31) | ||
452 | #define I915_CRC_ERROR_ENABLE (1UL<<29) | ||
453 | #define I915_CRC_DONE_ENABLE (1UL<<28) | ||
454 | #define I915_GMBUS_EVENT_ENABLE (1UL<<27) | ||
455 | #define I915_VSYNC_INTERRUPT_ENABLE (1UL<<25) | ||
456 | #define I915_DISPLAY_LINE_COMPARE_ENABLE (1UL<<24) | ||
457 | #define I915_DPST_EVENT_ENABLE (1UL<<23) | ||
458 | #define I915_LEGACY_BLC_EVENT_ENABLE (1UL<<22) | ||
459 | #define I915_ODD_FIELD_INTERRUPT_ENABLE (1UL<<21) | ||
460 | #define I915_EVEN_FIELD_INTERRUPT_ENABLE (1UL<<20) | ||
461 | #define I915_START_VBLANK_INTERRUPT_ENABLE (1UL<<18) /* 965 or later */ | ||
462 | #define I915_VBLANK_INTERRUPT_ENABLE (1UL<<17) | ||
463 | #define I915_OVERLAY_UPDATED_ENABLE (1UL<<16) | ||
464 | #define I915_CRC_ERROR_INTERRUPT_STATUS (1UL<<13) | ||
465 | #define I915_CRC_DONE_INTERRUPT_STATUS (1UL<<12) | ||
466 | #define I915_GMBUS_INTERRUPT_STATUS (1UL<<11) | ||
467 | #define I915_VSYNC_INTERRUPT_STATUS (1UL<<9) | ||
468 | #define I915_DISPLAY_LINE_COMPARE_STATUS (1UL<<8) | ||
469 | #define I915_DPST_EVENT_STATUS (1UL<<7) | ||
470 | #define I915_LEGACY_BLC_EVENT_STATUS (1UL<<6) | ||
471 | #define I915_ODD_FIELD_INTERRUPT_STATUS (1UL<<5) | ||
472 | #define I915_EVEN_FIELD_INTERRUPT_STATUS (1UL<<4) | ||
473 | #define I915_START_VBLANK_INTERRUPT_STATUS (1UL<<2) /* 965 or later */ | ||
474 | #define I915_VBLANK_INTERRUPT_STATUS (1UL<<1) | ||
475 | #define I915_OVERLAY_UPDATED_STATUS (1UL<<0) | ||
476 | 399 | ||
477 | #define SRX_INDEX 0x3c4 | 400 | #define SRX_INDEX 0x3c4 |
478 | #define SRX_DATA 0x3c5 | 401 | #define SRX_DATA 0x3c5 |
@@ -749,6 +672,8 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); | |||
749 | /** P1 value is 2 greater than this field */ | 672 | /** P1 value is 2 greater than this field */ |
750 | # define VGA0_PD_P1_MASK (0x1f << 0) | 673 | # define VGA0_PD_P1_MASK (0x1f << 0) |
751 | 674 | ||
675 | /* PCI D state control register */ | ||
676 | #define D_STATE 0x6104 | ||
752 | #define DSPCLK_GATE_D 0x6200 | 677 | #define DSPCLK_GATE_D 0x6200 |
753 | 678 | ||
754 | /* I830 CRTC registers */ | 679 | /* I830 CRTC registers */ |
@@ -1059,6 +984,12 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); | |||
1059 | #define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21) | 984 | #define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21) |
1060 | #define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21) | 985 | #define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21) |
1061 | 986 | ||
987 | #define DSPARB 0x70030 | ||
988 | #define DSPARB_CSTART_MASK (0x7f << 7) | ||
989 | #define DSPARB_CSTART_SHIFT 7 | ||
990 | #define DSPARB_BSTART_MASK (0x7f) | ||
991 | #define DSPARB_BSTART_SHIFT 0 | ||
992 | |||
1062 | #define PIPEBCONF 0x71008 | 993 | #define PIPEBCONF 0x71008 |
1063 | #define PIPEBCONF_ENABLE (1<<31) | 994 | #define PIPEBCONF_ENABLE (1<<31) |
1064 | #define PIPEBCONF_DISABLE 0 | 995 | #define PIPEBCONF_DISABLE 0 |
diff --git a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c index 023ce66ef3ab..f7f16e7a8bf3 100644 --- a/drivers/char/drm/i915_irq.c +++ b/drivers/char/drm/i915_irq.c | |||
@@ -38,109 +38,6 @@ | |||
38 | #define MAX_NOPID ((u32)~0) | 38 | #define MAX_NOPID ((u32)~0) |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * i915_get_pipe - return the the pipe associated with a given plane | ||
42 | * @dev: DRM device | ||
43 | * @plane: plane to look for | ||
44 | * | ||
45 | * The Intel Mesa & 2D drivers call the vblank routines with a plane number | ||
46 | * rather than a pipe number, since they may not always be equal. This routine | ||
47 | * maps the given @plane back to a pipe number. | ||
48 | */ | ||
49 | static int | ||
50 | i915_get_pipe(struct drm_device *dev, int plane) | ||
51 | { | ||
52 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | ||
53 | u32 dspcntr; | ||
54 | |||
55 | dspcntr = plane ? I915_READ(DSPBCNTR) : I915_READ(DSPACNTR); | ||
56 | |||
57 | return dspcntr & DISPPLANE_SEL_PIPE_MASK ? 1 : 0; | ||
58 | } | ||
59 | |||
60 | /** | ||
61 | * i915_get_plane - return the the plane associated with a given pipe | ||
62 | * @dev: DRM device | ||
63 | * @pipe: pipe to look for | ||
64 | * | ||
65 | * The Intel Mesa & 2D drivers call the vblank routines with a plane number | ||
66 | * rather than a plane number, since they may not always be equal. This routine | ||
67 | * maps the given @pipe back to a plane number. | ||
68 | */ | ||
69 | static int | ||
70 | i915_get_plane(struct drm_device *dev, int pipe) | ||
71 | { | ||
72 | if (i915_get_pipe(dev, 0) == pipe) | ||
73 | return 0; | ||
74 | return 1; | ||
75 | } | ||
76 | |||
77 | /** | ||
78 | * i915_pipe_enabled - check if a pipe is enabled | ||
79 | * @dev: DRM device | ||
80 | * @pipe: pipe to check | ||
81 | * | ||
82 | * Reading certain registers when the pipe is disabled can hang the chip. | ||
83 | * Use this routine to make sure the PLL is running and the pipe is active | ||
84 | * before reading such registers if unsure. | ||
85 | */ | ||
86 | static int | ||
87 | i915_pipe_enabled(struct drm_device *dev, int pipe) | ||
88 | { | ||
89 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | ||
90 | unsigned long pipeconf = pipe ? PIPEBCONF : PIPEACONF; | ||
91 | |||
92 | if (I915_READ(pipeconf) & PIPEACONF_ENABLE) | ||
93 | return 1; | ||
94 | |||
95 | return 0; | ||
96 | } | ||
97 | |||
98 | /** | ||
99 | * Emit a synchronous flip. | ||
100 | * | ||
101 | * This function must be called with the drawable spinlock held. | ||
102 | */ | ||
103 | static void | ||
104 | i915_dispatch_vsync_flip(struct drm_device *dev, struct drm_drawable_info *drw, | ||
105 | int plane) | ||
106 | { | ||
107 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | ||
108 | drm_i915_sarea_t *sarea_priv = dev_priv->sarea_priv; | ||
109 | u16 x1, y1, x2, y2; | ||
110 | int pf_planes = 1 << plane; | ||
111 | |||
112 | /* If the window is visible on the other plane, we have to flip on that | ||
113 | * plane as well. | ||
114 | */ | ||
115 | if (plane == 1) { | ||
116 | x1 = sarea_priv->planeA_x; | ||
117 | y1 = sarea_priv->planeA_y; | ||
118 | x2 = x1 + sarea_priv->planeA_w; | ||
119 | y2 = y1 + sarea_priv->planeA_h; | ||
120 | } else { | ||
121 | x1 = sarea_priv->planeB_x; | ||
122 | y1 = sarea_priv->planeB_y; | ||
123 | x2 = x1 + sarea_priv->planeB_w; | ||
124 | y2 = y1 + sarea_priv->planeB_h; | ||
125 | } | ||
126 | |||
127 | if (x2 > 0 && y2 > 0) { | ||
128 | int i, num_rects = drw->num_rects; | ||
129 | struct drm_clip_rect *rect = drw->rects; | ||
130 | |||
131 | for (i = 0; i < num_rects; i++) | ||
132 | if (!(rect[i].x1 >= x2 || rect[i].y1 >= y2 || | ||
133 | rect[i].x2 <= x1 || rect[i].y2 <= y1)) { | ||
134 | pf_planes = 0x3; | ||
135 | |||
136 | break; | ||
137 | } | ||
138 | } | ||
139 | |||
140 | i915_dispatch_flip(dev, pf_planes, 1); | ||
141 | } | ||
142 | |||
143 | /** | ||
144 | * Emit blits for scheduled buffer swaps. | 41 | * Emit blits for scheduled buffer swaps. |
145 | * | 42 | * |
146 | * This function will be called with the HW lock held. | 43 | * This function will be called with the HW lock held. |
@@ -148,19 +45,20 @@ i915_dispatch_vsync_flip(struct drm_device *dev, struct drm_drawable_info *drw, | |||
148 | static void i915_vblank_tasklet(struct drm_device *dev) | 45 | static void i915_vblank_tasklet(struct drm_device *dev) |
149 | { | 46 | { |
150 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 47 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
48 | unsigned long irqflags; | ||
151 | struct list_head *list, *tmp, hits, *hit; | 49 | struct list_head *list, *tmp, hits, *hit; |
152 | int nhits, nrects, slice[2], upper[2], lower[2], i, num_pages; | 50 | int nhits, nrects, slice[2], upper[2], lower[2], i; |
153 | unsigned counter[2]; | 51 | unsigned counter[2] = { atomic_read(&dev->vbl_received), |
52 | atomic_read(&dev->vbl_received2) }; | ||
154 | struct drm_drawable_info *drw; | 53 | struct drm_drawable_info *drw; |
155 | drm_i915_sarea_t *sarea_priv = dev_priv->sarea_priv; | 54 | drm_i915_sarea_t *sarea_priv = dev_priv->sarea_priv; |
156 | u32 cpp = dev_priv->cpp, offsets[3]; | 55 | u32 cpp = dev_priv->cpp; |
157 | u32 cmd = (cpp == 4) ? (XY_SRC_COPY_BLT_CMD | | 56 | u32 cmd = (cpp == 4) ? (XY_SRC_COPY_BLT_CMD | |
158 | XY_SRC_COPY_BLT_WRITE_ALPHA | | 57 | XY_SRC_COPY_BLT_WRITE_ALPHA | |
159 | XY_SRC_COPY_BLT_WRITE_RGB) | 58 | XY_SRC_COPY_BLT_WRITE_RGB) |
160 | : XY_SRC_COPY_BLT_CMD; | 59 | : XY_SRC_COPY_BLT_CMD; |
161 | u32 src_pitch = sarea_priv->pitch * cpp; | 60 | u32 src_pitch = sarea_priv->pitch * cpp; |
162 | u32 dst_pitch = sarea_priv->pitch * cpp; | 61 | u32 dst_pitch = sarea_priv->pitch * cpp; |
163 | /* COPY rop (0xcc), map cpp to magic color depth constants */ | ||
164 | u32 ropcpp = (0xcc << 16) | ((cpp - 1) << 24); | 62 | u32 ropcpp = (0xcc << 16) | ((cpp - 1) << 24); |
165 | RING_LOCALS; | 63 | RING_LOCALS; |
166 | 64 | ||
@@ -173,34 +71,24 @@ static void i915_vblank_tasklet(struct drm_device *dev) | |||
173 | src_pitch >>= 2; | 71 | src_pitch >>= 2; |
174 | } | 72 | } |
175 | 73 | ||
176 | counter[0] = drm_vblank_count(dev, 0); | ||
177 | counter[1] = drm_vblank_count(dev, 1); | ||
178 | |||
179 | DRM_DEBUG("\n"); | 74 | DRM_DEBUG("\n"); |
180 | 75 | ||
181 | INIT_LIST_HEAD(&hits); | 76 | INIT_LIST_HEAD(&hits); |
182 | 77 | ||
183 | nhits = nrects = 0; | 78 | nhits = nrects = 0; |
184 | 79 | ||
185 | /* No irqsave/restore necessary. This tasklet may be run in an | 80 | spin_lock_irqsave(&dev_priv->swaps_lock, irqflags); |
186 | * interrupt context or normal context, but we don't have to worry | ||
187 | * about getting interrupted by something acquiring the lock, because | ||
188 | * we are the interrupt context thing that acquires the lock. | ||
189 | */ | ||
190 | spin_lock(&dev_priv->swaps_lock); | ||
191 | 81 | ||
192 | /* Find buffer swaps scheduled for this vertical blank */ | 82 | /* Find buffer swaps scheduled for this vertical blank */ |
193 | list_for_each_safe(list, tmp, &dev_priv->vbl_swaps.head) { | 83 | list_for_each_safe(list, tmp, &dev_priv->vbl_swaps.head) { |
194 | drm_i915_vbl_swap_t *vbl_swap = | 84 | drm_i915_vbl_swap_t *vbl_swap = |
195 | list_entry(list, drm_i915_vbl_swap_t, head); | 85 | list_entry(list, drm_i915_vbl_swap_t, head); |
196 | int pipe = i915_get_pipe(dev, vbl_swap->plane); | ||
197 | 86 | ||
198 | if ((counter[pipe] - vbl_swap->sequence) > (1<<23)) | 87 | if ((counter[vbl_swap->pipe] - vbl_swap->sequence) > (1<<23)) |
199 | continue; | 88 | continue; |
200 | 89 | ||
201 | list_del(list); | 90 | list_del(list); |
202 | dev_priv->swaps_pending--; | 91 | dev_priv->swaps_pending--; |
203 | drm_vblank_put(dev, pipe); | ||
204 | 92 | ||
205 | spin_unlock(&dev_priv->swaps_lock); | 93 | spin_unlock(&dev_priv->swaps_lock); |
206 | spin_lock(&dev->drw_lock); | 94 | spin_lock(&dev->drw_lock); |
@@ -238,23 +126,43 @@ static void i915_vblank_tasklet(struct drm_device *dev) | |||
238 | spin_lock(&dev_priv->swaps_lock); | 126 | spin_lock(&dev_priv->swaps_lock); |
239 | } | 127 | } |
240 | 128 | ||
241 | spin_unlock(&dev_priv->swaps_lock); | 129 | if (nhits == 0) { |
242 | 130 | spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags); | |
243 | if (nhits == 0) | ||
244 | return; | 131 | return; |
132 | } | ||
133 | |||
134 | spin_unlock(&dev_priv->swaps_lock); | ||
245 | 135 | ||
246 | i915_kernel_lost_context(dev); | 136 | i915_kernel_lost_context(dev); |
247 | 137 | ||
248 | upper[0] = upper[1] = 0; | 138 | if (IS_I965G(dev)) { |
249 | slice[0] = max(sarea_priv->planeA_h / nhits, 1); | 139 | BEGIN_LP_RING(4); |
250 | slice[1] = max(sarea_priv->planeB_h / nhits, 1); | 140 | |
251 | lower[0] = sarea_priv->planeA_y + slice[0]; | 141 | OUT_RING(GFX_OP_DRAWRECT_INFO_I965); |
252 | lower[1] = sarea_priv->planeB_y + slice[0]; | 142 | OUT_RING(0); |
143 | OUT_RING(((sarea_priv->width - 1) & 0xffff) | ((sarea_priv->height - 1) << 16)); | ||
144 | OUT_RING(0); | ||
145 | ADVANCE_LP_RING(); | ||
146 | } else { | ||
147 | BEGIN_LP_RING(6); | ||
253 | 148 | ||
254 | offsets[0] = sarea_priv->front_offset; | 149 | OUT_RING(GFX_OP_DRAWRECT_INFO); |
255 | offsets[1] = sarea_priv->back_offset; | 150 | OUT_RING(0); |
256 | offsets[2] = sarea_priv->third_offset; | 151 | OUT_RING(0); |
257 | num_pages = sarea_priv->third_handle ? 3 : 2; | 152 | OUT_RING(sarea_priv->width | sarea_priv->height << 16); |
153 | OUT_RING(sarea_priv->width | sarea_priv->height << 16); | ||
154 | OUT_RING(0); | ||
155 | |||
156 | ADVANCE_LP_RING(); | ||
157 | } | ||
158 | |||
159 | sarea_priv->ctxOwner = DRM_KERNEL_CONTEXT; | ||
160 | |||
161 | upper[0] = upper[1] = 0; | ||
162 | slice[0] = max(sarea_priv->pipeA_h / nhits, 1); | ||
163 | slice[1] = max(sarea_priv->pipeB_h / nhits, 1); | ||
164 | lower[0] = sarea_priv->pipeA_y + slice[0]; | ||
165 | lower[1] = sarea_priv->pipeB_y + slice[0]; | ||
258 | 166 | ||
259 | spin_lock(&dev->drw_lock); | 167 | spin_lock(&dev->drw_lock); |
260 | 168 | ||
@@ -266,8 +174,6 @@ static void i915_vblank_tasklet(struct drm_device *dev) | |||
266 | for (i = 0; i++ < nhits; | 174 | for (i = 0; i++ < nhits; |
267 | upper[0] = lower[0], lower[0] += slice[0], | 175 | upper[0] = lower[0], lower[0] += slice[0], |
268 | upper[1] = lower[1], lower[1] += slice[1]) { | 176 | upper[1] = lower[1], lower[1] += slice[1]) { |
269 | int init_drawrect = 1; | ||
270 | |||
271 | if (i == nhits) | 177 | if (i == nhits) |
272 | lower[0] = lower[1] = sarea_priv->height; | 178 | lower[0] = lower[1] = sarea_priv->height; |
273 | 179 | ||
@@ -275,7 +181,7 @@ static void i915_vblank_tasklet(struct drm_device *dev) | |||
275 | drm_i915_vbl_swap_t *swap_hit = | 181 | drm_i915_vbl_swap_t *swap_hit = |
276 | list_entry(hit, drm_i915_vbl_swap_t, head); | 182 | list_entry(hit, drm_i915_vbl_swap_t, head); |
277 | struct drm_clip_rect *rect; | 183 | struct drm_clip_rect *rect; |
278 | int num_rects, plane, front, back; | 184 | int num_rects, pipe; |
279 | unsigned short top, bottom; | 185 | unsigned short top, bottom; |
280 | 186 | ||
281 | drw = drm_get_drawable_info(dev, swap_hit->drw_id); | 187 | drw = drm_get_drawable_info(dev, swap_hit->drw_id); |
@@ -283,50 +189,10 @@ static void i915_vblank_tasklet(struct drm_device *dev) | |||
283 | if (!drw) | 189 | if (!drw) |
284 | continue; | 190 | continue; |
285 | 191 | ||
286 | plane = swap_hit->plane; | ||
287 | |||
288 | if (swap_hit->flip) { | ||
289 | i915_dispatch_vsync_flip(dev, drw, plane); | ||
290 | continue; | ||
291 | } | ||
292 | |||
293 | if (init_drawrect) { | ||
294 | int width = sarea_priv->width; | ||
295 | int height = sarea_priv->height; | ||
296 | if (IS_I965G(dev)) { | ||
297 | BEGIN_LP_RING(4); | ||
298 | |||
299 | OUT_RING(GFX_OP_DRAWRECT_INFO_I965); | ||
300 | OUT_RING(0); | ||
301 | OUT_RING(((width - 1) & 0xffff) | ((height - 1) << 16)); | ||
302 | OUT_RING(0); | ||
303 | |||
304 | ADVANCE_LP_RING(); | ||
305 | } else { | ||
306 | BEGIN_LP_RING(6); | ||
307 | |||
308 | OUT_RING(GFX_OP_DRAWRECT_INFO); | ||
309 | OUT_RING(0); | ||
310 | OUT_RING(0); | ||
311 | OUT_RING(((width - 1) & 0xffff) | ((height - 1) << 16)); | ||
312 | OUT_RING(0); | ||
313 | OUT_RING(0); | ||
314 | |||
315 | ADVANCE_LP_RING(); | ||
316 | } | ||
317 | |||
318 | sarea_priv->ctxOwner = DRM_KERNEL_CONTEXT; | ||
319 | |||
320 | init_drawrect = 0; | ||
321 | } | ||
322 | |||
323 | rect = drw->rects; | 192 | rect = drw->rects; |
324 | top = upper[plane]; | 193 | pipe = swap_hit->pipe; |
325 | bottom = lower[plane]; | 194 | top = upper[pipe]; |
326 | 195 | bottom = lower[pipe]; | |
327 | front = (dev_priv->sarea_priv->pf_current_page >> | ||
328 | (2 * plane)) & 0x3; | ||
329 | back = (front + 1) % num_pages; | ||
330 | 196 | ||
331 | for (num_rects = drw->num_rects; num_rects--; rect++) { | 197 | for (num_rects = drw->num_rects; num_rects--; rect++) { |
332 | int y1 = max(rect->y1, top); | 198 | int y1 = max(rect->y1, top); |
@@ -341,17 +207,17 @@ static void i915_vblank_tasklet(struct drm_device *dev) | |||
341 | OUT_RING(ropcpp | dst_pitch); | 207 | OUT_RING(ropcpp | dst_pitch); |
342 | OUT_RING((y1 << 16) | rect->x1); | 208 | OUT_RING((y1 << 16) | rect->x1); |
343 | OUT_RING((y2 << 16) | rect->x2); | 209 | OUT_RING((y2 << 16) | rect->x2); |
344 | OUT_RING(offsets[front]); | 210 | OUT_RING(sarea_priv->front_offset); |
345 | OUT_RING((y1 << 16) | rect->x1); | 211 | OUT_RING((y1 << 16) | rect->x1); |
346 | OUT_RING(src_pitch); | 212 | OUT_RING(src_pitch); |
347 | OUT_RING(offsets[back]); | 213 | OUT_RING(sarea_priv->back_offset); |
348 | 214 | ||
349 | ADVANCE_LP_RING(); | 215 | ADVANCE_LP_RING(); |
350 | } | 216 | } |
351 | } | 217 | } |
352 | } | 218 | } |
353 | 219 | ||
354 | spin_unlock(&dev->drw_lock); | 220 | spin_unlock_irqrestore(&dev->drw_lock, irqflags); |
355 | 221 | ||
356 | list_for_each_safe(hit, tmp, &hits) { | 222 | list_for_each_safe(hit, tmp, &hits) { |
357 | drm_i915_vbl_swap_t *swap_hit = | 223 | drm_i915_vbl_swap_t *swap_hit = |
@@ -363,112 +229,67 @@ static void i915_vblank_tasklet(struct drm_device *dev) | |||
363 | } | 229 | } |
364 | } | 230 | } |
365 | 231 | ||
366 | u32 i915_get_vblank_counter(struct drm_device *dev, int plane) | ||
367 | { | ||
368 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | ||
369 | unsigned long high_frame; | ||
370 | unsigned long low_frame; | ||
371 | u32 high1, high2, low, count; | ||
372 | int pipe; | ||
373 | |||
374 | pipe = i915_get_pipe(dev, plane); | ||
375 | high_frame = pipe ? PIPEBFRAMEHIGH : PIPEAFRAMEHIGH; | ||
376 | low_frame = pipe ? PIPEBFRAMEPIXEL : PIPEAFRAMEPIXEL; | ||
377 | |||
378 | if (!i915_pipe_enabled(dev, pipe)) { | ||
379 | printk(KERN_ERR "trying to get vblank count for disabled " | ||
380 | "pipe %d\n", pipe); | ||
381 | return 0; | ||
382 | } | ||
383 | |||
384 | /* | ||
385 | * High & low register fields aren't synchronized, so make sure | ||
386 | * we get a low value that's stable across two reads of the high | ||
387 | * register. | ||
388 | */ | ||
389 | do { | ||
390 | high1 = ((I915_READ(high_frame) & PIPE_FRAME_HIGH_MASK) >> | ||
391 | PIPE_FRAME_HIGH_SHIFT); | ||
392 | low = ((I915_READ(low_frame) & PIPE_FRAME_LOW_MASK) >> | ||
393 | PIPE_FRAME_LOW_SHIFT); | ||
394 | high2 = ((I915_READ(high_frame) & PIPE_FRAME_HIGH_MASK) >> | ||
395 | PIPE_FRAME_HIGH_SHIFT); | ||
396 | } while (high1 != high2); | ||
397 | |||
398 | count = (high1 << 8) | low; | ||
399 | |||
400 | /* count may be reset by other driver(e.g. 2D driver), | ||
401 | we have no way to know if it is wrapped or resetted | ||
402 | when count is zero. do a rough guess. | ||
403 | */ | ||
404 | if (count == 0 && dev->last_vblank[pipe] < dev->max_vblank_count/2) | ||
405 | dev->last_vblank[pipe] = 0; | ||
406 | |||
407 | return count; | ||
408 | } | ||
409 | |||
410 | irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | 232 | irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) |
411 | { | 233 | { |
412 | struct drm_device *dev = (struct drm_device *) arg; | 234 | struct drm_device *dev = (struct drm_device *) arg; |
413 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 235 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
414 | u32 iir; | 236 | u16 temp; |
415 | u32 pipea_stats, pipeb_stats; | 237 | u32 pipea_stats, pipeb_stats; |
416 | int vblank = 0; | ||
417 | |||
418 | iir = I915_READ(I915REG_INT_IDENTITY_R); | ||
419 | if (iir == 0) { | ||
420 | DRM_DEBUG ("iir 0x%08x im 0x%08x ie 0x%08x pipea 0x%08x pipeb 0x%08x\n", | ||
421 | iir, | ||
422 | I915_READ(I915REG_INT_MASK_R), | ||
423 | I915_READ(I915REG_INT_ENABLE_R), | ||
424 | I915_READ(I915REG_PIPEASTAT), | ||
425 | I915_READ(I915REG_PIPEBSTAT)); | ||
426 | return IRQ_NONE; | ||
427 | } | ||
428 | 238 | ||
429 | /* | 239 | pipea_stats = I915_READ(I915REG_PIPEASTAT); |
430 | * Clear the PIPE(A|B)STAT regs before the IIR otherwise | 240 | pipeb_stats = I915_READ(I915REG_PIPEBSTAT); |
431 | * we may get extra interrupts. | ||
432 | */ | ||
433 | if (iir & I915_DISPLAY_PIPE_A_EVENT_INTERRUPT) { | ||
434 | pipea_stats = I915_READ(I915REG_PIPEASTAT); | ||
435 | if (pipea_stats & (I915_START_VBLANK_INTERRUPT_STATUS| | ||
436 | I915_VBLANK_INTERRUPT_STATUS)) | ||
437 | { | ||
438 | vblank++; | ||
439 | drm_handle_vblank(dev, i915_get_plane(dev, 0)); | ||
440 | } | ||
441 | I915_WRITE(I915REG_PIPEASTAT, pipea_stats); | ||
442 | } | ||
443 | if (iir & I915_DISPLAY_PIPE_B_EVENT_INTERRUPT) { | ||
444 | pipeb_stats = I915_READ(I915REG_PIPEBSTAT); | ||
445 | if (pipeb_stats & (I915_START_VBLANK_INTERRUPT_STATUS| | ||
446 | I915_VBLANK_INTERRUPT_STATUS)) | ||
447 | { | ||
448 | vblank++; | ||
449 | drm_handle_vblank(dev, i915_get_plane(dev, 1)); | ||
450 | } | ||
451 | I915_WRITE(I915REG_PIPEBSTAT, pipeb_stats); | ||
452 | } | ||
453 | 241 | ||
454 | if (dev_priv->sarea_priv) | 242 | temp = I915_READ16(I915REG_INT_IDENTITY_R); |
455 | dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); | ||
456 | 243 | ||
457 | I915_WRITE(I915REG_INT_IDENTITY_R, iir); | 244 | temp &= (USER_INT_FLAG | VSYNC_PIPEA_FLAG | VSYNC_PIPEB_FLAG); |
458 | (void) I915_READ(I915REG_INT_IDENTITY_R); /* Flush posted write */ | ||
459 | 245 | ||
460 | if (iir & I915_USER_INTERRUPT) { | 246 | DRM_DEBUG("%s flag=%08x\n", __FUNCTION__, temp); |
247 | |||
248 | if (temp == 0) | ||
249 | return IRQ_NONE; | ||
250 | |||
251 | I915_WRITE16(I915REG_INT_IDENTITY_R, temp); | ||
252 | (void) I915_READ16(I915REG_INT_IDENTITY_R); | ||
253 | DRM_READMEMORYBARRIER(); | ||
254 | |||
255 | dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); | ||
256 | |||
257 | if (temp & USER_INT_FLAG) | ||
461 | DRM_WAKEUP(&dev_priv->irq_queue); | 258 | DRM_WAKEUP(&dev_priv->irq_queue); |
462 | } | 259 | |
463 | if (vblank) { | 260 | if (temp & (VSYNC_PIPEA_FLAG | VSYNC_PIPEB_FLAG)) { |
261 | int vblank_pipe = dev_priv->vblank_pipe; | ||
262 | |||
263 | if ((vblank_pipe & | ||
264 | (DRM_I915_VBLANK_PIPE_A | DRM_I915_VBLANK_PIPE_B)) | ||
265 | == (DRM_I915_VBLANK_PIPE_A | DRM_I915_VBLANK_PIPE_B)) { | ||
266 | if (temp & VSYNC_PIPEA_FLAG) | ||
267 | atomic_inc(&dev->vbl_received); | ||
268 | if (temp & VSYNC_PIPEB_FLAG) | ||
269 | atomic_inc(&dev->vbl_received2); | ||
270 | } else if (((temp & VSYNC_PIPEA_FLAG) && | ||
271 | (vblank_pipe & DRM_I915_VBLANK_PIPE_A)) || | ||
272 | ((temp & VSYNC_PIPEB_FLAG) && | ||
273 | (vblank_pipe & DRM_I915_VBLANK_PIPE_B))) | ||
274 | atomic_inc(&dev->vbl_received); | ||
275 | |||
276 | DRM_WAKEUP(&dev->vbl_queue); | ||
277 | drm_vbl_send_signals(dev); | ||
278 | |||
464 | if (dev_priv->swaps_pending > 0) | 279 | if (dev_priv->swaps_pending > 0) |
465 | drm_locked_tasklet(dev, i915_vblank_tasklet); | 280 | drm_locked_tasklet(dev, i915_vblank_tasklet); |
281 | I915_WRITE(I915REG_PIPEASTAT, | ||
282 | pipea_stats|I915_VBLANK_INTERRUPT_ENABLE| | ||
283 | I915_VBLANK_CLEAR); | ||
284 | I915_WRITE(I915REG_PIPEBSTAT, | ||
285 | pipeb_stats|I915_VBLANK_INTERRUPT_ENABLE| | ||
286 | I915_VBLANK_CLEAR); | ||
466 | } | 287 | } |
467 | 288 | ||
468 | return IRQ_HANDLED; | 289 | return IRQ_HANDLED; |
469 | } | 290 | } |
470 | 291 | ||
471 | static int i915_emit_irq(struct drm_device *dev) | 292 | static int i915_emit_irq(struct drm_device * dev) |
472 | { | 293 | { |
473 | drm_i915_private_t *dev_priv = dev->dev_private; | 294 | drm_i915_private_t *dev_priv = dev->dev_private; |
474 | RING_LOCALS; | 295 | RING_LOCALS; |
@@ -515,12 +336,42 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr) | |||
515 | READ_BREADCRUMB(dev_priv), (int)dev_priv->counter); | 336 | READ_BREADCRUMB(dev_priv), (int)dev_priv->counter); |
516 | } | 337 | } |
517 | 338 | ||
518 | if (dev_priv->sarea_priv) | 339 | dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); |
519 | dev_priv->sarea_priv->last_dispatch = | ||
520 | READ_BREADCRUMB(dev_priv); | ||
521 | return ret; | 340 | return ret; |
522 | } | 341 | } |
523 | 342 | ||
343 | static int i915_driver_vblank_do_wait(struct drm_device *dev, unsigned int *sequence, | ||
344 | atomic_t *counter) | ||
345 | { | ||
346 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
347 | unsigned int cur_vblank; | ||
348 | int ret = 0; | ||
349 | |||
350 | if (!dev_priv) { | ||
351 | DRM_ERROR("called with no initialization\n"); | ||
352 | return -EINVAL; | ||
353 | } | ||
354 | |||
355 | DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ, | ||
356 | (((cur_vblank = atomic_read(counter)) | ||
357 | - *sequence) <= (1<<23))); | ||
358 | |||
359 | *sequence = cur_vblank; | ||
360 | |||
361 | return ret; | ||
362 | } | ||
363 | |||
364 | |||
365 | int i915_driver_vblank_wait(struct drm_device *dev, unsigned int *sequence) | ||
366 | { | ||
367 | return i915_driver_vblank_do_wait(dev, sequence, &dev->vbl_received); | ||
368 | } | ||
369 | |||
370 | int i915_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence) | ||
371 | { | ||
372 | return i915_driver_vblank_do_wait(dev, sequence, &dev->vbl_received2); | ||
373 | } | ||
374 | |||
524 | /* Needs the lock as it touches the ring. | 375 | /* Needs the lock as it touches the ring. |
525 | */ | 376 | */ |
526 | int i915_irq_emit(struct drm_device *dev, void *data, | 377 | int i915_irq_emit(struct drm_device *dev, void *data, |
@@ -563,96 +414,18 @@ int i915_irq_wait(struct drm_device *dev, void *data, | |||
563 | return i915_wait_irq(dev, irqwait->irq_seq); | 414 | return i915_wait_irq(dev, irqwait->irq_seq); |
564 | } | 415 | } |
565 | 416 | ||
566 | int i915_enable_vblank(struct drm_device *dev, int plane) | ||
567 | { | ||
568 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | ||
569 | int pipe = i915_get_pipe(dev, plane); | ||
570 | u32 pipestat_reg = 0; | ||
571 | u32 pipestat; | ||
572 | |||
573 | switch (pipe) { | ||
574 | case 0: | ||
575 | pipestat_reg = I915REG_PIPEASTAT; | ||
576 | dev_priv->irq_enable_reg |= I915_DISPLAY_PIPE_A_EVENT_INTERRUPT; | ||
577 | break; | ||
578 | case 1: | ||
579 | pipestat_reg = I915REG_PIPEBSTAT; | ||
580 | dev_priv->irq_enable_reg |= I915_DISPLAY_PIPE_B_EVENT_INTERRUPT; | ||
581 | break; | ||
582 | default: | ||
583 | DRM_ERROR("tried to enable vblank on non-existent pipe %d\n", | ||
584 | pipe); | ||
585 | break; | ||
586 | } | ||
587 | |||
588 | if (pipestat_reg) | ||
589 | { | ||
590 | pipestat = I915_READ (pipestat_reg); | ||
591 | /* | ||
592 | * Older chips didn't have the start vblank interrupt, | ||
593 | * but | ||
594 | */ | ||
595 | if (IS_I965G (dev)) | ||
596 | pipestat |= I915_START_VBLANK_INTERRUPT_ENABLE; | ||
597 | else | ||
598 | pipestat |= I915_VBLANK_INTERRUPT_ENABLE; | ||
599 | /* | ||
600 | * Clear any pending status | ||
601 | */ | ||
602 | pipestat |= (I915_START_VBLANK_INTERRUPT_STATUS | | ||
603 | I915_VBLANK_INTERRUPT_STATUS); | ||
604 | I915_WRITE(pipestat_reg, pipestat); | ||
605 | } | ||
606 | I915_WRITE(I915REG_INT_ENABLE_R, dev_priv->irq_enable_reg); | ||
607 | |||
608 | return 0; | ||
609 | } | ||
610 | |||
611 | void i915_disable_vblank(struct drm_device *dev, int plane) | ||
612 | { | ||
613 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | ||
614 | int pipe = i915_get_pipe(dev, plane); | ||
615 | u32 pipestat_reg = 0; | ||
616 | u32 pipestat; | ||
617 | |||
618 | switch (pipe) { | ||
619 | case 0: | ||
620 | pipestat_reg = I915REG_PIPEASTAT; | ||
621 | dev_priv->irq_enable_reg &= ~I915_DISPLAY_PIPE_A_EVENT_INTERRUPT; | ||
622 | break; | ||
623 | case 1: | ||
624 | pipestat_reg = I915REG_PIPEBSTAT; | ||
625 | dev_priv->irq_enable_reg &= ~I915_DISPLAY_PIPE_B_EVENT_INTERRUPT; | ||
626 | break; | ||
627 | default: | ||
628 | DRM_ERROR("tried to disable vblank on non-existent pipe %d\n", | ||
629 | pipe); | ||
630 | break; | ||
631 | } | ||
632 | |||
633 | I915_WRITE(I915REG_INT_ENABLE_R, dev_priv->irq_enable_reg); | ||
634 | if (pipestat_reg) | ||
635 | { | ||
636 | pipestat = I915_READ (pipestat_reg); | ||
637 | pipestat &= ~(I915_START_VBLANK_INTERRUPT_ENABLE | | ||
638 | I915_VBLANK_INTERRUPT_ENABLE); | ||
639 | /* | ||
640 | * Clear any pending status | ||
641 | */ | ||
642 | pipestat |= (I915_START_VBLANK_INTERRUPT_STATUS | | ||
643 | I915_VBLANK_INTERRUPT_STATUS); | ||
644 | I915_WRITE(pipestat_reg, pipestat); | ||
645 | } | ||
646 | } | ||
647 | |||
648 | static void i915_enable_interrupt (struct drm_device *dev) | 417 | static void i915_enable_interrupt (struct drm_device *dev) |
649 | { | 418 | { |
650 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 419 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
420 | u16 flag; | ||
651 | 421 | ||
652 | dev_priv->irq_enable_reg |= I915_USER_INTERRUPT; | 422 | flag = 0; |
423 | if (dev_priv->vblank_pipe & DRM_I915_VBLANK_PIPE_A) | ||
424 | flag |= VSYNC_PIPEA_FLAG; | ||
425 | if (dev_priv->vblank_pipe & DRM_I915_VBLANK_PIPE_B) | ||
426 | flag |= VSYNC_PIPEB_FLAG; | ||
653 | 427 | ||
654 | I915_WRITE(I915REG_INT_ENABLE_R, dev_priv->irq_enable_reg); | 428 | I915_WRITE16(I915REG_INT_ENABLE_R, USER_INT_FLAG | flag); |
655 | dev_priv->irq_enabled = 1; | ||
656 | } | 429 | } |
657 | 430 | ||
658 | /* Set the vblank monitor pipe | 431 | /* Set the vblank monitor pipe |
@@ -675,6 +448,8 @@ int i915_vblank_pipe_set(struct drm_device *dev, void *data, | |||
675 | 448 | ||
676 | dev_priv->vblank_pipe = pipe->pipe; | 449 | dev_priv->vblank_pipe = pipe->pipe; |
677 | 450 | ||
451 | i915_enable_interrupt (dev); | ||
452 | |||
678 | return 0; | 453 | return 0; |
679 | } | 454 | } |
680 | 455 | ||
@@ -692,9 +467,9 @@ int i915_vblank_pipe_get(struct drm_device *dev, void *data, | |||
692 | 467 | ||
693 | flag = I915_READ(I915REG_INT_ENABLE_R); | 468 | flag = I915_READ(I915REG_INT_ENABLE_R); |
694 | pipe->pipe = 0; | 469 | pipe->pipe = 0; |
695 | if (flag & I915_DISPLAY_PIPE_A_EVENT_INTERRUPT) | 470 | if (flag & VSYNC_PIPEA_FLAG) |
696 | pipe->pipe |= DRM_I915_VBLANK_PIPE_A; | 471 | pipe->pipe |= DRM_I915_VBLANK_PIPE_A; |
697 | if (flag & I915_DISPLAY_PIPE_B_EVENT_INTERRUPT) | 472 | if (flag & VSYNC_PIPEB_FLAG) |
698 | pipe->pipe |= DRM_I915_VBLANK_PIPE_B; | 473 | pipe->pipe |= DRM_I915_VBLANK_PIPE_B; |
699 | 474 | ||
700 | return 0; | 475 | return 0; |
@@ -709,30 +484,27 @@ int i915_vblank_swap(struct drm_device *dev, void *data, | |||
709 | drm_i915_private_t *dev_priv = dev->dev_private; | 484 | drm_i915_private_t *dev_priv = dev->dev_private; |
710 | drm_i915_vblank_swap_t *swap = data; | 485 | drm_i915_vblank_swap_t *swap = data; |
711 | drm_i915_vbl_swap_t *vbl_swap; | 486 | drm_i915_vbl_swap_t *vbl_swap; |
712 | unsigned int pipe, seqtype, curseq, plane; | 487 | unsigned int pipe, seqtype, curseq; |
713 | unsigned long irqflags; | 488 | unsigned long irqflags; |
714 | struct list_head *list; | 489 | struct list_head *list; |
715 | int ret; | ||
716 | 490 | ||
717 | if (!dev_priv) { | 491 | if (!dev_priv) { |
718 | DRM_ERROR("%s called with no initialization\n", __func__); | 492 | DRM_ERROR("%s called with no initialization\n", __func__); |
719 | return -EINVAL; | 493 | return -EINVAL; |
720 | } | 494 | } |
721 | 495 | ||
722 | if (!dev_priv->sarea_priv || dev_priv->sarea_priv->rotation) { | 496 | if (dev_priv->sarea_priv->rotation) { |
723 | DRM_DEBUG("Rotation not supported\n"); | 497 | DRM_DEBUG("Rotation not supported\n"); |
724 | return -EINVAL; | 498 | return -EINVAL; |
725 | } | 499 | } |
726 | 500 | ||
727 | if (swap->seqtype & ~(_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE | | 501 | if (swap->seqtype & ~(_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE | |
728 | _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS | | 502 | _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS)) { |
729 | _DRM_VBLANK_FLIP)) { | ||
730 | DRM_ERROR("Invalid sequence type 0x%x\n", swap->seqtype); | 503 | DRM_ERROR("Invalid sequence type 0x%x\n", swap->seqtype); |
731 | return -EINVAL; | 504 | return -EINVAL; |
732 | } | 505 | } |
733 | 506 | ||
734 | plane = (swap->seqtype & _DRM_VBLANK_SECONDARY) ? 1 : 0; | 507 | pipe = (swap->seqtype & _DRM_VBLANK_SECONDARY) ? 1 : 0; |
735 | pipe = i915_get_pipe(dev, plane); | ||
736 | 508 | ||
737 | seqtype = swap->seqtype & (_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE); | 509 | seqtype = swap->seqtype & (_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE); |
738 | 510 | ||
@@ -743,11 +515,6 @@ int i915_vblank_swap(struct drm_device *dev, void *data, | |||
743 | 515 | ||
744 | spin_lock_irqsave(&dev->drw_lock, irqflags); | 516 | spin_lock_irqsave(&dev->drw_lock, irqflags); |
745 | 517 | ||
746 | /* It makes no sense to schedule a swap for a drawable that doesn't have | ||
747 | * valid information at this point. E.g. this could mean that the X | ||
748 | * server is too old to push drawable information to the DRM, in which | ||
749 | * case all such swaps would become ineffective. | ||
750 | */ | ||
751 | if (!drm_get_drawable_info(dev, swap->drawable)) { | 518 | if (!drm_get_drawable_info(dev, swap->drawable)) { |
752 | spin_unlock_irqrestore(&dev->drw_lock, irqflags); | 519 | spin_unlock_irqrestore(&dev->drw_lock, irqflags); |
753 | DRM_DEBUG("Invalid drawable ID %d\n", swap->drawable); | 520 | DRM_DEBUG("Invalid drawable ID %d\n", swap->drawable); |
@@ -756,8 +523,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data, | |||
756 | 523 | ||
757 | spin_unlock_irqrestore(&dev->drw_lock, irqflags); | 524 | spin_unlock_irqrestore(&dev->drw_lock, irqflags); |
758 | 525 | ||
759 | drm_update_vblank_count(dev, pipe); | 526 | curseq = atomic_read(pipe ? &dev->vbl_received2 : &dev->vbl_received); |
760 | curseq = drm_vblank_count(dev, pipe); | ||
761 | 527 | ||
762 | if (seqtype == _DRM_VBLANK_RELATIVE) | 528 | if (seqtype == _DRM_VBLANK_RELATIVE) |
763 | swap->sequence += curseq; | 529 | swap->sequence += curseq; |
@@ -771,43 +537,14 @@ int i915_vblank_swap(struct drm_device *dev, void *data, | |||
771 | } | 537 | } |
772 | } | 538 | } |
773 | 539 | ||
774 | if (swap->seqtype & _DRM_VBLANK_FLIP) { | ||
775 | swap->sequence--; | ||
776 | |||
777 | if ((curseq - swap->sequence) <= (1<<23)) { | ||
778 | struct drm_drawable_info *drw; | ||
779 | |||
780 | LOCK_TEST_WITH_RETURN(dev, file_priv); | ||
781 | |||
782 | spin_lock_irqsave(&dev->drw_lock, irqflags); | ||
783 | |||
784 | drw = drm_get_drawable_info(dev, swap->drawable); | ||
785 | |||
786 | if (!drw) { | ||
787 | spin_unlock_irqrestore(&dev->drw_lock, | ||
788 | irqflags); | ||
789 | DRM_DEBUG("Invalid drawable ID %d\n", | ||
790 | swap->drawable); | ||
791 | return -EINVAL; | ||
792 | } | ||
793 | |||
794 | i915_dispatch_vsync_flip(dev, drw, plane); | ||
795 | |||
796 | spin_unlock_irqrestore(&dev->drw_lock, irqflags); | ||
797 | |||
798 | return 0; | ||
799 | } | ||
800 | } | ||
801 | |||
802 | spin_lock_irqsave(&dev_priv->swaps_lock, irqflags); | 540 | spin_lock_irqsave(&dev_priv->swaps_lock, irqflags); |
803 | 541 | ||
804 | list_for_each(list, &dev_priv->vbl_swaps.head) { | 542 | list_for_each(list, &dev_priv->vbl_swaps.head) { |
805 | vbl_swap = list_entry(list, drm_i915_vbl_swap_t, head); | 543 | vbl_swap = list_entry(list, drm_i915_vbl_swap_t, head); |
806 | 544 | ||
807 | if (vbl_swap->drw_id == swap->drawable && | 545 | if (vbl_swap->drw_id == swap->drawable && |
808 | vbl_swap->plane == plane && | 546 | vbl_swap->pipe == pipe && |
809 | vbl_swap->sequence == swap->sequence) { | 547 | vbl_swap->sequence == swap->sequence) { |
810 | vbl_swap->flip = (swap->seqtype & _DRM_VBLANK_FLIP); | ||
811 | spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags); | 548 | spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags); |
812 | DRM_DEBUG("Already scheduled\n"); | 549 | DRM_DEBUG("Already scheduled\n"); |
813 | return 0; | 550 | return 0; |
@@ -830,19 +567,9 @@ int i915_vblank_swap(struct drm_device *dev, void *data, | |||
830 | 567 | ||
831 | DRM_DEBUG("\n"); | 568 | DRM_DEBUG("\n"); |
832 | 569 | ||
833 | ret = drm_vblank_get(dev, pipe); | ||
834 | if (ret) { | ||
835 | drm_free(vbl_swap, sizeof(*vbl_swap), DRM_MEM_DRIVER); | ||
836 | return ret; | ||
837 | } | ||
838 | |||
839 | vbl_swap->drw_id = swap->drawable; | 570 | vbl_swap->drw_id = swap->drawable; |
840 | vbl_swap->plane = plane; | 571 | vbl_swap->pipe = pipe; |
841 | vbl_swap->sequence = swap->sequence; | 572 | vbl_swap->sequence = swap->sequence; |
842 | vbl_swap->flip = (swap->seqtype & _DRM_VBLANK_FLIP); | ||
843 | |||
844 | if (vbl_swap->flip) | ||
845 | swap->sequence++; | ||
846 | 573 | ||
847 | spin_lock_irqsave(&dev_priv->swaps_lock, irqflags); | 574 | spin_lock_irqsave(&dev_priv->swaps_lock, irqflags); |
848 | 575 | ||
@@ -860,57 +587,37 @@ void i915_driver_irq_preinstall(struct drm_device * dev) | |||
860 | { | 587 | { |
861 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 588 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
862 | 589 | ||
863 | I915_WRITE16(I915REG_HWSTAM, 0xeffe); | 590 | I915_WRITE16(I915REG_HWSTAM, 0xfffe); |
864 | I915_WRITE16(I915REG_INT_MASK_R, 0x0); | 591 | I915_WRITE16(I915REG_INT_MASK_R, 0x0); |
865 | I915_WRITE16(I915REG_INT_ENABLE_R, 0x0); | 592 | I915_WRITE16(I915REG_INT_ENABLE_R, 0x0); |
866 | } | 593 | } |
867 | 594 | ||
868 | int i915_driver_irq_postinstall(struct drm_device * dev) | 595 | void i915_driver_irq_postinstall(struct drm_device * dev) |
869 | { | 596 | { |
870 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 597 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
871 | int ret, num_pipes = 2; | ||
872 | 598 | ||
873 | spin_lock_init(&dev_priv->swaps_lock); | 599 | spin_lock_init(&dev_priv->swaps_lock); |
874 | INIT_LIST_HEAD(&dev_priv->vbl_swaps.head); | 600 | INIT_LIST_HEAD(&dev_priv->vbl_swaps.head); |
875 | dev_priv->swaps_pending = 0; | 601 | dev_priv->swaps_pending = 0; |
876 | 602 | ||
877 | dev_priv->user_irq_refcount = 0; | 603 | if (!dev_priv->vblank_pipe) |
878 | dev_priv->irq_enable_reg = 0; | 604 | dev_priv->vblank_pipe = DRM_I915_VBLANK_PIPE_A; |
879 | |||
880 | ret = drm_vblank_init(dev, num_pipes); | ||
881 | if (ret) | ||
882 | return ret; | ||
883 | |||
884 | dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ | ||
885 | |||
886 | i915_enable_interrupt(dev); | 605 | i915_enable_interrupt(dev); |
887 | DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); | 606 | DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); |
888 | |||
889 | /* | ||
890 | * Initialize the hardware status page IRQ location. | ||
891 | */ | ||
892 | |||
893 | I915_WRITE(I915REG_INSTPM, (1 << 5) | (1 << 21)); | ||
894 | return 0; | ||
895 | } | 607 | } |
896 | 608 | ||
897 | void i915_driver_irq_uninstall(struct drm_device * dev) | 609 | void i915_driver_irq_uninstall(struct drm_device * dev) |
898 | { | 610 | { |
899 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 611 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
900 | u32 temp; | 612 | u16 temp; |
901 | 613 | ||
902 | if (!dev_priv) | 614 | if (!dev_priv) |
903 | return; | 615 | return; |
904 | 616 | ||
905 | dev_priv->irq_enabled = 0; | 617 | I915_WRITE16(I915REG_HWSTAM, 0xffff); |
906 | I915_WRITE(I915REG_HWSTAM, 0xffffffff); | 618 | I915_WRITE16(I915REG_INT_MASK_R, 0xffff); |
907 | I915_WRITE(I915REG_INT_MASK_R, 0xffffffff); | 619 | I915_WRITE16(I915REG_INT_ENABLE_R, 0x0); |
908 | I915_WRITE(I915REG_INT_ENABLE_R, 0x0); | 620 | |
909 | 621 | temp = I915_READ16(I915REG_INT_IDENTITY_R); | |
910 | temp = I915_READ(I915REG_PIPEASTAT); | 622 | I915_WRITE16(I915REG_INT_IDENTITY_R, temp); |
911 | I915_WRITE(I915REG_PIPEASTAT, temp); | ||
912 | temp = I915_READ(I915REG_PIPEBSTAT); | ||
913 | I915_WRITE(I915REG_PIPEBSTAT, temp); | ||
914 | temp = I915_READ(I915REG_INT_IDENTITY_R); | ||
915 | I915_WRITE(I915REG_INT_IDENTITY_R, temp); | ||
916 | } | 623 | } |
diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c index 6b3790939e76..5572939fc7d1 100644 --- a/drivers/char/drm/mga_drv.c +++ b/drivers/char/drm/mga_drv.c | |||
@@ -45,16 +45,15 @@ static struct pci_device_id pciidlist[] = { | |||
45 | static struct drm_driver driver = { | 45 | static struct drm_driver driver = { |
46 | .driver_features = | 46 | .driver_features = |
47 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | | 47 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | |
48 | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED, | 48 | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | |
49 | DRIVER_IRQ_VBL, | ||
49 | .dev_priv_size = sizeof(drm_mga_buf_priv_t), | 50 | .dev_priv_size = sizeof(drm_mga_buf_priv_t), |
50 | .load = mga_driver_load, | 51 | .load = mga_driver_load, |
51 | .unload = mga_driver_unload, | 52 | .unload = mga_driver_unload, |
52 | .lastclose = mga_driver_lastclose, | 53 | .lastclose = mga_driver_lastclose, |
53 | .dma_quiescent = mga_driver_dma_quiescent, | 54 | .dma_quiescent = mga_driver_dma_quiescent, |
54 | .device_is_agp = mga_driver_device_is_agp, | 55 | .device_is_agp = mga_driver_device_is_agp, |
55 | .get_vblank_counter = mga_get_vblank_counter, | 56 | .vblank_wait = mga_driver_vblank_wait, |
56 | .enable_vblank = mga_enable_vblank, | ||
57 | .disable_vblank = mga_disable_vblank, | ||
58 | .irq_preinstall = mga_driver_irq_preinstall, | 57 | .irq_preinstall = mga_driver_irq_preinstall, |
59 | .irq_postinstall = mga_driver_irq_postinstall, | 58 | .irq_postinstall = mga_driver_irq_postinstall, |
60 | .irq_uninstall = mga_driver_irq_uninstall, | 59 | .irq_uninstall = mga_driver_irq_uninstall, |
diff --git a/drivers/char/drm/mga_drv.h b/drivers/char/drm/mga_drv.h index 8f7291f36363..f6ebd24bd587 100644 --- a/drivers/char/drm/mga_drv.h +++ b/drivers/char/drm/mga_drv.h | |||
@@ -120,7 +120,6 @@ typedef struct drm_mga_private { | |||
120 | u32 clear_cmd; | 120 | u32 clear_cmd; |
121 | u32 maccess; | 121 | u32 maccess; |
122 | 122 | ||
123 | atomic_t vbl_received; /**< Number of vblanks received. */ | ||
124 | wait_queue_head_t fence_queue; | 123 | wait_queue_head_t fence_queue; |
125 | atomic_t last_fence_retired; | 124 | atomic_t last_fence_retired; |
126 | u32 next_fence_to_post; | 125 | u32 next_fence_to_post; |
@@ -182,14 +181,11 @@ extern int mga_warp_install_microcode(drm_mga_private_t * dev_priv); | |||
182 | extern int mga_warp_init(drm_mga_private_t * dev_priv); | 181 | extern int mga_warp_init(drm_mga_private_t * dev_priv); |
183 | 182 | ||
184 | /* mga_irq.c */ | 183 | /* mga_irq.c */ |
185 | extern int mga_enable_vblank(struct drm_device *dev, int crtc); | ||
186 | extern void mga_disable_vblank(struct drm_device *dev, int crtc); | ||
187 | extern u32 mga_get_vblank_counter(struct drm_device *dev, int crtc); | ||
188 | extern int mga_driver_fence_wait(struct drm_device * dev, unsigned int *sequence); | 184 | extern int mga_driver_fence_wait(struct drm_device * dev, unsigned int *sequence); |
189 | extern int mga_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence); | 185 | extern int mga_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence); |
190 | extern irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS); | 186 | extern irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS); |
191 | extern void mga_driver_irq_preinstall(struct drm_device * dev); | 187 | extern void mga_driver_irq_preinstall(struct drm_device * dev); |
192 | extern int mga_driver_irq_postinstall(struct drm_device * dev); | 188 | extern void mga_driver_irq_postinstall(struct drm_device * dev); |
193 | extern void mga_driver_irq_uninstall(struct drm_device * dev); | 189 | extern void mga_driver_irq_uninstall(struct drm_device * dev); |
194 | extern long mga_compat_ioctl(struct file *filp, unsigned int cmd, | 190 | extern long mga_compat_ioctl(struct file *filp, unsigned int cmd, |
195 | unsigned long arg); | 191 | unsigned long arg); |
diff --git a/drivers/char/drm/mga_irq.c b/drivers/char/drm/mga_irq.c index 06852fb4b278..9302cb8f0f83 100644 --- a/drivers/char/drm/mga_irq.c +++ b/drivers/char/drm/mga_irq.c | |||
@@ -35,20 +35,6 @@ | |||
35 | #include "mga_drm.h" | 35 | #include "mga_drm.h" |
36 | #include "mga_drv.h" | 36 | #include "mga_drv.h" |
37 | 37 | ||
38 | u32 mga_get_vblank_counter(struct drm_device *dev, int crtc) | ||
39 | { | ||
40 | const drm_mga_private_t *const dev_priv = | ||
41 | (drm_mga_private_t *) dev->dev_private; | ||
42 | |||
43 | if (crtc != 0) { | ||
44 | return 0; | ||
45 | } | ||
46 | |||
47 | |||
48 | return atomic_read(&dev_priv->vbl_received); | ||
49 | } | ||
50 | |||
51 | |||
52 | irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS) | 38 | irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS) |
53 | { | 39 | { |
54 | struct drm_device *dev = (struct drm_device *) arg; | 40 | struct drm_device *dev = (struct drm_device *) arg; |
@@ -61,8 +47,9 @@ irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS) | |||
61 | /* VBLANK interrupt */ | 47 | /* VBLANK interrupt */ |
62 | if (status & MGA_VLINEPEN) { | 48 | if (status & MGA_VLINEPEN) { |
63 | MGA_WRITE(MGA_ICLEAR, MGA_VLINEICLR); | 49 | MGA_WRITE(MGA_ICLEAR, MGA_VLINEICLR); |
64 | atomic_inc(&dev_priv->vbl_received); | 50 | atomic_inc(&dev->vbl_received); |
65 | drm_handle_vblank(dev, 0); | 51 | DRM_WAKEUP(&dev->vbl_queue); |
52 | drm_vbl_send_signals(dev); | ||
66 | handled = 1; | 53 | handled = 1; |
67 | } | 54 | } |
68 | 55 | ||
@@ -91,34 +78,22 @@ irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS) | |||
91 | return IRQ_NONE; | 78 | return IRQ_NONE; |
92 | } | 79 | } |
93 | 80 | ||
94 | int mga_enable_vblank(struct drm_device *dev, int crtc) | 81 | int mga_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence) |
95 | { | 82 | { |
96 | drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; | 83 | unsigned int cur_vblank; |
97 | 84 | int ret = 0; | |
98 | if (crtc != 0) { | ||
99 | DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", | ||
100 | crtc); | ||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | MGA_WRITE(MGA_IEN, MGA_VLINEIEN | MGA_SOFTRAPEN); | ||
105 | return 0; | ||
106 | } | ||
107 | 85 | ||
86 | /* Assume that the user has missed the current sequence number | ||
87 | * by about a day rather than she wants to wait for years | ||
88 | * using vertical blanks... | ||
89 | */ | ||
90 | DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ, | ||
91 | (((cur_vblank = atomic_read(&dev->vbl_received)) | ||
92 | - *sequence) <= (1 << 23))); | ||
108 | 93 | ||
109 | void mga_disable_vblank(struct drm_device *dev, int crtc) | 94 | *sequence = cur_vblank; |
110 | { | ||
111 | if (crtc != 0) { | ||
112 | DRM_ERROR("tried to disable vblank on non-existent crtc %d\n", | ||
113 | crtc); | ||
114 | } | ||
115 | 95 | ||
116 | /* Do *NOT* disable the vertical refresh interrupt. MGA doesn't have | 96 | return ret; |
117 | * a nice hardware counter that tracks the number of refreshes when | ||
118 | * the interrupt is disabled, and the kernel doesn't know the refresh | ||
119 | * rate to calculate an estimate. | ||
120 | */ | ||
121 | /* MGA_WRITE(MGA_IEN, MGA_VLINEIEN | MGA_SOFTRAPEN); */ | ||
122 | } | 97 | } |
123 | 98 | ||
124 | int mga_driver_fence_wait(struct drm_device * dev, unsigned int *sequence) | 99 | int mga_driver_fence_wait(struct drm_device * dev, unsigned int *sequence) |
@@ -150,22 +125,14 @@ void mga_driver_irq_preinstall(struct drm_device * dev) | |||
150 | MGA_WRITE(MGA_ICLEAR, ~0); | 125 | MGA_WRITE(MGA_ICLEAR, ~0); |
151 | } | 126 | } |
152 | 127 | ||
153 | int mga_driver_irq_postinstall(struct drm_device * dev) | 128 | void mga_driver_irq_postinstall(struct drm_device * dev) |
154 | { | 129 | { |
155 | drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; | 130 | drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; |
156 | int ret; | ||
157 | |||
158 | ret = drm_vblank_init(dev, 1); | ||
159 | if (ret) | ||
160 | return ret; | ||
161 | 131 | ||
162 | DRM_INIT_WAITQUEUE(&dev_priv->fence_queue); | 132 | DRM_INIT_WAITQUEUE(&dev_priv->fence_queue); |
163 | 133 | ||
164 | /* Turn on soft trap interrupt. Vertical blank interrupts are enabled | 134 | /* Turn on vertical blank interrupt and soft trap interrupt. */ |
165 | * in mga_enable_vblank. | 135 | MGA_WRITE(MGA_IEN, MGA_VLINEIEN | MGA_SOFTRAPEN); |
166 | */ | ||
167 | MGA_WRITE(MGA_IEN, MGA_SOFTRAPEN); | ||
168 | return 0; | ||
169 | } | 136 | } |
170 | 137 | ||
171 | void mga_driver_irq_uninstall(struct drm_device * dev) | 138 | void mga_driver_irq_uninstall(struct drm_device * dev) |
diff --git a/drivers/char/drm/r128_drv.c b/drivers/char/drm/r128_drv.c index 2888aa01ebc7..6108e7587e12 100644 --- a/drivers/char/drm/r128_drv.c +++ b/drivers/char/drm/r128_drv.c | |||
@@ -43,13 +43,12 @@ static struct pci_device_id pciidlist[] = { | |||
43 | static struct drm_driver driver = { | 43 | static struct drm_driver driver = { |
44 | .driver_features = | 44 | .driver_features = |
45 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | | 45 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | |
46 | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED, | 46 | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | |
47 | DRIVER_IRQ_VBL, | ||
47 | .dev_priv_size = sizeof(drm_r128_buf_priv_t), | 48 | .dev_priv_size = sizeof(drm_r128_buf_priv_t), |
48 | .preclose = r128_driver_preclose, | 49 | .preclose = r128_driver_preclose, |
49 | .lastclose = r128_driver_lastclose, | 50 | .lastclose = r128_driver_lastclose, |
50 | .get_vblank_counter = r128_get_vblank_counter, | 51 | .vblank_wait = r128_driver_vblank_wait, |
51 | .enable_vblank = r128_enable_vblank, | ||
52 | .disable_vblank = r128_disable_vblank, | ||
53 | .irq_preinstall = r128_driver_irq_preinstall, | 52 | .irq_preinstall = r128_driver_irq_preinstall, |
54 | .irq_postinstall = r128_driver_irq_postinstall, | 53 | .irq_postinstall = r128_driver_irq_postinstall, |
55 | .irq_uninstall = r128_driver_irq_uninstall, | 54 | .irq_uninstall = r128_driver_irq_uninstall, |
diff --git a/drivers/char/drm/r128_drv.h b/drivers/char/drm/r128_drv.h index 80af9e09e75d..011105e51ac6 100644 --- a/drivers/char/drm/r128_drv.h +++ b/drivers/char/drm/r128_drv.h | |||
@@ -97,8 +97,6 @@ typedef struct drm_r128_private { | |||
97 | u32 crtc_offset; | 97 | u32 crtc_offset; |
98 | u32 crtc_offset_cntl; | 98 | u32 crtc_offset_cntl; |
99 | 99 | ||
100 | atomic_t vbl_received; | ||
101 | |||
102 | u32 color_fmt; | 100 | u32 color_fmt; |
103 | unsigned int front_offset; | 101 | unsigned int front_offset; |
104 | unsigned int front_pitch; | 102 | unsigned int front_pitch; |
@@ -151,12 +149,11 @@ extern int r128_wait_ring(drm_r128_private_t * dev_priv, int n); | |||
151 | extern int r128_do_cce_idle(drm_r128_private_t * dev_priv); | 149 | extern int r128_do_cce_idle(drm_r128_private_t * dev_priv); |
152 | extern int r128_do_cleanup_cce(struct drm_device * dev); | 150 | extern int r128_do_cleanup_cce(struct drm_device * dev); |
153 | 151 | ||
154 | extern int r128_enable_vblank(struct drm_device *dev, int crtc); | 152 | extern int r128_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence); |
155 | extern void r128_disable_vblank(struct drm_device *dev, int crtc); | 153 | |
156 | extern u32 r128_get_vblank_counter(struct drm_device *dev, int crtc); | ||
157 | extern irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS); | 154 | extern irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS); |
158 | extern void r128_driver_irq_preinstall(struct drm_device * dev); | 155 | extern void r128_driver_irq_preinstall(struct drm_device * dev); |
159 | extern int r128_driver_irq_postinstall(struct drm_device * dev); | 156 | extern void r128_driver_irq_postinstall(struct drm_device * dev); |
160 | extern void r128_driver_irq_uninstall(struct drm_device * dev); | 157 | extern void r128_driver_irq_uninstall(struct drm_device * dev); |
161 | extern void r128_driver_lastclose(struct drm_device * dev); | 158 | extern void r128_driver_lastclose(struct drm_device * dev); |
162 | extern void r128_driver_preclose(struct drm_device * dev, | 159 | extern void r128_driver_preclose(struct drm_device * dev, |
diff --git a/drivers/char/drm/r128_irq.c b/drivers/char/drm/r128_irq.c index 5b95bd898f95..c76fdca7662d 100644 --- a/drivers/char/drm/r128_irq.c +++ b/drivers/char/drm/r128_irq.c | |||
@@ -35,16 +35,6 @@ | |||
35 | #include "r128_drm.h" | 35 | #include "r128_drm.h" |
36 | #include "r128_drv.h" | 36 | #include "r128_drv.h" |
37 | 37 | ||
38 | u32 r128_get_vblank_counter(struct drm_device *dev, int crtc) | ||
39 | { | ||
40 | const drm_r128_private_t *dev_priv = dev->dev_private; | ||
41 | |||
42 | if (crtc != 0) | ||
43 | return 0; | ||
44 | |||
45 | return atomic_read(&dev_priv->vbl_received); | ||
46 | } | ||
47 | |||
48 | irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS) | 38 | irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS) |
49 | { | 39 | { |
50 | struct drm_device *dev = (struct drm_device *) arg; | 40 | struct drm_device *dev = (struct drm_device *) arg; |
@@ -56,38 +46,30 @@ irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS) | |||
56 | /* VBLANK interrupt */ | 46 | /* VBLANK interrupt */ |
57 | if (status & R128_CRTC_VBLANK_INT) { | 47 | if (status & R128_CRTC_VBLANK_INT) { |
58 | R128_WRITE(R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK); | 48 | R128_WRITE(R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK); |
59 | atomic_inc(&dev_priv->vbl_received); | 49 | atomic_inc(&dev->vbl_received); |
60 | drm_handle_vblank(dev, 0); | 50 | DRM_WAKEUP(&dev->vbl_queue); |
51 | drm_vbl_send_signals(dev); | ||
61 | return IRQ_HANDLED; | 52 | return IRQ_HANDLED; |
62 | } | 53 | } |
63 | return IRQ_NONE; | 54 | return IRQ_NONE; |
64 | } | 55 | } |
65 | 56 | ||
66 | int r128_enable_vblank(struct drm_device *dev, int crtc) | 57 | int r128_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence) |
67 | { | 58 | { |
68 | drm_r128_private_t *dev_priv = dev->dev_private; | 59 | unsigned int cur_vblank; |
69 | 60 | int ret = 0; | |
70 | if (crtc != 0) { | ||
71 | DRM_ERROR("%s: bad crtc %d\n", __FUNCTION__, crtc); | ||
72 | return -EINVAL; | ||
73 | } | ||
74 | 61 | ||
75 | R128_WRITE(R128_GEN_INT_CNTL, R128_CRTC_VBLANK_INT_EN); | 62 | /* Assume that the user has missed the current sequence number |
76 | return 0; | 63 | * by about a day rather than she wants to wait for years |
77 | } | 64 | * using vertical blanks... |
65 | */ | ||
66 | DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ, | ||
67 | (((cur_vblank = atomic_read(&dev->vbl_received)) | ||
68 | - *sequence) <= (1 << 23))); | ||
78 | 69 | ||
79 | void r128_disable_vblank(struct drm_device *dev, int crtc) | 70 | *sequence = cur_vblank; |
80 | { | ||
81 | if (crtc != 0) | ||
82 | DRM_ERROR("%s: bad crtc %d\n", __FUNCTION__, crtc); | ||
83 | 71 | ||
84 | /* | 72 | return ret; |
85 | * FIXME: implement proper interrupt disable by using the vblank | ||
86 | * counter register (if available) | ||
87 | * | ||
88 | * R128_WRITE(R128_GEN_INT_CNTL, | ||
89 | * R128_READ(R128_GEN_INT_CNTL) & ~R128_CRTC_VBLANK_INT_EN); | ||
90 | */ | ||
91 | } | 73 | } |
92 | 74 | ||
93 | void r128_driver_irq_preinstall(struct drm_device * dev) | 75 | void r128_driver_irq_preinstall(struct drm_device * dev) |
@@ -100,9 +82,12 @@ void r128_driver_irq_preinstall(struct drm_device * dev) | |||
100 | R128_WRITE(R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK); | 82 | R128_WRITE(R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK); |
101 | } | 83 | } |
102 | 84 | ||
103 | int r128_driver_irq_postinstall(struct drm_device * dev) | 85 | void r128_driver_irq_postinstall(struct drm_device * dev) |
104 | { | 86 | { |
105 | return drm_vblank_init(dev, 1); | 87 | drm_r128_private_t *dev_priv = (drm_r128_private_t *) dev->dev_private; |
88 | |||
89 | /* Turn on VBL interrupt */ | ||
90 | R128_WRITE(R128_GEN_INT_CNTL, R128_CRTC_VBLANK_INT_EN); | ||
106 | } | 91 | } |
107 | 92 | ||
108 | void r128_driver_irq_uninstall(struct drm_device * dev) | 93 | void r128_driver_irq_uninstall(struct drm_device * dev) |
diff --git a/drivers/char/drm/radeon_drv.c b/drivers/char/drm/radeon_drv.c index a2610319624d..349ac3d3b848 100644 --- a/drivers/char/drm/radeon_drv.c +++ b/drivers/char/drm/radeon_drv.c | |||
@@ -59,7 +59,8 @@ static struct pci_device_id pciidlist[] = { | |||
59 | static struct drm_driver driver = { | 59 | static struct drm_driver driver = { |
60 | .driver_features = | 60 | .driver_features = |
61 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | | 61 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | |
62 | DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED, | 62 | DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED | |
63 | DRIVER_IRQ_VBL | DRIVER_IRQ_VBL2, | ||
63 | .dev_priv_size = sizeof(drm_radeon_buf_priv_t), | 64 | .dev_priv_size = sizeof(drm_radeon_buf_priv_t), |
64 | .load = radeon_driver_load, | 65 | .load = radeon_driver_load, |
65 | .firstopen = radeon_driver_firstopen, | 66 | .firstopen = radeon_driver_firstopen, |
@@ -68,9 +69,8 @@ static struct drm_driver driver = { | |||
68 | .postclose = radeon_driver_postclose, | 69 | .postclose = radeon_driver_postclose, |
69 | .lastclose = radeon_driver_lastclose, | 70 | .lastclose = radeon_driver_lastclose, |
70 | .unload = radeon_driver_unload, | 71 | .unload = radeon_driver_unload, |
71 | .get_vblank_counter = radeon_get_vblank_counter, | 72 | .vblank_wait = radeon_driver_vblank_wait, |
72 | .enable_vblank = radeon_enable_vblank, | 73 | .vblank_wait2 = radeon_driver_vblank_wait2, |
73 | .disable_vblank = radeon_disable_vblank, | ||
74 | .dri_library_name = dri_library_name, | 74 | .dri_library_name = dri_library_name, |
75 | .irq_preinstall = radeon_driver_irq_preinstall, | 75 | .irq_preinstall = radeon_driver_irq_preinstall, |
76 | .irq_postinstall = radeon_driver_irq_postinstall, | 76 | .irq_postinstall = radeon_driver_irq_postinstall, |
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h index b791420bd3d9..173ae620223a 100644 --- a/drivers/char/drm/radeon_drv.h +++ b/drivers/char/drm/radeon_drv.h | |||
@@ -304,9 +304,6 @@ typedef struct drm_radeon_private { | |||
304 | 304 | ||
305 | u32 scratch_ages[5]; | 305 | u32 scratch_ages[5]; |
306 | 306 | ||
307 | unsigned int crtc_last_cnt; | ||
308 | unsigned int crtc2_last_cnt; | ||
309 | |||
310 | /* starting from here on, data is preserved accross an open */ | 307 | /* starting from here on, data is preserved accross an open */ |
311 | uint32_t flags; /* see radeon_chip_flags */ | 308 | uint32_t flags; /* see radeon_chip_flags */ |
312 | unsigned long fb_aper_offset; | 309 | unsigned long fb_aper_offset; |
@@ -377,13 +374,13 @@ extern int radeon_irq_emit(struct drm_device *dev, void *data, struct drm_file * | |||
377 | extern int radeon_irq_wait(struct drm_device *dev, void *data, struct drm_file *file_priv); | 374 | extern int radeon_irq_wait(struct drm_device *dev, void *data, struct drm_file *file_priv); |
378 | 375 | ||
379 | extern void radeon_do_release(struct drm_device * dev); | 376 | extern void radeon_do_release(struct drm_device * dev); |
380 | extern u32 radeon_get_vblank_counter(struct drm_device *dev, int crtc); | 377 | extern int radeon_driver_vblank_wait(struct drm_device * dev, |
381 | extern int radeon_enable_vblank(struct drm_device *dev, int crtc); | 378 | unsigned int *sequence); |
382 | extern void radeon_disable_vblank(struct drm_device *dev, int crtc); | 379 | extern int radeon_driver_vblank_wait2(struct drm_device * dev, |
383 | extern void radeon_do_release(struct drm_device * dev); | 380 | unsigned int *sequence); |
384 | extern irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS); | 381 | extern irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS); |
385 | extern void radeon_driver_irq_preinstall(struct drm_device * dev); | 382 | extern void radeon_driver_irq_preinstall(struct drm_device * dev); |
386 | extern int radeon_driver_irq_postinstall(struct drm_device * dev); | 383 | extern void radeon_driver_irq_postinstall(struct drm_device * dev); |
387 | extern void radeon_driver_irq_uninstall(struct drm_device * dev); | 384 | extern void radeon_driver_irq_uninstall(struct drm_device * dev); |
388 | extern int radeon_vblank_crtc_get(struct drm_device *dev); | 385 | extern int radeon_vblank_crtc_get(struct drm_device *dev); |
389 | extern int radeon_vblank_crtc_set(struct drm_device *dev, int64_t value); | 386 | extern int radeon_vblank_crtc_set(struct drm_device *dev, int64_t value); |
@@ -561,12 +558,6 @@ extern int r300_do_cp_cmdbuf(struct drm_device * dev, | |||
561 | ? DRM_READ32( dev_priv->ring_rptr, RADEON_SCRATCHOFF(x) ) \ | 558 | ? DRM_READ32( dev_priv->ring_rptr, RADEON_SCRATCHOFF(x) ) \ |
562 | : RADEON_READ( RADEON_SCRATCH_REG0 + 4*(x) ) ) | 559 | : RADEON_READ( RADEON_SCRATCH_REG0 + 4*(x) ) ) |
563 | 560 | ||
564 | #define RADEON_CRTC_CRNT_FRAME 0x0214 | ||
565 | #define RADEON_CRTC2_CRNT_FRAME 0x0314 | ||
566 | |||
567 | #define RADEON_CRTC_STATUS 0x005c | ||
568 | #define RADEON_CRTC2_STATUS 0x03fc | ||
569 | |||
570 | #define RADEON_GEN_INT_CNTL 0x0040 | 561 | #define RADEON_GEN_INT_CNTL 0x0040 |
571 | # define RADEON_CRTC_VBLANK_MASK (1 << 0) | 562 | # define RADEON_CRTC_VBLANK_MASK (1 << 0) |
572 | # define RADEON_CRTC2_VBLANK_MASK (1 << 9) | 563 | # define RADEON_CRTC2_VBLANK_MASK (1 << 9) |
diff --git a/drivers/char/drm/radeon_irq.c b/drivers/char/drm/radeon_irq.c index 507d6b747a13..009af3814b6f 100644 --- a/drivers/char/drm/radeon_irq.c +++ b/drivers/char/drm/radeon_irq.c | |||
@@ -35,61 +35,12 @@ | |||
35 | #include "radeon_drm.h" | 35 | #include "radeon_drm.h" |
36 | #include "radeon_drv.h" | 36 | #include "radeon_drv.h" |
37 | 37 | ||
38 | static void radeon_irq_set_state(struct drm_device *dev, u32 mask, int state) | 38 | static __inline__ u32 radeon_acknowledge_irqs(drm_radeon_private_t * dev_priv, |
39 | u32 mask) | ||
39 | { | 40 | { |
40 | drm_radeon_private_t *dev_priv = dev->dev_private; | 41 | u32 irqs = RADEON_READ(RADEON_GEN_INT_STATUS) & mask; |
41 | |||
42 | if (state) | ||
43 | dev_priv->irq_enable_reg |= mask; | ||
44 | else | ||
45 | dev_priv->irq_enable_reg &= ~mask; | ||
46 | |||
47 | RADEON_WRITE(RADEON_GEN_INT_CNTL, dev_priv->irq_enable_reg); | ||
48 | } | ||
49 | |||
50 | int radeon_enable_vblank(struct drm_device *dev, int crtc) | ||
51 | { | ||
52 | switch (crtc) { | ||
53 | case 0: | ||
54 | radeon_irq_set_state(dev, RADEON_CRTC_VBLANK_MASK, 1); | ||
55 | break; | ||
56 | case 1: | ||
57 | radeon_irq_set_state(dev, RADEON_CRTC2_VBLANK_MASK, 1); | ||
58 | break; | ||
59 | default: | ||
60 | DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", | ||
61 | crtc); | ||
62 | return EINVAL; | ||
63 | } | ||
64 | |||
65 | return 0; | ||
66 | } | ||
67 | |||
68 | void radeon_disable_vblank(struct drm_device *dev, int crtc) | ||
69 | { | ||
70 | switch (crtc) { | ||
71 | case 0: | ||
72 | radeon_irq_set_state(dev, RADEON_CRTC_VBLANK_MASK, 0); | ||
73 | break; | ||
74 | case 1: | ||
75 | radeon_irq_set_state(dev, RADEON_CRTC2_VBLANK_MASK, 0); | ||
76 | break; | ||
77 | default: | ||
78 | DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", | ||
79 | crtc); | ||
80 | break; | ||
81 | } | ||
82 | } | ||
83 | |||
84 | static __inline__ u32 radeon_acknowledge_irqs(drm_radeon_private_t * dev_priv) | ||
85 | { | ||
86 | u32 irqs = RADEON_READ(RADEON_GEN_INT_STATUS) & | ||
87 | (RADEON_SW_INT_TEST | RADEON_CRTC_VBLANK_STAT | | ||
88 | RADEON_CRTC2_VBLANK_STAT); | ||
89 | |||
90 | if (irqs) | 42 | if (irqs) |
91 | RADEON_WRITE(RADEON_GEN_INT_STATUS, irqs); | 43 | RADEON_WRITE(RADEON_GEN_INT_STATUS, irqs); |
92 | |||
93 | return irqs; | 44 | return irqs; |
94 | } | 45 | } |
95 | 46 | ||
@@ -121,21 +72,39 @@ irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS) | |||
121 | /* Only consider the bits we're interested in - others could be used | 72 | /* Only consider the bits we're interested in - others could be used |
122 | * outside the DRM | 73 | * outside the DRM |
123 | */ | 74 | */ |
124 | stat = radeon_acknowledge_irqs(dev_priv); | 75 | stat = radeon_acknowledge_irqs(dev_priv, (RADEON_SW_INT_TEST_ACK | |
76 | RADEON_CRTC_VBLANK_STAT | | ||
77 | RADEON_CRTC2_VBLANK_STAT)); | ||
125 | if (!stat) | 78 | if (!stat) |
126 | return IRQ_NONE; | 79 | return IRQ_NONE; |
127 | 80 | ||
128 | stat &= dev_priv->irq_enable_reg; | 81 | stat &= dev_priv->irq_enable_reg; |
129 | 82 | ||
130 | /* SW interrupt */ | 83 | /* SW interrupt */ |
131 | if (stat & RADEON_SW_INT_TEST) | 84 | if (stat & RADEON_SW_INT_TEST) { |
132 | DRM_WAKEUP(&dev_priv->swi_queue); | 85 | DRM_WAKEUP(&dev_priv->swi_queue); |
86 | } | ||
133 | 87 | ||
134 | /* VBLANK interrupt */ | 88 | /* VBLANK interrupt */ |
135 | if (stat & RADEON_CRTC_VBLANK_STAT) | 89 | if (stat & (RADEON_CRTC_VBLANK_STAT|RADEON_CRTC2_VBLANK_STAT)) { |
136 | drm_handle_vblank(dev, 0); | 90 | int vblank_crtc = dev_priv->vblank_crtc; |
137 | if (stat & RADEON_CRTC2_VBLANK_STAT) | 91 | |
138 | drm_handle_vblank(dev, 1); | 92 | if ((vblank_crtc & |
93 | (DRM_RADEON_VBLANK_CRTC1 | DRM_RADEON_VBLANK_CRTC2)) == | ||
94 | (DRM_RADEON_VBLANK_CRTC1 | DRM_RADEON_VBLANK_CRTC2)) { | ||
95 | if (stat & RADEON_CRTC_VBLANK_STAT) | ||
96 | atomic_inc(&dev->vbl_received); | ||
97 | if (stat & RADEON_CRTC2_VBLANK_STAT) | ||
98 | atomic_inc(&dev->vbl_received2); | ||
99 | } else if (((stat & RADEON_CRTC_VBLANK_STAT) && | ||
100 | (vblank_crtc & DRM_RADEON_VBLANK_CRTC1)) || | ||
101 | ((stat & RADEON_CRTC2_VBLANK_STAT) && | ||
102 | (vblank_crtc & DRM_RADEON_VBLANK_CRTC2))) | ||
103 | atomic_inc(&dev->vbl_received); | ||
104 | |||
105 | DRM_WAKEUP(&dev->vbl_queue); | ||
106 | drm_vbl_send_signals(dev); | ||
107 | } | ||
139 | 108 | ||
140 | return IRQ_HANDLED; | 109 | return IRQ_HANDLED; |
141 | } | 110 | } |
@@ -175,27 +144,54 @@ static int radeon_wait_irq(struct drm_device * dev, int swi_nr) | |||
175 | return ret; | 144 | return ret; |
176 | } | 145 | } |
177 | 146 | ||
178 | u32 radeon_get_vblank_counter(struct drm_device *dev, int crtc) | 147 | static int radeon_driver_vblank_do_wait(struct drm_device * dev, |
148 | unsigned int *sequence, int crtc) | ||
179 | { | 149 | { |
180 | drm_radeon_private_t *dev_priv = dev->dev_private; | 150 | drm_radeon_private_t *dev_priv = |
181 | u32 crtc_cnt_reg, crtc_status_reg; | 151 | (drm_radeon_private_t *) dev->dev_private; |
182 | 152 | unsigned int cur_vblank; | |
153 | int ret = 0; | ||
154 | int ack = 0; | ||
155 | atomic_t *counter; | ||
183 | if (!dev_priv) { | 156 | if (!dev_priv) { |
184 | DRM_ERROR("called with no initialization\n"); | 157 | DRM_ERROR("called with no initialization\n"); |
185 | return -EINVAL; | 158 | return -EINVAL; |
186 | } | 159 | } |
187 | 160 | ||
188 | if (crtc == 0) { | 161 | if (crtc == DRM_RADEON_VBLANK_CRTC1) { |
189 | crtc_cnt_reg = RADEON_CRTC_CRNT_FRAME; | 162 | counter = &dev->vbl_received; |
190 | crtc_status_reg = RADEON_CRTC_STATUS; | 163 | ack |= RADEON_CRTC_VBLANK_STAT; |
191 | } else if (crtc == 1) { | 164 | } else if (crtc == DRM_RADEON_VBLANK_CRTC2) { |
192 | crtc_cnt_reg = RADEON_CRTC2_CRNT_FRAME; | 165 | counter = &dev->vbl_received2; |
193 | crtc_status_reg = RADEON_CRTC2_STATUS; | 166 | ack |= RADEON_CRTC2_VBLANK_STAT; |
194 | } else { | 167 | } else |
195 | return -EINVAL; | 168 | return -EINVAL; |
196 | } | ||
197 | 169 | ||
198 | return RADEON_READ(crtc_cnt_reg) + (RADEON_READ(crtc_status_reg) & 1); | 170 | radeon_acknowledge_irqs(dev_priv, ack); |
171 | |||
172 | dev_priv->stats.boxes |= RADEON_BOX_WAIT_IDLE; | ||
173 | |||
174 | /* Assume that the user has missed the current sequence number | ||
175 | * by about a day rather than she wants to wait for years | ||
176 | * using vertical blanks... | ||
177 | */ | ||
178 | DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ, | ||
179 | (((cur_vblank = atomic_read(counter)) | ||
180 | - *sequence) <= (1 << 23))); | ||
181 | |||
182 | *sequence = cur_vblank; | ||
183 | |||
184 | return ret; | ||
185 | } | ||
186 | |||
187 | int radeon_driver_vblank_wait(struct drm_device *dev, unsigned int *sequence) | ||
188 | { | ||
189 | return radeon_driver_vblank_do_wait(dev, sequence, DRM_RADEON_VBLANK_CRTC1); | ||
190 | } | ||
191 | |||
192 | int radeon_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence) | ||
193 | { | ||
194 | return radeon_driver_vblank_do_wait(dev, sequence, DRM_RADEON_VBLANK_CRTC2); | ||
199 | } | 195 | } |
200 | 196 | ||
201 | /* Needs the lock as it touches the ring. | 197 | /* Needs the lock as it touches the ring. |
@@ -238,6 +234,21 @@ int radeon_irq_wait(struct drm_device *dev, void *data, struct drm_file *file_pr | |||
238 | return radeon_wait_irq(dev, irqwait->irq_seq); | 234 | return radeon_wait_irq(dev, irqwait->irq_seq); |
239 | } | 235 | } |
240 | 236 | ||
237 | static void radeon_enable_interrupt(struct drm_device *dev) | ||
238 | { | ||
239 | drm_radeon_private_t *dev_priv = (drm_radeon_private_t *) dev->dev_private; | ||
240 | |||
241 | dev_priv->irq_enable_reg = RADEON_SW_INT_ENABLE; | ||
242 | if (dev_priv->vblank_crtc & DRM_RADEON_VBLANK_CRTC1) | ||
243 | dev_priv->irq_enable_reg |= RADEON_CRTC_VBLANK_MASK; | ||
244 | |||
245 | if (dev_priv->vblank_crtc & DRM_RADEON_VBLANK_CRTC2) | ||
246 | dev_priv->irq_enable_reg |= RADEON_CRTC2_VBLANK_MASK; | ||
247 | |||
248 | RADEON_WRITE(RADEON_GEN_INT_CNTL, dev_priv->irq_enable_reg); | ||
249 | dev_priv->irq_enabled = 1; | ||
250 | } | ||
251 | |||
241 | /* drm_dma.h hooks | 252 | /* drm_dma.h hooks |
242 | */ | 253 | */ |
243 | void radeon_driver_irq_preinstall(struct drm_device * dev) | 254 | void radeon_driver_irq_preinstall(struct drm_device * dev) |
@@ -249,27 +260,20 @@ void radeon_driver_irq_preinstall(struct drm_device * dev) | |||
249 | RADEON_WRITE(RADEON_GEN_INT_CNTL, 0); | 260 | RADEON_WRITE(RADEON_GEN_INT_CNTL, 0); |
250 | 261 | ||
251 | /* Clear bits if they're already high */ | 262 | /* Clear bits if they're already high */ |
252 | radeon_acknowledge_irqs(dev_priv); | 263 | radeon_acknowledge_irqs(dev_priv, (RADEON_SW_INT_TEST_ACK | |
264 | RADEON_CRTC_VBLANK_STAT | | ||
265 | RADEON_CRTC2_VBLANK_STAT)); | ||
253 | } | 266 | } |
254 | 267 | ||
255 | int radeon_driver_irq_postinstall(struct drm_device * dev) | 268 | void radeon_driver_irq_postinstall(struct drm_device * dev) |
256 | { | 269 | { |
257 | drm_radeon_private_t *dev_priv = | 270 | drm_radeon_private_t *dev_priv = |
258 | (drm_radeon_private_t *) dev->dev_private; | 271 | (drm_radeon_private_t *) dev->dev_private; |
259 | int ret; | ||
260 | 272 | ||
261 | atomic_set(&dev_priv->swi_emitted, 0); | 273 | atomic_set(&dev_priv->swi_emitted, 0); |
262 | DRM_INIT_WAITQUEUE(&dev_priv->swi_queue); | 274 | DRM_INIT_WAITQUEUE(&dev_priv->swi_queue); |
263 | 275 | ||
264 | ret = drm_vblank_init(dev, 2); | 276 | radeon_enable_interrupt(dev); |
265 | if (ret) | ||
266 | return ret; | ||
267 | |||
268 | dev->max_vblank_count = 0x001fffff; | ||
269 | |||
270 | radeon_irq_set_state(dev, RADEON_SW_INT_ENABLE, 1); | ||
271 | |||
272 | return 0; | ||
273 | } | 277 | } |
274 | 278 | ||
275 | void radeon_driver_irq_uninstall(struct drm_device * dev) | 279 | void radeon_driver_irq_uninstall(struct drm_device * dev) |
@@ -311,5 +315,6 @@ int radeon_vblank_crtc_set(struct drm_device *dev, int64_t value) | |||
311 | return -EINVAL; | 315 | return -EINVAL; |
312 | } | 316 | } |
313 | dev_priv->vblank_crtc = (unsigned int)value; | 317 | dev_priv->vblank_crtc = (unsigned int)value; |
318 | radeon_enable_interrupt(dev); | ||
314 | return 0; | 319 | return 0; |
315 | } | 320 | } |
diff --git a/drivers/char/drm/via_drv.c b/drivers/char/drm/via_drv.c index 37870a4a3dc7..80c01cdfa37d 100644 --- a/drivers/char/drm/via_drv.c +++ b/drivers/char/drm/via_drv.c | |||
@@ -40,13 +40,11 @@ static struct pci_device_id pciidlist[] = { | |||
40 | static struct drm_driver driver = { | 40 | static struct drm_driver driver = { |
41 | .driver_features = | 41 | .driver_features = |
42 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ | | 42 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ | |
43 | DRIVER_IRQ_SHARED, | 43 | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL, |
44 | .load = via_driver_load, | 44 | .load = via_driver_load, |
45 | .unload = via_driver_unload, | 45 | .unload = via_driver_unload, |
46 | .context_dtor = via_final_context, | 46 | .context_dtor = via_final_context, |
47 | .get_vblank_counter = via_get_vblank_counter, | 47 | .vblank_wait = via_driver_vblank_wait, |
48 | .enable_vblank = via_enable_vblank, | ||
49 | .disable_vblank = via_disable_vblank, | ||
50 | .irq_preinstall = via_driver_irq_preinstall, | 48 | .irq_preinstall = via_driver_irq_preinstall, |
51 | .irq_postinstall = via_driver_irq_postinstall, | 49 | .irq_postinstall = via_driver_irq_postinstall, |
52 | .irq_uninstall = via_driver_irq_uninstall, | 50 | .irq_uninstall = via_driver_irq_uninstall, |
diff --git a/drivers/char/drm/via_drv.h b/drivers/char/drm/via_drv.h index fe67030e39ac..2daae81874cd 100644 --- a/drivers/char/drm/via_drv.h +++ b/drivers/char/drm/via_drv.h | |||
@@ -75,7 +75,6 @@ typedef struct drm_via_private { | |||
75 | struct timeval last_vblank; | 75 | struct timeval last_vblank; |
76 | int last_vblank_valid; | 76 | int last_vblank_valid; |
77 | unsigned usec_per_vblank; | 77 | unsigned usec_per_vblank; |
78 | atomic_t vbl_received; | ||
79 | drm_via_state_t hc_state; | 78 | drm_via_state_t hc_state; |
80 | char pci_buf[VIA_PCI_BUF_SIZE]; | 79 | char pci_buf[VIA_PCI_BUF_SIZE]; |
81 | const uint32_t *fire_offsets[VIA_FIRE_BUF_SIZE]; | 80 | const uint32_t *fire_offsets[VIA_FIRE_BUF_SIZE]; |
@@ -131,13 +130,11 @@ extern int via_init_context(struct drm_device * dev, int context); | |||
131 | extern int via_final_context(struct drm_device * dev, int context); | 130 | extern int via_final_context(struct drm_device * dev, int context); |
132 | 131 | ||
133 | extern int via_do_cleanup_map(struct drm_device * dev); | 132 | extern int via_do_cleanup_map(struct drm_device * dev); |
134 | extern u32 via_get_vblank_counter(struct drm_device *dev, int crtc); | 133 | extern int via_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence); |
135 | extern int via_enable_vblank(struct drm_device *dev, int crtc); | ||
136 | extern void via_disable_vblank(struct drm_device *dev, int crtc); | ||
137 | 134 | ||
138 | extern irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS); | 135 | extern irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS); |
139 | extern void via_driver_irq_preinstall(struct drm_device * dev); | 136 | extern void via_driver_irq_preinstall(struct drm_device * dev); |
140 | extern int via_driver_irq_postinstall(struct drm_device * dev); | 137 | extern void via_driver_irq_postinstall(struct drm_device * dev); |
141 | extern void via_driver_irq_uninstall(struct drm_device * dev); | 138 | extern void via_driver_irq_uninstall(struct drm_device * dev); |
142 | 139 | ||
143 | extern int via_dma_cleanup(struct drm_device * dev); | 140 | extern int via_dma_cleanup(struct drm_device * dev); |
diff --git a/drivers/char/drm/via_irq.c b/drivers/char/drm/via_irq.c index f1ab6fc7c07e..c6bb978a1106 100644 --- a/drivers/char/drm/via_irq.c +++ b/drivers/char/drm/via_irq.c | |||
@@ -92,17 +92,8 @@ static int via_irqmap_unichrome[] = {-1, -1, -1, 0, -1, 1}; | |||
92 | static unsigned time_diff(struct timeval *now, struct timeval *then) | 92 | static unsigned time_diff(struct timeval *now, struct timeval *then) |
93 | { | 93 | { |
94 | return (now->tv_usec >= then->tv_usec) ? | 94 | return (now->tv_usec >= then->tv_usec) ? |
95 | now->tv_usec - then->tv_usec : | 95 | now->tv_usec - then->tv_usec : |
96 | 1000000 - (then->tv_usec - now->tv_usec); | 96 | 1000000 - (then->tv_usec - now->tv_usec); |
97 | } | ||
98 | |||
99 | u32 via_get_vblank_counter(struct drm_device *dev, int crtc) | ||
100 | { | ||
101 | drm_via_private_t *dev_priv = dev->dev_private; | ||
102 | if (crtc != 0) | ||
103 | return 0; | ||
104 | |||
105 | return atomic_read(&dev_priv->vbl_received); | ||
106 | } | 97 | } |
107 | 98 | ||
108 | irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS) | 99 | irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS) |
@@ -117,8 +108,8 @@ irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS) | |||
117 | 108 | ||
118 | status = VIA_READ(VIA_REG_INTERRUPT); | 109 | status = VIA_READ(VIA_REG_INTERRUPT); |
119 | if (status & VIA_IRQ_VBLANK_PENDING) { | 110 | if (status & VIA_IRQ_VBLANK_PENDING) { |
120 | atomic_inc(&dev_priv->vbl_received); | 111 | atomic_inc(&dev->vbl_received); |
121 | if (!(atomic_read(&dev_priv->vbl_received) & 0x0F)) { | 112 | if (!(atomic_read(&dev->vbl_received) & 0x0F)) { |
122 | do_gettimeofday(&cur_vblank); | 113 | do_gettimeofday(&cur_vblank); |
123 | if (dev_priv->last_vblank_valid) { | 114 | if (dev_priv->last_vblank_valid) { |
124 | dev_priv->usec_per_vblank = | 115 | dev_priv->usec_per_vblank = |
@@ -128,11 +119,12 @@ irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS) | |||
128 | dev_priv->last_vblank = cur_vblank; | 119 | dev_priv->last_vblank = cur_vblank; |
129 | dev_priv->last_vblank_valid = 1; | 120 | dev_priv->last_vblank_valid = 1; |
130 | } | 121 | } |
131 | if (!(atomic_read(&dev_priv->vbl_received) & 0xFF)) { | 122 | if (!(atomic_read(&dev->vbl_received) & 0xFF)) { |
132 | DRM_DEBUG("US per vblank is: %u\n", | 123 | DRM_DEBUG("US per vblank is: %u\n", |
133 | dev_priv->usec_per_vblank); | 124 | dev_priv->usec_per_vblank); |
134 | } | 125 | } |
135 | drm_handle_vblank(dev, 0); | 126 | DRM_WAKEUP(&dev->vbl_queue); |
127 | drm_vbl_send_signals(dev); | ||
136 | handled = 1; | 128 | handled = 1; |
137 | } | 129 | } |
138 | 130 | ||
@@ -171,34 +163,31 @@ static __inline__ void viadrv_acknowledge_irqs(drm_via_private_t * dev_priv) | |||
171 | } | 163 | } |
172 | } | 164 | } |
173 | 165 | ||
174 | int via_enable_vblank(struct drm_device *dev, int crtc) | 166 | int via_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence) |
175 | { | 167 | { |
176 | drm_via_private_t *dev_priv = dev->dev_private; | 168 | drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; |
177 | u32 status; | 169 | unsigned int cur_vblank; |
170 | int ret = 0; | ||
178 | 171 | ||
179 | if (crtc != 0) { | 172 | DRM_DEBUG("\n"); |
180 | DRM_ERROR("%s: bad crtc %d\n", __FUNCTION__, crtc); | 173 | if (!dev_priv) { |
174 | DRM_ERROR("called with no initialization\n"); | ||
181 | return -EINVAL; | 175 | return -EINVAL; |
182 | } | 176 | } |
183 | 177 | ||
184 | status = VIA_READ(VIA_REG_INTERRUPT); | 178 | viadrv_acknowledge_irqs(dev_priv); |
185 | VIA_WRITE(VIA_REG_INTERRUPT, status & VIA_IRQ_VBLANK_ENABLE); | ||
186 | 179 | ||
187 | VIA_WRITE8(0x83d4, 0x11); | 180 | /* Assume that the user has missed the current sequence number |
188 | VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) | 0x30); | 181 | * by about a day rather than she wants to wait for years |
182 | * using vertical blanks... | ||
183 | */ | ||
189 | 184 | ||
190 | return 0; | 185 | DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ, |
191 | } | 186 | (((cur_vblank = atomic_read(&dev->vbl_received)) - |
187 | *sequence) <= (1 << 23))); | ||
192 | 188 | ||
193 | void via_disable_vblank(struct drm_device *dev, int crtc) | 189 | *sequence = cur_vblank; |
194 | { | 190 | return ret; |
195 | drm_via_private_t *dev_priv = dev->dev_private; | ||
196 | |||
197 | VIA_WRITE8(0x83d4, 0x11); | ||
198 | VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) & ~0x30); | ||
199 | |||
200 | if (crtc != 0) | ||
201 | DRM_ERROR("%s: bad crtc %d\n", __FUNCTION__, crtc); | ||
202 | } | 191 | } |
203 | 192 | ||
204 | static int | 193 | static int |
@@ -303,25 +292,23 @@ void via_driver_irq_preinstall(struct drm_device * dev) | |||
303 | } | 292 | } |
304 | } | 293 | } |
305 | 294 | ||
306 | int via_driver_irq_postinstall(struct drm_device * dev) | 295 | void via_driver_irq_postinstall(struct drm_device * dev) |
307 | { | 296 | { |
308 | drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; | 297 | drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; |
309 | u32 status; | 298 | u32 status; |
310 | 299 | ||
311 | DRM_DEBUG("via_driver_irq_postinstall\n"); | 300 | DRM_DEBUG("\n"); |
312 | if (!dev_priv) | 301 | if (dev_priv) { |
313 | return -EINVAL; | 302 | status = VIA_READ(VIA_REG_INTERRUPT); |
303 | VIA_WRITE(VIA_REG_INTERRUPT, status | VIA_IRQ_GLOBAL | ||
304 | | dev_priv->irq_enable_mask); | ||
314 | 305 | ||
315 | drm_vblank_init(dev, 1); | 306 | /* Some magic, oh for some data sheets ! */ |
316 | status = VIA_READ(VIA_REG_INTERRUPT); | ||
317 | VIA_WRITE(VIA_REG_INTERRUPT, status | VIA_IRQ_GLOBAL | ||
318 | | dev_priv->irq_enable_mask); | ||
319 | 307 | ||
320 | /* Some magic, oh for some data sheets ! */ | 308 | VIA_WRITE8(0x83d4, 0x11); |
321 | VIA_WRITE8(0x83d4, 0x11); | 309 | VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) | 0x30); |
322 | VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) | 0x30); | ||
323 | 310 | ||
324 | return 0; | 311 | } |
325 | } | 312 | } |
326 | 313 | ||
327 | void via_driver_irq_uninstall(struct drm_device * dev) | 314 | void via_driver_irq_uninstall(struct drm_device * dev) |
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig index 8d6c2089d2a8..efd0b4db7c8e 100644 --- a/drivers/char/hw_random/Kconfig +++ b/drivers/char/hw_random/Kconfig | |||
@@ -112,3 +112,12 @@ config HW_RANDOM_PASEMI | |||
112 | 112 | ||
113 | If unsure, say Y. | 113 | If unsure, say Y. |
114 | 114 | ||
115 | config HW_RANDOM_VIRTIO | ||
116 | tristate "VirtIO Random Number Generator support" | ||
117 | depends on HW_RANDOM && VIRTIO | ||
118 | ---help--- | ||
119 | This driver provides kernel-side support for the virtual Random Number | ||
120 | Generator hardware. | ||
121 | |||
122 | To compile this driver as a module, choose M here: the | ||
123 | module will be called virtio-rng. If unsure, say N. | ||
diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile index c8b7300e2fb1..b4940ddbb35f 100644 --- a/drivers/char/hw_random/Makefile +++ b/drivers/char/hw_random/Makefile | |||
@@ -11,3 +11,4 @@ obj-$(CONFIG_HW_RANDOM_VIA) += via-rng.o | |||
11 | obj-$(CONFIG_HW_RANDOM_IXP4XX) += ixp4xx-rng.o | 11 | obj-$(CONFIG_HW_RANDOM_IXP4XX) += ixp4xx-rng.o |
12 | obj-$(CONFIG_HW_RANDOM_OMAP) += omap-rng.o | 12 | obj-$(CONFIG_HW_RANDOM_OMAP) += omap-rng.o |
13 | obj-$(CONFIG_HW_RANDOM_PASEMI) += pasemi-rng.o | 13 | obj-$(CONFIG_HW_RANDOM_PASEMI) += pasemi-rng.o |
14 | obj-$(CONFIG_HW_RANDOM_VIRTIO) += virtio-rng.o | ||
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c new file mode 100644 index 000000000000..d0e563e4fc39 --- /dev/null +++ b/drivers/char/hw_random/virtio-rng.c | |||
@@ -0,0 +1,155 @@ | |||
1 | /* | ||
2 | * Randomness driver for virtio | ||
3 | * Copyright (C) 2007, 2008 Rusty Russell IBM Corporation | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | */ | ||
19 | #include <linux/err.h> | ||
20 | #include <linux/hw_random.h> | ||
21 | #include <linux/scatterlist.h> | ||
22 | #include <linux/spinlock.h> | ||
23 | #include <linux/virtio.h> | ||
24 | #include <linux/virtio_rng.h> | ||
25 | |||
26 | /* The host will fill any buffer we give it with sweet, sweet randomness. We | ||
27 | * give it 64 bytes at a time, and the hwrng framework takes it 4 bytes at a | ||
28 | * time. */ | ||
29 | #define RANDOM_DATA_SIZE 64 | ||
30 | |||
31 | static struct virtqueue *vq; | ||
32 | static u32 *random_data; | ||
33 | static unsigned int data_left; | ||
34 | static DECLARE_COMPLETION(have_data); | ||
35 | |||
36 | static void random_recv_done(struct virtqueue *vq) | ||
37 | { | ||
38 | int len; | ||
39 | |||
40 | /* We never get spurious callbacks. */ | ||
41 | if (!vq->vq_ops->get_buf(vq, &len)) | ||
42 | BUG(); | ||
43 | |||
44 | data_left = len / sizeof(random_data[0]); | ||
45 | complete(&have_data); | ||
46 | } | ||
47 | |||
48 | static void register_buffer(void) | ||
49 | { | ||
50 | struct scatterlist sg; | ||
51 | |||
52 | sg_init_one(&sg, random_data, RANDOM_DATA_SIZE); | ||
53 | /* There should always be room for one buffer. */ | ||
54 | if (vq->vq_ops->add_buf(vq, &sg, 0, 1, random_data) != 0) | ||
55 | BUG(); | ||
56 | vq->vq_ops->kick(vq); | ||
57 | } | ||
58 | |||
59 | /* At least we don't udelay() in a loop like some other drivers. */ | ||
60 | static int virtio_data_present(struct hwrng *rng, int wait) | ||
61 | { | ||
62 | if (data_left) | ||
63 | return 1; | ||
64 | |||
65 | if (!wait) | ||
66 | return 0; | ||
67 | |||
68 | wait_for_completion(&have_data); | ||
69 | return 1; | ||
70 | } | ||
71 | |||
72 | /* virtio_data_present() must have succeeded before this is called. */ | ||
73 | static int virtio_data_read(struct hwrng *rng, u32 *data) | ||
74 | { | ||
75 | BUG_ON(!data_left); | ||
76 | |||
77 | *data = random_data[--data_left]; | ||
78 | |||
79 | if (!data_left) { | ||
80 | init_completion(&have_data); | ||
81 | register_buffer(); | ||
82 | } | ||
83 | return sizeof(*data); | ||
84 | } | ||
85 | |||
86 | static struct hwrng virtio_hwrng = { | ||
87 | .name = "virtio", | ||
88 | .data_present = virtio_data_present, | ||
89 | .data_read = virtio_data_read, | ||
90 | }; | ||
91 | |||
92 | static int virtrng_probe(struct virtio_device *vdev) | ||
93 | { | ||
94 | int err; | ||
95 | |||
96 | /* We expect a single virtqueue. */ | ||
97 | vq = vdev->config->find_vq(vdev, 0, random_recv_done); | ||
98 | if (IS_ERR(vq)) | ||
99 | return PTR_ERR(vq); | ||
100 | |||
101 | err = hwrng_register(&virtio_hwrng); | ||
102 | if (err) { | ||
103 | vdev->config->del_vq(vq); | ||
104 | return err; | ||
105 | } | ||
106 | |||
107 | register_buffer(); | ||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | static void virtrng_remove(struct virtio_device *vdev) | ||
112 | { | ||
113 | vdev->config->reset(vdev); | ||
114 | hwrng_unregister(&virtio_hwrng); | ||
115 | vdev->config->del_vq(vq); | ||
116 | } | ||
117 | |||
118 | static struct virtio_device_id id_table[] = { | ||
119 | { VIRTIO_ID_RNG, VIRTIO_DEV_ANY_ID }, | ||
120 | { 0 }, | ||
121 | }; | ||
122 | |||
123 | static struct virtio_driver virtio_rng = { | ||
124 | .driver.name = KBUILD_MODNAME, | ||
125 | .driver.owner = THIS_MODULE, | ||
126 | .id_table = id_table, | ||
127 | .probe = virtrng_probe, | ||
128 | .remove = __devexit_p(virtrng_remove), | ||
129 | }; | ||
130 | |||
131 | static int __init init(void) | ||
132 | { | ||
133 | int err; | ||
134 | |||
135 | random_data = kmalloc(RANDOM_DATA_SIZE, GFP_KERNEL); | ||
136 | if (!random_data) | ||
137 | return -ENOMEM; | ||
138 | |||
139 | err = register_virtio_driver(&virtio_rng); | ||
140 | if (err) | ||
141 | kfree(random_data); | ||
142 | return err; | ||
143 | } | ||
144 | |||
145 | static void __exit fini(void) | ||
146 | { | ||
147 | kfree(random_data); | ||
148 | unregister_virtio_driver(&virtio_rng); | ||
149 | } | ||
150 | module_init(init); | ||
151 | module_exit(fini); | ||
152 | |||
153 | MODULE_DEVICE_TABLE(virtio, id_table); | ||
154 | MODULE_DESCRIPTION("Virtio random number driver"); | ||
155 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/char/ip2/Makefile b/drivers/char/ip2/Makefile index 6bfe2543ddc2..939618f62fe1 100644 --- a/drivers/char/ip2/Makefile +++ b/drivers/char/ip2/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the Computone IntelliPort Plus Driver | 2 | # Makefile for the Computone IntelliPort Plus Driver |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_COMPUTONE) += ip2.o ip2main.o | 5 | obj-$(CONFIG_COMPUTONE) += ip2.o |
6 | 6 | ||
7 | ip2-objs := ip2base.o | 7 | ip2-objs := ip2base.o ip2main.o |
8 | 8 | ||
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index 70957acaa960..c12cf8fc4be0 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c | |||
@@ -346,27 +346,6 @@ have_requested_irq( char irq ) | |||
346 | } | 346 | } |
347 | 347 | ||
348 | /******************************************************************************/ | 348 | /******************************************************************************/ |
349 | /* Function: init_module() */ | ||
350 | /* Parameters: None */ | ||
351 | /* Returns: Success (0) */ | ||
352 | /* */ | ||
353 | /* Description: */ | ||
354 | /* This is a required entry point for an installable module. It simply calls */ | ||
355 | /* the driver initialisation function and returns what it returns. */ | ||
356 | /******************************************************************************/ | ||
357 | #ifdef MODULE | ||
358 | static int __init | ||
359 | ip2_init_module(void) | ||
360 | { | ||
361 | #ifdef IP2DEBUG_INIT | ||
362 | printk (KERN_DEBUG "Loading module ...\n" ); | ||
363 | #endif | ||
364 | return 0; | ||
365 | } | ||
366 | module_init(ip2_init_module); | ||
367 | #endif /* MODULE */ | ||
368 | |||
369 | /******************************************************************************/ | ||
370 | /* Function: cleanup_module() */ | 349 | /* Function: cleanup_module() */ |
371 | /* Parameters: None */ | 350 | /* Parameters: None */ |
372 | /* Returns: Nothing */ | 351 | /* Returns: Nothing */ |
@@ -779,8 +758,6 @@ out: | |||
779 | return err; | 758 | return err; |
780 | } | 759 | } |
781 | 760 | ||
782 | EXPORT_SYMBOL(ip2_loadmain); | ||
783 | |||
784 | /******************************************************************************/ | 761 | /******************************************************************************/ |
785 | /* Function: ip2_init_board() */ | 762 | /* Function: ip2_init_board() */ |
786 | /* Parameters: Index of board in configuration structure */ | 763 | /* Parameters: Index of board in configuration structure */ |
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index 19105ec203f7..8096389b0dc2 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c | |||
@@ -282,16 +282,20 @@ static int opost(unsigned char c, struct tty_struct *tty) | |||
282 | if (O_ONLRET(tty)) | 282 | if (O_ONLRET(tty)) |
283 | tty->column = 0; | 283 | tty->column = 0; |
284 | if (O_ONLCR(tty)) { | 284 | if (O_ONLCR(tty)) { |
285 | if (space < 2) | 285 | if (space < 2) { |
286 | unlock_kernel(); | ||
286 | return -1; | 287 | return -1; |
288 | } | ||
287 | tty_put_char(tty, '\r'); | 289 | tty_put_char(tty, '\r'); |
288 | tty->column = 0; | 290 | tty->column = 0; |
289 | } | 291 | } |
290 | tty->canon_column = tty->column; | 292 | tty->canon_column = tty->column; |
291 | break; | 293 | break; |
292 | case '\r': | 294 | case '\r': |
293 | if (O_ONOCR(tty) && tty->column == 0) | 295 | if (O_ONOCR(tty) && tty->column == 0) { |
296 | unlock_kernel(); | ||
294 | return 0; | 297 | return 0; |
298 | } | ||
295 | if (O_OCRNL(tty)) { | 299 | if (O_OCRNL(tty)) { |
296 | c = '\n'; | 300 | c = '\n'; |
297 | if (O_ONLRET(tty)) | 301 | if (O_ONLRET(tty)) |
@@ -303,10 +307,13 @@ static int opost(unsigned char c, struct tty_struct *tty) | |||
303 | case '\t': | 307 | case '\t': |
304 | spaces = 8 - (tty->column & 7); | 308 | spaces = 8 - (tty->column & 7); |
305 | if (O_TABDLY(tty) == XTABS) { | 309 | if (O_TABDLY(tty) == XTABS) { |
306 | if (space < spaces) | 310 | if (space < spaces) { |
311 | unlock_kernel(); | ||
307 | return -1; | 312 | return -1; |
313 | } | ||
308 | tty->column += spaces; | 314 | tty->column += spaces; |
309 | tty->ops->write(tty, " ", spaces); | 315 | tty->ops->write(tty, " ", spaces); |
316 | unlock_kernel(); | ||
310 | return 0; | 317 | return 0; |
311 | } | 318 | } |
312 | tty->column += spaces; | 319 | tty->column += spaces; |
diff --git a/drivers/char/snsc_event.c b/drivers/char/snsc_event.c index 53b3d44f8c06..55a95892ccf9 100644 --- a/drivers/char/snsc_event.c +++ b/drivers/char/snsc_event.c | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
20 | #include <linux/byteorder/generic.h> | 20 | #include <asm/byteorder.h> |
21 | #include <asm/sn/sn_sal.h> | 21 | #include <asm/sn/sn_sal.h> |
22 | #include <asm/unaligned.h> | 22 | #include <asm/unaligned.h> |
23 | #include "snsc.h" | 23 | #include "snsc.h" |
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index 9e9bad8bdcf4..dbce1263bdff 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -402,6 +402,7 @@ static struct sysrq_key_op *sysrq_key_table[36] = { | |||
402 | &sysrq_showstate_blocked_op, /* w */ | 402 | &sysrq_showstate_blocked_op, /* w */ |
403 | /* x: May be registered on ppc/powerpc for xmon */ | 403 | /* x: May be registered on ppc/powerpc for xmon */ |
404 | NULL, /* x */ | 404 | NULL, /* x */ |
405 | /* y: May be registered on sparc64 for global register dump */ | ||
405 | NULL, /* y */ | 406 | NULL, /* y */ |
406 | NULL /* z */ | 407 | NULL /* z */ |
407 | }; | 408 | }; |
diff --git a/drivers/char/viocons.c b/drivers/char/viocons.c index 3d3e1c2b310f..65fb848e1cce 100644 --- a/drivers/char/viocons.c +++ b/drivers/char/viocons.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * Authors: Dave Boutcher <boutcher@us.ibm.com> | 7 | * Authors: Dave Boutcher <boutcher@us.ibm.com> |
8 | * Ryan Arnold <ryanarn@us.ibm.com> | 8 | * Ryan Arnold <ryanarn@us.ibm.com> |
9 | * Colin Devilbiss <devilbis@us.ibm.com> | 9 | * Colin Devilbiss <devilbis@us.ibm.com> |
10 | * Stephen Rothwell <sfr@au1.ibm.com> | 10 | * Stephen Rothwell |
11 | * | 11 | * |
12 | * (C) Copyright 2000, 2001, 2002, 2003, 2004 IBM Corporation | 12 | * (C) Copyright 2000, 2001, 2002, 2003, 2004 IBM Corporation |
13 | * | 13 | * |
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c index 58aad63831f4..c39ddaff5e8f 100644 --- a/drivers/char/viotape.c +++ b/drivers/char/viotape.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Authors: Dave Boutcher <boutcher@us.ibm.com> | 6 | * Authors: Dave Boutcher <boutcher@us.ibm.com> |
7 | * Ryan Arnold <ryanarn@us.ibm.com> | 7 | * Ryan Arnold <ryanarn@us.ibm.com> |
8 | * Colin Devilbiss <devilbis@us.ibm.com> | 8 | * Colin Devilbiss <devilbis@us.ibm.com> |
9 | * Stephen Rothwell <sfr@au1.ibm.com> | 9 | * Stephen Rothwell |
10 | * | 10 | * |
11 | * (C) Copyright 2000-2004 IBM Corporation | 11 | * (C) Copyright 2000-2004 IBM Corporation |
12 | * | 12 | * |
diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c index e122a0e87bb0..f17ac043b551 100644 --- a/drivers/char/vme_scc.c +++ b/drivers/char/vme_scc.c | |||
@@ -89,9 +89,7 @@ static void scc_break_ctl(struct tty_struct *tty, int break_state); | |||
89 | 89 | ||
90 | static struct tty_driver *scc_driver; | 90 | static struct tty_driver *scc_driver; |
91 | 91 | ||
92 | struct scc_port scc_ports[2]; | 92 | static struct scc_port scc_ports[2]; |
93 | |||
94 | int scc_initialized = 0; | ||
95 | 93 | ||
96 | /*--------------------------------------------------------------------------- | 94 | /*--------------------------------------------------------------------------- |
97 | * Interface from generic_serial.c back here | 95 | * Interface from generic_serial.c back here |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 7fce038fa57e..86f0a2430624 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -928,13 +928,13 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
928 | policy->user_policy.policy = policy->policy; | 928 | policy->user_policy.policy = policy->policy; |
929 | policy->user_policy.governor = policy->governor; | 929 | policy->user_policy.governor = policy->governor; |
930 | 930 | ||
931 | unlock_policy_rwsem_write(cpu); | ||
932 | |||
933 | if (ret) { | 931 | if (ret) { |
934 | dprintk("setting policy failed\n"); | 932 | dprintk("setting policy failed\n"); |
935 | goto err_out_unregister; | 933 | goto err_out_unregister; |
936 | } | 934 | } |
937 | 935 | ||
936 | unlock_policy_rwsem_write(cpu); | ||
937 | |||
938 | kobject_uevent(&policy->kobj, KOBJ_ADD); | 938 | kobject_uevent(&policy->kobj, KOBJ_ADD); |
939 | module_put(cpufreq_driver->owner); | 939 | module_put(cpufreq_driver->owner); |
940 | dprintk("initialization complete\n"); | 940 | dprintk("initialization complete\n"); |
diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c index ae6cd60d5c14..b64c6bc445e3 100644 --- a/drivers/cpufreq/freq_table.c +++ b/drivers/cpufreq/freq_table.c | |||
@@ -2,6 +2,11 @@ | |||
2 | * linux/drivers/cpufreq/freq_table.c | 2 | * linux/drivers/cpufreq/freq_table.c |
3 | * | 3 | * |
4 | * Copyright (C) 2002 - 2003 Dominik Brodowski | 4 | * Copyright (C) 2002 - 2003 Dominik Brodowski |
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
5 | */ | 10 | */ |
6 | 11 | ||
7 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c index 762b729672e0..0ec0f431e6a1 100644 --- a/drivers/dma/iop-adma.c +++ b/drivers/dma/iop-adma.c | |||
@@ -821,10 +821,10 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device) | |||
821 | 821 | ||
822 | dev_dbg(device->common.dev, "%s\n", __func__); | 822 | dev_dbg(device->common.dev, "%s\n", __func__); |
823 | 823 | ||
824 | src = kzalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL); | 824 | src = kmalloc(IOP_ADMA_TEST_SIZE, GFP_KERNEL); |
825 | if (!src) | 825 | if (!src) |
826 | return -ENOMEM; | 826 | return -ENOMEM; |
827 | dest = kzalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL); | 827 | dest = kzalloc(IOP_ADMA_TEST_SIZE, GFP_KERNEL); |
828 | if (!dest) { | 828 | if (!dest) { |
829 | kfree(src); | 829 | kfree(src); |
830 | return -ENOMEM; | 830 | return -ENOMEM; |
@@ -834,8 +834,6 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device) | |||
834 | for (i = 0; i < IOP_ADMA_TEST_SIZE; i++) | 834 | for (i = 0; i < IOP_ADMA_TEST_SIZE; i++) |
835 | ((u8 *) src)[i] = (u8)i; | 835 | ((u8 *) src)[i] = (u8)i; |
836 | 836 | ||
837 | memset(dest, 0, IOP_ADMA_TEST_SIZE); | ||
838 | |||
839 | /* Start copy, using first DMA channel */ | 837 | /* Start copy, using first DMA channel */ |
840 | dma_chan = container_of(device->common.channels.next, | 838 | dma_chan = container_of(device->common.channels.next, |
841 | struct dma_chan, | 839 | struct dma_chan, |
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c index 065732ddf40c..d49361bfe670 100644 --- a/drivers/edac/mpc85xx_edac.c +++ b/drivers/edac/mpc85xx_edac.c | |||
@@ -20,7 +20,6 @@ | |||
20 | 20 | ||
21 | #include <linux/of_platform.h> | 21 | #include <linux/of_platform.h> |
22 | #include <linux/of_device.h> | 22 | #include <linux/of_device.h> |
23 | #include <asm/mpc85xx.h> | ||
24 | #include "edac_module.h" | 23 | #include "edac_module.h" |
25 | #include "edac_core.h" | 24 | #include "edac_core.h" |
26 | #include "mpc85xx_edac.h" | 25 | #include "mpc85xx_edac.h" |
@@ -43,8 +42,6 @@ static u32 orig_pci_err_en; | |||
43 | static u32 orig_l2_err_disable; | 42 | static u32 orig_l2_err_disable; |
44 | static u32 orig_hid1; | 43 | static u32 orig_hid1; |
45 | 44 | ||
46 | static const char *mpc85xx_ctl_name = "MPC85xx"; | ||
47 | |||
48 | /************************ MC SYSFS parts ***********************************/ | 45 | /************************ MC SYSFS parts ***********************************/ |
49 | 46 | ||
50 | static ssize_t mpc85xx_mc_inject_data_hi_show(struct mem_ctl_info *mci, | 47 | static ssize_t mpc85xx_mc_inject_data_hi_show(struct mem_ctl_info *mci, |
diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c index 4a541921a14a..dda14015e873 100644 --- a/drivers/firewire/fw-cdev.c +++ b/drivers/firewire/fw-cdev.c | |||
@@ -113,6 +113,11 @@ static int fw_device_op_open(struct inode *inode, struct file *file) | |||
113 | if (device == NULL) | 113 | if (device == NULL) |
114 | return -ENODEV; | 114 | return -ENODEV; |
115 | 115 | ||
116 | if (fw_device_is_shutdown(device)) { | ||
117 | fw_device_put(device); | ||
118 | return -ENODEV; | ||
119 | } | ||
120 | |||
116 | client = kzalloc(sizeof(*client), GFP_KERNEL); | 121 | client = kzalloc(sizeof(*client), GFP_KERNEL); |
117 | if (client == NULL) { | 122 | if (client == NULL) { |
118 | fw_device_put(device); | 123 | fw_device_put(device); |
@@ -901,6 +906,9 @@ fw_device_op_ioctl(struct file *file, | |||
901 | { | 906 | { |
902 | struct client *client = file->private_data; | 907 | struct client *client = file->private_data; |
903 | 908 | ||
909 | if (fw_device_is_shutdown(client->device)) | ||
910 | return -ENODEV; | ||
911 | |||
904 | return dispatch_ioctl(client, cmd, (void __user *) arg); | 912 | return dispatch_ioctl(client, cmd, (void __user *) arg); |
905 | } | 913 | } |
906 | 914 | ||
@@ -911,6 +919,9 @@ fw_device_op_compat_ioctl(struct file *file, | |||
911 | { | 919 | { |
912 | struct client *client = file->private_data; | 920 | struct client *client = file->private_data; |
913 | 921 | ||
922 | if (fw_device_is_shutdown(client->device)) | ||
923 | return -ENODEV; | ||
924 | |||
914 | return dispatch_ioctl(client, cmd, compat_ptr(arg)); | 925 | return dispatch_ioctl(client, cmd, compat_ptr(arg)); |
915 | } | 926 | } |
916 | #endif | 927 | #endif |
@@ -922,6 +933,9 @@ static int fw_device_op_mmap(struct file *file, struct vm_area_struct *vma) | |||
922 | unsigned long size; | 933 | unsigned long size; |
923 | int page_count, retval; | 934 | int page_count, retval; |
924 | 935 | ||
936 | if (fw_device_is_shutdown(client->device)) | ||
937 | return -ENODEV; | ||
938 | |||
925 | /* FIXME: We could support multiple buffers, but we don't. */ | 939 | /* FIXME: We could support multiple buffers, but we don't. */ |
926 | if (client->buffer.pages != NULL) | 940 | if (client->buffer.pages != NULL) |
927 | return -EBUSY; | 941 | return -EBUSY; |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 7f138c6195ff..beaf6b3a37dc 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -127,7 +127,7 @@ int __init gpiochip_reserve(int start, int ngpio) | |||
127 | unsigned long flags; | 127 | unsigned long flags; |
128 | int i; | 128 | int i; |
129 | 129 | ||
130 | if (!gpio_is_valid(start) || !gpio_is_valid(start + ngpio)) | 130 | if (!gpio_is_valid(start) || !gpio_is_valid(start + ngpio - 1)) |
131 | return -EINVAL; | 131 | return -EINVAL; |
132 | 132 | ||
133 | spin_lock_irqsave(&gpio_lock, flags); | 133 | spin_lock_irqsave(&gpio_lock, flags); |
@@ -170,7 +170,7 @@ int gpiochip_add(struct gpio_chip *chip) | |||
170 | unsigned id; | 170 | unsigned id; |
171 | int base = chip->base; | 171 | int base = chip->base; |
172 | 172 | ||
173 | if ((!gpio_is_valid(base) || !gpio_is_valid(base + chip->ngpio)) | 173 | if ((!gpio_is_valid(base) || !gpio_is_valid(base + chip->ngpio - 1)) |
174 | && base >= 0) { | 174 | && base >= 0) { |
175 | status = -EINVAL; | 175 | status = -EINVAL; |
176 | goto fail; | 176 | goto fail; |
@@ -207,7 +207,7 @@ fail: | |||
207 | /* failures here can mean systems won't boot... */ | 207 | /* failures here can mean systems won't boot... */ |
208 | if (status) | 208 | if (status) |
209 | pr_err("gpiochip_add: gpios %d..%d (%s) not registered\n", | 209 | pr_err("gpiochip_add: gpios %d..%d (%s) not registered\n", |
210 | chip->base, chip->base + chip->ngpio, | 210 | chip->base, chip->base + chip->ngpio - 1, |
211 | chip->label ? : "generic"); | 211 | chip->label ? : "generic"); |
212 | return status; | 212 | return status; |
213 | } | 213 | } |
diff --git a/drivers/gpio/mcp23s08.c b/drivers/gpio/mcp23s08.c index 7fb5b9d009d4..7f92fdd5f0e2 100644 --- a/drivers/gpio/mcp23s08.c +++ b/drivers/gpio/mcp23s08.c | |||
@@ -168,7 +168,7 @@ static void mcp23s08_dbg_show(struct seq_file *s, struct gpio_chip *chip) | |||
168 | { | 168 | { |
169 | struct mcp23s08 *mcp; | 169 | struct mcp23s08 *mcp; |
170 | char bank; | 170 | char bank; |
171 | unsigned t; | 171 | int t; |
172 | unsigned mask; | 172 | unsigned mask; |
173 | 173 | ||
174 | mcp = container_of(chip, struct mcp23s08, chip); | 174 | mcp = container_of(chip, struct mcp23s08, chip); |
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c index 93f916720b13..7e40e8a55edf 100644 --- a/drivers/gpio/pca953x.c +++ b/drivers/gpio/pca953x.c | |||
@@ -30,6 +30,7 @@ static const struct i2c_device_id pca953x_id[] = { | |||
30 | { "pca9537", 4, }, | 30 | { "pca9537", 4, }, |
31 | { "pca9538", 8, }, | 31 | { "pca9538", 8, }, |
32 | { "pca9539", 16, }, | 32 | { "pca9539", 16, }, |
33 | { "pca9554", 8, }, | ||
33 | { "pca9555", 16, }, | 34 | { "pca9555", 16, }, |
34 | { "pca9557", 8, }, | 35 | { "pca9557", 8, }, |
35 | /* REVISIT several pca955x parts should work here too */ | 36 | /* REVISIT several pca955x parts should work here too */ |
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c index f88714b06000..47ac1a7d66e1 100644 --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: hid-debug.h,v 1.8 2001/09/25 09:37:57 vojtech Exp $ | ||
3 | * | ||
4 | * (c) 1999 Andreas Gal <gal@cs.uni-magdeburg.de> | 2 | * (c) 1999 Andreas Gal <gal@cs.uni-magdeburg.de> |
5 | * (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz> | 3 | * (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz> |
6 | * (c) 2007 Jiri Kosina | 4 | * (c) 2007 Jiri Kosina |
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index c3eb3f13e2ca..5c52a20ad344 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: hid-input.c,v 1.2 2002/04/23 00:59:25 rdamazio Exp $ | ||
3 | * | ||
4 | * Copyright (c) 2000-2001 Vojtech Pavlik | 2 | * Copyright (c) 2000-2001 Vojtech Pavlik |
5 | * Copyright (c) 2006-2007 Jiri Kosina | 3 | * Copyright (c) 2006-2007 Jiri Kosina |
6 | * | 4 | * |
@@ -218,8 +216,9 @@ int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, | |||
218 | } | 216 | } |
219 | } | 217 | } |
220 | 218 | ||
221 | if (test_bit(usage->code, hid->pb_pressed_numlock) || | 219 | if (hid->quirks & HID_QUIRK_APPLE_NUMLOCK_EMULATION && ( |
222 | test_bit(LED_NUML, input->led)) { | 220 | test_bit(usage->code, hid->pb_pressed_numlock) || |
221 | test_bit(LED_NUML, input->led))) { | ||
223 | trans = find_translation(powerbook_numlock_keys, usage->code); | 222 | trans = find_translation(powerbook_numlock_keys, usage->code); |
224 | 223 | ||
225 | if (trans) { | 224 | if (trans) { |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index d3f8d9194f30..1df832a8fcbc 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -325,6 +325,10 @@ | |||
325 | #define USB_DEVICE_ID_MGE_UPS 0xffff | 325 | #define USB_DEVICE_ID_MGE_UPS 0xffff |
326 | #define USB_DEVICE_ID_MGE_UPS1 0x0001 | 326 | #define USB_DEVICE_ID_MGE_UPS1 0x0001 |
327 | 327 | ||
328 | #define USB_VENDOR_ID_MICROCHIP 0x04d8 | ||
329 | #define USB_DEVICE_ID_PICKIT1 0x0032 | ||
330 | #define USB_DEVICE_ID_PICKIT2 0x0033 | ||
331 | |||
328 | #define USB_VENDOR_ID_MICROSOFT 0x045e | 332 | #define USB_VENDOR_ID_MICROSOFT 0x045e |
329 | #define USB_DEVICE_ID_SIDEWINDER_GV 0x003b | 333 | #define USB_DEVICE_ID_SIDEWINDER_GV 0x003b |
330 | #define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d | 334 | #define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d |
@@ -371,6 +375,9 @@ | |||
371 | #define USB_VENDOR_ID_SONY 0x054c | 375 | #define USB_VENDOR_ID_SONY 0x054c |
372 | #define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 | 376 | #define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 |
373 | 377 | ||
378 | #define USB_VENDOR_ID_SOUNDGRAPH 0x15c2 | ||
379 | #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD 0x0038 | ||
380 | |||
374 | #define USB_VENDOR_ID_SUN 0x0430 | 381 | #define USB_VENDOR_ID_SUN 0x0430 |
375 | #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab | 382 | #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab |
376 | 383 | ||
@@ -567,6 +574,7 @@ static const struct hid_blacklist { | |||
567 | { USB_VENDOR_ID_PANJIT, 0x0002, HID_QUIRK_IGNORE }, | 574 | { USB_VENDOR_ID_PANJIT, 0x0002, HID_QUIRK_IGNORE }, |
568 | { USB_VENDOR_ID_PANJIT, 0x0003, HID_QUIRK_IGNORE }, | 575 | { USB_VENDOR_ID_PANJIT, 0x0003, HID_QUIRK_IGNORE }, |
569 | { USB_VENDOR_ID_PANJIT, 0x0004, HID_QUIRK_IGNORE }, | 576 | { USB_VENDOR_ID_PANJIT, 0x0004, HID_QUIRK_IGNORE }, |
577 | { USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD, HID_QUIRK_IGNORE }, | ||
570 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO, HID_QUIRK_IGNORE }, | 578 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO, HID_QUIRK_IGNORE }, |
571 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP, HID_QUIRK_IGNORE }, | 579 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP, HID_QUIRK_IGNORE }, |
572 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP, HID_QUIRK_IGNORE }, | 580 | { USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP, HID_QUIRK_IGNORE }, |
@@ -580,6 +588,9 @@ static const struct hid_blacklist { | |||
580 | { USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_FLAIR, HID_QUIRK_IGNORE }, | 588 | { USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_FLAIR, HID_QUIRK_IGNORE }, |
581 | { USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_302, HID_QUIRK_IGNORE }, | 589 | { USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_ACECAD_302, HID_QUIRK_IGNORE }, |
582 | 590 | ||
591 | { USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1, HID_QUIRK_IGNORE }, | ||
592 | { USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT2, HID_QUIRK_IGNORE }, | ||
593 | |||
583 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP }, | 594 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP }, |
584 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP }, | 595 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500, HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL | HID_QUIRK_LOGITECH_EXPANDED_KEYMAP }, |
585 | 596 | ||
@@ -611,28 +622,28 @@ static const struct hid_blacklist { | |||
611 | 622 | ||
612 | { USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, | 623 | { USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, |
613 | 624 | ||
614 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 625 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
615 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 626 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
616 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 627 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
617 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, | 628 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, |
618 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 629 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
619 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 630 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
620 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, | 631 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, |
621 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 632 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
622 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 633 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
623 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, | 634 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD}, |
624 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 635 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
625 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI, HID_QUIRK_APPLE_HAS_FN }, | 636 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI, HID_QUIRK_APPLE_HAS_FN }, |
626 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, | 637 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, |
627 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN }, | 638 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN }, |
628 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 639 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
629 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 640 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
630 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 641 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
631 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, HID_QUIRK_APPLE_HAS_FN }, | 642 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN }, |
632 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, | 643 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, |
633 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS, HID_QUIRK_APPLE_HAS_FN }, | 644 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN }, |
634 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 645 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
635 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 646 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_NUMLOCK_EMULATION | HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
636 | 647 | ||
637 | { USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658, HID_QUIRK_RESET_LEDS }, | 648 | { USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658, HID_QUIRK_RESET_LEDS }, |
638 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD, HID_QUIRK_RESET_LEDS }, | 649 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD, HID_QUIRK_RESET_LEDS }, |
diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c index 5d9dbb47e4a8..3cd46d2e53c1 100644 --- a/drivers/hid/usbhid/usbkbd.c +++ b/drivers/hid/usbhid/usbkbd.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: usbkbd.c,v 1.27 2001/12/27 10:37:41 vojtech Exp $ | ||
3 | * | ||
4 | * Copyright (c) 1999-2001 Vojtech Pavlik | 2 | * Copyright (c) 1999-2001 Vojtech Pavlik |
5 | * | 3 | * |
6 | * USB HIDBP Keyboard support | 4 | * USB HIDBP Keyboard support |
diff --git a/drivers/hid/usbhid/usbmouse.c b/drivers/hid/usbhid/usbmouse.c index df0d96d989de..703e9d0e8714 100644 --- a/drivers/hid/usbhid/usbmouse.c +++ b/drivers/hid/usbhid/usbmouse.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: usbmouse.c,v 1.15 2001/12/27 10:37:41 vojtech Exp $ | ||
3 | * | ||
4 | * Copyright (c) 1999-2001 Vojtech Pavlik | 2 | * Copyright (c) 1999-2001 Vojtech Pavlik |
5 | * | 3 | * |
6 | * USB HIDBP Mouse support | 4 | * USB HIDBP Mouse support |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 4dc76bc45c9d..00ff53348491 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -330,6 +330,20 @@ config SENSORS_CORETEMP | |||
330 | sensor inside your CPU. Supported all are all known variants | 330 | sensor inside your CPU. Supported all are all known variants |
331 | of Intel Core family. | 331 | of Intel Core family. |
332 | 332 | ||
333 | config SENSORS_IBMAEM | ||
334 | tristate "IBM Active Energy Manager temperature/power sensors and control" | ||
335 | select IPMI_SI | ||
336 | depends on IPMI_HANDLER | ||
337 | help | ||
338 | If you say yes here you get support for the temperature and | ||
339 | power sensors and capping hardware in various IBM System X | ||
340 | servers that support Active Energy Manager. This includes | ||
341 | the x3350, x3550, x3650, x3655, x3755, x3850 M2, x3950 M2, | ||
342 | and certain HS2x/LS2x/QS2x blades. | ||
343 | |||
344 | This driver can also be built as a module. If so, the module | ||
345 | will be called ibmaem. | ||
346 | |||
333 | config SENSORS_IBMPEX | 347 | config SENSORS_IBMPEX |
334 | tristate "IBM PowerExecutive temperature/power sensors" | 348 | tristate "IBM PowerExecutive temperature/power sensors" |
335 | select IPMI_SI | 349 | select IPMI_SI |
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 3bdb05a5cbd7..d098677e08de 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile | |||
@@ -41,6 +41,7 @@ obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o | |||
41 | obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o | 41 | obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o |
42 | obj-$(CONFIG_SENSORS_HDAPS) += hdaps.o | 42 | obj-$(CONFIG_SENSORS_HDAPS) += hdaps.o |
43 | obj-$(CONFIG_SENSORS_I5K_AMB) += i5k_amb.o | 43 | obj-$(CONFIG_SENSORS_I5K_AMB) += i5k_amb.o |
44 | obj-$(CONFIG_SENSORS_IBMAEM) += ibmaem.o | ||
44 | obj-$(CONFIG_SENSORS_IBMPEX) += ibmpex.o | 45 | obj-$(CONFIG_SENSORS_IBMPEX) += ibmpex.o |
45 | obj-$(CONFIG_SENSORS_IT87) += it87.o | 46 | obj-$(CONFIG_SENSORS_IT87) += it87.o |
46 | obj-$(CONFIG_SENSORS_K8TEMP) += k8temp.o | 47 | obj-$(CONFIG_SENSORS_K8TEMP) += k8temp.o |
diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c index bab5fd2e4dfd..88e89653daaf 100644 --- a/drivers/hwmon/hdaps.c +++ b/drivers/hwmon/hdaps.c | |||
@@ -515,6 +515,7 @@ static struct dmi_system_id __initdata hdaps_whitelist[] = { | |||
515 | HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R50"), | 515 | HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R50"), |
516 | HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R51"), | 516 | HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R51"), |
517 | HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R52"), | 517 | HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R52"), |
518 | HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad R61i"), | ||
518 | HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T41p"), | 519 | HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T41p"), |
519 | HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad T41"), | 520 | HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad T41"), |
520 | HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T42p"), | 521 | HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T42p"), |
diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c index 6ac5c6f53585..f9e2ed621f7b 100644 --- a/drivers/hwmon/i5k_amb.c +++ b/drivers/hwmon/i5k_amb.c | |||
@@ -111,6 +111,7 @@ struct i5k_amb_data { | |||
111 | void __iomem *amb_mmio; | 111 | void __iomem *amb_mmio; |
112 | struct i5k_device_attribute *attrs; | 112 | struct i5k_device_attribute *attrs; |
113 | unsigned int num_attrs; | 113 | unsigned int num_attrs; |
114 | unsigned long chipset_id; | ||
114 | }; | 115 | }; |
115 | 116 | ||
116 | static ssize_t show_name(struct device *dev, struct device_attribute *devattr, | 117 | static ssize_t show_name(struct device *dev, struct device_attribute *devattr, |
@@ -382,7 +383,8 @@ err: | |||
382 | return res; | 383 | return res; |
383 | } | 384 | } |
384 | 385 | ||
385 | static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data) | 386 | static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data, |
387 | unsigned long devid) | ||
386 | { | 388 | { |
387 | struct pci_dev *pcidev; | 389 | struct pci_dev *pcidev; |
388 | u32 val32; | 390 | u32 val32; |
@@ -390,7 +392,7 @@ static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data) | |||
390 | 392 | ||
391 | /* Find AMB register memory space */ | 393 | /* Find AMB register memory space */ |
392 | pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, | 394 | pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, |
393 | PCI_DEVICE_ID_INTEL_5000_ERR, | 395 | devid, |
394 | NULL); | 396 | NULL); |
395 | if (!pcidev) | 397 | if (!pcidev) |
396 | return -ENODEV; | 398 | return -ENODEV; |
@@ -409,6 +411,8 @@ static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data) | |||
409 | goto out; | 411 | goto out; |
410 | } | 412 | } |
411 | 413 | ||
414 | data->chipset_id = devid; | ||
415 | |||
412 | res = 0; | 416 | res = 0; |
413 | out: | 417 | out: |
414 | pci_dev_put(pcidev); | 418 | pci_dev_put(pcidev); |
@@ -441,10 +445,30 @@ out: | |||
441 | return res; | 445 | return res; |
442 | } | 446 | } |
443 | 447 | ||
448 | static unsigned long i5k_channel_pci_id(struct i5k_amb_data *data, | ||
449 | unsigned long channel) | ||
450 | { | ||
451 | switch (data->chipset_id) { | ||
452 | case PCI_DEVICE_ID_INTEL_5000_ERR: | ||
453 | return PCI_DEVICE_ID_INTEL_5000_FBD0 + channel; | ||
454 | case PCI_DEVICE_ID_INTEL_5400_ERR: | ||
455 | return PCI_DEVICE_ID_INTEL_5400_FBD0 + channel; | ||
456 | default: | ||
457 | BUG(); | ||
458 | } | ||
459 | } | ||
460 | |||
461 | static unsigned long chipset_ids[] = { | ||
462 | PCI_DEVICE_ID_INTEL_5000_ERR, | ||
463 | PCI_DEVICE_ID_INTEL_5400_ERR, | ||
464 | 0 | ||
465 | }; | ||
466 | |||
444 | static int __devinit i5k_amb_probe(struct platform_device *pdev) | 467 | static int __devinit i5k_amb_probe(struct platform_device *pdev) |
445 | { | 468 | { |
446 | struct i5k_amb_data *data; | 469 | struct i5k_amb_data *data; |
447 | struct resource *reso; | 470 | struct resource *reso; |
471 | int i; | ||
448 | int res = -ENODEV; | 472 | int res = -ENODEV; |
449 | 473 | ||
450 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 474 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
@@ -452,19 +476,24 @@ static int __devinit i5k_amb_probe(struct platform_device *pdev) | |||
452 | return -ENOMEM; | 476 | return -ENOMEM; |
453 | 477 | ||
454 | /* Figure out where the AMB registers live */ | 478 | /* Figure out where the AMB registers live */ |
455 | res = i5k_find_amb_registers(data); | 479 | i = 0; |
480 | do { | ||
481 | res = i5k_find_amb_registers(data, chipset_ids[i]); | ||
482 | i++; | ||
483 | } while (res && chipset_ids[i]); | ||
484 | |||
456 | if (res) | 485 | if (res) |
457 | goto err; | 486 | goto err; |
458 | 487 | ||
459 | /* Copy the DIMM presence map for the first two channels */ | 488 | /* Copy the DIMM presence map for the first two channels */ |
460 | res = i5k_channel_probe(&data->amb_present[0], | 489 | res = i5k_channel_probe(&data->amb_present[0], |
461 | PCI_DEVICE_ID_INTEL_5000_FBD0); | 490 | i5k_channel_pci_id(data, 0)); |
462 | if (res) | 491 | if (res) |
463 | goto err; | 492 | goto err; |
464 | 493 | ||
465 | /* Copy the DIMM presence map for the optional second two channels */ | 494 | /* Copy the DIMM presence map for the optional second two channels */ |
466 | i5k_channel_probe(&data->amb_present[2], | 495 | i5k_channel_probe(&data->amb_present[2], |
467 | PCI_DEVICE_ID_INTEL_5000_FBD1); | 496 | i5k_channel_pci_id(data, 1)); |
468 | 497 | ||
469 | /* Set up resource regions */ | 498 | /* Set up resource regions */ |
470 | reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME); | 499 | reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME); |
diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c new file mode 100644 index 000000000000..5c006c9a4311 --- /dev/null +++ b/drivers/hwmon/ibmaem.c | |||
@@ -0,0 +1,1111 @@ | |||
1 | /* | ||
2 | * A hwmon driver for the IBM Active Energy Manager temperature/power sensors | ||
3 | * and capping functionality. | ||
4 | * Copyright (C) 2008 IBM | ||
5 | * | ||
6 | * Author: Darrick J. Wong <djwong@us.ibm.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #include <linux/ipmi.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/hwmon.h> | ||
26 | #include <linux/hwmon-sysfs.h> | ||
27 | #include <linux/jiffies.h> | ||
28 | #include <linux/mutex.h> | ||
29 | #include <linux/kdev_t.h> | ||
30 | #include <linux/spinlock.h> | ||
31 | #include <linux/idr.h> | ||
32 | #include <linux/sched.h> | ||
33 | #include <linux/platform_device.h> | ||
34 | #include <linux/math64.h> | ||
35 | #include <linux/time.h> | ||
36 | |||
37 | #define REFRESH_INTERVAL (HZ) | ||
38 | #define IPMI_TIMEOUT (30 * HZ) | ||
39 | #define DRVNAME "aem" | ||
40 | |||
41 | #define AEM_NETFN 0x2E | ||
42 | |||
43 | #define AEM_FIND_FW_CMD 0x80 | ||
44 | #define AEM_ELEMENT_CMD 0x81 | ||
45 | #define AEM_FW_INSTANCE_CMD 0x82 | ||
46 | |||
47 | #define AEM_READ_ELEMENT_CFG 0x80 | ||
48 | #define AEM_READ_BUFFER 0x81 | ||
49 | #define AEM_READ_REGISTER 0x82 | ||
50 | #define AEM_WRITE_REGISTER 0x83 | ||
51 | #define AEM_SET_REG_MASK 0x84 | ||
52 | #define AEM_CLEAR_REG_MASK 0x85 | ||
53 | #define AEM_READ_ELEMENT_CFG2 0x86 | ||
54 | |||
55 | #define AEM_CONTROL_ELEMENT 0 | ||
56 | #define AEM_ENERGY_ELEMENT 1 | ||
57 | #define AEM_CLOCK_ELEMENT 4 | ||
58 | #define AEM_POWER_CAP_ELEMENT 7 | ||
59 | #define AEM_EXHAUST_ELEMENT 9 | ||
60 | #define AEM_POWER_ELEMENT 10 | ||
61 | |||
62 | #define AEM_MODULE_TYPE_ID 0x0001 | ||
63 | |||
64 | #define AEM2_NUM_ENERGY_REGS 2 | ||
65 | #define AEM2_NUM_PCAP_REGS 6 | ||
66 | #define AEM2_NUM_TEMP_REGS 2 | ||
67 | #define AEM2_NUM_SENSORS 14 | ||
68 | |||
69 | #define AEM1_NUM_ENERGY_REGS 1 | ||
70 | #define AEM1_NUM_SENSORS 3 | ||
71 | |||
72 | /* AEM 2.x has more energy registers */ | ||
73 | #define AEM_NUM_ENERGY_REGS AEM2_NUM_ENERGY_REGS | ||
74 | /* AEM 2.x needs more sensor files */ | ||
75 | #define AEM_NUM_SENSORS AEM2_NUM_SENSORS | ||
76 | |||
77 | #define POWER_CAP 0 | ||
78 | #define POWER_CAP_MAX_HOTPLUG 1 | ||
79 | #define POWER_CAP_MAX 2 | ||
80 | #define POWER_CAP_MIN_WARNING 3 | ||
81 | #define POWER_CAP_MIN 4 | ||
82 | #define POWER_AUX 5 | ||
83 | |||
84 | #define AEM_DEFAULT_POWER_INTERVAL 1000 | ||
85 | #define AEM_MIN_POWER_INTERVAL 200 | ||
86 | #define UJ_PER_MJ 1000L | ||
87 | |||
88 | static DEFINE_IDR(aem_idr); | ||
89 | static DEFINE_SPINLOCK(aem_idr_lock); | ||
90 | |||
91 | static struct device_driver aem_driver = { | ||
92 | .name = DRVNAME, | ||
93 | .bus = &platform_bus_type, | ||
94 | }; | ||
95 | |||
96 | struct aem_ipmi_data { | ||
97 | struct completion read_complete; | ||
98 | struct ipmi_addr address; | ||
99 | ipmi_user_t user; | ||
100 | int interface; | ||
101 | |||
102 | struct kernel_ipmi_msg tx_message; | ||
103 | long tx_msgid; | ||
104 | |||
105 | void *rx_msg_data; | ||
106 | unsigned short rx_msg_len; | ||
107 | unsigned char rx_result; | ||
108 | int rx_recv_type; | ||
109 | |||
110 | struct device *bmc_device; | ||
111 | }; | ||
112 | |||
113 | struct aem_ro_sensor_template { | ||
114 | char *label; | ||
115 | ssize_t (*show)(struct device *dev, | ||
116 | struct device_attribute *devattr, | ||
117 | char *buf); | ||
118 | int index; | ||
119 | }; | ||
120 | |||
121 | struct aem_rw_sensor_template { | ||
122 | char *label; | ||
123 | ssize_t (*show)(struct device *dev, | ||
124 | struct device_attribute *devattr, | ||
125 | char *buf); | ||
126 | ssize_t (*set)(struct device *dev, | ||
127 | struct device_attribute *devattr, | ||
128 | const char *buf, size_t count); | ||
129 | int index; | ||
130 | }; | ||
131 | |||
132 | struct aem_data { | ||
133 | struct list_head list; | ||
134 | |||
135 | struct device *hwmon_dev; | ||
136 | struct platform_device *pdev; | ||
137 | struct mutex lock; | ||
138 | char valid; | ||
139 | unsigned long last_updated; /* In jiffies */ | ||
140 | u8 ver_major; | ||
141 | u8 ver_minor; | ||
142 | u8 module_handle; | ||
143 | int id; | ||
144 | struct aem_ipmi_data ipmi; | ||
145 | |||
146 | /* Function to update sensors */ | ||
147 | void (*update)(struct aem_data *data); | ||
148 | |||
149 | /* | ||
150 | * AEM 1.x sensors: | ||
151 | * Available sensors: | ||
152 | * Energy meter | ||
153 | * Power meter | ||
154 | * | ||
155 | * AEM 2.x sensors: | ||
156 | * Two energy meters | ||
157 | * Two power meters | ||
158 | * Two temperature sensors | ||
159 | * Six power cap registers | ||
160 | */ | ||
161 | |||
162 | /* sysfs attrs */ | ||
163 | struct sensor_device_attribute sensors[AEM_NUM_SENSORS]; | ||
164 | |||
165 | /* energy use in mJ */ | ||
166 | u64 energy[AEM_NUM_ENERGY_REGS]; | ||
167 | |||
168 | /* power sampling interval in ms */ | ||
169 | unsigned long power_period[AEM_NUM_ENERGY_REGS]; | ||
170 | |||
171 | /* Everything past here is for AEM2 only */ | ||
172 | |||
173 | /* power caps in dW */ | ||
174 | u16 pcap[AEM2_NUM_PCAP_REGS]; | ||
175 | |||
176 | /* exhaust temperature in C */ | ||
177 | u8 temp[AEM2_NUM_TEMP_REGS]; | ||
178 | }; | ||
179 | |||
180 | /* Data structures returned by the AEM firmware */ | ||
181 | struct aem_iana_id { | ||
182 | u8 bytes[3]; | ||
183 | }; | ||
184 | static struct aem_iana_id system_x_id = { | ||
185 | .bytes = {0x4D, 0x4F, 0x00} | ||
186 | }; | ||
187 | |||
188 | /* These are used to find AEM1 instances */ | ||
189 | struct aem_find_firmware_req { | ||
190 | struct aem_iana_id id; | ||
191 | u8 rsvd; | ||
192 | u16 index; | ||
193 | u16 module_type_id; | ||
194 | } __packed; | ||
195 | |||
196 | struct aem_find_firmware_resp { | ||
197 | struct aem_iana_id id; | ||
198 | u8 num_instances; | ||
199 | } __packed; | ||
200 | |||
201 | /* These are used to find AEM2 instances */ | ||
202 | struct aem_find_instance_req { | ||
203 | struct aem_iana_id id; | ||
204 | u8 instance_number; | ||
205 | u16 module_type_id; | ||
206 | } __packed; | ||
207 | |||
208 | struct aem_find_instance_resp { | ||
209 | struct aem_iana_id id; | ||
210 | u8 num_instances; | ||
211 | u8 major; | ||
212 | u8 minor; | ||
213 | u8 module_handle; | ||
214 | u16 record_id; | ||
215 | } __packed; | ||
216 | |||
217 | /* These are used to query sensors */ | ||
218 | struct aem_read_sensor_req { | ||
219 | struct aem_iana_id id; | ||
220 | u8 module_handle; | ||
221 | u8 element; | ||
222 | u8 subcommand; | ||
223 | u8 reg; | ||
224 | u8 rx_buf_size; | ||
225 | } __packed; | ||
226 | |||
227 | struct aem_read_sensor_resp { | ||
228 | struct aem_iana_id id; | ||
229 | u8 bytes[0]; | ||
230 | } __packed; | ||
231 | |||
232 | /* Data structures to talk to the IPMI layer */ | ||
233 | struct aem_driver_data { | ||
234 | struct list_head aem_devices; | ||
235 | struct ipmi_smi_watcher bmc_events; | ||
236 | struct ipmi_user_hndl ipmi_hndlrs; | ||
237 | }; | ||
238 | |||
239 | static void aem_register_bmc(int iface, struct device *dev); | ||
240 | static void aem_bmc_gone(int iface); | ||
241 | static void aem_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data); | ||
242 | |||
243 | static void aem_remove_sensors(struct aem_data *data); | ||
244 | static int aem_init_aem1(struct aem_ipmi_data *probe); | ||
245 | static int aem_init_aem2(struct aem_ipmi_data *probe); | ||
246 | static int aem1_find_sensors(struct aem_data *data); | ||
247 | static int aem2_find_sensors(struct aem_data *data); | ||
248 | static void update_aem1_sensors(struct aem_data *data); | ||
249 | static void update_aem2_sensors(struct aem_data *data); | ||
250 | |||
251 | static struct aem_driver_data driver_data = { | ||
252 | .aem_devices = LIST_HEAD_INIT(driver_data.aem_devices), | ||
253 | .bmc_events = { | ||
254 | .owner = THIS_MODULE, | ||
255 | .new_smi = aem_register_bmc, | ||
256 | .smi_gone = aem_bmc_gone, | ||
257 | }, | ||
258 | .ipmi_hndlrs = { | ||
259 | .ipmi_recv_hndl = aem_msg_handler, | ||
260 | }, | ||
261 | }; | ||
262 | |||
263 | /* Functions to talk to the IPMI layer */ | ||
264 | |||
265 | /* Initialize IPMI address, message buffers and user data */ | ||
266 | static int aem_init_ipmi_data(struct aem_ipmi_data *data, int iface, | ||
267 | struct device *bmc) | ||
268 | { | ||
269 | int err; | ||
270 | |||
271 | init_completion(&data->read_complete); | ||
272 | data->bmc_device = bmc; | ||
273 | |||
274 | /* Initialize IPMI address */ | ||
275 | data->address.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; | ||
276 | data->address.channel = IPMI_BMC_CHANNEL; | ||
277 | data->address.data[0] = 0; | ||
278 | data->interface = iface; | ||
279 | |||
280 | /* Initialize message buffers */ | ||
281 | data->tx_msgid = 0; | ||
282 | data->tx_message.netfn = AEM_NETFN; | ||
283 | |||
284 | /* Create IPMI messaging interface user */ | ||
285 | err = ipmi_create_user(data->interface, &driver_data.ipmi_hndlrs, | ||
286 | data, &data->user); | ||
287 | if (err < 0) { | ||
288 | dev_err(bmc, "Unable to register user with IPMI " | ||
289 | "interface %d\n", data->interface); | ||
290 | return -EACCES; | ||
291 | } | ||
292 | |||
293 | return 0; | ||
294 | } | ||
295 | |||
296 | /* Send an IPMI command */ | ||
297 | static int aem_send_message(struct aem_ipmi_data *data) | ||
298 | { | ||
299 | int err; | ||
300 | |||
301 | err = ipmi_validate_addr(&data->address, sizeof(data->address)); | ||
302 | if (err) | ||
303 | goto out; | ||
304 | |||
305 | data->tx_msgid++; | ||
306 | err = ipmi_request_settime(data->user, &data->address, data->tx_msgid, | ||
307 | &data->tx_message, data, 0, 0, 0); | ||
308 | if (err) | ||
309 | goto out1; | ||
310 | |||
311 | return 0; | ||
312 | out1: | ||
313 | dev_err(data->bmc_device, "request_settime=%x\n", err); | ||
314 | return err; | ||
315 | out: | ||
316 | dev_err(data->bmc_device, "validate_addr=%x\n", err); | ||
317 | return err; | ||
318 | } | ||
319 | |||
320 | /* Dispatch IPMI messages to callers */ | ||
321 | static void aem_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data) | ||
322 | { | ||
323 | unsigned short rx_len; | ||
324 | struct aem_ipmi_data *data = user_msg_data; | ||
325 | |||
326 | if (msg->msgid != data->tx_msgid) { | ||
327 | dev_err(data->bmc_device, "Mismatch between received msgid " | ||
328 | "(%02x) and transmitted msgid (%02x)!\n", | ||
329 | (int)msg->msgid, | ||
330 | (int)data->tx_msgid); | ||
331 | ipmi_free_recv_msg(msg); | ||
332 | return; | ||
333 | } | ||
334 | |||
335 | data->rx_recv_type = msg->recv_type; | ||
336 | if (msg->msg.data_len > 0) | ||
337 | data->rx_result = msg->msg.data[0]; | ||
338 | else | ||
339 | data->rx_result = IPMI_UNKNOWN_ERR_COMPLETION_CODE; | ||
340 | |||
341 | if (msg->msg.data_len > 1) { | ||
342 | rx_len = msg->msg.data_len - 1; | ||
343 | if (data->rx_msg_len < rx_len) | ||
344 | rx_len = data->rx_msg_len; | ||
345 | data->rx_msg_len = rx_len; | ||
346 | memcpy(data->rx_msg_data, msg->msg.data + 1, data->rx_msg_len); | ||
347 | } else | ||
348 | data->rx_msg_len = 0; | ||
349 | |||
350 | ipmi_free_recv_msg(msg); | ||
351 | complete(&data->read_complete); | ||
352 | } | ||
353 | |||
354 | /* ID functions */ | ||
355 | |||
356 | /* Obtain an id */ | ||
357 | static int aem_idr_get(int *id) | ||
358 | { | ||
359 | int i, err; | ||
360 | |||
361 | again: | ||
362 | if (unlikely(!idr_pre_get(&aem_idr, GFP_KERNEL))) | ||
363 | return -ENOMEM; | ||
364 | |||
365 | spin_lock(&aem_idr_lock); | ||
366 | err = idr_get_new(&aem_idr, NULL, &i); | ||
367 | spin_unlock(&aem_idr_lock); | ||
368 | |||
369 | if (unlikely(err == -EAGAIN)) | ||
370 | goto again; | ||
371 | else if (unlikely(err)) | ||
372 | return err; | ||
373 | |||
374 | *id = i & MAX_ID_MASK; | ||
375 | return 0; | ||
376 | } | ||
377 | |||
378 | /* Release an object ID */ | ||
379 | static void aem_idr_put(int id) | ||
380 | { | ||
381 | spin_lock(&aem_idr_lock); | ||
382 | idr_remove(&aem_idr, id); | ||
383 | spin_unlock(&aem_idr_lock); | ||
384 | } | ||
385 | |||
386 | /* Sensor support functions */ | ||
387 | |||
388 | /* Read a sensor value */ | ||
389 | static int aem_read_sensor(struct aem_data *data, u8 elt, u8 reg, | ||
390 | void *buf, size_t size) | ||
391 | { | ||
392 | int rs_size, res; | ||
393 | struct aem_read_sensor_req rs_req; | ||
394 | struct aem_read_sensor_resp *rs_resp; | ||
395 | struct aem_ipmi_data *ipmi = &data->ipmi; | ||
396 | |||
397 | /* AEM registers are 1, 2, 4 or 8 bytes */ | ||
398 | switch (size) { | ||
399 | case 1: | ||
400 | case 2: | ||
401 | case 4: | ||
402 | case 8: | ||
403 | break; | ||
404 | default: | ||
405 | return -EINVAL; | ||
406 | } | ||
407 | |||
408 | rs_req.id = system_x_id; | ||
409 | rs_req.module_handle = data->module_handle; | ||
410 | rs_req.element = elt; | ||
411 | rs_req.subcommand = AEM_READ_REGISTER; | ||
412 | rs_req.reg = reg; | ||
413 | rs_req.rx_buf_size = size; | ||
414 | |||
415 | ipmi->tx_message.cmd = AEM_ELEMENT_CMD; | ||
416 | ipmi->tx_message.data = (char *)&rs_req; | ||
417 | ipmi->tx_message.data_len = sizeof(rs_req); | ||
418 | |||
419 | rs_size = sizeof(*rs_resp) + size; | ||
420 | rs_resp = kzalloc(rs_size, GFP_KERNEL); | ||
421 | if (!rs_resp) | ||
422 | return -ENOMEM; | ||
423 | |||
424 | ipmi->rx_msg_data = rs_resp; | ||
425 | ipmi->rx_msg_len = rs_size; | ||
426 | |||
427 | aem_send_message(ipmi); | ||
428 | |||
429 | res = wait_for_completion_timeout(&ipmi->read_complete, IPMI_TIMEOUT); | ||
430 | if (!res) | ||
431 | return -ETIMEDOUT; | ||
432 | |||
433 | if (ipmi->rx_result || ipmi->rx_msg_len != rs_size || | ||
434 | memcmp(&rs_resp->id, &system_x_id, sizeof(system_x_id))) { | ||
435 | kfree(rs_resp); | ||
436 | return -ENOENT; | ||
437 | } | ||
438 | |||
439 | switch (size) { | ||
440 | case 1: { | ||
441 | u8 *x = buf; | ||
442 | *x = rs_resp->bytes[0]; | ||
443 | break; | ||
444 | } | ||
445 | case 2: { | ||
446 | u16 *x = buf; | ||
447 | *x = be16_to_cpup((u16 *)rs_resp->bytes); | ||
448 | break; | ||
449 | } | ||
450 | case 4: { | ||
451 | u32 *x = buf; | ||
452 | *x = be32_to_cpup((u32 *)rs_resp->bytes); | ||
453 | break; | ||
454 | } | ||
455 | case 8: { | ||
456 | u64 *x = buf; | ||
457 | *x = be64_to_cpup((u64 *)rs_resp->bytes); | ||
458 | break; | ||
459 | } | ||
460 | } | ||
461 | |||
462 | return 0; | ||
463 | } | ||
464 | |||
465 | /* Update AEM energy registers */ | ||
466 | static void update_aem_energy(struct aem_data *data) | ||
467 | { | ||
468 | aem_read_sensor(data, AEM_ENERGY_ELEMENT, 0, &data->energy[0], 8); | ||
469 | if (data->ver_major < 2) | ||
470 | return; | ||
471 | aem_read_sensor(data, AEM_ENERGY_ELEMENT, 1, &data->energy[1], 8); | ||
472 | } | ||
473 | |||
474 | /* Update all AEM1 sensors */ | ||
475 | static void update_aem1_sensors(struct aem_data *data) | ||
476 | { | ||
477 | mutex_lock(&data->lock); | ||
478 | if (time_before(jiffies, data->last_updated + REFRESH_INTERVAL) && | ||
479 | data->valid) | ||
480 | goto out; | ||
481 | |||
482 | update_aem_energy(data); | ||
483 | out: | ||
484 | mutex_unlock(&data->lock); | ||
485 | } | ||
486 | |||
487 | /* Update all AEM2 sensors */ | ||
488 | static void update_aem2_sensors(struct aem_data *data) | ||
489 | { | ||
490 | int i; | ||
491 | |||
492 | mutex_lock(&data->lock); | ||
493 | if (time_before(jiffies, data->last_updated + REFRESH_INTERVAL) && | ||
494 | data->valid) | ||
495 | goto out; | ||
496 | |||
497 | update_aem_energy(data); | ||
498 | aem_read_sensor(data, AEM_EXHAUST_ELEMENT, 0, &data->temp[0], 1); | ||
499 | aem_read_sensor(data, AEM_EXHAUST_ELEMENT, 1, &data->temp[1], 1); | ||
500 | |||
501 | for (i = POWER_CAP; i <= POWER_AUX; i++) | ||
502 | aem_read_sensor(data, AEM_POWER_CAP_ELEMENT, i, | ||
503 | &data->pcap[i], 2); | ||
504 | out: | ||
505 | mutex_unlock(&data->lock); | ||
506 | } | ||
507 | |||
508 | /* Delete an AEM instance */ | ||
509 | static void aem_delete(struct aem_data *data) | ||
510 | { | ||
511 | list_del(&data->list); | ||
512 | aem_remove_sensors(data); | ||
513 | hwmon_device_unregister(data->hwmon_dev); | ||
514 | ipmi_destroy_user(data->ipmi.user); | ||
515 | dev_set_drvdata(&data->pdev->dev, NULL); | ||
516 | platform_device_unregister(data->pdev); | ||
517 | aem_idr_put(data->id); | ||
518 | kfree(data); | ||
519 | } | ||
520 | |||
521 | /* Probe functions for AEM1 devices */ | ||
522 | |||
523 | /* Retrieve version and module handle for an AEM1 instance */ | ||
524 | static int aem_find_aem1_count(struct aem_ipmi_data *data) | ||
525 | { | ||
526 | int res; | ||
527 | struct aem_find_firmware_req ff_req; | ||
528 | struct aem_find_firmware_resp ff_resp; | ||
529 | |||
530 | ff_req.id = system_x_id; | ||
531 | ff_req.index = 0; | ||
532 | ff_req.module_type_id = cpu_to_be16(AEM_MODULE_TYPE_ID); | ||
533 | |||
534 | data->tx_message.cmd = AEM_FIND_FW_CMD; | ||
535 | data->tx_message.data = (char *)&ff_req; | ||
536 | data->tx_message.data_len = sizeof(ff_req); | ||
537 | |||
538 | data->rx_msg_data = &ff_resp; | ||
539 | data->rx_msg_len = sizeof(ff_resp); | ||
540 | |||
541 | aem_send_message(data); | ||
542 | |||
543 | res = wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT); | ||
544 | if (!res) | ||
545 | return -ETIMEDOUT; | ||
546 | |||
547 | if (data->rx_result || data->rx_msg_len != sizeof(ff_resp) || | ||
548 | memcmp(&ff_resp.id, &system_x_id, sizeof(system_x_id))) | ||
549 | return -ENOENT; | ||
550 | |||
551 | return ff_resp.num_instances; | ||
552 | } | ||
553 | |||
554 | /* Find and initialize one AEM1 instance */ | ||
555 | static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle) | ||
556 | { | ||
557 | struct aem_data *data; | ||
558 | int i; | ||
559 | int res = -ENOMEM; | ||
560 | |||
561 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
562 | if (!data) | ||
563 | return res; | ||
564 | mutex_init(&data->lock); | ||
565 | |||
566 | /* Copy instance data */ | ||
567 | data->ver_major = 1; | ||
568 | data->ver_minor = 0; | ||
569 | data->module_handle = module_handle; | ||
570 | for (i = 0; i < AEM1_NUM_ENERGY_REGS; i++) | ||
571 | data->power_period[i] = AEM_DEFAULT_POWER_INTERVAL; | ||
572 | |||
573 | /* Create sub-device for this fw instance */ | ||
574 | if (aem_idr_get(&data->id)) | ||
575 | goto id_err; | ||
576 | |||
577 | data->pdev = platform_device_alloc(DRVNAME, data->id); | ||
578 | if (!data->pdev) | ||
579 | goto dev_err; | ||
580 | data->pdev->dev.driver = &aem_driver; | ||
581 | |||
582 | res = platform_device_add(data->pdev); | ||
583 | if (res) | ||
584 | goto ipmi_err; | ||
585 | |||
586 | dev_set_drvdata(&data->pdev->dev, data); | ||
587 | |||
588 | /* Set up IPMI interface */ | ||
589 | if (aem_init_ipmi_data(&data->ipmi, probe->interface, | ||
590 | probe->bmc_device)) | ||
591 | goto ipmi_err; | ||
592 | |||
593 | /* Register with hwmon */ | ||
594 | data->hwmon_dev = hwmon_device_register(&data->pdev->dev); | ||
595 | |||
596 | if (IS_ERR(data->hwmon_dev)) { | ||
597 | dev_err(&data->pdev->dev, "Unable to register hwmon " | ||
598 | "device for IPMI interface %d\n", | ||
599 | probe->interface); | ||
600 | goto hwmon_reg_err; | ||
601 | } | ||
602 | |||
603 | data->update = update_aem1_sensors; | ||
604 | |||
605 | /* Find sensors */ | ||
606 | if (aem1_find_sensors(data)) | ||
607 | goto sensor_err; | ||
608 | |||
609 | /* Add to our list of AEM devices */ | ||
610 | list_add_tail(&data->list, &driver_data.aem_devices); | ||
611 | |||
612 | dev_info(data->ipmi.bmc_device, "Found AEM v%d.%d at 0x%X\n", | ||
613 | data->ver_major, data->ver_minor, | ||
614 | data->module_handle); | ||
615 | return 0; | ||
616 | |||
617 | sensor_err: | ||
618 | hwmon_device_unregister(data->hwmon_dev); | ||
619 | hwmon_reg_err: | ||
620 | ipmi_destroy_user(data->ipmi.user); | ||
621 | ipmi_err: | ||
622 | dev_set_drvdata(&data->pdev->dev, NULL); | ||
623 | platform_device_unregister(data->pdev); | ||
624 | dev_err: | ||
625 | aem_idr_put(data->id); | ||
626 | id_err: | ||
627 | kfree(data); | ||
628 | |||
629 | return res; | ||
630 | } | ||
631 | |||
632 | /* Find and initialize all AEM1 instances */ | ||
633 | static int aem_init_aem1(struct aem_ipmi_data *probe) | ||
634 | { | ||
635 | int num, i, err; | ||
636 | |||
637 | num = aem_find_aem1_count(probe); | ||
638 | for (i = 0; i < num; i++) { | ||
639 | err = aem_init_aem1_inst(probe, i); | ||
640 | if (err) { | ||
641 | dev_err(probe->bmc_device, | ||
642 | "Error %d initializing AEM1 0x%X\n", | ||
643 | err, i); | ||
644 | return err; | ||
645 | } | ||
646 | } | ||
647 | |||
648 | return 0; | ||
649 | } | ||
650 | |||
651 | /* Probe functions for AEM2 devices */ | ||
652 | |||
653 | /* Retrieve version and module handle for an AEM2 instance */ | ||
654 | static int aem_find_aem2(struct aem_ipmi_data *data, | ||
655 | struct aem_find_instance_resp *fi_resp, | ||
656 | int instance_num) | ||
657 | { | ||
658 | int res; | ||
659 | struct aem_find_instance_req fi_req; | ||
660 | |||
661 | fi_req.id = system_x_id; | ||
662 | fi_req.instance_number = instance_num; | ||
663 | fi_req.module_type_id = cpu_to_be16(AEM_MODULE_TYPE_ID); | ||
664 | |||
665 | data->tx_message.cmd = AEM_FW_INSTANCE_CMD; | ||
666 | data->tx_message.data = (char *)&fi_req; | ||
667 | data->tx_message.data_len = sizeof(fi_req); | ||
668 | |||
669 | data->rx_msg_data = fi_resp; | ||
670 | data->rx_msg_len = sizeof(*fi_resp); | ||
671 | |||
672 | aem_send_message(data); | ||
673 | |||
674 | res = wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT); | ||
675 | if (!res) | ||
676 | return -ETIMEDOUT; | ||
677 | |||
678 | if (data->rx_result || data->rx_msg_len != sizeof(*fi_resp) || | ||
679 | memcmp(&fi_resp->id, &system_x_id, sizeof(system_x_id))) | ||
680 | return -ENOENT; | ||
681 | |||
682 | return 0; | ||
683 | } | ||
684 | |||
685 | /* Find and initialize one AEM2 instance */ | ||
686 | static int aem_init_aem2_inst(struct aem_ipmi_data *probe, | ||
687 | struct aem_find_instance_resp *fi_resp) | ||
688 | { | ||
689 | struct aem_data *data; | ||
690 | int i; | ||
691 | int res = -ENOMEM; | ||
692 | |||
693 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
694 | if (!data) | ||
695 | return res; | ||
696 | mutex_init(&data->lock); | ||
697 | |||
698 | /* Copy instance data */ | ||
699 | data->ver_major = fi_resp->major; | ||
700 | data->ver_minor = fi_resp->minor; | ||
701 | data->module_handle = fi_resp->module_handle; | ||
702 | for (i = 0; i < AEM2_NUM_ENERGY_REGS; i++) | ||
703 | data->power_period[i] = AEM_DEFAULT_POWER_INTERVAL; | ||
704 | |||
705 | /* Create sub-device for this fw instance */ | ||
706 | if (aem_idr_get(&data->id)) | ||
707 | goto id_err; | ||
708 | |||
709 | data->pdev = platform_device_alloc(DRVNAME, data->id); | ||
710 | if (!data->pdev) | ||
711 | goto dev_err; | ||
712 | data->pdev->dev.driver = &aem_driver; | ||
713 | |||
714 | res = platform_device_add(data->pdev); | ||
715 | if (res) | ||
716 | goto ipmi_err; | ||
717 | |||
718 | dev_set_drvdata(&data->pdev->dev, data); | ||
719 | |||
720 | /* Set up IPMI interface */ | ||
721 | if (aem_init_ipmi_data(&data->ipmi, probe->interface, | ||
722 | probe->bmc_device)) | ||
723 | goto ipmi_err; | ||
724 | |||
725 | /* Register with hwmon */ | ||
726 | data->hwmon_dev = hwmon_device_register(&data->pdev->dev); | ||
727 | |||
728 | if (IS_ERR(data->hwmon_dev)) { | ||
729 | dev_err(&data->pdev->dev, "Unable to register hwmon " | ||
730 | "device for IPMI interface %d\n", | ||
731 | probe->interface); | ||
732 | goto hwmon_reg_err; | ||
733 | } | ||
734 | |||
735 | data->update = update_aem2_sensors; | ||
736 | |||
737 | /* Find sensors */ | ||
738 | if (aem2_find_sensors(data)) | ||
739 | goto sensor_err; | ||
740 | |||
741 | /* Add to our list of AEM devices */ | ||
742 | list_add_tail(&data->list, &driver_data.aem_devices); | ||
743 | |||
744 | dev_info(data->ipmi.bmc_device, "Found AEM v%d.%d at 0x%X\n", | ||
745 | data->ver_major, data->ver_minor, | ||
746 | data->module_handle); | ||
747 | return 0; | ||
748 | |||
749 | sensor_err: | ||
750 | hwmon_device_unregister(data->hwmon_dev); | ||
751 | hwmon_reg_err: | ||
752 | ipmi_destroy_user(data->ipmi.user); | ||
753 | ipmi_err: | ||
754 | dev_set_drvdata(&data->pdev->dev, NULL); | ||
755 | platform_device_unregister(data->pdev); | ||
756 | dev_err: | ||
757 | aem_idr_put(data->id); | ||
758 | id_err: | ||
759 | kfree(data); | ||
760 | |||
761 | return res; | ||
762 | } | ||
763 | |||
764 | /* Find and initialize all AEM2 instances */ | ||
765 | static int aem_init_aem2(struct aem_ipmi_data *probe) | ||
766 | { | ||
767 | struct aem_find_instance_resp fi_resp; | ||
768 | int err; | ||
769 | int i = 0; | ||
770 | |||
771 | while (!aem_find_aem2(probe, &fi_resp, i)) { | ||
772 | if (fi_resp.major != 2) { | ||
773 | dev_err(probe->bmc_device, "Unknown AEM v%d; please " | ||
774 | "report this to the maintainer.\n", | ||
775 | fi_resp.major); | ||
776 | i++; | ||
777 | continue; | ||
778 | } | ||
779 | err = aem_init_aem2_inst(probe, &fi_resp); | ||
780 | if (err) { | ||
781 | dev_err(probe->bmc_device, | ||
782 | "Error %d initializing AEM2 0x%X\n", | ||
783 | err, fi_resp.module_handle); | ||
784 | return err; | ||
785 | } | ||
786 | i++; | ||
787 | } | ||
788 | |||
789 | return 0; | ||
790 | } | ||
791 | |||
792 | /* Probe a BMC for AEM firmware instances */ | ||
793 | static void aem_register_bmc(int iface, struct device *dev) | ||
794 | { | ||
795 | struct aem_ipmi_data probe; | ||
796 | |||
797 | if (aem_init_ipmi_data(&probe, iface, dev)) | ||
798 | return; | ||
799 | |||
800 | /* Ignore probe errors; they won't cause problems */ | ||
801 | aem_init_aem1(&probe); | ||
802 | aem_init_aem2(&probe); | ||
803 | |||
804 | ipmi_destroy_user(probe.user); | ||
805 | } | ||
806 | |||
807 | /* Handle BMC deletion */ | ||
808 | static void aem_bmc_gone(int iface) | ||
809 | { | ||
810 | struct aem_data *p1, *next1; | ||
811 | |||
812 | list_for_each_entry_safe(p1, next1, &driver_data.aem_devices, list) | ||
813 | if (p1->ipmi.interface == iface) | ||
814 | aem_delete(p1); | ||
815 | } | ||
816 | |||
817 | /* sysfs support functions */ | ||
818 | |||
819 | /* AEM device name */ | ||
820 | static ssize_t show_name(struct device *dev, struct device_attribute *devattr, | ||
821 | char *buf) | ||
822 | { | ||
823 | struct aem_data *data = dev_get_drvdata(dev); | ||
824 | |||
825 | return sprintf(buf, "%s%d\n", DRVNAME, data->ver_major); | ||
826 | } | ||
827 | static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0); | ||
828 | |||
829 | /* AEM device version */ | ||
830 | static ssize_t show_version(struct device *dev, | ||
831 | struct device_attribute *devattr, | ||
832 | char *buf) | ||
833 | { | ||
834 | struct aem_data *data = dev_get_drvdata(dev); | ||
835 | |||
836 | return sprintf(buf, "%d.%d\n", data->ver_major, data->ver_minor); | ||
837 | } | ||
838 | static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, NULL, 0); | ||
839 | |||
840 | /* Display power use */ | ||
841 | static ssize_t aem_show_power(struct device *dev, | ||
842 | struct device_attribute *devattr, | ||
843 | char *buf) | ||
844 | { | ||
845 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
846 | struct aem_data *data = dev_get_drvdata(dev); | ||
847 | u64 before, after, delta, time; | ||
848 | signed long leftover; | ||
849 | struct timespec b, a; | ||
850 | |||
851 | mutex_lock(&data->lock); | ||
852 | update_aem_energy(data); | ||
853 | getnstimeofday(&b); | ||
854 | before = data->energy[attr->index]; | ||
855 | |||
856 | leftover = schedule_timeout_interruptible( | ||
857 | msecs_to_jiffies(data->power_period[attr->index]) | ||
858 | ); | ||
859 | if (leftover) { | ||
860 | mutex_unlock(&data->lock); | ||
861 | return 0; | ||
862 | } | ||
863 | |||
864 | update_aem_energy(data); | ||
865 | getnstimeofday(&a); | ||
866 | after = data->energy[attr->index]; | ||
867 | mutex_unlock(&data->lock); | ||
868 | |||
869 | time = timespec_to_ns(&a) - timespec_to_ns(&b); | ||
870 | delta = (after - before) * UJ_PER_MJ; | ||
871 | |||
872 | return sprintf(buf, "%llu\n", | ||
873 | (unsigned long long)div64_u64(delta * NSEC_PER_SEC, time)); | ||
874 | } | ||
875 | |||
876 | /* Display energy use */ | ||
877 | static ssize_t aem_show_energy(struct device *dev, | ||
878 | struct device_attribute *devattr, | ||
879 | char *buf) | ||
880 | { | ||
881 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
882 | struct aem_data *a = dev_get_drvdata(dev); | ||
883 | a->update(a); | ||
884 | |||
885 | return sprintf(buf, "%llu\n", | ||
886 | (unsigned long long)a->energy[attr->index] * 1000); | ||
887 | } | ||
888 | |||
889 | /* Display power interval registers */ | ||
890 | static ssize_t aem_show_power_period(struct device *dev, | ||
891 | struct device_attribute *devattr, | ||
892 | char *buf) | ||
893 | { | ||
894 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
895 | struct aem_data *a = dev_get_drvdata(dev); | ||
896 | a->update(a); | ||
897 | |||
898 | return sprintf(buf, "%lu\n", a->power_period[attr->index]); | ||
899 | } | ||
900 | |||
901 | /* Set power interval registers */ | ||
902 | static ssize_t aem_set_power_period(struct device *dev, | ||
903 | struct device_attribute *devattr, | ||
904 | const char *buf, size_t count) | ||
905 | { | ||
906 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
907 | struct aem_data *a = dev_get_drvdata(dev); | ||
908 | unsigned long temp; | ||
909 | int res; | ||
910 | |||
911 | res = strict_strtoul(buf, 10, &temp); | ||
912 | if (res) | ||
913 | return res; | ||
914 | |||
915 | if (temp < AEM_MIN_POWER_INTERVAL) | ||
916 | return -EINVAL; | ||
917 | |||
918 | mutex_lock(&a->lock); | ||
919 | a->power_period[attr->index] = temp; | ||
920 | mutex_unlock(&a->lock); | ||
921 | |||
922 | return count; | ||
923 | } | ||
924 | |||
925 | /* Discover sensors on an AEM device */ | ||
926 | static int aem_register_sensors(struct aem_data *data, | ||
927 | struct aem_ro_sensor_template *ro, | ||
928 | struct aem_rw_sensor_template *rw) | ||
929 | { | ||
930 | struct device *dev = &data->pdev->dev; | ||
931 | struct sensor_device_attribute *sensors = data->sensors; | ||
932 | int err; | ||
933 | |||
934 | /* Set up read-only sensors */ | ||
935 | while (ro->label) { | ||
936 | sensors->dev_attr.attr.name = ro->label; | ||
937 | sensors->dev_attr.attr.mode = S_IRUGO; | ||
938 | sensors->dev_attr.show = ro->show; | ||
939 | sensors->index = ro->index; | ||
940 | |||
941 | err = device_create_file(dev, &sensors->dev_attr); | ||
942 | if (err) { | ||
943 | sensors->dev_attr.attr.name = NULL; | ||
944 | goto error; | ||
945 | } | ||
946 | sensors++; | ||
947 | ro++; | ||
948 | } | ||
949 | |||
950 | /* Set up read-write sensors */ | ||
951 | while (rw->label) { | ||
952 | sensors->dev_attr.attr.name = rw->label; | ||
953 | sensors->dev_attr.attr.mode = S_IRUGO | S_IWUSR; | ||
954 | sensors->dev_attr.show = rw->show; | ||
955 | sensors->dev_attr.store = rw->set; | ||
956 | sensors->index = rw->index; | ||
957 | |||
958 | err = device_create_file(dev, &sensors->dev_attr); | ||
959 | if (err) { | ||
960 | sensors->dev_attr.attr.name = NULL; | ||
961 | goto error; | ||
962 | } | ||
963 | sensors++; | ||
964 | rw++; | ||
965 | } | ||
966 | |||
967 | err = device_create_file(dev, &sensor_dev_attr_name.dev_attr); | ||
968 | if (err) | ||
969 | goto error; | ||
970 | err = device_create_file(dev, &sensor_dev_attr_version.dev_attr); | ||
971 | return err; | ||
972 | |||
973 | error: | ||
974 | aem_remove_sensors(data); | ||
975 | return err; | ||
976 | } | ||
977 | |||
978 | /* sysfs support functions for AEM2 sensors */ | ||
979 | |||
980 | /* Display temperature use */ | ||
981 | static ssize_t aem2_show_temp(struct device *dev, | ||
982 | struct device_attribute *devattr, | ||
983 | char *buf) | ||
984 | { | ||
985 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
986 | struct aem_data *a = dev_get_drvdata(dev); | ||
987 | a->update(a); | ||
988 | |||
989 | return sprintf(buf, "%u\n", a->temp[attr->index] * 1000); | ||
990 | } | ||
991 | |||
992 | /* Display power-capping registers */ | ||
993 | static ssize_t aem2_show_pcap_value(struct device *dev, | ||
994 | struct device_attribute *devattr, | ||
995 | char *buf) | ||
996 | { | ||
997 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | ||
998 | struct aem_data *a = dev_get_drvdata(dev); | ||
999 | a->update(a); | ||
1000 | |||
1001 | return sprintf(buf, "%u\n", a->pcap[attr->index] * 100000); | ||
1002 | } | ||
1003 | |||
1004 | /* Remove sensors attached to an AEM device */ | ||
1005 | static void aem_remove_sensors(struct aem_data *data) | ||
1006 | { | ||
1007 | int i; | ||
1008 | |||
1009 | for (i = 0; i < AEM_NUM_SENSORS; i++) { | ||
1010 | if (!data->sensors[i].dev_attr.attr.name) | ||
1011 | continue; | ||
1012 | device_remove_file(&data->pdev->dev, | ||
1013 | &data->sensors[i].dev_attr); | ||
1014 | } | ||
1015 | |||
1016 | device_remove_file(&data->pdev->dev, | ||
1017 | &sensor_dev_attr_name.dev_attr); | ||
1018 | device_remove_file(&data->pdev->dev, | ||
1019 | &sensor_dev_attr_version.dev_attr); | ||
1020 | } | ||
1021 | |||
1022 | /* Sensor probe functions */ | ||
1023 | |||
1024 | /* Description of AEM1 sensors */ | ||
1025 | static struct aem_ro_sensor_template aem1_ro_sensors[] = { | ||
1026 | {"energy1_input", aem_show_energy, 0}, | ||
1027 | {"power1_average", aem_show_power, 0}, | ||
1028 | {NULL, NULL, 0}, | ||
1029 | }; | ||
1030 | |||
1031 | static struct aem_rw_sensor_template aem1_rw_sensors[] = { | ||
1032 | {"power1_average_interval", aem_show_power_period, aem_set_power_period, 0}, | ||
1033 | {NULL, NULL, NULL, 0}, | ||
1034 | }; | ||
1035 | |||
1036 | /* Description of AEM2 sensors */ | ||
1037 | static struct aem_ro_sensor_template aem2_ro_sensors[] = { | ||
1038 | {"energy1_input", aem_show_energy, 0}, | ||
1039 | {"energy2_input", aem_show_energy, 1}, | ||
1040 | {"power1_average", aem_show_power, 0}, | ||
1041 | {"power2_average", aem_show_power, 1}, | ||
1042 | {"temp1_input", aem2_show_temp, 0}, | ||
1043 | {"temp2_input", aem2_show_temp, 1}, | ||
1044 | |||
1045 | {"power4_average", aem2_show_pcap_value, POWER_CAP_MAX_HOTPLUG}, | ||
1046 | {"power5_average", aem2_show_pcap_value, POWER_CAP_MAX}, | ||
1047 | {"power6_average", aem2_show_pcap_value, POWER_CAP_MIN_WARNING}, | ||
1048 | {"power7_average", aem2_show_pcap_value, POWER_CAP_MIN}, | ||
1049 | |||
1050 | {"power3_average", aem2_show_pcap_value, POWER_AUX}, | ||
1051 | {"power_cap", aem2_show_pcap_value, POWER_CAP}, | ||
1052 | {NULL, NULL, 0}, | ||
1053 | }; | ||
1054 | |||
1055 | static struct aem_rw_sensor_template aem2_rw_sensors[] = { | ||
1056 | {"power1_average_interval", aem_show_power_period, aem_set_power_period, 0}, | ||
1057 | {"power2_average_interval", aem_show_power_period, aem_set_power_period, 1}, | ||
1058 | {NULL, NULL, NULL, 0}, | ||
1059 | }; | ||
1060 | |||
1061 | /* Set up AEM1 sensor attrs */ | ||
1062 | static int aem1_find_sensors(struct aem_data *data) | ||
1063 | { | ||
1064 | return aem_register_sensors(data, aem1_ro_sensors, aem1_rw_sensors); | ||
1065 | } | ||
1066 | |||
1067 | /* Set up AEM2 sensor attrs */ | ||
1068 | static int aem2_find_sensors(struct aem_data *data) | ||
1069 | { | ||
1070 | return aem_register_sensors(data, aem2_ro_sensors, aem2_rw_sensors); | ||
1071 | } | ||
1072 | |||
1073 | /* Module init/exit routines */ | ||
1074 | |||
1075 | static int __init aem_init(void) | ||
1076 | { | ||
1077 | int res; | ||
1078 | |||
1079 | res = driver_register(&aem_driver); | ||
1080 | if (res) { | ||
1081 | printk(KERN_ERR "Can't register aem driver\n"); | ||
1082 | return res; | ||
1083 | } | ||
1084 | |||
1085 | res = ipmi_smi_watcher_register(&driver_data.bmc_events); | ||
1086 | if (res) | ||
1087 | goto ipmi_reg_err; | ||
1088 | return 0; | ||
1089 | |||
1090 | ipmi_reg_err: | ||
1091 | driver_unregister(&aem_driver); | ||
1092 | return res; | ||
1093 | |||
1094 | } | ||
1095 | |||
1096 | static void __exit aem_exit(void) | ||
1097 | { | ||
1098 | struct aem_data *p1, *next1; | ||
1099 | |||
1100 | ipmi_smi_watcher_unregister(&driver_data.bmc_events); | ||
1101 | driver_unregister(&aem_driver); | ||
1102 | list_for_each_entry_safe(p1, next1, &driver_data.aem_devices, list) | ||
1103 | aem_delete(p1); | ||
1104 | } | ||
1105 | |||
1106 | MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>"); | ||
1107 | MODULE_DESCRIPTION("IBM Active Energy Manager power/temp sensor driver"); | ||
1108 | MODULE_LICENSE("GPL"); | ||
1109 | |||
1110 | module_init(aem_init); | ||
1111 | module_exit(aem_exit); | ||
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c index 2fa43183d375..43508d61eb7c 100644 --- a/drivers/i2c/busses/i2c-amd756.c +++ b/drivers/i2c/busses/i2c-amd756.c | |||
@@ -290,7 +290,7 @@ static u32 amd756_func(struct i2c_adapter *adapter) | |||
290 | { | 290 | { |
291 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | | 291 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | |
292 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | | 292 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | |
293 | I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_PROC_CALL; | 293 | I2C_FUNC_SMBUS_BLOCK_DATA; |
294 | } | 294 | } |
295 | 295 | ||
296 | static const struct i2c_algorithm smbus_algorithm = { | 296 | static const struct i2c_algorithm smbus_algorithm = { |
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c index 3dac920e53ea..43c9f8df9509 100644 --- a/drivers/i2c/busses/i2c-nforce2.c +++ b/drivers/i2c/busses/i2c-nforce2.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <linux/init.h> | 50 | #include <linux/init.h> |
51 | #include <linux/i2c.h> | 51 | #include <linux/i2c.h> |
52 | #include <linux/delay.h> | 52 | #include <linux/delay.h> |
53 | #include <linux/dmi.h> | ||
53 | #include <asm/io.h> | 54 | #include <asm/io.h> |
54 | 55 | ||
55 | MODULE_LICENSE("GPL"); | 56 | MODULE_LICENSE("GPL"); |
@@ -109,6 +110,18 @@ struct nforce2_smbus { | |||
109 | /* Misc definitions */ | 110 | /* Misc definitions */ |
110 | #define MAX_TIMEOUT 100 | 111 | #define MAX_TIMEOUT 100 |
111 | 112 | ||
113 | /* We disable the second SMBus channel on these boards */ | ||
114 | static struct dmi_system_id __devinitdata nforce2_dmi_blacklist2[] = { | ||
115 | { | ||
116 | .ident = "DFI Lanparty NF4 Expert", | ||
117 | .matches = { | ||
118 | DMI_MATCH(DMI_BOARD_VENDOR, "DFI Corp,LTD"), | ||
119 | DMI_MATCH(DMI_BOARD_NAME, "LP UT NF4 Expert"), | ||
120 | }, | ||
121 | }, | ||
122 | { } | ||
123 | }; | ||
124 | |||
112 | static struct pci_driver nforce2_driver; | 125 | static struct pci_driver nforce2_driver; |
113 | 126 | ||
114 | static void nforce2_abort(struct i2c_adapter *adap) | 127 | static void nforce2_abort(struct i2c_adapter *adap) |
@@ -367,10 +380,17 @@ static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_ | |||
367 | smbuses[0].base = 0; /* to have a check value */ | 380 | smbuses[0].base = 0; /* to have a check value */ |
368 | } | 381 | } |
369 | /* SMBus adapter 2 */ | 382 | /* SMBus adapter 2 */ |
370 | res2 = nforce2_probe_smb(dev, 5, NFORCE_PCI_SMB2, &smbuses[1], "SMB2"); | 383 | if (dmi_check_system(nforce2_dmi_blacklist2)) { |
371 | if (res2 < 0) { | 384 | dev_err(&dev->dev, "Disabling SMB2 for safety reasons.\n"); |
372 | dev_err(&dev->dev, "Error probing SMB2.\n"); | 385 | res2 = -EPERM; |
373 | smbuses[1].base = 0; /* to have a check value */ | 386 | smbuses[1].base = 0; |
387 | } else { | ||
388 | res2 = nforce2_probe_smb(dev, 5, NFORCE_PCI_SMB2, &smbuses[1], | ||
389 | "SMB2"); | ||
390 | if (res2 < 0) { | ||
391 | dev_err(&dev->dev, "Error probing SMB2.\n"); | ||
392 | smbuses[1].base = 0; /* to have a check value */ | ||
393 | } | ||
374 | } | 394 | } |
375 | if ((res1 < 0) && (res2 < 0)) { | 395 | if ((res1 < 0) && (res2 < 0)) { |
376 | /* we did not find even one of the SMBuses, so we give up */ | 396 | /* we did not find even one of the SMBuses, so we give up */ |
diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c index fb7ea5637eca..cf507b3f60f3 100644 --- a/drivers/i2c/chips/max6875.c +++ b/drivers/i2c/chips/max6875.c | |||
@@ -207,9 +207,6 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind) | |||
207 | fake_client->flags = 0; | 207 | fake_client->flags = 0; |
208 | strlcpy(fake_client->name, "max6875 subclient", I2C_NAME_SIZE); | 208 | strlcpy(fake_client->name, "max6875 subclient", I2C_NAME_SIZE); |
209 | 209 | ||
210 | /* Prevent 24RF08 corruption (in case of user error) */ | ||
211 | i2c_smbus_write_quick(real_client, 0); | ||
212 | |||
213 | if ((err = i2c_attach_client(real_client)) != 0) | 210 | if ((err = i2c_attach_client(real_client)) != 0) |
214 | goto exit_kfree2; | 211 | goto exit_kfree2; |
215 | 212 | ||
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index c99ebeadb558..d0175f4f8fc6 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -74,10 +74,7 @@ static int i2c_device_match(struct device *dev, struct device_driver *drv) | |||
74 | if (driver->id_table) | 74 | if (driver->id_table) |
75 | return i2c_match_id(driver->id_table, client) != NULL; | 75 | return i2c_match_id(driver->id_table, client) != NULL; |
76 | 76 | ||
77 | /* new style drivers use the same kind of driver matching policy | 77 | return 0; |
78 | * as platform devices or SPI: compare device and driver IDs. | ||
79 | */ | ||
80 | return strcmp(client->driver_name, drv->name) == 0; | ||
81 | } | 78 | } |
82 | 79 | ||
83 | #ifdef CONFIG_HOTPLUG | 80 | #ifdef CONFIG_HOTPLUG |
@@ -91,14 +88,9 @@ static int i2c_device_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
91 | if (dev->driver) | 88 | if (dev->driver) |
92 | return 0; | 89 | return 0; |
93 | 90 | ||
94 | if (client->driver_name[0]) { | 91 | if (add_uevent_var(env, "MODALIAS=%s%s", |
95 | if (add_uevent_var(env, "MODALIAS=%s", client->driver_name)) | 92 | I2C_MODULE_PREFIX, client->name)) |
96 | return -ENOMEM; | 93 | return -ENOMEM; |
97 | } else { | ||
98 | if (add_uevent_var(env, "MODALIAS=%s%s", | ||
99 | I2C_MODULE_PREFIX, client->name)) | ||
100 | return -ENOMEM; | ||
101 | } | ||
102 | dev_dbg(dev, "uevent\n"); | 94 | dev_dbg(dev, "uevent\n"); |
103 | return 0; | 95 | return 0; |
104 | } | 96 | } |
@@ -206,9 +198,7 @@ static ssize_t show_client_name(struct device *dev, struct device_attribute *att | |||
206 | static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf) | 198 | static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf) |
207 | { | 199 | { |
208 | struct i2c_client *client = to_i2c_client(dev); | 200 | struct i2c_client *client = to_i2c_client(dev); |
209 | return client->driver_name[0] | 201 | return sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name); |
210 | ? sprintf(buf, "%s\n", client->driver_name) | ||
211 | : sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name); | ||
212 | } | 202 | } |
213 | 203 | ||
214 | static struct device_attribute i2c_dev_attrs[] = { | 204 | static struct device_attribute i2c_dev_attrs[] = { |
@@ -282,8 +272,6 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info) | |||
282 | client->addr = info->addr; | 272 | client->addr = info->addr; |
283 | client->irq = info->irq; | 273 | client->irq = info->irq; |
284 | 274 | ||
285 | strlcpy(client->driver_name, info->driver_name, | ||
286 | sizeof(client->driver_name)); | ||
287 | strlcpy(client->name, info->type, sizeof(client->name)); | 275 | strlcpy(client->name, info->type, sizeof(client->name)); |
288 | 276 | ||
289 | /* a new style driver may be bound to this device when we | 277 | /* a new style driver may be bound to this device when we |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 34b0d4f26b58..655ec7ef568a 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -648,13 +648,12 @@ static int ide_register_port(ide_hwif_t *hwif) | |||
648 | 648 | ||
649 | get_device(&hwif->gendev); | 649 | get_device(&hwif->gendev); |
650 | 650 | ||
651 | hwif->portdev = device_create(ide_port_class, &hwif->gendev, | 651 | hwif->portdev = device_create_drvdata(ide_port_class, &hwif->gendev, |
652 | MKDEV(0, 0), hwif->name); | 652 | MKDEV(0, 0), hwif, hwif->name); |
653 | if (IS_ERR(hwif->portdev)) { | 653 | if (IS_ERR(hwif->portdev)) { |
654 | ret = PTR_ERR(hwif->portdev); | 654 | ret = PTR_ERR(hwif->portdev); |
655 | device_unregister(&hwif->gendev); | 655 | device_unregister(&hwif->gendev); |
656 | } | 656 | } |
657 | dev_set_drvdata(hwif->portdev, hwif); | ||
658 | out: | 657 | out: |
659 | return ret; | 658 | return ret; |
660 | } | 659 | } |
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c index 1f527bbf8d96..caa2632dd08e 100644 --- a/drivers/ide/legacy/macide.c +++ b/drivers/ide/legacy/macide.c | |||
@@ -95,6 +95,9 @@ static int __init macide_init(void) | |||
95 | int irq; | 95 | int irq; |
96 | hw_regs_t hw; | 96 | hw_regs_t hw; |
97 | 97 | ||
98 | if (!MACH_IS_MAC) | ||
99 | return -ENODEV; | ||
100 | |||
98 | switch (macintosh_config->ide_type) { | 101 | switch (macintosh_config->ide_type) { |
99 | case MAC_IDE_QUADRA: | 102 | case MAC_IDE_QUADRA: |
100 | base = IDE_BASE; | 103 | base = IDE_BASE; |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 16b9d0ad154e..a5ceff287a28 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -1539,15 +1539,13 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb, | |||
1539 | 1539 | ||
1540 | static void sbp2_create_command_orb(struct sbp2_lu *lu, | 1540 | static void sbp2_create_command_orb(struct sbp2_lu *lu, |
1541 | struct sbp2_command_info *cmd, | 1541 | struct sbp2_command_info *cmd, |
1542 | unchar *scsi_cmd, | 1542 | struct scsi_cmnd *SCpnt) |
1543 | unsigned int scsi_use_sg, | ||
1544 | unsigned int scsi_request_bufflen, | ||
1545 | struct scatterlist *sg, | ||
1546 | enum dma_data_direction dma_dir) | ||
1547 | { | 1543 | { |
1548 | struct sbp2_fwhost_info *hi = lu->hi; | 1544 | struct sbp2_fwhost_info *hi = lu->hi; |
1549 | struct sbp2_command_orb *orb = &cmd->command_orb; | 1545 | struct sbp2_command_orb *orb = &cmd->command_orb; |
1550 | u32 orb_direction; | 1546 | u32 orb_direction; |
1547 | unsigned int scsi_request_bufflen = scsi_bufflen(SCpnt); | ||
1548 | enum dma_data_direction dma_dir = SCpnt->sc_data_direction; | ||
1551 | 1549 | ||
1552 | /* | 1550 | /* |
1553 | * Set-up our command ORB. | 1551 | * Set-up our command ORB. |
@@ -1580,13 +1578,14 @@ static void sbp2_create_command_orb(struct sbp2_lu *lu, | |||
1580 | orb->data_descriptor_lo = 0x0; | 1578 | orb->data_descriptor_lo = 0x0; |
1581 | orb->misc |= ORB_SET_DIRECTION(1); | 1579 | orb->misc |= ORB_SET_DIRECTION(1); |
1582 | } else | 1580 | } else |
1583 | sbp2_prep_command_orb_sg(orb, hi, cmd, scsi_use_sg, sg, | 1581 | sbp2_prep_command_orb_sg(orb, hi, cmd, scsi_sg_count(SCpnt), |
1582 | scsi_sglist(SCpnt), | ||
1584 | orb_direction, dma_dir); | 1583 | orb_direction, dma_dir); |
1585 | 1584 | ||
1586 | sbp2util_cpu_to_be32_buffer(orb, sizeof(*orb)); | 1585 | sbp2util_cpu_to_be32_buffer(orb, sizeof(*orb)); |
1587 | 1586 | ||
1588 | memset(orb->cdb, 0, 12); | 1587 | memset(orb->cdb, 0, sizeof(orb->cdb)); |
1589 | memcpy(orb->cdb, scsi_cmd, COMMAND_SIZE(*scsi_cmd)); | 1588 | memcpy(orb->cdb, SCpnt->cmnd, SCpnt->cmd_len); |
1590 | } | 1589 | } |
1591 | 1590 | ||
1592 | static void sbp2_link_orb_command(struct sbp2_lu *lu, | 1591 | static void sbp2_link_orb_command(struct sbp2_lu *lu, |
@@ -1669,16 +1668,13 @@ static void sbp2_link_orb_command(struct sbp2_lu *lu, | |||
1669 | static int sbp2_send_command(struct sbp2_lu *lu, struct scsi_cmnd *SCpnt, | 1668 | static int sbp2_send_command(struct sbp2_lu *lu, struct scsi_cmnd *SCpnt, |
1670 | void (*done)(struct scsi_cmnd *)) | 1669 | void (*done)(struct scsi_cmnd *)) |
1671 | { | 1670 | { |
1672 | unchar *scsi_cmd = (unchar *)SCpnt->cmnd; | ||
1673 | struct sbp2_command_info *cmd; | 1671 | struct sbp2_command_info *cmd; |
1674 | 1672 | ||
1675 | cmd = sbp2util_allocate_command_orb(lu, SCpnt, done); | 1673 | cmd = sbp2util_allocate_command_orb(lu, SCpnt, done); |
1676 | if (!cmd) | 1674 | if (!cmd) |
1677 | return -EIO; | 1675 | return -EIO; |
1678 | 1676 | ||
1679 | sbp2_create_command_orb(lu, cmd, scsi_cmd, scsi_sg_count(SCpnt), | 1677 | sbp2_create_command_orb(lu, cmd, SCpnt); |
1680 | scsi_bufflen(SCpnt), scsi_sglist(SCpnt), | ||
1681 | SCpnt->sc_data_direction); | ||
1682 | sbp2_link_orb_command(lu, cmd); | 1678 | sbp2_link_orb_command(lu, cmd); |
1683 | 1679 | ||
1684 | return 0; | 1680 | return 0; |
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index fbe16d5250a4..1adf2efd3cb3 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c | |||
@@ -747,7 +747,9 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, | |||
747 | break; | 747 | break; |
748 | case IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED: | 748 | case IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED: |
749 | kmem_cache_free(ib_mad_cache, mad_priv); | 749 | kmem_cache_free(ib_mad_cache, mad_priv); |
750 | break; | 750 | kfree(local); |
751 | ret = 1; | ||
752 | goto out; | ||
751 | case IB_MAD_RESULT_SUCCESS: | 753 | case IB_MAD_RESULT_SUCCESS: |
752 | /* Treat like an incoming receive MAD */ | 754 | /* Treat like an incoming receive MAD */ |
753 | port_priv = ib_get_mad_port(mad_agent_priv->agent.device, | 755 | port_priv = ib_get_mad_port(mad_agent_priv->agent.device, |
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index 3aa2db54eae4..840ede9ae965 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c | |||
@@ -1005,8 +1005,9 @@ static int ib_umad_init_port(struct ib_device *device, int port_num, | |||
1005 | if (cdev_add(port->cdev, base_dev + port->dev_num, 1)) | 1005 | if (cdev_add(port->cdev, base_dev + port->dev_num, 1)) |
1006 | goto err_cdev; | 1006 | goto err_cdev; |
1007 | 1007 | ||
1008 | port->dev = device_create(umad_class, device->dma_device, | 1008 | port->dev = device_create_drvdata(umad_class, device->dma_device, |
1009 | port->cdev->dev, "umad%d", port->dev_num); | 1009 | port->cdev->dev, port, |
1010 | "umad%d", port->dev_num); | ||
1010 | if (IS_ERR(port->dev)) | 1011 | if (IS_ERR(port->dev)) |
1011 | goto err_cdev; | 1012 | goto err_cdev; |
1012 | 1013 | ||
@@ -1024,15 +1025,12 @@ static int ib_umad_init_port(struct ib_device *device, int port_num, | |||
1024 | if (cdev_add(port->sm_cdev, base_dev + port->dev_num + IB_UMAD_MAX_PORTS, 1)) | 1025 | if (cdev_add(port->sm_cdev, base_dev + port->dev_num + IB_UMAD_MAX_PORTS, 1)) |
1025 | goto err_sm_cdev; | 1026 | goto err_sm_cdev; |
1026 | 1027 | ||
1027 | port->sm_dev = device_create(umad_class, device->dma_device, | 1028 | port->sm_dev = device_create_drvdata(umad_class, device->dma_device, |
1028 | port->sm_cdev->dev, | 1029 | port->sm_cdev->dev, port, |
1029 | "issm%d", port->dev_num); | 1030 | "issm%d", port->dev_num); |
1030 | if (IS_ERR(port->sm_dev)) | 1031 | if (IS_ERR(port->sm_dev)) |
1031 | goto err_sm_cdev; | 1032 | goto err_sm_cdev; |
1032 | 1033 | ||
1033 | dev_set_drvdata(port->dev, port); | ||
1034 | dev_set_drvdata(port->sm_dev, port); | ||
1035 | |||
1036 | if (device_create_file(port->sm_dev, &dev_attr_ibdev)) | 1034 | if (device_create_file(port->sm_dev, &dev_attr_ibdev)) |
1037 | goto err_sm_dev; | 1035 | goto err_sm_dev; |
1038 | if (device_create_file(port->sm_dev, &dev_attr_port)) | 1036 | if (device_create_file(port->sm_dev, &dev_attr_port)) |
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index cc1afa28c181..f806da184b51 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
@@ -755,14 +755,15 @@ static void ib_uverbs_add_one(struct ib_device *device) | |||
755 | if (cdev_add(uverbs_dev->cdev, IB_UVERBS_BASE_DEV + uverbs_dev->devnum, 1)) | 755 | if (cdev_add(uverbs_dev->cdev, IB_UVERBS_BASE_DEV + uverbs_dev->devnum, 1)) |
756 | goto err_cdev; | 756 | goto err_cdev; |
757 | 757 | ||
758 | uverbs_dev->dev = device_create(uverbs_class, device->dma_device, | 758 | uverbs_dev->dev = device_create_drvdata(uverbs_class, |
759 | uverbs_dev->cdev->dev, | 759 | device->dma_device, |
760 | "uverbs%d", uverbs_dev->devnum); | 760 | uverbs_dev->cdev->dev, |
761 | uverbs_dev, | ||
762 | "uverbs%d", | ||
763 | uverbs_dev->devnum); | ||
761 | if (IS_ERR(uverbs_dev->dev)) | 764 | if (IS_ERR(uverbs_dev->dev)) |
762 | goto err_cdev; | 765 | goto err_cdev; |
763 | 766 | ||
764 | dev_set_drvdata(uverbs_dev->dev, uverbs_dev); | ||
765 | |||
766 | if (device_create_file(uverbs_dev->dev, &dev_attr_ibdev)) | 767 | if (device_create_file(uverbs_dev->dev, &dev_attr_ibdev)) |
767 | goto err_class; | 768 | goto err_class; |
768 | if (device_create_file(uverbs_dev->dev, &dev_attr_abi_version)) | 769 | if (device_create_file(uverbs_dev->dev, &dev_attr_abi_version)) |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_qp.c b/drivers/infiniband/hw/cxgb3/iwch_qp.c index 79dbe5beae52..992613799228 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_qp.c +++ b/drivers/infiniband/hw/cxgb3/iwch_qp.c | |||
@@ -229,7 +229,7 @@ int iwch_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
229 | struct ib_send_wr **bad_wr) | 229 | struct ib_send_wr **bad_wr) |
230 | { | 230 | { |
231 | int err = 0; | 231 | int err = 0; |
232 | u8 t3_wr_flit_cnt; | 232 | u8 uninitialized_var(t3_wr_flit_cnt); |
233 | enum t3_wr_opcode t3_wr_opcode = 0; | 233 | enum t3_wr_opcode t3_wr_opcode = 0; |
234 | enum t3_wr_flags t3_wr_flags; | 234 | enum t3_wr_flags t3_wr_flags; |
235 | struct iwch_qp *qhp; | 235 | struct iwch_qp *qhp; |
diff --git a/drivers/infiniband/hw/ipath/ipath_sdma.c b/drivers/infiniband/hw/ipath/ipath_sdma.c index 3697449c1ba4..0a8c1b8091a2 100644 --- a/drivers/infiniband/hw/ipath/ipath_sdma.c +++ b/drivers/infiniband/hw/ipath/ipath_sdma.c | |||
@@ -345,7 +345,7 @@ resched: | |||
345 | * state change | 345 | * state change |
346 | */ | 346 | */ |
347 | if (jiffies > dd->ipath_sdma_abort_jiffies) { | 347 | if (jiffies > dd->ipath_sdma_abort_jiffies) { |
348 | ipath_dbg("looping with status 0x%016llx\n", | 348 | ipath_dbg("looping with status 0x%08lx\n", |
349 | dd->ipath_sdma_status); | 349 | dd->ipath_sdma_status); |
350 | dd->ipath_sdma_abort_jiffies = jiffies + 5 * HZ; | 350 | dd->ipath_sdma_abort_jiffies = jiffies + 5 * HZ; |
351 | } | 351 | } |
@@ -615,7 +615,7 @@ void ipath_restart_sdma(struct ipath_devdata *dd) | |||
615 | } | 615 | } |
616 | spin_unlock_irqrestore(&dd->ipath_sdma_lock, flags); | 616 | spin_unlock_irqrestore(&dd->ipath_sdma_lock, flags); |
617 | if (!needed) { | 617 | if (!needed) { |
618 | ipath_dbg("invalid attempt to restart SDMA, status 0x%016llx\n", | 618 | ipath_dbg("invalid attempt to restart SDMA, status 0x%08lx\n", |
619 | dd->ipath_sdma_status); | 619 | dd->ipath_sdma_status); |
620 | goto bail; | 620 | goto bail; |
621 | } | 621 | } |
diff --git a/drivers/infiniband/hw/ipath/ipath_uc.c b/drivers/infiniband/hw/ipath/ipath_uc.c index 7fd18e833907..0596ec16fcbd 100644 --- a/drivers/infiniband/hw/ipath/ipath_uc.c +++ b/drivers/infiniband/hw/ipath/ipath_uc.c | |||
@@ -407,12 +407,11 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, | |||
407 | dev->n_pkt_drops++; | 407 | dev->n_pkt_drops++; |
408 | goto done; | 408 | goto done; |
409 | } | 409 | } |
410 | /* XXX Need to free SGEs */ | 410 | wc.opcode = IB_WC_RECV; |
411 | last_imm: | 411 | last_imm: |
412 | ipath_copy_sge(&qp->r_sge, data, tlen); | 412 | ipath_copy_sge(&qp->r_sge, data, tlen); |
413 | wc.wr_id = qp->r_wr_id; | 413 | wc.wr_id = qp->r_wr_id; |
414 | wc.status = IB_WC_SUCCESS; | 414 | wc.status = IB_WC_SUCCESS; |
415 | wc.opcode = IB_WC_RECV; | ||
416 | wc.qp = &qp->ibqp; | 415 | wc.qp = &qp->ibqp; |
417 | wc.src_qp = qp->remote_qpn; | 416 | wc.src_qp = qp->remote_qpn; |
418 | wc.slid = qp->remote_ah_attr.dlid; | 417 | wc.slid = qp->remote_ah_attr.dlid; |
@@ -514,6 +513,7 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, | |||
514 | goto done; | 513 | goto done; |
515 | } | 514 | } |
516 | wc.byte_len = qp->r_len; | 515 | wc.byte_len = qp->r_len; |
516 | wc.opcode = IB_WC_RECV_RDMA_WITH_IMM; | ||
517 | goto last_imm; | 517 | goto last_imm; |
518 | 518 | ||
519 | case OP(RDMA_WRITE_LAST): | 519 | case OP(RDMA_WRITE_LAST): |
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index 8e02ecfec188..a80df22deae8 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -333,6 +333,9 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, | |||
333 | cap->max_inline_data + sizeof (struct mlx4_wqe_inline_seg)) + | 333 | cap->max_inline_data + sizeof (struct mlx4_wqe_inline_seg)) + |
334 | send_wqe_overhead(type, qp->flags); | 334 | send_wqe_overhead(type, qp->flags); |
335 | 335 | ||
336 | if (s > dev->dev->caps.max_sq_desc_sz) | ||
337 | return -EINVAL; | ||
338 | |||
336 | /* | 339 | /* |
337 | * Hermon supports shrinking WQEs, such that a single work | 340 | * Hermon supports shrinking WQEs, such that a single work |
338 | * request can include multiple units of 1 << wqe_shift. This | 341 | * request can include multiple units of 1 << wqe_shift. This |
@@ -372,9 +375,6 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, | |||
372 | qp->sq.wqe_shift = ilog2(roundup_pow_of_two(s)); | 375 | qp->sq.wqe_shift = ilog2(roundup_pow_of_two(s)); |
373 | 376 | ||
374 | for (;;) { | 377 | for (;;) { |
375 | if (1 << qp->sq.wqe_shift > dev->dev->caps.max_sq_desc_sz) | ||
376 | return -EINVAL; | ||
377 | |||
378 | qp->sq_max_wqes_per_wr = DIV_ROUND_UP(s, 1U << qp->sq.wqe_shift); | 378 | qp->sq_max_wqes_per_wr = DIV_ROUND_UP(s, 1U << qp->sq.wqe_shift); |
379 | 379 | ||
380 | /* | 380 | /* |
@@ -395,7 +395,8 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, | |||
395 | ++qp->sq.wqe_shift; | 395 | ++qp->sq.wqe_shift; |
396 | } | 396 | } |
397 | 397 | ||
398 | qp->sq.max_gs = ((qp->sq_max_wqes_per_wr << qp->sq.wqe_shift) - | 398 | qp->sq.max_gs = (min(dev->dev->caps.max_sq_desc_sz, |
399 | (qp->sq_max_wqes_per_wr << qp->sq.wqe_shift)) - | ||
399 | send_wqe_overhead(type, qp->flags)) / | 400 | send_wqe_overhead(type, qp->flags)) / |
400 | sizeof (struct mlx4_wqe_data_seg); | 401 | sizeof (struct mlx4_wqe_data_seg); |
401 | 402 | ||
@@ -411,7 +412,9 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, | |||
411 | 412 | ||
412 | cap->max_send_wr = qp->sq.max_post = | 413 | cap->max_send_wr = qp->sq.max_post = |
413 | (qp->sq.wqe_cnt - qp->sq_spare_wqes) / qp->sq_max_wqes_per_wr; | 414 | (qp->sq.wqe_cnt - qp->sq_spare_wqes) / qp->sq_max_wqes_per_wr; |
414 | cap->max_send_sge = qp->sq.max_gs; | 415 | cap->max_send_sge = min(qp->sq.max_gs, |
416 | min(dev->dev->caps.max_sq_sg, | ||
417 | dev->dev->caps.max_rq_sg)); | ||
415 | /* We don't support inline sends for kernel QPs (yet) */ | 418 | /* We don't support inline sends for kernel QPs (yet) */ |
416 | cap->max_inline_data = 0; | 419 | cap->max_inline_data = 0; |
417 | 420 | ||
@@ -1457,7 +1460,7 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
1457 | unsigned ind; | 1460 | unsigned ind; |
1458 | int uninitialized_var(stamp); | 1461 | int uninitialized_var(stamp); |
1459 | int uninitialized_var(size); | 1462 | int uninitialized_var(size); |
1460 | unsigned seglen; | 1463 | unsigned uninitialized_var(seglen); |
1461 | int i; | 1464 | int i; |
1462 | 1465 | ||
1463 | spin_lock_irqsave(&qp->sq.lock, flags); | 1466 | spin_lock_irqsave(&qp->sq.lock, flags); |
diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c index 9ebadd6e0cfb..200cf13fc9bb 100644 --- a/drivers/infiniband/hw/mthca/mthca_main.c +++ b/drivers/infiniband/hw/mthca/mthca_main.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include "mthca_cmd.h" | 45 | #include "mthca_cmd.h" |
46 | #include "mthca_profile.h" | 46 | #include "mthca_profile.h" |
47 | #include "mthca_memfree.h" | 47 | #include "mthca_memfree.h" |
48 | #include "mthca_wqe.h" | ||
48 | 49 | ||
49 | MODULE_AUTHOR("Roland Dreier"); | 50 | MODULE_AUTHOR("Roland Dreier"); |
50 | MODULE_DESCRIPTION("Mellanox InfiniBand HCA low-level driver"); | 51 | MODULE_DESCRIPTION("Mellanox InfiniBand HCA low-level driver"); |
@@ -200,7 +201,18 @@ static int mthca_dev_lim(struct mthca_dev *mdev, struct mthca_dev_lim *dev_lim) | |||
200 | mdev->limits.gid_table_len = dev_lim->max_gids; | 201 | mdev->limits.gid_table_len = dev_lim->max_gids; |
201 | mdev->limits.pkey_table_len = dev_lim->max_pkeys; | 202 | mdev->limits.pkey_table_len = dev_lim->max_pkeys; |
202 | mdev->limits.local_ca_ack_delay = dev_lim->local_ca_ack_delay; | 203 | mdev->limits.local_ca_ack_delay = dev_lim->local_ca_ack_delay; |
203 | mdev->limits.max_sg = dev_lim->max_sg; | 204 | /* |
205 | * Need to allow for worst case send WQE overhead and check | ||
206 | * whether max_desc_sz imposes a lower limit than max_sg; UD | ||
207 | * send has the biggest overhead. | ||
208 | */ | ||
209 | mdev->limits.max_sg = min_t(int, dev_lim->max_sg, | ||
210 | (dev_lim->max_desc_sz - | ||
211 | sizeof (struct mthca_next_seg) - | ||
212 | (mthca_is_memfree(mdev) ? | ||
213 | sizeof (struct mthca_arbel_ud_seg) : | ||
214 | sizeof (struct mthca_tavor_ud_seg))) / | ||
215 | sizeof (struct mthca_data_seg)); | ||
204 | mdev->limits.max_wqes = dev_lim->max_qp_sz; | 216 | mdev->limits.max_wqes = dev_lim->max_qp_sz; |
205 | mdev->limits.max_qp_init_rdma = dev_lim->max_requester_per_qp; | 217 | mdev->limits.max_qp_init_rdma = dev_lim->max_requester_per_qp; |
206 | mdev->limits.reserved_qps = dev_lim->reserved_qps; | 218 | mdev->limits.reserved_qps = dev_lim->reserved_qps; |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index d00a2c174aee..3f663fb852c1 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -194,7 +194,13 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast, | |||
194 | /* Set the cached Q_Key before we attach if it's the broadcast group */ | 194 | /* Set the cached Q_Key before we attach if it's the broadcast group */ |
195 | if (!memcmp(mcast->mcmember.mgid.raw, priv->dev->broadcast + 4, | 195 | if (!memcmp(mcast->mcmember.mgid.raw, priv->dev->broadcast + 4, |
196 | sizeof (union ib_gid))) { | 196 | sizeof (union ib_gid))) { |
197 | spin_lock_irq(&priv->lock); | ||
198 | if (!priv->broadcast) { | ||
199 | spin_unlock_irq(&priv->lock); | ||
200 | return -EAGAIN; | ||
201 | } | ||
197 | priv->qkey = be32_to_cpu(priv->broadcast->mcmember.qkey); | 202 | priv->qkey = be32_to_cpu(priv->broadcast->mcmember.qkey); |
203 | spin_unlock_irq(&priv->lock); | ||
198 | priv->tx_wr.wr.ud.remote_qkey = priv->qkey; | 204 | priv->tx_wr.wr.ud.remote_qkey = priv->qkey; |
199 | } | 205 | } |
200 | 206 | ||
diff --git a/drivers/input/keyboard/aaed2000_kbd.c b/drivers/input/keyboard/aaed2000_kbd.c index a293e8b3f508..8a77bfcd05bc 100644 --- a/drivers/input/keyboard/aaed2000_kbd.c +++ b/drivers/input/keyboard/aaed2000_kbd.c | |||
@@ -183,4 +183,4 @@ module_exit(aaedkbd_exit); | |||
183 | 183 | ||
184 | MODULE_AUTHOR("Nicolas Bellido Y Ortega"); | 184 | MODULE_AUTHOR("Nicolas Bellido Y Ortega"); |
185 | MODULE_DESCRIPTION("AAED-2000 Keyboard Driver"); | 185 | MODULE_DESCRIPTION("AAED-2000 Keyboard Driver"); |
186 | MODULE_LICENSE("GPLv2"); | 186 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 4a95adc4cc78..af58a6f1e898 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -807,6 +807,8 @@ static int atkbd_activate(struct atkbd *atkbd) | |||
807 | static void atkbd_cleanup(struct serio *serio) | 807 | static void atkbd_cleanup(struct serio *serio) |
808 | { | 808 | { |
809 | struct atkbd *atkbd = serio_get_drvdata(serio); | 809 | struct atkbd *atkbd = serio_get_drvdata(serio); |
810 | |||
811 | atkbd_disable(atkbd); | ||
810 | ps2_command(&atkbd->ps2dev, NULL, ATKBD_CMD_RESET_BAT); | 812 | ps2_command(&atkbd->ps2dev, NULL, ATKBD_CMD_RESET_BAT); |
811 | } | 813 | } |
812 | 814 | ||
diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c index 29fbec6218b9..1aa46ae12630 100644 --- a/drivers/input/keyboard/corgikbd.c +++ b/drivers/input/keyboard/corgikbd.c | |||
@@ -412,5 +412,5 @@ module_exit(corgikbd_exit); | |||
412 | 412 | ||
413 | MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); | 413 | MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); |
414 | MODULE_DESCRIPTION("Corgi Keyboard Driver"); | 414 | MODULE_DESCRIPTION("Corgi Keyboard Driver"); |
415 | MODULE_LICENSE("GPLv2"); | 415 | MODULE_LICENSE("GPL v2"); |
416 | MODULE_ALIAS("platform:corgi-keyboard"); | 416 | MODULE_ALIAS("platform:corgi-keyboard"); |
diff --git a/drivers/input/keyboard/hilkbd.c b/drivers/input/keyboard/hilkbd.c index 50d80ecf0b80..aacf71f3cd44 100644 --- a/drivers/input/keyboard/hilkbd.c +++ b/drivers/input/keyboard/hilkbd.c | |||
@@ -217,6 +217,10 @@ hil_keyb_init(void) | |||
217 | return -ENOMEM; | 217 | return -ENOMEM; |
218 | 218 | ||
219 | #if defined(CONFIG_HP300) | 219 | #if defined(CONFIG_HP300) |
220 | if (!MACH_IS_HP300) { | ||
221 | err = -ENODEV; | ||
222 | goto err1; | ||
223 | } | ||
220 | if (!hwreg_present((void *)(HILBASE + HIL_DATA))) { | 224 | if (!hwreg_present((void *)(HILBASE + HIL_DATA))) { |
221 | printk(KERN_ERR "HIL: hardware register was not found\n"); | 225 | printk(KERN_ERR "HIL: hardware register was not found\n"); |
222 | err = -ENODEV; | 226 | err = -ENODEV; |
diff --git a/drivers/input/keyboard/jornada680_kbd.c b/drivers/input/keyboard/jornada680_kbd.c index 9387da343f97..781fc6102860 100644 --- a/drivers/input/keyboard/jornada680_kbd.c +++ b/drivers/input/keyboard/jornada680_kbd.c | |||
@@ -275,5 +275,5 @@ module_exit(jornada680kbd_exit); | |||
275 | 275 | ||
276 | MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>"); | 276 | MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>"); |
277 | MODULE_DESCRIPTION("HP Jornada 620/660/680/690 Keyboard Driver"); | 277 | MODULE_DESCRIPTION("HP Jornada 620/660/680/690 Keyboard Driver"); |
278 | MODULE_LICENSE("GPLv2"); | 278 | MODULE_LICENSE("GPL v2"); |
279 | MODULE_ALIAS("platform:jornada680_kbd"); | 279 | MODULE_ALIAS("platform:jornada680_kbd"); |
diff --git a/drivers/input/keyboard/jornada720_kbd.c b/drivers/input/keyboard/jornada720_kbd.c index a1164a0c7736..ce650af6d649 100644 --- a/drivers/input/keyboard/jornada720_kbd.c +++ b/drivers/input/keyboard/jornada720_kbd.c | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | MODULE_AUTHOR("Kristoffer Ericson <Kristoffer.Ericson@gmail.com>"); | 30 | MODULE_AUTHOR("Kristoffer Ericson <Kristoffer.Ericson@gmail.com>"); |
31 | MODULE_DESCRIPTION("HP Jornada 710/720/728 keyboard driver"); | 31 | MODULE_DESCRIPTION("HP Jornada 710/720/728 keyboard driver"); |
32 | MODULE_LICENSE("GPLv2"); | 32 | MODULE_LICENSE("GPL v2"); |
33 | 33 | ||
34 | static unsigned short jornada_std_keymap[128] = { /* ROW */ | 34 | static unsigned short jornada_std_keymap[128] = { /* ROW */ |
35 | 0, KEY_ESC, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, /* #1 */ | 35 | 0, KEY_ESC, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, /* #1 */ |
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index 3dea0c5077a9..45767e73f071 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c | |||
@@ -136,6 +136,9 @@ static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad) | |||
136 | set_bit(code, input_dev->keybit); | 136 | set_bit(code, input_dev->keybit); |
137 | } | 137 | } |
138 | 138 | ||
139 | for (i = 0; i < pdata->direct_key_num; i++) | ||
140 | set_bit(pdata->direct_key_map[i], input_dev->keybit); | ||
141 | |||
139 | keypad->rotary_up_key[0] = pdata->rotary0_up_key; | 142 | keypad->rotary_up_key[0] = pdata->rotary0_up_key; |
140 | keypad->rotary_up_key[1] = pdata->rotary1_up_key; | 143 | keypad->rotary_up_key[1] = pdata->rotary1_up_key; |
141 | keypad->rotary_down_key[0] = pdata->rotary0_down_key; | 144 | keypad->rotary_down_key[0] = pdata->rotary0_down_key; |
@@ -143,17 +146,21 @@ static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad) | |||
143 | keypad->rotary_rel_code[0] = pdata->rotary0_rel_code; | 146 | keypad->rotary_rel_code[0] = pdata->rotary0_rel_code; |
144 | keypad->rotary_rel_code[1] = pdata->rotary1_rel_code; | 147 | keypad->rotary_rel_code[1] = pdata->rotary1_rel_code; |
145 | 148 | ||
146 | if (pdata->rotary0_up_key && pdata->rotary0_down_key) { | 149 | if (pdata->enable_rotary0) { |
147 | set_bit(pdata->rotary0_up_key, input_dev->keybit); | 150 | if (pdata->rotary0_up_key && pdata->rotary0_down_key) { |
148 | set_bit(pdata->rotary0_down_key, input_dev->keybit); | 151 | set_bit(pdata->rotary0_up_key, input_dev->keybit); |
149 | } else | 152 | set_bit(pdata->rotary0_down_key, input_dev->keybit); |
150 | set_bit(pdata->rotary0_rel_code, input_dev->relbit); | 153 | } else |
151 | 154 | set_bit(pdata->rotary0_rel_code, input_dev->relbit); | |
152 | if (pdata->rotary1_up_key && pdata->rotary1_down_key) { | 155 | } |
153 | set_bit(pdata->rotary1_up_key, input_dev->keybit); | 156 | |
154 | set_bit(pdata->rotary1_down_key, input_dev->keybit); | 157 | if (pdata->enable_rotary1) { |
155 | } else | 158 | if (pdata->rotary1_up_key && pdata->rotary1_down_key) { |
156 | set_bit(pdata->rotary1_rel_code, input_dev->relbit); | 159 | set_bit(pdata->rotary1_up_key, input_dev->keybit); |
160 | set_bit(pdata->rotary1_down_key, input_dev->keybit); | ||
161 | } else | ||
162 | set_bit(pdata->rotary1_rel_code, input_dev->relbit); | ||
163 | } | ||
157 | } | 164 | } |
158 | 165 | ||
159 | static inline unsigned int lookup_matrix_keycode( | 166 | static inline unsigned int lookup_matrix_keycode( |
@@ -484,8 +491,13 @@ static int __devinit pxa27x_keypad_probe(struct platform_device *pdev) | |||
484 | keypad->input_dev = input_dev; | 491 | keypad->input_dev = input_dev; |
485 | input_set_drvdata(input_dev, keypad); | 492 | input_set_drvdata(input_dev, keypad); |
486 | 493 | ||
487 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) | | 494 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); |
488 | BIT_MASK(EV_REL); | 495 | if ((keypad->pdata->enable_rotary0 && |
496 | keypad->pdata->rotary0_rel_code) || | ||
497 | (keypad->pdata->enable_rotary1 && | ||
498 | keypad->pdata->rotary1_rel_code)) { | ||
499 | input_dev->evbit[0] |= BIT_MASK(EV_REL); | ||
500 | } | ||
489 | 501 | ||
490 | pxa27x_keypad_build_keycode(keypad); | 502 | pxa27x_keypad_build_keycode(keypad); |
491 | platform_set_drvdata(pdev, keypad); | 503 | platform_set_drvdata(pdev, keypad); |
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c index 61e401bc9109..1aa37181c40f 100644 --- a/drivers/input/keyboard/spitzkbd.c +++ b/drivers/input/keyboard/spitzkbd.c | |||
@@ -494,5 +494,5 @@ module_exit(spitzkbd_exit); | |||
494 | 494 | ||
495 | MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); | 495 | MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); |
496 | MODULE_DESCRIPTION("Spitz Keyboard Driver"); | 496 | MODULE_DESCRIPTION("Spitz Keyboard Driver"); |
497 | MODULE_LICENSE("GPLv2"); | 497 | MODULE_LICENSE("GPL v2"); |
498 | MODULE_ALIAS("platform:spitz-keyboard"); | 498 | MODULE_ALIAS("platform:spitz-keyboard"); |
diff --git a/drivers/input/misc/apanel.c b/drivers/input/misc/apanel.c index 9531d8c7444f..d82f7f727f7a 100644 --- a/drivers/input/misc/apanel.c +++ b/drivers/input/misc/apanel.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/ioport.h> | 21 | #include <linux/ioport.h> |
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/module.h> | ||
24 | #include <linux/input-polldev.h> | 23 | #include <linux/input-polldev.h> |
25 | #include <linux/i2c.h> | 24 | #include <linux/i2c.h> |
26 | #include <linux/workqueue.h> | 25 | #include <linux/workqueue.h> |
diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c index ab76ea442fa5..45e5d05b01de 100644 --- a/drivers/input/misc/hp_sdc_rtc.c +++ b/drivers/input/misc/hp_sdc_rtc.c | |||
@@ -691,6 +691,11 @@ static int __init hp_sdc_rtc_init(void) | |||
691 | { | 691 | { |
692 | int ret; | 692 | int ret; |
693 | 693 | ||
694 | #ifdef __mc68000__ | ||
695 | if (!MACH_IS_HP300) | ||
696 | return -ENODEV; | ||
697 | #endif | ||
698 | |||
694 | init_MUTEX(&i8042tregs); | 699 | init_MUTEX(&i8042tregs); |
695 | 700 | ||
696 | if ((ret = hp_sdc_request_timer_irq(&hp_sdc_rtc_isr))) | 701 | if ((ret = hp_sdc_request_timer_irq(&hp_sdc_rtc_isr))) |
diff --git a/drivers/input/serio/hp_sdc_mlc.c b/drivers/input/serio/hp_sdc_mlc.c index f1fd3b638a37..587398f5c9df 100644 --- a/drivers/input/serio/hp_sdc_mlc.c +++ b/drivers/input/serio/hp_sdc_mlc.c | |||
@@ -306,6 +306,11 @@ static int __init hp_sdc_mlc_init(void) | |||
306 | { | 306 | { |
307 | hil_mlc *mlc = &hp_sdc_mlc; | 307 | hil_mlc *mlc = &hp_sdc_mlc; |
308 | 308 | ||
309 | #ifdef __mc68000__ | ||
310 | if (!MACH_IS_HP300) | ||
311 | return -ENODEV; | ||
312 | #endif | ||
313 | |||
309 | printk(KERN_INFO PREFIX "Registering the System Domain Controller's HIL MLC.\n"); | 314 | printk(KERN_INFO PREFIX "Registering the System Domain Controller's HIL MLC.\n"); |
310 | 315 | ||
311 | hp_sdc_mlc_priv.emtestmode = 0; | 316 | hp_sdc_mlc_priv.emtestmode = 0; |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index 5ece9f56babc..9aafa96cb746 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -331,6 +331,13 @@ static struct dmi_system_id __initdata i8042_dmi_dritek_table[] = { | |||
331 | }, | 331 | }, |
332 | }, | 332 | }, |
333 | { | 333 | { |
334 | .ident = "Acer TravelMate 660", | ||
335 | .matches = { | ||
336 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
337 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"), | ||
338 | }, | ||
339 | }, | ||
340 | { | ||
334 | .ident = "Acer TravelMate 2490", | 341 | .ident = "Acer TravelMate 2490", |
335 | .matches = { | 342 | .matches = { |
336 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | 343 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 65a74cfc187b..592ff55b62d0 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -885,6 +885,20 @@ static long i8042_panic_blink(long count) | |||
885 | 885 | ||
886 | #undef DELAY | 886 | #undef DELAY |
887 | 887 | ||
888 | #ifdef CONFIG_X86 | ||
889 | static void i8042_dritek_enable(void) | ||
890 | { | ||
891 | char param = 0x90; | ||
892 | int error; | ||
893 | |||
894 | error = i8042_command(¶m, 0x1059); | ||
895 | if (error) | ||
896 | printk(KERN_WARNING | ||
897 | "Failed to enable DRITEK extension: %d\n", | ||
898 | error); | ||
899 | } | ||
900 | #endif | ||
901 | |||
888 | #ifdef CONFIG_PM | 902 | #ifdef CONFIG_PM |
889 | /* | 903 | /* |
890 | * Here we try to restore the original BIOS settings. We only want to | 904 | * Here we try to restore the original BIOS settings. We only want to |
@@ -942,6 +956,12 @@ static int i8042_resume(struct platform_device *dev) | |||
942 | return -EIO; | 956 | return -EIO; |
943 | } | 957 | } |
944 | 958 | ||
959 | |||
960 | #ifdef CONFIG_X86 | ||
961 | if (i8042_dritek) | ||
962 | i8042_dritek_enable(); | ||
963 | #endif | ||
964 | |||
945 | if (i8042_mux_present) { | 965 | if (i8042_mux_present) { |
946 | if (i8042_set_mux_mode(1, NULL) || i8042_enable_mux_ports()) | 966 | if (i8042_set_mux_mode(1, NULL) || i8042_enable_mux_ports()) |
947 | printk(KERN_WARNING | 967 | printk(KERN_WARNING |
@@ -1160,6 +1180,11 @@ static int __devinit i8042_probe(struct platform_device *dev) | |||
1160 | if (error) | 1180 | if (error) |
1161 | return error; | 1181 | return error; |
1162 | 1182 | ||
1183 | #ifdef CONFIG_X86 | ||
1184 | if (i8042_dritek) | ||
1185 | i8042_dritek_enable(); | ||
1186 | #endif | ||
1187 | |||
1163 | if (!i8042_noaux) { | 1188 | if (!i8042_noaux) { |
1164 | error = i8042_setup_aux(); | 1189 | error = i8042_setup_aux(); |
1165 | if (error && error != -ENODEV && error != -EBUSY) | 1190 | if (error && error != -ENODEV && error != -EBUSY) |
@@ -1171,14 +1196,6 @@ static int __devinit i8042_probe(struct platform_device *dev) | |||
1171 | if (error) | 1196 | if (error) |
1172 | goto out_fail; | 1197 | goto out_fail; |
1173 | } | 1198 | } |
1174 | #ifdef CONFIG_X86 | ||
1175 | if (i8042_dritek) { | ||
1176 | char param = 0x90; | ||
1177 | error = i8042_command(¶m, 0x1059); | ||
1178 | if (error) | ||
1179 | goto out_fail; | ||
1180 | } | ||
1181 | #endif | ||
1182 | /* | 1199 | /* |
1183 | * Ok, everything is ready, let's register all serio ports | 1200 | * Ok, everything is ready, let's register all serio ports |
1184 | */ | 1201 | */ |
diff --git a/drivers/input/serio/q40kbd.c b/drivers/input/serio/q40kbd.c index cb89aff2e160..d962a8d78b14 100644 --- a/drivers/input/serio/q40kbd.c +++ b/drivers/input/serio/q40kbd.c | |||
@@ -156,7 +156,7 @@ static int __init q40kbd_init(void) | |||
156 | int error; | 156 | int error; |
157 | 157 | ||
158 | if (!MACH_IS_Q40) | 158 | if (!MACH_IS_Q40) |
159 | return -EIO; | 159 | return -ENODEV; |
160 | 160 | ||
161 | error = platform_driver_register(&q40kbd_driver); | 161 | error = platform_driver_register(&q40kbd_driver); |
162 | if (error) | 162 | if (error) |
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c index c5a8661a1baa..1e748e46d12e 100644 --- a/drivers/input/tablet/gtco.c +++ b/drivers/input/tablet/gtco.c | |||
@@ -830,7 +830,7 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
830 | struct gtco *gtco; | 830 | struct gtco *gtco; |
831 | struct input_dev *input_dev; | 831 | struct input_dev *input_dev; |
832 | struct hid_descriptor *hid_desc; | 832 | struct hid_descriptor *hid_desc; |
833 | char *report = NULL; | 833 | char *report; |
834 | int result = 0, retry; | 834 | int result = 0, retry; |
835 | int error; | 835 | int error; |
836 | struct usb_endpoint_descriptor *endpoint; | 836 | struct usb_endpoint_descriptor *endpoint; |
@@ -916,12 +916,16 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
916 | le16_to_cpu(hid_desc->wDescriptorLength), | 916 | le16_to_cpu(hid_desc->wDescriptorLength), |
917 | 5000); /* 5 secs */ | 917 | 5000); /* 5 secs */ |
918 | 918 | ||
919 | if (result == le16_to_cpu(hid_desc->wDescriptorLength)) | 919 | dbg("usb_control_msg result: %d", result); |
920 | if (result == le16_to_cpu(hid_desc->wDescriptorLength)) { | ||
921 | parse_hid_report_descriptor(gtco, report, result); | ||
920 | break; | 922 | break; |
923 | } | ||
921 | } | 924 | } |
922 | 925 | ||
926 | kfree(report); | ||
927 | |||
923 | /* If we didn't get the report, fail */ | 928 | /* If we didn't get the report, fail */ |
924 | dbg("usb_control_msg result: :%d", result); | ||
925 | if (result != le16_to_cpu(hid_desc->wDescriptorLength)) { | 929 | if (result != le16_to_cpu(hid_desc->wDescriptorLength)) { |
926 | err("Failed to get HID Report Descriptor of size: %d", | 930 | err("Failed to get HID Report Descriptor of size: %d", |
927 | hid_desc->wDescriptorLength); | 931 | hid_desc->wDescriptorLength); |
@@ -929,12 +933,6 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
929 | goto err_free_urb; | 933 | goto err_free_urb; |
930 | } | 934 | } |
931 | 935 | ||
932 | /* Now we parse the report */ | ||
933 | parse_hid_report_descriptor(gtco, report, result); | ||
934 | |||
935 | /* Now we delete it */ | ||
936 | kfree(report); | ||
937 | |||
938 | /* Create a device file node */ | 936 | /* Create a device file node */ |
939 | usb_make_path(gtco->usbdev, gtco->usbpath, sizeof(gtco->usbpath)); | 937 | usb_make_path(gtco->usbdev, gtco->usbpath, sizeof(gtco->usbpath)); |
940 | strlcat(gtco->usbpath, "/input0", sizeof(gtco->usbpath)); | 938 | strlcat(gtco->usbpath, "/input0", sizeof(gtco->usbpath)); |
@@ -988,7 +986,6 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
988 | usb_buffer_free(gtco->usbdev, REPORT_MAX_SIZE, | 986 | usb_buffer_free(gtco->usbdev, REPORT_MAX_SIZE, |
989 | gtco->buffer, gtco->buf_dma); | 987 | gtco->buffer, gtco->buf_dma); |
990 | err_free_devs: | 988 | err_free_devs: |
991 | kfree(report); | ||
992 | input_free_device(input_dev); | 989 | input_free_device(input_dev); |
993 | kfree(gtco); | 990 | kfree(gtco); |
994 | return error; | 991 | return error; |
diff --git a/drivers/input/touchscreen/jornada720_ts.c b/drivers/input/touchscreen/jornada720_ts.c index 742242111bf1..1aca108b1031 100644 --- a/drivers/input/touchscreen/jornada720_ts.c +++ b/drivers/input/touchscreen/jornada720_ts.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>"); | 25 | MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>"); |
26 | MODULE_DESCRIPTION("HP Jornada 710/720/728 touchscreen driver"); | 26 | MODULE_DESCRIPTION("HP Jornada 710/720/728 touchscreen driver"); |
27 | MODULE_LICENSE("GPLv2"); | 27 | MODULE_LICENSE("GPL v2"); |
28 | 28 | ||
29 | struct jornada_ts { | 29 | struct jornada_ts { |
30 | struct input_dev *dev; | 30 | struct input_dev *dev; |
diff --git a/drivers/input/touchscreen/wm9713.c b/drivers/input/touchscreen/wm9713.c index 01278bd7e65c..838458792ea0 100644 --- a/drivers/input/touchscreen/wm9713.c +++ b/drivers/input/touchscreen/wm9713.c | |||
@@ -85,6 +85,15 @@ module_param(delay, int, 0); | |||
85 | MODULE_PARM_DESC(delay, "Set adc sample delay."); | 85 | MODULE_PARM_DESC(delay, "Set adc sample delay."); |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * Set five_wire = 1 to use a 5 wire touchscreen. | ||
89 | * | ||
90 | * NOTE: Five wire mode does not allow for readback of pressure. | ||
91 | */ | ||
92 | static int five_wire; | ||
93 | module_param(five_wire, int, 0); | ||
94 | MODULE_PARM_DESC(five_wire, "Set to '1' to use 5-wire touchscreen."); | ||
95 | |||
96 | /* | ||
88 | * Set adc mask function. | 97 | * Set adc mask function. |
89 | * | 98 | * |
90 | * Sources of glitch noise, such as signals driving an LCD display, may feed | 99 | * Sources of glitch noise, such as signals driving an LCD display, may feed |
@@ -162,6 +171,19 @@ static void wm9713_phy_init(struct wm97xx *wm) | |||
162 | 64000 / rpu); | 171 | 64000 / rpu); |
163 | } | 172 | } |
164 | 173 | ||
174 | /* Five wire panel? */ | ||
175 | if (five_wire) { | ||
176 | dig3 |= WM9713_45W; | ||
177 | dev_info(wm->dev, "setting 5-wire touchscreen mode."); | ||
178 | |||
179 | if (pil) { | ||
180 | dev_warn(wm->dev, | ||
181 | "Pressure measurement not supported in 5 " | ||
182 | "wire mode, disabling\n"); | ||
183 | pil = 0; | ||
184 | } | ||
185 | } | ||
186 | |||
165 | /* touchpanel pressure */ | 187 | /* touchpanel pressure */ |
166 | if (pil == 2) { | 188 | if (pil == 2) { |
167 | dig3 |= WM9712_PIL; | 189 | dig3 |= WM9712_PIL; |
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c index e9c7ea46b6e3..cdc24ad314e0 100644 --- a/drivers/input/touchscreen/wm97xx-core.c +++ b/drivers/input/touchscreen/wm97xx-core.c | |||
@@ -608,6 +608,17 @@ static int wm97xx_probe(struct device *dev) | |||
608 | goto alloc_err; | 608 | goto alloc_err; |
609 | } | 609 | } |
610 | 610 | ||
611 | /* set up physical characteristics */ | ||
612 | wm->codec->phy_init(wm); | ||
613 | |||
614 | /* load gpio cache */ | ||
615 | wm->gpio[0] = wm97xx_reg_read(wm, AC97_GPIO_CFG); | ||
616 | wm->gpio[1] = wm97xx_reg_read(wm, AC97_GPIO_POLARITY); | ||
617 | wm->gpio[2] = wm97xx_reg_read(wm, AC97_GPIO_STICKY); | ||
618 | wm->gpio[3] = wm97xx_reg_read(wm, AC97_GPIO_WAKEUP); | ||
619 | wm->gpio[4] = wm97xx_reg_read(wm, AC97_GPIO_STATUS); | ||
620 | wm->gpio[5] = wm97xx_reg_read(wm, AC97_MISC_AFE); | ||
621 | |||
611 | wm->input_dev = input_allocate_device(); | 622 | wm->input_dev = input_allocate_device(); |
612 | if (wm->input_dev == NULL) { | 623 | if (wm->input_dev == NULL) { |
613 | ret = -ENOMEM; | 624 | ret = -ENOMEM; |
@@ -616,6 +627,7 @@ static int wm97xx_probe(struct device *dev) | |||
616 | 627 | ||
617 | /* set up touch configuration */ | 628 | /* set up touch configuration */ |
618 | wm->input_dev->name = "wm97xx touchscreen"; | 629 | wm->input_dev->name = "wm97xx touchscreen"; |
630 | wm->input_dev->phys = "wm97xx"; | ||
619 | wm->input_dev->open = wm97xx_ts_input_open; | 631 | wm->input_dev->open = wm97xx_ts_input_open; |
620 | wm->input_dev->close = wm97xx_ts_input_close; | 632 | wm->input_dev->close = wm97xx_ts_input_close; |
621 | set_bit(EV_ABS, wm->input_dev->evbit); | 633 | set_bit(EV_ABS, wm->input_dev->evbit); |
@@ -634,17 +646,6 @@ static int wm97xx_probe(struct device *dev) | |||
634 | if (ret < 0) | 646 | if (ret < 0) |
635 | goto dev_alloc_err; | 647 | goto dev_alloc_err; |
636 | 648 | ||
637 | /* set up physical characteristics */ | ||
638 | wm->codec->phy_init(wm); | ||
639 | |||
640 | /* load gpio cache */ | ||
641 | wm->gpio[0] = wm97xx_reg_read(wm, AC97_GPIO_CFG); | ||
642 | wm->gpio[1] = wm97xx_reg_read(wm, AC97_GPIO_POLARITY); | ||
643 | wm->gpio[2] = wm97xx_reg_read(wm, AC97_GPIO_STICKY); | ||
644 | wm->gpio[3] = wm97xx_reg_read(wm, AC97_GPIO_WAKEUP); | ||
645 | wm->gpio[4] = wm97xx_reg_read(wm, AC97_GPIO_STATUS); | ||
646 | wm->gpio[5] = wm97xx_reg_read(wm, AC97_MISC_AFE); | ||
647 | |||
648 | /* register our battery device */ | 649 | /* register our battery device */ |
649 | wm->battery_dev = platform_device_alloc("wm97xx-battery", -1); | 650 | wm->battery_dev = platform_device_alloc("wm97xx-battery", -1); |
650 | if (!wm->battery_dev) { | 651 | if (!wm->battery_dev) { |
@@ -801,7 +802,7 @@ void wm97xx_unregister_mach_ops(struct wm97xx *wm) | |||
801 | EXPORT_SYMBOL_GPL(wm97xx_unregister_mach_ops); | 802 | EXPORT_SYMBOL_GPL(wm97xx_unregister_mach_ops); |
802 | 803 | ||
803 | static struct device_driver wm97xx_driver = { | 804 | static struct device_driver wm97xx_driver = { |
804 | .name = "ac97", | 805 | .name = "wm97xx-ts", |
805 | .bus = &ac97_bus_type, | 806 | .bus = &ac97_bus_type, |
806 | .owner = THIS_MODULE, | 807 | .owner = THIS_MODULE, |
807 | .probe = wm97xx_probe, | 808 | .probe = wm97xx_probe, |
diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c index d3999a8e9f88..53f6ad1235db 100644 --- a/drivers/isdn/hysdn/hycapi.c +++ b/drivers/isdn/hysdn/hycapi.c | |||
@@ -462,11 +462,11 @@ static int hycapi_read_proc(char *page, char **start, off_t off, | |||
462 | default: s = "???"; break; | 462 | default: s = "???"; break; |
463 | } | 463 | } |
464 | len += sprintf(page+len, "%-16s %s\n", "type", s); | 464 | len += sprintf(page+len, "%-16s %s\n", "type", s); |
465 | if ((s = cinfo->version[VER_DRIVER]) != 0) | 465 | if ((s = cinfo->version[VER_DRIVER]) != NULL) |
466 | len += sprintf(page+len, "%-16s %s\n", "ver_driver", s); | 466 | len += sprintf(page+len, "%-16s %s\n", "ver_driver", s); |
467 | if ((s = cinfo->version[VER_CARDTYPE]) != 0) | 467 | if ((s = cinfo->version[VER_CARDTYPE]) != NULL) |
468 | len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s); | 468 | len += sprintf(page+len, "%-16s %s\n", "ver_cardtype", s); |
469 | if ((s = cinfo->version[VER_SERIAL]) != 0) | 469 | if ((s = cinfo->version[VER_SERIAL]) != NULL) |
470 | len += sprintf(page+len, "%-16s %s\n", "ver_serial", s); | 470 | len += sprintf(page+len, "%-16s %s\n", "ver_serial", s); |
471 | 471 | ||
472 | len += sprintf(page+len, "%-16s %s\n", "cardname", cinfo->cardname); | 472 | len += sprintf(page+len, "%-16s %s\n", "cardname", cinfo->cardname); |
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index b3c54be74556..559a40861c39 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c | |||
@@ -103,13 +103,11 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) | |||
103 | { | 103 | { |
104 | int rc; | 104 | int rc; |
105 | 105 | ||
106 | led_cdev->dev = device_create(leds_class, parent, 0, "%s", | 106 | led_cdev->dev = device_create_drvdata(leds_class, parent, 0, led_cdev, |
107 | led_cdev->name); | 107 | "%s", led_cdev->name); |
108 | if (IS_ERR(led_cdev->dev)) | 108 | if (IS_ERR(led_cdev->dev)) |
109 | return PTR_ERR(led_cdev->dev); | 109 | return PTR_ERR(led_cdev->dev); |
110 | 110 | ||
111 | dev_set_drvdata(led_cdev->dev, led_cdev); | ||
112 | |||
113 | /* register the attributes */ | 111 | /* register the attributes */ |
114 | rc = device_create_file(led_cdev->dev, &dev_attr_brightness); | 112 | rc = device_create_file(led_cdev->dev, &dev_attr_brightness); |
115 | if (rc) | 113 | if (rc) |
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c index 8080249957af..1a8de57289eb 100644 --- a/drivers/lguest/lguest_device.c +++ b/drivers/lguest/lguest_device.c | |||
@@ -20,14 +20,11 @@ | |||
20 | /* The pointer to our (page) of device descriptions. */ | 20 | /* The pointer to our (page) of device descriptions. */ |
21 | static void *lguest_devices; | 21 | static void *lguest_devices; |
22 | 22 | ||
23 | /* Unique numbering for lguest devices. */ | ||
24 | static unsigned int dev_index; | ||
25 | |||
26 | /* For Guests, device memory can be used as normal memory, so we cast away the | 23 | /* For Guests, device memory can be used as normal memory, so we cast away the |
27 | * __iomem to quieten sparse. */ | 24 | * __iomem to quieten sparse. */ |
28 | static inline void *lguest_map(unsigned long phys_addr, unsigned long pages) | 25 | static inline void *lguest_map(unsigned long phys_addr, unsigned long pages) |
29 | { | 26 | { |
30 | return (__force void *)ioremap(phys_addr, PAGE_SIZE*pages); | 27 | return (__force void *)ioremap_cache(phys_addr, PAGE_SIZE*pages); |
31 | } | 28 | } |
32 | 29 | ||
33 | static inline void lguest_unmap(void *addr) | 30 | static inline void lguest_unmap(void *addr) |
@@ -325,8 +322,10 @@ static struct device lguest_root = { | |||
325 | * As Andrew Tridgell says, "Untested code is buggy code". | 322 | * As Andrew Tridgell says, "Untested code is buggy code". |
326 | * | 323 | * |
327 | * It's worth reading this carefully: we start with a pointer to the new device | 324 | * It's worth reading this carefully: we start with a pointer to the new device |
328 | * descriptor in the "lguest_devices" page. */ | 325 | * descriptor in the "lguest_devices" page, and the offset into the device |
329 | static void add_lguest_device(struct lguest_device_desc *d) | 326 | * descriptor page so we can uniquely identify it if things go badly wrong. */ |
327 | static void add_lguest_device(struct lguest_device_desc *d, | ||
328 | unsigned int offset) | ||
330 | { | 329 | { |
331 | struct lguest_device *ldev; | 330 | struct lguest_device *ldev; |
332 | 331 | ||
@@ -334,18 +333,14 @@ static void add_lguest_device(struct lguest_device_desc *d) | |||
334 | * it. */ | 333 | * it. */ |
335 | ldev = kzalloc(sizeof(*ldev), GFP_KERNEL); | 334 | ldev = kzalloc(sizeof(*ldev), GFP_KERNEL); |
336 | if (!ldev) { | 335 | if (!ldev) { |
337 | printk(KERN_EMERG "Cannot allocate lguest dev %u\n", | 336 | printk(KERN_EMERG "Cannot allocate lguest dev %u type %u\n", |
338 | dev_index++); | 337 | offset, d->type); |
339 | return; | 338 | return; |
340 | } | 339 | } |
341 | 340 | ||
342 | /* This devices' parent is the lguest/ dir. */ | 341 | /* This devices' parent is the lguest/ dir. */ |
343 | ldev->vdev.dev.parent = &lguest_root; | 342 | ldev->vdev.dev.parent = &lguest_root; |
344 | /* We have a unique device index thanks to the dev_index counter. */ | 343 | /* We have a unique device index thanks to the dev_index counter. */ |
345 | ldev->vdev.index = dev_index++; | ||
346 | /* The device type comes straight from the descriptor. There's also a | ||
347 | * device vendor field in the virtio_device struct, which we leave as | ||
348 | * 0. */ | ||
349 | ldev->vdev.id.device = d->type; | 344 | ldev->vdev.id.device = d->type; |
350 | /* We have a simple set of routines for querying the device's | 345 | /* We have a simple set of routines for querying the device's |
351 | * configuration information and setting its status. */ | 346 | * configuration information and setting its status. */ |
@@ -357,8 +352,8 @@ static void add_lguest_device(struct lguest_device_desc *d) | |||
357 | * virtio_device and calls device_register(). This makes the bus | 352 | * virtio_device and calls device_register(). This makes the bus |
358 | * infrastructure look for a matching driver. */ | 353 | * infrastructure look for a matching driver. */ |
359 | if (register_virtio_device(&ldev->vdev) != 0) { | 354 | if (register_virtio_device(&ldev->vdev) != 0) { |
360 | printk(KERN_ERR "Failed to register lguest device %u\n", | 355 | printk(KERN_ERR "Failed to register lguest dev %u type %u\n", |
361 | ldev->vdev.index); | 356 | offset, d->type); |
362 | kfree(ldev); | 357 | kfree(ldev); |
363 | } | 358 | } |
364 | } | 359 | } |
@@ -379,7 +374,7 @@ static void scan_devices(void) | |||
379 | break; | 374 | break; |
380 | 375 | ||
381 | printk("Device at %i has size %u\n", i, desc_size(d)); | 376 | printk("Device at %i has size %u\n", i, desc_size(d)); |
382 | add_lguest_device(d); | 377 | add_lguest_device(d, i); |
383 | } | 378 | } |
384 | } | 379 | } |
385 | 380 | ||
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index b8b9e44f7f4e..dbaad39020a1 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c | |||
@@ -334,7 +334,7 @@ int __init adb_init(void) | |||
334 | return 0; | 334 | return 0; |
335 | } | 335 | } |
336 | 336 | ||
337 | __initcall(adb_init); | 337 | device_initcall(adb_init); |
338 | 338 | ||
339 | static int | 339 | static int |
340 | do_adb_reset_bus(void) | 340 | do_adb_reset_bus(void) |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index c14dacdacfac..b26927ce889c 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -203,17 +203,6 @@ static void bitmap_checkfree(struct bitmap *bitmap, unsigned long page) | |||
203 | * bitmap file handling - read and write the bitmap file and its superblock | 203 | * bitmap file handling - read and write the bitmap file and its superblock |
204 | */ | 204 | */ |
205 | 205 | ||
206 | /* copy the pathname of a file to a buffer */ | ||
207 | char *file_path(struct file *file, char *buf, int count) | ||
208 | { | ||
209 | if (!buf) | ||
210 | return NULL; | ||
211 | |||
212 | buf = d_path(&file->f_path, buf, count); | ||
213 | |||
214 | return IS_ERR(buf) ? NULL : buf; | ||
215 | } | ||
216 | |||
217 | /* | 206 | /* |
218 | * basic page I/O operations | 207 | * basic page I/O operations |
219 | */ | 208 | */ |
@@ -721,11 +710,13 @@ static void bitmap_file_kick(struct bitmap *bitmap) | |||
721 | if (bitmap->file) { | 710 | if (bitmap->file) { |
722 | path = kmalloc(PAGE_SIZE, GFP_KERNEL); | 711 | path = kmalloc(PAGE_SIZE, GFP_KERNEL); |
723 | if (path) | 712 | if (path) |
724 | ptr = file_path(bitmap->file, path, PAGE_SIZE); | 713 | ptr = d_path(&bitmap->file->f_path, path, |
714 | PAGE_SIZE); | ||
715 | |||
725 | 716 | ||
726 | printk(KERN_ALERT | 717 | printk(KERN_ALERT |
727 | "%s: kicking failed bitmap file %s from array!\n", | 718 | "%s: kicking failed bitmap file %s from array!\n", |
728 | bmname(bitmap), ptr ? ptr : ""); | 719 | bmname(bitmap), IS_ERR(ptr) ? "" : ptr); |
729 | 720 | ||
730 | kfree(path); | 721 | kfree(path); |
731 | } else | 722 | } else |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 83eb78b00137..51c19f86ff99 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -74,6 +74,8 @@ static DEFINE_SPINLOCK(pers_lock); | |||
74 | 74 | ||
75 | static void md_print_devices(void); | 75 | static void md_print_devices(void); |
76 | 76 | ||
77 | static DECLARE_WAIT_QUEUE_HEAD(resync_wait); | ||
78 | |||
77 | #define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); } | 79 | #define MD_BUG(x...) { printk("md: bug in file %s, line %d\n", __FILE__, __LINE__); md_print_devices(); } |
78 | 80 | ||
79 | /* | 81 | /* |
@@ -3013,6 +3015,36 @@ degraded_show(mddev_t *mddev, char *page) | |||
3013 | static struct md_sysfs_entry md_degraded = __ATTR_RO(degraded); | 3015 | static struct md_sysfs_entry md_degraded = __ATTR_RO(degraded); |
3014 | 3016 | ||
3015 | static ssize_t | 3017 | static ssize_t |
3018 | sync_force_parallel_show(mddev_t *mddev, char *page) | ||
3019 | { | ||
3020 | return sprintf(page, "%d\n", mddev->parallel_resync); | ||
3021 | } | ||
3022 | |||
3023 | static ssize_t | ||
3024 | sync_force_parallel_store(mddev_t *mddev, const char *buf, size_t len) | ||
3025 | { | ||
3026 | long n; | ||
3027 | |||
3028 | if (strict_strtol(buf, 10, &n)) | ||
3029 | return -EINVAL; | ||
3030 | |||
3031 | if (n != 0 && n != 1) | ||
3032 | return -EINVAL; | ||
3033 | |||
3034 | mddev->parallel_resync = n; | ||
3035 | |||
3036 | if (mddev->sync_thread) | ||
3037 | wake_up(&resync_wait); | ||
3038 | |||
3039 | return len; | ||
3040 | } | ||
3041 | |||
3042 | /* force parallel resync, even with shared block devices */ | ||
3043 | static struct md_sysfs_entry md_sync_force_parallel = | ||
3044 | __ATTR(sync_force_parallel, S_IRUGO|S_IWUSR, | ||
3045 | sync_force_parallel_show, sync_force_parallel_store); | ||
3046 | |||
3047 | static ssize_t | ||
3016 | sync_speed_show(mddev_t *mddev, char *page) | 3048 | sync_speed_show(mddev_t *mddev, char *page) |
3017 | { | 3049 | { |
3018 | unsigned long resync, dt, db; | 3050 | unsigned long resync, dt, db; |
@@ -3187,6 +3219,7 @@ static struct attribute *md_redundancy_attrs[] = { | |||
3187 | &md_sync_min.attr, | 3219 | &md_sync_min.attr, |
3188 | &md_sync_max.attr, | 3220 | &md_sync_max.attr, |
3189 | &md_sync_speed.attr, | 3221 | &md_sync_speed.attr, |
3222 | &md_sync_force_parallel.attr, | ||
3190 | &md_sync_completed.attr, | 3223 | &md_sync_completed.attr, |
3191 | &md_max_sync.attr, | 3224 | &md_max_sync.attr, |
3192 | &md_suspend_lo.attr, | 3225 | &md_suspend_lo.attr, |
@@ -3691,6 +3724,8 @@ static int do_md_stop(mddev_t * mddev, int mode) | |||
3691 | 3724 | ||
3692 | module_put(mddev->pers->owner); | 3725 | module_put(mddev->pers->owner); |
3693 | mddev->pers = NULL; | 3726 | mddev->pers = NULL; |
3727 | /* tell userspace to handle 'inactive' */ | ||
3728 | sysfs_notify(&mddev->kobj, NULL, "array_state"); | ||
3694 | 3729 | ||
3695 | set_capacity(disk, 0); | 3730 | set_capacity(disk, 0); |
3696 | mddev->changed = 1; | 3731 | mddev->changed = 1; |
@@ -3987,8 +4022,8 @@ static int get_bitmap_file(mddev_t * mddev, void __user * arg) | |||
3987 | if (!buf) | 4022 | if (!buf) |
3988 | goto out; | 4023 | goto out; |
3989 | 4024 | ||
3990 | ptr = file_path(mddev->bitmap->file, buf, sizeof(file->pathname)); | 4025 | ptr = d_path(&mddev->bitmap->file->f_path, buf, sizeof(file->pathname)); |
3991 | if (!ptr) | 4026 | if (IS_ERR(ptr)) |
3992 | goto out; | 4027 | goto out; |
3993 | 4028 | ||
3994 | strcpy(file->pathname, ptr); | 4029 | strcpy(file->pathname, ptr); |
@@ -5399,7 +5434,7 @@ void md_done_sync(mddev_t *mddev, int blocks, int ok) | |||
5399 | atomic_sub(blocks, &mddev->recovery_active); | 5434 | atomic_sub(blocks, &mddev->recovery_active); |
5400 | wake_up(&mddev->recovery_wait); | 5435 | wake_up(&mddev->recovery_wait); |
5401 | if (!ok) { | 5436 | if (!ok) { |
5402 | set_bit(MD_RECOVERY_ERR, &mddev->recovery); | 5437 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
5403 | md_wakeup_thread(mddev->thread); | 5438 | md_wakeup_thread(mddev->thread); |
5404 | // stop recovery, signal do_sync .... | 5439 | // stop recovery, signal do_sync .... |
5405 | } | 5440 | } |
@@ -5435,8 +5470,11 @@ void md_write_start(mddev_t *mddev, struct bio *bi) | |||
5435 | md_wakeup_thread(mddev->thread); | 5470 | md_wakeup_thread(mddev->thread); |
5436 | } | 5471 | } |
5437 | spin_unlock_irq(&mddev->write_lock); | 5472 | spin_unlock_irq(&mddev->write_lock); |
5473 | sysfs_notify(&mddev->kobj, NULL, "array_state"); | ||
5438 | } | 5474 | } |
5439 | wait_event(mddev->sb_wait, mddev->flags==0); | 5475 | wait_event(mddev->sb_wait, |
5476 | !test_bit(MD_CHANGE_CLEAN, &mddev->flags) && | ||
5477 | !test_bit(MD_CHANGE_PENDING, &mddev->flags)); | ||
5440 | } | 5478 | } |
5441 | 5479 | ||
5442 | void md_write_end(mddev_t *mddev) | 5480 | void md_write_end(mddev_t *mddev) |
@@ -5471,13 +5509,17 @@ void md_allow_write(mddev_t *mddev) | |||
5471 | mddev->safemode = 1; | 5509 | mddev->safemode = 1; |
5472 | spin_unlock_irq(&mddev->write_lock); | 5510 | spin_unlock_irq(&mddev->write_lock); |
5473 | md_update_sb(mddev, 0); | 5511 | md_update_sb(mddev, 0); |
5512 | |||
5513 | sysfs_notify(&mddev->kobj, NULL, "array_state"); | ||
5514 | /* wait for the dirty state to be recorded in the metadata */ | ||
5515 | wait_event(mddev->sb_wait, | ||
5516 | !test_bit(MD_CHANGE_CLEAN, &mddev->flags) && | ||
5517 | !test_bit(MD_CHANGE_PENDING, &mddev->flags)); | ||
5474 | } else | 5518 | } else |
5475 | spin_unlock_irq(&mddev->write_lock); | 5519 | spin_unlock_irq(&mddev->write_lock); |
5476 | } | 5520 | } |
5477 | EXPORT_SYMBOL_GPL(md_allow_write); | 5521 | EXPORT_SYMBOL_GPL(md_allow_write); |
5478 | 5522 | ||
5479 | static DECLARE_WAIT_QUEUE_HEAD(resync_wait); | ||
5480 | |||
5481 | #define SYNC_MARKS 10 | 5523 | #define SYNC_MARKS 10 |
5482 | #define SYNC_MARK_STEP (3*HZ) | 5524 | #define SYNC_MARK_STEP (3*HZ) |
5483 | void md_do_sync(mddev_t *mddev) | 5525 | void md_do_sync(mddev_t *mddev) |
@@ -5541,8 +5583,9 @@ void md_do_sync(mddev_t *mddev) | |||
5541 | for_each_mddev(mddev2, tmp) { | 5583 | for_each_mddev(mddev2, tmp) { |
5542 | if (mddev2 == mddev) | 5584 | if (mddev2 == mddev) |
5543 | continue; | 5585 | continue; |
5544 | if (mddev2->curr_resync && | 5586 | if (!mddev->parallel_resync |
5545 | match_mddev_units(mddev,mddev2)) { | 5587 | && mddev2->curr_resync |
5588 | && match_mddev_units(mddev, mddev2)) { | ||
5546 | DEFINE_WAIT(wq); | 5589 | DEFINE_WAIT(wq); |
5547 | if (mddev < mddev2 && mddev->curr_resync == 2) { | 5590 | if (mddev < mddev2 && mddev->curr_resync == 2) { |
5548 | /* arbitrarily yield */ | 5591 | /* arbitrarily yield */ |
@@ -5647,7 +5690,7 @@ void md_do_sync(mddev_t *mddev) | |||
5647 | sectors = mddev->pers->sync_request(mddev, j, &skipped, | 5690 | sectors = mddev->pers->sync_request(mddev, j, &skipped, |
5648 | currspeed < speed_min(mddev)); | 5691 | currspeed < speed_min(mddev)); |
5649 | if (sectors == 0) { | 5692 | if (sectors == 0) { |
5650 | set_bit(MD_RECOVERY_ERR, &mddev->recovery); | 5693 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
5651 | goto out; | 5694 | goto out; |
5652 | } | 5695 | } |
5653 | 5696 | ||
@@ -5670,8 +5713,7 @@ void md_do_sync(mddev_t *mddev) | |||
5670 | 5713 | ||
5671 | last_check = io_sectors; | 5714 | last_check = io_sectors; |
5672 | 5715 | ||
5673 | if (test_bit(MD_RECOVERY_INTR, &mddev->recovery) || | 5716 | if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) |
5674 | test_bit(MD_RECOVERY_ERR, &mddev->recovery)) | ||
5675 | break; | 5717 | break; |
5676 | 5718 | ||
5677 | repeat: | 5719 | repeat: |
@@ -5725,8 +5767,7 @@ void md_do_sync(mddev_t *mddev) | |||
5725 | /* tell personality that we are finished */ | 5767 | /* tell personality that we are finished */ |
5726 | mddev->pers->sync_request(mddev, max_sectors, &skipped, 1); | 5768 | mddev->pers->sync_request(mddev, max_sectors, &skipped, 1); |
5727 | 5769 | ||
5728 | if (!test_bit(MD_RECOVERY_ERR, &mddev->recovery) && | 5770 | if (!test_bit(MD_RECOVERY_CHECK, &mddev->recovery) && |
5729 | !test_bit(MD_RECOVERY_CHECK, &mddev->recovery) && | ||
5730 | mddev->curr_resync > 2) { | 5771 | mddev->curr_resync > 2) { |
5731 | if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { | 5772 | if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { |
5732 | if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { | 5773 | if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { |
@@ -5795,7 +5836,10 @@ static int remove_and_add_spares(mddev_t *mddev) | |||
5795 | } | 5836 | } |
5796 | 5837 | ||
5797 | if (mddev->degraded) { | 5838 | if (mddev->degraded) { |
5798 | rdev_for_each(rdev, rtmp, mddev) | 5839 | rdev_for_each(rdev, rtmp, mddev) { |
5840 | if (rdev->raid_disk >= 0 && | ||
5841 | !test_bit(In_sync, &rdev->flags)) | ||
5842 | spares++; | ||
5799 | if (rdev->raid_disk < 0 | 5843 | if (rdev->raid_disk < 0 |
5800 | && !test_bit(Faulty, &rdev->flags)) { | 5844 | && !test_bit(Faulty, &rdev->flags)) { |
5801 | rdev->recovery_offset = 0; | 5845 | rdev->recovery_offset = 0; |
@@ -5813,6 +5857,7 @@ static int remove_and_add_spares(mddev_t *mddev) | |||
5813 | } else | 5857 | } else |
5814 | break; | 5858 | break; |
5815 | } | 5859 | } |
5860 | } | ||
5816 | } | 5861 | } |
5817 | return spares; | 5862 | return spares; |
5818 | } | 5863 | } |
@@ -5826,7 +5871,7 @@ static int remove_and_add_spares(mddev_t *mddev) | |||
5826 | * to do that as needed. | 5871 | * to do that as needed. |
5827 | * When it is determined that resync is needed, we set MD_RECOVERY_RUNNING in | 5872 | * When it is determined that resync is needed, we set MD_RECOVERY_RUNNING in |
5828 | * "->recovery" and create a thread at ->sync_thread. | 5873 | * "->recovery" and create a thread at ->sync_thread. |
5829 | * When the thread finishes it sets MD_RECOVERY_DONE (and might set MD_RECOVERY_ERR) | 5874 | * When the thread finishes it sets MD_RECOVERY_DONE |
5830 | * and wakeups up this thread which will reap the thread and finish up. | 5875 | * and wakeups up this thread which will reap the thread and finish up. |
5831 | * This thread also removes any faulty devices (with nr_pending == 0). | 5876 | * This thread also removes any faulty devices (with nr_pending == 0). |
5832 | * | 5877 | * |
@@ -5901,8 +5946,7 @@ void md_check_recovery(mddev_t *mddev) | |||
5901 | /* resync has finished, collect result */ | 5946 | /* resync has finished, collect result */ |
5902 | md_unregister_thread(mddev->sync_thread); | 5947 | md_unregister_thread(mddev->sync_thread); |
5903 | mddev->sync_thread = NULL; | 5948 | mddev->sync_thread = NULL; |
5904 | if (!test_bit(MD_RECOVERY_ERR, &mddev->recovery) && | 5949 | if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { |
5905 | !test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { | ||
5906 | /* success...*/ | 5950 | /* success...*/ |
5907 | /* activate any spares */ | 5951 | /* activate any spares */ |
5908 | mddev->pers->spare_active(mddev); | 5952 | mddev->pers->spare_active(mddev); |
@@ -5926,7 +5970,6 @@ void md_check_recovery(mddev_t *mddev) | |||
5926 | * might be left set | 5970 | * might be left set |
5927 | */ | 5971 | */ |
5928 | clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 5972 | clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
5929 | clear_bit(MD_RECOVERY_ERR, &mddev->recovery); | ||
5930 | clear_bit(MD_RECOVERY_INTR, &mddev->recovery); | 5973 | clear_bit(MD_RECOVERY_INTR, &mddev->recovery); |
5931 | clear_bit(MD_RECOVERY_DONE, &mddev->recovery); | 5974 | clear_bit(MD_RECOVERY_DONE, &mddev->recovery); |
5932 | 5975 | ||
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 4f4d1f383842..e968116e0de9 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -327,7 +327,8 @@ static int multipath_remove_disk(mddev_t *mddev, int number) | |||
327 | if (rdev) { | 327 | if (rdev) { |
328 | if (test_bit(In_sync, &rdev->flags) || | 328 | if (test_bit(In_sync, &rdev->flags) || |
329 | atomic_read(&rdev->nr_pending)) { | 329 | atomic_read(&rdev->nr_pending)) { |
330 | printk(KERN_ERR "hot-remove-disk, slot %d is identified" " but is still operational!\n", number); | 330 | printk(KERN_ERR "hot-remove-disk, slot %d is identified" |
331 | " but is still operational!\n", number); | ||
331 | err = -EBUSY; | 332 | err = -EBUSY; |
332 | goto abort; | 333 | goto abort; |
333 | } | 334 | } |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index ac409b7d83f5..c610b947218a 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -773,7 +773,7 @@ static int make_request(struct request_queue *q, struct bio * bio) | |||
773 | r1bio_t *r1_bio; | 773 | r1bio_t *r1_bio; |
774 | struct bio *read_bio; | 774 | struct bio *read_bio; |
775 | int i, targets = 0, disks; | 775 | int i, targets = 0, disks; |
776 | struct bitmap *bitmap = mddev->bitmap; | 776 | struct bitmap *bitmap; |
777 | unsigned long flags; | 777 | unsigned long flags; |
778 | struct bio_list bl; | 778 | struct bio_list bl; |
779 | struct page **behind_pages = NULL; | 779 | struct page **behind_pages = NULL; |
@@ -802,6 +802,8 @@ static int make_request(struct request_queue *q, struct bio * bio) | |||
802 | 802 | ||
803 | wait_barrier(conf); | 803 | wait_barrier(conf); |
804 | 804 | ||
805 | bitmap = mddev->bitmap; | ||
806 | |||
805 | disk_stat_inc(mddev->gendisk, ios[rw]); | 807 | disk_stat_inc(mddev->gendisk, ios[rw]); |
806 | disk_stat_add(mddev->gendisk, sectors[rw], bio_sectors(bio)); | 808 | disk_stat_add(mddev->gendisk, sectors[rw], bio_sectors(bio)); |
807 | 809 | ||
@@ -1025,7 +1027,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1025 | /* | 1027 | /* |
1026 | * if recovery is running, make sure it aborts. | 1028 | * if recovery is running, make sure it aborts. |
1027 | */ | 1029 | */ |
1028 | set_bit(MD_RECOVERY_ERR, &mddev->recovery); | 1030 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
1029 | } else | 1031 | } else |
1030 | set_bit(Faulty, &rdev->flags); | 1032 | set_bit(Faulty, &rdev->flags); |
1031 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | 1033 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
@@ -1146,6 +1148,14 @@ static int raid1_remove_disk(mddev_t *mddev, int number) | |||
1146 | err = -EBUSY; | 1148 | err = -EBUSY; |
1147 | goto abort; | 1149 | goto abort; |
1148 | } | 1150 | } |
1151 | /* Only remove non-faulty devices is recovery | ||
1152 | * is not possible. | ||
1153 | */ | ||
1154 | if (!test_bit(Faulty, &rdev->flags) && | ||
1155 | mddev->degraded < conf->raid_disks) { | ||
1156 | err = -EBUSY; | ||
1157 | goto abort; | ||
1158 | } | ||
1149 | p->rdev = NULL; | 1159 | p->rdev = NULL; |
1150 | synchronize_rcu(); | 1160 | synchronize_rcu(); |
1151 | if (atomic_read(&rdev->nr_pending)) { | 1161 | if (atomic_read(&rdev->nr_pending)) { |
@@ -1282,6 +1292,7 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio) | |||
1282 | rdev_dec_pending(conf->mirrors[i].rdev, mddev); | 1292 | rdev_dec_pending(conf->mirrors[i].rdev, mddev); |
1283 | } else { | 1293 | } else { |
1284 | /* fixup the bio for reuse */ | 1294 | /* fixup the bio for reuse */ |
1295 | int size; | ||
1285 | sbio->bi_vcnt = vcnt; | 1296 | sbio->bi_vcnt = vcnt; |
1286 | sbio->bi_size = r1_bio->sectors << 9; | 1297 | sbio->bi_size = r1_bio->sectors << 9; |
1287 | sbio->bi_idx = 0; | 1298 | sbio->bi_idx = 0; |
@@ -1295,10 +1306,20 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio) | |||
1295 | sbio->bi_sector = r1_bio->sector + | 1306 | sbio->bi_sector = r1_bio->sector + |
1296 | conf->mirrors[i].rdev->data_offset; | 1307 | conf->mirrors[i].rdev->data_offset; |
1297 | sbio->bi_bdev = conf->mirrors[i].rdev->bdev; | 1308 | sbio->bi_bdev = conf->mirrors[i].rdev->bdev; |
1298 | for (j = 0; j < vcnt ; j++) | 1309 | size = sbio->bi_size; |
1299 | memcpy(page_address(sbio->bi_io_vec[j].bv_page), | 1310 | for (j = 0; j < vcnt ; j++) { |
1311 | struct bio_vec *bi; | ||
1312 | bi = &sbio->bi_io_vec[j]; | ||
1313 | bi->bv_offset = 0; | ||
1314 | if (size > PAGE_SIZE) | ||
1315 | bi->bv_len = PAGE_SIZE; | ||
1316 | else | ||
1317 | bi->bv_len = size; | ||
1318 | size -= PAGE_SIZE; | ||
1319 | memcpy(page_address(bi->bv_page), | ||
1300 | page_address(pbio->bi_io_vec[j].bv_page), | 1320 | page_address(pbio->bi_io_vec[j].bv_page), |
1301 | PAGE_SIZE); | 1321 | PAGE_SIZE); |
1322 | } | ||
1302 | 1323 | ||
1303 | } | 1324 | } |
1304 | } | 1325 | } |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 8536ede1e712..1de17da34a95 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1020,7 +1020,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1020 | /* | 1020 | /* |
1021 | * if recovery is running, make sure it aborts. | 1021 | * if recovery is running, make sure it aborts. |
1022 | */ | 1022 | */ |
1023 | set_bit(MD_RECOVERY_ERR, &mddev->recovery); | 1023 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
1024 | } | 1024 | } |
1025 | set_bit(Faulty, &rdev->flags); | 1025 | set_bit(Faulty, &rdev->flags); |
1026 | set_bit(MD_CHANGE_DEVS, &mddev->flags); | 1026 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
@@ -1171,6 +1171,14 @@ static int raid10_remove_disk(mddev_t *mddev, int number) | |||
1171 | err = -EBUSY; | 1171 | err = -EBUSY; |
1172 | goto abort; | 1172 | goto abort; |
1173 | } | 1173 | } |
1174 | /* Only remove faulty devices in recovery | ||
1175 | * is not possible. | ||
1176 | */ | ||
1177 | if (!test_bit(Faulty, &rdev->flags) && | ||
1178 | enough(conf)) { | ||
1179 | err = -EBUSY; | ||
1180 | goto abort; | ||
1181 | } | ||
1174 | p->rdev = NULL; | 1182 | p->rdev = NULL; |
1175 | synchronize_rcu(); | 1183 | synchronize_rcu(); |
1176 | if (atomic_read(&rdev->nr_pending)) { | 1184 | if (atomic_read(&rdev->nr_pending)) { |
@@ -1237,6 +1245,7 @@ static void end_sync_write(struct bio *bio, int error) | |||
1237 | 1245 | ||
1238 | if (!uptodate) | 1246 | if (!uptodate) |
1239 | md_error(mddev, conf->mirrors[d].rdev); | 1247 | md_error(mddev, conf->mirrors[d].rdev); |
1248 | |||
1240 | update_head_pos(i, r10_bio); | 1249 | update_head_pos(i, r10_bio); |
1241 | 1250 | ||
1242 | while (atomic_dec_and_test(&r10_bio->remaining)) { | 1251 | while (atomic_dec_and_test(&r10_bio->remaining)) { |
@@ -1844,7 +1853,8 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i | |||
1844 | if (rb2) | 1853 | if (rb2) |
1845 | atomic_dec(&rb2->remaining); | 1854 | atomic_dec(&rb2->remaining); |
1846 | r10_bio = rb2; | 1855 | r10_bio = rb2; |
1847 | if (!test_and_set_bit(MD_RECOVERY_ERR, &mddev->recovery)) | 1856 | if (!test_and_set_bit(MD_RECOVERY_INTR, |
1857 | &mddev->recovery)) | ||
1848 | printk(KERN_INFO "raid10: %s: insufficient working devices for recovery.\n", | 1858 | printk(KERN_INFO "raid10: %s: insufficient working devices for recovery.\n", |
1849 | mdname(mddev)); | 1859 | mdname(mddev)); |
1850 | break; | 1860 | break; |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 93fde48c0f42..425958a76b84 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -94,6 +94,8 @@ | |||
94 | #define __inline__ | 94 | #define __inline__ |
95 | #endif | 95 | #endif |
96 | 96 | ||
97 | #define printk_rl(args...) ((void) (printk_ratelimit() && printk(args))) | ||
98 | |||
97 | #if !RAID6_USE_EMPTY_ZERO_PAGE | 99 | #if !RAID6_USE_EMPTY_ZERO_PAGE |
98 | /* In .bss so it's zeroed */ | 100 | /* In .bss so it's zeroed */ |
99 | const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(256))); | 101 | const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(256))); |
@@ -1143,10 +1145,12 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
1143 | set_bit(R5_UPTODATE, &sh->dev[i].flags); | 1145 | set_bit(R5_UPTODATE, &sh->dev[i].flags); |
1144 | if (test_bit(R5_ReadError, &sh->dev[i].flags)) { | 1146 | if (test_bit(R5_ReadError, &sh->dev[i].flags)) { |
1145 | rdev = conf->disks[i].rdev; | 1147 | rdev = conf->disks[i].rdev; |
1146 | printk(KERN_INFO "raid5:%s: read error corrected (%lu sectors at %llu on %s)\n", | 1148 | printk_rl(KERN_INFO "raid5:%s: read error corrected" |
1147 | mdname(conf->mddev), STRIPE_SECTORS, | 1149 | " (%lu sectors at %llu on %s)\n", |
1148 | (unsigned long long)(sh->sector + rdev->data_offset), | 1150 | mdname(conf->mddev), STRIPE_SECTORS, |
1149 | bdevname(rdev->bdev, b)); | 1151 | (unsigned long long)(sh->sector |
1152 | + rdev->data_offset), | ||
1153 | bdevname(rdev->bdev, b)); | ||
1150 | clear_bit(R5_ReadError, &sh->dev[i].flags); | 1154 | clear_bit(R5_ReadError, &sh->dev[i].flags); |
1151 | clear_bit(R5_ReWrite, &sh->dev[i].flags); | 1155 | clear_bit(R5_ReWrite, &sh->dev[i].flags); |
1152 | } | 1156 | } |
@@ -1160,16 +1164,22 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
1160 | clear_bit(R5_UPTODATE, &sh->dev[i].flags); | 1164 | clear_bit(R5_UPTODATE, &sh->dev[i].flags); |
1161 | atomic_inc(&rdev->read_errors); | 1165 | atomic_inc(&rdev->read_errors); |
1162 | if (conf->mddev->degraded) | 1166 | if (conf->mddev->degraded) |
1163 | printk(KERN_WARNING "raid5:%s: read error not correctable (sector %llu on %s).\n", | 1167 | printk_rl(KERN_WARNING |
1164 | mdname(conf->mddev), | 1168 | "raid5:%s: read error not correctable " |
1165 | (unsigned long long)(sh->sector + rdev->data_offset), | 1169 | "(sector %llu on %s).\n", |
1166 | bdn); | 1170 | mdname(conf->mddev), |
1171 | (unsigned long long)(sh->sector | ||
1172 | + rdev->data_offset), | ||
1173 | bdn); | ||
1167 | else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) | 1174 | else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) |
1168 | /* Oh, no!!! */ | 1175 | /* Oh, no!!! */ |
1169 | printk(KERN_WARNING "raid5:%s: read error NOT corrected!! (sector %llu on %s).\n", | 1176 | printk_rl(KERN_WARNING |
1170 | mdname(conf->mddev), | 1177 | "raid5:%s: read error NOT corrected!! " |
1171 | (unsigned long long)(sh->sector + rdev->data_offset), | 1178 | "(sector %llu on %s).\n", |
1172 | bdn); | 1179 | mdname(conf->mddev), |
1180 | (unsigned long long)(sh->sector | ||
1181 | + rdev->data_offset), | ||
1182 | bdn); | ||
1173 | else if (atomic_read(&rdev->read_errors) | 1183 | else if (atomic_read(&rdev->read_errors) |
1174 | > conf->max_nr_stripes) | 1184 | > conf->max_nr_stripes) |
1175 | printk(KERN_WARNING | 1185 | printk(KERN_WARNING |
@@ -1258,7 +1268,7 @@ static void error(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1258 | /* | 1268 | /* |
1259 | * if recovery was running, make sure it aborts. | 1269 | * if recovery was running, make sure it aborts. |
1260 | */ | 1270 | */ |
1261 | set_bit(MD_RECOVERY_ERR, &mddev->recovery); | 1271 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
1262 | } | 1272 | } |
1263 | set_bit(Faulty, &rdev->flags); | 1273 | set_bit(Faulty, &rdev->flags); |
1264 | printk (KERN_ALERT | 1274 | printk (KERN_ALERT |
@@ -4564,6 +4574,14 @@ static int raid5_remove_disk(mddev_t *mddev, int number) | |||
4564 | err = -EBUSY; | 4574 | err = -EBUSY; |
4565 | goto abort; | 4575 | goto abort; |
4566 | } | 4576 | } |
4577 | /* Only remove non-faulty devices if recovery | ||
4578 | * isn't possible. | ||
4579 | */ | ||
4580 | if (!test_bit(Faulty, &rdev->flags) && | ||
4581 | mddev->degraded <= conf->max_degraded) { | ||
4582 | err = -EBUSY; | ||
4583 | goto abort; | ||
4584 | } | ||
4567 | p->rdev = NULL; | 4585 | p->rdev = NULL; |
4568 | synchronize_rcu(); | 4586 | synchronize_rcu(); |
4569 | if (atomic_read(&rdev->nr_pending)) { | 4587 | if (atomic_read(&rdev->nr_pending)) { |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 89d8d37838a3..3b26fbd3e558 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -901,7 +901,7 @@ endif # V4L_USB_DRIVERS | |||
901 | 901 | ||
902 | config SOC_CAMERA | 902 | config SOC_CAMERA |
903 | tristate "SoC camera support" | 903 | tristate "SoC camera support" |
904 | depends on VIDEO_V4L2 | 904 | depends on VIDEO_V4L2 && HAS_DMA |
905 | select VIDEOBUF_DMA_SG | 905 | select VIDEOBUF_DMA_SG |
906 | help | 906 | help |
907 | SoC Camera is a common API to several cameras, not connecting | 907 | SoC Camera is a common API to several cameras, not connecting |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 2ca3e9cfb2bb..0165aac533bf 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -2613,7 +2613,7 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | |||
2613 | struct bttv_fh *fh = priv; | 2613 | struct bttv_fh *fh = priv; |
2614 | 2614 | ||
2615 | mutex_lock(&fh->cap.vb_lock); | 2615 | mutex_lock(&fh->cap.vb_lock); |
2616 | retval = videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, | 2616 | retval = __videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, |
2617 | V4L2_MEMORY_MMAP); | 2617 | V4L2_MEMORY_MMAP); |
2618 | if (retval < 0) { | 2618 | if (retval < 0) { |
2619 | mutex_unlock(&fh->cap.vb_lock); | 2619 | mutex_unlock(&fh->cap.vb_lock); |
diff --git a/drivers/media/video/cs5345.c b/drivers/media/video/cs5345.c index 2a429f9e32cd..03411503457e 100644 --- a/drivers/media/video/cs5345.c +++ b/drivers/media/video/cs5345.c | |||
@@ -160,10 +160,17 @@ static int cs5345_probe(struct i2c_client *client, | |||
160 | 160 | ||
161 | /* ----------------------------------------------------------------------- */ | 161 | /* ----------------------------------------------------------------------- */ |
162 | 162 | ||
163 | static const struct i2c_device_id cs5345_id[] = { | ||
164 | { "cs5345", 0 }, | ||
165 | { } | ||
166 | }; | ||
167 | MODULE_DEVICE_TABLE(i2c, cs5345_id); | ||
168 | |||
163 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 169 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
164 | .name = "cs5345", | 170 | .name = "cs5345", |
165 | .driverid = I2C_DRIVERID_CS5345, | 171 | .driverid = I2C_DRIVERID_CS5345, |
166 | .command = cs5345_command, | 172 | .command = cs5345_command, |
167 | .probe = cs5345_probe, | 173 | .probe = cs5345_probe, |
174 | .id_table = cs5345_id, | ||
168 | }; | 175 | }; |
169 | 176 | ||
diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c index 2dfd0afc62db..d965af860ab2 100644 --- a/drivers/media/video/cs53l32a.c +++ b/drivers/media/video/cs53l32a.c | |||
@@ -144,7 +144,8 @@ static int cs53l32a_probe(struct i2c_client *client, | |||
144 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 144 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
145 | return -EIO; | 145 | return -EIO; |
146 | 146 | ||
147 | snprintf(client->name, sizeof(client->name) - 1, "cs53l32a"); | 147 | if (!id) |
148 | strlcpy(client->name, "cs53l32a", sizeof(client->name)); | ||
148 | 149 | ||
149 | v4l_info(client, "chip found @ 0x%x (%s)\n", | 150 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
150 | client->addr << 1, client->adapter->name); | 151 | client->addr << 1, client->adapter->name); |
@@ -175,10 +176,17 @@ static int cs53l32a_probe(struct i2c_client *client, | |||
175 | return 0; | 176 | return 0; |
176 | } | 177 | } |
177 | 178 | ||
179 | static const struct i2c_device_id cs53l32a_id[] = { | ||
180 | { "cs53l32a", 0 }, | ||
181 | { } | ||
182 | }; | ||
183 | MODULE_DEVICE_TABLE(i2c, cs53l32a_id); | ||
184 | |||
178 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 185 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
179 | .name = "cs53l32a", | 186 | .name = "cs53l32a", |
180 | .driverid = I2C_DRIVERID_CS53L32A, | 187 | .driverid = I2C_DRIVERID_CS53L32A, |
181 | .command = cs53l32a_command, | 188 | .command = cs53l32a_command, |
182 | .probe = cs53l32a_probe, | 189 | .probe = cs53l32a_probe, |
190 | .id_table = cs53l32a_id, | ||
183 | }; | 191 | }; |
184 | 192 | ||
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c index 4f08a4058d1a..1d6c51a75313 100644 --- a/drivers/media/video/cx18/cx18-i2c.c +++ b/drivers/media/video/cx18/cx18-i2c.c | |||
@@ -74,7 +74,7 @@ static const u8 hw_bus[] = { | |||
74 | }; | 74 | }; |
75 | 75 | ||
76 | /* This array should match the CX18_HW_ defines */ | 76 | /* This array should match the CX18_HW_ defines */ |
77 | static const char * const hw_drivernames[] = { | 77 | static const char * const hw_devicenames[] = { |
78 | "tuner", | 78 | "tuner", |
79 | "tveeprom", | 79 | "tveeprom", |
80 | "cs5345", | 80 | "cs5345", |
@@ -95,8 +95,7 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx) | |||
95 | id = hw_driverids[idx]; | 95 | id = hw_driverids[idx]; |
96 | bus = hw_bus[idx]; | 96 | bus = hw_bus[idx]; |
97 | memset(&info, 0, sizeof(info)); | 97 | memset(&info, 0, sizeof(info)); |
98 | strlcpy(info.driver_name, hw_drivernames[idx], | 98 | strlcpy(info.type, hw_devicenames[idx], sizeof(info.type)); |
99 | sizeof(info.driver_name)); | ||
100 | info.addr = hw_addrs[idx]; | 99 | info.addr = hw_addrs[idx]; |
101 | for (i = 0; i < I2C_CLIENTS_MAX; i++) | 100 | for (i = 0; i < I2C_CLIENTS_MAX; i++) |
102 | if (cx->i2c_clients[i] == NULL) | 101 | if (cx->i2c_clients[i] == NULL) |
@@ -279,7 +278,7 @@ static const char *cx18_i2c_id_name(u32 id) | |||
279 | 278 | ||
280 | for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) | 279 | for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) |
281 | if (hw_driverids[i] == id) | 280 | if (hw_driverids[i] == id) |
282 | return hw_drivernames[i]; | 281 | return hw_devicenames[i]; |
283 | return "unknown device"; | 282 | return "unknown device"; |
284 | } | 283 | } |
285 | 284 | ||
@@ -290,7 +289,7 @@ static const char *cx18_i2c_hw_name(u32 hw) | |||
290 | 289 | ||
291 | for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) | 290 | for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) |
292 | if (1 << i == hw) | 291 | if (1 << i == hw) |
293 | return hw_drivernames[i]; | 292 | return hw_devicenames[i]; |
294 | return "unknown device"; | 293 | return "unknown device"; |
295 | } | 294 | } |
296 | 295 | ||
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 88823810497c..607efdcd22f8 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -1284,10 +1284,17 @@ static int cx25840_remove(struct i2c_client *client) | |||
1284 | return 0; | 1284 | return 0; |
1285 | } | 1285 | } |
1286 | 1286 | ||
1287 | static const struct i2c_device_id cx25840_id[] = { | ||
1288 | { "cx25840", 0 }, | ||
1289 | { } | ||
1290 | }; | ||
1291 | MODULE_DEVICE_TABLE(i2c, cx25840_id); | ||
1292 | |||
1287 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 1293 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
1288 | .name = "cx25840", | 1294 | .name = "cx25840", |
1289 | .driverid = I2C_DRIVERID_CX25840, | 1295 | .driverid = I2C_DRIVERID_CX25840, |
1290 | .command = cx25840_command, | 1296 | .command = cx25840_command, |
1291 | .probe = cx25840_probe, | 1297 | .probe = cx25840_probe, |
1292 | .remove = cx25840_remove, | 1298 | .remove = cx25840_remove, |
1299 | .id_table = cx25840_id, | ||
1293 | }; | 1300 | }; |
diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c index 5e749c528a62..15d037ae25c5 100644 --- a/drivers/media/video/et61x251/et61x251_core.c +++ b/drivers/media/video/et61x251/et61x251_core.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <linux/mm.h> | 34 | #include <linux/mm.h> |
35 | #include <linux/vmalloc.h> | 35 | #include <linux/vmalloc.h> |
36 | #include <linux/page-flags.h> | 36 | #include <linux/page-flags.h> |
37 | #include <linux/byteorder/generic.h> | 37 | #include <asm/byteorder.h> |
38 | #include <asm/page.h> | 38 | #include <asm/page.h> |
39 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
40 | 40 | ||
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index 771adf47e944..32129f3ea836 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c | |||
@@ -136,7 +136,7 @@ static const u8 hw_addrs[] = { | |||
136 | }; | 136 | }; |
137 | 137 | ||
138 | /* This array should match the IVTV_HW_ defines */ | 138 | /* This array should match the IVTV_HW_ defines */ |
139 | static const char * const hw_drivernames[] = { | 139 | static const char * const hw_devicenames[] = { |
140 | "cx25840", | 140 | "cx25840", |
141 | "saa7115", | 141 | "saa7115", |
142 | "saa7127", | 142 | "saa7127", |
@@ -145,7 +145,7 @@ static const char * const hw_drivernames[] = { | |||
145 | "wm8775", | 145 | "wm8775", |
146 | "cs53l32a", | 146 | "cs53l32a", |
147 | "tveeprom", | 147 | "tveeprom", |
148 | "saa7115", | 148 | "saa7114", |
149 | "upd64031a", | 149 | "upd64031a", |
150 | "upd64083", | 150 | "upd64083", |
151 | "saa717x", | 151 | "saa717x", |
@@ -167,8 +167,7 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx) | |||
167 | return -1; | 167 | return -1; |
168 | id = hw_driverids[idx]; | 168 | id = hw_driverids[idx]; |
169 | memset(&info, 0, sizeof(info)); | 169 | memset(&info, 0, sizeof(info)); |
170 | strlcpy(info.driver_name, hw_drivernames[idx], | 170 | strlcpy(info.type, hw_devicenames[idx], sizeof(info.type)); |
171 | sizeof(info.driver_name)); | ||
172 | info.addr = hw_addrs[idx]; | 171 | info.addr = hw_addrs[idx]; |
173 | for (i = 0; itv->i2c_clients[i] && i < I2C_CLIENTS_MAX; i++) {} | 172 | for (i = 0; itv->i2c_clients[i] && i < I2C_CLIENTS_MAX; i++) {} |
174 | 173 | ||
@@ -657,7 +656,7 @@ static const char *ivtv_i2c_id_name(u32 id) | |||
657 | 656 | ||
658 | for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) | 657 | for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) |
659 | if (hw_driverids[i] == id) | 658 | if (hw_driverids[i] == id) |
660 | return hw_drivernames[i]; | 659 | return hw_devicenames[i]; |
661 | return "unknown device"; | 660 | return "unknown device"; |
662 | } | 661 | } |
663 | 662 | ||
@@ -668,7 +667,7 @@ static const char *ivtv_i2c_hw_name(u32 hw) | |||
668 | 667 | ||
669 | for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) | 668 | for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) |
670 | if (1 << i == hw) | 669 | if (1 << i == hw) |
671 | return hw_drivernames[i]; | 670 | return hw_devicenames[i]; |
672 | return "unknown device"; | 671 | return "unknown device"; |
673 | } | 672 | } |
674 | 673 | ||
@@ -770,7 +769,7 @@ int init_ivtv_i2c(struct ivtv *itv) | |||
770 | * same size and GPIO must be the last entry. | 769 | * same size and GPIO must be the last entry. |
771 | */ | 770 | */ |
772 | if (ARRAY_SIZE(hw_driverids) != ARRAY_SIZE(hw_addrs) || | 771 | if (ARRAY_SIZE(hw_driverids) != ARRAY_SIZE(hw_addrs) || |
773 | ARRAY_SIZE(hw_drivernames) != ARRAY_SIZE(hw_addrs) || | 772 | ARRAY_SIZE(hw_devicenames) != ARRAY_SIZE(hw_addrs) || |
774 | IVTV_HW_GPIO != (1 << (ARRAY_SIZE(hw_addrs) - 1)) || | 773 | IVTV_HW_GPIO != (1 << (ARRAY_SIZE(hw_addrs) - 1)) || |
775 | hw_driverids[ARRAY_SIZE(hw_addrs) - 1]) { | 774 | hw_driverids[ARRAY_SIZE(hw_addrs) - 1]) { |
776 | IVTV_ERR("Mismatched I2C hardware arrays\n"); | 775 | IVTV_ERR("Mismatched I2C hardware arrays\n"); |
diff --git a/drivers/media/video/m52790.c b/drivers/media/video/m52790.c index 5b9dfa2c51b4..8e0160d275ca 100644 --- a/drivers/media/video/m52790.c +++ b/drivers/media/video/m52790.c | |||
@@ -135,8 +135,6 @@ static int m52790_probe(struct i2c_client *client, | |||
135 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 135 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
136 | return -EIO; | 136 | return -EIO; |
137 | 137 | ||
138 | snprintf(client->name, sizeof(client->name) - 1, "m52790"); | ||
139 | |||
140 | v4l_info(client, "chip found @ 0x%x (%s)\n", | 138 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
141 | client->addr << 1, client->adapter->name); | 139 | client->addr << 1, client->adapter->name); |
142 | 140 | ||
@@ -159,11 +157,18 @@ static int m52790_remove(struct i2c_client *client) | |||
159 | 157 | ||
160 | /* ----------------------------------------------------------------------- */ | 158 | /* ----------------------------------------------------------------------- */ |
161 | 159 | ||
160 | static const struct i2c_device_id m52790_id[] = { | ||
161 | { "m52790", 0 }, | ||
162 | { } | ||
163 | }; | ||
164 | MODULE_DEVICE_TABLE(i2c, m52790_id); | ||
165 | |||
162 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 166 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
163 | .name = "m52790", | 167 | .name = "m52790", |
164 | .driverid = I2C_DRIVERID_M52790, | 168 | .driverid = I2C_DRIVERID_M52790, |
165 | .command = m52790_command, | 169 | .command = m52790_command, |
166 | .probe = m52790_probe, | 170 | .probe = m52790_probe, |
167 | .remove = m52790_remove, | 171 | .remove = m52790_remove, |
172 | .id_table = m52790_id, | ||
168 | }; | 173 | }; |
169 | 174 | ||
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index e6273162e123..310dbaba55ff 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c | |||
@@ -815,7 +815,8 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
815 | int msp_product, msp_prod_hi, msp_prod_lo; | 815 | int msp_product, msp_prod_hi, msp_prod_lo; |
816 | int msp_rom; | 816 | int msp_rom; |
817 | 817 | ||
818 | snprintf(client->name, sizeof(client->name) - 1, "msp3400"); | 818 | if (!id) |
819 | strlcpy(client->name, "msp3400", sizeof(client->name)); | ||
819 | 820 | ||
820 | if (msp_reset(client) == -1) { | 821 | if (msp_reset(client) == -1) { |
821 | v4l_dbg(1, msp_debug, client, "msp3400 not found\n"); | 822 | v4l_dbg(1, msp_debug, client, "msp3400 not found\n"); |
@@ -864,9 +865,6 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
864 | msp_revision = (state->rev1 & 0x0f) + '@'; | 865 | msp_revision = (state->rev1 & 0x0f) + '@'; |
865 | msp_hard = ((state->rev1 >> 8) & 0xff) + '@'; | 866 | msp_hard = ((state->rev1 >> 8) & 0xff) + '@'; |
866 | msp_rom = state->rev2 & 0x1f; | 867 | msp_rom = state->rev2 & 0x1f; |
867 | snprintf(client->name, sizeof(client->name), "MSP%d4%02d%c-%c%d", | ||
868 | msp_family, msp_product, | ||
869 | msp_revision, msp_hard, msp_rom); | ||
870 | /* Rev B=2, C=3, D=4, G=7 */ | 868 | /* Rev B=2, C=3, D=4, G=7 */ |
871 | state->ident = msp_family * 10000 + 4000 + msp_product * 10 + | 869 | state->ident = msp_family * 10000 + 4000 + msp_product * 10 + |
872 | msp_revision - '@'; | 870 | msp_revision - '@'; |
@@ -931,7 +929,9 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
931 | } | 929 | } |
932 | 930 | ||
933 | /* hello world :-) */ | 931 | /* hello world :-) */ |
934 | v4l_info(client, "%s found @ 0x%x (%s)\n", client->name, | 932 | v4l_info(client, "MSP%d4%02d%c-%c%d found @ 0x%x (%s)\n", |
933 | msp_family, msp_product, | ||
934 | msp_revision, msp_hard, msp_rom, | ||
935 | client->addr << 1, client->adapter->name); | 935 | client->addr << 1, client->adapter->name); |
936 | v4l_info(client, "%s ", client->name); | 936 | v4l_info(client, "%s ", client->name); |
937 | if (state->has_nicam && state->has_radio) | 937 | if (state->has_nicam && state->has_radio) |
@@ -987,6 +987,12 @@ static int msp_remove(struct i2c_client *client) | |||
987 | 987 | ||
988 | /* ----------------------------------------------------------------------- */ | 988 | /* ----------------------------------------------------------------------- */ |
989 | 989 | ||
990 | static const struct i2c_device_id msp_id[] = { | ||
991 | { "msp3400", 0 }, | ||
992 | { } | ||
993 | }; | ||
994 | MODULE_DEVICE_TABLE(i2c, msp_id); | ||
995 | |||
990 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 996 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
991 | .name = "msp3400", | 997 | .name = "msp3400", |
992 | .driverid = I2C_DRIVERID_MSP3400, | 998 | .driverid = I2C_DRIVERID_MSP3400, |
@@ -995,6 +1001,7 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { | |||
995 | .remove = msp_remove, | 1001 | .remove = msp_remove, |
996 | .suspend = msp_suspend, | 1002 | .suspend = msp_suspend, |
997 | .resume = msp_resume, | 1003 | .resume = msp_resume, |
1004 | .id_table = msp_id, | ||
998 | }; | 1005 | }; |
999 | 1006 | ||
1000 | 1007 | ||
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index e684108637ad..435c083cc542 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
@@ -1456,14 +1456,13 @@ static int saa7115_probe(struct i2c_client *client, | |||
1456 | struct saa711x_state *state; | 1456 | struct saa711x_state *state; |
1457 | int i; | 1457 | int i; |
1458 | char name[17]; | 1458 | char name[17]; |
1459 | u8 chip_id; | 1459 | char chip_id; |
1460 | int autodetect = !id || id->driver_data == 1; | ||
1460 | 1461 | ||
1461 | /* Check if the adapter supports the needed features */ | 1462 | /* Check if the adapter supports the needed features */ |
1462 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 1463 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
1463 | return -EIO; | 1464 | return -EIO; |
1464 | 1465 | ||
1465 | snprintf(client->name, sizeof(client->name) - 1, "saa7115"); | ||
1466 | |||
1467 | for (i = 0; i < 0x0f; i++) { | 1466 | for (i = 0; i < 0x0f; i++) { |
1468 | saa711x_write(client, 0, i); | 1467 | saa711x_write(client, 0, i); |
1469 | name[i] = (saa711x_read(client, 0) & 0x0f) + '0'; | 1468 | name[i] = (saa711x_read(client, 0) & 0x0f) + '0'; |
@@ -1472,8 +1471,7 @@ static int saa7115_probe(struct i2c_client *client, | |||
1472 | } | 1471 | } |
1473 | name[i] = '\0'; | 1472 | name[i] = '\0'; |
1474 | 1473 | ||
1475 | saa711x_write(client, 0, 5); | 1474 | chip_id = name[5]; |
1476 | chip_id = saa711x_read(client, 0) & 0x0f; | ||
1477 | 1475 | ||
1478 | /* Check whether this chip is part of the saa711x series */ | 1476 | /* Check whether this chip is part of the saa711x series */ |
1479 | if (memcmp(name, "1f711", 5)) { | 1477 | if (memcmp(name, "1f711", 5)) { |
@@ -1482,8 +1480,14 @@ static int saa7115_probe(struct i2c_client *client, | |||
1482 | return -ENODEV; | 1480 | return -ENODEV; |
1483 | } | 1481 | } |
1484 | 1482 | ||
1485 | snprintf(client->name, sizeof(client->name) - 1, "saa711%d",chip_id); | 1483 | /* Safety check */ |
1486 | v4l_info(client, "saa711%d found (%s) @ 0x%x (%s)\n", chip_id, name, client->addr << 1, client->adapter->name); | 1484 | if (!autodetect && id->name[6] != chip_id) { |
1485 | v4l_warn(client, "found saa711%c while %s was expected\n", | ||
1486 | chip_id, id->name); | ||
1487 | } | ||
1488 | snprintf(client->name, sizeof(client->name), "saa711%c", chip_id); | ||
1489 | v4l_info(client, "saa711%c found (%s) @ 0x%x (%s)\n", chip_id, name, | ||
1490 | client->addr << 1, client->adapter->name); | ||
1487 | 1491 | ||
1488 | state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL); | 1492 | state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL); |
1489 | i2c_set_clientdata(client, state); | 1493 | i2c_set_clientdata(client, state); |
@@ -1499,19 +1503,19 @@ static int saa7115_probe(struct i2c_client *client, | |||
1499 | state->hue = 0; | 1503 | state->hue = 0; |
1500 | state->sat = 64; | 1504 | state->sat = 64; |
1501 | switch (chip_id) { | 1505 | switch (chip_id) { |
1502 | case 1: | 1506 | case '1': |
1503 | state->ident = V4L2_IDENT_SAA7111; | 1507 | state->ident = V4L2_IDENT_SAA7111; |
1504 | break; | 1508 | break; |
1505 | case 3: | 1509 | case '3': |
1506 | state->ident = V4L2_IDENT_SAA7113; | 1510 | state->ident = V4L2_IDENT_SAA7113; |
1507 | break; | 1511 | break; |
1508 | case 4: | 1512 | case '4': |
1509 | state->ident = V4L2_IDENT_SAA7114; | 1513 | state->ident = V4L2_IDENT_SAA7114; |
1510 | break; | 1514 | break; |
1511 | case 5: | 1515 | case '5': |
1512 | state->ident = V4L2_IDENT_SAA7115; | 1516 | state->ident = V4L2_IDENT_SAA7115; |
1513 | break; | 1517 | break; |
1514 | case 8: | 1518 | case '8': |
1515 | state->ident = V4L2_IDENT_SAA7118; | 1519 | state->ident = V4L2_IDENT_SAA7118; |
1516 | break; | 1520 | break; |
1517 | default: | 1521 | default: |
@@ -1553,6 +1557,17 @@ static int saa7115_remove(struct i2c_client *client) | |||
1553 | return 0; | 1557 | return 0; |
1554 | } | 1558 | } |
1555 | 1559 | ||
1560 | static const struct i2c_device_id saa7115_id[] = { | ||
1561 | { "saa711x", 1 }, /* autodetect */ | ||
1562 | { "saa7111", 0 }, | ||
1563 | { "saa7113", 0 }, | ||
1564 | { "saa7114", 0 }, | ||
1565 | { "saa7115", 0 }, | ||
1566 | { "saa7118", 0 }, | ||
1567 | { } | ||
1568 | }; | ||
1569 | MODULE_DEVICE_TABLE(i2c, saa7115_id); | ||
1570 | |||
1556 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 1571 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
1557 | .name = "saa7115", | 1572 | .name = "saa7115", |
1558 | .driverid = I2C_DRIVERID_SAA711X, | 1573 | .driverid = I2C_DRIVERID_SAA711X, |
@@ -1560,5 +1575,6 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { | |||
1560 | .probe = saa7115_probe, | 1575 | .probe = saa7115_probe, |
1561 | .remove = saa7115_remove, | 1576 | .remove = saa7115_remove, |
1562 | .legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL, | 1577 | .legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL, |
1578 | .id_table = saa7115_id, | ||
1563 | }; | 1579 | }; |
1564 | 1580 | ||
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c index e750cd65c1c3..79d11a658bdf 100644 --- a/drivers/media/video/saa7127.c +++ b/drivers/media/video/saa7127.c | |||
@@ -672,8 +672,6 @@ static int saa7127_probe(struct i2c_client *client, | |||
672 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 672 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
673 | return -EIO; | 673 | return -EIO; |
674 | 674 | ||
675 | snprintf(client->name, sizeof(client->name) - 1, "saa7127"); | ||
676 | |||
677 | v4l_dbg(1, debug, client, "detecting saa7127 client on address 0x%x\n", | 675 | v4l_dbg(1, debug, client, "detecting saa7127 client on address 0x%x\n", |
678 | client->addr << 1); | 676 | client->addr << 1); |
679 | 677 | ||
@@ -741,11 +739,18 @@ static int saa7127_remove(struct i2c_client *client) | |||
741 | 739 | ||
742 | /* ----------------------------------------------------------------------- */ | 740 | /* ----------------------------------------------------------------------- */ |
743 | 741 | ||
742 | static struct i2c_device_id saa7127_id[] = { | ||
743 | { "saa7127", 0 }, | ||
744 | { } | ||
745 | }; | ||
746 | MODULE_DEVICE_TABLE(i2c, saa7127_id); | ||
747 | |||
744 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 748 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
745 | .name = "saa7127", | 749 | .name = "saa7127", |
746 | .driverid = I2C_DRIVERID_SAA7127, | 750 | .driverid = I2C_DRIVERID_SAA7127, |
747 | .command = saa7127_command, | 751 | .command = saa7127_command, |
748 | .probe = saa7127_probe, | 752 | .probe = saa7127_probe, |
749 | .remove = saa7127_remove, | 753 | .remove = saa7127_remove, |
754 | .id_table = saa7127_id, | ||
750 | }; | 755 | }; |
751 | 756 | ||
diff --git a/drivers/media/video/saa717x.c b/drivers/media/video/saa717x.c index 72c4081feff5..2220f9569941 100644 --- a/drivers/media/video/saa717x.c +++ b/drivers/media/video/saa717x.c | |||
@@ -1429,8 +1429,6 @@ static int saa717x_probe(struct i2c_client *client, | |||
1429 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 1429 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
1430 | return -EIO; | 1430 | return -EIO; |
1431 | 1431 | ||
1432 | snprintf(client->name, sizeof(client->name) - 1, "saa717x"); | ||
1433 | |||
1434 | if (saa717x_write(client, 0x5a4, 0xfe) && | 1432 | if (saa717x_write(client, 0x5a4, 0xfe) && |
1435 | saa717x_write(client, 0x5a5, 0x0f) && | 1433 | saa717x_write(client, 0x5a5, 0x0f) && |
1436 | saa717x_write(client, 0x5a6, 0x00) && | 1434 | saa717x_write(client, 0x5a6, 0x00) && |
@@ -1507,6 +1505,12 @@ static int saa717x_remove(struct i2c_client *client) | |||
1507 | 1505 | ||
1508 | /* ----------------------------------------------------------------------- */ | 1506 | /* ----------------------------------------------------------------------- */ |
1509 | 1507 | ||
1508 | static const struct i2c_device_id saa717x_id[] = { | ||
1509 | { "saa717x", 0 }, | ||
1510 | { } | ||
1511 | }; | ||
1512 | MODULE_DEVICE_TABLE(i2c, saa717x_id); | ||
1513 | |||
1510 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 1514 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
1511 | .name = "saa717x", | 1515 | .name = "saa717x", |
1512 | .driverid = I2C_DRIVERID_SAA717X, | 1516 | .driverid = I2C_DRIVERID_SAA717X, |
@@ -1514,4 +1518,5 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { | |||
1514 | .probe = saa717x_probe, | 1518 | .probe = saa717x_probe, |
1515 | .remove = saa717x_remove, | 1519 | .remove = saa717x_remove, |
1516 | .legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL, | 1520 | .legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL, |
1521 | .id_table = saa717x_id, | ||
1517 | }; | 1522 | }; |
diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c index 5748b1e1a128..7f9c7bcf3c85 100644 --- a/drivers/media/video/sn9c102/sn9c102_core.c +++ b/drivers/media/video/sn9c102/sn9c102_core.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <linux/mm.h> | 34 | #include <linux/mm.h> |
35 | #include <linux/vmalloc.h> | 35 | #include <linux/vmalloc.h> |
36 | #include <linux/page-flags.h> | 36 | #include <linux/page-flags.h> |
37 | #include <linux/byteorder/generic.h> | 37 | #include <asm/byteorder.h> |
38 | #include <asm/page.h> | 38 | #include <asm/page.h> |
39 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
40 | 40 | ||
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 5a75788b92ae..a0f7bc1edaa2 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -92,6 +92,7 @@ struct tuner { | |||
92 | unsigned int type; /* chip type id */ | 92 | unsigned int type; /* chip type id */ |
93 | unsigned int config; | 93 | unsigned int config; |
94 | int (*tuner_callback) (void *dev, int command, int arg); | 94 | int (*tuner_callback) (void *dev, int command, int arg); |
95 | const char *name; | ||
95 | }; | 96 | }; |
96 | 97 | ||
97 | /* standard i2c insmod options */ | 98 | /* standard i2c insmod options */ |
@@ -330,13 +331,13 @@ static void tuner_i2c_address_check(struct tuner *t) | |||
330 | tuner_warn("Support for tuners in i2c address range 0x64 thru 0x6f\n"); | 331 | tuner_warn("Support for tuners in i2c address range 0x64 thru 0x6f\n"); |
331 | tuner_warn("will soon be dropped. This message indicates that your\n"); | 332 | tuner_warn("will soon be dropped. This message indicates that your\n"); |
332 | tuner_warn("hardware has a %s tuner at i2c address 0x%02x.\n", | 333 | tuner_warn("hardware has a %s tuner at i2c address 0x%02x.\n", |
333 | t->i2c->name, t->i2c->addr); | 334 | t->name, t->i2c->addr); |
334 | tuner_warn("To ensure continued support for your device, please\n"); | 335 | tuner_warn("To ensure continued support for your device, please\n"); |
335 | tuner_warn("send a copy of this message, along with full dmesg\n"); | 336 | tuner_warn("send a copy of this message, along with full dmesg\n"); |
336 | tuner_warn("output to v4l-dvb-maintainer@linuxtv.org\n"); | 337 | tuner_warn("output to v4l-dvb-maintainer@linuxtv.org\n"); |
337 | tuner_warn("Please use subject line: \"obsolete tuner i2c address.\"\n"); | 338 | tuner_warn("Please use subject line: \"obsolete tuner i2c address.\"\n"); |
338 | tuner_warn("driver: %s, addr: 0x%02x, type: %d (%s)\n", | 339 | tuner_warn("driver: %s, addr: 0x%02x, type: %d (%s)\n", |
339 | t->i2c->adapter->name, t->i2c->addr, t->type, t->i2c->name); | 340 | t->i2c->adapter->name, t->i2c->addr, t->type, t->name); |
340 | tuner_warn("====================== WARNING! ======================\n"); | 341 | tuner_warn("====================== WARNING! ======================\n"); |
341 | } | 342 | } |
342 | 343 | ||
@@ -470,19 +471,17 @@ static void set_type(struct i2c_client *c, unsigned int type, | |||
470 | if ((NULL == analog_ops->set_params) && | 471 | if ((NULL == analog_ops->set_params) && |
471 | (fe_tuner_ops->set_analog_params)) { | 472 | (fe_tuner_ops->set_analog_params)) { |
472 | 473 | ||
473 | strlcpy(t->i2c->name, fe_tuner_ops->info.name, | 474 | t->name = fe_tuner_ops->info.name; |
474 | sizeof(t->i2c->name)); | ||
475 | 475 | ||
476 | t->fe.analog_demod_priv = t; | 476 | t->fe.analog_demod_priv = t; |
477 | memcpy(analog_ops, &tuner_core_ops, | 477 | memcpy(analog_ops, &tuner_core_ops, |
478 | sizeof(struct analog_demod_ops)); | 478 | sizeof(struct analog_demod_ops)); |
479 | 479 | ||
480 | } else { | 480 | } else { |
481 | strlcpy(t->i2c->name, analog_ops->info.name, | 481 | t->name = analog_ops->info.name; |
482 | sizeof(t->i2c->name)); | ||
483 | } | 482 | } |
484 | 483 | ||
485 | tuner_dbg("type set to %s\n", t->i2c->name); | 484 | tuner_dbg("type set to %s\n", t->name); |
486 | 485 | ||
487 | if (t->mode_mask == T_UNINITIALIZED) | 486 | if (t->mode_mask == T_UNINITIALIZED) |
488 | t->mode_mask = new_mode_mask; | 487 | t->mode_mask = new_mode_mask; |
@@ -1115,7 +1114,7 @@ static int tuner_probe(struct i2c_client *client, | |||
1115 | if (NULL == t) | 1114 | if (NULL == t) |
1116 | return -ENOMEM; | 1115 | return -ENOMEM; |
1117 | t->i2c = client; | 1116 | t->i2c = client; |
1118 | strlcpy(client->name, "(tuner unset)", sizeof(client->name)); | 1117 | t->name = "(tuner unset)"; |
1119 | i2c_set_clientdata(client, t); | 1118 | i2c_set_clientdata(client, t); |
1120 | t->type = UNSET; | 1119 | t->type = UNSET; |
1121 | t->audmode = V4L2_TUNER_MODE_STEREO; | 1120 | t->audmode = V4L2_TUNER_MODE_STEREO; |
@@ -1278,6 +1277,15 @@ static int tuner_remove(struct i2c_client *client) | |||
1278 | 1277 | ||
1279 | /* ----------------------------------------------------------------------- */ | 1278 | /* ----------------------------------------------------------------------- */ |
1280 | 1279 | ||
1280 | /* This driver supports many devices and the idea is to let the driver | ||
1281 | detect which device is present. So rather than listing all supported | ||
1282 | devices here, we pretend to support a single, fake device type. */ | ||
1283 | static const struct i2c_device_id tuner_id[] = { | ||
1284 | { "tuner", }, /* autodetect */ | ||
1285 | { } | ||
1286 | }; | ||
1287 | MODULE_DEVICE_TABLE(i2c, tuner_id); | ||
1288 | |||
1281 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 1289 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
1282 | .name = "tuner", | 1290 | .name = "tuner", |
1283 | .driverid = I2C_DRIVERID_TUNER, | 1291 | .driverid = I2C_DRIVERID_TUNER, |
@@ -1287,6 +1295,7 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { | |||
1287 | .suspend = tuner_suspend, | 1295 | .suspend = tuner_suspend, |
1288 | .resume = tuner_resume, | 1296 | .resume = tuner_resume, |
1289 | .legacy_probe = tuner_legacy_probe, | 1297 | .legacy_probe = tuner_legacy_probe, |
1298 | .id_table = tuner_id, | ||
1290 | }; | 1299 | }; |
1291 | 1300 | ||
1292 | 1301 | ||
diff --git a/drivers/media/video/upd64031a.c b/drivers/media/video/upd64031a.c index 93bfd19dec7d..b4628874933b 100644 --- a/drivers/media/video/upd64031a.c +++ b/drivers/media/video/upd64031a.c | |||
@@ -228,6 +228,11 @@ static int upd64031a_remove(struct i2c_client *client) | |||
228 | 228 | ||
229 | /* ----------------------------------------------------------------------- */ | 229 | /* ----------------------------------------------------------------------- */ |
230 | 230 | ||
231 | static const struct i2c_device_id upd64031a_id[] = { | ||
232 | { "upd64031a", 0 }, | ||
233 | { } | ||
234 | }; | ||
235 | MODULE_DEVICE_TABLE(i2c, upd64031a_id); | ||
231 | 236 | ||
232 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 237 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
233 | .name = "upd64031a", | 238 | .name = "upd64031a", |
@@ -235,4 +240,5 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { | |||
235 | .command = upd64031a_command, | 240 | .command = upd64031a_command, |
236 | .probe = upd64031a_probe, | 241 | .probe = upd64031a_probe, |
237 | .remove = upd64031a_remove, | 242 | .remove = upd64031a_remove, |
243 | .id_table = upd64031a_id, | ||
238 | }; | 244 | }; |
diff --git a/drivers/media/video/upd64083.c b/drivers/media/video/upd64083.c index 9ab712a56ce0..9521ce004dcc 100644 --- a/drivers/media/video/upd64083.c +++ b/drivers/media/video/upd64083.c | |||
@@ -205,6 +205,11 @@ static int upd64083_remove(struct i2c_client *client) | |||
205 | 205 | ||
206 | /* ----------------------------------------------------------------------- */ | 206 | /* ----------------------------------------------------------------------- */ |
207 | 207 | ||
208 | static const struct i2c_device_id upd64083_id[] = { | ||
209 | { "upd64083", 0 }, | ||
210 | { } | ||
211 | }; | ||
212 | MODULE_DEVICE_TABLE(i2c, upd64083_id); | ||
208 | 213 | ||
209 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 214 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
210 | .name = "upd64083", | 215 | .name = "upd64083", |
@@ -212,4 +217,5 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = { | |||
212 | .command = upd64083_command, | 217 | .command = upd64083_command, |
213 | .probe = upd64083_probe, | 218 | .probe = upd64083_probe, |
214 | .remove = upd64083_remove, | 219 | .remove = upd64083_remove, |
220 | .id_table = upd64083_id, | ||
215 | }; | 221 | }; |
diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index 982f4463896c..0a88c44ace00 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c | |||
@@ -331,7 +331,7 @@ int videobuf_mmap_free(struct videobuf_queue *q) | |||
331 | } | 331 | } |
332 | 332 | ||
333 | /* Locking: Caller holds q->vb_lock */ | 333 | /* Locking: Caller holds q->vb_lock */ |
334 | static int __videobuf_mmap_setup(struct videobuf_queue *q, | 334 | int __videobuf_mmap_setup(struct videobuf_queue *q, |
335 | unsigned int bcount, unsigned int bsize, | 335 | unsigned int bcount, unsigned int bsize, |
336 | enum v4l2_memory memory) | 336 | enum v4l2_memory memory) |
337 | { | 337 | { |
@@ -1129,6 +1129,7 @@ EXPORT_SYMBOL_GPL(videobuf_read_stream); | |||
1129 | EXPORT_SYMBOL_GPL(videobuf_read_one); | 1129 | EXPORT_SYMBOL_GPL(videobuf_read_one); |
1130 | EXPORT_SYMBOL_GPL(videobuf_poll_stream); | 1130 | EXPORT_SYMBOL_GPL(videobuf_poll_stream); |
1131 | 1131 | ||
1132 | EXPORT_SYMBOL_GPL(__videobuf_mmap_setup); | ||
1132 | EXPORT_SYMBOL_GPL(videobuf_mmap_setup); | 1133 | EXPORT_SYMBOL_GPL(videobuf_mmap_setup); |
1133 | EXPORT_SYMBOL_GPL(videobuf_mmap_free); | 1134 | EXPORT_SYMBOL_GPL(videobuf_mmap_free); |
1134 | EXPORT_SYMBOL_GPL(videobuf_mmap_mapper); | 1135 | EXPORT_SYMBOL_GPL(videobuf_mmap_mapper); |
diff --git a/drivers/media/video/vp27smpx.c b/drivers/media/video/vp27smpx.c index fac0deba24af..a1f76ee032e7 100644 --- a/drivers/media/video/vp27smpx.c +++ b/drivers/media/video/vp27smpx.c | |||
@@ -130,8 +130,6 @@ static int vp27smpx_probe(struct i2c_client *client, | |||
130 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 130 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
131 | return -EIO; | 131 | return -EIO; |
132 | 132 | ||
133 | snprintf(client->name, sizeof(client->name) - 1, "vp27smpx"); | ||
134 | |||
135 | v4l_info(client, "chip found @ 0x%x (%s)\n", | 133 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
136 | client->addr << 1, client->adapter->name); | 134 | client->addr << 1, client->adapter->name); |
137 | 135 | ||
@@ -154,11 +152,18 @@ static int vp27smpx_remove(struct i2c_client *client) | |||
154 | 152 | ||
155 | /* ----------------------------------------------------------------------- */ | 153 | /* ----------------------------------------------------------------------- */ |
156 | 154 | ||
155 | static const struct i2c_device_id vp27smpx_id[] = { | ||
156 | { "vp27smpx", 0 }, | ||
157 | { } | ||
158 | }; | ||
159 | MODULE_DEVICE_TABLE(i2c, vp27smpx_id); | ||
160 | |||
157 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 161 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
158 | .name = "vp27smpx", | 162 | .name = "vp27smpx", |
159 | .driverid = I2C_DRIVERID_VP27SMPX, | 163 | .driverid = I2C_DRIVERID_VP27SMPX, |
160 | .command = vp27smpx_command, | 164 | .command = vp27smpx_command, |
161 | .probe = vp27smpx_probe, | 165 | .probe = vp27smpx_probe, |
162 | .remove = vp27smpx_remove, | 166 | .remove = vp27smpx_remove, |
167 | .id_table = vp27smpx_id, | ||
163 | }; | 168 | }; |
164 | 169 | ||
diff --git a/drivers/media/video/wm8739.c b/drivers/media/video/wm8739.c index 0f8ed8461fba..fc50299caa36 100644 --- a/drivers/media/video/wm8739.c +++ b/drivers/media/video/wm8739.c | |||
@@ -313,11 +313,18 @@ static int wm8739_remove(struct i2c_client *client) | |||
313 | return 0; | 313 | return 0; |
314 | } | 314 | } |
315 | 315 | ||
316 | static const struct i2c_device_id wm8739_id[] = { | ||
317 | { "wm8739", 0 }, | ||
318 | { } | ||
319 | }; | ||
320 | MODULE_DEVICE_TABLE(i2c, wm8739_id); | ||
321 | |||
316 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 322 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
317 | .name = "wm8739", | 323 | .name = "wm8739", |
318 | .driverid = I2C_DRIVERID_WM8739, | 324 | .driverid = I2C_DRIVERID_WM8739, |
319 | .command = wm8739_command, | 325 | .command = wm8739_command, |
320 | .probe = wm8739_probe, | 326 | .probe = wm8739_probe, |
321 | .remove = wm8739_remove, | 327 | .remove = wm8739_remove, |
328 | .id_table = wm8739_id, | ||
322 | }; | 329 | }; |
323 | 330 | ||
diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c index 67a409e60c46..506378a508b9 100644 --- a/drivers/media/video/wm8775.c +++ b/drivers/media/video/wm8775.c | |||
@@ -216,11 +216,18 @@ static int wm8775_remove(struct i2c_client *client) | |||
216 | return 0; | 216 | return 0; |
217 | } | 217 | } |
218 | 218 | ||
219 | static const struct i2c_device_id wm8775_id[] = { | ||
220 | { "wm8775", 0 }, | ||
221 | { } | ||
222 | }; | ||
223 | MODULE_DEVICE_TABLE(i2c, wm8775_id); | ||
224 | |||
219 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 225 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
220 | .name = "wm8775", | 226 | .name = "wm8775", |
221 | .driverid = I2C_DRIVERID_WM8775, | 227 | .driverid = I2C_DRIVERID_WM8775, |
222 | .command = wm8775_command, | 228 | .command = wm8775_command, |
223 | .probe = wm8775_probe, | 229 | .probe = wm8775_probe, |
224 | .remove = wm8775_remove, | 230 | .remove = wm8775_remove, |
231 | .id_table = wm8775_id, | ||
225 | }; | 232 | }; |
226 | 233 | ||
diff --git a/drivers/media/video/zc0301/zc0301_core.c b/drivers/media/video/zc0301/zc0301_core.c index 363dd2b9475c..e5c4e9f5193f 100644 --- a/drivers/media/video/zc0301/zc0301_core.c +++ b/drivers/media/video/zc0301/zc0301_core.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #include <linux/mm.h> | 38 | #include <linux/mm.h> |
39 | #include <linux/vmalloc.h> | 39 | #include <linux/vmalloc.h> |
40 | #include <linux/page-flags.h> | 40 | #include <linux/page-flags.h> |
41 | #include <linux/byteorder/generic.h> | 41 | #include <asm/byteorder.h> |
42 | #include <asm/page.h> | 42 | #include <asm/page.h> |
43 | #include <asm/uaccess.h> | 43 | #include <asm/uaccess.h> |
44 | 44 | ||
diff --git a/drivers/media/video/zoran_device.c b/drivers/media/video/zoran_device.c index 7b60533efe45..37629ffd34c3 100644 --- a/drivers/media/video/zoran_device.c +++ b/drivers/media/video/zoran_device.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/vmalloc.h> | 33 | #include <linux/vmalloc.h> |
34 | #include <linux/byteorder/generic.h> | ||
35 | 34 | ||
36 | #include <linux/interrupt.h> | 35 | #include <linux/interrupt.h> |
37 | #include <linux/proc_fs.h> | 36 | #include <linux/proc_fs.h> |
@@ -47,6 +46,7 @@ | |||
47 | #include <linux/delay.h> | 46 | #include <linux/delay.h> |
48 | #include <linux/wait.h> | 47 | #include <linux/wait.h> |
49 | 48 | ||
49 | #include <asm/byteorder.h> | ||
50 | #include <asm/io.h> | 50 | #include <asm/io.h> |
51 | 51 | ||
52 | #include "videocodec.h" | 52 | #include "videocodec.h" |
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index 0134bec1e399..345c77e46837 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c | |||
@@ -52,7 +52,6 @@ | |||
52 | #include <linux/pci.h> | 52 | #include <linux/pci.h> |
53 | #include <linux/vmalloc.h> | 53 | #include <linux/vmalloc.h> |
54 | #include <linux/wait.h> | 54 | #include <linux/wait.h> |
55 | #include <linux/byteorder/generic.h> | ||
56 | 55 | ||
57 | #include <linux/interrupt.h> | 56 | #include <linux/interrupt.h> |
58 | #include <linux/i2c.h> | 57 | #include <linux/i2c.h> |
@@ -74,6 +73,7 @@ | |||
74 | #include <media/v4l2-common.h> | 73 | #include <media/v4l2-common.h> |
75 | #include "videocodec.h" | 74 | #include "videocodec.h" |
76 | 75 | ||
76 | #include <asm/byteorder.h> | ||
77 | #include <asm/io.h> | 77 | #include <asm/io.h> |
78 | #include <asm/uaccess.h> | 78 | #include <asm/uaccess.h> |
79 | #include <linux/proc_fs.h> | 79 | #include <linux/proc_fs.h> |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 2566479937c9..ae96bd6242f2 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -24,7 +24,7 @@ config MFD_ASIC3 | |||
24 | 24 | ||
25 | config HTC_EGPIO | 25 | config HTC_EGPIO |
26 | bool "HTC EGPIO support" | 26 | bool "HTC EGPIO support" |
27 | depends on GENERIC_HARDIRQS && HAVE_GPIO_LIB | 27 | depends on GENERIC_HARDIRQS && HAVE_GPIO_LIB && ARM |
28 | help | 28 | help |
29 | This driver supports the CPLD egpio chip present on | 29 | This driver supports the CPLD egpio chip present on |
30 | several HTC phones. It provides basic support for input | 30 | several HTC phones. It provides basic support for input |
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index 3f28f6eabdbf..a0ce0b2fa03e 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
@@ -3821,7 +3821,7 @@ TPACPI_HANDLE(led, ec, "SLED", /* 570 */ | |||
3821 | #define TPACPI_LED_NUMLEDS 8 | 3821 | #define TPACPI_LED_NUMLEDS 8 |
3822 | static struct tpacpi_led_classdev *tpacpi_leds; | 3822 | static struct tpacpi_led_classdev *tpacpi_leds; |
3823 | static enum led_status_t tpacpi_led_state_cache[TPACPI_LED_NUMLEDS]; | 3823 | static enum led_status_t tpacpi_led_state_cache[TPACPI_LED_NUMLEDS]; |
3824 | static const char const *tpacpi_led_names[TPACPI_LED_NUMLEDS] = { | 3824 | static const char * const tpacpi_led_names[TPACPI_LED_NUMLEDS] = { |
3825 | /* there's a limit of 19 chars + NULL before 2.6.26 */ | 3825 | /* there's a limit of 19 chars + NULL before 2.6.26 */ |
3826 | "tpacpi::power", | 3826 | "tpacpi::power", |
3827 | "tpacpi:orange:batt", | 3827 | "tpacpi:orange:batt", |
@@ -3860,10 +3860,10 @@ static int led_get_status(unsigned int led) | |||
3860 | static int led_set_status(unsigned int led, enum led_status_t ledstatus) | 3860 | static int led_set_status(unsigned int led, enum led_status_t ledstatus) |
3861 | { | 3861 | { |
3862 | /* off, on, blink. Index is led_status_t */ | 3862 | /* off, on, blink. Index is led_status_t */ |
3863 | static const int const led_sled_arg1[] = { 0, 1, 3 }; | 3863 | static const int led_sled_arg1[] = { 0, 1, 3 }; |
3864 | static const int const led_exp_hlbl[] = { 0, 0, 1 }; /* led# * */ | 3864 | static const int led_exp_hlbl[] = { 0, 0, 1 }; /* led# * */ |
3865 | static const int const led_exp_hlcl[] = { 0, 1, 1 }; /* led# * */ | 3865 | static const int led_exp_hlcl[] = { 0, 1, 1 }; /* led# * */ |
3866 | static const int const led_led_arg1[] = { 0, 0x80, 0xc0 }; | 3866 | static const int led_led_arg1[] = { 0, 0x80, 0xc0 }; |
3867 | 3867 | ||
3868 | int rc = 0; | 3868 | int rc = 0; |
3869 | 3869 | ||
diff --git a/drivers/mmc/card/Kconfig b/drivers/mmc/card/Kconfig index aa8a4e461942..dd0f398ee2f5 100644 --- a/drivers/mmc/card/Kconfig +++ b/drivers/mmc/card/Kconfig | |||
@@ -39,3 +39,15 @@ config SDIO_UART | |||
39 | SDIO function driver for SDIO cards that implements the UART | 39 | SDIO function driver for SDIO cards that implements the UART |
40 | class, as well as the GPS class which appears like a UART. | 40 | class, as well as the GPS class which appears like a UART. |
41 | 41 | ||
42 | config MMC_TEST | ||
43 | tristate "MMC host test driver" | ||
44 | default n | ||
45 | help | ||
46 | Development driver that performs a series of reads and writes | ||
47 | to a memory card in order to expose certain well known bugs | ||
48 | in host controllers. The tests are executed by writing to the | ||
49 | "test" file in sysfs under each card. Note that whatever is | ||
50 | on your card will be overwritten by these tests. | ||
51 | |||
52 | This driver is only of interest to those developing or | ||
53 | testing a host driver. Most people should say N here. | ||
diff --git a/drivers/mmc/card/Makefile b/drivers/mmc/card/Makefile index fc5a784cfa1a..0d407514f67d 100644 --- a/drivers/mmc/card/Makefile +++ b/drivers/mmc/card/Makefile | |||
@@ -8,6 +8,7 @@ endif | |||
8 | 8 | ||
9 | obj-$(CONFIG_MMC_BLOCK) += mmc_block.o | 9 | obj-$(CONFIG_MMC_BLOCK) += mmc_block.o |
10 | mmc_block-objs := block.o queue.o | 10 | mmc_block-objs := block.o queue.o |
11 | obj-$(CONFIG_MMC_TEST) += mmc_test.o | ||
11 | 12 | ||
12 | obj-$(CONFIG_SDIO_UART) += sdio_uart.o | 13 | obj-$(CONFIG_SDIO_UART) += sdio_uart.o |
13 | 14 | ||
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c new file mode 100644 index 000000000000..ffadee549a41 --- /dev/null +++ b/drivers/mmc/card/mmc_test.c | |||
@@ -0,0 +1,892 @@ | |||
1 | /* | ||
2 | * linux/drivers/mmc/card/mmc_test.c | ||
3 | * | ||
4 | * Copyright 2007 Pierre Ossman | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or (at | ||
9 | * your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/mmc/core.h> | ||
13 | #include <linux/mmc/card.h> | ||
14 | #include <linux/mmc/host.h> | ||
15 | #include <linux/mmc/mmc.h> | ||
16 | |||
17 | #include <linux/scatterlist.h> | ||
18 | |||
19 | #define RESULT_OK 0 | ||
20 | #define RESULT_FAIL 1 | ||
21 | #define RESULT_UNSUP_HOST 2 | ||
22 | #define RESULT_UNSUP_CARD 3 | ||
23 | |||
24 | #define BUFFER_SIZE (PAGE_SIZE * 4) | ||
25 | |||
26 | struct mmc_test_card { | ||
27 | struct mmc_card *card; | ||
28 | |||
29 | u8 *buffer; | ||
30 | }; | ||
31 | |||
32 | /*******************************************************************/ | ||
33 | /* Helper functions */ | ||
34 | /*******************************************************************/ | ||
35 | |||
36 | static int mmc_test_set_blksize(struct mmc_test_card *test, unsigned size) | ||
37 | { | ||
38 | struct mmc_command cmd; | ||
39 | int ret; | ||
40 | |||
41 | cmd.opcode = MMC_SET_BLOCKLEN; | ||
42 | cmd.arg = size; | ||
43 | cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; | ||
44 | ret = mmc_wait_for_cmd(test->card->host, &cmd, 0); | ||
45 | if (ret) | ||
46 | return ret; | ||
47 | |||
48 | return 0; | ||
49 | } | ||
50 | |||
51 | static int __mmc_test_transfer(struct mmc_test_card *test, int write, | ||
52 | unsigned broken_xfer, u8 *buffer, unsigned addr, | ||
53 | unsigned blocks, unsigned blksz) | ||
54 | { | ||
55 | int ret, busy; | ||
56 | |||
57 | struct mmc_request mrq; | ||
58 | struct mmc_command cmd; | ||
59 | struct mmc_command stop; | ||
60 | struct mmc_data data; | ||
61 | |||
62 | struct scatterlist sg; | ||
63 | |||
64 | memset(&mrq, 0, sizeof(struct mmc_request)); | ||
65 | |||
66 | mrq.cmd = &cmd; | ||
67 | mrq.data = &data; | ||
68 | |||
69 | memset(&cmd, 0, sizeof(struct mmc_command)); | ||
70 | |||
71 | if (broken_xfer) { | ||
72 | if (blocks > 1) { | ||
73 | cmd.opcode = write ? | ||
74 | MMC_WRITE_BLOCK : MMC_READ_SINGLE_BLOCK; | ||
75 | } else { | ||
76 | cmd.opcode = MMC_SEND_STATUS; | ||
77 | } | ||
78 | } else { | ||
79 | if (blocks > 1) { | ||
80 | cmd.opcode = write ? | ||
81 | MMC_WRITE_MULTIPLE_BLOCK : MMC_READ_MULTIPLE_BLOCK; | ||
82 | } else { | ||
83 | cmd.opcode = write ? | ||
84 | MMC_WRITE_BLOCK : MMC_READ_SINGLE_BLOCK; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | if (broken_xfer && blocks == 1) | ||
89 | cmd.arg = test->card->rca << 16; | ||
90 | else | ||
91 | cmd.arg = addr; | ||
92 | cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC; | ||
93 | |||
94 | memset(&stop, 0, sizeof(struct mmc_command)); | ||
95 | |||
96 | if (!broken_xfer && (blocks > 1)) { | ||
97 | stop.opcode = MMC_STOP_TRANSMISSION; | ||
98 | stop.arg = 0; | ||
99 | stop.flags = MMC_RSP_R1B | MMC_CMD_AC; | ||
100 | |||
101 | mrq.stop = &stop; | ||
102 | } | ||
103 | |||
104 | memset(&data, 0, sizeof(struct mmc_data)); | ||
105 | |||
106 | data.blksz = blksz; | ||
107 | data.blocks = blocks; | ||
108 | data.flags = write ? MMC_DATA_WRITE : MMC_DATA_READ; | ||
109 | data.sg = &sg; | ||
110 | data.sg_len = 1; | ||
111 | |||
112 | sg_init_one(&sg, buffer, blocks * blksz); | ||
113 | |||
114 | mmc_set_data_timeout(&data, test->card); | ||
115 | |||
116 | mmc_wait_for_req(test->card->host, &mrq); | ||
117 | |||
118 | ret = 0; | ||
119 | |||
120 | if (broken_xfer) { | ||
121 | if (!ret && cmd.error) | ||
122 | ret = cmd.error; | ||
123 | if (!ret && data.error == 0) | ||
124 | ret = RESULT_FAIL; | ||
125 | if (!ret && data.error != -ETIMEDOUT) | ||
126 | ret = data.error; | ||
127 | if (!ret && stop.error) | ||
128 | ret = stop.error; | ||
129 | if (blocks > 1) { | ||
130 | if (!ret && data.bytes_xfered > blksz) | ||
131 | ret = RESULT_FAIL; | ||
132 | } else { | ||
133 | if (!ret && data.bytes_xfered > 0) | ||
134 | ret = RESULT_FAIL; | ||
135 | } | ||
136 | } else { | ||
137 | if (!ret && cmd.error) | ||
138 | ret = cmd.error; | ||
139 | if (!ret && data.error) | ||
140 | ret = data.error; | ||
141 | if (!ret && stop.error) | ||
142 | ret = stop.error; | ||
143 | if (!ret && data.bytes_xfered != blocks * blksz) | ||
144 | ret = RESULT_FAIL; | ||
145 | } | ||
146 | |||
147 | if (ret == -EINVAL) | ||
148 | ret = RESULT_UNSUP_HOST; | ||
149 | |||
150 | busy = 0; | ||
151 | do { | ||
152 | int ret2; | ||
153 | |||
154 | memset(&cmd, 0, sizeof(struct mmc_command)); | ||
155 | |||
156 | cmd.opcode = MMC_SEND_STATUS; | ||
157 | cmd.arg = test->card->rca << 16; | ||
158 | cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; | ||
159 | |||
160 | ret2 = mmc_wait_for_cmd(test->card->host, &cmd, 0); | ||
161 | if (ret2) | ||
162 | break; | ||
163 | |||
164 | if (!busy && !(cmd.resp[0] & R1_READY_FOR_DATA)) { | ||
165 | busy = 1; | ||
166 | printk(KERN_INFO "%s: Warning: Host did not " | ||
167 | "wait for busy state to end.\n", | ||
168 | mmc_hostname(test->card->host)); | ||
169 | } | ||
170 | } while (!(cmd.resp[0] & R1_READY_FOR_DATA)); | ||
171 | |||
172 | return ret; | ||
173 | } | ||
174 | |||
175 | static int mmc_test_transfer(struct mmc_test_card *test, int write, | ||
176 | u8 *buffer, unsigned addr, unsigned blocks, unsigned blksz) | ||
177 | { | ||
178 | return __mmc_test_transfer(test, write, 0, buffer, | ||
179 | addr, blocks, blksz); | ||
180 | } | ||
181 | |||
182 | static int mmc_test_prepare_verify(struct mmc_test_card *test, int write) | ||
183 | { | ||
184 | int ret, i; | ||
185 | |||
186 | ret = mmc_test_set_blksize(test, 512); | ||
187 | if (ret) | ||
188 | return ret; | ||
189 | |||
190 | if (write) | ||
191 | memset(test->buffer, 0xDF, BUFFER_SIZE); | ||
192 | else { | ||
193 | for (i = 0;i < BUFFER_SIZE;i++) | ||
194 | test->buffer[i] = i; | ||
195 | } | ||
196 | |||
197 | for (i = 0;i < BUFFER_SIZE / 512;i++) { | ||
198 | ret = mmc_test_transfer(test, 1, test->buffer + i * 512, | ||
199 | i * 512, 1, 512); | ||
200 | if (ret) | ||
201 | return ret; | ||
202 | } | ||
203 | |||
204 | return 0; | ||
205 | } | ||
206 | |||
207 | static int mmc_test_prepare_verify_write(struct mmc_test_card *test) | ||
208 | { | ||
209 | return mmc_test_prepare_verify(test, 1); | ||
210 | } | ||
211 | |||
212 | static int mmc_test_prepare_verify_read(struct mmc_test_card *test) | ||
213 | { | ||
214 | return mmc_test_prepare_verify(test, 0); | ||
215 | } | ||
216 | |||
217 | static int mmc_test_verified_transfer(struct mmc_test_card *test, int write, | ||
218 | u8 *buffer, unsigned addr, unsigned blocks, unsigned blksz) | ||
219 | { | ||
220 | int ret, i, sectors; | ||
221 | |||
222 | /* | ||
223 | * It is assumed that the above preparation has been done. | ||
224 | */ | ||
225 | |||
226 | memset(test->buffer, 0, BUFFER_SIZE); | ||
227 | |||
228 | if (write) { | ||
229 | for (i = 0;i < blocks * blksz;i++) | ||
230 | buffer[i] = i; | ||
231 | } | ||
232 | |||
233 | ret = mmc_test_set_blksize(test, blksz); | ||
234 | if (ret) | ||
235 | return ret; | ||
236 | |||
237 | ret = mmc_test_transfer(test, write, buffer, addr, blocks, blksz); | ||
238 | if (ret) | ||
239 | return ret; | ||
240 | |||
241 | if (write) { | ||
242 | ret = mmc_test_set_blksize(test, 512); | ||
243 | if (ret) | ||
244 | return ret; | ||
245 | |||
246 | sectors = (blocks * blksz + 511) / 512; | ||
247 | if ((sectors * 512) == (blocks * blksz)) | ||
248 | sectors++; | ||
249 | |||
250 | if ((sectors * 512) > BUFFER_SIZE) | ||
251 | return -EINVAL; | ||
252 | |||
253 | memset(test->buffer, 0, sectors * 512); | ||
254 | |||
255 | for (i = 0;i < sectors;i++) { | ||
256 | ret = mmc_test_transfer(test, 0, | ||
257 | test->buffer + i * 512, | ||
258 | addr + i * 512, 1, 512); | ||
259 | if (ret) | ||
260 | return ret; | ||
261 | } | ||
262 | |||
263 | for (i = 0;i < blocks * blksz;i++) { | ||
264 | if (test->buffer[i] != (u8)i) | ||
265 | return RESULT_FAIL; | ||
266 | } | ||
267 | |||
268 | for (;i < sectors * 512;i++) { | ||
269 | if (test->buffer[i] != 0xDF) | ||
270 | return RESULT_FAIL; | ||
271 | } | ||
272 | } else { | ||
273 | for (i = 0;i < blocks * blksz;i++) { | ||
274 | if (buffer[i] != (u8)i) | ||
275 | return RESULT_FAIL; | ||
276 | } | ||
277 | } | ||
278 | |||
279 | return 0; | ||
280 | } | ||
281 | |||
282 | static int mmc_test_cleanup_verify(struct mmc_test_card *test) | ||
283 | { | ||
284 | int ret, i; | ||
285 | |||
286 | ret = mmc_test_set_blksize(test, 512); | ||
287 | if (ret) | ||
288 | return ret; | ||
289 | |||
290 | memset(test->buffer, 0, BUFFER_SIZE); | ||
291 | |||
292 | for (i = 0;i < BUFFER_SIZE / 512;i++) { | ||
293 | ret = mmc_test_transfer(test, 1, test->buffer + i * 512, | ||
294 | i * 512, 1, 512); | ||
295 | if (ret) | ||
296 | return ret; | ||
297 | } | ||
298 | |||
299 | return 0; | ||
300 | } | ||
301 | |||
302 | /*******************************************************************/ | ||
303 | /* Tests */ | ||
304 | /*******************************************************************/ | ||
305 | |||
306 | struct mmc_test_case { | ||
307 | const char *name; | ||
308 | |||
309 | int (*prepare)(struct mmc_test_card *); | ||
310 | int (*run)(struct mmc_test_card *); | ||
311 | int (*cleanup)(struct mmc_test_card *); | ||
312 | }; | ||
313 | |||
314 | static int mmc_test_basic_write(struct mmc_test_card *test) | ||
315 | { | ||
316 | int ret; | ||
317 | |||
318 | ret = mmc_test_set_blksize(test, 512); | ||
319 | if (ret) | ||
320 | return ret; | ||
321 | |||
322 | ret = mmc_test_transfer(test, 1, test->buffer, 0, 1, 512); | ||
323 | if (ret) | ||
324 | return ret; | ||
325 | |||
326 | return 0; | ||
327 | } | ||
328 | |||
329 | static int mmc_test_basic_read(struct mmc_test_card *test) | ||
330 | { | ||
331 | int ret; | ||
332 | |||
333 | ret = mmc_test_set_blksize(test, 512); | ||
334 | if (ret) | ||
335 | return ret; | ||
336 | |||
337 | ret = mmc_test_transfer(test, 0, test->buffer, 0, 1, 512); | ||
338 | if (ret) | ||
339 | return ret; | ||
340 | |||
341 | return 0; | ||
342 | } | ||
343 | |||
344 | static int mmc_test_verify_write(struct mmc_test_card *test) | ||
345 | { | ||
346 | int ret; | ||
347 | |||
348 | ret = mmc_test_verified_transfer(test, 1, test->buffer, 0, 1, 512); | ||
349 | if (ret) | ||
350 | return ret; | ||
351 | |||
352 | return 0; | ||
353 | } | ||
354 | |||
355 | static int mmc_test_verify_read(struct mmc_test_card *test) | ||
356 | { | ||
357 | int ret; | ||
358 | |||
359 | ret = mmc_test_verified_transfer(test, 0, test->buffer, 0, 1, 512); | ||
360 | if (ret) | ||
361 | return ret; | ||
362 | |||
363 | return 0; | ||
364 | } | ||
365 | |||
366 | static int mmc_test_multi_write(struct mmc_test_card *test) | ||
367 | { | ||
368 | int ret; | ||
369 | unsigned int size; | ||
370 | |||
371 | if (test->card->host->max_blk_count == 1) | ||
372 | return RESULT_UNSUP_HOST; | ||
373 | |||
374 | size = PAGE_SIZE * 2; | ||
375 | size = min(size, test->card->host->max_req_size); | ||
376 | size = min(size, test->card->host->max_seg_size); | ||
377 | size = min(size, test->card->host->max_blk_count * 512); | ||
378 | |||
379 | if (size < 1024) | ||
380 | return RESULT_UNSUP_HOST; | ||
381 | |||
382 | ret = mmc_test_verified_transfer(test, 1, test->buffer, 0, | ||
383 | size / 512, 512); | ||
384 | if (ret) | ||
385 | return ret; | ||
386 | |||
387 | return 0; | ||
388 | } | ||
389 | |||
390 | static int mmc_test_multi_read(struct mmc_test_card *test) | ||
391 | { | ||
392 | int ret; | ||
393 | unsigned int size; | ||
394 | |||
395 | if (test->card->host->max_blk_count == 1) | ||
396 | return RESULT_UNSUP_HOST; | ||
397 | |||
398 | size = PAGE_SIZE * 2; | ||
399 | size = min(size, test->card->host->max_req_size); | ||
400 | size = min(size, test->card->host->max_seg_size); | ||
401 | size = min(size, test->card->host->max_blk_count * 512); | ||
402 | |||
403 | if (size < 1024) | ||
404 | return RESULT_UNSUP_HOST; | ||
405 | |||
406 | ret = mmc_test_verified_transfer(test, 0, test->buffer, 0, | ||
407 | size / 512, 512); | ||
408 | if (ret) | ||
409 | return ret; | ||
410 | |||
411 | return 0; | ||
412 | } | ||
413 | |||
414 | static int mmc_test_pow2_write(struct mmc_test_card *test) | ||
415 | { | ||
416 | int ret, i; | ||
417 | |||
418 | if (!test->card->csd.write_partial) | ||
419 | return RESULT_UNSUP_CARD; | ||
420 | |||
421 | for (i = 1; i < 512;i <<= 1) { | ||
422 | ret = mmc_test_verified_transfer(test, 1, | ||
423 | test->buffer, 0, 1, i); | ||
424 | if (ret) | ||
425 | return ret; | ||
426 | } | ||
427 | |||
428 | return 0; | ||
429 | } | ||
430 | |||
431 | static int mmc_test_pow2_read(struct mmc_test_card *test) | ||
432 | { | ||
433 | int ret, i; | ||
434 | |||
435 | if (!test->card->csd.read_partial) | ||
436 | return RESULT_UNSUP_CARD; | ||
437 | |||
438 | for (i = 1; i < 512;i <<= 1) { | ||
439 | ret = mmc_test_verified_transfer(test, 0, | ||
440 | test->buffer, 0, 1, i); | ||
441 | if (ret) | ||
442 | return ret; | ||
443 | } | ||
444 | |||
445 | return 0; | ||
446 | } | ||
447 | |||
448 | static int mmc_test_weird_write(struct mmc_test_card *test) | ||
449 | { | ||
450 | int ret, i; | ||
451 | |||
452 | if (!test->card->csd.write_partial) | ||
453 | return RESULT_UNSUP_CARD; | ||
454 | |||
455 | for (i = 3; i < 512;i += 7) { | ||
456 | ret = mmc_test_verified_transfer(test, 1, | ||
457 | test->buffer, 0, 1, i); | ||
458 | if (ret) | ||
459 | return ret; | ||
460 | } | ||
461 | |||
462 | return 0; | ||
463 | } | ||
464 | |||
465 | static int mmc_test_weird_read(struct mmc_test_card *test) | ||
466 | { | ||
467 | int ret, i; | ||
468 | |||
469 | if (!test->card->csd.read_partial) | ||
470 | return RESULT_UNSUP_CARD; | ||
471 | |||
472 | for (i = 3; i < 512;i += 7) { | ||
473 | ret = mmc_test_verified_transfer(test, 0, | ||
474 | test->buffer, 0, 1, i); | ||
475 | if (ret) | ||
476 | return ret; | ||
477 | } | ||
478 | |||
479 | return 0; | ||
480 | } | ||
481 | |||
482 | static int mmc_test_align_write(struct mmc_test_card *test) | ||
483 | { | ||
484 | int ret, i; | ||
485 | |||
486 | for (i = 1;i < 4;i++) { | ||
487 | ret = mmc_test_verified_transfer(test, 1, test->buffer + i, | ||
488 | 0, 1, 512); | ||
489 | if (ret) | ||
490 | return ret; | ||
491 | } | ||
492 | |||
493 | return 0; | ||
494 | } | ||
495 | |||
496 | static int mmc_test_align_read(struct mmc_test_card *test) | ||
497 | { | ||
498 | int ret, i; | ||
499 | |||
500 | for (i = 1;i < 4;i++) { | ||
501 | ret = mmc_test_verified_transfer(test, 0, test->buffer + i, | ||
502 | 0, 1, 512); | ||
503 | if (ret) | ||
504 | return ret; | ||
505 | } | ||
506 | |||
507 | return 0; | ||
508 | } | ||
509 | |||
510 | static int mmc_test_align_multi_write(struct mmc_test_card *test) | ||
511 | { | ||
512 | int ret, i; | ||
513 | unsigned int size; | ||
514 | |||
515 | if (test->card->host->max_blk_count == 1) | ||
516 | return RESULT_UNSUP_HOST; | ||
517 | |||
518 | size = PAGE_SIZE * 2; | ||
519 | size = min(size, test->card->host->max_req_size); | ||
520 | size = min(size, test->card->host->max_seg_size); | ||
521 | size = min(size, test->card->host->max_blk_count * 512); | ||
522 | |||
523 | if (size < 1024) | ||
524 | return RESULT_UNSUP_HOST; | ||
525 | |||
526 | for (i = 1;i < 4;i++) { | ||
527 | ret = mmc_test_verified_transfer(test, 1, test->buffer + i, | ||
528 | 0, size / 512, 512); | ||
529 | if (ret) | ||
530 | return ret; | ||
531 | } | ||
532 | |||
533 | return 0; | ||
534 | } | ||
535 | |||
536 | static int mmc_test_align_multi_read(struct mmc_test_card *test) | ||
537 | { | ||
538 | int ret, i; | ||
539 | unsigned int size; | ||
540 | |||
541 | if (test->card->host->max_blk_count == 1) | ||
542 | return RESULT_UNSUP_HOST; | ||
543 | |||
544 | size = PAGE_SIZE * 2; | ||
545 | size = min(size, test->card->host->max_req_size); | ||
546 | size = min(size, test->card->host->max_seg_size); | ||
547 | size = min(size, test->card->host->max_blk_count * 512); | ||
548 | |||
549 | if (size < 1024) | ||
550 | return RESULT_UNSUP_HOST; | ||
551 | |||
552 | for (i = 1;i < 4;i++) { | ||
553 | ret = mmc_test_verified_transfer(test, 0, test->buffer + i, | ||
554 | 0, size / 512, 512); | ||
555 | if (ret) | ||
556 | return ret; | ||
557 | } | ||
558 | |||
559 | return 0; | ||
560 | } | ||
561 | |||
562 | static int mmc_test_xfersize_write(struct mmc_test_card *test) | ||
563 | { | ||
564 | int ret; | ||
565 | |||
566 | ret = mmc_test_set_blksize(test, 512); | ||
567 | if (ret) | ||
568 | return ret; | ||
569 | |||
570 | ret = __mmc_test_transfer(test, 1, 1, test->buffer, 0, 1, 512); | ||
571 | if (ret) | ||
572 | return ret; | ||
573 | |||
574 | return 0; | ||
575 | } | ||
576 | |||
577 | static int mmc_test_xfersize_read(struct mmc_test_card *test) | ||
578 | { | ||
579 | int ret; | ||
580 | |||
581 | ret = mmc_test_set_blksize(test, 512); | ||
582 | if (ret) | ||
583 | return ret; | ||
584 | |||
585 | ret = __mmc_test_transfer(test, 0, 1, test->buffer, 0, 1, 512); | ||
586 | if (ret) | ||
587 | return ret; | ||
588 | |||
589 | return 0; | ||
590 | } | ||
591 | |||
592 | static int mmc_test_multi_xfersize_write(struct mmc_test_card *test) | ||
593 | { | ||
594 | int ret; | ||
595 | |||
596 | if (test->card->host->max_blk_count == 1) | ||
597 | return RESULT_UNSUP_HOST; | ||
598 | |||
599 | ret = mmc_test_set_blksize(test, 512); | ||
600 | if (ret) | ||
601 | return ret; | ||
602 | |||
603 | ret = __mmc_test_transfer(test, 1, 1, test->buffer, 0, 2, 512); | ||
604 | if (ret) | ||
605 | return ret; | ||
606 | |||
607 | return 0; | ||
608 | } | ||
609 | |||
610 | static int mmc_test_multi_xfersize_read(struct mmc_test_card *test) | ||
611 | { | ||
612 | int ret; | ||
613 | |||
614 | if (test->card->host->max_blk_count == 1) | ||
615 | return RESULT_UNSUP_HOST; | ||
616 | |||
617 | ret = mmc_test_set_blksize(test, 512); | ||
618 | if (ret) | ||
619 | return ret; | ||
620 | |||
621 | ret = __mmc_test_transfer(test, 0, 1, test->buffer, 0, 2, 512); | ||
622 | if (ret) | ||
623 | return ret; | ||
624 | |||
625 | return 0; | ||
626 | } | ||
627 | |||
628 | static const struct mmc_test_case mmc_test_cases[] = { | ||
629 | { | ||
630 | .name = "Basic write (no data verification)", | ||
631 | .run = mmc_test_basic_write, | ||
632 | }, | ||
633 | |||
634 | { | ||
635 | .name = "Basic read (no data verification)", | ||
636 | .run = mmc_test_basic_read, | ||
637 | }, | ||
638 | |||
639 | { | ||
640 | .name = "Basic write (with data verification)", | ||
641 | .prepare = mmc_test_prepare_verify_write, | ||
642 | .run = mmc_test_verify_write, | ||
643 | .cleanup = mmc_test_cleanup_verify, | ||
644 | }, | ||
645 | |||
646 | { | ||
647 | .name = "Basic read (with data verification)", | ||
648 | .prepare = mmc_test_prepare_verify_read, | ||
649 | .run = mmc_test_verify_read, | ||
650 | .cleanup = mmc_test_cleanup_verify, | ||
651 | }, | ||
652 | |||
653 | { | ||
654 | .name = "Multi-block write", | ||
655 | .prepare = mmc_test_prepare_verify_write, | ||
656 | .run = mmc_test_multi_write, | ||
657 | .cleanup = mmc_test_cleanup_verify, | ||
658 | }, | ||
659 | |||
660 | { | ||
661 | .name = "Multi-block read", | ||
662 | .prepare = mmc_test_prepare_verify_read, | ||
663 | .run = mmc_test_multi_read, | ||
664 | .cleanup = mmc_test_cleanup_verify, | ||
665 | }, | ||
666 | |||
667 | { | ||
668 | .name = "Power of two block writes", | ||
669 | .prepare = mmc_test_prepare_verify_write, | ||
670 | .run = mmc_test_pow2_write, | ||
671 | .cleanup = mmc_test_cleanup_verify, | ||
672 | }, | ||
673 | |||
674 | { | ||
675 | .name = "Power of two block reads", | ||
676 | .prepare = mmc_test_prepare_verify_read, | ||
677 | .run = mmc_test_pow2_read, | ||
678 | .cleanup = mmc_test_cleanup_verify, | ||
679 | }, | ||
680 | |||
681 | { | ||
682 | .name = "Weird sized block writes", | ||
683 | .prepare = mmc_test_prepare_verify_write, | ||
684 | .run = mmc_test_weird_write, | ||
685 | .cleanup = mmc_test_cleanup_verify, | ||
686 | }, | ||
687 | |||
688 | { | ||
689 | .name = "Weird sized block reads", | ||
690 | .prepare = mmc_test_prepare_verify_read, | ||
691 | .run = mmc_test_weird_read, | ||
692 | .cleanup = mmc_test_cleanup_verify, | ||
693 | }, | ||
694 | |||
695 | { | ||
696 | .name = "Badly aligned write", | ||
697 | .prepare = mmc_test_prepare_verify_write, | ||
698 | .run = mmc_test_align_write, | ||
699 | .cleanup = mmc_test_cleanup_verify, | ||
700 | }, | ||
701 | |||
702 | { | ||
703 | .name = "Badly aligned read", | ||
704 | .prepare = mmc_test_prepare_verify_read, | ||
705 | .run = mmc_test_align_read, | ||
706 | .cleanup = mmc_test_cleanup_verify, | ||
707 | }, | ||
708 | |||
709 | { | ||
710 | .name = "Badly aligned multi-block write", | ||
711 | .prepare = mmc_test_prepare_verify_write, | ||
712 | .run = mmc_test_align_multi_write, | ||
713 | .cleanup = mmc_test_cleanup_verify, | ||
714 | }, | ||
715 | |||
716 | { | ||
717 | .name = "Badly aligned multi-block read", | ||
718 | .prepare = mmc_test_prepare_verify_read, | ||
719 | .run = mmc_test_align_multi_read, | ||
720 | .cleanup = mmc_test_cleanup_verify, | ||
721 | }, | ||
722 | |||
723 | { | ||
724 | .name = "Correct xfer_size at write (start failure)", | ||
725 | .run = mmc_test_xfersize_write, | ||
726 | }, | ||
727 | |||
728 | { | ||
729 | .name = "Correct xfer_size at read (start failure)", | ||
730 | .run = mmc_test_xfersize_read, | ||
731 | }, | ||
732 | |||
733 | { | ||
734 | .name = "Correct xfer_size at write (midway failure)", | ||
735 | .run = mmc_test_multi_xfersize_write, | ||
736 | }, | ||
737 | |||
738 | { | ||
739 | .name = "Correct xfer_size at read (midway failure)", | ||
740 | .run = mmc_test_multi_xfersize_read, | ||
741 | }, | ||
742 | }; | ||
743 | |||
744 | static struct mutex mmc_test_lock; | ||
745 | |||
746 | static void mmc_test_run(struct mmc_test_card *test) | ||
747 | { | ||
748 | int i, ret; | ||
749 | |||
750 | printk(KERN_INFO "%s: Starting tests of card %s...\n", | ||
751 | mmc_hostname(test->card->host), mmc_card_id(test->card)); | ||
752 | |||
753 | mmc_claim_host(test->card->host); | ||
754 | |||
755 | for (i = 0;i < ARRAY_SIZE(mmc_test_cases);i++) { | ||
756 | printk(KERN_INFO "%s: Test case %d. %s...\n", | ||
757 | mmc_hostname(test->card->host), i + 1, | ||
758 | mmc_test_cases[i].name); | ||
759 | |||
760 | if (mmc_test_cases[i].prepare) { | ||
761 | ret = mmc_test_cases[i].prepare(test); | ||
762 | if (ret) { | ||
763 | printk(KERN_INFO "%s: Result: Prepare " | ||
764 | "stage failed! (%d)\n", | ||
765 | mmc_hostname(test->card->host), | ||
766 | ret); | ||
767 | continue; | ||
768 | } | ||
769 | } | ||
770 | |||
771 | ret = mmc_test_cases[i].run(test); | ||
772 | switch (ret) { | ||
773 | case RESULT_OK: | ||
774 | printk(KERN_INFO "%s: Result: OK\n", | ||
775 | mmc_hostname(test->card->host)); | ||
776 | break; | ||
777 | case RESULT_FAIL: | ||
778 | printk(KERN_INFO "%s: Result: FAILED\n", | ||
779 | mmc_hostname(test->card->host)); | ||
780 | break; | ||
781 | case RESULT_UNSUP_HOST: | ||
782 | printk(KERN_INFO "%s: Result: UNSUPPORTED " | ||
783 | "(by host)\n", | ||
784 | mmc_hostname(test->card->host)); | ||
785 | break; | ||
786 | case RESULT_UNSUP_CARD: | ||
787 | printk(KERN_INFO "%s: Result: UNSUPPORTED " | ||
788 | "(by card)\n", | ||
789 | mmc_hostname(test->card->host)); | ||
790 | break; | ||
791 | default: | ||
792 | printk(KERN_INFO "%s: Result: ERROR (%d)\n", | ||
793 | mmc_hostname(test->card->host), ret); | ||
794 | } | ||
795 | |||
796 | if (mmc_test_cases[i].cleanup) { | ||
797 | ret = mmc_test_cases[i].cleanup(test); | ||
798 | if (ret) { | ||
799 | printk(KERN_INFO "%s: Warning: Cleanup " | ||
800 | "stage failed! (%d)\n", | ||
801 | mmc_hostname(test->card->host), | ||
802 | ret); | ||
803 | } | ||
804 | } | ||
805 | } | ||
806 | |||
807 | mmc_release_host(test->card->host); | ||
808 | |||
809 | printk(KERN_INFO "%s: Tests completed.\n", | ||
810 | mmc_hostname(test->card->host)); | ||
811 | } | ||
812 | |||
813 | static ssize_t mmc_test_show(struct device *dev, | ||
814 | struct device_attribute *attr, char *buf) | ||
815 | { | ||
816 | mutex_lock(&mmc_test_lock); | ||
817 | mutex_unlock(&mmc_test_lock); | ||
818 | |||
819 | return 0; | ||
820 | } | ||
821 | |||
822 | static ssize_t mmc_test_store(struct device *dev, | ||
823 | struct device_attribute *attr, const char *buf, size_t count) | ||
824 | { | ||
825 | struct mmc_card *card; | ||
826 | struct mmc_test_card *test; | ||
827 | |||
828 | card = container_of(dev, struct mmc_card, dev); | ||
829 | |||
830 | test = kzalloc(sizeof(struct mmc_test_card), GFP_KERNEL); | ||
831 | if (!test) | ||
832 | return -ENOMEM; | ||
833 | |||
834 | test->card = card; | ||
835 | |||
836 | test->buffer = kzalloc(BUFFER_SIZE, GFP_KERNEL); | ||
837 | if (test->buffer) { | ||
838 | mutex_lock(&mmc_test_lock); | ||
839 | mmc_test_run(test); | ||
840 | mutex_unlock(&mmc_test_lock); | ||
841 | } | ||
842 | |||
843 | kfree(test->buffer); | ||
844 | kfree(test); | ||
845 | |||
846 | return count; | ||
847 | } | ||
848 | |||
849 | static DEVICE_ATTR(test, S_IWUSR | S_IRUGO, mmc_test_show, mmc_test_store); | ||
850 | |||
851 | static int mmc_test_probe(struct mmc_card *card) | ||
852 | { | ||
853 | int ret; | ||
854 | |||
855 | mutex_init(&mmc_test_lock); | ||
856 | |||
857 | ret = device_create_file(&card->dev, &dev_attr_test); | ||
858 | if (ret) | ||
859 | return ret; | ||
860 | |||
861 | return 0; | ||
862 | } | ||
863 | |||
864 | static void mmc_test_remove(struct mmc_card *card) | ||
865 | { | ||
866 | device_remove_file(&card->dev, &dev_attr_test); | ||
867 | } | ||
868 | |||
869 | static struct mmc_driver mmc_driver = { | ||
870 | .drv = { | ||
871 | .name = "mmc_test", | ||
872 | }, | ||
873 | .probe = mmc_test_probe, | ||
874 | .remove = mmc_test_remove, | ||
875 | }; | ||
876 | |||
877 | static int __init mmc_test_init(void) | ||
878 | { | ||
879 | return mmc_register_driver(&mmc_driver); | ||
880 | } | ||
881 | |||
882 | static void __exit mmc_test_exit(void) | ||
883 | { | ||
884 | mmc_unregister_driver(&mmc_driver); | ||
885 | } | ||
886 | |||
887 | module_init(mmc_test_init); | ||
888 | module_exit(mmc_test_exit); | ||
889 | |||
890 | MODULE_LICENSE("GPL"); | ||
891 | MODULE_DESCRIPTION("Multimedia Card (MMC) host test driver"); | ||
892 | MODULE_AUTHOR("Pierre Ossman"); | ||
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 3b3cd0e74715..dead61754ad7 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig | |||
@@ -119,7 +119,7 @@ config MMC_TIFM_SD | |||
119 | 119 | ||
120 | config MMC_SPI | 120 | config MMC_SPI |
121 | tristate "MMC/SD over SPI" | 121 | tristate "MMC/SD over SPI" |
122 | depends on MMC && SPI_MASTER && !HIGHMEM | 122 | depends on MMC && SPI_MASTER && !HIGHMEM && HAS_DMA |
123 | select CRC7 | 123 | select CRC7 |
124 | select CRC_ITU_T | 124 | select CRC_ITU_T |
125 | help | 125 | help |
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c index a28fc2f68ce2..8979ad330a4d 100644 --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c | |||
@@ -663,9 +663,12 @@ static void at91_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
663 | gpio_set_value(host->board->vcc_pin, 0); | 663 | gpio_set_value(host->board->vcc_pin, 0); |
664 | break; | 664 | break; |
665 | case MMC_POWER_UP: | 665 | case MMC_POWER_UP: |
666 | case MMC_POWER_ON: | ||
667 | gpio_set_value(host->board->vcc_pin, 1); | 666 | gpio_set_value(host->board->vcc_pin, 1); |
668 | break; | 667 | break; |
668 | case MMC_POWER_ON: | ||
669 | break; | ||
670 | default: | ||
671 | WARN_ON(1); | ||
669 | } | 672 | } |
670 | } | 673 | } |
671 | } | 674 | } |
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index 14759e9f42ad..549517c35675 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c | |||
@@ -1003,7 +1003,7 @@ static void mmc_omap_dma_cb(int lch, u16 ch_status, void *data) | |||
1003 | 1003 | ||
1004 | static int mmc_omap_get_dma_channel(struct mmc_omap_host *host, struct mmc_data *data) | 1004 | static int mmc_omap_get_dma_channel(struct mmc_omap_host *host, struct mmc_data *data) |
1005 | { | 1005 | { |
1006 | const char *dev_name; | 1006 | const char *dma_dev_name; |
1007 | int sync_dev, dma_ch, is_read, r; | 1007 | int sync_dev, dma_ch, is_read, r; |
1008 | 1008 | ||
1009 | is_read = !(data->flags & MMC_DATA_WRITE); | 1009 | is_read = !(data->flags & MMC_DATA_WRITE); |
@@ -1018,21 +1018,21 @@ static int mmc_omap_get_dma_channel(struct mmc_omap_host *host, struct mmc_data | |||
1018 | if (is_read) { | 1018 | if (is_read) { |
1019 | if (host->id == 1) { | 1019 | if (host->id == 1) { |
1020 | sync_dev = OMAP_DMA_MMC_RX; | 1020 | sync_dev = OMAP_DMA_MMC_RX; |
1021 | dev_name = "MMC1 read"; | 1021 | dma_dev_name = "MMC1 read"; |
1022 | } else { | 1022 | } else { |
1023 | sync_dev = OMAP_DMA_MMC2_RX; | 1023 | sync_dev = OMAP_DMA_MMC2_RX; |
1024 | dev_name = "MMC2 read"; | 1024 | dma_dev_name = "MMC2 read"; |
1025 | } | 1025 | } |
1026 | } else { | 1026 | } else { |
1027 | if (host->id == 1) { | 1027 | if (host->id == 1) { |
1028 | sync_dev = OMAP_DMA_MMC_TX; | 1028 | sync_dev = OMAP_DMA_MMC_TX; |
1029 | dev_name = "MMC1 write"; | 1029 | dma_dev_name = "MMC1 write"; |
1030 | } else { | 1030 | } else { |
1031 | sync_dev = OMAP_DMA_MMC2_TX; | 1031 | sync_dev = OMAP_DMA_MMC2_TX; |
1032 | dev_name = "MMC2 write"; | 1032 | dma_dev_name = "MMC2 write"; |
1033 | } | 1033 | } |
1034 | } | 1034 | } |
1035 | r = omap_request_dma(sync_dev, dev_name, mmc_omap_dma_cb, | 1035 | r = omap_request_dma(sync_dev, dma_dev_name, mmc_omap_dma_cb, |
1036 | host, &dma_ch); | 1036 | host, &dma_ch); |
1037 | if (r != 0) { | 1037 | if (r != 0) { |
1038 | dev_dbg(mmc_dev(host->mmc), "omap_request_dma() failed with %d\n", r); | 1038 | dev_dbg(mmc_dev(host->mmc), "omap_request_dma() failed with %d\n", r); |
diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c index 59d8fb49270a..effaf7cdefab 100644 --- a/drivers/mtd/maps/ck804xrom.c +++ b/drivers/mtd/maps/ck804xrom.c | |||
@@ -331,15 +331,15 @@ static void __devexit ck804xrom_remove_one (struct pci_dev *pdev) | |||
331 | } | 331 | } |
332 | 332 | ||
333 | static struct pci_device_id ck804xrom_pci_tbl[] = { | 333 | static struct pci_device_id ck804xrom_pci_tbl[] = { |
334 | { PCI_VENDOR_ID_NVIDIA, 0x0051, PCI_ANY_ID, PCI_ANY_ID, DEV_CK804 }, | 334 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0051), .driver_data = DEV_CK804 }, |
335 | { PCI_VENDOR_ID_NVIDIA, 0x0360, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, | 335 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0360), .driver_data = DEV_MCP55 }, |
336 | { PCI_VENDOR_ID_NVIDIA, 0x0361, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, | 336 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0361), .driver_data = DEV_MCP55 }, |
337 | { PCI_VENDOR_ID_NVIDIA, 0x0362, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, | 337 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0362), .driver_data = DEV_MCP55 }, |
338 | { PCI_VENDOR_ID_NVIDIA, 0x0363, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, | 338 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0363), .driver_data = DEV_MCP55 }, |
339 | { PCI_VENDOR_ID_NVIDIA, 0x0364, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, | 339 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0364), .driver_data = DEV_MCP55 }, |
340 | { PCI_VENDOR_ID_NVIDIA, 0x0365, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, | 340 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0365), .driver_data = DEV_MCP55 }, |
341 | { PCI_VENDOR_ID_NVIDIA, 0x0366, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, | 341 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0366), .driver_data = DEV_MCP55 }, |
342 | { PCI_VENDOR_ID_NVIDIA, 0x0367, PCI_ANY_ID, PCI_ANY_ID, DEV_MCP55 }, | 342 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0367), .driver_data = DEV_MCP55 }, |
343 | { 0, } | 343 | { 0, } |
344 | }; | 344 | }; |
345 | 345 | ||
diff --git a/drivers/net/82596.c b/drivers/net/82596.c index 2797da7eeee6..da292e647eb1 100644 --- a/drivers/net/82596.c +++ b/drivers/net/82596.c | |||
@@ -1162,6 +1162,7 @@ struct net_device * __init i82596_probe(int unit) | |||
1162 | memcpy(eth_addr, (void *) 0xfffc1f2c, 6); /* YUCK! Get addr from NOVRAM */ | 1162 | memcpy(eth_addr, (void *) 0xfffc1f2c, 6); /* YUCK! Get addr from NOVRAM */ |
1163 | dev->base_addr = MVME_I596_BASE; | 1163 | dev->base_addr = MVME_I596_BASE; |
1164 | dev->irq = (unsigned) MVME16x_IRQ_I596; | 1164 | dev->irq = (unsigned) MVME16x_IRQ_I596; |
1165 | goto found; | ||
1165 | } | 1166 | } |
1166 | #endif | 1167 | #endif |
1167 | #ifdef ENABLE_BVME6000_NET | 1168 | #ifdef ENABLE_BVME6000_NET |
@@ -1176,6 +1177,7 @@ struct net_device * __init i82596_probe(int unit) | |||
1176 | rtc[3] = msr; | 1177 | rtc[3] = msr; |
1177 | dev->base_addr = BVME_I596_BASE; | 1178 | dev->base_addr = BVME_I596_BASE; |
1178 | dev->irq = (unsigned) BVME_IRQ_I596; | 1179 | dev->irq = (unsigned) BVME_IRQ_I596; |
1180 | goto found; | ||
1179 | } | 1181 | } |
1180 | #endif | 1182 | #endif |
1181 | #ifdef ENABLE_APRICOT | 1183 | #ifdef ENABLE_APRICOT |
@@ -1212,8 +1214,13 @@ struct net_device * __init i82596_probe(int unit) | |||
1212 | } | 1214 | } |
1213 | 1215 | ||
1214 | dev->irq = 10; | 1216 | dev->irq = 10; |
1217 | goto found; | ||
1215 | } | 1218 | } |
1216 | #endif | 1219 | #endif |
1220 | err = -ENODEV; | ||
1221 | goto out; | ||
1222 | |||
1223 | found: | ||
1217 | dev->mem_start = (int)__get_free_pages(GFP_ATOMIC, 0); | 1224 | dev->mem_start = (int)__get_free_pages(GFP_ATOMIC, 0); |
1218 | if (!dev->mem_start) { | 1225 | if (!dev->mem_start) { |
1219 | err = -ENOMEM; | 1226 | err = -ENOMEM; |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 654a78c31087..c537f53ffcb9 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -1353,7 +1353,7 @@ config APRICOT | |||
1353 | 1353 | ||
1354 | config B44 | 1354 | config B44 |
1355 | tristate "Broadcom 440x/47xx ethernet support" | 1355 | tristate "Broadcom 440x/47xx ethernet support" |
1356 | depends on SSB_POSSIBLE | 1356 | depends on SSB_POSSIBLE && HAS_DMA |
1357 | select SSB | 1357 | select SSB |
1358 | select MII | 1358 | select MII |
1359 | help | 1359 | help |
diff --git a/drivers/net/apne.c b/drivers/net/apne.c index 47a8275d3962..867f6fff543c 100644 --- a/drivers/net/apne.c +++ b/drivers/net/apne.c | |||
@@ -127,6 +127,9 @@ struct net_device * __init apne_probe(int unit) | |||
127 | #endif | 127 | #endif |
128 | int err; | 128 | int err; |
129 | 129 | ||
130 | if (!MACH_IS_AMIGA) | ||
131 | return ERR_PTR(-ENODEV); | ||
132 | |||
130 | if (apne_owned) | 133 | if (apne_owned) |
131 | return ERR_PTR(-ENODEV); | 134 | return ERR_PTR(-ENODEV); |
132 | 135 | ||
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index db04bfb3460f..32dc391e63cc 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c | |||
@@ -2024,6 +2024,7 @@ rrd_ok: | |||
2024 | /* Good Receive */ | 2024 | /* Good Receive */ |
2025 | pci_unmap_page(adapter->pdev, buffer_info->dma, | 2025 | pci_unmap_page(adapter->pdev, buffer_info->dma, |
2026 | buffer_info->length, PCI_DMA_FROMDEVICE); | 2026 | buffer_info->length, PCI_DMA_FROMDEVICE); |
2027 | buffer_info->dma = 0; | ||
2027 | skb = buffer_info->skb; | 2028 | skb = buffer_info->skb; |
2028 | length = le16_to_cpu(rrd->xsz.xsum_sz.pkt_size); | 2029 | length = le16_to_cpu(rrd->xsz.xsum_sz.pkt_size); |
2029 | 2030 | ||
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index 348371fda597..fba87abe78ee 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c | |||
@@ -1394,7 +1394,11 @@ net_open(struct net_device *dev) | |||
1394 | #endif | 1394 | #endif |
1395 | if (!result) { | 1395 | if (!result) { |
1396 | printk(KERN_ERR "%s: EEPROM is configured for unavailable media\n", dev->name); | 1396 | printk(KERN_ERR "%s: EEPROM is configured for unavailable media\n", dev->name); |
1397 | release_irq: | 1397 | release_dma: |
1398 | #if ALLOW_DMA | ||
1399 | free_dma(dev->dma); | ||
1400 | #endif | ||
1401 | release_irq: | ||
1398 | #if ALLOW_DMA | 1402 | #if ALLOW_DMA |
1399 | release_dma_buff(lp); | 1403 | release_dma_buff(lp); |
1400 | #endif | 1404 | #endif |
@@ -1442,12 +1446,12 @@ net_open(struct net_device *dev) | |||
1442 | if ((result = detect_bnc(dev)) != DETECTED_NONE) | 1446 | if ((result = detect_bnc(dev)) != DETECTED_NONE) |
1443 | break; | 1447 | break; |
1444 | printk(KERN_ERR "%s: no media detected\n", dev->name); | 1448 | printk(KERN_ERR "%s: no media detected\n", dev->name); |
1445 | goto release_irq; | 1449 | goto release_dma; |
1446 | } | 1450 | } |
1447 | switch(result) { | 1451 | switch(result) { |
1448 | case DETECTED_NONE: | 1452 | case DETECTED_NONE: |
1449 | printk(KERN_ERR "%s: no network cable attached to configured media\n", dev->name); | 1453 | printk(KERN_ERR "%s: no network cable attached to configured media\n", dev->name); |
1450 | goto release_irq; | 1454 | goto release_dma; |
1451 | case DETECTED_RJ45H: | 1455 | case DETECTED_RJ45H: |
1452 | printk(KERN_INFO "%s: using half-duplex 10Base-T (RJ-45)\n", dev->name); | 1456 | printk(KERN_INFO "%s: using half-duplex 10Base-T (RJ-45)\n", dev->name); |
1453 | break; | 1457 | break; |
diff --git a/drivers/net/irda/Kconfig b/drivers/net/irda/Kconfig index ce816ba9c40d..e6317557a531 100644 --- a/drivers/net/irda/Kconfig +++ b/drivers/net/irda/Kconfig | |||
@@ -329,6 +329,7 @@ config PXA_FICP | |||
329 | config MCS_FIR | 329 | config MCS_FIR |
330 | tristate "MosChip MCS7780 IrDA-USB dongle" | 330 | tristate "MosChip MCS7780 IrDA-USB dongle" |
331 | depends on IRDA && USB && EXPERIMENTAL | 331 | depends on IRDA && USB && EXPERIMENTAL |
332 | select CRC32 | ||
332 | help | 333 | help |
333 | Say Y or M here if you want to build support for the MosChip | 334 | Say Y or M here if you want to build support for the MosChip |
334 | MCS7780 IrDA-USB bridge device driver. | 335 | MCS7780 IrDA-USB bridge device driver. |
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 9081234ab458..6f50ed7b183f 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c | |||
@@ -1120,7 +1120,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self) | |||
1120 | } | 1120 | } |
1121 | } | 1121 | } |
1122 | 1122 | ||
1123 | if (self->usbdev->descriptor.bcdDevice == fw_version) { | 1123 | if (self->usbdev->descriptor.bcdDevice == cpu_to_le16(fw_version)) { |
1124 | /* | 1124 | /* |
1125 | * If we're here, we've found a correct patch | 1125 | * If we're here, we've found a correct patch |
1126 | * The actual image starts after the "STMP" keyword | 1126 | * The actual image starts after the "STMP" keyword |
diff --git a/drivers/net/irda/irda-usb.h b/drivers/net/irda/irda-usb.h index e846c38224a3..a0ca9c1fe196 100644 --- a/drivers/net/irda/irda-usb.h +++ b/drivers/net/irda/irda-usb.h | |||
@@ -117,11 +117,11 @@ | |||
117 | struct irda_class_desc { | 117 | struct irda_class_desc { |
118 | __u8 bLength; | 118 | __u8 bLength; |
119 | __u8 bDescriptorType; | 119 | __u8 bDescriptorType; |
120 | __u16 bcdSpecRevision; | 120 | __le16 bcdSpecRevision; |
121 | __u8 bmDataSize; | 121 | __u8 bmDataSize; |
122 | __u8 bmWindowSize; | 122 | __u8 bmWindowSize; |
123 | __u8 bmMinTurnaroundTime; | 123 | __u8 bmMinTurnaroundTime; |
124 | __u16 wBaudRate; | 124 | __le16 wBaudRate; |
125 | __u8 bmAdditionalBOFs; | 125 | __u8 bmAdditionalBOFs; |
126 | __u8 bIrdaRateSniff; | 126 | __u8 bIrdaRateSniff; |
127 | __u8 bMaxUnicastList; | 127 | __u8 bMaxUnicastList; |
diff --git a/drivers/net/mac89x0.c b/drivers/net/mac89x0.c index 2a66e5b7cebc..4ce8afd481c3 100644 --- a/drivers/net/mac89x0.c +++ b/drivers/net/mac89x0.c | |||
@@ -183,6 +183,9 @@ struct net_device * __init mac89x0_probe(int unit) | |||
183 | int err = -ENODEV; | 183 | int err = -ENODEV; |
184 | DECLARE_MAC_BUF(mac); | 184 | DECLARE_MAC_BUF(mac); |
185 | 185 | ||
186 | if (!MACH_IS_MAC) | ||
187 | return ERR_PTR(-ENODEV); | ||
188 | |||
186 | dev = alloc_etherdev(sizeof(struct net_local)); | 189 | dev = alloc_etherdev(sizeof(struct net_local)); |
187 | if (!dev) | 190 | if (!dev) |
188 | return ERR_PTR(-ENOMEM); | 191 | return ERR_PTR(-ENOMEM); |
diff --git a/drivers/net/macmace.c b/drivers/net/macmace.c index 18770527df99..51ad3765e075 100644 --- a/drivers/net/macmace.c +++ b/drivers/net/macmace.c | |||
@@ -781,6 +781,9 @@ static int __init mac_mace_init_module(void) | |||
781 | { | 781 | { |
782 | int err; | 782 | int err; |
783 | 783 | ||
784 | if (!MACH_IS_MAC) | ||
785 | return -ENODEV; | ||
786 | |||
784 | if ((err = platform_driver_register(&mac_mace_driver))) { | 787 | if ((err = platform_driver_register(&mac_mace_driver))) { |
785 | printk(KERN_ERR "Driver registration failed\n"); | 788 | printk(KERN_ERR "Driver registration failed\n"); |
786 | return err; | 789 | return err; |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index 93007d38df57..9a68d2ea5f3e 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -76,7 +76,7 @@ | |||
76 | #include "myri10ge_mcp.h" | 76 | #include "myri10ge_mcp.h" |
77 | #include "myri10ge_mcp_gen_header.h" | 77 | #include "myri10ge_mcp_gen_header.h" |
78 | 78 | ||
79 | #define MYRI10GE_VERSION_STR "1.3.2-1.287" | 79 | #define MYRI10GE_VERSION_STR "1.3.99-1.347" |
80 | 80 | ||
81 | MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); | 81 | MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); |
82 | MODULE_AUTHOR("Maintainer: help@myri.com"); | 82 | MODULE_AUTHOR("Maintainer: help@myri.com"); |
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c index 8db342f2fdc9..70cfdb46aa27 100644 --- a/drivers/net/pppol2tp.c +++ b/drivers/net/pppol2tp.c | |||
@@ -240,12 +240,15 @@ static inline struct pppol2tp_session *pppol2tp_sock_to_session(struct sock *sk) | |||
240 | if (sk == NULL) | 240 | if (sk == NULL) |
241 | return NULL; | 241 | return NULL; |
242 | 242 | ||
243 | sock_hold(sk); | ||
243 | session = (struct pppol2tp_session *)(sk->sk_user_data); | 244 | session = (struct pppol2tp_session *)(sk->sk_user_data); |
244 | if (session == NULL) | 245 | if (session == NULL) { |
245 | return NULL; | 246 | sock_put(sk); |
247 | goto out; | ||
248 | } | ||
246 | 249 | ||
247 | BUG_ON(session->magic != L2TP_SESSION_MAGIC); | 250 | BUG_ON(session->magic != L2TP_SESSION_MAGIC); |
248 | 251 | out: | |
249 | return session; | 252 | return session; |
250 | } | 253 | } |
251 | 254 | ||
@@ -256,12 +259,15 @@ static inline struct pppol2tp_tunnel *pppol2tp_sock_to_tunnel(struct sock *sk) | |||
256 | if (sk == NULL) | 259 | if (sk == NULL) |
257 | return NULL; | 260 | return NULL; |
258 | 261 | ||
262 | sock_hold(sk); | ||
259 | tunnel = (struct pppol2tp_tunnel *)(sk->sk_user_data); | 263 | tunnel = (struct pppol2tp_tunnel *)(sk->sk_user_data); |
260 | if (tunnel == NULL) | 264 | if (tunnel == NULL) { |
261 | return NULL; | 265 | sock_put(sk); |
266 | goto out; | ||
267 | } | ||
262 | 268 | ||
263 | BUG_ON(tunnel->magic != L2TP_TUNNEL_MAGIC); | 269 | BUG_ON(tunnel->magic != L2TP_TUNNEL_MAGIC); |
264 | 270 | out: | |
265 | return tunnel; | 271 | return tunnel; |
266 | } | 272 | } |
267 | 273 | ||
@@ -716,12 +722,14 @@ discard: | |||
716 | session->stats.rx_errors++; | 722 | session->stats.rx_errors++; |
717 | kfree_skb(skb); | 723 | kfree_skb(skb); |
718 | sock_put(session->sock); | 724 | sock_put(session->sock); |
725 | sock_put(sock); | ||
719 | 726 | ||
720 | return 0; | 727 | return 0; |
721 | 728 | ||
722 | error: | 729 | error: |
723 | /* Put UDP header back */ | 730 | /* Put UDP header back */ |
724 | __skb_push(skb, sizeof(struct udphdr)); | 731 | __skb_push(skb, sizeof(struct udphdr)); |
732 | sock_put(sock); | ||
725 | 733 | ||
726 | no_tunnel: | 734 | no_tunnel: |
727 | return 1; | 735 | return 1; |
@@ -745,10 +753,13 @@ static int pppol2tp_udp_encap_recv(struct sock *sk, struct sk_buff *skb) | |||
745 | "%s: received %d bytes\n", tunnel->name, skb->len); | 753 | "%s: received %d bytes\n", tunnel->name, skb->len); |
746 | 754 | ||
747 | if (pppol2tp_recv_core(sk, skb)) | 755 | if (pppol2tp_recv_core(sk, skb)) |
748 | goto pass_up; | 756 | goto pass_up_put; |
749 | 757 | ||
758 | sock_put(sk); | ||
750 | return 0; | 759 | return 0; |
751 | 760 | ||
761 | pass_up_put: | ||
762 | sock_put(sk); | ||
752 | pass_up: | 763 | pass_up: |
753 | return 1; | 764 | return 1; |
754 | } | 765 | } |
@@ -858,7 +869,7 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh | |||
858 | 869 | ||
859 | tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock); | 870 | tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock); |
860 | if (tunnel == NULL) | 871 | if (tunnel == NULL) |
861 | goto error; | 872 | goto error_put_sess; |
862 | 873 | ||
863 | /* What header length is configured for this session? */ | 874 | /* What header length is configured for this session? */ |
864 | hdr_len = pppol2tp_l2tp_header_len(session); | 875 | hdr_len = pppol2tp_l2tp_header_len(session); |
@@ -870,7 +881,7 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh | |||
870 | sizeof(ppph) + total_len, | 881 | sizeof(ppph) + total_len, |
871 | 0, GFP_KERNEL); | 882 | 0, GFP_KERNEL); |
872 | if (!skb) | 883 | if (!skb) |
873 | goto error; | 884 | goto error_put_sess_tun; |
874 | 885 | ||
875 | /* Reserve space for headers. */ | 886 | /* Reserve space for headers. */ |
876 | skb_reserve(skb, NET_SKB_PAD); | 887 | skb_reserve(skb, NET_SKB_PAD); |
@@ -900,7 +911,7 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh | |||
900 | error = memcpy_fromiovec(skb->data, m->msg_iov, total_len); | 911 | error = memcpy_fromiovec(skb->data, m->msg_iov, total_len); |
901 | if (error < 0) { | 912 | if (error < 0) { |
902 | kfree_skb(skb); | 913 | kfree_skb(skb); |
903 | goto error; | 914 | goto error_put_sess_tun; |
904 | } | 915 | } |
905 | skb_put(skb, total_len); | 916 | skb_put(skb, total_len); |
906 | 917 | ||
@@ -947,10 +958,33 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh | |||
947 | session->stats.tx_errors++; | 958 | session->stats.tx_errors++; |
948 | } | 959 | } |
949 | 960 | ||
961 | return error; | ||
962 | |||
963 | error_put_sess_tun: | ||
964 | sock_put(session->tunnel_sock); | ||
965 | error_put_sess: | ||
966 | sock_put(sk); | ||
950 | error: | 967 | error: |
951 | return error; | 968 | return error; |
952 | } | 969 | } |
953 | 970 | ||
971 | /* Automatically called when the skb is freed. | ||
972 | */ | ||
973 | static void pppol2tp_sock_wfree(struct sk_buff *skb) | ||
974 | { | ||
975 | sock_put(skb->sk); | ||
976 | } | ||
977 | |||
978 | /* For data skbs that we transmit, we associate with the tunnel socket | ||
979 | * but don't do accounting. | ||
980 | */ | ||
981 | static inline void pppol2tp_skb_set_owner_w(struct sk_buff *skb, struct sock *sk) | ||
982 | { | ||
983 | sock_hold(sk); | ||
984 | skb->sk = sk; | ||
985 | skb->destructor = pppol2tp_sock_wfree; | ||
986 | } | ||
987 | |||
954 | /* Transmit function called by generic PPP driver. Sends PPP frame | 988 | /* Transmit function called by generic PPP driver. Sends PPP frame |
955 | * over PPPoL2TP socket. | 989 | * over PPPoL2TP socket. |
956 | * | 990 | * |
@@ -993,10 +1027,10 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb) | |||
993 | 1027 | ||
994 | sk_tun = session->tunnel_sock; | 1028 | sk_tun = session->tunnel_sock; |
995 | if (sk_tun == NULL) | 1029 | if (sk_tun == NULL) |
996 | goto abort; | 1030 | goto abort_put_sess; |
997 | tunnel = pppol2tp_sock_to_tunnel(sk_tun); | 1031 | tunnel = pppol2tp_sock_to_tunnel(sk_tun); |
998 | if (tunnel == NULL) | 1032 | if (tunnel == NULL) |
999 | goto abort; | 1033 | goto abort_put_sess; |
1000 | 1034 | ||
1001 | /* What header length is configured for this session? */ | 1035 | /* What header length is configured for this session? */ |
1002 | hdr_len = pppol2tp_l2tp_header_len(session); | 1036 | hdr_len = pppol2tp_l2tp_header_len(session); |
@@ -1009,7 +1043,7 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb) | |||
1009 | sizeof(struct udphdr) + hdr_len + sizeof(ppph); | 1043 | sizeof(struct udphdr) + hdr_len + sizeof(ppph); |
1010 | old_headroom = skb_headroom(skb); | 1044 | old_headroom = skb_headroom(skb); |
1011 | if (skb_cow_head(skb, headroom)) | 1045 | if (skb_cow_head(skb, headroom)) |
1012 | goto abort; | 1046 | goto abort_put_sess_tun; |
1013 | 1047 | ||
1014 | new_headroom = skb_headroom(skb); | 1048 | new_headroom = skb_headroom(skb); |
1015 | skb_orphan(skb); | 1049 | skb_orphan(skb); |
@@ -1069,7 +1103,7 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb) | |||
1069 | /* Get routing info from the tunnel socket */ | 1103 | /* Get routing info from the tunnel socket */ |
1070 | dst_release(skb->dst); | 1104 | dst_release(skb->dst); |
1071 | skb->dst = dst_clone(__sk_dst_get(sk_tun)); | 1105 | skb->dst = dst_clone(__sk_dst_get(sk_tun)); |
1072 | skb->sk = sk_tun; | 1106 | pppol2tp_skb_set_owner_w(skb, sk_tun); |
1073 | 1107 | ||
1074 | /* Queue the packet to IP for output */ | 1108 | /* Queue the packet to IP for output */ |
1075 | len = skb->len; | 1109 | len = skb->len; |
@@ -1086,8 +1120,14 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb) | |||
1086 | session->stats.tx_errors++; | 1120 | session->stats.tx_errors++; |
1087 | } | 1121 | } |
1088 | 1122 | ||
1123 | sock_put(sk_tun); | ||
1124 | sock_put(sk); | ||
1089 | return 1; | 1125 | return 1; |
1090 | 1126 | ||
1127 | abort_put_sess_tun: | ||
1128 | sock_put(sk_tun); | ||
1129 | abort_put_sess: | ||
1130 | sock_put(sk); | ||
1091 | abort: | 1131 | abort: |
1092 | /* Free the original skb */ | 1132 | /* Free the original skb */ |
1093 | kfree_skb(skb); | 1133 | kfree_skb(skb); |
@@ -1191,7 +1231,7 @@ static void pppol2tp_tunnel_destruct(struct sock *sk) | |||
1191 | { | 1231 | { |
1192 | struct pppol2tp_tunnel *tunnel; | 1232 | struct pppol2tp_tunnel *tunnel; |
1193 | 1233 | ||
1194 | tunnel = pppol2tp_sock_to_tunnel(sk); | 1234 | tunnel = sk->sk_user_data; |
1195 | if (tunnel == NULL) | 1235 | if (tunnel == NULL) |
1196 | goto end; | 1236 | goto end; |
1197 | 1237 | ||
@@ -1230,10 +1270,12 @@ static void pppol2tp_session_destruct(struct sock *sk) | |||
1230 | if (sk->sk_user_data != NULL) { | 1270 | if (sk->sk_user_data != NULL) { |
1231 | struct pppol2tp_tunnel *tunnel; | 1271 | struct pppol2tp_tunnel *tunnel; |
1232 | 1272 | ||
1233 | session = pppol2tp_sock_to_session(sk); | 1273 | session = sk->sk_user_data; |
1234 | if (session == NULL) | 1274 | if (session == NULL) |
1235 | goto out; | 1275 | goto out; |
1236 | 1276 | ||
1277 | BUG_ON(session->magic != L2TP_SESSION_MAGIC); | ||
1278 | |||
1237 | /* Don't use pppol2tp_sock_to_tunnel() here to | 1279 | /* Don't use pppol2tp_sock_to_tunnel() here to |
1238 | * get the tunnel context because the tunnel | 1280 | * get the tunnel context because the tunnel |
1239 | * socket might have already been closed (its | 1281 | * socket might have already been closed (its |
@@ -1279,6 +1321,7 @@ out: | |||
1279 | static int pppol2tp_release(struct socket *sock) | 1321 | static int pppol2tp_release(struct socket *sock) |
1280 | { | 1322 | { |
1281 | struct sock *sk = sock->sk; | 1323 | struct sock *sk = sock->sk; |
1324 | struct pppol2tp_session *session; | ||
1282 | int error; | 1325 | int error; |
1283 | 1326 | ||
1284 | if (!sk) | 1327 | if (!sk) |
@@ -1296,9 +1339,18 @@ static int pppol2tp_release(struct socket *sock) | |||
1296 | sock_orphan(sk); | 1339 | sock_orphan(sk); |
1297 | sock->sk = NULL; | 1340 | sock->sk = NULL; |
1298 | 1341 | ||
1342 | session = pppol2tp_sock_to_session(sk); | ||
1343 | |||
1299 | /* Purge any queued data */ | 1344 | /* Purge any queued data */ |
1300 | skb_queue_purge(&sk->sk_receive_queue); | 1345 | skb_queue_purge(&sk->sk_receive_queue); |
1301 | skb_queue_purge(&sk->sk_write_queue); | 1346 | skb_queue_purge(&sk->sk_write_queue); |
1347 | if (session != NULL) { | ||
1348 | struct sk_buff *skb; | ||
1349 | while ((skb = skb_dequeue(&session->reorder_q))) { | ||
1350 | kfree_skb(skb); | ||
1351 | sock_put(sk); | ||
1352 | } | ||
1353 | } | ||
1302 | 1354 | ||
1303 | release_sock(sk); | 1355 | release_sock(sk); |
1304 | 1356 | ||
@@ -1601,7 +1653,7 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
1601 | 1653 | ||
1602 | error = ppp_register_channel(&po->chan); | 1654 | error = ppp_register_channel(&po->chan); |
1603 | if (error) | 1655 | if (error) |
1604 | goto end; | 1656 | goto end_put_tun; |
1605 | 1657 | ||
1606 | /* This is how we get the session context from the socket. */ | 1658 | /* This is how we get the session context from the socket. */ |
1607 | sk->sk_user_data = session; | 1659 | sk->sk_user_data = session; |
@@ -1621,6 +1673,8 @@ out_no_ppp: | |||
1621 | PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, | 1673 | PRINTK(session->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, |
1622 | "%s: created\n", session->name); | 1674 | "%s: created\n", session->name); |
1623 | 1675 | ||
1676 | end_put_tun: | ||
1677 | sock_put(tunnel_sock); | ||
1624 | end: | 1678 | end: |
1625 | release_sock(sk); | 1679 | release_sock(sk); |
1626 | 1680 | ||
@@ -1668,6 +1722,7 @@ static int pppol2tp_getname(struct socket *sock, struct sockaddr *uaddr, | |||
1668 | *usockaddr_len = len; | 1722 | *usockaddr_len = len; |
1669 | 1723 | ||
1670 | error = 0; | 1724 | error = 0; |
1725 | sock_put(sock->sk); | ||
1671 | 1726 | ||
1672 | end: | 1727 | end: |
1673 | return error; | 1728 | return error; |
@@ -1906,14 +1961,17 @@ static int pppol2tp_ioctl(struct socket *sock, unsigned int cmd, | |||
1906 | err = -EBADF; | 1961 | err = -EBADF; |
1907 | tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock); | 1962 | tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock); |
1908 | if (tunnel == NULL) | 1963 | if (tunnel == NULL) |
1909 | goto end; | 1964 | goto end_put_sess; |
1910 | 1965 | ||
1911 | err = pppol2tp_tunnel_ioctl(tunnel, cmd, arg); | 1966 | err = pppol2tp_tunnel_ioctl(tunnel, cmd, arg); |
1912 | goto end; | 1967 | sock_put(session->tunnel_sock); |
1968 | goto end_put_sess; | ||
1913 | } | 1969 | } |
1914 | 1970 | ||
1915 | err = pppol2tp_session_ioctl(session, cmd, arg); | 1971 | err = pppol2tp_session_ioctl(session, cmd, arg); |
1916 | 1972 | ||
1973 | end_put_sess: | ||
1974 | sock_put(sk); | ||
1917 | end: | 1975 | end: |
1918 | return err; | 1976 | return err; |
1919 | } | 1977 | } |
@@ -2059,14 +2117,17 @@ static int pppol2tp_setsockopt(struct socket *sock, int level, int optname, | |||
2059 | err = -EBADF; | 2117 | err = -EBADF; |
2060 | tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock); | 2118 | tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock); |
2061 | if (tunnel == NULL) | 2119 | if (tunnel == NULL) |
2062 | goto end; | 2120 | goto end_put_sess; |
2063 | 2121 | ||
2064 | err = pppol2tp_tunnel_setsockopt(sk, tunnel, optname, val); | 2122 | err = pppol2tp_tunnel_setsockopt(sk, tunnel, optname, val); |
2123 | sock_put(session->tunnel_sock); | ||
2065 | } else | 2124 | } else |
2066 | err = pppol2tp_session_setsockopt(sk, session, optname, val); | 2125 | err = pppol2tp_session_setsockopt(sk, session, optname, val); |
2067 | 2126 | ||
2068 | err = 0; | 2127 | err = 0; |
2069 | 2128 | ||
2129 | end_put_sess: | ||
2130 | sock_put(sk); | ||
2070 | end: | 2131 | end: |
2071 | return err; | 2132 | return err; |
2072 | } | 2133 | } |
@@ -2181,20 +2242,24 @@ static int pppol2tp_getsockopt(struct socket *sock, int level, | |||
2181 | err = -EBADF; | 2242 | err = -EBADF; |
2182 | tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock); | 2243 | tunnel = pppol2tp_sock_to_tunnel(session->tunnel_sock); |
2183 | if (tunnel == NULL) | 2244 | if (tunnel == NULL) |
2184 | goto end; | 2245 | goto end_put_sess; |
2185 | 2246 | ||
2186 | err = pppol2tp_tunnel_getsockopt(sk, tunnel, optname, &val); | 2247 | err = pppol2tp_tunnel_getsockopt(sk, tunnel, optname, &val); |
2248 | sock_put(session->tunnel_sock); | ||
2187 | } else | 2249 | } else |
2188 | err = pppol2tp_session_getsockopt(sk, session, optname, &val); | 2250 | err = pppol2tp_session_getsockopt(sk, session, optname, &val); |
2189 | 2251 | ||
2190 | err = -EFAULT; | 2252 | err = -EFAULT; |
2191 | if (put_user(len, (int __user *) optlen)) | 2253 | if (put_user(len, (int __user *) optlen)) |
2192 | goto end; | 2254 | goto end_put_sess; |
2193 | 2255 | ||
2194 | if (copy_to_user((void __user *) optval, &val, len)) | 2256 | if (copy_to_user((void __user *) optval, &val, len)) |
2195 | goto end; | 2257 | goto end_put_sess; |
2196 | 2258 | ||
2197 | err = 0; | 2259 | err = 0; |
2260 | |||
2261 | end_put_sess: | ||
2262 | sock_put(sk); | ||
2198 | end: | 2263 | end: |
2199 | return err; | 2264 | return err; |
2200 | } | 2265 | } |
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c index b4b63805ee8f..61955f8d8011 100644 --- a/drivers/net/sc92031.c +++ b/drivers/net/sc92031.c | |||
@@ -972,7 +972,7 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
972 | skb_copy_and_csum_dev(skb, priv->tx_bufs + entry * TX_BUF_SIZE); | 972 | skb_copy_and_csum_dev(skb, priv->tx_bufs + entry * TX_BUF_SIZE); |
973 | 973 | ||
974 | len = skb->len; | 974 | len = skb->len; |
975 | if (unlikely(len < ETH_ZLEN)) { | 975 | if (len < ETH_ZLEN) { |
976 | memset(priv->tx_bufs + entry * TX_BUF_SIZE + len, | 976 | memset(priv->tx_bufs + entry * TX_BUF_SIZE + len, |
977 | 0, ETH_ZLEN - len); | 977 | 0, ETH_ZLEN - len); |
978 | len = ETH_ZLEN; | 978 | len = ETH_ZLEN; |
diff --git a/drivers/net/sfc/falcon_xmac.c b/drivers/net/sfc/falcon_xmac.c index dbdcee4b0f8d..55c0d9760be8 100644 --- a/drivers/net/sfc/falcon_xmac.c +++ b/drivers/net/sfc/falcon_xmac.c | |||
@@ -459,7 +459,7 @@ static int falcon_check_xaui_link_up(struct efx_nic *efx) | |||
459 | tries--; | 459 | tries--; |
460 | } | 460 | } |
461 | 461 | ||
462 | EFX_ERR(efx, "Failed to bring XAUI link back up in %d tries!\n", | 462 | EFX_LOG(efx, "Failed to bring XAUI link back up in %d tries!\n", |
463 | max_tries); | 463 | max_tries); |
464 | return 0; | 464 | return 0; |
465 | } | 465 | } |
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c index f8d46134daca..359452a06c67 100644 --- a/drivers/net/sun3lance.c +++ b/drivers/net/sun3lance.c | |||
@@ -250,6 +250,9 @@ struct net_device * __init sun3lance_probe(int unit) | |||
250 | static int found; | 250 | static int found; |
251 | int err = -ENODEV; | 251 | int err = -ENODEV; |
252 | 252 | ||
253 | if (!MACH_IS_SUN3 && !MACH_IS_SUN3X) | ||
254 | return ERR_PTR(-ENODEV); | ||
255 | |||
253 | /* check that this machine has an onboard lance */ | 256 | /* check that this machine has an onboard lance */ |
254 | switch(idprom->id_machtype) { | 257 | switch(idprom->id_machtype) { |
255 | case SM_SUN3|SM_3_50: | 258 | case SM_SUN3|SM_3_50: |
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c index b4e7f30ea4e8..1aa425be3067 100644 --- a/drivers/net/sunhme.c +++ b/drivers/net/sunhme.c | |||
@@ -111,7 +111,7 @@ static __inline__ void tx_add_log(struct happy_meal *hp, unsigned int a, unsigne | |||
111 | struct hme_tx_logent *tlp; | 111 | struct hme_tx_logent *tlp; |
112 | unsigned long flags; | 112 | unsigned long flags; |
113 | 113 | ||
114 | save_and_cli(flags); | 114 | local_irq_save(flags); |
115 | tlp = &tx_log[txlog_cur_entry]; | 115 | tlp = &tx_log[txlog_cur_entry]; |
116 | tlp->tstamp = (unsigned int)jiffies; | 116 | tlp->tstamp = (unsigned int)jiffies; |
117 | tlp->tx_new = hp->tx_new; | 117 | tlp->tx_new = hp->tx_new; |
@@ -119,7 +119,7 @@ static __inline__ void tx_add_log(struct happy_meal *hp, unsigned int a, unsigne | |||
119 | tlp->action = a; | 119 | tlp->action = a; |
120 | tlp->status = s; | 120 | tlp->status = s; |
121 | txlog_cur_entry = (txlog_cur_entry + 1) & (TX_LOG_LEN - 1); | 121 | txlog_cur_entry = (txlog_cur_entry + 1) & (TX_LOG_LEN - 1); |
122 | restore_flags(flags); | 122 | local_irq_restore(flags); |
123 | } | 123 | } |
124 | static __inline__ void tx_dump_log(void) | 124 | static __inline__ void tx_dump_log(void) |
125 | { | 125 | { |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index d9f248f23b97..633c128a6228 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -1828,6 +1828,21 @@ static void tg3_frob_aux_power(struct tg3 *tp) | |||
1828 | GRC_LCLCTRL_GPIO_OUTPUT0 | | 1828 | GRC_LCLCTRL_GPIO_OUTPUT0 | |
1829 | GRC_LCLCTRL_GPIO_OUTPUT1), | 1829 | GRC_LCLCTRL_GPIO_OUTPUT1), |
1830 | 100); | 1830 | 100); |
1831 | } else if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5761) { | ||
1832 | /* The 5761 non-e device swaps GPIO 0 and GPIO 2. */ | ||
1833 | u32 grc_local_ctrl = GRC_LCLCTRL_GPIO_OE0 | | ||
1834 | GRC_LCLCTRL_GPIO_OE1 | | ||
1835 | GRC_LCLCTRL_GPIO_OE2 | | ||
1836 | GRC_LCLCTRL_GPIO_OUTPUT0 | | ||
1837 | GRC_LCLCTRL_GPIO_OUTPUT1 | | ||
1838 | tp->grc_local_ctrl; | ||
1839 | tw32_wait_f(GRC_LOCAL_CTRL, grc_local_ctrl, 100); | ||
1840 | |||
1841 | grc_local_ctrl |= GRC_LCLCTRL_GPIO_OUTPUT2; | ||
1842 | tw32_wait_f(GRC_LOCAL_CTRL, grc_local_ctrl, 100); | ||
1843 | |||
1844 | grc_local_ctrl &= ~GRC_LCLCTRL_GPIO_OUTPUT0; | ||
1845 | tw32_wait_f(GRC_LOCAL_CTRL, grc_local_ctrl, 100); | ||
1831 | } else { | 1846 | } else { |
1832 | u32 no_gpio2; | 1847 | u32 no_gpio2; |
1833 | u32 grc_local_ctrl = 0; | 1848 | u32 grc_local_ctrl = 0; |
@@ -3534,8 +3549,7 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset) | |||
3534 | err |= tg3_readphy(tp, MII_BMCR, &bmcr); | 3549 | err |= tg3_readphy(tp, MII_BMCR, &bmcr); |
3535 | 3550 | ||
3536 | if ((tp->link_config.autoneg == AUTONEG_ENABLE) && !force_reset && | 3551 | if ((tp->link_config.autoneg == AUTONEG_ENABLE) && !force_reset && |
3537 | (tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT) && | 3552 | (tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT)) { |
3538 | tp->link_config.flowctrl == tp->link_config.active_flowctrl) { | ||
3539 | /* do nothing, just check for link up at the end */ | 3553 | /* do nothing, just check for link up at the end */ |
3540 | } else if (tp->link_config.autoneg == AUTONEG_ENABLE) { | 3554 | } else if (tp->link_config.autoneg == AUTONEG_ENABLE) { |
3541 | u32 adv, new_adv; | 3555 | u32 adv, new_adv; |
@@ -9008,7 +9022,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
9008 | (cmd->speed == SPEED_1000)) | 9022 | (cmd->speed == SPEED_1000)) |
9009 | return -EINVAL; | 9023 | return -EINVAL; |
9010 | else if ((cmd->speed == SPEED_1000) && | 9024 | else if ((cmd->speed == SPEED_1000) && |
9011 | (tp->tg3_flags2 & TG3_FLAG_10_100_ONLY)) | 9025 | (tp->tg3_flags & TG3_FLAG_10_100_ONLY)) |
9012 | return -EINVAL; | 9026 | return -EINVAL; |
9013 | 9027 | ||
9014 | tg3_full_lock(tp, 0); | 9028 | tg3_full_lock(tp, 0); |
@@ -12275,6 +12289,15 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
12275 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755) | 12289 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755) |
12276 | tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_UART_SEL; | 12290 | tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_UART_SEL; |
12277 | 12291 | ||
12292 | if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5761) { | ||
12293 | /* Turn off the debug UART. */ | ||
12294 | tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_UART_SEL; | ||
12295 | if (tp->tg3_flags2 & TG3_FLG2_IS_NIC) | ||
12296 | /* Keep VMain power. */ | ||
12297 | tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_OE0 | | ||
12298 | GRC_LCLCTRL_GPIO_OUTPUT0; | ||
12299 | } | ||
12300 | |||
12278 | /* Force the chip into D0. */ | 12301 | /* Force the chip into D0. */ |
12279 | err = tg3_set_power_state(tp, PCI_D0); | 12302 | err = tg3_set_power_state(tp, PCI_D0); |
12280 | if (err) { | 12303 | if (err) { |
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index f9d13fa05d64..55670b5eb611 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -1729,12 +1729,15 @@ static int tulip_suspend (struct pci_dev *pdev, pm_message_t state) | |||
1729 | if (!dev) | 1729 | if (!dev) |
1730 | return -EINVAL; | 1730 | return -EINVAL; |
1731 | 1731 | ||
1732 | if (netif_running(dev)) | 1732 | if (!netif_running(dev)) |
1733 | tulip_down(dev); | 1733 | goto save_state; |
1734 | |||
1735 | tulip_down(dev); | ||
1734 | 1736 | ||
1735 | netif_device_detach(dev); | 1737 | netif_device_detach(dev); |
1736 | free_irq(dev->irq, dev); | 1738 | free_irq(dev->irq, dev); |
1737 | 1739 | ||
1740 | save_state: | ||
1738 | pci_save_state(pdev); | 1741 | pci_save_state(pdev); |
1739 | pci_disable_device(pdev); | 1742 | pci_disable_device(pdev); |
1740 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | 1743 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); |
@@ -1754,6 +1757,9 @@ static int tulip_resume(struct pci_dev *pdev) | |||
1754 | pci_set_power_state(pdev, PCI_D0); | 1757 | pci_set_power_state(pdev, PCI_D0); |
1755 | pci_restore_state(pdev); | 1758 | pci_restore_state(pdev); |
1756 | 1759 | ||
1760 | if (!netif_running(dev)) | ||
1761 | return 0; | ||
1762 | |||
1757 | if ((retval = pci_enable_device(pdev))) { | 1763 | if ((retval = pci_enable_device(pdev))) { |
1758 | printk (KERN_ERR "tulip: pci_enable_device failed in resume\n"); | 1764 | printk (KERN_ERR "tulip: pci_enable_device failed in resume\n"); |
1759 | return retval; | 1765 | return retval; |
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c index 5f176f2b1c17..cfbbfee55836 100644 --- a/drivers/net/ucc_geth_ethtool.c +++ b/drivers/net/ucc_geth_ethtool.c | |||
@@ -73,6 +73,7 @@ static char tx_fw_stat_gstrings[][ETH_GSTRING_LEN] = { | |||
73 | "tx-frames-ok", | 73 | "tx-frames-ok", |
74 | "tx-excessive-differ-frames", | 74 | "tx-excessive-differ-frames", |
75 | "tx-256-511-frames", | 75 | "tx-256-511-frames", |
76 | "tx-512-1023-frames", | ||
76 | "tx-1024-1518-frames", | 77 | "tx-1024-1518-frames", |
77 | "tx-jumbo-frames", | 78 | "tx-jumbo-frames", |
78 | }; | 79 | }; |
@@ -308,7 +309,7 @@ static void uec_get_strings(struct net_device *netdev, u32 stringset, u8 *buf) | |||
308 | buf += UEC_TX_FW_STATS_LEN * ETH_GSTRING_LEN; | 309 | buf += UEC_TX_FW_STATS_LEN * ETH_GSTRING_LEN; |
309 | } | 310 | } |
310 | if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX) | 311 | if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX) |
311 | memcpy(buf, tx_fw_stat_gstrings, UEC_RX_FW_STATS_LEN * | 312 | memcpy(buf, rx_fw_stat_gstrings, UEC_RX_FW_STATS_LEN * |
312 | ETH_GSTRING_LEN); | 313 | ETH_GSTRING_LEN); |
313 | } | 314 | } |
314 | 315 | ||
diff --git a/drivers/net/usb/cdc_subset.c b/drivers/net/usb/cdc_subset.c index 0ec7936cbe21..c66b9c324f54 100644 --- a/drivers/net/usb/cdc_subset.c +++ b/drivers/net/usb/cdc_subset.c | |||
@@ -218,7 +218,7 @@ static const struct driver_info blob_info = { | |||
218 | /*-------------------------------------------------------------------------*/ | 218 | /*-------------------------------------------------------------------------*/ |
219 | 219 | ||
220 | #ifndef HAVE_HARDWARE | 220 | #ifndef HAVE_HARDWARE |
221 | #error You need to configure some hardware for this driver | 221 | #warning You need to configure some hardware for this driver |
222 | #endif | 222 | #endif |
223 | 223 | ||
224 | /* | 224 | /* |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index fe7cdf2a2a23..5450eac9e263 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -47,6 +47,9 @@ struct virtnet_info | |||
47 | /* Number of input buffers, and max we've ever had. */ | 47 | /* Number of input buffers, and max we've ever had. */ |
48 | unsigned int num, max; | 48 | unsigned int num, max; |
49 | 49 | ||
50 | /* For cleaning up after transmission. */ | ||
51 | struct tasklet_struct tasklet; | ||
52 | |||
50 | /* Receive & send queues. */ | 53 | /* Receive & send queues. */ |
51 | struct sk_buff_head recv; | 54 | struct sk_buff_head recv; |
52 | struct sk_buff_head send; | 55 | struct sk_buff_head send; |
@@ -68,8 +71,13 @@ static void skb_xmit_done(struct virtqueue *svq) | |||
68 | 71 | ||
69 | /* Suppress further interrupts. */ | 72 | /* Suppress further interrupts. */ |
70 | svq->vq_ops->disable_cb(svq); | 73 | svq->vq_ops->disable_cb(svq); |
74 | |||
71 | /* We were waiting for more output buffers. */ | 75 | /* We were waiting for more output buffers. */ |
72 | netif_wake_queue(vi->dev); | 76 | netif_wake_queue(vi->dev); |
77 | |||
78 | /* Make sure we re-xmit last_xmit_skb: if there are no more packets | ||
79 | * queued, start_xmit won't be called. */ | ||
80 | tasklet_schedule(&vi->tasklet); | ||
73 | } | 81 | } |
74 | 82 | ||
75 | static void receive_skb(struct net_device *dev, struct sk_buff *skb, | 83 | static void receive_skb(struct net_device *dev, struct sk_buff *skb, |
@@ -278,6 +286,18 @@ static int xmit_skb(struct virtnet_info *vi, struct sk_buff *skb) | |||
278 | return vi->svq->vq_ops->add_buf(vi->svq, sg, num, 0, skb); | 286 | return vi->svq->vq_ops->add_buf(vi->svq, sg, num, 0, skb); |
279 | } | 287 | } |
280 | 288 | ||
289 | static void xmit_tasklet(unsigned long data) | ||
290 | { | ||
291 | struct virtnet_info *vi = (void *)data; | ||
292 | |||
293 | netif_tx_lock_bh(vi->dev); | ||
294 | if (vi->last_xmit_skb && xmit_skb(vi, vi->last_xmit_skb) == 0) { | ||
295 | vi->svq->vq_ops->kick(vi->svq); | ||
296 | vi->last_xmit_skb = NULL; | ||
297 | } | ||
298 | netif_tx_unlock_bh(vi->dev); | ||
299 | } | ||
300 | |||
281 | static int start_xmit(struct sk_buff *skb, struct net_device *dev) | 301 | static int start_xmit(struct sk_buff *skb, struct net_device *dev) |
282 | { | 302 | { |
283 | struct virtnet_info *vi = netdev_priv(dev); | 303 | struct virtnet_info *vi = netdev_priv(dev); |
@@ -287,21 +307,25 @@ again: | |||
287 | free_old_xmit_skbs(vi); | 307 | free_old_xmit_skbs(vi); |
288 | 308 | ||
289 | /* If we has a buffer left over from last time, send it now. */ | 309 | /* If we has a buffer left over from last time, send it now. */ |
290 | if (vi->last_xmit_skb) { | 310 | if (unlikely(vi->last_xmit_skb)) { |
291 | if (xmit_skb(vi, vi->last_xmit_skb) != 0) { | 311 | if (xmit_skb(vi, vi->last_xmit_skb) != 0) { |
292 | /* Drop this skb: we only queue one. */ | 312 | /* Drop this skb: we only queue one. */ |
293 | vi->dev->stats.tx_dropped++; | 313 | vi->dev->stats.tx_dropped++; |
294 | kfree_skb(skb); | 314 | kfree_skb(skb); |
315 | skb = NULL; | ||
295 | goto stop_queue; | 316 | goto stop_queue; |
296 | } | 317 | } |
297 | vi->last_xmit_skb = NULL; | 318 | vi->last_xmit_skb = NULL; |
298 | } | 319 | } |
299 | 320 | ||
300 | /* Put new one in send queue and do transmit */ | 321 | /* Put new one in send queue and do transmit */ |
301 | __skb_queue_head(&vi->send, skb); | 322 | if (likely(skb)) { |
302 | if (xmit_skb(vi, skb) != 0) { | 323 | __skb_queue_head(&vi->send, skb); |
303 | vi->last_xmit_skb = skb; | 324 | if (xmit_skb(vi, skb) != 0) { |
304 | goto stop_queue; | 325 | vi->last_xmit_skb = skb; |
326 | skb = NULL; | ||
327 | goto stop_queue; | ||
328 | } | ||
305 | } | 329 | } |
306 | done: | 330 | done: |
307 | vi->svq->vq_ops->kick(vi->svq); | 331 | vi->svq->vq_ops->kick(vi->svq); |
@@ -428,6 +452,8 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
428 | skb_queue_head_init(&vi->recv); | 452 | skb_queue_head_init(&vi->recv); |
429 | skb_queue_head_init(&vi->send); | 453 | skb_queue_head_init(&vi->send); |
430 | 454 | ||
455 | tasklet_init(&vi->tasklet, xmit_tasklet, (unsigned long)vi); | ||
456 | |||
431 | err = register_netdev(dev); | 457 | err = register_netdev(dev); |
432 | if (err) { | 458 | if (err) { |
433 | pr_debug("virtio_net: registering device failed\n"); | 459 | pr_debug("virtio_net: registering device failed\n"); |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 17ced37e55ed..1e1446bf4b48 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -2906,7 +2906,7 @@ EXPORT_SYMBOL(init_airo_card); | |||
2906 | 2906 | ||
2907 | static int waitbusy (struct airo_info *ai) { | 2907 | static int waitbusy (struct airo_info *ai) { |
2908 | int delay = 0; | 2908 | int delay = 0; |
2909 | while ((IN4500 (ai, COMMAND) & COMMAND_BUSY) && (delay < 10000)) { | 2909 | while ((IN4500(ai, COMMAND) & COMMAND_BUSY) && (delay < 10000)) { |
2910 | udelay (10); | 2910 | udelay (10); |
2911 | if ((++delay % 20) == 0) | 2911 | if ((++delay % 20) == 0) |
2912 | OUT4500(ai, EVACK, EV_CLEARCOMMANDBUSY); | 2912 | OUT4500(ai, EVACK, EV_CLEARCOMMANDBUSY); |
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index f978a9d5190b..7bb2646ae0ef 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/string.h> | 47 | #include <linux/string.h> |
48 | #include <linux/ctype.h> | 48 | #include <linux/ctype.h> |
49 | #include <linux/timer.h> | 49 | #include <linux/timer.h> |
50 | #include <asm/byteorder.h> | ||
50 | #include <asm/io.h> | 51 | #include <asm/io.h> |
51 | #include <asm/system.h> | 52 | #include <asm/system.h> |
52 | #include <asm/uaccess.h> | 53 | #include <asm/uaccess.h> |
@@ -60,7 +61,6 @@ | |||
60 | #include <linux/delay.h> | 61 | #include <linux/delay.h> |
61 | #include <linux/wireless.h> | 62 | #include <linux/wireless.h> |
62 | #include <net/iw_handler.h> | 63 | #include <net/iw_handler.h> |
63 | #include <linux/byteorder/generic.h> | ||
64 | #include <linux/crc32.h> | 64 | #include <linux/crc32.h> |
65 | #include <linux/proc_fs.h> | 65 | #include <linux/proc_fs.h> |
66 | #include <linux/device.h> | 66 | #include <linux/device.h> |
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig index f51b2d9b085b..1fa043d1802c 100644 --- a/drivers/net/wireless/b43/Kconfig +++ b/drivers/net/wireless/b43/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config B43 | 1 | config B43 |
2 | tristate "Broadcom 43xx wireless support (mac80211 stack)" | 2 | tristate "Broadcom 43xx wireless support (mac80211 stack)" |
3 | depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 | 3 | depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 && HAS_DMA |
4 | select SSB | 4 | select SSB |
5 | select FW_LOADER | 5 | select FW_LOADER |
6 | select HW_RANDOM | 6 | select HW_RANDOM |
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index e919189919bb..239e71c3d1b1 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
@@ -755,6 +755,7 @@ struct b43_wl { | |||
755 | struct sk_buff *current_beacon; | 755 | struct sk_buff *current_beacon; |
756 | bool beacon0_uploaded; | 756 | bool beacon0_uploaded; |
757 | bool beacon1_uploaded; | 757 | bool beacon1_uploaded; |
758 | bool beacon_templates_virgin; /* Never wrote the templates? */ | ||
758 | struct work_struct beacon_update_trigger; | 759 | struct work_struct beacon_update_trigger; |
759 | 760 | ||
760 | /* The current QOS parameters for the 4 queues. | 761 | /* The current QOS parameters for the 4 queues. |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index f9c14c66434e..1e31e0bca744 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -1550,6 +1550,30 @@ static void b43_write_probe_resp_template(struct b43_wldev *dev, | |||
1550 | kfree(probe_resp_data); | 1550 | kfree(probe_resp_data); |
1551 | } | 1551 | } |
1552 | 1552 | ||
1553 | static void b43_upload_beacon0(struct b43_wldev *dev) | ||
1554 | { | ||
1555 | struct b43_wl *wl = dev->wl; | ||
1556 | |||
1557 | if (wl->beacon0_uploaded) | ||
1558 | return; | ||
1559 | b43_write_beacon_template(dev, 0x68, 0x18); | ||
1560 | /* FIXME: Probe resp upload doesn't really belong here, | ||
1561 | * but we don't use that feature anyway. */ | ||
1562 | b43_write_probe_resp_template(dev, 0x268, 0x4A, | ||
1563 | &__b43_ratetable[3]); | ||
1564 | wl->beacon0_uploaded = 1; | ||
1565 | } | ||
1566 | |||
1567 | static void b43_upload_beacon1(struct b43_wldev *dev) | ||
1568 | { | ||
1569 | struct b43_wl *wl = dev->wl; | ||
1570 | |||
1571 | if (wl->beacon1_uploaded) | ||
1572 | return; | ||
1573 | b43_write_beacon_template(dev, 0x468, 0x1A); | ||
1574 | wl->beacon1_uploaded = 1; | ||
1575 | } | ||
1576 | |||
1553 | static void handle_irq_beacon(struct b43_wldev *dev) | 1577 | static void handle_irq_beacon(struct b43_wldev *dev) |
1554 | { | 1578 | { |
1555 | struct b43_wl *wl = dev->wl; | 1579 | struct b43_wl *wl = dev->wl; |
@@ -1575,24 +1599,27 @@ static void handle_irq_beacon(struct b43_wldev *dev) | |||
1575 | return; | 1599 | return; |
1576 | } | 1600 | } |
1577 | 1601 | ||
1578 | if (!beacon0_valid) { | 1602 | if (unlikely(wl->beacon_templates_virgin)) { |
1579 | if (!wl->beacon0_uploaded) { | 1603 | /* We never uploaded a beacon before. |
1580 | b43_write_beacon_template(dev, 0x68, 0x18); | 1604 | * Upload both templates now, but only mark one valid. */ |
1581 | b43_write_probe_resp_template(dev, 0x268, 0x4A, | 1605 | wl->beacon_templates_virgin = 0; |
1582 | &__b43_ratetable[3]); | 1606 | b43_upload_beacon0(dev); |
1583 | wl->beacon0_uploaded = 1; | 1607 | b43_upload_beacon1(dev); |
1584 | } | ||
1585 | cmd = b43_read32(dev, B43_MMIO_MACCMD); | 1608 | cmd = b43_read32(dev, B43_MMIO_MACCMD); |
1586 | cmd |= B43_MACCMD_BEACON0_VALID; | 1609 | cmd |= B43_MACCMD_BEACON0_VALID; |
1587 | b43_write32(dev, B43_MMIO_MACCMD, cmd); | 1610 | b43_write32(dev, B43_MMIO_MACCMD, cmd); |
1588 | } else if (!beacon1_valid) { | 1611 | } else { |
1589 | if (!wl->beacon1_uploaded) { | 1612 | if (!beacon0_valid) { |
1590 | b43_write_beacon_template(dev, 0x468, 0x1A); | 1613 | b43_upload_beacon0(dev); |
1591 | wl->beacon1_uploaded = 1; | 1614 | cmd = b43_read32(dev, B43_MMIO_MACCMD); |
1615 | cmd |= B43_MACCMD_BEACON0_VALID; | ||
1616 | b43_write32(dev, B43_MMIO_MACCMD, cmd); | ||
1617 | } else if (!beacon1_valid) { | ||
1618 | b43_upload_beacon1(dev); | ||
1619 | cmd = b43_read32(dev, B43_MMIO_MACCMD); | ||
1620 | cmd |= B43_MACCMD_BEACON1_VALID; | ||
1621 | b43_write32(dev, B43_MMIO_MACCMD, cmd); | ||
1592 | } | 1622 | } |
1593 | cmd = b43_read32(dev, B43_MMIO_MACCMD); | ||
1594 | cmd |= B43_MACCMD_BEACON1_VALID; | ||
1595 | b43_write32(dev, B43_MMIO_MACCMD, cmd); | ||
1596 | } | 1623 | } |
1597 | } | 1624 | } |
1598 | 1625 | ||
@@ -4172,6 +4199,9 @@ static int b43_op_start(struct ieee80211_hw *hw) | |||
4172 | wl->filter_flags = 0; | 4199 | wl->filter_flags = 0; |
4173 | wl->radiotap_enabled = 0; | 4200 | wl->radiotap_enabled = 0; |
4174 | b43_qos_clear(wl); | 4201 | b43_qos_clear(wl); |
4202 | wl->beacon0_uploaded = 0; | ||
4203 | wl->beacon1_uploaded = 0; | ||
4204 | wl->beacon_templates_virgin = 1; | ||
4175 | 4205 | ||
4176 | /* First register RFkill. | 4206 | /* First register RFkill. |
4177 | * LEDs that are registered later depend on it. */ | 4207 | * LEDs that are registered later depend on it. */ |
@@ -4338,7 +4368,9 @@ static void b43_chip_reset(struct work_struct *work) | |||
4338 | goto out; | 4368 | goto out; |
4339 | } | 4369 | } |
4340 | } | 4370 | } |
4341 | out: | 4371 | out: |
4372 | if (err) | ||
4373 | wl->current_dev = NULL; /* Failed to init the dev. */ | ||
4342 | mutex_unlock(&wl->mutex); | 4374 | mutex_unlock(&wl->mutex); |
4343 | if (err) | 4375 | if (err) |
4344 | b43err(wl, "Controller restart FAILED\n"); | 4376 | b43err(wl, "Controller restart FAILED\n"); |
@@ -4479,9 +4511,11 @@ static void b43_one_core_detach(struct ssb_device *dev) | |||
4479 | struct b43_wldev *wldev; | 4511 | struct b43_wldev *wldev; |
4480 | struct b43_wl *wl; | 4512 | struct b43_wl *wl; |
4481 | 4513 | ||
4514 | /* Do not cancel ieee80211-workqueue based work here. | ||
4515 | * See comment in b43_remove(). */ | ||
4516 | |||
4482 | wldev = ssb_get_drvdata(dev); | 4517 | wldev = ssb_get_drvdata(dev); |
4483 | wl = wldev->wl; | 4518 | wl = wldev->wl; |
4484 | cancel_work_sync(&wldev->restart_work); | ||
4485 | b43_debugfs_remove_device(wldev); | 4519 | b43_debugfs_remove_device(wldev); |
4486 | b43_wireless_core_detach(wldev); | 4520 | b43_wireless_core_detach(wldev); |
4487 | list_del(&wldev->list); | 4521 | list_del(&wldev->list); |
@@ -4666,6 +4700,10 @@ static void b43_remove(struct ssb_device *dev) | |||
4666 | struct b43_wl *wl = ssb_get_devtypedata(dev); | 4700 | struct b43_wl *wl = ssb_get_devtypedata(dev); |
4667 | struct b43_wldev *wldev = ssb_get_drvdata(dev); | 4701 | struct b43_wldev *wldev = ssb_get_drvdata(dev); |
4668 | 4702 | ||
4703 | /* We must cancel any work here before unregistering from ieee80211, | ||
4704 | * as the ieee80211 unreg will destroy the workqueue. */ | ||
4705 | cancel_work_sync(&wldev->restart_work); | ||
4706 | |||
4669 | B43_WARN_ON(!wl); | 4707 | B43_WARN_ON(!wl); |
4670 | if (wl->current_dev == wldev) | 4708 | if (wl->current_dev == wldev) |
4671 | ieee80211_unregister_hw(wl->hw); | 4709 | ieee80211_unregister_hw(wl->hw); |
diff --git a/drivers/net/wireless/b43legacy/Kconfig b/drivers/net/wireless/b43legacy/Kconfig index 13c65faf0247..aef2298d37ac 100644 --- a/drivers/net/wireless/b43legacy/Kconfig +++ b/drivers/net/wireless/b43legacy/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config B43LEGACY | 1 | config B43LEGACY |
2 | tristate "Broadcom 43xx-legacy wireless support (mac80211 stack)" | 2 | tristate "Broadcom 43xx-legacy wireless support (mac80211 stack)" |
3 | depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 | 3 | depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 && HAS_DMA |
4 | select SSB | 4 | select SSB |
5 | select FW_LOADER | 5 | select FW_LOADER |
6 | select HW_RANDOM | 6 | select HW_RANDOM |
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index f706ca65f159..5f533b93ad5d 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c | |||
@@ -3036,7 +3036,6 @@ static void b43legacy_set_pretbtt(struct b43legacy_wldev *dev) | |||
3036 | /* Locking: wl->mutex */ | 3036 | /* Locking: wl->mutex */ |
3037 | static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev) | 3037 | static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev) |
3038 | { | 3038 | { |
3039 | struct b43legacy_wl *wl = dev->wl; | ||
3040 | struct b43legacy_phy *phy = &dev->phy; | 3039 | struct b43legacy_phy *phy = &dev->phy; |
3041 | u32 macctl; | 3040 | u32 macctl; |
3042 | 3041 | ||
@@ -3051,12 +3050,6 @@ static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev) | |||
3051 | macctl |= B43legacy_MACCTL_PSM_JMP0; | 3050 | macctl |= B43legacy_MACCTL_PSM_JMP0; |
3052 | b43legacy_write32(dev, B43legacy_MMIO_MACCTL, macctl); | 3051 | b43legacy_write32(dev, B43legacy_MMIO_MACCTL, macctl); |
3053 | 3052 | ||
3054 | mutex_unlock(&wl->mutex); | ||
3055 | /* Must unlock as it would otherwise deadlock. No races here. | ||
3056 | * Cancel possibly pending workqueues. */ | ||
3057 | cancel_work_sync(&dev->restart_work); | ||
3058 | mutex_lock(&wl->mutex); | ||
3059 | |||
3060 | b43legacy_leds_exit(dev); | 3053 | b43legacy_leds_exit(dev); |
3061 | b43legacy_rng_exit(dev->wl); | 3054 | b43legacy_rng_exit(dev->wl); |
3062 | b43legacy_pio_free(dev); | 3055 | b43legacy_pio_free(dev); |
@@ -3482,6 +3475,8 @@ static void b43legacy_chip_reset(struct work_struct *work) | |||
3482 | } | 3475 | } |
3483 | } | 3476 | } |
3484 | out: | 3477 | out: |
3478 | if (err) | ||
3479 | wl->current_dev = NULL; /* Failed to init the dev. */ | ||
3485 | mutex_unlock(&wl->mutex); | 3480 | mutex_unlock(&wl->mutex); |
3486 | if (err) | 3481 | if (err) |
3487 | b43legacyerr(wl, "Controller restart FAILED\n"); | 3482 | b43legacyerr(wl, "Controller restart FAILED\n"); |
@@ -3614,9 +3609,11 @@ static void b43legacy_one_core_detach(struct ssb_device *dev) | |||
3614 | struct b43legacy_wldev *wldev; | 3609 | struct b43legacy_wldev *wldev; |
3615 | struct b43legacy_wl *wl; | 3610 | struct b43legacy_wl *wl; |
3616 | 3611 | ||
3612 | /* Do not cancel ieee80211-workqueue based work here. | ||
3613 | * See comment in b43legacy_remove(). */ | ||
3614 | |||
3617 | wldev = ssb_get_drvdata(dev); | 3615 | wldev = ssb_get_drvdata(dev); |
3618 | wl = wldev->wl; | 3616 | wl = wldev->wl; |
3619 | cancel_work_sync(&wldev->restart_work); | ||
3620 | b43legacy_debugfs_remove_device(wldev); | 3617 | b43legacy_debugfs_remove_device(wldev); |
3621 | b43legacy_wireless_core_detach(wldev); | 3618 | b43legacy_wireless_core_detach(wldev); |
3622 | list_del(&wldev->list); | 3619 | list_del(&wldev->list); |
@@ -3784,6 +3781,10 @@ static void b43legacy_remove(struct ssb_device *dev) | |||
3784 | struct b43legacy_wl *wl = ssb_get_devtypedata(dev); | 3781 | struct b43legacy_wl *wl = ssb_get_devtypedata(dev); |
3785 | struct b43legacy_wldev *wldev = ssb_get_drvdata(dev); | 3782 | struct b43legacy_wldev *wldev = ssb_get_drvdata(dev); |
3786 | 3783 | ||
3784 | /* We must cancel any work here before unregistering from ieee80211, | ||
3785 | * as the ieee80211 unreg will destroy the workqueue. */ | ||
3786 | cancel_work_sync(&wldev->restart_work); | ||
3787 | |||
3787 | B43legacy_WARN_ON(!wl); | 3788 | B43legacy_WARN_ON(!wl); |
3788 | if (wl->current_dev == wldev) | 3789 | if (wl->current_dev == wldev) |
3789 | ieee80211_unregister_hw(wl->hw); | 3790 | ieee80211_unregister_hw(wl->hw); |
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index d74c061994ae..6e704608947c 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -1753,6 +1753,8 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio) | |||
1753 | 1753 | ||
1754 | if (priv->workqueue) { | 1754 | if (priv->workqueue) { |
1755 | cancel_delayed_work(&priv->request_scan); | 1755 | cancel_delayed_work(&priv->request_scan); |
1756 | cancel_delayed_work(&priv->request_direct_scan); | ||
1757 | cancel_delayed_work(&priv->request_passive_scan); | ||
1756 | cancel_delayed_work(&priv->scan_event); | 1758 | cancel_delayed_work(&priv->scan_event); |
1757 | } | 1759 | } |
1758 | queue_work(priv->workqueue, &priv->down); | 1760 | queue_work(priv->workqueue, &priv->down); |
@@ -2005,6 +2007,8 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) | |||
2005 | wake_up_interruptible(&priv->wait_command_queue); | 2007 | wake_up_interruptible(&priv->wait_command_queue); |
2006 | priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); | 2008 | priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); |
2007 | cancel_delayed_work(&priv->request_scan); | 2009 | cancel_delayed_work(&priv->request_scan); |
2010 | cancel_delayed_work(&priv->request_direct_scan); | ||
2011 | cancel_delayed_work(&priv->request_passive_scan); | ||
2008 | cancel_delayed_work(&priv->scan_event); | 2012 | cancel_delayed_work(&priv->scan_event); |
2009 | schedule_work(&priv->link_down); | 2013 | schedule_work(&priv->link_down); |
2010 | queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ); | 2014 | queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ); |
@@ -4712,6 +4716,12 @@ static void ipw_rx_notification(struct ipw_priv *priv, | |||
4712 | priv->status &= ~STATUS_SCAN_FORCED; | 4716 | priv->status &= ~STATUS_SCAN_FORCED; |
4713 | #endif /* CONFIG_IPW2200_MONITOR */ | 4717 | #endif /* CONFIG_IPW2200_MONITOR */ |
4714 | 4718 | ||
4719 | /* Do queued direct scans first */ | ||
4720 | if (priv->status & STATUS_DIRECT_SCAN_PENDING) { | ||
4721 | queue_delayed_work(priv->workqueue, | ||
4722 | &priv->request_direct_scan, 0); | ||
4723 | } | ||
4724 | |||
4715 | if (!(priv->status & (STATUS_ASSOCIATED | | 4725 | if (!(priv->status & (STATUS_ASSOCIATED | |
4716 | STATUS_ASSOCIATING | | 4726 | STATUS_ASSOCIATING | |
4717 | STATUS_ROAMING | | 4727 | STATUS_ROAMING | |
@@ -6267,7 +6277,7 @@ static void ipw_add_scan_channels(struct ipw_priv *priv, | |||
6267 | } | 6277 | } |
6268 | } | 6278 | } |
6269 | 6279 | ||
6270 | static int ipw_request_scan_helper(struct ipw_priv *priv, int type) | 6280 | static int ipw_request_scan_helper(struct ipw_priv *priv, int type, int direct) |
6271 | { | 6281 | { |
6272 | struct ipw_scan_request_ext scan; | 6282 | struct ipw_scan_request_ext scan; |
6273 | int err = 0, scan_type; | 6283 | int err = 0, scan_type; |
@@ -6278,22 +6288,31 @@ static int ipw_request_scan_helper(struct ipw_priv *priv, int type) | |||
6278 | 6288 | ||
6279 | mutex_lock(&priv->mutex); | 6289 | mutex_lock(&priv->mutex); |
6280 | 6290 | ||
6291 | if (direct && (priv->direct_scan_ssid_len == 0)) { | ||
6292 | IPW_DEBUG_HC("Direct scan requested but no SSID to scan for\n"); | ||
6293 | priv->status &= ~STATUS_DIRECT_SCAN_PENDING; | ||
6294 | goto done; | ||
6295 | } | ||
6296 | |||
6281 | if (priv->status & STATUS_SCANNING) { | 6297 | if (priv->status & STATUS_SCANNING) { |
6282 | IPW_DEBUG_HC("Concurrent scan requested. Ignoring.\n"); | 6298 | IPW_DEBUG_HC("Concurrent scan requested. Queuing.\n"); |
6283 | priv->status |= STATUS_SCAN_PENDING; | 6299 | priv->status |= direct ? STATUS_DIRECT_SCAN_PENDING : |
6300 | STATUS_SCAN_PENDING; | ||
6284 | goto done; | 6301 | goto done; |
6285 | } | 6302 | } |
6286 | 6303 | ||
6287 | if (!(priv->status & STATUS_SCAN_FORCED) && | 6304 | if (!(priv->status & STATUS_SCAN_FORCED) && |
6288 | priv->status & STATUS_SCAN_ABORTING) { | 6305 | priv->status & STATUS_SCAN_ABORTING) { |
6289 | IPW_DEBUG_HC("Scan request while abort pending. Queuing.\n"); | 6306 | IPW_DEBUG_HC("Scan request while abort pending. Queuing.\n"); |
6290 | priv->status |= STATUS_SCAN_PENDING; | 6307 | priv->status |= direct ? STATUS_DIRECT_SCAN_PENDING : |
6308 | STATUS_SCAN_PENDING; | ||
6291 | goto done; | 6309 | goto done; |
6292 | } | 6310 | } |
6293 | 6311 | ||
6294 | if (priv->status & STATUS_RF_KILL_MASK) { | 6312 | if (priv->status & STATUS_RF_KILL_MASK) { |
6295 | IPW_DEBUG_HC("Aborting scan due to RF Kill activation\n"); | 6313 | IPW_DEBUG_HC("Queuing scan due to RF Kill activation\n"); |
6296 | priv->status |= STATUS_SCAN_PENDING; | 6314 | priv->status |= direct ? STATUS_DIRECT_SCAN_PENDING : |
6315 | STATUS_SCAN_PENDING; | ||
6297 | goto done; | 6316 | goto done; |
6298 | } | 6317 | } |
6299 | 6318 | ||
@@ -6321,6 +6340,7 @@ static int ipw_request_scan_helper(struct ipw_priv *priv, int type) | |||
6321 | cpu_to_le16(20); | 6340 | cpu_to_le16(20); |
6322 | 6341 | ||
6323 | scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(120); | 6342 | scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(120); |
6343 | scan.dwell_time[IPW_SCAN_ACTIVE_DIRECT_SCAN] = cpu_to_le16(20); | ||
6324 | 6344 | ||
6325 | #ifdef CONFIG_IPW2200_MONITOR | 6345 | #ifdef CONFIG_IPW2200_MONITOR |
6326 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { | 6346 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { |
@@ -6360,13 +6380,23 @@ static int ipw_request_scan_helper(struct ipw_priv *priv, int type) | |||
6360 | cpu_to_le16(2000); | 6380 | cpu_to_le16(2000); |
6361 | } else { | 6381 | } else { |
6362 | #endif /* CONFIG_IPW2200_MONITOR */ | 6382 | #endif /* CONFIG_IPW2200_MONITOR */ |
6363 | /* If we are roaming, then make this a directed scan for the | 6383 | /* Honor direct scans first, otherwise if we are roaming make |
6364 | * current network. Otherwise, ensure that every other scan | 6384 | * this a direct scan for the current network. Finally, |
6365 | * is a fast channel hop scan */ | 6385 | * ensure that every other scan is a fast channel hop scan */ |
6366 | if ((priv->status & STATUS_ROAMING) | 6386 | if (direct) { |
6367 | || (!(priv->status & STATUS_ASSOCIATED) | 6387 | err = ipw_send_ssid(priv, priv->direct_scan_ssid, |
6368 | && (priv->config & CFG_STATIC_ESSID) | 6388 | priv->direct_scan_ssid_len); |
6369 | && (le32_to_cpu(scan.full_scan_index) % 2))) { | 6389 | if (err) { |
6390 | IPW_DEBUG_HC("Attempt to send SSID command " | ||
6391 | "failed\n"); | ||
6392 | goto done; | ||
6393 | } | ||
6394 | |||
6395 | scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN; | ||
6396 | } else if ((priv->status & STATUS_ROAMING) | ||
6397 | || (!(priv->status & STATUS_ASSOCIATED) | ||
6398 | && (priv->config & CFG_STATIC_ESSID) | ||
6399 | && (le32_to_cpu(scan.full_scan_index) % 2))) { | ||
6370 | err = ipw_send_ssid(priv, priv->essid, priv->essid_len); | 6400 | err = ipw_send_ssid(priv, priv->essid, priv->essid_len); |
6371 | if (err) { | 6401 | if (err) { |
6372 | IPW_DEBUG_HC("Attempt to send SSID command " | 6402 | IPW_DEBUG_HC("Attempt to send SSID command " |
@@ -6391,7 +6421,12 @@ send_request: | |||
6391 | } | 6421 | } |
6392 | 6422 | ||
6393 | priv->status |= STATUS_SCANNING; | 6423 | priv->status |= STATUS_SCANNING; |
6394 | priv->status &= ~STATUS_SCAN_PENDING; | 6424 | if (direct) { |
6425 | priv->status &= ~STATUS_DIRECT_SCAN_PENDING; | ||
6426 | priv->direct_scan_ssid_len = 0; | ||
6427 | } else | ||
6428 | priv->status &= ~STATUS_SCAN_PENDING; | ||
6429 | |||
6395 | queue_delayed_work(priv->workqueue, &priv->scan_check, | 6430 | queue_delayed_work(priv->workqueue, &priv->scan_check, |
6396 | IPW_SCAN_CHECK_WATCHDOG); | 6431 | IPW_SCAN_CHECK_WATCHDOG); |
6397 | done: | 6432 | done: |
@@ -6402,15 +6437,22 @@ done: | |||
6402 | static void ipw_request_passive_scan(struct work_struct *work) | 6437 | static void ipw_request_passive_scan(struct work_struct *work) |
6403 | { | 6438 | { |
6404 | struct ipw_priv *priv = | 6439 | struct ipw_priv *priv = |
6405 | container_of(work, struct ipw_priv, request_passive_scan); | 6440 | container_of(work, struct ipw_priv, request_passive_scan.work); |
6406 | ipw_request_scan_helper(priv, IW_SCAN_TYPE_PASSIVE); | 6441 | ipw_request_scan_helper(priv, IW_SCAN_TYPE_PASSIVE, 0); |
6407 | } | 6442 | } |
6408 | 6443 | ||
6409 | static void ipw_request_scan(struct work_struct *work) | 6444 | static void ipw_request_scan(struct work_struct *work) |
6410 | { | 6445 | { |
6411 | struct ipw_priv *priv = | 6446 | struct ipw_priv *priv = |
6412 | container_of(work, struct ipw_priv, request_scan.work); | 6447 | container_of(work, struct ipw_priv, request_scan.work); |
6413 | ipw_request_scan_helper(priv, IW_SCAN_TYPE_ACTIVE); | 6448 | ipw_request_scan_helper(priv, IW_SCAN_TYPE_ACTIVE, 0); |
6449 | } | ||
6450 | |||
6451 | static void ipw_request_direct_scan(struct work_struct *work) | ||
6452 | { | ||
6453 | struct ipw_priv *priv = | ||
6454 | container_of(work, struct ipw_priv, request_direct_scan.work); | ||
6455 | ipw_request_scan_helper(priv, IW_SCAN_TYPE_ACTIVE, 1); | ||
6414 | } | 6456 | } |
6415 | 6457 | ||
6416 | static void ipw_bg_abort_scan(struct work_struct *work) | 6458 | static void ipw_bg_abort_scan(struct work_struct *work) |
@@ -7558,8 +7600,31 @@ static int ipw_associate(void *data) | |||
7558 | priv->ieee->iw_mode == IW_MODE_ADHOC && | 7600 | priv->ieee->iw_mode == IW_MODE_ADHOC && |
7559 | priv->config & CFG_ADHOC_CREATE && | 7601 | priv->config & CFG_ADHOC_CREATE && |
7560 | priv->config & CFG_STATIC_ESSID && | 7602 | priv->config & CFG_STATIC_ESSID && |
7561 | priv->config & CFG_STATIC_CHANNEL && | 7603 | priv->config & CFG_STATIC_CHANNEL) { |
7562 | !list_empty(&priv->ieee->network_free_list)) { | 7604 | /* Use oldest network if the free list is empty */ |
7605 | if (list_empty(&priv->ieee->network_free_list)) { | ||
7606 | struct ieee80211_network *oldest = NULL; | ||
7607 | struct ieee80211_network *target; | ||
7608 | DECLARE_MAC_BUF(mac); | ||
7609 | |||
7610 | list_for_each_entry(target, &priv->ieee->network_list, list) { | ||
7611 | if ((oldest == NULL) || | ||
7612 | (target->last_scanned < oldest->last_scanned)) | ||
7613 | oldest = target; | ||
7614 | } | ||
7615 | |||
7616 | /* If there are no more slots, expire the oldest */ | ||
7617 | list_del(&oldest->list); | ||
7618 | target = oldest; | ||
7619 | IPW_DEBUG_ASSOC("Expired '%s' (%s) from " | ||
7620 | "network list.\n", | ||
7621 | escape_essid(target->ssid, | ||
7622 | target->ssid_len), | ||
7623 | print_mac(mac, target->bssid)); | ||
7624 | list_add_tail(&target->list, | ||
7625 | &priv->ieee->network_free_list); | ||
7626 | } | ||
7627 | |||
7563 | element = priv->ieee->network_free_list.next; | 7628 | element = priv->ieee->network_free_list.next; |
7564 | network = list_entry(element, struct ieee80211_network, list); | 7629 | network = list_entry(element, struct ieee80211_network, list); |
7565 | ipw_adhoc_create(priv, network); | 7630 | ipw_adhoc_create(priv, network); |
@@ -9454,99 +9519,38 @@ static int ipw_wx_get_retry(struct net_device *dev, | |||
9454 | return 0; | 9519 | return 0; |
9455 | } | 9520 | } |
9456 | 9521 | ||
9457 | static int ipw_request_direct_scan(struct ipw_priv *priv, char *essid, | ||
9458 | int essid_len) | ||
9459 | { | ||
9460 | struct ipw_scan_request_ext scan; | ||
9461 | int err = 0, scan_type; | ||
9462 | |||
9463 | if (!(priv->status & STATUS_INIT) || | ||
9464 | (priv->status & STATUS_EXIT_PENDING)) | ||
9465 | return 0; | ||
9466 | |||
9467 | mutex_lock(&priv->mutex); | ||
9468 | |||
9469 | if (priv->status & STATUS_RF_KILL_MASK) { | ||
9470 | IPW_DEBUG_HC("Aborting scan due to RF kill activation\n"); | ||
9471 | priv->status |= STATUS_SCAN_PENDING; | ||
9472 | goto done; | ||
9473 | } | ||
9474 | |||
9475 | IPW_DEBUG_HC("starting request direct scan!\n"); | ||
9476 | |||
9477 | if (priv->status & (STATUS_SCANNING | STATUS_SCAN_ABORTING)) { | ||
9478 | /* We should not sleep here; otherwise we will block most | ||
9479 | * of the system (for instance, we hold rtnl_lock when we | ||
9480 | * get here). | ||
9481 | */ | ||
9482 | err = -EAGAIN; | ||
9483 | goto done; | ||
9484 | } | ||
9485 | memset(&scan, 0, sizeof(scan)); | ||
9486 | |||
9487 | if (priv->config & CFG_SPEED_SCAN) | ||
9488 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = | ||
9489 | cpu_to_le16(30); | ||
9490 | else | ||
9491 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = | ||
9492 | cpu_to_le16(20); | ||
9493 | |||
9494 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] = | ||
9495 | cpu_to_le16(20); | ||
9496 | scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(120); | ||
9497 | scan.dwell_time[IPW_SCAN_ACTIVE_DIRECT_SCAN] = cpu_to_le16(20); | ||
9498 | |||
9499 | scan.full_scan_index = cpu_to_le32(ieee80211_get_scans(priv->ieee)); | ||
9500 | |||
9501 | err = ipw_send_ssid(priv, essid, essid_len); | ||
9502 | if (err) { | ||
9503 | IPW_DEBUG_HC("Attempt to send SSID command failed\n"); | ||
9504 | goto done; | ||
9505 | } | ||
9506 | scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN; | ||
9507 | |||
9508 | ipw_add_scan_channels(priv, &scan, scan_type); | ||
9509 | |||
9510 | err = ipw_send_scan_request_ext(priv, &scan); | ||
9511 | if (err) { | ||
9512 | IPW_DEBUG_HC("Sending scan command failed: %08X\n", err); | ||
9513 | goto done; | ||
9514 | } | ||
9515 | |||
9516 | priv->status |= STATUS_SCANNING; | ||
9517 | |||
9518 | done: | ||
9519 | mutex_unlock(&priv->mutex); | ||
9520 | return err; | ||
9521 | } | ||
9522 | |||
9523 | static int ipw_wx_set_scan(struct net_device *dev, | 9522 | static int ipw_wx_set_scan(struct net_device *dev, |
9524 | struct iw_request_info *info, | 9523 | struct iw_request_info *info, |
9525 | union iwreq_data *wrqu, char *extra) | 9524 | union iwreq_data *wrqu, char *extra) |
9526 | { | 9525 | { |
9527 | struct ipw_priv *priv = ieee80211_priv(dev); | 9526 | struct ipw_priv *priv = ieee80211_priv(dev); |
9528 | struct iw_scan_req *req = (struct iw_scan_req *)extra; | 9527 | struct iw_scan_req *req = (struct iw_scan_req *)extra; |
9528 | struct delayed_work *work = NULL; | ||
9529 | 9529 | ||
9530 | mutex_lock(&priv->mutex); | 9530 | mutex_lock(&priv->mutex); |
9531 | |||
9531 | priv->user_requested_scan = 1; | 9532 | priv->user_requested_scan = 1; |
9532 | mutex_unlock(&priv->mutex); | ||
9533 | 9533 | ||
9534 | if (wrqu->data.length == sizeof(struct iw_scan_req)) { | 9534 | if (wrqu->data.length == sizeof(struct iw_scan_req)) { |
9535 | if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { | 9535 | if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { |
9536 | ipw_request_direct_scan(priv, req->essid, | 9536 | int len = min((int)req->essid_len, |
9537 | req->essid_len); | 9537 | (int)sizeof(priv->direct_scan_ssid)); |
9538 | return 0; | 9538 | memcpy(priv->direct_scan_ssid, req->essid, len); |
9539 | } | 9539 | priv->direct_scan_ssid_len = len; |
9540 | if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { | 9540 | work = &priv->request_direct_scan; |
9541 | queue_work(priv->workqueue, | 9541 | } else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { |
9542 | &priv->request_passive_scan); | 9542 | work = &priv->request_passive_scan; |
9543 | return 0; | ||
9544 | } | 9543 | } |
9544 | } else { | ||
9545 | /* Normal active broadcast scan */ | ||
9546 | work = &priv->request_scan; | ||
9545 | } | 9547 | } |
9546 | 9548 | ||
9549 | mutex_unlock(&priv->mutex); | ||
9550 | |||
9547 | IPW_DEBUG_WX("Start scan\n"); | 9551 | IPW_DEBUG_WX("Start scan\n"); |
9548 | 9552 | ||
9549 | queue_delayed_work(priv->workqueue, &priv->request_scan, 0); | 9553 | queue_delayed_work(priv->workqueue, work, 0); |
9550 | 9554 | ||
9551 | return 0; | 9555 | return 0; |
9552 | } | 9556 | } |
@@ -10708,6 +10712,8 @@ static void ipw_link_up(struct ipw_priv *priv) | |||
10708 | } | 10712 | } |
10709 | 10713 | ||
10710 | cancel_delayed_work(&priv->request_scan); | 10714 | cancel_delayed_work(&priv->request_scan); |
10715 | cancel_delayed_work(&priv->request_direct_scan); | ||
10716 | cancel_delayed_work(&priv->request_passive_scan); | ||
10711 | cancel_delayed_work(&priv->scan_event); | 10717 | cancel_delayed_work(&priv->scan_event); |
10712 | ipw_reset_stats(priv); | 10718 | ipw_reset_stats(priv); |
10713 | /* Ensure the rate is updated immediately */ | 10719 | /* Ensure the rate is updated immediately */ |
@@ -10738,6 +10744,8 @@ static void ipw_link_down(struct ipw_priv *priv) | |||
10738 | 10744 | ||
10739 | /* Cancel any queued work ... */ | 10745 | /* Cancel any queued work ... */ |
10740 | cancel_delayed_work(&priv->request_scan); | 10746 | cancel_delayed_work(&priv->request_scan); |
10747 | cancel_delayed_work(&priv->request_direct_scan); | ||
10748 | cancel_delayed_work(&priv->request_passive_scan); | ||
10741 | cancel_delayed_work(&priv->adhoc_check); | 10749 | cancel_delayed_work(&priv->adhoc_check); |
10742 | cancel_delayed_work(&priv->gather_stats); | 10750 | cancel_delayed_work(&priv->gather_stats); |
10743 | 10751 | ||
@@ -10777,8 +10785,9 @@ static int __devinit ipw_setup_deferred_work(struct ipw_priv *priv) | |||
10777 | INIT_WORK(&priv->up, ipw_bg_up); | 10785 | INIT_WORK(&priv->up, ipw_bg_up); |
10778 | INIT_WORK(&priv->down, ipw_bg_down); | 10786 | INIT_WORK(&priv->down, ipw_bg_down); |
10779 | INIT_DELAYED_WORK(&priv->request_scan, ipw_request_scan); | 10787 | INIT_DELAYED_WORK(&priv->request_scan, ipw_request_scan); |
10788 | INIT_DELAYED_WORK(&priv->request_direct_scan, ipw_request_direct_scan); | ||
10789 | INIT_DELAYED_WORK(&priv->request_passive_scan, ipw_request_passive_scan); | ||
10780 | INIT_DELAYED_WORK(&priv->scan_event, ipw_scan_event); | 10790 | INIT_DELAYED_WORK(&priv->scan_event, ipw_scan_event); |
10781 | INIT_WORK(&priv->request_passive_scan, ipw_request_passive_scan); | ||
10782 | INIT_DELAYED_WORK(&priv->gather_stats, ipw_bg_gather_stats); | 10791 | INIT_DELAYED_WORK(&priv->gather_stats, ipw_bg_gather_stats); |
10783 | INIT_WORK(&priv->abort_scan, ipw_bg_abort_scan); | 10792 | INIT_WORK(&priv->abort_scan, ipw_bg_abort_scan); |
10784 | INIT_WORK(&priv->roam, ipw_bg_roam); | 10793 | INIT_WORK(&priv->roam, ipw_bg_roam); |
@@ -11812,6 +11821,8 @@ static void __devexit ipw_pci_remove(struct pci_dev *pdev) | |||
11812 | cancel_delayed_work(&priv->adhoc_check); | 11821 | cancel_delayed_work(&priv->adhoc_check); |
11813 | cancel_delayed_work(&priv->gather_stats); | 11822 | cancel_delayed_work(&priv->gather_stats); |
11814 | cancel_delayed_work(&priv->request_scan); | 11823 | cancel_delayed_work(&priv->request_scan); |
11824 | cancel_delayed_work(&priv->request_direct_scan); | ||
11825 | cancel_delayed_work(&priv->request_passive_scan); | ||
11815 | cancel_delayed_work(&priv->scan_event); | 11826 | cancel_delayed_work(&priv->scan_event); |
11816 | cancel_delayed_work(&priv->rf_kill); | 11827 | cancel_delayed_work(&priv->rf_kill); |
11817 | cancel_delayed_work(&priv->scan_check); | 11828 | cancel_delayed_work(&priv->scan_check); |
diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index cd3295b66dd6..d4ab28b73b32 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h | |||
@@ -1037,6 +1037,7 @@ struct ipw_cmd { /* XXX */ | |||
1037 | #define STATUS_DISASSOC_PENDING (1<<12) | 1037 | #define STATUS_DISASSOC_PENDING (1<<12) |
1038 | #define STATUS_STATE_PENDING (1<<13) | 1038 | #define STATUS_STATE_PENDING (1<<13) |
1039 | 1039 | ||
1040 | #define STATUS_DIRECT_SCAN_PENDING (1<<19) | ||
1040 | #define STATUS_SCAN_PENDING (1<<20) | 1041 | #define STATUS_SCAN_PENDING (1<<20) |
1041 | #define STATUS_SCANNING (1<<21) | 1042 | #define STATUS_SCANNING (1<<21) |
1042 | #define STATUS_SCAN_ABORTING (1<<22) | 1043 | #define STATUS_SCAN_ABORTING (1<<22) |
@@ -1292,6 +1293,8 @@ struct ipw_priv { | |||
1292 | struct iw_public_data wireless_data; | 1293 | struct iw_public_data wireless_data; |
1293 | 1294 | ||
1294 | int user_requested_scan; | 1295 | int user_requested_scan; |
1296 | u8 direct_scan_ssid[IW_ESSID_MAX_SIZE]; | ||
1297 | u8 direct_scan_ssid_len; | ||
1295 | 1298 | ||
1296 | struct workqueue_struct *workqueue; | 1299 | struct workqueue_struct *workqueue; |
1297 | 1300 | ||
@@ -1301,8 +1304,9 @@ struct ipw_priv { | |||
1301 | struct work_struct system_config; | 1304 | struct work_struct system_config; |
1302 | struct work_struct rx_replenish; | 1305 | struct work_struct rx_replenish; |
1303 | struct delayed_work request_scan; | 1306 | struct delayed_work request_scan; |
1307 | struct delayed_work request_direct_scan; | ||
1308 | struct delayed_work request_passive_scan; | ||
1304 | struct delayed_work scan_event; | 1309 | struct delayed_work scan_event; |
1305 | struct work_struct request_passive_scan; | ||
1306 | struct work_struct adapter_restart; | 1310 | struct work_struct adapter_restart; |
1307 | struct delayed_work rf_kill; | 1311 | struct delayed_work rf_kill; |
1308 | struct work_struct up; | 1312 | struct work_struct up; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-led.c b/drivers/net/wireless/iwlwifi/iwl-3945-led.c index d200d08fb086..8b1528e52d43 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-led.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-led.c | |||
@@ -229,14 +229,15 @@ static int iwl3945_led_register_led(struct iwl3945_priv *priv, | |||
229 | led->led_dev.brightness_set = iwl3945_led_brightness_set; | 229 | led->led_dev.brightness_set = iwl3945_led_brightness_set; |
230 | led->led_dev.default_trigger = trigger; | 230 | led->led_dev.default_trigger = trigger; |
231 | 231 | ||
232 | led->priv = priv; | ||
233 | led->type = type; | ||
234 | |||
232 | ret = led_classdev_register(device, &led->led_dev); | 235 | ret = led_classdev_register(device, &led->led_dev); |
233 | if (ret) { | 236 | if (ret) { |
234 | IWL_ERROR("Error: failed to register led handler.\n"); | 237 | IWL_ERROR("Error: failed to register led handler.\n"); |
235 | return ret; | 238 | return ret; |
236 | } | 239 | } |
237 | 240 | ||
238 | led->priv = priv; | ||
239 | led->type = type; | ||
240 | led->registered = 1; | 241 | led->registered = 1; |
241 | 242 | ||
242 | if (set_led && led->led_on) | 243 | if (set_led && led->led_on) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c index a955f9c1b9ee..d8f2b4d33fd9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c | |||
@@ -1145,7 +1145,6 @@ static s32 rs_get_best_rate(struct iwl_priv *priv, | |||
1145 | 1145 | ||
1146 | /* Higher rate not available, use the original */ | 1146 | /* Higher rate not available, use the original */ |
1147 | } else { | 1147 | } else { |
1148 | new_rate = rate; | ||
1149 | break; | 1148 | break; |
1150 | } | 1149 | } |
1151 | } | 1150 | } |
@@ -1977,7 +1976,7 @@ lq_update: | |||
1977 | * 2) Not just finishing up a search | 1976 | * 2) Not just finishing up a search |
1978 | * 3) Allowing a new search | 1977 | * 3) Allowing a new search |
1979 | */ | 1978 | */ |
1980 | if (!update_lq && !done_search && !lq_sta->stay_in_tbl) { | 1979 | if (!update_lq && !done_search && !lq_sta->stay_in_tbl && window->counter) { |
1981 | /* Save current throughput to compare with "search" throughput*/ | 1980 | /* Save current throughput to compare with "search" throughput*/ |
1982 | lq_sta->last_tpt = current_tpt; | 1981 | lq_sta->last_tpt = current_tpt; |
1983 | 1982 | ||
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index cf261d3487fd..75427e61898d 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -1858,6 +1858,9 @@ static void lbs_send_confirmsleep(struct lbs_private *priv) | |||
1858 | 1858 | ||
1859 | spin_lock_irqsave(&priv->driver_lock, flags); | 1859 | spin_lock_irqsave(&priv->driver_lock, flags); |
1860 | 1860 | ||
1861 | /* We don't get a response on the sleep-confirmation */ | ||
1862 | priv->dnld_sent = DNLD_RES_RECEIVED; | ||
1863 | |||
1861 | /* If nothing to do, go back to sleep (?) */ | 1864 | /* If nothing to do, go back to sleep (?) */ |
1862 | if (!__kfifo_len(priv->event_fifo) && !priv->resp_len[priv->resp_idx]) | 1865 | if (!__kfifo_len(priv->event_fifo) && !priv->resp_len[priv->resp_idx]) |
1863 | priv->psstate = PS_STATE_SLEEP; | 1866 | priv->psstate = PS_STATE_SLEEP; |
@@ -1920,12 +1923,12 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv) | |||
1920 | 1923 | ||
1921 | lbs_deb_enter(LBS_DEB_HOST); | 1924 | lbs_deb_enter(LBS_DEB_HOST); |
1922 | 1925 | ||
1926 | spin_lock_irqsave(&priv->driver_lock, flags); | ||
1923 | if (priv->dnld_sent) { | 1927 | if (priv->dnld_sent) { |
1924 | allowed = 0; | 1928 | allowed = 0; |
1925 | lbs_deb_host("dnld_sent was set\n"); | 1929 | lbs_deb_host("dnld_sent was set\n"); |
1926 | } | 1930 | } |
1927 | 1931 | ||
1928 | spin_lock_irqsave(&priv->driver_lock, flags); | ||
1929 | /* In-progress command? */ | 1932 | /* In-progress command? */ |
1930 | if (priv->cur_cmd) { | 1933 | if (priv->cur_cmd) { |
1931 | allowed = 0; | 1934 | allowed = 0; |
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index ad2fabca9116..0aa0ce3b2c42 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c | |||
@@ -312,8 +312,8 @@ static ssize_t lbs_threshold_write(uint16_t tlv_type, uint16_t event_mask, | |||
312 | if (tlv_type != TLV_TYPE_BCNMISS) | 312 | if (tlv_type != TLV_TYPE_BCNMISS) |
313 | tlv->freq = freq; | 313 | tlv->freq = freq; |
314 | 314 | ||
315 | /* The command header, the event mask, and the one TLV */ | 315 | /* The command header, the action, the event mask, and one TLV */ |
316 | events->hdr.size = cpu_to_le16(sizeof(events->hdr) + 2 + sizeof(*tlv)); | 316 | events->hdr.size = cpu_to_le16(sizeof(events->hdr) + 4 + sizeof(*tlv)); |
317 | 317 | ||
318 | ret = lbs_cmd_with_response(priv, CMD_802_11_SUBSCRIBE_EVENT, events); | 318 | ret = lbs_cmd_with_response(priv, CMD_802_11_SUBSCRIBE_EVENT, events); |
319 | 319 | ||
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index b7ab3590b586..abd6d9ed8f4b 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -765,8 +765,8 @@ static int lbs_thread(void *data) | |||
765 | lbs_deb_thread("4: currenttxskb %p, dnld_sent %d\n", | 765 | lbs_deb_thread("4: currenttxskb %p, dnld_sent %d\n", |
766 | priv->currenttxskb, priv->dnld_sent); | 766 | priv->currenttxskb, priv->dnld_sent); |
767 | 767 | ||
768 | spin_lock_irq(&priv->driver_lock); | ||
769 | /* Process any pending command response */ | 768 | /* Process any pending command response */ |
769 | spin_lock_irq(&priv->driver_lock); | ||
770 | resp_idx = priv->resp_idx; | 770 | resp_idx = priv->resp_idx; |
771 | if (priv->resp_len[resp_idx]) { | 771 | if (priv->resp_len[resp_idx]) { |
772 | spin_unlock_irq(&priv->driver_lock); | 772 | spin_unlock_irq(&priv->driver_lock); |
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index 98ddbb3b3273..1610a7308c1d 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c | |||
@@ -49,6 +49,7 @@ static struct usb_device_id p54u_table[] __devinitdata = { | |||
49 | {USB_DEVICE(0x5041, 0x2235)}, /* Linksys WUSB54G Portable */ | 49 | {USB_DEVICE(0x5041, 0x2235)}, /* Linksys WUSB54G Portable */ |
50 | 50 | ||
51 | /* Version 2 devices (3887) */ | 51 | /* Version 2 devices (3887) */ |
52 | {USB_DEVICE(0x0471, 0x1230)}, /* Philips CPWUA054/00 */ | ||
52 | {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */ | 53 | {USB_DEVICE(0x050d, 0x7050)}, /* Belkin F5D7050 ver 1000 */ |
53 | {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */ | 54 | {USB_DEVICE(0x0572, 0x2000)}, /* Cohiba Proto board */ |
54 | {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */ | 55 | {USB_DEVICE(0x0572, 0x2002)}, /* Cohiba Proto board */ |
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index ed310f84f28b..3954897d0678 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
@@ -116,6 +116,7 @@ MODULE_PARM_DESC(workaround_interval, | |||
116 | #define OID_802_11_ENCRYPTION_STATUS ccpu2(0x0d01011b) | 116 | #define OID_802_11_ENCRYPTION_STATUS ccpu2(0x0d01011b) |
117 | #define OID_802_11_ADD_KEY ccpu2(0x0d01011d) | 117 | #define OID_802_11_ADD_KEY ccpu2(0x0d01011d) |
118 | #define OID_802_11_REMOVE_KEY ccpu2(0x0d01011e) | 118 | #define OID_802_11_REMOVE_KEY ccpu2(0x0d01011e) |
119 | #define OID_802_11_ASSOCIATION_INFORMATION ccpu2(0x0d01011f) | ||
119 | #define OID_802_11_PMKID ccpu2(0x0d010123) | 120 | #define OID_802_11_PMKID ccpu2(0x0d010123) |
120 | #define OID_802_11_NETWORK_TYPES_SUPPORTED ccpu2(0x0d010203) | 121 | #define OID_802_11_NETWORK_TYPES_SUPPORTED ccpu2(0x0d010203) |
121 | #define OID_802_11_NETWORK_TYPE_IN_USE ccpu2(0x0d010204) | 122 | #define OID_802_11_NETWORK_TYPE_IN_USE ccpu2(0x0d010204) |
@@ -271,6 +272,26 @@ struct ndis_config_param { | |||
271 | __le32 value_length; | 272 | __le32 value_length; |
272 | } __attribute__((packed)); | 273 | } __attribute__((packed)); |
273 | 274 | ||
275 | struct ndis_80211_assoc_info { | ||
276 | __le32 length; | ||
277 | __le16 req_ies; | ||
278 | struct req_ie { | ||
279 | __le16 capa; | ||
280 | __le16 listen_interval; | ||
281 | u8 cur_ap_address[6]; | ||
282 | } req_ie; | ||
283 | __le32 req_ie_length; | ||
284 | __le32 offset_req_ies; | ||
285 | __le16 resp_ies; | ||
286 | struct resp_ie { | ||
287 | __le16 capa; | ||
288 | __le16 status_code; | ||
289 | __le16 assoc_id; | ||
290 | } resp_ie; | ||
291 | __le32 resp_ie_length; | ||
292 | __le32 offset_resp_ies; | ||
293 | } __attribute__((packed)); | ||
294 | |||
274 | /* these have to match what is in wpa_supplicant */ | 295 | /* these have to match what is in wpa_supplicant */ |
275 | enum wpa_alg { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP }; | 296 | enum wpa_alg { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP }; |
276 | enum wpa_cipher { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP, | 297 | enum wpa_cipher { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP, |
@@ -674,6 +695,12 @@ static int get_bssid(struct usbnet *usbdev, u8 bssid[ETH_ALEN]) | |||
674 | return ret; | 695 | return ret; |
675 | } | 696 | } |
676 | 697 | ||
698 | static int get_association_info(struct usbnet *usbdev, | ||
699 | struct ndis_80211_assoc_info *info, int len) | ||
700 | { | ||
701 | return rndis_query_oid(usbdev, OID_802_11_ASSOCIATION_INFORMATION, | ||
702 | info, &len); | ||
703 | } | ||
677 | 704 | ||
678 | static int is_associated(struct usbnet *usbdev) | 705 | static int is_associated(struct usbnet *usbdev) |
679 | { | 706 | { |
@@ -2182,11 +2209,40 @@ static void rndis_wext_worker(struct work_struct *work) | |||
2182 | struct usbnet *usbdev = priv->usbdev; | 2209 | struct usbnet *usbdev = priv->usbdev; |
2183 | union iwreq_data evt; | 2210 | union iwreq_data evt; |
2184 | unsigned char bssid[ETH_ALEN]; | 2211 | unsigned char bssid[ETH_ALEN]; |
2185 | int ret; | 2212 | struct ndis_80211_assoc_info *info; |
2213 | int assoc_size = sizeof(*info) + IW_CUSTOM_MAX + 32; | ||
2214 | int ret, offset; | ||
2186 | 2215 | ||
2187 | if (test_and_clear_bit(WORK_CONNECTION_EVENT, &priv->work_pending)) { | 2216 | if (test_and_clear_bit(WORK_CONNECTION_EVENT, &priv->work_pending)) { |
2188 | ret = get_bssid(usbdev, bssid); | 2217 | info = kzalloc(assoc_size, GFP_KERNEL); |
2218 | if (!info) | ||
2219 | goto get_bssid; | ||
2220 | |||
2221 | /* Get association info IEs from device and send them back to | ||
2222 | * userspace. */ | ||
2223 | ret = get_association_info(usbdev, info, assoc_size); | ||
2224 | if (!ret) { | ||
2225 | evt.data.length = le32_to_cpu(info->req_ie_length); | ||
2226 | if (evt.data.length > 0) { | ||
2227 | offset = le32_to_cpu(info->offset_req_ies); | ||
2228 | wireless_send_event(usbdev->net, | ||
2229 | IWEVASSOCREQIE, &evt, | ||
2230 | (char *)info + offset); | ||
2231 | } | ||
2232 | |||
2233 | evt.data.length = le32_to_cpu(info->resp_ie_length); | ||
2234 | if (evt.data.length > 0) { | ||
2235 | offset = le32_to_cpu(info->offset_resp_ies); | ||
2236 | wireless_send_event(usbdev->net, | ||
2237 | IWEVASSOCRESPIE, &evt, | ||
2238 | (char *)info + offset); | ||
2239 | } | ||
2240 | } | ||
2241 | |||
2242 | kfree(info); | ||
2189 | 2243 | ||
2244 | get_bssid: | ||
2245 | ret = get_bssid(usbdev, bssid); | ||
2190 | if (!ret) { | 2246 | if (!ret) { |
2191 | evt.data.flags = 0; | 2247 | evt.data.flags = 0; |
2192 | evt.data.length = 0; | 2248 | evt.data.length = 0; |
@@ -2414,6 +2470,11 @@ static int bcm4320_early_init(struct usbnet *dev) | |||
2414 | else if (priv->param_power_save > 2) | 2470 | else if (priv->param_power_save > 2) |
2415 | priv->param_power_save = 2; | 2471 | priv->param_power_save = 2; |
2416 | 2472 | ||
2473 | if (priv->param_power_output < 0) | ||
2474 | priv->param_power_output = 0; | ||
2475 | else if (priv->param_power_output > 3) | ||
2476 | priv->param_power_output = 3; | ||
2477 | |||
2417 | if (priv->param_roamtrigger < -80) | 2478 | if (priv->param_roamtrigger < -80) |
2418 | priv->param_roamtrigger = -80; | 2479 | priv->param_roamtrigger = -80; |
2419 | else if (priv->param_roamtrigger > -60) | 2480 | else if (priv->param_roamtrigger > -60) |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 5c7220ea46e6..15ec797c5ec1 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -328,6 +328,11 @@ static inline int rt2x00_get_link_ant_rssi(struct link *link) | |||
328 | return DEFAULT_RSSI; | 328 | return DEFAULT_RSSI; |
329 | } | 329 | } |
330 | 330 | ||
331 | static inline void rt2x00_reset_link_ant_rssi(struct link *link) | ||
332 | { | ||
333 | link->ant.rssi_ant = 0; | ||
334 | } | ||
335 | |||
331 | static inline int rt2x00_get_link_ant_rssi_history(struct link *link, | 336 | static inline int rt2x00_get_link_ant_rssi_history(struct link *link, |
332 | enum antenna ant) | 337 | enum antenna ant) |
333 | { | 338 | { |
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c index a9930a03f450..48608e8cc8b4 100644 --- a/drivers/net/wireless/rt2x00/rt2x00config.c +++ b/drivers/net/wireless/rt2x00/rt2x00config.c | |||
@@ -129,6 +129,7 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, | |||
129 | */ | 129 | */ |
130 | rt2x00dev->ops->lib->config(rt2x00dev, &libconf, CONFIG_UPDATE_ANTENNA); | 130 | rt2x00dev->ops->lib->config(rt2x00dev, &libconf, CONFIG_UPDATE_ANTENNA); |
131 | rt2x00lib_reset_link_tuner(rt2x00dev); | 131 | rt2x00lib_reset_link_tuner(rt2x00dev); |
132 | rt2x00_reset_link_ant_rssi(&rt2x00dev->link); | ||
132 | 133 | ||
133 | rt2x00dev->link.ant.active.rx = libconf.ant.rx; | 134 | rt2x00dev->link.ant.active.rx = libconf.ant.rx; |
134 | rt2x00dev->link.ant.active.tx = libconf.ant.tx; | 135 | rt2x00dev->link.ant.active.tx = libconf.ant.tx; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 69e233610c94..f7a44170c025 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -481,9 +481,9 @@ void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev) | |||
481 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags)) | 481 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags)) |
482 | return; | 482 | return; |
483 | 483 | ||
484 | ieee80211_iterate_active_interfaces(rt2x00dev->hw, | 484 | ieee80211_iterate_active_interfaces_atomic(rt2x00dev->hw, |
485 | rt2x00lib_beacondone_iter, | 485 | rt2x00lib_beacondone_iter, |
486 | rt2x00dev); | 486 | rt2x00dev); |
487 | 487 | ||
488 | queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->intf_work); | 488 | queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->intf_work); |
489 | } | 489 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index c05e05b58887..b02dbc8a666e 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
@@ -114,6 +114,7 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
114 | */ | 114 | */ |
115 | if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags)) { | 115 | if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags)) { |
116 | ieee80211_stop_queues(hw); | 116 | ieee80211_stop_queues(hw); |
117 | dev_kfree_skb_any(skb); | ||
117 | return NETDEV_TX_OK; | 118 | return NETDEV_TX_OK; |
118 | } | 119 | } |
119 | 120 | ||
diff --git a/drivers/net/wireless/rtl8180_grf5101.c b/drivers/net/wireless/rtl8180_grf5101.c index 5d47935dbac3..947ee55f18b2 100644 --- a/drivers/net/wireless/rtl8180_grf5101.c +++ b/drivers/net/wireless/rtl8180_grf5101.c | |||
@@ -88,7 +88,7 @@ static void grf5101_rf_set_channel(struct ieee80211_hw *dev, | |||
88 | write_grf5101(dev, 0x0B, chan); | 88 | write_grf5101(dev, 0x0B, chan); |
89 | write_grf5101(dev, 0x07, 0x1000); | 89 | write_grf5101(dev, 0x07, 0x1000); |
90 | 90 | ||
91 | grf5101_write_phy_antenna(dev, chan); | 91 | grf5101_write_phy_antenna(dev, channel); |
92 | } | 92 | } |
93 | 93 | ||
94 | static void grf5101_rf_stop(struct ieee80211_hw *dev) | 94 | static void grf5101_rf_stop(struct ieee80211_hw *dev) |
diff --git a/drivers/net/wireless/rtl8180_max2820.c b/drivers/net/wireless/rtl8180_max2820.c index a34dfd382b6d..6c825fd7f3b6 100644 --- a/drivers/net/wireless/rtl8180_max2820.c +++ b/drivers/net/wireless/rtl8180_max2820.c | |||
@@ -78,7 +78,8 @@ static void max2820_rf_set_channel(struct ieee80211_hw *dev, | |||
78 | struct ieee80211_conf *conf) | 78 | struct ieee80211_conf *conf) |
79 | { | 79 | { |
80 | struct rtl8180_priv *priv = dev->priv; | 80 | struct rtl8180_priv *priv = dev->priv; |
81 | int channel = ieee80211_frequency_to_channel(conf->channel->center_freq); | 81 | int channel = conf ? |
82 | ieee80211_frequency_to_channel(conf->channel->center_freq) : 1; | ||
82 | unsigned int chan_idx = channel - 1; | 83 | unsigned int chan_idx = channel - 1; |
83 | u32 txpw = priv->channels[chan_idx].hw_value & 0xFF; | 84 | u32 txpw = priv->channels[chan_idx].hw_value & 0xFF; |
84 | u32 chan = max2820_chan[chan_idx]; | 85 | u32 chan = max2820_chan[chan_idx]; |
@@ -87,7 +88,7 @@ static void max2820_rf_set_channel(struct ieee80211_hw *dev, | |||
87 | * sa2400, for MAXIM we do this directly from BB */ | 88 | * sa2400, for MAXIM we do this directly from BB */ |
88 | rtl8180_write_phy(dev, 3, txpw); | 89 | rtl8180_write_phy(dev, 3, txpw); |
89 | 90 | ||
90 | max2820_write_phy_antenna(dev, chan); | 91 | max2820_write_phy_antenna(dev, channel); |
91 | write_max2820(dev, 3, chan); | 92 | write_max2820(dev, 3, chan); |
92 | } | 93 | } |
93 | 94 | ||
diff --git a/drivers/net/wireless/rtl8180_sa2400.c b/drivers/net/wireless/rtl8180_sa2400.c index 0311b4ea124c..cea4e0ccb92d 100644 --- a/drivers/net/wireless/rtl8180_sa2400.c +++ b/drivers/net/wireless/rtl8180_sa2400.c | |||
@@ -86,7 +86,7 @@ static void sa2400_rf_set_channel(struct ieee80211_hw *dev, | |||
86 | 86 | ||
87 | write_sa2400(dev, 7, txpw); | 87 | write_sa2400(dev, 7, txpw); |
88 | 88 | ||
89 | sa2400_write_phy_antenna(dev, chan); | 89 | sa2400_write_phy_antenna(dev, channel); |
90 | 90 | ||
91 | write_sa2400(dev, 0, chan); | 91 | write_sa2400(dev, 0, chan); |
92 | write_sa2400(dev, 1, 0xbb50); | 92 | write_sa2400(dev, 1, 0xbb50); |
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index d2378d083a35..6d86b365f150 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c | |||
@@ -647,7 +647,7 @@ int zd_mac_rx(struct ieee80211_hw *hw, const u8 *buffer, unsigned int length) | |||
647 | fc = le16_to_cpu(*((__le16 *) buffer)); | 647 | fc = le16_to_cpu(*((__le16 *) buffer)); |
648 | 648 | ||
649 | is_qos = ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && | 649 | is_qos = ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && |
650 | ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_QOS_DATA); | 650 | (fc & IEEE80211_STYPE_QOS_DATA); |
651 | is_4addr = (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == | 651 | is_4addr = (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == |
652 | (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS); | 652 | (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS); |
653 | need_padding = is_qos ^ is_4addr; | 653 | need_padding = is_qos ^ is_4addr; |
diff --git a/drivers/of/base.c b/drivers/of/base.c index 9bd7c4a31253..23ffb7c0caf2 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -65,6 +65,9 @@ struct property *of_find_property(const struct device_node *np, | |||
65 | { | 65 | { |
66 | struct property *pp; | 66 | struct property *pp; |
67 | 67 | ||
68 | if (!np) | ||
69 | return NULL; | ||
70 | |||
68 | read_lock(&devtree_lock); | 71 | read_lock(&devtree_lock); |
69 | for (pp = np->properties; pp != 0; pp = pp->next) { | 72 | for (pp = np->properties; pp != 0; pp = pp->next) { |
70 | if (of_prop_cmp(pp->name, name) == 0) { | 73 | if (of_prop_cmp(pp->name, name) == 0) { |
diff --git a/drivers/parisc/asp.c b/drivers/parisc/asp.c index 558420bc9f88..821369135369 100644 --- a/drivers/parisc/asp.c +++ b/drivers/parisc/asp.c | |||
@@ -88,7 +88,7 @@ asp_init_chip(struct parisc_device *dev) | |||
88 | ret = -EBUSY; | 88 | ret = -EBUSY; |
89 | dev->irq = gsc_claim_irq(&gsc_irq, ASP_GSC_IRQ); | 89 | dev->irq = gsc_claim_irq(&gsc_irq, ASP_GSC_IRQ); |
90 | if (dev->irq < 0) { | 90 | if (dev->irq < 0) { |
91 | printk(KERN_ERR "%s(): cannot get GSC irq\n", __FUNCTION__); | 91 | printk(KERN_ERR "%s(): cannot get GSC irq\n", __func__); |
92 | goto out; | 92 | goto out; |
93 | } | 93 | } |
94 | 94 | ||
diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c index 07d2a8d4498f..b30e38f3a50d 100644 --- a/drivers/parisc/ccio-dma.c +++ b/drivers/parisc/ccio-dma.c | |||
@@ -359,7 +359,7 @@ ccio_alloc_range(struct ioc *ioc, struct device *dev, size_t size) | |||
359 | BUG_ON((pages_needed * IOVP_SIZE) > DMA_CHUNK_SIZE); | 359 | BUG_ON((pages_needed * IOVP_SIZE) > DMA_CHUNK_SIZE); |
360 | 360 | ||
361 | DBG_RES("%s() size: %d pages_needed %d\n", | 361 | DBG_RES("%s() size: %d pages_needed %d\n", |
362 | __FUNCTION__, size, pages_needed); | 362 | __func__, size, pages_needed); |
363 | 363 | ||
364 | /* | 364 | /* |
365 | ** "seek and ye shall find"...praying never hurts either... | 365 | ** "seek and ye shall find"...praying never hurts either... |
@@ -395,16 +395,16 @@ ccio_alloc_range(struct ioc *ioc, struct device *dev, size_t size) | |||
395 | #endif | 395 | #endif |
396 | } else { | 396 | } else { |
397 | panic("%s: %s() Too many pages to map. pages_needed: %u\n", | 397 | panic("%s: %s() Too many pages to map. pages_needed: %u\n", |
398 | __FILE__, __FUNCTION__, pages_needed); | 398 | __FILE__, __func__, pages_needed); |
399 | } | 399 | } |
400 | 400 | ||
401 | panic("%s: %s() I/O MMU is out of mapping resources.\n", __FILE__, | 401 | panic("%s: %s() I/O MMU is out of mapping resources.\n", __FILE__, |
402 | __FUNCTION__); | 402 | __func__); |
403 | 403 | ||
404 | resource_found: | 404 | resource_found: |
405 | 405 | ||
406 | DBG_RES("%s() res_idx %d res_hint: %d\n", | 406 | DBG_RES("%s() res_idx %d res_hint: %d\n", |
407 | __FUNCTION__, res_idx, ioc->res_hint); | 407 | __func__, res_idx, ioc->res_hint); |
408 | 408 | ||
409 | #ifdef CCIO_SEARCH_TIME | 409 | #ifdef CCIO_SEARCH_TIME |
410 | { | 410 | { |
@@ -450,7 +450,7 @@ ccio_free_range(struct ioc *ioc, dma_addr_t iova, unsigned long pages_mapped) | |||
450 | BUG_ON(pages_mapped > BITS_PER_LONG); | 450 | BUG_ON(pages_mapped > BITS_PER_LONG); |
451 | 451 | ||
452 | DBG_RES("%s(): res_idx: %d pages_mapped %d\n", | 452 | DBG_RES("%s(): res_idx: %d pages_mapped %d\n", |
453 | __FUNCTION__, res_idx, pages_mapped); | 453 | __func__, res_idx, pages_mapped); |
454 | 454 | ||
455 | #ifdef CCIO_MAP_STATS | 455 | #ifdef CCIO_MAP_STATS |
456 | ioc->used_pages -= pages_mapped; | 456 | ioc->used_pages -= pages_mapped; |
@@ -474,7 +474,7 @@ ccio_free_range(struct ioc *ioc, dma_addr_t iova, unsigned long pages_mapped) | |||
474 | #endif | 474 | #endif |
475 | } else { | 475 | } else { |
476 | panic("%s:%s() Too many pages to unmap.\n", __FILE__, | 476 | panic("%s:%s() Too many pages to unmap.\n", __FILE__, |
477 | __FUNCTION__); | 477 | __func__); |
478 | } | 478 | } |
479 | } | 479 | } |
480 | 480 | ||
@@ -775,7 +775,7 @@ ccio_map_single(struct device *dev, void *addr, size_t size, | |||
775 | pdir_start = &(ioc->pdir_base[idx]); | 775 | pdir_start = &(ioc->pdir_base[idx]); |
776 | 776 | ||
777 | DBG_RUN("%s() 0x%p -> 0x%lx size: %0x%x\n", | 777 | DBG_RUN("%s() 0x%p -> 0x%lx size: %0x%x\n", |
778 | __FUNCTION__, addr, (long)iovp | offset, size); | 778 | __func__, addr, (long)iovp | offset, size); |
779 | 779 | ||
780 | /* If not cacheline aligned, force SAFE_DMA on the whole mess */ | 780 | /* If not cacheline aligned, force SAFE_DMA on the whole mess */ |
781 | if((size % L1_CACHE_BYTES) || ((unsigned long)addr % L1_CACHE_BYTES)) | 781 | if((size % L1_CACHE_BYTES) || ((unsigned long)addr % L1_CACHE_BYTES)) |
@@ -820,7 +820,7 @@ ccio_unmap_single(struct device *dev, dma_addr_t iova, size_t size, | |||
820 | ioc = GET_IOC(dev); | 820 | ioc = GET_IOC(dev); |
821 | 821 | ||
822 | DBG_RUN("%s() iovp 0x%lx/%x\n", | 822 | DBG_RUN("%s() iovp 0x%lx/%x\n", |
823 | __FUNCTION__, (long)iova, size); | 823 | __func__, (long)iova, size); |
824 | 824 | ||
825 | iova ^= offset; /* clear offset bits */ | 825 | iova ^= offset; /* clear offset bits */ |
826 | size += offset; | 826 | size += offset; |
@@ -922,7 +922,7 @@ ccio_map_sg(struct device *dev, struct scatterlist *sglist, int nents, | |||
922 | BUG_ON(!dev); | 922 | BUG_ON(!dev); |
923 | ioc = GET_IOC(dev); | 923 | ioc = GET_IOC(dev); |
924 | 924 | ||
925 | DBG_RUN_SG("%s() START %d entries\n", __FUNCTION__, nents); | 925 | DBG_RUN_SG("%s() START %d entries\n", __func__, nents); |
926 | 926 | ||
927 | /* Fast path single entry scatterlists. */ | 927 | /* Fast path single entry scatterlists. */ |
928 | if (nents == 1) { | 928 | if (nents == 1) { |
@@ -966,7 +966,7 @@ ccio_map_sg(struct device *dev, struct scatterlist *sglist, int nents, | |||
966 | 966 | ||
967 | BUG_ON(coalesced != filled); | 967 | BUG_ON(coalesced != filled); |
968 | 968 | ||
969 | DBG_RUN_SG("%s() DONE %d mappings\n", __FUNCTION__, filled); | 969 | DBG_RUN_SG("%s() DONE %d mappings\n", __func__, filled); |
970 | 970 | ||
971 | for (i = 0; i < filled; i++) | 971 | for (i = 0; i < filled; i++) |
972 | current_len += sg_dma_len(sglist + i); | 972 | current_len += sg_dma_len(sglist + i); |
@@ -995,7 +995,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, | |||
995 | ioc = GET_IOC(dev); | 995 | ioc = GET_IOC(dev); |
996 | 996 | ||
997 | DBG_RUN_SG("%s() START %d entries, %08lx,%x\n", | 997 | DBG_RUN_SG("%s() START %d entries, %08lx,%x\n", |
998 | __FUNCTION__, nents, sg_virt_addr(sglist), sglist->length); | 998 | __func__, nents, sg_virt_addr(sglist), sglist->length); |
999 | 999 | ||
1000 | #ifdef CCIO_MAP_STATS | 1000 | #ifdef CCIO_MAP_STATS |
1001 | ioc->usg_calls++; | 1001 | ioc->usg_calls++; |
@@ -1011,7 +1011,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, | |||
1011 | ++sglist; | 1011 | ++sglist; |
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | DBG_RUN_SG("%s() DONE (nents %d)\n", __FUNCTION__, nents); | 1014 | DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents); |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | static struct hppa_dma_ops ccio_ops = { | 1017 | static struct hppa_dma_ops ccio_ops = { |
@@ -1225,7 +1225,7 @@ static int | |||
1225 | ccio_get_iotlb_size(struct parisc_device *dev) | 1225 | ccio_get_iotlb_size(struct parisc_device *dev) |
1226 | { | 1226 | { |
1227 | if (dev->spa_shift == 0) { | 1227 | if (dev->spa_shift == 0) { |
1228 | panic("%s() : Can't determine I/O TLB size.\n", __FUNCTION__); | 1228 | panic("%s() : Can't determine I/O TLB size.\n", __func__); |
1229 | } | 1229 | } |
1230 | return (1 << dev->spa_shift); | 1230 | return (1 << dev->spa_shift); |
1231 | } | 1231 | } |
@@ -1315,7 +1315,7 @@ ccio_ioc_init(struct ioc *ioc) | |||
1315 | BUG_ON((1 << get_order(ioc->pdir_size)) != (ioc->pdir_size >> PAGE_SHIFT)); | 1315 | BUG_ON((1 << get_order(ioc->pdir_size)) != (ioc->pdir_size >> PAGE_SHIFT)); |
1316 | 1316 | ||
1317 | DBG_INIT("%s() hpa 0x%p mem %luMB IOV %dMB (%d bits)\n", | 1317 | DBG_INIT("%s() hpa 0x%p mem %luMB IOV %dMB (%d bits)\n", |
1318 | __FUNCTION__, ioc->ioc_regs, | 1318 | __func__, ioc->ioc_regs, |
1319 | (unsigned long) num_physpages >> (20 - PAGE_SHIFT), | 1319 | (unsigned long) num_physpages >> (20 - PAGE_SHIFT), |
1320 | iova_space_size>>20, | 1320 | iova_space_size>>20, |
1321 | iov_order + PAGE_SHIFT); | 1321 | iov_order + PAGE_SHIFT); |
@@ -1323,7 +1323,7 @@ ccio_ioc_init(struct ioc *ioc) | |||
1323 | ioc->pdir_base = (u64 *)__get_free_pages(GFP_KERNEL, | 1323 | ioc->pdir_base = (u64 *)__get_free_pages(GFP_KERNEL, |
1324 | get_order(ioc->pdir_size)); | 1324 | get_order(ioc->pdir_size)); |
1325 | if(NULL == ioc->pdir_base) { | 1325 | if(NULL == ioc->pdir_base) { |
1326 | panic("%s() could not allocate I/O Page Table\n", __FUNCTION__); | 1326 | panic("%s() could not allocate I/O Page Table\n", __func__); |
1327 | } | 1327 | } |
1328 | memset(ioc->pdir_base, 0, ioc->pdir_size); | 1328 | memset(ioc->pdir_base, 0, ioc->pdir_size); |
1329 | 1329 | ||
@@ -1332,12 +1332,12 @@ ccio_ioc_init(struct ioc *ioc) | |||
1332 | 1332 | ||
1333 | /* resource map size dictated by pdir_size */ | 1333 | /* resource map size dictated by pdir_size */ |
1334 | ioc->res_size = (ioc->pdir_size / sizeof(u64)) >> 3; | 1334 | ioc->res_size = (ioc->pdir_size / sizeof(u64)) >> 3; |
1335 | DBG_INIT("%s() res_size 0x%x\n", __FUNCTION__, ioc->res_size); | 1335 | DBG_INIT("%s() res_size 0x%x\n", __func__, ioc->res_size); |
1336 | 1336 | ||
1337 | ioc->res_map = (u8 *)__get_free_pages(GFP_KERNEL, | 1337 | ioc->res_map = (u8 *)__get_free_pages(GFP_KERNEL, |
1338 | get_order(ioc->res_size)); | 1338 | get_order(ioc->res_size)); |
1339 | if(NULL == ioc->res_map) { | 1339 | if(NULL == ioc->res_map) { |
1340 | panic("%s() could not allocate resource map\n", __FUNCTION__); | 1340 | panic("%s() could not allocate resource map\n", __func__); |
1341 | } | 1341 | } |
1342 | memset(ioc->res_map, 0, ioc->res_size); | 1342 | memset(ioc->res_map, 0, ioc->res_size); |
1343 | 1343 | ||
@@ -1409,7 +1409,7 @@ ccio_init_resource(struct resource *res, char *name, void __iomem *ioaddr) | |||
1409 | result = insert_resource(&iomem_resource, res); | 1409 | result = insert_resource(&iomem_resource, res); |
1410 | if (result < 0) { | 1410 | if (result < 0) { |
1411 | printk(KERN_ERR "%s() failed to claim CCIO bus address space (%08lx,%08lx)\n", | 1411 | printk(KERN_ERR "%s() failed to claim CCIO bus address space (%08lx,%08lx)\n", |
1412 | __FUNCTION__, res->start, res->end); | 1412 | __func__, res->start, res->end); |
1413 | } | 1413 | } |
1414 | } | 1414 | } |
1415 | 1415 | ||
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index d9c6322a721b..fd56128525d1 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c | |||
@@ -180,7 +180,7 @@ static int dino_cfg_read(struct pci_bus *bus, unsigned int devfn, int where, | |||
180 | void __iomem *base_addr = d->hba.base_addr; | 180 | void __iomem *base_addr = d->hba.base_addr; |
181 | unsigned long flags; | 181 | unsigned long flags; |
182 | 182 | ||
183 | DBG("%s: %p, %d, %d, %d\n", __FUNCTION__, base_addr, devfn, where, | 183 | DBG("%s: %p, %d, %d, %d\n", __func__, base_addr, devfn, where, |
184 | size); | 184 | size); |
185 | spin_lock_irqsave(&d->dinosaur_pen, flags); | 185 | spin_lock_irqsave(&d->dinosaur_pen, flags); |
186 | 186 | ||
@@ -215,7 +215,7 @@ static int dino_cfg_write(struct pci_bus *bus, unsigned int devfn, int where, | |||
215 | void __iomem *base_addr = d->hba.base_addr; | 215 | void __iomem *base_addr = d->hba.base_addr; |
216 | unsigned long flags; | 216 | unsigned long flags; |
217 | 217 | ||
218 | DBG("%s: %p, %d, %d, %d\n", __FUNCTION__, base_addr, devfn, where, | 218 | DBG("%s: %p, %d, %d, %d\n", __func__, base_addr, devfn, where, |
219 | size); | 219 | size); |
220 | spin_lock_irqsave(&d->dinosaur_pen, flags); | 220 | spin_lock_irqsave(&d->dinosaur_pen, flags); |
221 | 221 | ||
@@ -301,7 +301,7 @@ static void dino_disable_irq(unsigned int irq) | |||
301 | struct dino_device *dino_dev = irq_desc[irq].chip_data; | 301 | struct dino_device *dino_dev = irq_desc[irq].chip_data; |
302 | int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); | 302 | int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); |
303 | 303 | ||
304 | DBG(KERN_WARNING "%s(0x%p, %d)\n", __FUNCTION__, dino_dev, irq); | 304 | DBG(KERN_WARNING "%s(0x%p, %d)\n", __func__, dino_dev, irq); |
305 | 305 | ||
306 | /* Clear the matching bit in the IMR register */ | 306 | /* Clear the matching bit in the IMR register */ |
307 | dino_dev->imr &= ~(DINO_MASK_IRQ(local_irq)); | 307 | dino_dev->imr &= ~(DINO_MASK_IRQ(local_irq)); |
@@ -314,7 +314,7 @@ static void dino_enable_irq(unsigned int irq) | |||
314 | int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); | 314 | int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); |
315 | u32 tmp; | 315 | u32 tmp; |
316 | 316 | ||
317 | DBG(KERN_WARNING "%s(0x%p, %d)\n", __FUNCTION__, dino_dev, irq); | 317 | DBG(KERN_WARNING "%s(0x%p, %d)\n", __func__, dino_dev, irq); |
318 | 318 | ||
319 | /* | 319 | /* |
320 | ** clear pending IRQ bits | 320 | ** clear pending IRQ bits |
@@ -340,7 +340,7 @@ static void dino_enable_irq(unsigned int irq) | |||
340 | tmp = __raw_readl(dino_dev->hba.base_addr+DINO_ILR); | 340 | tmp = __raw_readl(dino_dev->hba.base_addr+DINO_ILR); |
341 | if (tmp & DINO_MASK_IRQ(local_irq)) { | 341 | if (tmp & DINO_MASK_IRQ(local_irq)) { |
342 | DBG(KERN_WARNING "%s(): IRQ asserted! (ILR 0x%x)\n", | 342 | DBG(KERN_WARNING "%s(): IRQ asserted! (ILR 0x%x)\n", |
343 | __FUNCTION__, tmp); | 343 | __func__, tmp); |
344 | gsc_writel(dino_dev->txn_data, dino_dev->txn_addr); | 344 | gsc_writel(dino_dev->txn_data, dino_dev->txn_addr); |
345 | } | 345 | } |
346 | } | 346 | } |
@@ -388,7 +388,7 @@ ilr_again: | |||
388 | int local_irq = __ffs(mask); | 388 | int local_irq = __ffs(mask); |
389 | int irq = dino_dev->global_irq[local_irq]; | 389 | int irq = dino_dev->global_irq[local_irq]; |
390 | DBG(KERN_DEBUG "%s(%d, %p) mask 0x%x\n", | 390 | DBG(KERN_DEBUG "%s(%d, %p) mask 0x%x\n", |
391 | __FUNCTION__, irq, intr_dev, mask); | 391 | __func__, irq, intr_dev, mask); |
392 | __do_IRQ(irq); | 392 | __do_IRQ(irq); |
393 | mask &= ~(1 << local_irq); | 393 | mask &= ~(1 << local_irq); |
394 | } while (mask); | 394 | } while (mask); |
@@ -566,7 +566,7 @@ dino_fixup_bus(struct pci_bus *bus) | |||
566 | int port_base = HBA_PORT_BASE(dino_dev->hba.hba_num); | 566 | int port_base = HBA_PORT_BASE(dino_dev->hba.hba_num); |
567 | 567 | ||
568 | DBG(KERN_WARNING "%s(0x%p) bus %d platform_data 0x%p\n", | 568 | DBG(KERN_WARNING "%s(0x%p) bus %d platform_data 0x%p\n", |
569 | __FUNCTION__, bus, bus->secondary, | 569 | __func__, bus, bus->secondary, |
570 | bus->bridge->platform_data); | 570 | bus->bridge->platform_data); |
571 | 571 | ||
572 | /* Firmware doesn't set up card-mode dino, so we have to */ | 572 | /* Firmware doesn't set up card-mode dino, so we have to */ |
diff --git a/drivers/parisc/gsc.c b/drivers/parisc/gsc.c index 1b3e3fd12d95..f7d088b897ee 100644 --- a/drivers/parisc/gsc.c +++ b/drivers/parisc/gsc.c | |||
@@ -112,7 +112,7 @@ static void gsc_asic_disable_irq(unsigned int irq) | |||
112 | int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); | 112 | int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); |
113 | u32 imr; | 113 | u32 imr; |
114 | 114 | ||
115 | DEBPRINTK(KERN_DEBUG "%s(%d) %s: IMR 0x%x\n", __FUNCTION__, irq, | 115 | DEBPRINTK(KERN_DEBUG "%s(%d) %s: IMR 0x%x\n", __func__, irq, |
116 | irq_dev->name, imr); | 116 | irq_dev->name, imr); |
117 | 117 | ||
118 | /* Disable the IRQ line by clearing the bit in the IMR */ | 118 | /* Disable the IRQ line by clearing the bit in the IMR */ |
@@ -127,7 +127,7 @@ static void gsc_asic_enable_irq(unsigned int irq) | |||
127 | int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); | 127 | int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); |
128 | u32 imr; | 128 | u32 imr; |
129 | 129 | ||
130 | DEBPRINTK(KERN_DEBUG "%s(%d) %s: IMR 0x%x\n", __FUNCTION__, irq, | 130 | DEBPRINTK(KERN_DEBUG "%s(%d) %s: IMR 0x%x\n", __func__, irq, |
131 | irq_dev->name, imr); | 131 | irq_dev->name, imr); |
132 | 132 | ||
133 | /* Enable the IRQ line by setting the bit in the IMR */ | 133 | /* Enable the IRQ line by setting the bit in the IMR */ |
diff --git a/drivers/parisc/lasi.c b/drivers/parisc/lasi.c index cb3d28176129..bee510098ce8 100644 --- a/drivers/parisc/lasi.c +++ b/drivers/parisc/lasi.c | |||
@@ -193,7 +193,7 @@ lasi_init_chip(struct parisc_device *dev) | |||
193 | dev->irq = gsc_alloc_irq(&gsc_irq); | 193 | dev->irq = gsc_alloc_irq(&gsc_irq); |
194 | if (dev->irq < 0) { | 194 | if (dev->irq < 0) { |
195 | printk(KERN_ERR "%s(): cannot get GSC irq\n", | 195 | printk(KERN_ERR "%s(): cannot get GSC irq\n", |
196 | __FUNCTION__); | 196 | __func__); |
197 | kfree(lasi); | 197 | kfree(lasi); |
198 | return -EBUSY; | 198 | return -EBUSY; |
199 | } | 199 | } |
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index 66ce61048361..a28c8946deaa 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c | |||
@@ -377,12 +377,12 @@ static int elroy_cfg_read(struct pci_bus *bus, unsigned int devfn, int pos, int | |||
377 | /* original - Generate config cycle on broken elroy | 377 | /* original - Generate config cycle on broken elroy |
378 | with risk we will miss PCI bus errors. */ | 378 | with risk we will miss PCI bus errors. */ |
379 | *data = lba_rd_cfg(d, tok, pos, size); | 379 | *data = lba_rd_cfg(d, tok, pos, size); |
380 | DBG_CFG("%s(%x+%2x) -> 0x%x (a)\n", __FUNCTION__, tok, pos, *data); | 380 | DBG_CFG("%s(%x+%2x) -> 0x%x (a)\n", __func__, tok, pos, *data); |
381 | return 0; | 381 | return 0; |
382 | } | 382 | } |
383 | 383 | ||
384 | if (LBA_SKIP_PROBE(d) && !lba_device_present(bus->secondary, devfn, d)) { | 384 | if (LBA_SKIP_PROBE(d) && !lba_device_present(bus->secondary, devfn, d)) { |
385 | DBG_CFG("%s(%x+%2x) -> -1 (b)\n", __FUNCTION__, tok, pos); | 385 | DBG_CFG("%s(%x+%2x) -> -1 (b)\n", __func__, tok, pos); |
386 | /* either don't want to look or know device isn't present. */ | 386 | /* either don't want to look or know device isn't present. */ |
387 | *data = ~0U; | 387 | *data = ~0U; |
388 | return(0); | 388 | return(0); |
@@ -398,7 +398,7 @@ static int elroy_cfg_read(struct pci_bus *bus, unsigned int devfn, int pos, int | |||
398 | case 2: *data = READ_REG16(data_reg + (pos & 2)); break; | 398 | case 2: *data = READ_REG16(data_reg + (pos & 2)); break; |
399 | case 4: *data = READ_REG32(data_reg); break; | 399 | case 4: *data = READ_REG32(data_reg); break; |
400 | } | 400 | } |
401 | DBG_CFG("%s(%x+%2x) -> 0x%x (c)\n", __FUNCTION__, tok, pos, *data); | 401 | DBG_CFG("%s(%x+%2x) -> 0x%x (c)\n", __func__, tok, pos, *data); |
402 | return 0; | 402 | return 0; |
403 | } | 403 | } |
404 | 404 | ||
@@ -441,16 +441,16 @@ static int elroy_cfg_write(struct pci_bus *bus, unsigned int devfn, int pos, int | |||
441 | if (!LBA_SKIP_PROBE(d)) { | 441 | if (!LBA_SKIP_PROBE(d)) { |
442 | /* Original Workaround */ | 442 | /* Original Workaround */ |
443 | lba_wr_cfg(d, tok, pos, (u32) data, size); | 443 | lba_wr_cfg(d, tok, pos, (u32) data, size); |
444 | DBG_CFG("%s(%x+%2x) = 0x%x (a)\n", __FUNCTION__, tok, pos,data); | 444 | DBG_CFG("%s(%x+%2x) = 0x%x (a)\n", __func__, tok, pos,data); |
445 | return 0; | 445 | return 0; |
446 | } | 446 | } |
447 | 447 | ||
448 | if (LBA_SKIP_PROBE(d) && (!lba_device_present(bus->secondary, devfn, d))) { | 448 | if (LBA_SKIP_PROBE(d) && (!lba_device_present(bus->secondary, devfn, d))) { |
449 | DBG_CFG("%s(%x+%2x) = 0x%x (b)\n", __FUNCTION__, tok, pos,data); | 449 | DBG_CFG("%s(%x+%2x) = 0x%x (b)\n", __func__, tok, pos,data); |
450 | return 1; /* New Workaround */ | 450 | return 1; /* New Workaround */ |
451 | } | 451 | } |
452 | 452 | ||
453 | DBG_CFG("%s(%x+%2x) = 0x%x (c)\n", __FUNCTION__, tok, pos, data); | 453 | DBG_CFG("%s(%x+%2x) = 0x%x (c)\n", __func__, tok, pos, data); |
454 | 454 | ||
455 | /* Basic Algorithm */ | 455 | /* Basic Algorithm */ |
456 | LBA_CFG_ADDR_SETUP(d, tok | pos); | 456 | LBA_CFG_ADDR_SETUP(d, tok | pos); |
@@ -521,7 +521,7 @@ static int mercury_cfg_write(struct pci_bus *bus, unsigned int devfn, int pos, i | |||
521 | if ((pos > 255) || (devfn > 255)) | 521 | if ((pos > 255) || (devfn > 255)) |
522 | return -EINVAL; | 522 | return -EINVAL; |
523 | 523 | ||
524 | DBG_CFG("%s(%x+%2x) <- 0x%x (c)\n", __FUNCTION__, tok, pos, data); | 524 | DBG_CFG("%s(%x+%2x) <- 0x%x (c)\n", __func__, tok, pos, data); |
525 | 525 | ||
526 | LBA_CFG_TR4_ADDR_SETUP(d, tok | pos); | 526 | LBA_CFG_TR4_ADDR_SETUP(d, tok | pos); |
527 | switch(size) { | 527 | switch(size) { |
@@ -890,7 +890,7 @@ LBA_PORT_IN(32, 0) | |||
890 | #define LBA_PORT_OUT(size, mask) \ | 890 | #define LBA_PORT_OUT(size, mask) \ |
891 | static void lba_astro_out##size (struct pci_hba_data *d, u16 addr, u##size val) \ | 891 | static void lba_astro_out##size (struct pci_hba_data *d, u16 addr, u##size val) \ |
892 | { \ | 892 | { \ |
893 | DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __FUNCTION__, d, addr, val); \ | 893 | DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __func__, d, addr, val); \ |
894 | WRITE_REG##size(val, astro_iop_base + addr); \ | 894 | WRITE_REG##size(val, astro_iop_base + addr); \ |
895 | if (LBA_DEV(d)->hw_rev < 3) \ | 895 | if (LBA_DEV(d)->hw_rev < 3) \ |
896 | lba_t32 = READ_U32(d->base_addr + LBA_FUNC_ID); \ | 896 | lba_t32 = READ_U32(d->base_addr + LBA_FUNC_ID); \ |
@@ -932,7 +932,7 @@ static struct pci_port_ops lba_astro_port_ops = { | |||
932 | static u##size lba_pat_in##size (struct pci_hba_data *l, u16 addr) \ | 932 | static u##size lba_pat_in##size (struct pci_hba_data *l, u16 addr) \ |
933 | { \ | 933 | { \ |
934 | u##size t; \ | 934 | u##size t; \ |
935 | DBG_PORT("%s(0x%p, 0x%x) ->", __FUNCTION__, l, addr); \ | 935 | DBG_PORT("%s(0x%p, 0x%x) ->", __func__, l, addr); \ |
936 | t = READ_REG##size(PIOP_TO_GMMIO(LBA_DEV(l), addr)); \ | 936 | t = READ_REG##size(PIOP_TO_GMMIO(LBA_DEV(l), addr)); \ |
937 | DBG_PORT(" 0x%x\n", t); \ | 937 | DBG_PORT(" 0x%x\n", t); \ |
938 | return (t); \ | 938 | return (t); \ |
@@ -948,7 +948,7 @@ LBA_PORT_IN(32, 0) | |||
948 | static void lba_pat_out##size (struct pci_hba_data *l, u16 addr, u##size val) \ | 948 | static void lba_pat_out##size (struct pci_hba_data *l, u16 addr, u##size val) \ |
949 | { \ | 949 | { \ |
950 | void __iomem *where = PIOP_TO_GMMIO(LBA_DEV(l), addr); \ | 950 | void __iomem *where = PIOP_TO_GMMIO(LBA_DEV(l), addr); \ |
951 | DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __FUNCTION__, l, addr, val); \ | 951 | DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __func__, l, addr, val); \ |
952 | WRITE_REG##size(val, where); \ | 952 | WRITE_REG##size(val, where); \ |
953 | /* flush the I/O down to the elroy at least */ \ | 953 | /* flush the I/O down to the elroy at least */ \ |
954 | lba_t32 = READ_U32(l->base_addr + LBA_FUNC_ID); \ | 954 | lba_t32 = READ_U32(l->base_addr + LBA_FUNC_ID); \ |
@@ -1584,7 +1584,7 @@ void lba_set_iregs(struct parisc_device *lba, u32 ibase, u32 imask) | |||
1584 | WARN_ON((ibase & 0x001fffff) != 0); | 1584 | WARN_ON((ibase & 0x001fffff) != 0); |
1585 | WARN_ON((imask & 0x001fffff) != 0); | 1585 | WARN_ON((imask & 0x001fffff) != 0); |
1586 | 1586 | ||
1587 | DBG("%s() ibase 0x%x imask 0x%x\n", __FUNCTION__, ibase, imask); | 1587 | DBG("%s() ibase 0x%x imask 0x%x\n", __func__, ibase, imask); |
1588 | WRITE_REG32( imask, base_addr + LBA_IMASK); | 1588 | WRITE_REG32( imask, base_addr + LBA_IMASK); |
1589 | WRITE_REG32( ibase, base_addr + LBA_IBASE); | 1589 | WRITE_REG32( ibase, base_addr + LBA_IBASE); |
1590 | iounmap(base_addr); | 1590 | iounmap(base_addr); |
diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c index 703b85edb004..f9b12664f9fb 100644 --- a/drivers/parisc/led.c +++ b/drivers/parisc/led.c | |||
@@ -569,7 +569,7 @@ int __init register_led_driver(int model, unsigned long cmd_reg, unsigned long d | |||
569 | 569 | ||
570 | default: | 570 | default: |
571 | printk(KERN_ERR "%s: Wrong LCD/LED model %d !\n", | 571 | printk(KERN_ERR "%s: Wrong LCD/LED model %d !\n", |
572 | __FUNCTION__, lcd_info.model); | 572 | __func__, lcd_info.model); |
573 | return 1; | 573 | return 1; |
574 | } | 574 | } |
575 | 575 | ||
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index afc849bd3f58..bc73b96346ff 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c | |||
@@ -384,7 +384,7 @@ sba_search_bitmap(struct ioc *ioc, struct device *dev, | |||
384 | } | 384 | } |
385 | mask = RESMAP_MASK(bits_wanted) >> bitshiftcnt; | 385 | mask = RESMAP_MASK(bits_wanted) >> bitshiftcnt; |
386 | 386 | ||
387 | DBG_RES("%s() o %ld %p", __FUNCTION__, o, res_ptr); | 387 | DBG_RES("%s() o %ld %p", __func__, o, res_ptr); |
388 | while(res_ptr < res_end) | 388 | while(res_ptr < res_end) |
389 | { | 389 | { |
390 | DBG_RES(" %p %lx %lx\n", res_ptr, mask, *res_ptr); | 390 | DBG_RES(" %p %lx %lx\n", res_ptr, mask, *res_ptr); |
@@ -454,7 +454,7 @@ sba_alloc_range(struct ioc *ioc, struct device *dev, size_t size) | |||
454 | #endif | 454 | #endif |
455 | 455 | ||
456 | DBG_RES("%s(%x) %d -> %lx hint %x/%x\n", | 456 | DBG_RES("%s(%x) %d -> %lx hint %x/%x\n", |
457 | __FUNCTION__, size, pages_needed, pide, | 457 | __func__, size, pages_needed, pide, |
458 | (uint) ((unsigned long) ioc->res_hint - (unsigned long) ioc->res_map), | 458 | (uint) ((unsigned long) ioc->res_hint - (unsigned long) ioc->res_map), |
459 | ioc->res_bitshift ); | 459 | ioc->res_bitshift ); |
460 | 460 | ||
@@ -497,7 +497,7 @@ sba_free_range(struct ioc *ioc, dma_addr_t iova, size_t size) | |||
497 | unsigned long m = RESMAP_MASK(bits_not_wanted) >> (pide & (BITS_PER_LONG - 1)); | 497 | unsigned long m = RESMAP_MASK(bits_not_wanted) >> (pide & (BITS_PER_LONG - 1)); |
498 | 498 | ||
499 | DBG_RES("%s( ,%x,%x) %x/%lx %x %p %lx\n", | 499 | DBG_RES("%s( ,%x,%x) %x/%lx %x %p %lx\n", |
500 | __FUNCTION__, (uint) iova, size, | 500 | __func__, (uint) iova, size, |
501 | bits_not_wanted, m, pide, res_ptr, *res_ptr); | 501 | bits_not_wanted, m, pide, res_ptr, *res_ptr); |
502 | 502 | ||
503 | #ifdef SBA_COLLECT_STATS | 503 | #ifdef SBA_COLLECT_STATS |
@@ -740,7 +740,7 @@ sba_map_single(struct device *dev, void *addr, size_t size, | |||
740 | iovp = (dma_addr_t) pide << IOVP_SHIFT; | 740 | iovp = (dma_addr_t) pide << IOVP_SHIFT; |
741 | 741 | ||
742 | DBG_RUN("%s() 0x%p -> 0x%lx\n", | 742 | DBG_RUN("%s() 0x%p -> 0x%lx\n", |
743 | __FUNCTION__, addr, (long) iovp | offset); | 743 | __func__, addr, (long) iovp | offset); |
744 | 744 | ||
745 | pdir_start = &(ioc->pdir_base[pide]); | 745 | pdir_start = &(ioc->pdir_base[pide]); |
746 | 746 | ||
@@ -798,7 +798,7 @@ sba_unmap_single(struct device *dev, dma_addr_t iova, size_t size, | |||
798 | unsigned long flags; | 798 | unsigned long flags; |
799 | dma_addr_t offset; | 799 | dma_addr_t offset; |
800 | 800 | ||
801 | DBG_RUN("%s() iovp 0x%lx/%x\n", __FUNCTION__, (long) iova, size); | 801 | DBG_RUN("%s() iovp 0x%lx/%x\n", __func__, (long) iova, size); |
802 | 802 | ||
803 | ioc = GET_IOC(dev); | 803 | ioc = GET_IOC(dev); |
804 | offset = iova & ~IOVP_MASK; | 804 | offset = iova & ~IOVP_MASK; |
@@ -937,7 +937,7 @@ sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents, | |||
937 | int coalesced, filled = 0; | 937 | int coalesced, filled = 0; |
938 | unsigned long flags; | 938 | unsigned long flags; |
939 | 939 | ||
940 | DBG_RUN_SG("%s() START %d entries\n", __FUNCTION__, nents); | 940 | DBG_RUN_SG("%s() START %d entries\n", __func__, nents); |
941 | 941 | ||
942 | ioc = GET_IOC(dev); | 942 | ioc = GET_IOC(dev); |
943 | 943 | ||
@@ -998,7 +998,7 @@ sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents, | |||
998 | 998 | ||
999 | spin_unlock_irqrestore(&ioc->res_lock, flags); | 999 | spin_unlock_irqrestore(&ioc->res_lock, flags); |
1000 | 1000 | ||
1001 | DBG_RUN_SG("%s() DONE %d mappings\n", __FUNCTION__, filled); | 1001 | DBG_RUN_SG("%s() DONE %d mappings\n", __func__, filled); |
1002 | 1002 | ||
1003 | return filled; | 1003 | return filled; |
1004 | } | 1004 | } |
@@ -1023,7 +1023,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, | |||
1023 | #endif | 1023 | #endif |
1024 | 1024 | ||
1025 | DBG_RUN_SG("%s() START %d entries, %p,%x\n", | 1025 | DBG_RUN_SG("%s() START %d entries, %p,%x\n", |
1026 | __FUNCTION__, nents, sg_virt_addr(sglist), sglist->length); | 1026 | __func__, nents, sg_virt_addr(sglist), sglist->length); |
1027 | 1027 | ||
1028 | ioc = GET_IOC(dev); | 1028 | ioc = GET_IOC(dev); |
1029 | 1029 | ||
@@ -1047,7 +1047,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, | |||
1047 | ++sglist; | 1047 | ++sglist; |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | DBG_RUN_SG("%s() DONE (nents %d)\n", __FUNCTION__, nents); | 1050 | DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents); |
1051 | 1051 | ||
1052 | #ifdef ASSERT_PDIR_SANITY | 1052 | #ifdef ASSERT_PDIR_SANITY |
1053 | spin_lock_irqsave(&ioc->res_lock, flags); | 1053 | spin_lock_irqsave(&ioc->res_lock, flags); |
@@ -1118,7 +1118,7 @@ sba_alloc_pdir(unsigned int pdir_size) | |||
1118 | pdir_base = __get_free_pages(GFP_KERNEL, pdir_order); | 1118 | pdir_base = __get_free_pages(GFP_KERNEL, pdir_order); |
1119 | if (NULL == (void *) pdir_base) { | 1119 | if (NULL == (void *) pdir_base) { |
1120 | panic("%s() could not allocate I/O Page Table\n", | 1120 | panic("%s() could not allocate I/O Page Table\n", |
1121 | __FUNCTION__); | 1121 | __func__); |
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | /* If this is not PA8700 (PCX-W2) | 1124 | /* If this is not PA8700 (PCX-W2) |
@@ -1261,7 +1261,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num) | |||
1261 | ioc->pdir_size = (iova_space_size / IOVP_SIZE) * sizeof(u64); | 1261 | ioc->pdir_size = (iova_space_size / IOVP_SIZE) * sizeof(u64); |
1262 | 1262 | ||
1263 | DBG_INIT("%s() hpa 0x%p IOV %dMB (%d bits)\n", | 1263 | DBG_INIT("%s() hpa 0x%p IOV %dMB (%d bits)\n", |
1264 | __FUNCTION__, ioc->ioc_hpa, iova_space_size >> 20, | 1264 | __func__, ioc->ioc_hpa, iova_space_size >> 20, |
1265 | iov_order + PAGE_SHIFT); | 1265 | iov_order + PAGE_SHIFT); |
1266 | 1266 | ||
1267 | ioc->pdir_base = (void *) __get_free_pages(GFP_KERNEL, | 1267 | ioc->pdir_base = (void *) __get_free_pages(GFP_KERNEL, |
@@ -1272,7 +1272,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num) | |||
1272 | memset(ioc->pdir_base, 0, ioc->pdir_size); | 1272 | memset(ioc->pdir_base, 0, ioc->pdir_size); |
1273 | 1273 | ||
1274 | DBG_INIT("%s() pdir %p size %x\n", | 1274 | DBG_INIT("%s() pdir %p size %x\n", |
1275 | __FUNCTION__, ioc->pdir_base, ioc->pdir_size); | 1275 | __func__, ioc->pdir_base, ioc->pdir_size); |
1276 | 1276 | ||
1277 | #ifdef SBA_HINT_SUPPORT | 1277 | #ifdef SBA_HINT_SUPPORT |
1278 | ioc->hint_shift_pdir = iov_order + PAGE_SHIFT; | 1278 | ioc->hint_shift_pdir = iov_order + PAGE_SHIFT; |
@@ -1354,7 +1354,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num) | |||
1354 | 1354 | ||
1355 | if (agp_found && sba_reserve_agpgart) { | 1355 | if (agp_found && sba_reserve_agpgart) { |
1356 | printk(KERN_INFO "%s: reserving %dMb of IOVA space for agpgart\n", | 1356 | printk(KERN_INFO "%s: reserving %dMb of IOVA space for agpgart\n", |
1357 | __FUNCTION__, (iova_space_size/2) >> 20); | 1357 | __func__, (iova_space_size/2) >> 20); |
1358 | ioc->pdir_size /= 2; | 1358 | ioc->pdir_size /= 2; |
1359 | ioc->pdir_base[PDIR_INDEX(iova_space_size/2)] = SBA_AGPGART_COOKIE; | 1359 | ioc->pdir_base[PDIR_INDEX(iova_space_size/2)] = SBA_AGPGART_COOKIE; |
1360 | } | 1360 | } |
@@ -1406,7 +1406,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num) | |||
1406 | ioc->pdir_size = pdir_size = (iova_space_size/IOVP_SIZE) * sizeof(u64); | 1406 | ioc->pdir_size = pdir_size = (iova_space_size/IOVP_SIZE) * sizeof(u64); |
1407 | 1407 | ||
1408 | DBG_INIT("%s() hpa 0x%lx mem %ldMB IOV %dMB (%d bits)\n", | 1408 | DBG_INIT("%s() hpa 0x%lx mem %ldMB IOV %dMB (%d bits)\n", |
1409 | __FUNCTION__, | 1409 | __func__, |
1410 | ioc->ioc_hpa, | 1410 | ioc->ioc_hpa, |
1411 | (unsigned long) num_physpages >> (20 - PAGE_SHIFT), | 1411 | (unsigned long) num_physpages >> (20 - PAGE_SHIFT), |
1412 | iova_space_size>>20, | 1412 | iova_space_size>>20, |
@@ -1415,7 +1415,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num) | |||
1415 | ioc->pdir_base = sba_alloc_pdir(pdir_size); | 1415 | ioc->pdir_base = sba_alloc_pdir(pdir_size); |
1416 | 1416 | ||
1417 | DBG_INIT("%s() pdir %p size %x\n", | 1417 | DBG_INIT("%s() pdir %p size %x\n", |
1418 | __FUNCTION__, ioc->pdir_base, pdir_size); | 1418 | __func__, ioc->pdir_base, pdir_size); |
1419 | 1419 | ||
1420 | #ifdef SBA_HINT_SUPPORT | 1420 | #ifdef SBA_HINT_SUPPORT |
1421 | /* FIXME : DMA HINTs not used */ | 1421 | /* FIXME : DMA HINTs not used */ |
@@ -1443,7 +1443,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num) | |||
1443 | #endif | 1443 | #endif |
1444 | 1444 | ||
1445 | DBG_INIT("%s() IOV base 0x%lx mask 0x%0lx\n", | 1445 | DBG_INIT("%s() IOV base 0x%lx mask 0x%0lx\n", |
1446 | __FUNCTION__, ioc->ibase, ioc->imask); | 1446 | __func__, ioc->ibase, ioc->imask); |
1447 | 1447 | ||
1448 | /* | 1448 | /* |
1449 | ** FIXME: Hint registers are programmed with default hint | 1449 | ** FIXME: Hint registers are programmed with default hint |
@@ -1470,7 +1470,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num) | |||
1470 | 1470 | ||
1471 | ioc->ibase = 0; /* used by SBA_IOVA and related macros */ | 1471 | ioc->ibase = 0; /* used by SBA_IOVA and related macros */ |
1472 | 1472 | ||
1473 | DBG_INIT("%s() DONE\n", __FUNCTION__); | 1473 | DBG_INIT("%s() DONE\n", __func__); |
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | 1476 | ||
@@ -1544,7 +1544,7 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa, | |||
1544 | if (!IS_PLUTO(sba_dev->dev)) { | 1544 | if (!IS_PLUTO(sba_dev->dev)) { |
1545 | ioc_ctl = READ_REG(sba_dev->sba_hpa+IOC_CTRL); | 1545 | ioc_ctl = READ_REG(sba_dev->sba_hpa+IOC_CTRL); |
1546 | DBG_INIT("%s() hpa 0x%lx ioc_ctl 0x%Lx ->", | 1546 | DBG_INIT("%s() hpa 0x%lx ioc_ctl 0x%Lx ->", |
1547 | __FUNCTION__, sba_dev->sba_hpa, ioc_ctl); | 1547 | __func__, sba_dev->sba_hpa, ioc_ctl); |
1548 | ioc_ctl &= ~(IOC_CTRL_RM | IOC_CTRL_NC | IOC_CTRL_CE); | 1548 | ioc_ctl &= ~(IOC_CTRL_RM | IOC_CTRL_NC | IOC_CTRL_CE); |
1549 | ioc_ctl |= IOC_CTRL_DD | IOC_CTRL_D4 | IOC_CTRL_TC; | 1549 | ioc_ctl |= IOC_CTRL_DD | IOC_CTRL_D4 | IOC_CTRL_TC; |
1550 | /* j6700 v1.6 firmware sets 0x294f */ | 1550 | /* j6700 v1.6 firmware sets 0x294f */ |
@@ -1675,7 +1675,7 @@ sba_common_init(struct sba_device *sba_dev) | |||
1675 | 1675 | ||
1676 | res_size >>= 3; /* convert bit count to byte count */ | 1676 | res_size >>= 3; /* convert bit count to byte count */ |
1677 | DBG_INIT("%s() res_size 0x%x\n", | 1677 | DBG_INIT("%s() res_size 0x%x\n", |
1678 | __FUNCTION__, res_size); | 1678 | __func__, res_size); |
1679 | 1679 | ||
1680 | sba_dev->ioc[i].res_size = res_size; | 1680 | sba_dev->ioc[i].res_size = res_size; |
1681 | sba_dev->ioc[i].res_map = (char *) __get_free_pages(GFP_KERNEL, get_order(res_size)); | 1681 | sba_dev->ioc[i].res_map = (char *) __get_free_pages(GFP_KERNEL, get_order(res_size)); |
@@ -1688,7 +1688,7 @@ sba_common_init(struct sba_device *sba_dev) | |||
1688 | if (NULL == sba_dev->ioc[i].res_map) | 1688 | if (NULL == sba_dev->ioc[i].res_map) |
1689 | { | 1689 | { |
1690 | panic("%s:%s() could not allocate resource map\n", | 1690 | panic("%s:%s() could not allocate resource map\n", |
1691 | __FILE__, __FUNCTION__ ); | 1691 | __FILE__, __func__ ); |
1692 | } | 1692 | } |
1693 | 1693 | ||
1694 | memset(sba_dev->ioc[i].res_map, 0, res_size); | 1694 | memset(sba_dev->ioc[i].res_map, 0, res_size); |
@@ -1725,7 +1725,7 @@ sba_common_init(struct sba_device *sba_dev) | |||
1725 | #endif | 1725 | #endif |
1726 | 1726 | ||
1727 | DBG_INIT("%s() %d res_map %x %p\n", | 1727 | DBG_INIT("%s() %d res_map %x %p\n", |
1728 | __FUNCTION__, i, res_size, sba_dev->ioc[i].res_map); | 1728 | __func__, i, res_size, sba_dev->ioc[i].res_map); |
1729 | } | 1729 | } |
1730 | 1730 | ||
1731 | spin_lock_init(&sba_dev->sba_lock); | 1731 | spin_lock_init(&sba_dev->sba_lock); |
diff --git a/drivers/parisc/wax.c b/drivers/parisc/wax.c index 813c2c24ab1e..892a83bbe73d 100644 --- a/drivers/parisc/wax.c +++ b/drivers/parisc/wax.c | |||
@@ -93,7 +93,7 @@ wax_init_chip(struct parisc_device *dev) | |||
93 | dev->irq = gsc_claim_irq(&gsc_irq, WAX_GSC_IRQ); | 93 | dev->irq = gsc_claim_irq(&gsc_irq, WAX_GSC_IRQ); |
94 | if (dev->irq < 0) { | 94 | if (dev->irq < 0) { |
95 | printk(KERN_ERR "%s(): cannot get GSC irq\n", | 95 | printk(KERN_ERR "%s(): cannot get GSC irq\n", |
96 | __FUNCTION__); | 96 | __func__); |
97 | kfree(wax); | 97 | kfree(wax); |
98 | return -EBUSY; | 98 | return -EBUSY; |
99 | } | 99 | } |
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c index 925ba16355ce..a11021e8ce37 100644 --- a/drivers/pci/hotplug/pci_hotplug_core.c +++ b/drivers/pci/hotplug/pci_hotplug_core.c | |||
@@ -619,6 +619,7 @@ static struct hotplug_slot *get_slot_from_name (const char *name) | |||
619 | int pci_hp_register (struct hotplug_slot *slot) | 619 | int pci_hp_register (struct hotplug_slot *slot) |
620 | { | 620 | { |
621 | int result; | 621 | int result; |
622 | struct hotplug_slot *tmp; | ||
622 | 623 | ||
623 | if (slot == NULL) | 624 | if (slot == NULL) |
624 | return -ENODEV; | 625 | return -ENODEV; |
@@ -630,7 +631,11 @@ int pci_hp_register (struct hotplug_slot *slot) | |||
630 | return -EINVAL; | 631 | return -EINVAL; |
631 | } | 632 | } |
632 | 633 | ||
633 | /* this can fail if we have already registered a slot with the same name */ | 634 | /* Check if we have already registered a slot with the same name. */ |
635 | tmp = get_slot_from_name(slot->name); | ||
636 | if (tmp) | ||
637 | return -EEXIST; | ||
638 | |||
634 | slot->kobj.kset = pci_hotplug_slots_kset; | 639 | slot->kobj.kset = pci_hotplug_slots_kset; |
635 | result = kobject_init_and_add(&slot->kobj, &hotplug_slot_ktype, NULL, | 640 | result = kobject_init_and_add(&slot->kobj, &hotplug_slot_ktype, NULL, |
636 | "%s", slot->name); | 641 | "%s", slot->name); |
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index 8264a7680435..79c9ddaad3fb 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h | |||
@@ -97,6 +97,7 @@ struct controller { | |||
97 | u8 cap_base; | 97 | u8 cap_base; |
98 | struct timer_list poll_timer; | 98 | struct timer_list poll_timer; |
99 | volatile int cmd_busy; | 99 | volatile int cmd_busy; |
100 | unsigned int no_cmd_complete:1; | ||
100 | }; | 101 | }; |
101 | 102 | ||
102 | #define INT_BUTTON_IGNORE 0 | 103 | #define INT_BUTTON_IGNORE 0 |
@@ -135,6 +136,7 @@ struct controller { | |||
135 | #define PWR_LED_PRSN 0x00000010 | 136 | #define PWR_LED_PRSN 0x00000010 |
136 | #define HP_SUPR_RM_SUP 0x00000020 | 137 | #define HP_SUPR_RM_SUP 0x00000020 |
137 | #define EMI_PRSN 0x00020000 | 138 | #define EMI_PRSN 0x00020000 |
139 | #define NO_CMD_CMPL_SUP 0x00040000 | ||
138 | 140 | ||
139 | #define ATTN_BUTTN(ctrl) ((ctrl)->slot_cap & ATTN_BUTTN_PRSN) | 141 | #define ATTN_BUTTN(ctrl) ((ctrl)->slot_cap & ATTN_BUTTN_PRSN) |
140 | #define POWER_CTRL(ctrl) ((ctrl)->slot_cap & PWR_CTRL_PRSN) | 142 | #define POWER_CTRL(ctrl) ((ctrl)->slot_cap & PWR_CTRL_PRSN) |
@@ -143,13 +145,14 @@ struct controller { | |||
143 | #define PWR_LED(ctrl) ((ctrl)->slot_cap & PWR_LED_PRSN) | 145 | #define PWR_LED(ctrl) ((ctrl)->slot_cap & PWR_LED_PRSN) |
144 | #define HP_SUPR_RM(ctrl) ((ctrl)->slot_cap & HP_SUPR_RM_SUP) | 146 | #define HP_SUPR_RM(ctrl) ((ctrl)->slot_cap & HP_SUPR_RM_SUP) |
145 | #define EMI(ctrl) ((ctrl)->slot_cap & EMI_PRSN) | 147 | #define EMI(ctrl) ((ctrl)->slot_cap & EMI_PRSN) |
148 | #define NO_CMD_CMPL(ctrl) ((ctrl)->slot_cap & NO_CMD_CMPL_SUP) | ||
146 | 149 | ||
147 | extern int pciehp_sysfs_enable_slot(struct slot *slot); | 150 | extern int pciehp_sysfs_enable_slot(struct slot *slot); |
148 | extern int pciehp_sysfs_disable_slot(struct slot *slot); | 151 | extern int pciehp_sysfs_disable_slot(struct slot *slot); |
149 | extern u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl); | 152 | extern u8 pciehp_handle_attention_button(struct slot *p_slot); |
150 | extern u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl); | 153 | extern u8 pciehp_handle_switch_change(struct slot *p_slot); |
151 | extern u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl); | 154 | extern u8 pciehp_handle_presence_change(struct slot *p_slot); |
152 | extern u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl); | 155 | extern u8 pciehp_handle_power_fault(struct slot *p_slot); |
153 | extern int pciehp_configure_device(struct slot *p_slot); | 156 | extern int pciehp_configure_device(struct slot *p_slot); |
154 | extern int pciehp_unconfigure_device(struct slot *p_slot); | 157 | extern int pciehp_unconfigure_device(struct slot *p_slot); |
155 | extern void pciehp_queue_pushbutton_work(struct work_struct *work); | 158 | extern void pciehp_queue_pushbutton_work(struct work_struct *work); |
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 43d8ddb2d679..48a2ed378914 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
@@ -254,7 +254,11 @@ static int init_slots(struct controller *ctrl) | |||
254 | slot->hp_slot, slot->number, ctrl->slot_device_offset); | 254 | slot->hp_slot, slot->number, ctrl->slot_device_offset); |
255 | retval = pci_hp_register(hotplug_slot); | 255 | retval = pci_hp_register(hotplug_slot); |
256 | if (retval) { | 256 | if (retval) { |
257 | err ("pci_hp_register failed with error %d\n", retval); | 257 | err("pci_hp_register failed with error %d\n", retval); |
258 | if (retval == -EEXIST) | ||
259 | err("Failed to register slot because of name " | ||
260 | "collision. Try \'pciehp_slot_with_bus\' " | ||
261 | "module option.\n"); | ||
258 | goto error_info; | 262 | goto error_info; |
259 | } | 263 | } |
260 | /* create additional sysfs entries */ | 264 | /* create additional sysfs entries */ |
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index 0a7aa628e955..96a5d55a4983 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
@@ -55,16 +55,13 @@ static int queue_interrupt_event(struct slot *p_slot, u32 event_type) | |||
55 | return 0; | 55 | return 0; |
56 | } | 56 | } |
57 | 57 | ||
58 | u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl) | 58 | u8 pciehp_handle_attention_button(struct slot *p_slot) |
59 | { | 59 | { |
60 | struct slot *p_slot; | ||
61 | u32 event_type; | 60 | u32 event_type; |
62 | 61 | ||
63 | /* Attention Button Change */ | 62 | /* Attention Button Change */ |
64 | dbg("pciehp: Attention button interrupt received.\n"); | 63 | dbg("pciehp: Attention button interrupt received.\n"); |
65 | 64 | ||
66 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); | ||
67 | |||
68 | /* | 65 | /* |
69 | * Button pressed - See if need to TAKE ACTION!!! | 66 | * Button pressed - See if need to TAKE ACTION!!! |
70 | */ | 67 | */ |
@@ -76,18 +73,15 @@ u8 pciehp_handle_attention_button(u8 hp_slot, struct controller *ctrl) | |||
76 | return 0; | 73 | return 0; |
77 | } | 74 | } |
78 | 75 | ||
79 | u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl) | 76 | u8 pciehp_handle_switch_change(struct slot *p_slot) |
80 | { | 77 | { |
81 | struct slot *p_slot; | ||
82 | u8 getstatus; | 78 | u8 getstatus; |
83 | u32 event_type; | 79 | u32 event_type; |
84 | 80 | ||
85 | /* Switch Change */ | 81 | /* Switch Change */ |
86 | dbg("pciehp: Switch interrupt received.\n"); | 82 | dbg("pciehp: Switch interrupt received.\n"); |
87 | 83 | ||
88 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); | ||
89 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 84 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
90 | |||
91 | if (getstatus) { | 85 | if (getstatus) { |
92 | /* | 86 | /* |
93 | * Switch opened | 87 | * Switch opened |
@@ -107,17 +101,14 @@ u8 pciehp_handle_switch_change(u8 hp_slot, struct controller *ctrl) | |||
107 | return 1; | 101 | return 1; |
108 | } | 102 | } |
109 | 103 | ||
110 | u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl) | 104 | u8 pciehp_handle_presence_change(struct slot *p_slot) |
111 | { | 105 | { |
112 | struct slot *p_slot; | ||
113 | u32 event_type; | 106 | u32 event_type; |
114 | u8 presence_save; | 107 | u8 presence_save; |
115 | 108 | ||
116 | /* Presence Change */ | 109 | /* Presence Change */ |
117 | dbg("pciehp: Presence/Notify input change.\n"); | 110 | dbg("pciehp: Presence/Notify input change.\n"); |
118 | 111 | ||
119 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); | ||
120 | |||
121 | /* Switch is open, assume a presence change | 112 | /* Switch is open, assume a presence change |
122 | * Save the presence state | 113 | * Save the presence state |
123 | */ | 114 | */ |
@@ -141,16 +132,13 @@ u8 pciehp_handle_presence_change(u8 hp_slot, struct controller *ctrl) | |||
141 | return 1; | 132 | return 1; |
142 | } | 133 | } |
143 | 134 | ||
144 | u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl) | 135 | u8 pciehp_handle_power_fault(struct slot *p_slot) |
145 | { | 136 | { |
146 | struct slot *p_slot; | ||
147 | u32 event_type; | 137 | u32 event_type; |
148 | 138 | ||
149 | /* power fault */ | 139 | /* power fault */ |
150 | dbg("pciehp: Power fault interrupt received.\n"); | 140 | dbg("pciehp: Power fault interrupt received.\n"); |
151 | 141 | ||
152 | p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); | ||
153 | |||
154 | if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) { | 142 | if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) { |
155 | /* | 143 | /* |
156 | * power fault Cleared | 144 | * power fault Cleared |
@@ -163,7 +151,7 @@ u8 pciehp_handle_power_fault(u8 hp_slot, struct controller *ctrl) | |||
163 | */ | 151 | */ |
164 | info("Power fault on Slot(%s)\n", p_slot->name); | 152 | info("Power fault on Slot(%s)\n", p_slot->name); |
165 | event_type = INT_POWER_FAULT; | 153 | event_type = INT_POWER_FAULT; |
166 | info("power fault bit %x set\n", hp_slot); | 154 | info("power fault bit %x set\n", 0); |
167 | } | 155 | } |
168 | 156 | ||
169 | queue_interrupt_event(p_slot, event_type); | 157 | queue_interrupt_event(p_slot, event_type); |
@@ -186,6 +174,13 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot) | |||
186 | } | 174 | } |
187 | } | 175 | } |
188 | 176 | ||
177 | /* | ||
178 | * After turning power off, we must wait for at least 1 second | ||
179 | * before taking any action that relies on power having been | ||
180 | * removed from the slot/adapter. | ||
181 | */ | ||
182 | msleep(1000); | ||
183 | |||
189 | if (PWR_LED(ctrl)) | 184 | if (PWR_LED(ctrl)) |
190 | pslot->hpc_ops->green_led_off(pslot); | 185 | pslot->hpc_ops->green_led_off(pslot); |
191 | 186 | ||
@@ -289,6 +284,13 @@ static int remove_board(struct slot *p_slot) | |||
289 | } | 284 | } |
290 | } | 285 | } |
291 | 286 | ||
287 | /* | ||
288 | * After turning power off, we must wait for at least 1 second | ||
289 | * before taking any action that relies on power having been | ||
290 | * removed from the slot/adapter. | ||
291 | */ | ||
292 | msleep(1000); | ||
293 | |||
292 | if (PWR_LED(ctrl)) | 294 | if (PWR_LED(ctrl)) |
293 | /* turn off Green LED */ | 295 | /* turn off Green LED */ |
294 | p_slot->hpc_ops->green_led_off(p_slot); | 296 | p_slot->hpc_ops->green_led_off(p_slot); |
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 891f81a0400c..79f104963166 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
@@ -247,14 +247,38 @@ static inline void pciehp_free_irq(struct controller *ctrl) | |||
247 | free_irq(ctrl->pci_dev->irq, ctrl); | 247 | free_irq(ctrl->pci_dev->irq, ctrl); |
248 | } | 248 | } |
249 | 249 | ||
250 | static inline int pcie_wait_cmd(struct controller *ctrl) | 250 | static inline int pcie_poll_cmd(struct controller *ctrl) |
251 | { | ||
252 | u16 slot_status; | ||
253 | int timeout = 1000; | ||
254 | |||
255 | if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) | ||
256 | if (slot_status & CMD_COMPLETED) | ||
257 | goto completed; | ||
258 | for (timeout = 1000; timeout > 0; timeout -= 100) { | ||
259 | msleep(100); | ||
260 | if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) | ||
261 | if (slot_status & CMD_COMPLETED) | ||
262 | goto completed; | ||
263 | } | ||
264 | return 0; /* timeout */ | ||
265 | |||
266 | completed: | ||
267 | pciehp_writew(ctrl, SLOTSTATUS, CMD_COMPLETED); | ||
268 | return timeout; | ||
269 | } | ||
270 | |||
271 | static inline int pcie_wait_cmd(struct controller *ctrl, int poll) | ||
251 | { | 272 | { |
252 | int retval = 0; | 273 | int retval = 0; |
253 | unsigned int msecs = pciehp_poll_mode ? 2500 : 1000; | 274 | unsigned int msecs = pciehp_poll_mode ? 2500 : 1000; |
254 | unsigned long timeout = msecs_to_jiffies(msecs); | 275 | unsigned long timeout = msecs_to_jiffies(msecs); |
255 | int rc; | 276 | int rc; |
256 | 277 | ||
257 | rc = wait_event_interruptible_timeout(ctrl->queue, | 278 | if (poll) |
279 | rc = pcie_poll_cmd(ctrl); | ||
280 | else | ||
281 | rc = wait_event_interruptible_timeout(ctrl->queue, | ||
258 | !ctrl->cmd_busy, timeout); | 282 | !ctrl->cmd_busy, timeout); |
259 | if (!rc) | 283 | if (!rc) |
260 | dbg("Command not completed in 1000 msec\n"); | 284 | dbg("Command not completed in 1000 msec\n"); |
@@ -286,12 +310,28 @@ static int pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask) | |||
286 | goto out; | 310 | goto out; |
287 | } | 311 | } |
288 | 312 | ||
289 | if ((slot_status & CMD_COMPLETED) == CMD_COMPLETED ) { | 313 | if (slot_status & CMD_COMPLETED) { |
290 | /* After 1 sec and CMD_COMPLETED still not set, just | 314 | if (!ctrl->no_cmd_complete) { |
291 | proceed forward to issue the next command according | 315 | /* |
292 | to spec. Just print out the error message */ | 316 | * After 1 sec and CMD_COMPLETED still not set, just |
293 | dbg("%s: CMD_COMPLETED not clear after 1 sec.\n", | 317 | * proceed forward to issue the next command according |
294 | __func__); | 318 | * to spec. Just print out the error message. |
319 | */ | ||
320 | dbg("%s: CMD_COMPLETED not clear after 1 sec.\n", | ||
321 | __func__); | ||
322 | } else if (!NO_CMD_CMPL(ctrl)) { | ||
323 | /* | ||
324 | * This controller semms to notify of command completed | ||
325 | * event even though it supports none of power | ||
326 | * controller, attention led, power led and EMI. | ||
327 | */ | ||
328 | dbg("%s: Unexpected CMD_COMPLETED. Need to wait for " | ||
329 | "command completed event.\n", __func__); | ||
330 | ctrl->no_cmd_complete = 0; | ||
331 | } else { | ||
332 | dbg("%s: Unexpected CMD_COMPLETED. Maybe the " | ||
333 | "controller is broken.\n", __func__); | ||
334 | } | ||
295 | } | 335 | } |
296 | 336 | ||
297 | retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); | 337 | retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); |
@@ -315,8 +355,18 @@ static int pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask) | |||
315 | /* | 355 | /* |
316 | * Wait for command completion. | 356 | * Wait for command completion. |
317 | */ | 357 | */ |
318 | if (!retval) | 358 | if (!retval && !ctrl->no_cmd_complete) { |
319 | retval = pcie_wait_cmd(ctrl); | 359 | int poll = 0; |
360 | /* | ||
361 | * if hotplug interrupt is not enabled or command | ||
362 | * completed interrupt is not enabled, we need to poll | ||
363 | * command completed event. | ||
364 | */ | ||
365 | if (!(slot_ctrl & HP_INTR_ENABLE) || | ||
366 | !(slot_ctrl & CMD_CMPL_INTR_ENABLE)) | ||
367 | poll = 1; | ||
368 | retval = pcie_wait_cmd(ctrl, poll); | ||
369 | } | ||
320 | out: | 370 | out: |
321 | mutex_unlock(&ctrl->ctrl_lock); | 371 | mutex_unlock(&ctrl->ctrl_lock); |
322 | return retval; | 372 | return retval; |
@@ -704,13 +754,6 @@ static int hpc_power_off_slot(struct slot * slot) | |||
704 | } | 754 | } |
705 | dbg("%s: SLOTCTRL %x write cmd %x\n", | 755 | dbg("%s: SLOTCTRL %x write cmd %x\n", |
706 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); | 756 | __func__, ctrl->cap_base + SLOTCTRL, slot_cmd); |
707 | |||
708 | /* | ||
709 | * After turning power off, we must wait for at least 1 second | ||
710 | * before taking any action that relies on power having been | ||
711 | * removed from the slot/adapter. | ||
712 | */ | ||
713 | msleep(1000); | ||
714 | out: | 757 | out: |
715 | if (changed) | 758 | if (changed) |
716 | pcie_unmask_bad_dllp(ctrl); | 759 | pcie_unmask_bad_dllp(ctrl); |
@@ -722,6 +765,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
722 | { | 765 | { |
723 | struct controller *ctrl = (struct controller *)dev_id; | 766 | struct controller *ctrl = (struct controller *)dev_id; |
724 | u16 detected, intr_loc; | 767 | u16 detected, intr_loc; |
768 | struct slot *p_slot; | ||
725 | 769 | ||
726 | /* | 770 | /* |
727 | * In order to guarantee that all interrupt events are | 771 | * In order to guarantee that all interrupt events are |
@@ -756,21 +800,38 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
756 | wake_up_interruptible(&ctrl->queue); | 800 | wake_up_interruptible(&ctrl->queue); |
757 | } | 801 | } |
758 | 802 | ||
803 | if (!(intr_loc & ~CMD_COMPLETED)) | ||
804 | return IRQ_HANDLED; | ||
805 | |||
806 | /* | ||
807 | * Return without handling events if this handler routine is | ||
808 | * called before controller initialization is done. This may | ||
809 | * happen if hotplug event or another interrupt that shares | ||
810 | * the IRQ with pciehp arrives before slot initialization is | ||
811 | * done after interrupt handler is registered. | ||
812 | * | ||
813 | * FIXME - Need more structural fixes. We need to be ready to | ||
814 | * handle the event before installing interrupt handler. | ||
815 | */ | ||
816 | p_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); | ||
817 | if (!p_slot || !p_slot->hpc_ops) | ||
818 | return IRQ_HANDLED; | ||
819 | |||
759 | /* Check MRL Sensor Changed */ | 820 | /* Check MRL Sensor Changed */ |
760 | if (intr_loc & MRL_SENS_CHANGED) | 821 | if (intr_loc & MRL_SENS_CHANGED) |
761 | pciehp_handle_switch_change(0, ctrl); | 822 | pciehp_handle_switch_change(p_slot); |
762 | 823 | ||
763 | /* Check Attention Button Pressed */ | 824 | /* Check Attention Button Pressed */ |
764 | if (intr_loc & ATTN_BUTTN_PRESSED) | 825 | if (intr_loc & ATTN_BUTTN_PRESSED) |
765 | pciehp_handle_attention_button(0, ctrl); | 826 | pciehp_handle_attention_button(p_slot); |
766 | 827 | ||
767 | /* Check Presence Detect Changed */ | 828 | /* Check Presence Detect Changed */ |
768 | if (intr_loc & PRSN_DETECT_CHANGED) | 829 | if (intr_loc & PRSN_DETECT_CHANGED) |
769 | pciehp_handle_presence_change(0, ctrl); | 830 | pciehp_handle_presence_change(p_slot); |
770 | 831 | ||
771 | /* Check Power Fault Detected */ | 832 | /* Check Power Fault Detected */ |
772 | if (intr_loc & PWR_FAULT_DETECTED) | 833 | if (intr_loc & PWR_FAULT_DETECTED) |
773 | pciehp_handle_power_fault(0, ctrl); | 834 | pciehp_handle_power_fault(p_slot); |
774 | 835 | ||
775 | return IRQ_HANDLED; | 836 | return IRQ_HANDLED; |
776 | } | 837 | } |
@@ -1028,6 +1089,12 @@ static int pciehp_acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev) | |||
1028 | static int pcie_init_hardware_part1(struct controller *ctrl, | 1089 | static int pcie_init_hardware_part1(struct controller *ctrl, |
1029 | struct pcie_device *dev) | 1090 | struct pcie_device *dev) |
1030 | { | 1091 | { |
1092 | /* Clear all remaining event bits in Slot Status register */ | ||
1093 | if (pciehp_writew(ctrl, SLOTSTATUS, 0x1f)) { | ||
1094 | err("%s: Cannot write to SLOTSTATUS register\n", __func__); | ||
1095 | return -1; | ||
1096 | } | ||
1097 | |||
1031 | /* Mask Hot-plug Interrupt Enable */ | 1098 | /* Mask Hot-plug Interrupt Enable */ |
1032 | if (pcie_write_cmd(ctrl, 0, HP_INTR_ENABLE | CMD_CMPL_INTR_ENABLE)) { | 1099 | if (pcie_write_cmd(ctrl, 0, HP_INTR_ENABLE | CMD_CMPL_INTR_ENABLE)) { |
1033 | err("%s: Cannot mask hotplug interrupt enable\n", __func__); | 1100 | err("%s: Cannot mask hotplug interrupt enable\n", __func__); |
@@ -1040,16 +1107,6 @@ int pcie_init_hardware_part2(struct controller *ctrl, struct pcie_device *dev) | |||
1040 | { | 1107 | { |
1041 | u16 cmd, mask; | 1108 | u16 cmd, mask; |
1042 | 1109 | ||
1043 | /* | ||
1044 | * We need to clear all events before enabling hotplug interrupt | ||
1045 | * notification mechanism in order for hotplug controler to | ||
1046 | * generate interrupts. | ||
1047 | */ | ||
1048 | if (pciehp_writew(ctrl, SLOTSTATUS, 0x1f)) { | ||
1049 | err("%s: Cannot write to SLOTSTATUS register\n", __FUNCTION__); | ||
1050 | return -1; | ||
1051 | } | ||
1052 | |||
1053 | cmd = PRSN_DETECT_ENABLE; | 1110 | cmd = PRSN_DETECT_ENABLE; |
1054 | if (ATTN_BUTTN(ctrl)) | 1111 | if (ATTN_BUTTN(ctrl)) |
1055 | cmd |= ATTN_BUTTN_ENABLE; | 1112 | cmd |= ATTN_BUTTN_ENABLE; |
@@ -1116,6 +1173,7 @@ static inline void dbg_ctrl(struct controller *ctrl) | |||
1116 | dbg(" Power Indicator : %3s\n", PWR_LED(ctrl) ? "yes" : "no"); | 1173 | dbg(" Power Indicator : %3s\n", PWR_LED(ctrl) ? "yes" : "no"); |
1117 | dbg(" Hot-Plug Surprise : %3s\n", HP_SUPR_RM(ctrl) ? "yes" : "no"); | 1174 | dbg(" Hot-Plug Surprise : %3s\n", HP_SUPR_RM(ctrl) ? "yes" : "no"); |
1118 | dbg(" EMI Present : %3s\n", EMI(ctrl) ? "yes" : "no"); | 1175 | dbg(" EMI Present : %3s\n", EMI(ctrl) ? "yes" : "no"); |
1176 | dbg(" Comamnd Completed : %3s\n", NO_CMD_CMPL(ctrl)? "no" : "yes"); | ||
1119 | pciehp_readw(ctrl, SLOTSTATUS, ®16); | 1177 | pciehp_readw(ctrl, SLOTSTATUS, ®16); |
1120 | dbg("Slot Status : 0x%04x\n", reg16); | 1178 | dbg("Slot Status : 0x%04x\n", reg16); |
1121 | pciehp_readw(ctrl, SLOTSTATUS, ®16); | 1179 | pciehp_readw(ctrl, SLOTSTATUS, ®16); |
@@ -1147,6 +1205,15 @@ int pcie_init(struct controller *ctrl, struct pcie_device *dev) | |||
1147 | mutex_init(&ctrl->ctrl_lock); | 1205 | mutex_init(&ctrl->ctrl_lock); |
1148 | init_waitqueue_head(&ctrl->queue); | 1206 | init_waitqueue_head(&ctrl->queue); |
1149 | dbg_ctrl(ctrl); | 1207 | dbg_ctrl(ctrl); |
1208 | /* | ||
1209 | * Controller doesn't notify of command completion if the "No | ||
1210 | * Command Completed Support" bit is set in Slot Capability | ||
1211 | * register or the controller supports none of power | ||
1212 | * controller, attention led, power led and EMI. | ||
1213 | */ | ||
1214 | if (NO_CMD_CMPL(ctrl) || | ||
1215 | !(POWER_CTRL(ctrl) | ATTN_LED(ctrl) | PWR_LED(ctrl) | EMI(ctrl))) | ||
1216 | ctrl->no_cmd_complete = 1; | ||
1150 | 1217 | ||
1151 | info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", | 1218 | info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", |
1152 | pdev->vendor, pdev->device, | 1219 | pdev->vendor, pdev->device, |
diff --git a/drivers/pci/hotplug/rpadlpar_sysfs.c b/drivers/pci/hotplug/rpadlpar_sysfs.c index e32148a8fa12..779c5db71be4 100644 --- a/drivers/pci/hotplug/rpadlpar_sysfs.c +++ b/drivers/pci/hotplug/rpadlpar_sysfs.c | |||
@@ -18,8 +18,12 @@ | |||
18 | #include "rpadlpar.h" | 18 | #include "rpadlpar.h" |
19 | 19 | ||
20 | #define DLPAR_KOBJ_NAME "control" | 20 | #define DLPAR_KOBJ_NAME "control" |
21 | #define ADD_SLOT_ATTR_NAME "add_slot" | 21 | |
22 | #define REMOVE_SLOT_ATTR_NAME "remove_slot" | 22 | /* Those two have no quotes because they are passed to __ATTR() which |
23 | * stringifies the argument (yuck !) | ||
24 | */ | ||
25 | #define ADD_SLOT_ATTR_NAME add_slot | ||
26 | #define REMOVE_SLOT_ATTR_NAME remove_slot | ||
23 | 27 | ||
24 | #define MAX_DRC_NAME_LEN 64 | 28 | #define MAX_DRC_NAME_LEN 64 |
25 | 29 | ||
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c index 1648076600fc..97848654652a 100644 --- a/drivers/pci/hotplug/shpchp_core.c +++ b/drivers/pci/hotplug/shpchp_core.c | |||
@@ -162,6 +162,10 @@ static int init_slots(struct controller *ctrl) | |||
162 | retval = pci_hp_register(slot->hotplug_slot); | 162 | retval = pci_hp_register(slot->hotplug_slot); |
163 | if (retval) { | 163 | if (retval) { |
164 | err("pci_hp_register failed with error %d\n", retval); | 164 | err("pci_hp_register failed with error %d\n", retval); |
165 | if (retval == -EEXIST) | ||
166 | err("Failed to register slot because of name " | ||
167 | "collision. Try \'shpchp_slot_with_bus\' " | ||
168 | "module option.\n"); | ||
165 | goto error_info; | 169 | goto error_info; |
166 | } | 170 | } |
167 | 171 | ||
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 61fedb2448b6..f82495583e63 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c | |||
@@ -506,6 +506,23 @@ static void free_link_state(struct pci_dev *pdev) | |||
506 | pdev->link_state = NULL; | 506 | pdev->link_state = NULL; |
507 | } | 507 | } |
508 | 508 | ||
509 | static int pcie_aspm_sanity_check(struct pci_dev *pdev) | ||
510 | { | ||
511 | struct pci_dev *child_dev; | ||
512 | int child_pos; | ||
513 | |||
514 | /* | ||
515 | * Some functions in a slot might not all be PCIE functions, very | ||
516 | * strange. Disable ASPM for the whole slot | ||
517 | */ | ||
518 | list_for_each_entry(child_dev, &pdev->subordinate->devices, bus_list) { | ||
519 | child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); | ||
520 | if (!child_pos) | ||
521 | return -EINVAL; | ||
522 | } | ||
523 | return 0; | ||
524 | } | ||
525 | |||
509 | /* | 526 | /* |
510 | * pcie_aspm_init_link_state: Initiate PCI express link state. | 527 | * pcie_aspm_init_link_state: Initiate PCI express link state. |
511 | * It is called after the pcie and its children devices are scaned. | 528 | * It is called after the pcie and its children devices are scaned. |
@@ -526,6 +543,9 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev) | |||
526 | if (list_empty(&pdev->subordinate->devices)) | 543 | if (list_empty(&pdev->subordinate->devices)) |
527 | goto out; | 544 | goto out; |
528 | 545 | ||
546 | if (pcie_aspm_sanity_check(pdev)) | ||
547 | goto out; | ||
548 | |||
529 | mutex_lock(&aspm_lock); | 549 | mutex_lock(&aspm_lock); |
530 | 550 | ||
531 | link_state = kzalloc(sizeof(*link_state), GFP_KERNEL); | 551 | link_state = kzalloc(sizeof(*link_state), GFP_KERNEL); |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index f2d9c770f51a..dabb563f51d9 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -1503,8 +1503,7 @@ static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_f | |||
1503 | (f->device == dev->device || f->device == (u16) PCI_ANY_ID)) { | 1503 | (f->device == dev->device || f->device == (u16) PCI_ANY_ID)) { |
1504 | #ifdef DEBUG | 1504 | #ifdef DEBUG |
1505 | dev_dbg(&dev->dev, "calling "); | 1505 | dev_dbg(&dev->dev, "calling "); |
1506 | print_fn_descriptor_symbol("%s()\n", | 1506 | print_fn_descriptor_symbol("%s\n", f->hook); |
1507 | (unsigned long) f->hook); | ||
1508 | #endif | 1507 | #endif |
1509 | f->hook(dev); | 1508 | f->hook(dev); |
1510 | } | 1509 | } |
diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c index 0a6cea1316b4..52d0aa8c2e7a 100644 --- a/drivers/pcmcia/electra_cf.c +++ b/drivers/pcmcia/electra_cf.c | |||
@@ -352,6 +352,7 @@ static struct of_device_id electra_cf_match[] = { | |||
352 | }, | 352 | }, |
353 | {}, | 353 | {}, |
354 | }; | 354 | }; |
355 | MODULE_DEVICE_TABLE(of, electra_cf_match); | ||
355 | 356 | ||
356 | static struct of_platform_driver electra_cf_driver = { | 357 | static struct of_platform_driver electra_cf_driver = { |
357 | .name = (char *)driver_name, | 358 | .name = (char *)driver_name, |
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c index ffdb12a59c40..e2b7de4cb05e 100644 --- a/drivers/pnp/quirks.c +++ b/drivers/pnp/quirks.c | |||
@@ -331,8 +331,7 @@ void pnp_fixup_device(struct pnp_dev *dev) | |||
331 | continue; | 331 | continue; |
332 | #ifdef DEBUG | 332 | #ifdef DEBUG |
333 | dev_dbg(&dev->dev, "%s: calling ", f->id); | 333 | dev_dbg(&dev->dev, "%s: calling ", f->id); |
334 | print_fn_descriptor_symbol("%s\n", | 334 | print_fn_descriptor_symbol("%s\n", f->quirk_function); |
335 | (unsigned long) f->quirk_function); | ||
336 | #endif | 335 | #endif |
337 | f->quirk_function(dev); | 336 | f->quirk_function(dev); |
338 | } | 337 | } |
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 138dd76ee347..af1633eb3b70 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c | |||
@@ -91,15 +91,13 @@ int power_supply_register(struct device *parent, struct power_supply *psy) | |||
91 | { | 91 | { |
92 | int rc = 0; | 92 | int rc = 0; |
93 | 93 | ||
94 | psy->dev = device_create(power_supply_class, parent, 0, | 94 | psy->dev = device_create_drvdata(power_supply_class, parent, 0, |
95 | "%s", psy->name); | 95 | psy, "%s", psy->name); |
96 | if (IS_ERR(psy->dev)) { | 96 | if (IS_ERR(psy->dev)) { |
97 | rc = PTR_ERR(psy->dev); | 97 | rc = PTR_ERR(psy->dev); |
98 | goto dev_create_failed; | 98 | goto dev_create_failed; |
99 | } | 99 | } |
100 | 100 | ||
101 | dev_set_drvdata(psy->dev, psy); | ||
102 | |||
103 | INIT_WORK(&psy->changed_work, power_supply_changed_work); | 101 | INIT_WORK(&psy->changed_work, power_supply_changed_work); |
104 | 102 | ||
105 | rc = power_supply_create_attrs(psy); | 103 | rc = power_supply_create_attrs(psy); |
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index ac6d4d3218b3..1a4025683362 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -63,6 +63,7 @@ static void dasd_return_cqr_cb(struct dasd_ccw_req *, void *); | |||
63 | */ | 63 | */ |
64 | static wait_queue_head_t dasd_init_waitq; | 64 | static wait_queue_head_t dasd_init_waitq; |
65 | static wait_queue_head_t dasd_flush_wq; | 65 | static wait_queue_head_t dasd_flush_wq; |
66 | static wait_queue_head_t generic_waitq; | ||
66 | 67 | ||
67 | /* | 68 | /* |
68 | * Allocate memory for a new device structure. | 69 | * Allocate memory for a new device structure. |
@@ -925,6 +926,8 @@ static void dasd_handle_killed_request(struct ccw_device *cdev, | |||
925 | struct dasd_ccw_req *cqr; | 926 | struct dasd_ccw_req *cqr; |
926 | struct dasd_device *device; | 927 | struct dasd_device *device; |
927 | 928 | ||
929 | if (!intparm) | ||
930 | return; | ||
928 | cqr = (struct dasd_ccw_req *) intparm; | 931 | cqr = (struct dasd_ccw_req *) intparm; |
929 | if (cqr->status != DASD_CQR_IN_IO) { | 932 | if (cqr->status != DASD_CQR_IN_IO) { |
930 | MESSAGE(KERN_DEBUG, | 933 | MESSAGE(KERN_DEBUG, |
@@ -976,17 +979,16 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm, | |||
976 | if (IS_ERR(irb)) { | 979 | if (IS_ERR(irb)) { |
977 | switch (PTR_ERR(irb)) { | 980 | switch (PTR_ERR(irb)) { |
978 | case -EIO: | 981 | case -EIO: |
979 | dasd_handle_killed_request(cdev, intparm); | ||
980 | break; | 982 | break; |
981 | case -ETIMEDOUT: | 983 | case -ETIMEDOUT: |
982 | printk(KERN_WARNING"%s(%s): request timed out\n", | 984 | printk(KERN_WARNING"%s(%s): request timed out\n", |
983 | __func__, cdev->dev.bus_id); | 985 | __func__, cdev->dev.bus_id); |
984 | //FIXME - dasd uses own timeout interface... | ||
985 | break; | 986 | break; |
986 | default: | 987 | default: |
987 | printk(KERN_WARNING"%s(%s): unknown error %ld\n", | 988 | printk(KERN_WARNING"%s(%s): unknown error %ld\n", |
988 | __func__, cdev->dev.bus_id, PTR_ERR(irb)); | 989 | __func__, cdev->dev.bus_id, PTR_ERR(irb)); |
989 | } | 990 | } |
991 | dasd_handle_killed_request(cdev, intparm); | ||
990 | return; | 992 | return; |
991 | } | 993 | } |
992 | 994 | ||
@@ -1150,11 +1152,15 @@ static void __dasd_device_process_final_queue(struct dasd_device *device, | |||
1150 | struct list_head *l, *n; | 1152 | struct list_head *l, *n; |
1151 | struct dasd_ccw_req *cqr; | 1153 | struct dasd_ccw_req *cqr; |
1152 | struct dasd_block *block; | 1154 | struct dasd_block *block; |
1155 | void (*callback)(struct dasd_ccw_req *, void *data); | ||
1156 | void *callback_data; | ||
1153 | 1157 | ||
1154 | list_for_each_safe(l, n, final_queue) { | 1158 | list_for_each_safe(l, n, final_queue) { |
1155 | cqr = list_entry(l, struct dasd_ccw_req, devlist); | 1159 | cqr = list_entry(l, struct dasd_ccw_req, devlist); |
1156 | list_del_init(&cqr->devlist); | 1160 | list_del_init(&cqr->devlist); |
1157 | block = cqr->block; | 1161 | block = cqr->block; |
1162 | callback = cqr->callback; | ||
1163 | callback_data = cqr->callback_data; | ||
1158 | if (block) | 1164 | if (block) |
1159 | spin_lock_bh(&block->queue_lock); | 1165 | spin_lock_bh(&block->queue_lock); |
1160 | switch (cqr->status) { | 1166 | switch (cqr->status) { |
@@ -1175,7 +1181,7 @@ static void __dasd_device_process_final_queue(struct dasd_device *device, | |||
1175 | BUG(); | 1181 | BUG(); |
1176 | } | 1182 | } |
1177 | if (cqr->callback != NULL) | 1183 | if (cqr->callback != NULL) |
1178 | (cqr->callback)(cqr, cqr->callback_data); | 1184 | (callback)(cqr, callback_data); |
1179 | if (block) | 1185 | if (block) |
1180 | spin_unlock_bh(&block->queue_lock); | 1186 | spin_unlock_bh(&block->queue_lock); |
1181 | } | 1187 | } |
@@ -1405,17 +1411,15 @@ static inline int _wait_for_wakeup(struct dasd_ccw_req *cqr) | |||
1405 | */ | 1411 | */ |
1406 | int dasd_sleep_on(struct dasd_ccw_req *cqr) | 1412 | int dasd_sleep_on(struct dasd_ccw_req *cqr) |
1407 | { | 1413 | { |
1408 | wait_queue_head_t wait_q; | ||
1409 | struct dasd_device *device; | 1414 | struct dasd_device *device; |
1410 | int rc; | 1415 | int rc; |
1411 | 1416 | ||
1412 | device = cqr->startdev; | 1417 | device = cqr->startdev; |
1413 | 1418 | ||
1414 | init_waitqueue_head (&wait_q); | ||
1415 | cqr->callback = dasd_wakeup_cb; | 1419 | cqr->callback = dasd_wakeup_cb; |
1416 | cqr->callback_data = (void *) &wait_q; | 1420 | cqr->callback_data = (void *) &generic_waitq; |
1417 | dasd_add_request_tail(cqr); | 1421 | dasd_add_request_tail(cqr); |
1418 | wait_event(wait_q, _wait_for_wakeup(cqr)); | 1422 | wait_event(generic_waitq, _wait_for_wakeup(cqr)); |
1419 | 1423 | ||
1420 | /* Request status is either done or failed. */ | 1424 | /* Request status is either done or failed. */ |
1421 | rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO; | 1425 | rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO; |
@@ -1428,20 +1432,18 @@ int dasd_sleep_on(struct dasd_ccw_req *cqr) | |||
1428 | */ | 1432 | */ |
1429 | int dasd_sleep_on_interruptible(struct dasd_ccw_req *cqr) | 1433 | int dasd_sleep_on_interruptible(struct dasd_ccw_req *cqr) |
1430 | { | 1434 | { |
1431 | wait_queue_head_t wait_q; | ||
1432 | struct dasd_device *device; | 1435 | struct dasd_device *device; |
1433 | int rc; | 1436 | int rc; |
1434 | 1437 | ||
1435 | device = cqr->startdev; | 1438 | device = cqr->startdev; |
1436 | init_waitqueue_head (&wait_q); | ||
1437 | cqr->callback = dasd_wakeup_cb; | 1439 | cqr->callback = dasd_wakeup_cb; |
1438 | cqr->callback_data = (void *) &wait_q; | 1440 | cqr->callback_data = (void *) &generic_waitq; |
1439 | dasd_add_request_tail(cqr); | 1441 | dasd_add_request_tail(cqr); |
1440 | rc = wait_event_interruptible(wait_q, _wait_for_wakeup(cqr)); | 1442 | rc = wait_event_interruptible(generic_waitq, _wait_for_wakeup(cqr)); |
1441 | if (rc == -ERESTARTSYS) { | 1443 | if (rc == -ERESTARTSYS) { |
1442 | dasd_cancel_req(cqr); | 1444 | dasd_cancel_req(cqr); |
1443 | /* wait (non-interruptible) for final status */ | 1445 | /* wait (non-interruptible) for final status */ |
1444 | wait_event(wait_q, _wait_for_wakeup(cqr)); | 1446 | wait_event(generic_waitq, _wait_for_wakeup(cqr)); |
1445 | } | 1447 | } |
1446 | rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO; | 1448 | rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO; |
1447 | return rc; | 1449 | return rc; |
@@ -1465,7 +1467,6 @@ static inline int _dasd_term_running_cqr(struct dasd_device *device) | |||
1465 | 1467 | ||
1466 | int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr) | 1468 | int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr) |
1467 | { | 1469 | { |
1468 | wait_queue_head_t wait_q; | ||
1469 | struct dasd_device *device; | 1470 | struct dasd_device *device; |
1470 | int rc; | 1471 | int rc; |
1471 | 1472 | ||
@@ -1477,9 +1478,8 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr) | |||
1477 | return rc; | 1478 | return rc; |
1478 | } | 1479 | } |
1479 | 1480 | ||
1480 | init_waitqueue_head (&wait_q); | ||
1481 | cqr->callback = dasd_wakeup_cb; | 1481 | cqr->callback = dasd_wakeup_cb; |
1482 | cqr->callback_data = (void *) &wait_q; | 1482 | cqr->callback_data = (void *) &generic_waitq; |
1483 | cqr->status = DASD_CQR_QUEUED; | 1483 | cqr->status = DASD_CQR_QUEUED; |
1484 | list_add(&cqr->devlist, &device->ccw_queue); | 1484 | list_add(&cqr->devlist, &device->ccw_queue); |
1485 | 1485 | ||
@@ -1488,7 +1488,7 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr) | |||
1488 | 1488 | ||
1489 | spin_unlock_irq(get_ccwdev_lock(device->cdev)); | 1489 | spin_unlock_irq(get_ccwdev_lock(device->cdev)); |
1490 | 1490 | ||
1491 | wait_event(wait_q, _wait_for_wakeup(cqr)); | 1491 | wait_event(generic_waitq, _wait_for_wakeup(cqr)); |
1492 | 1492 | ||
1493 | /* Request status is either done or failed. */ | 1493 | /* Request status is either done or failed. */ |
1494 | rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO; | 1494 | rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO; |
@@ -2429,6 +2429,7 @@ static int __init dasd_init(void) | |||
2429 | 2429 | ||
2430 | init_waitqueue_head(&dasd_init_waitq); | 2430 | init_waitqueue_head(&dasd_init_waitq); |
2431 | init_waitqueue_head(&dasd_flush_wq); | 2431 | init_waitqueue_head(&dasd_flush_wq); |
2432 | init_waitqueue_head(&generic_waitq); | ||
2432 | 2433 | ||
2433 | /* register 'common' DASD debug area, used for all DBF_XXX calls */ | 2434 | /* register 'common' DASD debug area, used for all DBF_XXX calls */ |
2434 | dasd_debug_area = debug_register("dasd", 1, 1, 8 * sizeof(long)); | 2435 | dasd_debug_area = debug_register("dasd", 1, 1, 8 * sizeof(long)); |
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index f4fb40257348..d774e79476fe 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -86,10 +86,10 @@ static DEFINE_SPINLOCK(dasd_devmap_lock); | |||
86 | static struct list_head dasd_hashlists[256]; | 86 | static struct list_head dasd_hashlists[256]; |
87 | int dasd_max_devindex; | 87 | int dasd_max_devindex; |
88 | 88 | ||
89 | static struct dasd_devmap *dasd_add_busid(char *, int); | 89 | static struct dasd_devmap *dasd_add_busid(const char *, int); |
90 | 90 | ||
91 | static inline int | 91 | static inline int |
92 | dasd_hash_busid(char *bus_id) | 92 | dasd_hash_busid(const char *bus_id) |
93 | { | 93 | { |
94 | int hash, i; | 94 | int hash, i; |
95 | 95 | ||
@@ -394,7 +394,7 @@ dasd_parse(void) | |||
394 | * devices. | 394 | * devices. |
395 | */ | 395 | */ |
396 | static struct dasd_devmap * | 396 | static struct dasd_devmap * |
397 | dasd_add_busid(char *bus_id, int features) | 397 | dasd_add_busid(const char *bus_id, int features) |
398 | { | 398 | { |
399 | struct dasd_devmap *devmap, *new, *tmp; | 399 | struct dasd_devmap *devmap, *new, *tmp; |
400 | int hash; | 400 | int hash; |
@@ -430,7 +430,7 @@ dasd_add_busid(char *bus_id, int features) | |||
430 | * Find devmap for device with given bus_id. | 430 | * Find devmap for device with given bus_id. |
431 | */ | 431 | */ |
432 | static struct dasd_devmap * | 432 | static struct dasd_devmap * |
433 | dasd_find_busid(char *bus_id) | 433 | dasd_find_busid(const char *bus_id) |
434 | { | 434 | { |
435 | struct dasd_devmap *devmap, *tmp; | 435 | struct dasd_devmap *devmap, *tmp; |
436 | int hash; | 436 | int hash; |
@@ -452,7 +452,7 @@ dasd_find_busid(char *bus_id) | |||
452 | * Check if busid has been added to the list of dasd ranges. | 452 | * Check if busid has been added to the list of dasd ranges. |
453 | */ | 453 | */ |
454 | int | 454 | int |
455 | dasd_busid_known(char *bus_id) | 455 | dasd_busid_known(const char *bus_id) |
456 | { | 456 | { |
457 | return IS_ERR(dasd_find_busid(bus_id)) ? -ENOENT : 0; | 457 | return IS_ERR(dasd_find_busid(bus_id)) ? -ENOENT : 0; |
458 | } | 458 | } |
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index 6c624bf44617..fb2f931cf844 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h | |||
@@ -598,7 +598,7 @@ struct dasd_device *dasd_device_from_cdev_locked(struct ccw_device *); | |||
598 | struct dasd_device *dasd_device_from_devindex(int); | 598 | struct dasd_device *dasd_device_from_devindex(int); |
599 | 599 | ||
600 | int dasd_parse(void); | 600 | int dasd_parse(void); |
601 | int dasd_busid_known(char *); | 601 | int dasd_busid_known(const char *); |
602 | 602 | ||
603 | /* externals in dasd_gendisk.c */ | 603 | /* externals in dasd_gendisk.c */ |
604 | int dasd_gendisk_init(void); | 604 | int dasd_gendisk_init(void); |
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c index 0d98f1ff2edd..848ef7e8523f 100644 --- a/drivers/s390/char/raw3270.c +++ b/drivers/s390/char/raw3270.c | |||
@@ -549,7 +549,6 @@ raw3270_start_init(struct raw3270 *rp, struct raw3270_view *view, | |||
549 | struct raw3270_request *rq) | 549 | struct raw3270_request *rq) |
550 | { | 550 | { |
551 | unsigned long flags; | 551 | unsigned long flags; |
552 | wait_queue_head_t wq; | ||
553 | int rc; | 552 | int rc; |
554 | 553 | ||
555 | #ifdef CONFIG_TN3270_CONSOLE | 554 | #ifdef CONFIG_TN3270_CONSOLE |
@@ -566,20 +565,20 @@ raw3270_start_init(struct raw3270 *rp, struct raw3270_view *view, | |||
566 | return rq->rc; | 565 | return rq->rc; |
567 | } | 566 | } |
568 | #endif | 567 | #endif |
569 | init_waitqueue_head(&wq); | ||
570 | rq->callback = raw3270_wake_init; | 568 | rq->callback = raw3270_wake_init; |
571 | rq->callback_data = &wq; | 569 | rq->callback_data = &raw3270_wait_queue; |
572 | spin_lock_irqsave(get_ccwdev_lock(view->dev->cdev), flags); | 570 | spin_lock_irqsave(get_ccwdev_lock(view->dev->cdev), flags); |
573 | rc = __raw3270_start(rp, view, rq); | 571 | rc = __raw3270_start(rp, view, rq); |
574 | spin_unlock_irqrestore(get_ccwdev_lock(view->dev->cdev), flags); | 572 | spin_unlock_irqrestore(get_ccwdev_lock(view->dev->cdev), flags); |
575 | if (rc) | 573 | if (rc) |
576 | return rc; | 574 | return rc; |
577 | /* Now wait for the completion. */ | 575 | /* Now wait for the completion. */ |
578 | rc = wait_event_interruptible(wq, raw3270_request_final(rq)); | 576 | rc = wait_event_interruptible(raw3270_wait_queue, |
577 | raw3270_request_final(rq)); | ||
579 | if (rc == -ERESTARTSYS) { /* Interrupted by a signal. */ | 578 | if (rc == -ERESTARTSYS) { /* Interrupted by a signal. */ |
580 | raw3270_halt_io(view->dev, rq); | 579 | raw3270_halt_io(view->dev, rq); |
581 | /* No wait for the halt to complete. */ | 580 | /* No wait for the halt to complete. */ |
582 | wait_event(wq, raw3270_request_final(rq)); | 581 | wait_event(raw3270_wait_queue, raw3270_request_final(rq)); |
583 | return -ERESTARTSYS; | 582 | return -ERESTARTSYS; |
584 | } | 583 | } |
585 | return rq->rc; | 584 | return rq->rc; |
diff --git a/drivers/s390/char/sclp_config.c b/drivers/s390/char/sclp_config.c index 9e784d5f7f57..ad05a87bc480 100644 --- a/drivers/s390/char/sclp_config.c +++ b/drivers/s390/char/sclp_config.c | |||
@@ -40,7 +40,7 @@ static void sclp_cpu_capability_notify(struct work_struct *work) | |||
40 | put_online_cpus(); | 40 | put_online_cpus(); |
41 | } | 41 | } |
42 | 42 | ||
43 | static void sclp_cpu_change_notify(struct work_struct *work) | 43 | static void __ref sclp_cpu_change_notify(struct work_struct *work) |
44 | { | 44 | { |
45 | smp_rescan_cpus(); | 45 | smp_rescan_cpus(); |
46 | } | 46 | } |
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c index 35707c04e613..62576af36f47 100644 --- a/drivers/s390/char/sclp_vt220.c +++ b/drivers/s390/char/sclp_vt220.c | |||
@@ -71,9 +71,6 @@ static struct list_head sclp_vt220_outqueue; | |||
71 | /* Number of requests in outqueue */ | 71 | /* Number of requests in outqueue */ |
72 | static int sclp_vt220_outqueue_count; | 72 | static int sclp_vt220_outqueue_count; |
73 | 73 | ||
74 | /* Wait queue used to delay write requests while we've run out of buffers */ | ||
75 | static wait_queue_head_t sclp_vt220_waitq; | ||
76 | |||
77 | /* Timer used for delaying write requests to merge subsequent messages into | 74 | /* Timer used for delaying write requests to merge subsequent messages into |
78 | * a single buffer */ | 75 | * a single buffer */ |
79 | static struct timer_list sclp_vt220_timer; | 76 | static struct timer_list sclp_vt220_timer; |
@@ -133,7 +130,6 @@ sclp_vt220_process_queue(struct sclp_vt220_request *request) | |||
133 | } while (request && __sclp_vt220_emit(request)); | 130 | } while (request && __sclp_vt220_emit(request)); |
134 | if (request == NULL && sclp_vt220_flush_later) | 131 | if (request == NULL && sclp_vt220_flush_later) |
135 | sclp_vt220_emit_current(); | 132 | sclp_vt220_emit_current(); |
136 | wake_up(&sclp_vt220_waitq); | ||
137 | /* Check if the tty needs a wake up call */ | 133 | /* Check if the tty needs a wake up call */ |
138 | if (sclp_vt220_tty != NULL) { | 134 | if (sclp_vt220_tty != NULL) { |
139 | tty_wakeup(sclp_vt220_tty); | 135 | tty_wakeup(sclp_vt220_tty); |
@@ -383,7 +379,7 @@ sclp_vt220_timeout(unsigned long data) | |||
383 | */ | 379 | */ |
384 | static int | 380 | static int |
385 | __sclp_vt220_write(const unsigned char *buf, int count, int do_schedule, | 381 | __sclp_vt220_write(const unsigned char *buf, int count, int do_schedule, |
386 | int convertlf, int may_schedule) | 382 | int convertlf, int may_fail) |
387 | { | 383 | { |
388 | unsigned long flags; | 384 | unsigned long flags; |
389 | void *page; | 385 | void *page; |
@@ -395,15 +391,14 @@ __sclp_vt220_write(const unsigned char *buf, int count, int do_schedule, | |||
395 | overall_written = 0; | 391 | overall_written = 0; |
396 | spin_lock_irqsave(&sclp_vt220_lock, flags); | 392 | spin_lock_irqsave(&sclp_vt220_lock, flags); |
397 | do { | 393 | do { |
398 | /* Create a sclp output buffer if none exists yet */ | 394 | /* Create an sclp output buffer if none exists yet */ |
399 | if (sclp_vt220_current_request == NULL) { | 395 | if (sclp_vt220_current_request == NULL) { |
400 | while (list_empty(&sclp_vt220_empty)) { | 396 | while (list_empty(&sclp_vt220_empty)) { |
401 | spin_unlock_irqrestore(&sclp_vt220_lock, flags); | 397 | spin_unlock_irqrestore(&sclp_vt220_lock, flags); |
402 | if (in_interrupt() || !may_schedule) | 398 | if (may_fail) |
403 | sclp_sync_wait(); | 399 | goto out; |
404 | else | 400 | else |
405 | wait_event(sclp_vt220_waitq, | 401 | sclp_sync_wait(); |
406 | !list_empty(&sclp_vt220_empty)); | ||
407 | spin_lock_irqsave(&sclp_vt220_lock, flags); | 402 | spin_lock_irqsave(&sclp_vt220_lock, flags); |
408 | } | 403 | } |
409 | page = (void *) sclp_vt220_empty.next; | 404 | page = (void *) sclp_vt220_empty.next; |
@@ -437,6 +432,7 @@ __sclp_vt220_write(const unsigned char *buf, int count, int do_schedule, | |||
437 | add_timer(&sclp_vt220_timer); | 432 | add_timer(&sclp_vt220_timer); |
438 | } | 433 | } |
439 | spin_unlock_irqrestore(&sclp_vt220_lock, flags); | 434 | spin_unlock_irqrestore(&sclp_vt220_lock, flags); |
435 | out: | ||
440 | return overall_written; | 436 | return overall_written; |
441 | } | 437 | } |
442 | 438 | ||
@@ -520,19 +516,11 @@ sclp_vt220_close(struct tty_struct *tty, struct file *filp) | |||
520 | * character to the tty device. If the kernel uses this routine, | 516 | * character to the tty device. If the kernel uses this routine, |
521 | * it must call the flush_chars() routine (if defined) when it is | 517 | * it must call the flush_chars() routine (if defined) when it is |
522 | * done stuffing characters into the driver. | 518 | * done stuffing characters into the driver. |
523 | * | ||
524 | * NOTE: include/linux/tty_driver.h specifies that a character should be | ||
525 | * ignored if there is no room in the queue. This driver implements a different | ||
526 | * semantic in that it will block when there is no more room left. | ||
527 | * | ||
528 | * FIXME: putchar can currently be called from BH and other non blocking | ||
529 | * handlers so this semantic isn't a good idea. | ||
530 | */ | 519 | */ |
531 | static int | 520 | static int |
532 | sclp_vt220_put_char(struct tty_struct *tty, unsigned char ch) | 521 | sclp_vt220_put_char(struct tty_struct *tty, unsigned char ch) |
533 | { | 522 | { |
534 | __sclp_vt220_write(&ch, 1, 0, 0, 1); | 523 | return __sclp_vt220_write(&ch, 1, 0, 0, 1); |
535 | return 1; | ||
536 | } | 524 | } |
537 | 525 | ||
538 | /* | 526 | /* |
@@ -653,7 +641,6 @@ static int __init __sclp_vt220_init(void) | |||
653 | spin_lock_init(&sclp_vt220_lock); | 641 | spin_lock_init(&sclp_vt220_lock); |
654 | INIT_LIST_HEAD(&sclp_vt220_empty); | 642 | INIT_LIST_HEAD(&sclp_vt220_empty); |
655 | INIT_LIST_HEAD(&sclp_vt220_outqueue); | 643 | INIT_LIST_HEAD(&sclp_vt220_outqueue); |
656 | init_waitqueue_head(&sclp_vt220_waitq); | ||
657 | init_timer(&sclp_vt220_timer); | 644 | init_timer(&sclp_vt220_timer); |
658 | sclp_vt220_current_request = NULL; | 645 | sclp_vt220_current_request = NULL; |
659 | sclp_vt220_buffered_chars = 0; | 646 | sclp_vt220_buffered_chars = 0; |
diff --git a/drivers/s390/char/tape.h b/drivers/s390/char/tape.h index dddf8d62c153..d0d565a05dfe 100644 --- a/drivers/s390/char/tape.h +++ b/drivers/s390/char/tape.h | |||
@@ -231,6 +231,9 @@ struct tape_device { | |||
231 | /* Request queue. */ | 231 | /* Request queue. */ |
232 | struct list_head req_queue; | 232 | struct list_head req_queue; |
233 | 233 | ||
234 | /* Request wait queue. */ | ||
235 | wait_queue_head_t wait_queue; | ||
236 | |||
234 | /* Each tape device has (currently) two minor numbers. */ | 237 | /* Each tape device has (currently) two minor numbers. */ |
235 | int first_minor; | 238 | int first_minor; |
236 | 239 | ||
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c index ddc4a114e7f4..95da72bc17e8 100644 --- a/drivers/s390/char/tape_block.c +++ b/drivers/s390/char/tape_block.c | |||
@@ -179,11 +179,11 @@ tapeblock_requeue(struct work_struct *work) { | |||
179 | tapeblock_end_request(req, -EIO); | 179 | tapeblock_end_request(req, -EIO); |
180 | continue; | 180 | continue; |
181 | } | 181 | } |
182 | blkdev_dequeue_request(req); | ||
183 | nr_queued++; | ||
182 | spin_unlock_irq(&device->blk_data.request_queue_lock); | 184 | spin_unlock_irq(&device->blk_data.request_queue_lock); |
183 | rc = tapeblock_start_request(device, req); | 185 | rc = tapeblock_start_request(device, req); |
184 | spin_lock_irq(&device->blk_data.request_queue_lock); | 186 | spin_lock_irq(&device->blk_data.request_queue_lock); |
185 | blkdev_dequeue_request(req); | ||
186 | nr_queued++; | ||
187 | } | 187 | } |
188 | spin_unlock_irq(&device->blk_data.request_queue_lock); | 188 | spin_unlock_irq(&device->blk_data.request_queue_lock); |
189 | atomic_set(&device->blk_data.requeue_scheduled, 0); | 189 | atomic_set(&device->blk_data.requeue_scheduled, 0); |
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c index 7ad8cf157641..c20e3c548343 100644 --- a/drivers/s390/char/tape_core.c +++ b/drivers/s390/char/tape_core.c | |||
@@ -76,32 +76,9 @@ const char *tape_op_verbose[TO_SIZE] = | |||
76 | [TO_KEKL_QUERY] = "KLQ",[TO_RDC] = "RDC", | 76 | [TO_KEKL_QUERY] = "KLQ",[TO_RDC] = "RDC", |
77 | }; | 77 | }; |
78 | 78 | ||
79 | static int | 79 | static int devid_to_int(struct ccw_dev_id *dev_id) |
80 | busid_to_int(char *bus_id) | ||
81 | { | 80 | { |
82 | int dec; | 81 | return dev_id->devno + (dev_id->ssid << 16); |
83 | int d; | ||
84 | char * s; | ||
85 | |||
86 | for(s = bus_id, d = 0; *s != '\0' && *s != '.'; s++) | ||
87 | d = (d * 10) + (*s - '0'); | ||
88 | dec = d; | ||
89 | for(s++, d = 0; *s != '\0' && *s != '.'; s++) | ||
90 | d = (d * 10) + (*s - '0'); | ||
91 | dec = (dec << 8) + d; | ||
92 | |||
93 | for(s++; *s != '\0'; s++) { | ||
94 | if (*s >= '0' && *s <= '9') { | ||
95 | d = *s - '0'; | ||
96 | } else if (*s >= 'a' && *s <= 'f') { | ||
97 | d = *s - 'a' + 10; | ||
98 | } else { | ||
99 | d = *s - 'A' + 10; | ||
100 | } | ||
101 | dec = (dec << 4) + d; | ||
102 | } | ||
103 | |||
104 | return dec; | ||
105 | } | 82 | } |
106 | 83 | ||
107 | /* | 84 | /* |
@@ -472,6 +449,7 @@ tape_alloc_device(void) | |||
472 | INIT_LIST_HEAD(&device->req_queue); | 449 | INIT_LIST_HEAD(&device->req_queue); |
473 | INIT_LIST_HEAD(&device->node); | 450 | INIT_LIST_HEAD(&device->node); |
474 | init_waitqueue_head(&device->state_change_wq); | 451 | init_waitqueue_head(&device->state_change_wq); |
452 | init_waitqueue_head(&device->wait_queue); | ||
475 | device->tape_state = TS_INIT; | 453 | device->tape_state = TS_INIT; |
476 | device->medium_state = MS_UNKNOWN; | 454 | device->medium_state = MS_UNKNOWN; |
477 | *device->modeset_byte = 0; | 455 | *device->modeset_byte = 0; |
@@ -551,6 +529,7 @@ tape_generic_probe(struct ccw_device *cdev) | |||
551 | { | 529 | { |
552 | struct tape_device *device; | 530 | struct tape_device *device; |
553 | int ret; | 531 | int ret; |
532 | struct ccw_dev_id dev_id; | ||
554 | 533 | ||
555 | device = tape_alloc_device(); | 534 | device = tape_alloc_device(); |
556 | if (IS_ERR(device)) | 535 | if (IS_ERR(device)) |
@@ -565,7 +544,8 @@ tape_generic_probe(struct ccw_device *cdev) | |||
565 | cdev->dev.driver_data = device; | 544 | cdev->dev.driver_data = device; |
566 | cdev->handler = __tape_do_irq; | 545 | cdev->handler = __tape_do_irq; |
567 | device->cdev = cdev; | 546 | device->cdev = cdev; |
568 | device->cdev_id = busid_to_int(cdev->dev.bus_id); | 547 | ccw_device_get_id(cdev, &dev_id); |
548 | device->cdev_id = devid_to_int(&dev_id); | ||
569 | PRINT_INFO("tape device %s found\n", cdev->dev.bus_id); | 549 | PRINT_INFO("tape device %s found\n", cdev->dev.bus_id); |
570 | return ret; | 550 | return ret; |
571 | } | 551 | } |
@@ -975,21 +955,19 @@ __tape_wake_up(struct tape_request *request, void *data) | |||
975 | int | 955 | int |
976 | tape_do_io(struct tape_device *device, struct tape_request *request) | 956 | tape_do_io(struct tape_device *device, struct tape_request *request) |
977 | { | 957 | { |
978 | wait_queue_head_t wq; | ||
979 | int rc; | 958 | int rc; |
980 | 959 | ||
981 | init_waitqueue_head(&wq); | ||
982 | spin_lock_irq(get_ccwdev_lock(device->cdev)); | 960 | spin_lock_irq(get_ccwdev_lock(device->cdev)); |
983 | /* Setup callback */ | 961 | /* Setup callback */ |
984 | request->callback = __tape_wake_up; | 962 | request->callback = __tape_wake_up; |
985 | request->callback_data = &wq; | 963 | request->callback_data = &device->wait_queue; |
986 | /* Add request to request queue and try to start it. */ | 964 | /* Add request to request queue and try to start it. */ |
987 | rc = __tape_start_request(device, request); | 965 | rc = __tape_start_request(device, request); |
988 | spin_unlock_irq(get_ccwdev_lock(device->cdev)); | 966 | spin_unlock_irq(get_ccwdev_lock(device->cdev)); |
989 | if (rc) | 967 | if (rc) |
990 | return rc; | 968 | return rc; |
991 | /* Request added to the queue. Wait for its completion. */ | 969 | /* Request added to the queue. Wait for its completion. */ |
992 | wait_event(wq, (request->callback == NULL)); | 970 | wait_event(device->wait_queue, (request->callback == NULL)); |
993 | /* Get rc from request */ | 971 | /* Get rc from request */ |
994 | return request->rc; | 972 | return request->rc; |
995 | } | 973 | } |
@@ -1010,20 +988,19 @@ int | |||
1010 | tape_do_io_interruptible(struct tape_device *device, | 988 | tape_do_io_interruptible(struct tape_device *device, |
1011 | struct tape_request *request) | 989 | struct tape_request *request) |
1012 | { | 990 | { |
1013 | wait_queue_head_t wq; | ||
1014 | int rc; | 991 | int rc; |
1015 | 992 | ||
1016 | init_waitqueue_head(&wq); | ||
1017 | spin_lock_irq(get_ccwdev_lock(device->cdev)); | 993 | spin_lock_irq(get_ccwdev_lock(device->cdev)); |
1018 | /* Setup callback */ | 994 | /* Setup callback */ |
1019 | request->callback = __tape_wake_up_interruptible; | 995 | request->callback = __tape_wake_up_interruptible; |
1020 | request->callback_data = &wq; | 996 | request->callback_data = &device->wait_queue; |
1021 | rc = __tape_start_request(device, request); | 997 | rc = __tape_start_request(device, request); |
1022 | spin_unlock_irq(get_ccwdev_lock(device->cdev)); | 998 | spin_unlock_irq(get_ccwdev_lock(device->cdev)); |
1023 | if (rc) | 999 | if (rc) |
1024 | return rc; | 1000 | return rc; |
1025 | /* Request added to the queue. Wait for its completion. */ | 1001 | /* Request added to the queue. Wait for its completion. */ |
1026 | rc = wait_event_interruptible(wq, (request->callback == NULL)); | 1002 | rc = wait_event_interruptible(device->wait_queue, |
1003 | (request->callback == NULL)); | ||
1027 | if (rc != -ERESTARTSYS) | 1004 | if (rc != -ERESTARTSYS) |
1028 | /* Request finished normally. */ | 1005 | /* Request finished normally. */ |
1029 | return request->rc; | 1006 | return request->rc; |
@@ -1036,7 +1013,7 @@ tape_do_io_interruptible(struct tape_device *device, | |||
1036 | /* Wait for the interrupt that acknowledges the halt. */ | 1013 | /* Wait for the interrupt that acknowledges the halt. */ |
1037 | do { | 1014 | do { |
1038 | rc = wait_event_interruptible( | 1015 | rc = wait_event_interruptible( |
1039 | wq, | 1016 | device->wait_queue, |
1040 | (request->callback == NULL) | 1017 | (request->callback == NULL) |
1041 | ); | 1018 | ); |
1042 | } while (rc == -ERESTARTSYS); | 1019 | } while (rc == -ERESTARTSYS); |
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c index d364e0bfae12..2c2428cc05d8 100644 --- a/drivers/s390/char/vmlogrdr.c +++ b/drivers/s390/char/vmlogrdr.c | |||
@@ -762,10 +762,10 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv) | |||
762 | device_unregister(dev); | 762 | device_unregister(dev); |
763 | return ret; | 763 | return ret; |
764 | } | 764 | } |
765 | priv->class_device = device_create(vmlogrdr_class, dev, | 765 | priv->class_device = device_create_drvdata(vmlogrdr_class, dev, |
766 | MKDEV(vmlogrdr_major, | 766 | MKDEV(vmlogrdr_major, |
767 | priv->minor_num), | 767 | priv->minor_num), |
768 | "%s", dev->bus_id); | 768 | priv, "%s", dev->bus_id); |
769 | if (IS_ERR(priv->class_device)) { | 769 | if (IS_ERR(priv->class_device)) { |
770 | ret = PTR_ERR(priv->class_device); | 770 | ret = PTR_ERR(priv->class_device); |
771 | priv->class_device=NULL; | 771 | priv->class_device=NULL; |
@@ -773,7 +773,6 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv) | |||
773 | device_unregister(dev); | 773 | device_unregister(dev); |
774 | return ret; | 774 | return ret; |
775 | } | 775 | } |
776 | dev->driver_data = priv; | ||
777 | priv->device = dev; | 776 | priv->device = dev; |
778 | return 0; | 777 | return 0; |
779 | } | 778 | } |
@@ -858,7 +857,7 @@ static int __init vmlogrdr_init(void) | |||
858 | for (i=0; i < MAXMINOR; ++i ) { | 857 | for (i=0; i < MAXMINOR; ++i ) { |
859 | sys_ser[i].buffer = (char *) get_zeroed_page(GFP_KERNEL); | 858 | sys_ser[i].buffer = (char *) get_zeroed_page(GFP_KERNEL); |
860 | if (!sys_ser[i].buffer) { | 859 | if (!sys_ser[i].buffer) { |
861 | rc = ENOMEM; | 860 | rc = -ENOMEM; |
862 | break; | 861 | break; |
863 | } | 862 | } |
864 | sys_ser[i].current_position = sys_ser[i].buffer; | 863 | sys_ser[i].current_position = sys_ser[i].buffer; |
diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c index 9c21b8f43f9b..a4a5f2efea48 100644 --- a/drivers/s390/cio/blacklist.c +++ b/drivers/s390/cio/blacklist.c | |||
@@ -19,7 +19,6 @@ | |||
19 | 19 | ||
20 | #include <asm/cio.h> | 20 | #include <asm/cio.h> |
21 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
22 | #include <asm/cio.h> | ||
23 | 22 | ||
24 | #include "blacklist.h" | 23 | #include "blacklist.h" |
25 | #include "cio.h" | 24 | #include "cio.h" |
diff --git a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c index ba559053402e..5cf7be008e98 100644 --- a/drivers/s390/cio/device_pgid.c +++ b/drivers/s390/cio/device_pgid.c | |||
@@ -243,16 +243,10 @@ __ccw_device_do_pgid(struct ccw_device *cdev, __u8 func) | |||
243 | /* Setup sense path group id channel program. */ | 243 | /* Setup sense path group id channel program. */ |
244 | cdev->private->pgid[0].inf.fc = func; | 244 | cdev->private->pgid[0].inf.fc = func; |
245 | ccw = cdev->private->iccws; | 245 | ccw = cdev->private->iccws; |
246 | if (!cdev->private->flags.pgid_single) { | 246 | if (cdev->private->flags.pgid_single) |
247 | cdev->private->pgid[0].inf.fc |= SPID_FUNC_MULTI_PATH; | ||
248 | ccw->cmd_code = CCW_CMD_SUSPEND_RECONN; | ||
249 | ccw->cda = 0; | ||
250 | ccw->count = 0; | ||
251 | ccw->flags = CCW_FLAG_SLI | CCW_FLAG_CC; | ||
252 | ccw++; | ||
253 | } else | ||
254 | cdev->private->pgid[0].inf.fc |= SPID_FUNC_SINGLE_PATH; | 247 | cdev->private->pgid[0].inf.fc |= SPID_FUNC_SINGLE_PATH; |
255 | 248 | else | |
249 | cdev->private->pgid[0].inf.fc |= SPID_FUNC_MULTI_PATH; | ||
256 | ccw->cmd_code = CCW_CMD_SET_PGID; | 250 | ccw->cmd_code = CCW_CMD_SET_PGID; |
257 | ccw->cda = (__u32) __pa (&cdev->private->pgid[0]); | 251 | ccw->cda = (__u32) __pa (&cdev->private->pgid[0]); |
258 | ccw->count = sizeof (struct pgid); | 252 | ccw->count = sizeof (struct pgid); |
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c index 47a7e6200b26..5ab34340919b 100644 --- a/drivers/s390/kvm/kvm_virtio.c +++ b/drivers/s390/kvm/kvm_virtio.c | |||
@@ -31,11 +31,6 @@ | |||
31 | */ | 31 | */ |
32 | static void *kvm_devices; | 32 | static void *kvm_devices; |
33 | 33 | ||
34 | /* | ||
35 | * Unique numbering for kvm devices. | ||
36 | */ | ||
37 | static unsigned int dev_index; | ||
38 | |||
39 | struct kvm_device { | 34 | struct kvm_device { |
40 | struct virtio_device vdev; | 35 | struct virtio_device vdev; |
41 | struct kvm_device_desc *desc; | 36 | struct kvm_device_desc *desc; |
@@ -78,27 +73,32 @@ static unsigned desc_size(const struct kvm_device_desc *desc) | |||
78 | + desc->config_len; | 73 | + desc->config_len; |
79 | } | 74 | } |
80 | 75 | ||
81 | /* | 76 | /* This gets the device's feature bits. */ |
82 | * This tests (and acknowleges) a feature bit. | 77 | static u32 kvm_get_features(struct virtio_device *vdev) |
83 | */ | ||
84 | static bool kvm_feature(struct virtio_device *vdev, unsigned fbit) | ||
85 | { | 78 | { |
79 | unsigned int i; | ||
80 | u32 features = 0; | ||
86 | struct kvm_device_desc *desc = to_kvmdev(vdev)->desc; | 81 | struct kvm_device_desc *desc = to_kvmdev(vdev)->desc; |
87 | u8 *features; | 82 | u8 *in_features = kvm_vq_features(desc); |
88 | 83 | ||
89 | if (fbit / 8 > desc->feature_len) | 84 | for (i = 0; i < min(desc->feature_len * 8, 32); i++) |
90 | return false; | 85 | if (in_features[i / 8] & (1 << (i % 8))) |
86 | features |= (1 << i); | ||
87 | return features; | ||
88 | } | ||
91 | 89 | ||
92 | features = kvm_vq_features(desc); | 90 | static void kvm_set_features(struct virtio_device *vdev, u32 features) |
93 | if (!(features[fbit / 8] & (1 << (fbit % 8)))) | 91 | { |
94 | return false; | 92 | unsigned int i; |
93 | struct kvm_device_desc *desc = to_kvmdev(vdev)->desc; | ||
94 | /* Second half of bitmap is features we accept. */ | ||
95 | u8 *out_features = kvm_vq_features(desc) + desc->feature_len; | ||
95 | 96 | ||
96 | /* | 97 | memset(out_features, 0, desc->feature_len); |
97 | * We set the matching bit in the other half of the bitmap to tell the | 98 | for (i = 0; i < min(desc->feature_len * 8, 32); i++) { |
98 | * Host we want to use this feature. | 99 | if (features & (1 << i)) |
99 | */ | 100 | out_features[i / 8] |= (1 << (i % 8)); |
100 | features[desc->feature_len + fbit / 8] |= (1 << (fbit % 8)); | 101 | } |
101 | return true; | ||
102 | } | 102 | } |
103 | 103 | ||
104 | /* | 104 | /* |
@@ -221,7 +221,8 @@ static void kvm_del_vq(struct virtqueue *vq) | |||
221 | * The config ops structure as defined by virtio config | 221 | * The config ops structure as defined by virtio config |
222 | */ | 222 | */ |
223 | static struct virtio_config_ops kvm_vq_configspace_ops = { | 223 | static struct virtio_config_ops kvm_vq_configspace_ops = { |
224 | .feature = kvm_feature, | 224 | .get_features = kvm_get_features, |
225 | .set_features = kvm_set_features, | ||
225 | .get = kvm_get, | 226 | .get = kvm_get, |
226 | .set = kvm_set, | 227 | .set = kvm_set, |
227 | .get_status = kvm_get_status, | 228 | .get_status = kvm_get_status, |
@@ -244,26 +245,25 @@ static struct device kvm_root = { | |||
244 | * adds a new device and register it with virtio | 245 | * adds a new device and register it with virtio |
245 | * appropriate drivers are loaded by the device model | 246 | * appropriate drivers are loaded by the device model |
246 | */ | 247 | */ |
247 | static void add_kvm_device(struct kvm_device_desc *d) | 248 | static void add_kvm_device(struct kvm_device_desc *d, unsigned int offset) |
248 | { | 249 | { |
249 | struct kvm_device *kdev; | 250 | struct kvm_device *kdev; |
250 | 251 | ||
251 | kdev = kzalloc(sizeof(*kdev), GFP_KERNEL); | 252 | kdev = kzalloc(sizeof(*kdev), GFP_KERNEL); |
252 | if (!kdev) { | 253 | if (!kdev) { |
253 | printk(KERN_EMERG "Cannot allocate kvm dev %u\n", | 254 | printk(KERN_EMERG "Cannot allocate kvm dev %u type %u\n", |
254 | dev_index++); | 255 | offset, d->type); |
255 | return; | 256 | return; |
256 | } | 257 | } |
257 | 258 | ||
258 | kdev->vdev.dev.parent = &kvm_root; | 259 | kdev->vdev.dev.parent = &kvm_root; |
259 | kdev->vdev.index = dev_index++; | ||
260 | kdev->vdev.id.device = d->type; | 260 | kdev->vdev.id.device = d->type; |
261 | kdev->vdev.config = &kvm_vq_configspace_ops; | 261 | kdev->vdev.config = &kvm_vq_configspace_ops; |
262 | kdev->desc = d; | 262 | kdev->desc = d; |
263 | 263 | ||
264 | if (register_virtio_device(&kdev->vdev) != 0) { | 264 | if (register_virtio_device(&kdev->vdev) != 0) { |
265 | printk(KERN_ERR "Failed to register kvm device %u\n", | 265 | printk(KERN_ERR "Failed to register kvm device %u type %u\n", |
266 | kdev->vdev.index); | 266 | offset, d->type); |
267 | kfree(kdev); | 267 | kfree(kdev); |
268 | } | 268 | } |
269 | } | 269 | } |
@@ -283,7 +283,7 @@ static void scan_devices(void) | |||
283 | if (d->type == 0) | 283 | if (d->type == 0) |
284 | break; | 284 | break; |
285 | 285 | ||
286 | add_kvm_device(d); | 286 | add_kvm_device(d, i); |
287 | } | 287 | } |
288 | } | 288 | } |
289 | 289 | ||
diff --git a/drivers/sbus/char/bpp.c b/drivers/sbus/char/bpp.c index b87037ec9805..03c966059471 100644 --- a/drivers/sbus/char/bpp.c +++ b/drivers/sbus/char/bpp.c | |||
@@ -869,7 +869,7 @@ static void probeLptPort(unsigned idx) | |||
869 | instances[idx].mode = COMPATIBILITY; | 869 | instances[idx].mode = COMPATIBILITY; |
870 | instances[idx].run_length = 0; | 870 | instances[idx].run_length = 0; |
871 | instances[idx].run_flag = 0; | 871 | instances[idx].run_flag = 0; |
872 | if (!request_region(lpAddr,3, dev_name)) return; | 872 | if (!request_region(lpAddr,3, bpp_dev_name)) return; |
873 | 873 | ||
874 | /* | 874 | /* |
875 | * First, make sure the instance exists. Do this by writing to | 875 | * First, make sure the instance exists. Do this by writing to |
@@ -1021,7 +1021,7 @@ static int __init bpp_init(void) | |||
1021 | if (rc == 0) | 1021 | if (rc == 0) |
1022 | return -ENODEV; | 1022 | return -ENODEV; |
1023 | 1023 | ||
1024 | rc = register_chrdev(BPP_MAJOR, dev_name, &bpp_fops); | 1024 | rc = register_chrdev(BPP_MAJOR, bpp_dev_name, &bpp_fops); |
1025 | if (rc < 0) | 1025 | if (rc < 0) |
1026 | return rc; | 1026 | return rc; |
1027 | 1027 | ||
@@ -1037,7 +1037,7 @@ static void __exit bpp_cleanup(void) | |||
1037 | { | 1037 | { |
1038 | unsigned idx; | 1038 | unsigned idx; |
1039 | 1039 | ||
1040 | unregister_chrdev(BPP_MAJOR, dev_name); | 1040 | unregister_chrdev(BPP_MAJOR, bpp_dev_name); |
1041 | 1041 | ||
1042 | for (idx = 0; idx < BPP_NO; idx++) { | 1042 | for (idx = 0; idx < BPP_NO; idx++) { |
1043 | if (instances[idx].present) | 1043 | if (instances[idx].present) |
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index b31faeccb9cd..867f6fd5c2c0 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c | |||
@@ -1278,7 +1278,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance) | |||
1278 | error = 0; | 1278 | error = 0; |
1279 | /* Check for command packet errors */ | 1279 | /* Check for command packet errors */ |
1280 | if (full_command_packet->command.newcommand.status != 0) { | 1280 | if (full_command_packet->command.newcommand.status != 0) { |
1281 | if (tw_dev->srb[request_id] != 0) { | 1281 | if (tw_dev->srb[request_id] != NULL) { |
1282 | error = twa_fill_sense(tw_dev, request_id, 1, 1); | 1282 | error = twa_fill_sense(tw_dev, request_id, 1, 1); |
1283 | } else { | 1283 | } else { |
1284 | /* Skip ioctl error prints */ | 1284 | /* Skip ioctl error prints */ |
@@ -1290,7 +1290,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance) | |||
1290 | 1290 | ||
1291 | /* Check for correct state */ | 1291 | /* Check for correct state */ |
1292 | if (tw_dev->state[request_id] != TW_S_POSTED) { | 1292 | if (tw_dev->state[request_id] != TW_S_POSTED) { |
1293 | if (tw_dev->srb[request_id] != 0) { | 1293 | if (tw_dev->srb[request_id] != NULL) { |
1294 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1a, "Received a request id that wasn't posted"); | 1294 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1a, "Received a request id that wasn't posted"); |
1295 | TW_CLEAR_ALL_INTERRUPTS(tw_dev); | 1295 | TW_CLEAR_ALL_INTERRUPTS(tw_dev); |
1296 | goto twa_interrupt_bail; | 1296 | goto twa_interrupt_bail; |
@@ -1298,7 +1298,7 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance) | |||
1298 | } | 1298 | } |
1299 | 1299 | ||
1300 | /* Check for internal command completion */ | 1300 | /* Check for internal command completion */ |
1301 | if (tw_dev->srb[request_id] == 0) { | 1301 | if (tw_dev->srb[request_id] == NULL) { |
1302 | if (request_id != tw_dev->chrdev_request_id) { | 1302 | if (request_id != tw_dev->chrdev_request_id) { |
1303 | if (twa_aen_complete(tw_dev, request_id)) | 1303 | if (twa_aen_complete(tw_dev, request_id)) |
1304 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1b, "Error completing AEN during attention interrupt"); | 1304 | TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1b, "Error completing AEN during attention interrupt"); |
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index 1dca1775f4b1..0899cb61e3dd 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c | |||
@@ -3582,7 +3582,7 @@ static int checksetup(struct aha152x_setup *setup) | |||
3582 | if (i == ARRAY_SIZE(ports)) | 3582 | if (i == ARRAY_SIZE(ports)) |
3583 | return 0; | 3583 | return 0; |
3584 | 3584 | ||
3585 | if ( request_region(setup->io_port, IO_RANGE, "aha152x")==0 ) { | 3585 | if (!request_region(setup->io_port, IO_RANGE, "aha152x")) { |
3586 | printk(KERN_ERR "aha152x: io port 0x%x busy.\n", setup->io_port); | 3586 | printk(KERN_ERR "aha152x: io port 0x%x busy.\n", setup->io_port); |
3587 | return 0; | 3587 | return 0; |
3588 | } | 3588 | } |
@@ -3842,7 +3842,7 @@ static int __init aha152x_init(void) | |||
3842 | if ((setup_count == 1) && (setup[0].io_port == ports[i])) | 3842 | if ((setup_count == 1) && (setup[0].io_port == ports[i])) |
3843 | continue; | 3843 | continue; |
3844 | 3844 | ||
3845 | if ( request_region(ports[i], IO_RANGE, "aha152x")==0 ) { | 3845 | if (!request_region(ports[i], IO_RANGE, "aha152x")) { |
3846 | printk(KERN_ERR "aha152x: io port 0x%x busy.\n", ports[i]); | 3846 | printk(KERN_ERR "aha152x: io port 0x%x busy.\n", ports[i]); |
3847 | continue; | 3847 | continue; |
3848 | } | 3848 | } |
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index db6de5e6afb3..7d311541c76c 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c | |||
@@ -747,7 +747,7 @@ static void send_s870(struct atp_unit *dev,unsigned char c) | |||
747 | dev->quhd[c] = 0; | 747 | dev->quhd[c] = 0; |
748 | } | 748 | } |
749 | workreq = dev->quereq[c][dev->quhd[c]]; | 749 | workreq = dev->quereq[c][dev->quhd[c]]; |
750 | if (dev->id[c][scmd_id(workreq)].curr_req == 0) { | 750 | if (dev->id[c][scmd_id(workreq)].curr_req == NULL) { |
751 | dev->id[c][scmd_id(workreq)].curr_req = workreq; | 751 | dev->id[c][scmd_id(workreq)].curr_req = workreq; |
752 | dev->last_cmd[c] = scmd_id(workreq); | 752 | dev->last_cmd[c] = scmd_id(workreq); |
753 | goto cmd_subp; | 753 | goto cmd_subp; |
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 75c84d7b9ce8..c4b938bc30d3 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c | |||
@@ -910,9 +910,9 @@ static int ch_probe(struct device *dev) | |||
910 | ch->minor = minor; | 910 | ch->minor = minor; |
911 | sprintf(ch->name,"ch%d",ch->minor); | 911 | sprintf(ch->name,"ch%d",ch->minor); |
912 | 912 | ||
913 | class_dev = device_create(ch_sysfs_class, dev, | 913 | class_dev = device_create_drvdata(ch_sysfs_class, dev, |
914 | MKDEV(SCSI_CHANGER_MAJOR,ch->minor), | 914 | MKDEV(SCSI_CHANGER_MAJOR, ch->minor), |
915 | "s%s", ch->name); | 915 | ch, "s%s", ch->name); |
916 | if (IS_ERR(class_dev)) { | 916 | if (IS_ERR(class_dev)) { |
917 | printk(KERN_WARNING "ch%d: device_create failed\n", | 917 | printk(KERN_WARNING "ch%d: device_create failed\n", |
918 | ch->minor); | 918 | ch->minor); |
@@ -926,7 +926,6 @@ static int ch_probe(struct device *dev) | |||
926 | if (init) | 926 | if (init) |
927 | ch_init_elem(ch); | 927 | ch_init_elem(ch); |
928 | 928 | ||
929 | dev_set_drvdata(dev, ch); | ||
930 | sdev_printk(KERN_INFO, sd, "Attached scsi changer %s\n", ch->name); | 929 | sdev_printk(KERN_INFO, sd, "Attached scsi changer %s\n", ch->name); |
931 | 930 | ||
932 | return 0; | 931 | return 0; |
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c index aaa48e0c8ed0..da876d3924be 100644 --- a/drivers/scsi/hptiop.c +++ b/drivers/scsi/hptiop.c | |||
@@ -444,7 +444,7 @@ static void __iomem *hptiop_map_pci_bar(struct hptiop_hba *hba, int index) | |||
444 | if (!(pci_resource_flags(pcidev, index) & IORESOURCE_MEM)) { | 444 | if (!(pci_resource_flags(pcidev, index) & IORESOURCE_MEM)) { |
445 | printk(KERN_ERR "scsi%d: pci resource invalid\n", | 445 | printk(KERN_ERR "scsi%d: pci resource invalid\n", |
446 | hba->host->host_no); | 446 | hba->host->host_no); |
447 | return 0; | 447 | return NULL; |
448 | } | 448 | } |
449 | 449 | ||
450 | mem_base_phy = pci_resource_start(pcidev, index); | 450 | mem_base_phy = pci_resource_start(pcidev, index); |
@@ -454,7 +454,7 @@ static void __iomem *hptiop_map_pci_bar(struct hptiop_hba *hba, int index) | |||
454 | if (!mem_base_virt) { | 454 | if (!mem_base_virt) { |
455 | printk(KERN_ERR "scsi%d: Fail to ioremap memory space\n", | 455 | printk(KERN_ERR "scsi%d: Fail to ioremap memory space\n", |
456 | hba->host->host_no); | 456 | hba->host->host_no); |
457 | return 0; | 457 | return NULL; |
458 | } | 458 | } |
459 | return mem_base_virt; | 459 | return mem_base_virt; |
460 | } | 460 | } |
@@ -476,11 +476,11 @@ static void hptiop_unmap_pci_bar_itl(struct hptiop_hba *hba) | |||
476 | static int hptiop_map_pci_bar_mv(struct hptiop_hba *hba) | 476 | static int hptiop_map_pci_bar_mv(struct hptiop_hba *hba) |
477 | { | 477 | { |
478 | hba->u.mv.regs = hptiop_map_pci_bar(hba, 0); | 478 | hba->u.mv.regs = hptiop_map_pci_bar(hba, 0); |
479 | if (hba->u.mv.regs == 0) | 479 | if (hba->u.mv.regs == NULL) |
480 | return -1; | 480 | return -1; |
481 | 481 | ||
482 | hba->u.mv.mu = hptiop_map_pci_bar(hba, 2); | 482 | hba->u.mv.mu = hptiop_map_pci_bar(hba, 2); |
483 | if (hba->u.mv.mu == 0) { | 483 | if (hba->u.mv.mu == NULL) { |
484 | iounmap(hba->u.mv.regs); | 484 | iounmap(hba->u.mv.regs); |
485 | return -1; | 485 | return -1; |
486 | } | 486 | } |
@@ -1210,8 +1210,8 @@ static void hptiop_remove(struct pci_dev *pcidev) | |||
1210 | 1210 | ||
1211 | static struct hptiop_adapter_ops hptiop_itl_ops = { | 1211 | static struct hptiop_adapter_ops hptiop_itl_ops = { |
1212 | .iop_wait_ready = iop_wait_ready_itl, | 1212 | .iop_wait_ready = iop_wait_ready_itl, |
1213 | .internal_memalloc = 0, | 1213 | .internal_memalloc = NULL, |
1214 | .internal_memfree = 0, | 1214 | .internal_memfree = NULL, |
1215 | .map_pci_bar = hptiop_map_pci_bar_itl, | 1215 | .map_pci_bar = hptiop_map_pci_bar_itl, |
1216 | .unmap_pci_bar = hptiop_unmap_pci_bar_itl, | 1216 | .unmap_pci_bar = hptiop_unmap_pci_bar_itl, |
1217 | .enable_intr = hptiop_enable_intr_itl, | 1217 | .enable_intr = hptiop_enable_intr_itl, |
diff --git a/drivers/scsi/mac_esp.c b/drivers/scsi/mac_esp.c index cd37bd69a115..887682a24e36 100644 --- a/drivers/scsi/mac_esp.c +++ b/drivers/scsi/mac_esp.c | |||
@@ -650,7 +650,7 @@ static void __exit mac_esp_exit(void) | |||
650 | 650 | ||
651 | MODULE_DESCRIPTION("Mac ESP SCSI driver"); | 651 | MODULE_DESCRIPTION("Mac ESP SCSI driver"); |
652 | MODULE_AUTHOR("Finn Thain <fthain@telegraphics.com.au>"); | 652 | MODULE_AUTHOR("Finn Thain <fthain@telegraphics.com.au>"); |
653 | MODULE_LICENSE("GPLv2"); | 653 | MODULE_LICENSE("GPL v2"); |
654 | MODULE_VERSION(DRV_VERSION); | 654 | MODULE_VERSION(DRV_VERSION); |
655 | 655 | ||
656 | module_init(mac_esp_init); | 656 | module_init(mac_esp_init); |
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index 31f7aec44d90..243d8becd30f 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c | |||
@@ -5695,13 +5695,12 @@ static int osst_sysfs_add(dev_t dev, struct device *device, struct osst_tape * S | |||
5695 | struct device *osst_member; | 5695 | struct device *osst_member; |
5696 | int err; | 5696 | int err; |
5697 | 5697 | ||
5698 | osst_member = device_create(osst_sysfs_class, device, dev, "%s", name); | 5698 | osst_member = device_create_drvdata(osst_sysfs_class, device, dev, STp, "%s", name); |
5699 | if (IS_ERR(osst_member)) { | 5699 | if (IS_ERR(osst_member)) { |
5700 | printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name); | 5700 | printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name); |
5701 | return PTR_ERR(osst_member); | 5701 | return PTR_ERR(osst_member); |
5702 | } | 5702 | } |
5703 | 5703 | ||
5704 | dev_set_drvdata(osst_member, STp); | ||
5705 | err = device_create_file(osst_member, &dev_attr_ADR_rev); | 5704 | err = device_create_file(osst_member, &dev_attr_ADR_rev); |
5706 | if (err) | 5705 | if (err) |
5707 | goto err_out; | 5706 | goto err_out; |
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index 51e2f299dbbb..3754ab87f89a 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c | |||
@@ -2811,7 +2811,7 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp) | |||
2811 | 2811 | ||
2812 | /* Check for room in outstanding command list. */ | 2812 | /* Check for room in outstanding command list. */ |
2813 | for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS && | 2813 | for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS && |
2814 | ha->outstanding_cmds[cnt] != 0; cnt++); | 2814 | ha->outstanding_cmds[cnt] != NULL; cnt++); |
2815 | 2815 | ||
2816 | if (cnt >= MAX_OUTSTANDING_COMMANDS) { | 2816 | if (cnt >= MAX_OUTSTANDING_COMMANDS) { |
2817 | status = 1; | 2817 | status = 1; |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index c9d7f721b9e2..ea0edd1b2e76 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -1441,17 +1441,18 @@ sg_add(struct device *cl_dev, struct class_interface *cl_intf) | |||
1441 | if (sg_sysfs_valid) { | 1441 | if (sg_sysfs_valid) { |
1442 | struct device *sg_class_member; | 1442 | struct device *sg_class_member; |
1443 | 1443 | ||
1444 | sg_class_member = device_create(sg_sysfs_class, cl_dev->parent, | 1444 | sg_class_member = device_create_drvdata(sg_sysfs_class, |
1445 | MKDEV(SCSI_GENERIC_MAJOR, | 1445 | cl_dev->parent, |
1446 | sdp->index), | 1446 | MKDEV(SCSI_GENERIC_MAJOR, |
1447 | "%s", disk->disk_name); | 1447 | sdp->index), |
1448 | sdp, | ||
1449 | "%s", disk->disk_name); | ||
1448 | if (IS_ERR(sg_class_member)) { | 1450 | if (IS_ERR(sg_class_member)) { |
1449 | printk(KERN_ERR "sg_add: " | 1451 | printk(KERN_ERR "sg_add: " |
1450 | "device_create failed\n"); | 1452 | "device_create failed\n"); |
1451 | error = PTR_ERR(sg_class_member); | 1453 | error = PTR_ERR(sg_class_member); |
1452 | goto cdev_add_err; | 1454 | goto cdev_add_err; |
1453 | } | 1455 | } |
1454 | dev_set_drvdata(sg_class_member, sdp); | ||
1455 | error = sysfs_create_link(&scsidp->sdev_gendev.kobj, | 1456 | error = sysfs_create_link(&scsidp->sdev_gendev.kobj, |
1456 | &sg_class_member->kobj, "generic"); | 1457 | &sg_class_member->kobj, "generic"); |
1457 | if (error) | 1458 | if (error) |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index e8db66ad0bde..6e5a5bb31311 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -4424,17 +4424,19 @@ static int do_create_class_files(struct scsi_tape *STp, int dev_num, int mode) | |||
4424 | snprintf(name, 10, "%s%s%s", rew ? "n" : "", | 4424 | snprintf(name, 10, "%s%s%s", rew ? "n" : "", |
4425 | STp->disk->disk_name, st_formats[i]); | 4425 | STp->disk->disk_name, st_formats[i]); |
4426 | st_class_member = | 4426 | st_class_member = |
4427 | device_create(st_sysfs_class, &STp->device->sdev_gendev, | 4427 | device_create_drvdata(st_sysfs_class, |
4428 | MKDEV(SCSI_TAPE_MAJOR, | 4428 | &STp->device->sdev_gendev, |
4429 | TAPE_MINOR(dev_num, mode, rew)), | 4429 | MKDEV(SCSI_TAPE_MAJOR, |
4430 | "%s", name); | 4430 | TAPE_MINOR(dev_num, |
4431 | mode, rew)), | ||
4432 | &STp->modes[mode], | ||
4433 | "%s", name); | ||
4431 | if (IS_ERR(st_class_member)) { | 4434 | if (IS_ERR(st_class_member)) { |
4432 | printk(KERN_WARNING "st%d: device_create failed\n", | 4435 | printk(KERN_WARNING "st%d: device_create failed\n", |
4433 | dev_num); | 4436 | dev_num); |
4434 | error = PTR_ERR(st_class_member); | 4437 | error = PTR_ERR(st_class_member); |
4435 | goto out; | 4438 | goto out; |
4436 | } | 4439 | } |
4437 | dev_set_drvdata(st_class_member, &STp->modes[mode]); | ||
4438 | 4440 | ||
4439 | error = device_create_file(st_class_member, | 4441 | error = device_create_file(st_class_member, |
4440 | &dev_attr_defined); | 4442 | &dev_attr_defined); |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index a1ca9b7bf2d5..1bc00b721e9d 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -93,7 +93,6 @@ static unsigned int nr_uarts = CONFIG_SERIAL_8250_RUNTIME_UARTS; | |||
93 | #define CONFIG_HUB6 1 | 93 | #define CONFIG_HUB6 1 |
94 | 94 | ||
95 | #include <asm/serial.h> | 95 | #include <asm/serial.h> |
96 | |||
97 | /* | 96 | /* |
98 | * SERIAL_PORT_DFNS tells us about built-in ports that have no | 97 | * SERIAL_PORT_DFNS tells us about built-in ports that have no |
99 | * standard enumeration mechanism. Platforms that can find all | 98 | * standard enumeration mechanism. Platforms that can find all |
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 53fa19cf2f06..788c3559522d 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
@@ -2602,7 +2602,12 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
2602 | { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS200, | 2602 | { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS200, |
2603 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0811 */ | 2603 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0811 */ |
2604 | pbn_b2_2_115200 }, | 2604 | pbn_b2_2_115200 }, |
2605 | 2605 | /* | |
2606 | * IntaShield IS-400 | ||
2607 | */ | ||
2608 | { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS400, | ||
2609 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0dc0 */ | ||
2610 | pbn_b2_4_115200 }, | ||
2606 | /* | 2611 | /* |
2607 | * Perle PCI-RAS cards | 2612 | * Perle PCI-RAS cards |
2608 | */ | 2613 | */ |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 62e6eb136a3c..9bc42763623c 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -1361,7 +1361,7 @@ config SERIAL_SC26XX_CONSOLE | |||
1361 | 1361 | ||
1362 | config SERIAL_BFIN_SPORT | 1362 | config SERIAL_BFIN_SPORT |
1363 | tristate "Blackfin SPORT emulate UART (EXPERIMENTAL)" | 1363 | tristate "Blackfin SPORT emulate UART (EXPERIMENTAL)" |
1364 | depends on BFIN && EXPERIMENTAL | 1364 | depends on BLACKFIN && EXPERIMENTAL |
1365 | select SERIAL_CORE | 1365 | select SERIAL_CORE |
1366 | help | 1366 | help |
1367 | Enble support SPORT emulate UART on Blackfin series. | 1367 | Enble support SPORT emulate UART on Blackfin series. |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index eab032733790..53b03c629aff 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -2054,6 +2054,8 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) | |||
2054 | int uart_resume_port(struct uart_driver *drv, struct uart_port *port) | 2054 | int uart_resume_port(struct uart_driver *drv, struct uart_port *port) |
2055 | { | 2055 | { |
2056 | struct uart_state *state = drv->state + port->line; | 2056 | struct uart_state *state = drv->state + port->line; |
2057 | struct device *tty_dev; | ||
2058 | struct uart_match match = {port, drv}; | ||
2057 | 2059 | ||
2058 | mutex_lock(&state->mutex); | 2060 | mutex_lock(&state->mutex); |
2059 | 2061 | ||
@@ -2063,7 +2065,8 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port) | |||
2063 | return 0; | 2065 | return 0; |
2064 | } | 2066 | } |
2065 | 2067 | ||
2066 | if (!port->suspended) { | 2068 | tty_dev = device_find_child(port->dev, &match, serial_match_port); |
2069 | if (!port->suspended && device_may_wakeup(tty_dev)) { | ||
2067 | disable_irq_wake(port->irq); | 2070 | disable_irq_wake(port->irq); |
2068 | mutex_unlock(&state->mutex); | 2071 | mutex_unlock(&state->mutex); |
2069 | return 0; | 2072 | return 0; |
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index 8fdafc27fce8..ce6ee92b3a1b 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
@@ -184,15 +184,15 @@ static void put_string(struct sci_port *sci_port, const char *buffer, int count) | |||
184 | int h, l; | 184 | int h, l; |
185 | 185 | ||
186 | c = *p++; | 186 | c = *p++; |
187 | h = highhex(c); | 187 | h = hex_asc_hi(c); |
188 | l = lowhex(c); | 188 | l = hex_asc_lo(c); |
189 | put_char(port, h); | 189 | put_char(port, h); |
190 | put_char(port, l); | 190 | put_char(port, l); |
191 | checksum += h + l; | 191 | checksum += h + l; |
192 | } | 192 | } |
193 | put_char(port, '#'); | 193 | put_char(port, '#'); |
194 | put_char(port, highhex(checksum)); | 194 | put_char(port, hex_asc_hi(checksum)); |
195 | put_char(port, lowhex(checksum)); | 195 | put_char(port, hex_asc_lo(checksum)); |
196 | } while (get_char(port) != '+'); | 196 | } while (get_char(port) != '+'); |
197 | } else | 197 | } else |
198 | #endif /* CONFIG_SH_STANDARD_BIOS || CONFIG_SH_KGDB */ | 198 | #endif /* CONFIG_SH_STANDARD_BIOS || CONFIG_SH_KGDB */ |
diff --git a/drivers/serial/sunhv.c b/drivers/serial/sunhv.c index 145c0281495d..2847336742d7 100644 --- a/drivers/serial/sunhv.c +++ b/drivers/serial/sunhv.c | |||
@@ -499,7 +499,6 @@ static void sunhv_console_write_bychar(struct console *con, const char *s, unsig | |||
499 | } else | 499 | } else |
500 | spin_lock(&port->lock); | 500 | spin_lock(&port->lock); |
501 | 501 | ||
502 | spin_lock_irqsave(&port->lock, flags); | ||
503 | for (i = 0; i < n; i++) { | 502 | for (i = 0; i < n; i++) { |
504 | if (*s == '\n') | 503 | if (*s == '\n') |
505 | sunhv_console_putchar(port, '\r'); | 504 | sunhv_console_putchar(port, '\r'); |
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index b3518ca9f04e..41620c0fb046 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c | |||
@@ -68,6 +68,7 @@ static unsigned long minors[N_SPI_MINORS / BITS_PER_LONG]; | |||
68 | 68 | ||
69 | struct spidev_data { | 69 | struct spidev_data { |
70 | struct device dev; | 70 | struct device dev; |
71 | spinlock_t spi_lock; | ||
71 | struct spi_device *spi; | 72 | struct spi_device *spi; |
72 | struct list_head device_entry; | 73 | struct list_head device_entry; |
73 | 74 | ||
@@ -85,12 +86,75 @@ MODULE_PARM_DESC(bufsiz, "data bytes in biggest supported SPI message"); | |||
85 | 86 | ||
86 | /*-------------------------------------------------------------------------*/ | 87 | /*-------------------------------------------------------------------------*/ |
87 | 88 | ||
89 | /* | ||
90 | * We can't use the standard synchronous wrappers for file I/O; we | ||
91 | * need to protect against async removal of the underlying spi_device. | ||
92 | */ | ||
93 | static void spidev_complete(void *arg) | ||
94 | { | ||
95 | complete(arg); | ||
96 | } | ||
97 | |||
98 | static ssize_t | ||
99 | spidev_sync(struct spidev_data *spidev, struct spi_message *message) | ||
100 | { | ||
101 | DECLARE_COMPLETION_ONSTACK(done); | ||
102 | int status; | ||
103 | |||
104 | message->complete = spidev_complete; | ||
105 | message->context = &done; | ||
106 | |||
107 | spin_lock_irq(&spidev->spi_lock); | ||
108 | if (spidev->spi == NULL) | ||
109 | status = -ESHUTDOWN; | ||
110 | else | ||
111 | status = spi_async(spidev->spi, message); | ||
112 | spin_unlock_irq(&spidev->spi_lock); | ||
113 | |||
114 | if (status == 0) { | ||
115 | wait_for_completion(&done); | ||
116 | status = message->status; | ||
117 | if (status == 0) | ||
118 | status = message->actual_length; | ||
119 | } | ||
120 | return status; | ||
121 | } | ||
122 | |||
123 | static inline ssize_t | ||
124 | spidev_sync_write(struct spidev_data *spidev, size_t len) | ||
125 | { | ||
126 | struct spi_transfer t = { | ||
127 | .tx_buf = spidev->buffer, | ||
128 | .len = len, | ||
129 | }; | ||
130 | struct spi_message m; | ||
131 | |||
132 | spi_message_init(&m); | ||
133 | spi_message_add_tail(&t, &m); | ||
134 | return spidev_sync(spidev, &m); | ||
135 | } | ||
136 | |||
137 | static inline ssize_t | ||
138 | spidev_sync_read(struct spidev_data *spidev, size_t len) | ||
139 | { | ||
140 | struct spi_transfer t = { | ||
141 | .rx_buf = spidev->buffer, | ||
142 | .len = len, | ||
143 | }; | ||
144 | struct spi_message m; | ||
145 | |||
146 | spi_message_init(&m); | ||
147 | spi_message_add_tail(&t, &m); | ||
148 | return spidev_sync(spidev, &m); | ||
149 | } | ||
150 | |||
151 | /*-------------------------------------------------------------------------*/ | ||
152 | |||
88 | /* Read-only message with current device setup */ | 153 | /* Read-only message with current device setup */ |
89 | static ssize_t | 154 | static ssize_t |
90 | spidev_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) | 155 | spidev_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) |
91 | { | 156 | { |
92 | struct spidev_data *spidev; | 157 | struct spidev_data *spidev; |
93 | struct spi_device *spi; | ||
94 | ssize_t status = 0; | 158 | ssize_t status = 0; |
95 | 159 | ||
96 | /* chipselect only toggles at start or end of operation */ | 160 | /* chipselect only toggles at start or end of operation */ |
@@ -98,10 +162,9 @@ spidev_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) | |||
98 | return -EMSGSIZE; | 162 | return -EMSGSIZE; |
99 | 163 | ||
100 | spidev = filp->private_data; | 164 | spidev = filp->private_data; |
101 | spi = spidev->spi; | ||
102 | 165 | ||
103 | mutex_lock(&spidev->buf_lock); | 166 | mutex_lock(&spidev->buf_lock); |
104 | status = spi_read(spi, spidev->buffer, count); | 167 | status = spidev_sync_read(spidev, count); |
105 | if (status == 0) { | 168 | if (status == 0) { |
106 | unsigned long missing; | 169 | unsigned long missing; |
107 | 170 | ||
@@ -122,7 +185,6 @@ spidev_write(struct file *filp, const char __user *buf, | |||
122 | size_t count, loff_t *f_pos) | 185 | size_t count, loff_t *f_pos) |
123 | { | 186 | { |
124 | struct spidev_data *spidev; | 187 | struct spidev_data *spidev; |
125 | struct spi_device *spi; | ||
126 | ssize_t status = 0; | 188 | ssize_t status = 0; |
127 | unsigned long missing; | 189 | unsigned long missing; |
128 | 190 | ||
@@ -131,12 +193,11 @@ spidev_write(struct file *filp, const char __user *buf, | |||
131 | return -EMSGSIZE; | 193 | return -EMSGSIZE; |
132 | 194 | ||
133 | spidev = filp->private_data; | 195 | spidev = filp->private_data; |
134 | spi = spidev->spi; | ||
135 | 196 | ||
136 | mutex_lock(&spidev->buf_lock); | 197 | mutex_lock(&spidev->buf_lock); |
137 | missing = copy_from_user(spidev->buffer, buf, count); | 198 | missing = copy_from_user(spidev->buffer, buf, count); |
138 | if (missing == 0) { | 199 | if (missing == 0) { |
139 | status = spi_write(spi, spidev->buffer, count); | 200 | status = spidev_sync_write(spidev, count); |
140 | if (status == 0) | 201 | if (status == 0) |
141 | status = count; | 202 | status = count; |
142 | } else | 203 | } else |
@@ -153,7 +214,6 @@ static int spidev_message(struct spidev_data *spidev, | |||
153 | struct spi_transfer *k_xfers; | 214 | struct spi_transfer *k_xfers; |
154 | struct spi_transfer *k_tmp; | 215 | struct spi_transfer *k_tmp; |
155 | struct spi_ioc_transfer *u_tmp; | 216 | struct spi_ioc_transfer *u_tmp; |
156 | struct spi_device *spi = spidev->spi; | ||
157 | unsigned n, total; | 217 | unsigned n, total; |
158 | u8 *buf; | 218 | u8 *buf; |
159 | int status = -EFAULT; | 219 | int status = -EFAULT; |
@@ -215,7 +275,7 @@ static int spidev_message(struct spidev_data *spidev, | |||
215 | spi_message_add_tail(k_tmp, &msg); | 275 | spi_message_add_tail(k_tmp, &msg); |
216 | } | 276 | } |
217 | 277 | ||
218 | status = spi_sync(spi, &msg); | 278 | status = spidev_sync(spidev, &msg); |
219 | if (status < 0) | 279 | if (status < 0) |
220 | goto done; | 280 | goto done; |
221 | 281 | ||
@@ -269,8 +329,16 @@ spidev_ioctl(struct inode *inode, struct file *filp, | |||
269 | if (err) | 329 | if (err) |
270 | return -EFAULT; | 330 | return -EFAULT; |
271 | 331 | ||
332 | /* guard against device removal before, or while, | ||
333 | * we issue this ioctl. | ||
334 | */ | ||
272 | spidev = filp->private_data; | 335 | spidev = filp->private_data; |
273 | spi = spidev->spi; | 336 | spin_lock_irq(&spidev->spi_lock); |
337 | spi = spi_dev_get(spidev->spi); | ||
338 | spin_unlock_irq(&spidev->spi_lock); | ||
339 | |||
340 | if (spi == NULL) | ||
341 | return -ESHUTDOWN; | ||
274 | 342 | ||
275 | switch (cmd) { | 343 | switch (cmd) { |
276 | /* read requests */ | 344 | /* read requests */ |
@@ -356,8 +424,10 @@ spidev_ioctl(struct inode *inode, struct file *filp, | |||
356 | default: | 424 | default: |
357 | /* segmented and/or full-duplex I/O request */ | 425 | /* segmented and/or full-duplex I/O request */ |
358 | if (_IOC_NR(cmd) != _IOC_NR(SPI_IOC_MESSAGE(0)) | 426 | if (_IOC_NR(cmd) != _IOC_NR(SPI_IOC_MESSAGE(0)) |
359 | || _IOC_DIR(cmd) != _IOC_WRITE) | 427 | || _IOC_DIR(cmd) != _IOC_WRITE) { |
360 | return -ENOTTY; | 428 | retval = -ENOTTY; |
429 | break; | ||
430 | } | ||
361 | 431 | ||
362 | tmp = _IOC_SIZE(cmd); | 432 | tmp = _IOC_SIZE(cmd); |
363 | if ((tmp % sizeof(struct spi_ioc_transfer)) != 0) { | 433 | if ((tmp % sizeof(struct spi_ioc_transfer)) != 0) { |
@@ -385,6 +455,7 @@ spidev_ioctl(struct inode *inode, struct file *filp, | |||
385 | kfree(ioc); | 455 | kfree(ioc); |
386 | break; | 456 | break; |
387 | } | 457 | } |
458 | spi_dev_put(spi); | ||
388 | return retval; | 459 | return retval; |
389 | } | 460 | } |
390 | 461 | ||
@@ -488,6 +559,7 @@ static int spidev_probe(struct spi_device *spi) | |||
488 | 559 | ||
489 | /* Initialize the driver data */ | 560 | /* Initialize the driver data */ |
490 | spidev->spi = spi; | 561 | spidev->spi = spi; |
562 | spin_lock_init(&spidev->spi_lock); | ||
491 | mutex_init(&spidev->buf_lock); | 563 | mutex_init(&spidev->buf_lock); |
492 | 564 | ||
493 | INIT_LIST_HEAD(&spidev->device_entry); | 565 | INIT_LIST_HEAD(&spidev->device_entry); |
@@ -526,13 +598,17 @@ static int spidev_remove(struct spi_device *spi) | |||
526 | { | 598 | { |
527 | struct spidev_data *spidev = dev_get_drvdata(&spi->dev); | 599 | struct spidev_data *spidev = dev_get_drvdata(&spi->dev); |
528 | 600 | ||
529 | mutex_lock(&device_list_lock); | 601 | /* make sure ops on existing fds can abort cleanly */ |
602 | spin_lock_irq(&spidev->spi_lock); | ||
603 | spidev->spi = NULL; | ||
604 | spin_unlock_irq(&spidev->spi_lock); | ||
530 | 605 | ||
606 | /* prevent new opens */ | ||
607 | mutex_lock(&device_list_lock); | ||
531 | list_del(&spidev->device_entry); | 608 | list_del(&spidev->device_entry); |
532 | dev_set_drvdata(&spi->dev, NULL); | 609 | dev_set_drvdata(&spi->dev, NULL); |
533 | clear_bit(MINOR(spidev->dev.devt), minors); | 610 | clear_bit(MINOR(spidev->dev.devt), minors); |
534 | device_unregister(&spidev->dev); | 611 | device_unregister(&spidev->dev); |
535 | |||
536 | mutex_unlock(&device_list_lock); | 612 | mutex_unlock(&device_list_lock); |
537 | 613 | ||
538 | return 0; | 614 | return 0; |
diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c index 75def13e797d..d28c53868093 100644 --- a/drivers/ssb/driver_pcicore.c +++ b/drivers/ssb/driver_pcicore.c | |||
@@ -537,12 +537,12 @@ int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc, | |||
537 | int err = 0; | 537 | int err = 0; |
538 | u32 tmp; | 538 | u32 tmp; |
539 | 539 | ||
540 | might_sleep(); | ||
541 | |||
542 | if (!pdev) | 540 | if (!pdev) |
543 | goto out; | 541 | goto out; |
544 | bus = pdev->bus; | 542 | bus = pdev->bus; |
545 | 543 | ||
544 | might_sleep_if(pdev->id.coreid != SSB_DEV_PCI); | ||
545 | |||
546 | /* Enable interrupts for this device. */ | 546 | /* Enable interrupts for this device. */ |
547 | if (bus->host_pci && | 547 | if (bus->host_pci && |
548 | ((pdev->id.revision >= 6) || (pdev->id.coreid == SSB_DEV_PCIE))) { | 548 | ((pdev->id.revision >= 6) || (pdev->id.coreid == SSB_DEV_PCIE))) { |
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index 55cc7b80422a..0a12e90ad416 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
@@ -649,15 +649,14 @@ int __uio_register_device(struct module *owner, | |||
649 | if (ret) | 649 | if (ret) |
650 | goto err_get_minor; | 650 | goto err_get_minor; |
651 | 651 | ||
652 | idev->dev = device_create(uio_class->class, parent, | 652 | idev->dev = device_create_drvdata(uio_class->class, parent, |
653 | MKDEV(uio_major, idev->minor), | 653 | MKDEV(uio_major, idev->minor), idev, |
654 | "uio%d", idev->minor); | 654 | "uio%d", idev->minor); |
655 | if (IS_ERR(idev->dev)) { | 655 | if (IS_ERR(idev->dev)) { |
656 | printk(KERN_ERR "UIO: device register failed\n"); | 656 | printk(KERN_ERR "UIO: device register failed\n"); |
657 | ret = PTR_ERR(idev->dev); | 657 | ret = PTR_ERR(idev->dev); |
658 | goto err_device_create; | 658 | goto err_device_create; |
659 | } | 659 | } |
660 | dev_set_drvdata(idev->dev, idev); | ||
661 | 660 | ||
662 | ret = uio_dev_add_attributes(idev); | 661 | ret = uio_dev_add_attributes(idev); |
663 | if (ret) | 662 | if (ret) |
diff --git a/drivers/usb/class/Kconfig b/drivers/usb/class/Kconfig index 3a9102d2591b..66f17ed88cb5 100644 --- a/drivers/usb/class/Kconfig +++ b/drivers/usb/class/Kconfig | |||
@@ -29,3 +29,14 @@ config USB_PRINTER | |||
29 | To compile this driver as a module, choose M here: the | 29 | To compile this driver as a module, choose M here: the |
30 | module will be called usblp. | 30 | module will be called usblp. |
31 | 31 | ||
32 | config USB_WDM | ||
33 | tristate "USB Wireless Device Management support" | ||
34 | depends on USB | ||
35 | ---help--- | ||
36 | This driver supports the WMC Device Management functionality | ||
37 | of cell phones compliant to the CDC WMC specification. You can use | ||
38 | AT commands over this device. | ||
39 | |||
40 | To compile this driver as a module, choose M here: the | ||
41 | module will be called cdc-wdm. | ||
42 | |||
diff --git a/drivers/usb/class/Makefile b/drivers/usb/class/Makefile index cc391e6c2af8..535d59a30600 100644 --- a/drivers/usb/class/Makefile +++ b/drivers/usb/class/Makefile | |||
@@ -5,3 +5,4 @@ | |||
5 | 5 | ||
6 | obj-$(CONFIG_USB_ACM) += cdc-acm.o | 6 | obj-$(CONFIG_USB_ACM) += cdc-acm.o |
7 | obj-$(CONFIG_USB_PRINTER) += usblp.o | 7 | obj-$(CONFIG_USB_PRINTER) += usblp.o |
8 | obj-$(CONFIG_USB_WDM) += cdc-wdm.o | ||
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c new file mode 100644 index 000000000000..107666d4e2ec --- /dev/null +++ b/drivers/usb/class/cdc-wdm.c | |||
@@ -0,0 +1,740 @@ | |||
1 | /* | ||
2 | * cdc-wdm.c | ||
3 | * | ||
4 | * This driver supports USB CDC WCM Device Management. | ||
5 | * | ||
6 | * Copyright (c) 2007-2008 Oliver Neukum | ||
7 | * | ||
8 | * Some code taken from cdc-acm.c | ||
9 | * | ||
10 | * Released under the GPLv2. | ||
11 | * | ||
12 | * Many thanks to Carl Nordbeck | ||
13 | */ | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/errno.h> | ||
16 | #include <linux/slab.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/smp_lock.h> | ||
19 | #include <linux/mutex.h> | ||
20 | #include <linux/uaccess.h> | ||
21 | #include <linux/bitops.h> | ||
22 | #include <linux/poll.h> | ||
23 | #include <linux/usb.h> | ||
24 | #include <linux/usb/cdc.h> | ||
25 | #include <asm/byteorder.h> | ||
26 | #include <asm/unaligned.h> | ||
27 | |||
28 | /* | ||
29 | * Version Information | ||
30 | */ | ||
31 | #define DRIVER_VERSION "v0.02" | ||
32 | #define DRIVER_AUTHOR "Oliver Neukum" | ||
33 | |||
34 | static struct usb_device_id wdm_ids[] = { | ||
35 | { | ||
36 | .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS | | ||
37 | USB_DEVICE_ID_MATCH_INT_SUBCLASS, | ||
38 | .bInterfaceClass = USB_CLASS_COMM, | ||
39 | .bInterfaceSubClass = USB_CDC_SUBCLASS_DMM | ||
40 | }, | ||
41 | { } | ||
42 | }; | ||
43 | |||
44 | #define WDM_MINOR_BASE 176 | ||
45 | |||
46 | |||
47 | #define WDM_IN_USE 1 | ||
48 | #define WDM_DISCONNECTING 2 | ||
49 | #define WDM_RESULT 3 | ||
50 | #define WDM_READ 4 | ||
51 | #define WDM_INT_STALL 5 | ||
52 | #define WDM_POLL_RUNNING 6 | ||
53 | |||
54 | |||
55 | #define WDM_MAX 16 | ||
56 | |||
57 | |||
58 | static DEFINE_MUTEX(wdm_mutex); | ||
59 | |||
60 | /* --- method tables --- */ | ||
61 | |||
62 | struct wdm_device { | ||
63 | u8 *inbuf; /* buffer for response */ | ||
64 | u8 *outbuf; /* buffer for command */ | ||
65 | u8 *sbuf; /* buffer for status */ | ||
66 | u8 *ubuf; /* buffer for copy to user space */ | ||
67 | |||
68 | struct urb *command; | ||
69 | struct urb *response; | ||
70 | struct urb *validity; | ||
71 | struct usb_interface *intf; | ||
72 | struct usb_ctrlrequest *orq; | ||
73 | struct usb_ctrlrequest *irq; | ||
74 | spinlock_t iuspin; | ||
75 | |||
76 | unsigned long flags; | ||
77 | u16 bufsize; | ||
78 | u16 wMaxCommand; | ||
79 | u16 wMaxPacketSize; | ||
80 | u16 bMaxPacketSize0; | ||
81 | __le16 inum; | ||
82 | int reslength; | ||
83 | int length; | ||
84 | int read; | ||
85 | int count; | ||
86 | dma_addr_t shandle; | ||
87 | dma_addr_t ihandle; | ||
88 | struct mutex wlock; | ||
89 | struct mutex rlock; | ||
90 | wait_queue_head_t wait; | ||
91 | struct work_struct rxwork; | ||
92 | int werr; | ||
93 | int rerr; | ||
94 | }; | ||
95 | |||
96 | static struct usb_driver wdm_driver; | ||
97 | |||
98 | /* --- callbacks --- */ | ||
99 | static void wdm_out_callback(struct urb *urb) | ||
100 | { | ||
101 | struct wdm_device *desc; | ||
102 | desc = urb->context; | ||
103 | spin_lock(&desc->iuspin); | ||
104 | desc->werr = urb->status; | ||
105 | spin_unlock(&desc->iuspin); | ||
106 | clear_bit(WDM_IN_USE, &desc->flags); | ||
107 | kfree(desc->outbuf); | ||
108 | wake_up(&desc->wait); | ||
109 | } | ||
110 | |||
111 | static void wdm_in_callback(struct urb *urb) | ||
112 | { | ||
113 | struct wdm_device *desc = urb->context; | ||
114 | int status = urb->status; | ||
115 | |||
116 | spin_lock(&desc->iuspin); | ||
117 | |||
118 | if (status) { | ||
119 | switch (status) { | ||
120 | case -ENOENT: | ||
121 | dev_dbg(&desc->intf->dev, | ||
122 | "nonzero urb status received: -ENOENT"); | ||
123 | break; | ||
124 | case -ECONNRESET: | ||
125 | dev_dbg(&desc->intf->dev, | ||
126 | "nonzero urb status received: -ECONNRESET"); | ||
127 | break; | ||
128 | case -ESHUTDOWN: | ||
129 | dev_dbg(&desc->intf->dev, | ||
130 | "nonzero urb status received: -ESHUTDOWN"); | ||
131 | break; | ||
132 | case -EPIPE: | ||
133 | err("nonzero urb status received: -EPIPE"); | ||
134 | break; | ||
135 | default: | ||
136 | err("Unexpected error %d", status); | ||
137 | break; | ||
138 | } | ||
139 | } | ||
140 | |||
141 | desc->rerr = status; | ||
142 | desc->reslength = urb->actual_length; | ||
143 | memmove(desc->ubuf + desc->length, desc->inbuf, desc->reslength); | ||
144 | desc->length += desc->reslength; | ||
145 | wake_up(&desc->wait); | ||
146 | |||
147 | set_bit(WDM_READ, &desc->flags); | ||
148 | spin_unlock(&desc->iuspin); | ||
149 | } | ||
150 | |||
151 | static void wdm_int_callback(struct urb *urb) | ||
152 | { | ||
153 | int rv = 0; | ||
154 | int status = urb->status; | ||
155 | struct wdm_device *desc; | ||
156 | struct usb_ctrlrequest *req; | ||
157 | struct usb_cdc_notification *dr; | ||
158 | |||
159 | desc = urb->context; | ||
160 | req = desc->irq; | ||
161 | dr = (struct usb_cdc_notification *)desc->sbuf; | ||
162 | |||
163 | if (status) { | ||
164 | switch (status) { | ||
165 | case -ESHUTDOWN: | ||
166 | case -ENOENT: | ||
167 | case -ECONNRESET: | ||
168 | return; /* unplug */ | ||
169 | case -EPIPE: | ||
170 | set_bit(WDM_INT_STALL, &desc->flags); | ||
171 | err("Stall on int endpoint"); | ||
172 | goto sw; /* halt is cleared in work */ | ||
173 | default: | ||
174 | err("nonzero urb status received: %d", status); | ||
175 | break; | ||
176 | } | ||
177 | } | ||
178 | |||
179 | if (urb->actual_length < sizeof(struct usb_cdc_notification)) { | ||
180 | err("wdm_int_callback - %d bytes", urb->actual_length); | ||
181 | goto exit; | ||
182 | } | ||
183 | |||
184 | switch (dr->bNotificationType) { | ||
185 | case USB_CDC_NOTIFY_RESPONSE_AVAILABLE: | ||
186 | dev_dbg(&desc->intf->dev, | ||
187 | "NOTIFY_RESPONSE_AVAILABLE received: index %d len %d", | ||
188 | dr->wIndex, dr->wLength); | ||
189 | break; | ||
190 | |||
191 | case USB_CDC_NOTIFY_NETWORK_CONNECTION: | ||
192 | |||
193 | dev_dbg(&desc->intf->dev, | ||
194 | "NOTIFY_NETWORK_CONNECTION %s network", | ||
195 | dr->wValue ? "connected to" : "disconnected from"); | ||
196 | goto exit; | ||
197 | default: | ||
198 | clear_bit(WDM_POLL_RUNNING, &desc->flags); | ||
199 | err("unknown notification %d received: index %d len %d", | ||
200 | dr->bNotificationType, dr->wIndex, dr->wLength); | ||
201 | goto exit; | ||
202 | } | ||
203 | |||
204 | req->bRequestType = (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE); | ||
205 | req->bRequest = USB_CDC_GET_ENCAPSULATED_RESPONSE; | ||
206 | req->wValue = 0; | ||
207 | req->wIndex = desc->inum; | ||
208 | req->wLength = cpu_to_le16(desc->bMaxPacketSize0); | ||
209 | |||
210 | usb_fill_control_urb( | ||
211 | desc->response, | ||
212 | interface_to_usbdev(desc->intf), | ||
213 | /* using common endpoint 0 */ | ||
214 | usb_rcvctrlpipe(interface_to_usbdev(desc->intf), 0), | ||
215 | (unsigned char *)req, | ||
216 | desc->inbuf, | ||
217 | desc->bMaxPacketSize0, | ||
218 | wdm_in_callback, | ||
219 | desc | ||
220 | ); | ||
221 | desc->response->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
222 | spin_lock(&desc->iuspin); | ||
223 | clear_bit(WDM_READ, &desc->flags); | ||
224 | if (!test_bit(WDM_DISCONNECTING, &desc->flags)) { | ||
225 | rv = usb_submit_urb(desc->response, GFP_ATOMIC); | ||
226 | dev_dbg(&desc->intf->dev, "%s: usb_submit_urb %d", | ||
227 | __func__, rv); | ||
228 | } | ||
229 | spin_unlock(&desc->iuspin); | ||
230 | if (rv < 0) { | ||
231 | if (rv == -EPERM) | ||
232 | return; | ||
233 | if (rv == -ENOMEM) { | ||
234 | sw: | ||
235 | rv = schedule_work(&desc->rxwork); | ||
236 | if (rv) | ||
237 | err("Cannot schedule work"); | ||
238 | } | ||
239 | } | ||
240 | exit: | ||
241 | rv = usb_submit_urb(urb, GFP_ATOMIC); | ||
242 | if (rv) | ||
243 | err("%s - usb_submit_urb failed with result %d", | ||
244 | __func__, rv); | ||
245 | |||
246 | } | ||
247 | |||
248 | static void kill_urbs(struct wdm_device *desc) | ||
249 | { | ||
250 | usb_kill_urb(desc->command); | ||
251 | usb_kill_urb(desc->validity); | ||
252 | usb_kill_urb(desc->response); | ||
253 | } | ||
254 | |||
255 | static void free_urbs(struct wdm_device *desc) | ||
256 | { | ||
257 | usb_free_urb(desc->validity); | ||
258 | usb_free_urb(desc->response); | ||
259 | usb_free_urb(desc->command); | ||
260 | } | ||
261 | |||
262 | static void cleanup(struct wdm_device *desc) | ||
263 | { | ||
264 | usb_buffer_free(interface_to_usbdev(desc->intf), | ||
265 | desc->wMaxPacketSize, | ||
266 | desc->sbuf, | ||
267 | desc->validity->transfer_dma); | ||
268 | usb_buffer_free(interface_to_usbdev(desc->intf), | ||
269 | desc->wMaxPacketSize, | ||
270 | desc->inbuf, | ||
271 | desc->response->transfer_dma); | ||
272 | kfree(desc->orq); | ||
273 | kfree(desc->irq); | ||
274 | kfree(desc->ubuf); | ||
275 | free_urbs(desc); | ||
276 | kfree(desc); | ||
277 | } | ||
278 | |||
279 | static ssize_t wdm_write | ||
280 | (struct file *file, const char __user *buffer, size_t count, loff_t *ppos) | ||
281 | { | ||
282 | u8 *buf; | ||
283 | int rv = -EMSGSIZE, r, we; | ||
284 | struct wdm_device *desc = file->private_data; | ||
285 | struct usb_ctrlrequest *req; | ||
286 | |||
287 | if (count > desc->wMaxCommand) | ||
288 | count = desc->wMaxCommand; | ||
289 | |||
290 | spin_lock_irq(&desc->iuspin); | ||
291 | we = desc->werr; | ||
292 | desc->werr = 0; | ||
293 | spin_unlock_irq(&desc->iuspin); | ||
294 | if (we < 0) | ||
295 | return -EIO; | ||
296 | |||
297 | r = mutex_lock_interruptible(&desc->wlock); /* concurrent writes */ | ||
298 | rv = -ERESTARTSYS; | ||
299 | if (r) | ||
300 | goto outnl; | ||
301 | |||
302 | r = wait_event_interruptible(desc->wait, !test_bit(WDM_IN_USE, | ||
303 | &desc->flags)); | ||
304 | if (r < 0) | ||
305 | goto out; | ||
306 | |||
307 | if (test_bit(WDM_DISCONNECTING, &desc->flags)) { | ||
308 | rv = -ENODEV; | ||
309 | goto out; | ||
310 | } | ||
311 | |||
312 | desc->outbuf = buf = kmalloc(count, GFP_KERNEL); | ||
313 | if (!buf) { | ||
314 | rv = -ENOMEM; | ||
315 | goto out; | ||
316 | } | ||
317 | |||
318 | r = copy_from_user(buf, buffer, count); | ||
319 | if (r > 0) { | ||
320 | kfree(buf); | ||
321 | rv = -EFAULT; | ||
322 | goto out; | ||
323 | } | ||
324 | |||
325 | req = desc->orq; | ||
326 | usb_fill_control_urb( | ||
327 | desc->command, | ||
328 | interface_to_usbdev(desc->intf), | ||
329 | /* using common endpoint 0 */ | ||
330 | usb_sndctrlpipe(interface_to_usbdev(desc->intf), 0), | ||
331 | (unsigned char *)req, | ||
332 | buf, | ||
333 | count, | ||
334 | wdm_out_callback, | ||
335 | desc | ||
336 | ); | ||
337 | |||
338 | req->bRequestType = (USB_DIR_OUT | USB_TYPE_CLASS | | ||
339 | USB_RECIP_INTERFACE); | ||
340 | req->bRequest = USB_CDC_SEND_ENCAPSULATED_COMMAND; | ||
341 | req->wValue = 0; | ||
342 | req->wIndex = desc->inum; | ||
343 | req->wLength = cpu_to_le16(count); | ||
344 | set_bit(WDM_IN_USE, &desc->flags); | ||
345 | |||
346 | rv = usb_submit_urb(desc->command, GFP_KERNEL); | ||
347 | if (rv < 0) { | ||
348 | kfree(buf); | ||
349 | clear_bit(WDM_IN_USE, &desc->flags); | ||
350 | } else { | ||
351 | dev_dbg(&desc->intf->dev, "Tx URB has been submitted index=%d", | ||
352 | req->wIndex); | ||
353 | } | ||
354 | out: | ||
355 | mutex_unlock(&desc->wlock); | ||
356 | outnl: | ||
357 | return rv < 0 ? rv : count; | ||
358 | } | ||
359 | |||
360 | static ssize_t wdm_read | ||
361 | (struct file *file, char __user *buffer, size_t count, loff_t *ppos) | ||
362 | { | ||
363 | int rv, cntr; | ||
364 | int i = 0; | ||
365 | struct wdm_device *desc = file->private_data; | ||
366 | |||
367 | |||
368 | rv = mutex_lock_interruptible(&desc->rlock); /*concurrent reads */ | ||
369 | if (rv < 0) | ||
370 | return -ERESTARTSYS; | ||
371 | |||
372 | if (desc->length == 0) { | ||
373 | desc->read = 0; | ||
374 | retry: | ||
375 | i++; | ||
376 | rv = wait_event_interruptible(desc->wait, | ||
377 | test_bit(WDM_READ, &desc->flags)); | ||
378 | |||
379 | if (rv < 0) { | ||
380 | rv = -ERESTARTSYS; | ||
381 | goto err; | ||
382 | } | ||
383 | |||
384 | spin_lock_irq(&desc->iuspin); | ||
385 | |||
386 | if (desc->rerr) { /* read completed, error happened */ | ||
387 | int t = desc->rerr; | ||
388 | desc->rerr = 0; | ||
389 | spin_unlock_irq(&desc->iuspin); | ||
390 | err("reading had resulted in %d", t); | ||
391 | rv = -EIO; | ||
392 | goto err; | ||
393 | } | ||
394 | /* | ||
395 | * recheck whether we've lost the race | ||
396 | * against the completion handler | ||
397 | */ | ||
398 | if (!test_bit(WDM_READ, &desc->flags)) { /* lost race */ | ||
399 | spin_unlock_irq(&desc->iuspin); | ||
400 | goto retry; | ||
401 | } | ||
402 | if (!desc->reslength) { /* zero length read */ | ||
403 | spin_unlock_irq(&desc->iuspin); | ||
404 | goto retry; | ||
405 | } | ||
406 | clear_bit(WDM_READ, &desc->flags); | ||
407 | spin_unlock_irq(&desc->iuspin); | ||
408 | } | ||
409 | |||
410 | cntr = count > desc->length ? desc->length : count; | ||
411 | rv = copy_to_user(buffer, desc->ubuf, cntr); | ||
412 | if (rv > 0) { | ||
413 | rv = -EFAULT; | ||
414 | goto err; | ||
415 | } | ||
416 | |||
417 | for (i = 0; i < desc->length - cntr; i++) | ||
418 | desc->ubuf[i] = desc->ubuf[i + cntr]; | ||
419 | |||
420 | desc->length -= cntr; | ||
421 | rv = cntr; | ||
422 | |||
423 | err: | ||
424 | mutex_unlock(&desc->rlock); | ||
425 | if (rv < 0) | ||
426 | err("wdm_read: exit error"); | ||
427 | return rv; | ||
428 | } | ||
429 | |||
430 | static int wdm_flush(struct file *file, fl_owner_t id) | ||
431 | { | ||
432 | struct wdm_device *desc = file->private_data; | ||
433 | |||
434 | wait_event(desc->wait, !test_bit(WDM_IN_USE, &desc->flags)); | ||
435 | if (desc->werr < 0) | ||
436 | err("Error in flush path: %d", desc->werr); | ||
437 | |||
438 | return desc->werr; | ||
439 | } | ||
440 | |||
441 | static unsigned int wdm_poll(struct file *file, struct poll_table_struct *wait) | ||
442 | { | ||
443 | struct wdm_device *desc = file->private_data; | ||
444 | unsigned long flags; | ||
445 | unsigned int mask = 0; | ||
446 | |||
447 | spin_lock_irqsave(&desc->iuspin, flags); | ||
448 | if (test_bit(WDM_DISCONNECTING, &desc->flags)) { | ||
449 | mask = POLLERR; | ||
450 | spin_unlock_irqrestore(&desc->iuspin, flags); | ||
451 | goto desc_out; | ||
452 | } | ||
453 | if (test_bit(WDM_READ, &desc->flags)) | ||
454 | mask = POLLIN | POLLRDNORM; | ||
455 | if (desc->rerr || desc->werr) | ||
456 | mask |= POLLERR; | ||
457 | if (!test_bit(WDM_IN_USE, &desc->flags)) | ||
458 | mask |= POLLOUT | POLLWRNORM; | ||
459 | spin_unlock_irqrestore(&desc->iuspin, flags); | ||
460 | |||
461 | poll_wait(file, &desc->wait, wait); | ||
462 | |||
463 | desc_out: | ||
464 | return mask; | ||
465 | } | ||
466 | |||
467 | static int wdm_open(struct inode *inode, struct file *file) | ||
468 | { | ||
469 | int minor = iminor(inode); | ||
470 | int rv = -ENODEV; | ||
471 | struct usb_interface *intf; | ||
472 | struct wdm_device *desc; | ||
473 | |||
474 | mutex_lock(&wdm_mutex); | ||
475 | intf = usb_find_interface(&wdm_driver, minor); | ||
476 | if (!intf) | ||
477 | goto out; | ||
478 | |||
479 | desc = usb_get_intfdata(intf); | ||
480 | if (test_bit(WDM_DISCONNECTING, &desc->flags)) | ||
481 | goto out; | ||
482 | |||
483 | desc->count++; | ||
484 | file->private_data = desc; | ||
485 | |||
486 | rv = usb_submit_urb(desc->validity, GFP_KERNEL); | ||
487 | |||
488 | if (rv < 0) { | ||
489 | desc->count--; | ||
490 | err("Error submitting int urb - %d", rv); | ||
491 | goto out; | ||
492 | } | ||
493 | rv = 0; | ||
494 | |||
495 | out: | ||
496 | mutex_unlock(&wdm_mutex); | ||
497 | return rv; | ||
498 | } | ||
499 | |||
500 | static int wdm_release(struct inode *inode, struct file *file) | ||
501 | { | ||
502 | struct wdm_device *desc = file->private_data; | ||
503 | |||
504 | mutex_lock(&wdm_mutex); | ||
505 | desc->count--; | ||
506 | if (!desc->count) { | ||
507 | dev_dbg(&desc->intf->dev, "wdm_release: cleanup"); | ||
508 | kill_urbs(desc); | ||
509 | } | ||
510 | mutex_unlock(&wdm_mutex); | ||
511 | return 0; | ||
512 | } | ||
513 | |||
514 | static const struct file_operations wdm_fops = { | ||
515 | .owner = THIS_MODULE, | ||
516 | .read = wdm_read, | ||
517 | .write = wdm_write, | ||
518 | .open = wdm_open, | ||
519 | .flush = wdm_flush, | ||
520 | .release = wdm_release, | ||
521 | .poll = wdm_poll | ||
522 | }; | ||
523 | |||
524 | static struct usb_class_driver wdm_class = { | ||
525 | .name = "cdc-wdm%d", | ||
526 | .fops = &wdm_fops, | ||
527 | .minor_base = WDM_MINOR_BASE, | ||
528 | }; | ||
529 | |||
530 | /* --- error handling --- */ | ||
531 | static void wdm_rxwork(struct work_struct *work) | ||
532 | { | ||
533 | struct wdm_device *desc = container_of(work, struct wdm_device, rxwork); | ||
534 | unsigned long flags; | ||
535 | int rv; | ||
536 | |||
537 | spin_lock_irqsave(&desc->iuspin, flags); | ||
538 | if (test_bit(WDM_DISCONNECTING, &desc->flags)) { | ||
539 | spin_unlock_irqrestore(&desc->iuspin, flags); | ||
540 | } else { | ||
541 | spin_unlock_irqrestore(&desc->iuspin, flags); | ||
542 | rv = usb_submit_urb(desc->response, GFP_KERNEL); | ||
543 | if (rv < 0 && rv != -EPERM) { | ||
544 | spin_lock_irqsave(&desc->iuspin, flags); | ||
545 | if (!test_bit(WDM_DISCONNECTING, &desc->flags)) | ||
546 | schedule_work(&desc->rxwork); | ||
547 | spin_unlock_irqrestore(&desc->iuspin, flags); | ||
548 | } | ||
549 | } | ||
550 | } | ||
551 | |||
552 | /* --- hotplug --- */ | ||
553 | |||
554 | static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id) | ||
555 | { | ||
556 | int rv = -EINVAL; | ||
557 | struct usb_device *udev = interface_to_usbdev(intf); | ||
558 | struct wdm_device *desc; | ||
559 | struct usb_host_interface *iface; | ||
560 | struct usb_endpoint_descriptor *ep; | ||
561 | struct usb_cdc_dmm_desc *dmhd; | ||
562 | u8 *buffer = intf->altsetting->extra; | ||
563 | int buflen = intf->altsetting->extralen; | ||
564 | u16 maxcom = 0; | ||
565 | |||
566 | if (!buffer) | ||
567 | goto out; | ||
568 | |||
569 | while (buflen > 0) { | ||
570 | if (buffer [1] != USB_DT_CS_INTERFACE) { | ||
571 | err("skipping garbage"); | ||
572 | goto next_desc; | ||
573 | } | ||
574 | |||
575 | switch (buffer [2]) { | ||
576 | case USB_CDC_HEADER_TYPE: | ||
577 | break; | ||
578 | case USB_CDC_DMM_TYPE: | ||
579 | dmhd = (struct usb_cdc_dmm_desc *)buffer; | ||
580 | maxcom = le16_to_cpu(dmhd->wMaxCommand); | ||
581 | dev_dbg(&intf->dev, | ||
582 | "Finding maximum buffer length: %d", maxcom); | ||
583 | break; | ||
584 | default: | ||
585 | err("Ignoring extra header, type %d, length %d", | ||
586 | buffer[2], buffer[0]); | ||
587 | break; | ||
588 | } | ||
589 | next_desc: | ||
590 | buflen -= buffer[0]; | ||
591 | buffer += buffer[0]; | ||
592 | } | ||
593 | |||
594 | rv = -ENOMEM; | ||
595 | desc = kzalloc(sizeof(struct wdm_device), GFP_KERNEL); | ||
596 | if (!desc) | ||
597 | goto out; | ||
598 | mutex_init(&desc->wlock); | ||
599 | mutex_init(&desc->rlock); | ||
600 | spin_lock_init(&desc->iuspin); | ||
601 | init_waitqueue_head(&desc->wait); | ||
602 | desc->wMaxCommand = maxcom; | ||
603 | desc->inum = cpu_to_le16((u16)intf->cur_altsetting->desc.bInterfaceNumber); | ||
604 | desc->intf = intf; | ||
605 | INIT_WORK(&desc->rxwork, wdm_rxwork); | ||
606 | |||
607 | iface = &intf->altsetting[0]; | ||
608 | ep = &iface->endpoint[0].desc; | ||
609 | if (!usb_endpoint_is_int_in(ep)) { | ||
610 | rv = -EINVAL; | ||
611 | goto err; | ||
612 | } | ||
613 | |||
614 | desc->wMaxPacketSize = ep->wMaxPacketSize; | ||
615 | desc->bMaxPacketSize0 = cpu_to_le16(udev->descriptor.bMaxPacketSize0); | ||
616 | |||
617 | desc->orq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); | ||
618 | if (!desc->orq) | ||
619 | goto err; | ||
620 | desc->irq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); | ||
621 | if (!desc->irq) | ||
622 | goto err; | ||
623 | |||
624 | desc->validity = usb_alloc_urb(0, GFP_KERNEL); | ||
625 | if (!desc->validity) | ||
626 | goto err; | ||
627 | |||
628 | desc->response = usb_alloc_urb(0, GFP_KERNEL); | ||
629 | if (!desc->response) | ||
630 | goto err; | ||
631 | |||
632 | desc->command = usb_alloc_urb(0, GFP_KERNEL); | ||
633 | if (!desc->command) | ||
634 | goto err; | ||
635 | |||
636 | desc->ubuf = kmalloc(desc->wMaxCommand, GFP_KERNEL); | ||
637 | if (!desc->ubuf) | ||
638 | goto err; | ||
639 | |||
640 | desc->sbuf = usb_buffer_alloc(interface_to_usbdev(intf), | ||
641 | desc->wMaxPacketSize, | ||
642 | GFP_KERNEL, | ||
643 | &desc->validity->transfer_dma); | ||
644 | if (!desc->sbuf) | ||
645 | goto err; | ||
646 | |||
647 | desc->inbuf = usb_buffer_alloc(interface_to_usbdev(intf), | ||
648 | desc->bMaxPacketSize0, | ||
649 | GFP_KERNEL, | ||
650 | &desc->response->transfer_dma); | ||
651 | if (!desc->inbuf) | ||
652 | goto err2; | ||
653 | |||
654 | usb_fill_int_urb( | ||
655 | desc->validity, | ||
656 | interface_to_usbdev(intf), | ||
657 | usb_rcvintpipe(interface_to_usbdev(intf), ep->bEndpointAddress), | ||
658 | desc->sbuf, | ||
659 | desc->wMaxPacketSize, | ||
660 | wdm_int_callback, | ||
661 | desc, | ||
662 | ep->bInterval | ||
663 | ); | ||
664 | desc->validity->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
665 | |||
666 | usb_set_intfdata(intf, desc); | ||
667 | rv = usb_register_dev(intf, &wdm_class); | ||
668 | dev_info(&intf->dev, "cdc-wdm%d: USB WDM device\n", | ||
669 | intf->minor - WDM_MINOR_BASE); | ||
670 | if (rv < 0) | ||
671 | goto err; | ||
672 | out: | ||
673 | return rv; | ||
674 | err2: | ||
675 | usb_buffer_free(interface_to_usbdev(desc->intf), | ||
676 | desc->wMaxPacketSize, | ||
677 | desc->sbuf, | ||
678 | desc->validity->transfer_dma); | ||
679 | err: | ||
680 | free_urbs(desc); | ||
681 | kfree(desc->ubuf); | ||
682 | kfree(desc->orq); | ||
683 | kfree(desc->irq); | ||
684 | kfree(desc); | ||
685 | return rv; | ||
686 | } | ||
687 | |||
688 | static void wdm_disconnect(struct usb_interface *intf) | ||
689 | { | ||
690 | struct wdm_device *desc; | ||
691 | unsigned long flags; | ||
692 | |||
693 | usb_deregister_dev(intf, &wdm_class); | ||
694 | mutex_lock(&wdm_mutex); | ||
695 | desc = usb_get_intfdata(intf); | ||
696 | |||
697 | /* the spinlock makes sure no new urbs are generated in the callbacks */ | ||
698 | spin_lock_irqsave(&desc->iuspin, flags); | ||
699 | set_bit(WDM_DISCONNECTING, &desc->flags); | ||
700 | set_bit(WDM_READ, &desc->flags); | ||
701 | clear_bit(WDM_IN_USE, &desc->flags); | ||
702 | spin_unlock_irqrestore(&desc->iuspin, flags); | ||
703 | cancel_work_sync(&desc->rxwork); | ||
704 | kill_urbs(desc); | ||
705 | wake_up_all(&desc->wait); | ||
706 | if (!desc->count) | ||
707 | cleanup(desc); | ||
708 | mutex_unlock(&wdm_mutex); | ||
709 | } | ||
710 | |||
711 | static struct usb_driver wdm_driver = { | ||
712 | .name = "cdc_wdm", | ||
713 | .probe = wdm_probe, | ||
714 | .disconnect = wdm_disconnect, | ||
715 | .id_table = wdm_ids, | ||
716 | }; | ||
717 | |||
718 | /* --- low level module stuff --- */ | ||
719 | |||
720 | static int __init wdm_init(void) | ||
721 | { | ||
722 | int rv; | ||
723 | |||
724 | rv = usb_register(&wdm_driver); | ||
725 | |||
726 | return rv; | ||
727 | } | ||
728 | |||
729 | static void __exit wdm_exit(void) | ||
730 | { | ||
731 | usb_deregister(&wdm_driver); | ||
732 | } | ||
733 | |||
734 | module_init(wdm_init); | ||
735 | module_exit(wdm_exit); | ||
736 | |||
737 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
738 | MODULE_DESCRIPTION("USB Abstract Control Model driver for " | ||
739 | "USB WCM Device Management"); | ||
740 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c index c1cb94e9f242..7e912f21fd36 100644 --- a/drivers/usb/core/generic.c +++ b/drivers/usb/core/generic.c | |||
@@ -155,9 +155,6 @@ static int generic_probe(struct usb_device *udev) | |||
155 | { | 155 | { |
156 | int err, c; | 156 | int err, c; |
157 | 157 | ||
158 | /* put device-specific files into sysfs */ | ||
159 | usb_create_sysfs_dev_files(udev); | ||
160 | |||
161 | /* Choose and set the configuration. This registers the interfaces | 158 | /* Choose and set the configuration. This registers the interfaces |
162 | * with the driver core and lets interface drivers bind to them. | 159 | * with the driver core and lets interface drivers bind to them. |
163 | */ | 160 | */ |
@@ -189,8 +186,6 @@ static void generic_disconnect(struct usb_device *udev) | |||
189 | * unconfigure the device */ | 186 | * unconfigure the device */ |
190 | if (udev->actconfig) | 187 | if (udev->actconfig) |
191 | usb_set_configuration(udev, -1); | 188 | usb_set_configuration(udev, -1); |
192 | |||
193 | usb_remove_sysfs_dev_files(udev); | ||
194 | } | 189 | } |
195 | 190 | ||
196 | #ifdef CONFIG_PM | 191 | #ifdef CONFIG_PM |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index bf10e9c4195e..09a53e7f3327 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -818,12 +818,12 @@ static int usb_register_bus(struct usb_bus *bus) | |||
818 | set_bit (busnum, busmap.busmap); | 818 | set_bit (busnum, busmap.busmap); |
819 | bus->busnum = busnum; | 819 | bus->busnum = busnum; |
820 | 820 | ||
821 | bus->dev = device_create(usb_host_class, bus->controller, MKDEV(0, 0), | 821 | bus->dev = device_create_drvdata(usb_host_class, bus->controller, |
822 | "usb_host%d", busnum); | 822 | MKDEV(0, 0), bus, |
823 | "usb_host%d", busnum); | ||
823 | result = PTR_ERR(bus->dev); | 824 | result = PTR_ERR(bus->dev); |
824 | if (IS_ERR(bus->dev)) | 825 | if (IS_ERR(bus->dev)) |
825 | goto error_create_class_dev; | 826 | goto error_create_class_dev; |
826 | dev_set_drvdata(bus->dev, bus); | ||
827 | 827 | ||
828 | /* Add it to the local list of buses */ | 828 | /* Add it to the local list of buses */ |
829 | list_add (&bus->bus_list, &usb_bus_list); | 829 | list_add (&bus->bus_list, &usb_bus_list); |
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index 1e4b81e9eb50..a0bf5df6cb6f 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
@@ -213,6 +213,8 @@ struct hc_driver { | |||
213 | 213 | ||
214 | /* force handover of high-speed port to full-speed companion */ | 214 | /* force handover of high-speed port to full-speed companion */ |
215 | void (*relinquish_port)(struct usb_hcd *, int); | 215 | void (*relinquish_port)(struct usb_hcd *, int); |
216 | /* has a port been handed over to a companion? */ | ||
217 | int (*port_handed_over)(struct usb_hcd *, int); | ||
216 | }; | 218 | }; |
217 | 219 | ||
218 | extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); | 220 | extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index eb57fcc701d7..8eb4da332f56 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1326,6 +1326,12 @@ void usb_disconnect(struct usb_device **pdev) | |||
1326 | 1326 | ||
1327 | usb_unlock_device(udev); | 1327 | usb_unlock_device(udev); |
1328 | 1328 | ||
1329 | /* Remove the device-specific files from sysfs. This must be | ||
1330 | * done with udev unlocked, because some of the attribute | ||
1331 | * routines try to acquire the device lock. | ||
1332 | */ | ||
1333 | usb_remove_sysfs_dev_files(udev); | ||
1334 | |||
1329 | /* Unregister the device. The device driver is responsible | 1335 | /* Unregister the device. The device driver is responsible |
1330 | * for removing the device files from usbfs and sysfs and for | 1336 | * for removing the device files from usbfs and sysfs and for |
1331 | * de-configuring the device. | 1337 | * de-configuring the device. |
@@ -1541,6 +1547,9 @@ int usb_new_device(struct usb_device *udev) | |||
1541 | goto fail; | 1547 | goto fail; |
1542 | } | 1548 | } |
1543 | 1549 | ||
1550 | /* put device-specific files into sysfs */ | ||
1551 | usb_create_sysfs_dev_files(udev); | ||
1552 | |||
1544 | /* Tell the world! */ | 1553 | /* Tell the world! */ |
1545 | announce_device(udev); | 1554 | announce_device(udev); |
1546 | return err; | 1555 | return err; |
@@ -2744,7 +2753,11 @@ loop: | |||
2744 | if ((status == -ENOTCONN) || (status == -ENOTSUPP)) | 2753 | if ((status == -ENOTCONN) || (status == -ENOTSUPP)) |
2745 | break; | 2754 | break; |
2746 | } | 2755 | } |
2747 | dev_err(hub_dev, "unable to enumerate USB device on port %d\n", port1); | 2756 | if (hub->hdev->parent || |
2757 | !hcd->driver->port_handed_over || | ||
2758 | !(hcd->driver->port_handed_over)(hcd, port1)) | ||
2759 | dev_err(hub_dev, "unable to enumerate USB device on port %d\n", | ||
2760 | port1); | ||
2748 | 2761 | ||
2749 | done: | 2762 | done: |
2750 | hub_port_disable(hub, port1, 1); | 2763 | hub_port_disable(hub, port1, 1); |
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 2e2019390290..3da1ab4b389d 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -47,6 +47,10 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
47 | /* Edirol SD-20 */ | 47 | /* Edirol SD-20 */ |
48 | { USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME }, | 48 | { USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME }, |
49 | 49 | ||
50 | /* Avision AV600U */ | ||
51 | { USB_DEVICE(0x0638, 0x0a13), .driver_info = | ||
52 | USB_QUIRK_STRING_FETCH_255 }, | ||
53 | |||
50 | /* M-Systems Flash Disk Pioneers */ | 54 | /* M-Systems Flash Disk Pioneers */ |
51 | { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, | 55 | { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, |
52 | 56 | ||
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index c783cb111847..5e1f5d55bf04 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c | |||
@@ -588,35 +588,33 @@ read_descriptors(struct kobject *kobj, struct bin_attribute *attr, | |||
588 | container_of(kobj, struct device, kobj)); | 588 | container_of(kobj, struct device, kobj)); |
589 | size_t nleft = count; | 589 | size_t nleft = count; |
590 | size_t srclen, n; | 590 | size_t srclen, n; |
591 | int cfgno; | ||
592 | void *src; | ||
591 | 593 | ||
592 | usb_lock_device(udev); | 594 | /* The binary attribute begins with the device descriptor. |
593 | 595 | * Following that are the raw descriptor entries for all the | |
594 | /* The binary attribute begins with the device descriptor */ | 596 | * configurations (config plus subsidiary descriptors). |
595 | srclen = sizeof(struct usb_device_descriptor); | ||
596 | if (off < srclen) { | ||
597 | n = min_t(size_t, nleft, srclen - off); | ||
598 | memcpy(buf, off + (char *) &udev->descriptor, n); | ||
599 | nleft -= n; | ||
600 | buf += n; | ||
601 | off = 0; | ||
602 | } else { | ||
603 | off -= srclen; | ||
604 | } | ||
605 | |||
606 | /* Then follows the raw descriptor entry for the current | ||
607 | * configuration (config plus subsidiary descriptors). | ||
608 | */ | 597 | */ |
609 | if (udev->actconfig) { | 598 | for (cfgno = -1; cfgno < udev->descriptor.bNumConfigurations && |
610 | int cfgno = udev->actconfig - udev->config; | 599 | nleft > 0; ++cfgno) { |
611 | 600 | if (cfgno < 0) { | |
612 | srclen = __le16_to_cpu(udev->actconfig->desc.wTotalLength); | 601 | src = &udev->descriptor; |
602 | srclen = sizeof(struct usb_device_descriptor); | ||
603 | } else { | ||
604 | src = udev->rawdescriptors[cfgno]; | ||
605 | srclen = __le16_to_cpu(udev->config[cfgno].desc. | ||
606 | wTotalLength); | ||
607 | } | ||
613 | if (off < srclen) { | 608 | if (off < srclen) { |
614 | n = min_t(size_t, nleft, srclen - off); | 609 | n = min(nleft, srclen - (size_t) off); |
615 | memcpy(buf, off + udev->rawdescriptors[cfgno], n); | 610 | memcpy(buf, src + off, n); |
616 | nleft -= n; | 611 | nleft -= n; |
612 | buf += n; | ||
613 | off = 0; | ||
614 | } else { | ||
615 | off -= srclen; | ||
617 | } | 616 | } |
618 | } | 617 | } |
619 | usb_unlock_device(udev); | ||
620 | return count - nleft; | 618 | return count - nleft; |
621 | } | 619 | } |
622 | 620 | ||
diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c index 651b82701394..18687543d7fa 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.c +++ b/drivers/usb/gadget/fsl_usb2_udc.c | |||
@@ -1627,7 +1627,9 @@ static int reset_queues(struct fsl_udc *udc) | |||
1627 | udc_reset_ep_queue(udc, pipe); | 1627 | udc_reset_ep_queue(udc, pipe); |
1628 | 1628 | ||
1629 | /* report disconnect; the driver is already quiesced */ | 1629 | /* report disconnect; the driver is already quiesced */ |
1630 | spin_unlock(&udc->lock); | ||
1630 | udc->driver->disconnect(&udc->gadget); | 1631 | udc->driver->disconnect(&udc->gadget); |
1632 | spin_lock(&udc->lock); | ||
1631 | 1633 | ||
1632 | return 0; | 1634 | return 0; |
1633 | } | 1635 | } |
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index 499b7a23f351..e02bfd4df3a6 100644 --- a/drivers/usb/gadget/pxa27x_udc.c +++ b/drivers/usb/gadget/pxa27x_udc.c | |||
@@ -1526,7 +1526,8 @@ static void udc_disable(struct pxa_udc *udc) | |||
1526 | 1526 | ||
1527 | ep0_idle(udc); | 1527 | ep0_idle(udc); |
1528 | udc->gadget.speed = USB_SPEED_UNKNOWN; | 1528 | udc->gadget.speed = USB_SPEED_UNKNOWN; |
1529 | udc->mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT); | 1529 | if (udc->mach->udc_command) |
1530 | udc->mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT); | ||
1530 | } | 1531 | } |
1531 | 1532 | ||
1532 | /** | 1533 | /** |
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c index 8b5f991e949c..08a4335401a9 100644 --- a/drivers/usb/host/ehci-au1xxx.c +++ b/drivers/usb/host/ehci-au1xxx.c | |||
@@ -223,6 +223,7 @@ static const struct hc_driver ehci_au1xxx_hc_driver = { | |||
223 | .bus_suspend = ehci_bus_suspend, | 223 | .bus_suspend = ehci_bus_suspend, |
224 | .bus_resume = ehci_bus_resume, | 224 | .bus_resume = ehci_bus_resume, |
225 | .relinquish_port = ehci_relinquish_port, | 225 | .relinquish_port = ehci_relinquish_port, |
226 | .port_handed_over = ehci_port_handed_over, | ||
226 | }; | 227 | }; |
227 | 228 | ||
228 | /*-------------------------------------------------------------------------*/ | 229 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 6d9bed6c1f48..7370d6187c64 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
@@ -269,7 +269,7 @@ static int ehci_fsl_setup(struct usb_hcd *hcd) | |||
269 | if (retval) | 269 | if (retval) |
270 | return retval; | 270 | return retval; |
271 | 271 | ||
272 | ehci->is_tdi_rh_tt = 1; | 272 | hcd->has_tt = 1; |
273 | 273 | ||
274 | ehci->sbrn = 0x20; | 274 | ehci->sbrn = 0x20; |
275 | 275 | ||
@@ -295,10 +295,6 @@ static const struct hc_driver ehci_fsl_hc_driver = { | |||
295 | */ | 295 | */ |
296 | .reset = ehci_fsl_setup, | 296 | .reset = ehci_fsl_setup, |
297 | .start = ehci_run, | 297 | .start = ehci_run, |
298 | #ifdef CONFIG_PM | ||
299 | .suspend = ehci_bus_suspend, | ||
300 | .resume = ehci_bus_resume, | ||
301 | #endif | ||
302 | .stop = ehci_stop, | 298 | .stop = ehci_stop, |
303 | .shutdown = ehci_shutdown, | 299 | .shutdown = ehci_shutdown, |
304 | 300 | ||
@@ -322,6 +318,7 @@ static const struct hc_driver ehci_fsl_hc_driver = { | |||
322 | .bus_suspend = ehci_bus_suspend, | 318 | .bus_suspend = ehci_bus_suspend, |
323 | .bus_resume = ehci_bus_resume, | 319 | .bus_resume = ehci_bus_resume, |
324 | .relinquish_port = ehci_relinquish_port, | 320 | .relinquish_port = ehci_relinquish_port, |
321 | .port_handed_over = ehci_port_handed_over, | ||
325 | }; | 322 | }; |
326 | 323 | ||
327 | static int ehci_fsl_drv_probe(struct platform_device *pdev) | 324 | static int ehci_fsl_drv_probe(struct platform_device *pdev) |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 382587c4457c..740835bb8575 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -609,7 +609,7 @@ static int ehci_hub_control ( | |||
609 | } | 609 | } |
610 | break; | 610 | break; |
611 | case USB_PORT_FEAT_C_SUSPEND: | 611 | case USB_PORT_FEAT_C_SUSPEND: |
612 | /* we auto-clear this feature */ | 612 | clear_bit(wIndex, &ehci->port_c_suspend); |
613 | break; | 613 | break; |
614 | case USB_PORT_FEAT_POWER: | 614 | case USB_PORT_FEAT_POWER: |
615 | if (HCS_PPC (ehci->hcs_params)) | 615 | if (HCS_PPC (ehci->hcs_params)) |
@@ -688,7 +688,7 @@ static int ehci_hub_control ( | |||
688 | /* resume completed? */ | 688 | /* resume completed? */ |
689 | else if (time_after_eq(jiffies, | 689 | else if (time_after_eq(jiffies, |
690 | ehci->reset_done[wIndex])) { | 690 | ehci->reset_done[wIndex])) { |
691 | status |= 1 << USB_PORT_FEAT_C_SUSPEND; | 691 | set_bit(wIndex, &ehci->port_c_suspend); |
692 | ehci->reset_done[wIndex] = 0; | 692 | ehci->reset_done[wIndex] = 0; |
693 | 693 | ||
694 | /* stop resume signaling */ | 694 | /* stop resume signaling */ |
@@ -765,6 +765,8 @@ static int ehci_hub_control ( | |||
765 | status |= 1 << USB_PORT_FEAT_RESET; | 765 | status |= 1 << USB_PORT_FEAT_RESET; |
766 | if (temp & PORT_POWER) | 766 | if (temp & PORT_POWER) |
767 | status |= 1 << USB_PORT_FEAT_POWER; | 767 | status |= 1 << USB_PORT_FEAT_POWER; |
768 | if (test_bit(wIndex, &ehci->port_c_suspend)) | ||
769 | status |= 1 << USB_PORT_FEAT_C_SUSPEND; | ||
768 | 770 | ||
769 | #ifndef VERBOSE_DEBUG | 771 | #ifndef VERBOSE_DEBUG |
770 | if (status & ~0xffff) /* only if wPortChange is interesting */ | 772 | if (status & ~0xffff) /* only if wPortChange is interesting */ |
@@ -875,3 +877,13 @@ static void ehci_relinquish_port(struct usb_hcd *hcd, int portnum) | |||
875 | set_owner(ehci, --portnum, PORT_OWNER); | 877 | set_owner(ehci, --portnum, PORT_OWNER); |
876 | } | 878 | } |
877 | 879 | ||
880 | static int ehci_port_handed_over(struct usb_hcd *hcd, int portnum) | ||
881 | { | ||
882 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
883 | u32 __iomem *reg; | ||
884 | |||
885 | if (ehci_is_TDI(ehci)) | ||
886 | return 0; | ||
887 | reg = &ehci->regs->port_status[portnum - 1]; | ||
888 | return ehci_readl(ehci, reg) & PORT_OWNER; | ||
889 | } | ||
diff --git a/drivers/usb/host/ehci-ixp4xx.c b/drivers/usb/host/ehci-ixp4xx.c index 601c8795a854..9d042f220097 100644 --- a/drivers/usb/host/ehci-ixp4xx.c +++ b/drivers/usb/host/ehci-ixp4xx.c | |||
@@ -26,7 +26,7 @@ static int ixp4xx_ehci_init(struct usb_hcd *hcd) | |||
26 | + HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); | 26 | + HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); |
27 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); | 27 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); |
28 | 28 | ||
29 | ehci->is_tdi_rh_tt = 1; | 29 | hcd->has_tt = 1; |
30 | ehci_reset(ehci); | 30 | ehci_reset(ehci); |
31 | 31 | ||
32 | retval = ehci_init(hcd); | 32 | retval = ehci_init(hcd); |
@@ -58,6 +58,8 @@ static const struct hc_driver ixp4xx_ehci_hc_driver = { | |||
58 | .bus_suspend = ehci_bus_suspend, | 58 | .bus_suspend = ehci_bus_suspend, |
59 | .bus_resume = ehci_bus_resume, | 59 | .bus_resume = ehci_bus_resume, |
60 | #endif | 60 | #endif |
61 | .relinquish_port = ehci_relinquish_port, | ||
62 | .port_handed_over = ehci_port_handed_over, | ||
61 | }; | 63 | }; |
62 | 64 | ||
63 | static int ixp4xx_ehci_probe(struct platform_device *pdev) | 65 | static int ixp4xx_ehci_probe(struct platform_device *pdev) |
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index d187d0313742..ab625f0ba1d9 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c | |||
@@ -115,6 +115,8 @@ static int ehci_orion_setup(struct usb_hcd *hcd) | |||
115 | if (retval) | 115 | if (retval) |
116 | return retval; | 116 | return retval; |
117 | 117 | ||
118 | hcd->has_tt = 1; | ||
119 | |||
118 | ehci_reset(ehci); | 120 | ehci_reset(ehci); |
119 | ehci_port_power(ehci, 0); | 121 | ehci_port_power(ehci, 0); |
120 | 122 | ||
@@ -137,10 +139,6 @@ static const struct hc_driver ehci_orion_hc_driver = { | |||
137 | */ | 139 | */ |
138 | .reset = ehci_orion_setup, | 140 | .reset = ehci_orion_setup, |
139 | .start = ehci_run, | 141 | .start = ehci_run, |
140 | #ifdef CONFIG_PM | ||
141 | .suspend = ehci_bus_suspend, | ||
142 | .resume = ehci_bus_resume, | ||
143 | #endif | ||
144 | .stop = ehci_stop, | 142 | .stop = ehci_stop, |
145 | .shutdown = ehci_shutdown, | 143 | .shutdown = ehci_shutdown, |
146 | 144 | ||
@@ -163,6 +161,8 @@ static const struct hc_driver ehci_orion_hc_driver = { | |||
163 | .hub_control = ehci_hub_control, | 161 | .hub_control = ehci_hub_control, |
164 | .bus_suspend = ehci_bus_suspend, | 162 | .bus_suspend = ehci_bus_suspend, |
165 | .bus_resume = ehci_bus_resume, | 163 | .bus_resume = ehci_bus_resume, |
164 | .relinquish_port = ehci_relinquish_port, | ||
165 | .port_handed_over = ehci_port_handed_over, | ||
166 | }; | 166 | }; |
167 | 167 | ||
168 | static void __init | 168 | static void __init |
@@ -248,7 +248,7 @@ static int __init ehci_orion_drv_probe(struct platform_device *pdev) | |||
248 | ehci->regs = hcd->regs + 0x100 + | 248 | ehci->regs = hcd->regs + 0x100 + |
249 | HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); | 249 | HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); |
250 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); | 250 | ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); |
251 | ehci->is_tdi_rh_tt = 1; | 251 | hcd->has_tt = 1; |
252 | ehci->sbrn = 0x20; | 252 | ehci->sbrn = 0x20; |
253 | 253 | ||
254 | /* | 254 | /* |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 5bb7f6bb13f3..c46a58f9181d 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -129,7 +129,6 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
129 | switch (pdev->vendor) { | 129 | switch (pdev->vendor) { |
130 | case PCI_VENDOR_ID_TDI: | 130 | case PCI_VENDOR_ID_TDI: |
131 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { | 131 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { |
132 | ehci->is_tdi_rh_tt = 1; | ||
133 | hcd->has_tt = 1; | 132 | hcd->has_tt = 1; |
134 | tdi_reset(ehci); | 133 | tdi_reset(ehci); |
135 | } | 134 | } |
@@ -379,7 +378,8 @@ static const struct hc_driver ehci_pci_hc_driver = { | |||
379 | .hub_control = ehci_hub_control, | 378 | .hub_control = ehci_hub_control, |
380 | .bus_suspend = ehci_bus_suspend, | 379 | .bus_suspend = ehci_bus_suspend, |
381 | .bus_resume = ehci_bus_resume, | 380 | .bus_resume = ehci_bus_resume, |
382 | .relinquish_port = ehci_relinquish_port, | 381 | .relinquish_port = ehci_relinquish_port, |
382 | .port_handed_over = ehci_port_handed_over, | ||
383 | }; | 383 | }; |
384 | 384 | ||
385 | /*-------------------------------------------------------------------------*/ | 385 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c index ee305b1f99ff..b018deed2e8f 100644 --- a/drivers/usb/host/ehci-ppc-of.c +++ b/drivers/usb/host/ehci-ppc-of.c | |||
@@ -76,6 +76,8 @@ static const struct hc_driver ehci_ppc_of_hc_driver = { | |||
76 | .bus_suspend = ehci_bus_suspend, | 76 | .bus_suspend = ehci_bus_suspend, |
77 | .bus_resume = ehci_bus_resume, | 77 | .bus_resume = ehci_bus_resume, |
78 | #endif | 78 | #endif |
79 | .relinquish_port = ehci_relinquish_port, | ||
80 | .port_handed_over = ehci_port_handed_over, | ||
79 | }; | 81 | }; |
80 | 82 | ||
81 | 83 | ||
diff --git a/drivers/usb/host/ehci-ppc-soc.c b/drivers/usb/host/ehci-ppc-soc.c index 6c76036783a1..529590eb4037 100644 --- a/drivers/usb/host/ehci-ppc-soc.c +++ b/drivers/usb/host/ehci-ppc-soc.c | |||
@@ -163,6 +163,7 @@ static const struct hc_driver ehci_ppc_soc_hc_driver = { | |||
163 | .bus_suspend = ehci_bus_suspend, | 163 | .bus_suspend = ehci_bus_suspend, |
164 | .bus_resume = ehci_bus_resume, | 164 | .bus_resume = ehci_bus_resume, |
165 | .relinquish_port = ehci_relinquish_port, | 165 | .relinquish_port = ehci_relinquish_port, |
166 | .port_handed_over = ehci_port_handed_over, | ||
166 | }; | 167 | }; |
167 | 168 | ||
168 | static int ehci_hcd_ppc_soc_drv_probe(struct platform_device *pdev) | 169 | static int ehci_hcd_ppc_soc_drv_probe(struct platform_device *pdev) |
diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c index 69782221bcf3..37e6abeb794c 100644 --- a/drivers/usb/host/ehci-ps3.c +++ b/drivers/usb/host/ehci-ps3.c | |||
@@ -73,6 +73,7 @@ static const struct hc_driver ps3_ehci_hc_driver = { | |||
73 | .bus_resume = ehci_bus_resume, | 73 | .bus_resume = ehci_bus_resume, |
74 | #endif | 74 | #endif |
75 | .relinquish_port = ehci_relinquish_port, | 75 | .relinquish_port = ehci_relinquish_port, |
76 | .port_handed_over = ehci_port_handed_over, | ||
76 | }; | 77 | }; |
77 | 78 | ||
78 | static int ps3_ehci_probe(struct ps3_system_bus_device *dev) | 79 | static int ps3_ehci_probe(struct ps3_system_bus_device *dev) |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index be575e46eac3..b7853c8bac0f 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -1349,18 +1349,27 @@ iso_stream_schedule ( | |||
1349 | /* when's the last uframe this urb could start? */ | 1349 | /* when's the last uframe this urb could start? */ |
1350 | max = now + mod; | 1350 | max = now + mod; |
1351 | 1351 | ||
1352 | /* typical case: reuse current schedule. stream is still active, | 1352 | /* Typical case: reuse current schedule, stream is still active. |
1353 | * and no gaps from host falling behind (irq delays etc) | 1353 | * Hopefully there are no gaps from the host falling behind |
1354 | * (irq delays etc), but if there are we'll take the next | ||
1355 | * slot in the schedule, implicitly assuming URB_ISO_ASAP. | ||
1354 | */ | 1356 | */ |
1355 | if (likely (!list_empty (&stream->td_list))) { | 1357 | if (likely (!list_empty (&stream->td_list))) { |
1356 | start = stream->next_uframe; | 1358 | start = stream->next_uframe; |
1357 | if (start < now) | 1359 | if (start < now) |
1358 | start += mod; | 1360 | start += mod; |
1359 | if (likely ((start + sched->span) < max)) | 1361 | |
1360 | goto ready; | 1362 | /* Fell behind (by up to twice the slop amount)? */ |
1361 | /* else fell behind; someday, try to reschedule */ | 1363 | if (start >= max - 2 * 8 * SCHEDULE_SLOP) |
1362 | status = -EL2NSYNC; | 1364 | start += stream->interval * DIV_ROUND_UP( |
1363 | goto fail; | 1365 | max - start, stream->interval) - mod; |
1366 | |||
1367 | /* Tried to schedule too far into the future? */ | ||
1368 | if (unlikely((start + sched->span) >= max)) { | ||
1369 | status = -EFBIG; | ||
1370 | goto fail; | ||
1371 | } | ||
1372 | goto ready; | ||
1364 | } | 1373 | } |
1365 | 1374 | ||
1366 | /* need to schedule; when's the next (u)frame we could start? | 1375 | /* need to schedule; when's the next (u)frame we could start? |
@@ -1613,6 +1622,9 @@ itd_complete ( | |||
1613 | } else if (likely ((t & EHCI_ISOC_ACTIVE) == 0)) { | 1622 | } else if (likely ((t & EHCI_ISOC_ACTIVE) == 0)) { |
1614 | desc->status = 0; | 1623 | desc->status = 0; |
1615 | desc->actual_length = EHCI_ITD_LENGTH (t); | 1624 | desc->actual_length = EHCI_ITD_LENGTH (t); |
1625 | } else { | ||
1626 | /* URB was too late */ | ||
1627 | desc->status = -EXDEV; | ||
1616 | } | 1628 | } |
1617 | } | 1629 | } |
1618 | 1630 | ||
@@ -2095,7 +2107,7 @@ done: | |||
2095 | static void | 2107 | static void |
2096 | scan_periodic (struct ehci_hcd *ehci) | 2108 | scan_periodic (struct ehci_hcd *ehci) |
2097 | { | 2109 | { |
2098 | unsigned frame, clock, now_uframe, mod; | 2110 | unsigned now_uframe, frame, clock, clock_frame, mod; |
2099 | unsigned modified; | 2111 | unsigned modified; |
2100 | 2112 | ||
2101 | mod = ehci->periodic_size << 3; | 2113 | mod = ehci->periodic_size << 3; |
@@ -2111,6 +2123,7 @@ scan_periodic (struct ehci_hcd *ehci) | |||
2111 | else | 2123 | else |
2112 | clock = now_uframe + mod - 1; | 2124 | clock = now_uframe + mod - 1; |
2113 | clock %= mod; | 2125 | clock %= mod; |
2126 | clock_frame = clock >> 3; | ||
2114 | 2127 | ||
2115 | for (;;) { | 2128 | for (;;) { |
2116 | union ehci_shadow q, *q_p; | 2129 | union ehci_shadow q, *q_p; |
@@ -2157,22 +2170,26 @@ restart: | |||
2157 | case Q_TYPE_ITD: | 2170 | case Q_TYPE_ITD: |
2158 | /* If this ITD is still active, leave it for | 2171 | /* If this ITD is still active, leave it for |
2159 | * later processing ... check the next entry. | 2172 | * later processing ... check the next entry. |
2173 | * No need to check for activity unless the | ||
2174 | * frame is current. | ||
2160 | */ | 2175 | */ |
2161 | rmb (); | 2176 | if (frame == clock_frame && live) { |
2162 | for (uf = 0; uf < 8 && live; uf++) { | 2177 | rmb(); |
2163 | if (0 == (q.itd->hw_transaction [uf] | 2178 | for (uf = 0; uf < 8; uf++) { |
2164 | & ITD_ACTIVE(ehci))) | 2179 | if (q.itd->hw_transaction[uf] & |
2165 | continue; | 2180 | ITD_ACTIVE(ehci)) |
2166 | incomplete = true; | 2181 | break; |
2167 | q_p = &q.itd->itd_next; | 2182 | } |
2168 | hw_p = &q.itd->hw_next; | 2183 | if (uf < 8) { |
2169 | type = Q_NEXT_TYPE(ehci, | 2184 | incomplete = true; |
2185 | q_p = &q.itd->itd_next; | ||
2186 | hw_p = &q.itd->hw_next; | ||
2187 | type = Q_NEXT_TYPE(ehci, | ||
2170 | q.itd->hw_next); | 2188 | q.itd->hw_next); |
2171 | q = *q_p; | 2189 | q = *q_p; |
2172 | break; | 2190 | break; |
2191 | } | ||
2173 | } | 2192 | } |
2174 | if (uf < 8 && live) | ||
2175 | break; | ||
2176 | 2193 | ||
2177 | /* Take finished ITDs out of the schedule | 2194 | /* Take finished ITDs out of the schedule |
2178 | * and process them: recycle, maybe report | 2195 | * and process them: recycle, maybe report |
@@ -2189,9 +2206,12 @@ restart: | |||
2189 | case Q_TYPE_SITD: | 2206 | case Q_TYPE_SITD: |
2190 | /* If this SITD is still active, leave it for | 2207 | /* If this SITD is still active, leave it for |
2191 | * later processing ... check the next entry. | 2208 | * later processing ... check the next entry. |
2209 | * No need to check for activity unless the | ||
2210 | * frame is current. | ||
2192 | */ | 2211 | */ |
2193 | if ((q.sitd->hw_results & SITD_ACTIVE(ehci)) | 2212 | if (frame == clock_frame && live && |
2194 | && live) { | 2213 | (q.sitd->hw_results & |
2214 | SITD_ACTIVE(ehci))) { | ||
2195 | incomplete = true; | 2215 | incomplete = true; |
2196 | q_p = &q.sitd->sitd_next; | 2216 | q_p = &q.sitd->sitd_next; |
2197 | hw_p = &q.sitd->hw_next; | 2217 | hw_p = &q.sitd->hw_next; |
@@ -2260,6 +2280,7 @@ restart: | |||
2260 | 2280 | ||
2261 | /* rescan the rest of this frame, then ... */ | 2281 | /* rescan the rest of this frame, then ... */ |
2262 | clock = now; | 2282 | clock = now; |
2283 | clock_frame = clock >> 3; | ||
2263 | } else { | 2284 | } else { |
2264 | now_uframe++; | 2285 | now_uframe++; |
2265 | now_uframe %= mod; | 2286 | now_uframe %= mod; |
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index bf92d209a1a9..35a03095757e 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -97,6 +97,8 @@ struct ehci_hcd { /* one per controller */ | |||
97 | dedicated to the companion controller */ | 97 | dedicated to the companion controller */ |
98 | unsigned long owned_ports; /* which ports are | 98 | unsigned long owned_ports; /* which ports are |
99 | owned by the companion during a bus suspend */ | 99 | owned by the companion during a bus suspend */ |
100 | unsigned long port_c_suspend; /* which ports have | ||
101 | the change-suspend feature turned on */ | ||
100 | 102 | ||
101 | /* per-HC memory pools (could be per-bus, but ...) */ | 103 | /* per-HC memory pools (could be per-bus, but ...) */ |
102 | struct dma_pool *qh_pool; /* qh per active urb */ | 104 | struct dma_pool *qh_pool; /* qh per active urb */ |
@@ -112,7 +114,6 @@ struct ehci_hcd { /* one per controller */ | |||
112 | u32 command; | 114 | u32 command; |
113 | 115 | ||
114 | /* SILICON QUIRKS */ | 116 | /* SILICON QUIRKS */ |
115 | unsigned is_tdi_rh_tt:1; /* TDI roothub with TT */ | ||
116 | unsigned no_selective_suspend:1; | 117 | unsigned no_selective_suspend:1; |
117 | unsigned has_fsl_port_bug:1; /* FreeScale */ | 118 | unsigned has_fsl_port_bug:1; /* FreeScale */ |
118 | unsigned big_endian_mmio:1; | 119 | unsigned big_endian_mmio:1; |
@@ -678,7 +679,7 @@ struct ehci_fstn { | |||
678 | * needed (mostly in root hub code). | 679 | * needed (mostly in root hub code). |
679 | */ | 680 | */ |
680 | 681 | ||
681 | #define ehci_is_TDI(e) ((e)->is_tdi_rh_tt) | 682 | #define ehci_is_TDI(e) (ehci_to_hcd(e)->has_tt) |
682 | 683 | ||
683 | /* Returns the speed of a device attached to a port on the root hub. */ | 684 | /* Returns the speed of a device attached to a port on the root hub. */ |
684 | static inline unsigned int | 685 | static inline unsigned int |
diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig index a53db1d4e07a..eb6c06979f3b 100644 --- a/drivers/usb/misc/Kconfig +++ b/drivers/usb/misc/Kconfig | |||
@@ -269,3 +269,14 @@ config USB_TEST | |||
269 | See <http://www.linux-usb.org/usbtest/> for more information, | 269 | See <http://www.linux-usb.org/usbtest/> for more information, |
270 | including sample test device firmware and "how to use it". | 270 | including sample test device firmware and "how to use it". |
271 | 271 | ||
272 | config USB_ISIGHTFW | ||
273 | tristate "iSight firmware loading support" | ||
274 | depends on USB | ||
275 | help | ||
276 | This driver loads firmware for USB Apple iSight cameras, allowing | ||
277 | them to be driven by the USB video class driver available at | ||
278 | http://linux-uvc.berlios.de | ||
279 | |||
280 | The firmware for this driver must be extracted from the MacOS | ||
281 | driver beforehand. Tools for doing so are available at | ||
282 | http://bersace03.free.fr | ||
diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile index b68e6b774f1a..aba091cb5ec0 100644 --- a/drivers/usb/misc/Makefile +++ b/drivers/usb/misc/Makefile | |||
@@ -14,6 +14,7 @@ obj-$(CONFIG_USB_EMI62) += emi62.o | |||
14 | obj-$(CONFIG_USB_FTDI_ELAN) += ftdi-elan.o | 14 | obj-$(CONFIG_USB_FTDI_ELAN) += ftdi-elan.o |
15 | obj-$(CONFIG_USB_IDMOUSE) += idmouse.o | 15 | obj-$(CONFIG_USB_IDMOUSE) += idmouse.o |
16 | obj-$(CONFIG_USB_IOWARRIOR) += iowarrior.o | 16 | obj-$(CONFIG_USB_IOWARRIOR) += iowarrior.o |
17 | obj-$(CONFIG_USB_ISIGHTFW) += isight_firmware.o | ||
17 | obj-$(CONFIG_USB_LCD) += usblcd.o | 18 | obj-$(CONFIG_USB_LCD) += usblcd.o |
18 | obj-$(CONFIG_USB_LD) += ldusb.o | 19 | obj-$(CONFIG_USB_LD) += ldusb.o |
19 | obj-$(CONFIG_USB_LED) += usbled.o | 20 | obj-$(CONFIG_USB_LED) += usbled.o |
diff --git a/drivers/usb/misc/isight_firmware.c b/drivers/usb/misc/isight_firmware.c new file mode 100644 index 000000000000..390e04885536 --- /dev/null +++ b/drivers/usb/misc/isight_firmware.c | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | * Driver for loading USB isight firmware | ||
3 | * | ||
4 | * Copyright (C) 2008 Matthew Garrett <mjg@redhat.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the Free | ||
8 | * Software Foundation, version 2. | ||
9 | * | ||
10 | * The USB isight cameras in recent Apples are roughly compatible with the USB | ||
11 | * video class specification, and can be driven by uvcvideo. However, they | ||
12 | * need firmware to be loaded beforehand. After firmware loading, the device | ||
13 | * detaches from the USB bus and reattaches with a new device ID. It can then | ||
14 | * be claimed by the uvc driver. | ||
15 | * | ||
16 | * The firmware is non-free and must be extracted by the user. Tools to do this | ||
17 | * are available at http://bersace03.free.fr/ift/ | ||
18 | * | ||
19 | * The isight firmware loading was reverse engineered by Johannes Berg | ||
20 | * <johannes@sipsolutions.de>, and this driver is based on code by Ronald | ||
21 | * Bultje <rbultje@ronald.bitfreak.net> | ||
22 | */ | ||
23 | |||
24 | #include <linux/usb.h> | ||
25 | #include <linux/firmware.h> | ||
26 | #include <linux/errno.h> | ||
27 | #include <linux/module.h> | ||
28 | |||
29 | static struct usb_device_id id_table[] = { | ||
30 | {USB_DEVICE(0x05ac, 0x8300)}, | ||
31 | {}, | ||
32 | }; | ||
33 | |||
34 | MODULE_DEVICE_TABLE(usb, id_table); | ||
35 | |||
36 | static int isight_firmware_load(struct usb_interface *intf, | ||
37 | const struct usb_device_id *id) | ||
38 | { | ||
39 | struct usb_device *dev = interface_to_usbdev(intf); | ||
40 | int llen, len, req, ret = 0; | ||
41 | const struct firmware *firmware; | ||
42 | unsigned char *buf; | ||
43 | unsigned char data[4]; | ||
44 | char *ptr; | ||
45 | |||
46 | if (request_firmware(&firmware, "isight.fw", &dev->dev) != 0) { | ||
47 | printk(KERN_ERR "Unable to load isight firmware\n"); | ||
48 | return -ENODEV; | ||
49 | } | ||
50 | |||
51 | ptr = firmware->data; | ||
52 | |||
53 | if (usb_control_msg | ||
54 | (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, "\1", 1, | ||
55 | 300) != 1) { | ||
56 | printk(KERN_ERR | ||
57 | "Failed to initialise isight firmware loader\n"); | ||
58 | ret = -ENODEV; | ||
59 | goto out; | ||
60 | } | ||
61 | |||
62 | while (1) { | ||
63 | memcpy(data, ptr, 4); | ||
64 | len = (data[0] << 8 | data[1]); | ||
65 | req = (data[2] << 8 | data[3]); | ||
66 | ptr += 4; | ||
67 | |||
68 | if (len == 0x8001) | ||
69 | break; /* success */ | ||
70 | else if (len == 0) | ||
71 | continue; | ||
72 | |||
73 | for (; len > 0; req += 50) { | ||
74 | llen = len > 50 ? 50 : len; | ||
75 | len -= llen; | ||
76 | |||
77 | buf = kmalloc(llen, GFP_KERNEL); | ||
78 | memcpy(buf, ptr, llen); | ||
79 | |||
80 | ptr += llen; | ||
81 | |||
82 | if (usb_control_msg | ||
83 | (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, req, 0, | ||
84 | buf, llen, 300) != llen) { | ||
85 | printk(KERN_ERR | ||
86 | "Failed to load isight firmware\n"); | ||
87 | kfree(buf); | ||
88 | ret = -ENODEV; | ||
89 | goto out; | ||
90 | } | ||
91 | |||
92 | kfree(buf); | ||
93 | } | ||
94 | } | ||
95 | if (usb_control_msg | ||
96 | (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, "\0", 1, | ||
97 | 300) != 1) { | ||
98 | printk(KERN_ERR "isight firmware loading completion failed\n"); | ||
99 | ret = -ENODEV; | ||
100 | } | ||
101 | out: | ||
102 | release_firmware(firmware); | ||
103 | return ret; | ||
104 | } | ||
105 | |||
106 | static void isight_firmware_disconnect(struct usb_interface *intf) | ||
107 | { | ||
108 | } | ||
109 | |||
110 | static struct usb_driver isight_firmware_driver = { | ||
111 | .name = "isight_firmware", | ||
112 | .probe = isight_firmware_load, | ||
113 | .disconnect = isight_firmware_disconnect, | ||
114 | .id_table = id_table, | ||
115 | }; | ||
116 | |||
117 | static int __init isight_firmware_init(void) | ||
118 | { | ||
119 | return usb_register(&isight_firmware_driver); | ||
120 | } | ||
121 | |||
122 | static void __exit isight_firmware_exit(void) | ||
123 | { | ||
124 | usb_deregister(&isight_firmware_driver); | ||
125 | } | ||
126 | |||
127 | module_init(isight_firmware_init); | ||
128 | module_exit(isight_firmware_exit); | ||
129 | |||
130 | MODULE_LICENSE("GPL"); | ||
131 | MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>"); | ||
diff --git a/drivers/usb/misc/phidgetkit.c b/drivers/usb/misc/phidgetkit.c index 24230c638b8e..4cfa25b0f44e 100644 --- a/drivers/usb/misc/phidgetkit.c +++ b/drivers/usb/misc/phidgetkit.c | |||
@@ -595,14 +595,14 @@ static int interfacekit_probe(struct usb_interface *intf, const struct usb_devic | |||
595 | } while(value); | 595 | } while(value); |
596 | kit->dev_no = bit; | 596 | kit->dev_no = bit; |
597 | 597 | ||
598 | kit->dev = device_create(phidget_class, &kit->udev->dev, 0, | 598 | kit->dev = device_create_drvdata(phidget_class, &kit->udev->dev, |
599 | "interfacekit%d", kit->dev_no); | 599 | MKDEV(0, 0), kit, |
600 | "interfacekit%d", kit->dev_no); | ||
600 | if (IS_ERR(kit->dev)) { | 601 | if (IS_ERR(kit->dev)) { |
601 | rc = PTR_ERR(kit->dev); | 602 | rc = PTR_ERR(kit->dev); |
602 | kit->dev = NULL; | 603 | kit->dev = NULL; |
603 | goto out; | 604 | goto out; |
604 | } | 605 | } |
605 | dev_set_drvdata(kit->dev, kit); | ||
606 | 606 | ||
607 | if (usb_submit_urb(kit->irq, GFP_KERNEL)) { | 607 | if (usb_submit_urb(kit->irq, GFP_KERNEL)) { |
608 | rc = -EIO; | 608 | rc = -EIO; |
diff --git a/drivers/usb/misc/phidgetmotorcontrol.c b/drivers/usb/misc/phidgetmotorcontrol.c index f0113c17cc5a..9b4696f21b22 100644 --- a/drivers/usb/misc/phidgetmotorcontrol.c +++ b/drivers/usb/misc/phidgetmotorcontrol.c | |||
@@ -365,16 +365,15 @@ static int motorcontrol_probe(struct usb_interface *intf, const struct usb_devic | |||
365 | } while(value); | 365 | } while(value); |
366 | mc->dev_no = bit; | 366 | mc->dev_no = bit; |
367 | 367 | ||
368 | mc->dev = device_create(phidget_class, &mc->udev->dev, 0, | 368 | mc->dev = device_create_drvdata(phidget_class, &mc->udev->dev, |
369 | "motorcontrol%d", mc->dev_no); | 369 | MKDEV(0, 0), mc, |
370 | "motorcontrol%d", mc->dev_no); | ||
370 | if (IS_ERR(mc->dev)) { | 371 | if (IS_ERR(mc->dev)) { |
371 | rc = PTR_ERR(mc->dev); | 372 | rc = PTR_ERR(mc->dev); |
372 | mc->dev = NULL; | 373 | mc->dev = NULL; |
373 | goto out; | 374 | goto out; |
374 | } | 375 | } |
375 | 376 | ||
376 | dev_set_drvdata(mc->dev, mc); | ||
377 | |||
378 | if (usb_submit_urb(mc->irq, GFP_KERNEL)) { | 377 | if (usb_submit_urb(mc->irq, GFP_KERNEL)) { |
379 | rc = -EIO; | 378 | rc = -EIO; |
380 | goto out; | 379 | goto out; |
diff --git a/drivers/usb/misc/phidgetservo.c b/drivers/usb/misc/phidgetservo.c index 7d590c09434a..1ca7ddb41d4d 100644 --- a/drivers/usb/misc/phidgetservo.c +++ b/drivers/usb/misc/phidgetservo.c | |||
@@ -275,14 +275,14 @@ servo_probe(struct usb_interface *interface, const struct usb_device_id *id) | |||
275 | } while (value); | 275 | } while (value); |
276 | dev->dev_no = bit; | 276 | dev->dev_no = bit; |
277 | 277 | ||
278 | dev->dev = device_create(phidget_class, &dev->udev->dev, 0, | 278 | dev->dev = device_create_drvdata(phidget_class, &dev->udev->dev, |
279 | "servo%d", dev->dev_no); | 279 | MKDEV(0, 0), dev, |
280 | "servo%d", dev->dev_no); | ||
280 | if (IS_ERR(dev->dev)) { | 281 | if (IS_ERR(dev->dev)) { |
281 | rc = PTR_ERR(dev->dev); | 282 | rc = PTR_ERR(dev->dev); |
282 | dev->dev = NULL; | 283 | dev->dev = NULL; |
283 | goto out; | 284 | goto out; |
284 | } | 285 | } |
285 | dev_set_drvdata(dev->dev, dev); | ||
286 | 286 | ||
287 | servo_count = dev->type & SERVO_COUNT_QUAD ? 4 : 1; | 287 | servo_count = dev->type & SERVO_COUNT_QUAD ? 4 : 1; |
288 | 288 | ||
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index ba28fdc9ccd2..1f7c86bd8297 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
@@ -28,6 +28,7 @@ static int debug; | |||
28 | 28 | ||
29 | static struct usb_device_id id_table [] = { | 29 | static struct usb_device_id id_table [] = { |
30 | { USB_DEVICE(0x4348, 0x5523) }, | 30 | { USB_DEVICE(0x4348, 0x5523) }, |
31 | { USB_DEVICE(0x1a86, 0x7523) }, | ||
31 | { }, | 32 | { }, |
32 | }; | 33 | }; |
33 | MODULE_DEVICE_TABLE(usb, id_table); | 34 | MODULE_DEVICE_TABLE(usb, id_table); |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 5b349ece7247..5234e7a3bd2c 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -174,8 +174,270 @@ static struct usb_device_id id_table_combined [] = { | |||
174 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) }, | 174 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) }, |
175 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, | 175 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, |
176 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, | 176 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, |
177 | { USB_DEVICE(MTXORB_VK_VID, MTXORB_VK_PID), | 177 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0100_PID) }, |
178 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0101_PID) }, | ||
179 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0102_PID) }, | ||
180 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0103_PID) }, | ||
181 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0104_PID) }, | ||
182 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0105_PID) }, | ||
183 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0106_PID) }, | ||
184 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0107_PID) }, | ||
185 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0108_PID) }, | ||
186 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0109_PID) }, | ||
187 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010A_PID) }, | ||
188 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010B_PID) }, | ||
189 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010C_PID) }, | ||
190 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010D_PID) }, | ||
191 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010E_PID) }, | ||
192 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_010F_PID) }, | ||
193 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0110_PID) }, | ||
194 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0111_PID) }, | ||
195 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0112_PID) }, | ||
196 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0113_PID) }, | ||
197 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0114_PID) }, | ||
198 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0115_PID) }, | ||
199 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0116_PID) }, | ||
200 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0117_PID) }, | ||
201 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0118_PID) }, | ||
202 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0119_PID) }, | ||
203 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011A_PID) }, | ||
204 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011B_PID) }, | ||
205 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011C_PID) }, | ||
206 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011D_PID) }, | ||
207 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011E_PID) }, | ||
208 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_011F_PID) }, | ||
209 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0120_PID) }, | ||
210 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0121_PID) }, | ||
211 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0122_PID) }, | ||
212 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0123_PID) }, | ||
213 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0124_PID) }, | ||
214 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0125_PID) }, | ||
215 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0126_PID) }, | ||
216 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0127_PID), | ||
178 | .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, | 217 | .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, |
218 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0128_PID) }, | ||
219 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0129_PID) }, | ||
220 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012A_PID) }, | ||
221 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012B_PID) }, | ||
222 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012C_PID), | ||
223 | .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, | ||
224 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012D_PID) }, | ||
225 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012E_PID) }, | ||
226 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_012F_PID) }, | ||
227 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0130_PID) }, | ||
228 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0131_PID) }, | ||
229 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0132_PID) }, | ||
230 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0133_PID) }, | ||
231 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0134_PID) }, | ||
232 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0135_PID) }, | ||
233 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0136_PID) }, | ||
234 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0137_PID) }, | ||
235 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0138_PID) }, | ||
236 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0139_PID) }, | ||
237 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013A_PID) }, | ||
238 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013B_PID) }, | ||
239 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013C_PID) }, | ||
240 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013D_PID) }, | ||
241 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013E_PID) }, | ||
242 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_013F_PID) }, | ||
243 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0140_PID) }, | ||
244 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0141_PID) }, | ||
245 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0142_PID) }, | ||
246 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0143_PID) }, | ||
247 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0144_PID) }, | ||
248 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0145_PID) }, | ||
249 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0146_PID) }, | ||
250 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0147_PID) }, | ||
251 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0148_PID) }, | ||
252 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0149_PID) }, | ||
253 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014A_PID) }, | ||
254 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014B_PID) }, | ||
255 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014C_PID) }, | ||
256 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014D_PID) }, | ||
257 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014E_PID) }, | ||
258 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_014F_PID) }, | ||
259 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0150_PID) }, | ||
260 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0151_PID) }, | ||
261 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0152_PID) }, | ||
262 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0153_PID), | ||
263 | .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, | ||
264 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0154_PID), | ||
265 | .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, | ||
266 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0155_PID), | ||
267 | .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, | ||
268 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0156_PID), | ||
269 | .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, | ||
270 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0157_PID), | ||
271 | .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, | ||
272 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0158_PID), | ||
273 | .driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk }, | ||
274 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0159_PID) }, | ||
275 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015A_PID) }, | ||
276 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015B_PID) }, | ||
277 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015C_PID) }, | ||
278 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015D_PID) }, | ||
279 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015E_PID) }, | ||
280 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_015F_PID) }, | ||
281 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0160_PID) }, | ||
282 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0161_PID) }, | ||
283 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0162_PID) }, | ||
284 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0163_PID) }, | ||
285 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0164_PID) }, | ||
286 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0165_PID) }, | ||
287 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0166_PID) }, | ||
288 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0167_PID) }, | ||
289 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0168_PID) }, | ||
290 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0169_PID) }, | ||
291 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016A_PID) }, | ||
292 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016B_PID) }, | ||
293 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016C_PID) }, | ||
294 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016D_PID) }, | ||
295 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016E_PID) }, | ||
296 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_016F_PID) }, | ||
297 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0170_PID) }, | ||
298 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0171_PID) }, | ||
299 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0172_PID) }, | ||
300 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0173_PID) }, | ||
301 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0174_PID) }, | ||
302 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0175_PID) }, | ||
303 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0176_PID) }, | ||
304 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0177_PID) }, | ||
305 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0178_PID) }, | ||
306 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0179_PID) }, | ||
307 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017A_PID) }, | ||
308 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017B_PID) }, | ||
309 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017C_PID) }, | ||
310 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017D_PID) }, | ||
311 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017E_PID) }, | ||
312 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_017F_PID) }, | ||
313 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0180_PID) }, | ||
314 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0181_PID) }, | ||
315 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0182_PID) }, | ||
316 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0183_PID) }, | ||
317 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0184_PID) }, | ||
318 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0185_PID) }, | ||
319 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0186_PID) }, | ||
320 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0187_PID) }, | ||
321 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0188_PID) }, | ||
322 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0189_PID) }, | ||
323 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018A_PID) }, | ||
324 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018B_PID) }, | ||
325 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018C_PID) }, | ||
326 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018D_PID) }, | ||
327 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018E_PID) }, | ||
328 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_018F_PID) }, | ||
329 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0190_PID) }, | ||
330 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0191_PID) }, | ||
331 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0192_PID) }, | ||
332 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0193_PID) }, | ||
333 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0194_PID) }, | ||
334 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0195_PID) }, | ||
335 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0196_PID) }, | ||
336 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0197_PID) }, | ||
337 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0198_PID) }, | ||
338 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_0199_PID) }, | ||
339 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019A_PID) }, | ||
340 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019B_PID) }, | ||
341 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019C_PID) }, | ||
342 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019D_PID) }, | ||
343 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019E_PID) }, | ||
344 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_019F_PID) }, | ||
345 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A0_PID) }, | ||
346 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A1_PID) }, | ||
347 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A2_PID) }, | ||
348 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A3_PID) }, | ||
349 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A4_PID) }, | ||
350 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A5_PID) }, | ||
351 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A6_PID) }, | ||
352 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A7_PID) }, | ||
353 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A8_PID) }, | ||
354 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01A9_PID) }, | ||
355 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AA_PID) }, | ||
356 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AB_PID) }, | ||
357 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AC_PID) }, | ||
358 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AD_PID) }, | ||
359 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AE_PID) }, | ||
360 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01AF_PID) }, | ||
361 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B0_PID) }, | ||
362 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B1_PID) }, | ||
363 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B2_PID) }, | ||
364 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B3_PID) }, | ||
365 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B4_PID) }, | ||
366 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B5_PID) }, | ||
367 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B6_PID) }, | ||
368 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B7_PID) }, | ||
369 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B8_PID) }, | ||
370 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01B9_PID) }, | ||
371 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BA_PID) }, | ||
372 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BB_PID) }, | ||
373 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BC_PID) }, | ||
374 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BD_PID) }, | ||
375 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BE_PID) }, | ||
376 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01BF_PID) }, | ||
377 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C0_PID) }, | ||
378 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C1_PID) }, | ||
379 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C2_PID) }, | ||
380 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C3_PID) }, | ||
381 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C4_PID) }, | ||
382 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C5_PID) }, | ||
383 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C6_PID) }, | ||
384 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C7_PID) }, | ||
385 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C8_PID) }, | ||
386 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01C9_PID) }, | ||
387 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CA_PID) }, | ||
388 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CB_PID) }, | ||
389 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CC_PID) }, | ||
390 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CD_PID) }, | ||
391 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CE_PID) }, | ||
392 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01CF_PID) }, | ||
393 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D0_PID) }, | ||
394 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D1_PID) }, | ||
395 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D2_PID) }, | ||
396 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D3_PID) }, | ||
397 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D4_PID) }, | ||
398 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D5_PID) }, | ||
399 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D6_PID) }, | ||
400 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D7_PID) }, | ||
401 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D8_PID) }, | ||
402 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01D9_PID) }, | ||
403 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DA_PID) }, | ||
404 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DB_PID) }, | ||
405 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DC_PID) }, | ||
406 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DD_PID) }, | ||
407 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DE_PID) }, | ||
408 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01DF_PID) }, | ||
409 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E0_PID) }, | ||
410 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E1_PID) }, | ||
411 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E2_PID) }, | ||
412 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E3_PID) }, | ||
413 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E4_PID) }, | ||
414 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E5_PID) }, | ||
415 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E6_PID) }, | ||
416 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E7_PID) }, | ||
417 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E8_PID) }, | ||
418 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01E9_PID) }, | ||
419 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EA_PID) }, | ||
420 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EB_PID) }, | ||
421 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EC_PID) }, | ||
422 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01ED_PID) }, | ||
423 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EE_PID) }, | ||
424 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01EF_PID) }, | ||
425 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F0_PID) }, | ||
426 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F1_PID) }, | ||
427 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F2_PID) }, | ||
428 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F3_PID) }, | ||
429 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F4_PID) }, | ||
430 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F5_PID) }, | ||
431 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F6_PID) }, | ||
432 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F7_PID) }, | ||
433 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F8_PID) }, | ||
434 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01F9_PID) }, | ||
435 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FA_PID) }, | ||
436 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FB_PID) }, | ||
437 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FC_PID) }, | ||
438 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FD_PID) }, | ||
439 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FE_PID) }, | ||
440 | { USB_DEVICE(MTXORB_VID,MTXORB_FTDI_RANGE_01FF_PID) }, | ||
179 | { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, | 441 | { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, |
180 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, | 442 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, |
181 | { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, | 443 | { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, |
@@ -374,6 +636,7 @@ static struct usb_device_id id_table_combined [] = { | |||
374 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 636 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
375 | { USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID), | 637 | { USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID), |
376 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 638 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
639 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, | ||
377 | { }, /* Optional parameter entry */ | 640 | { }, /* Optional parameter entry */ |
378 | { } /* Terminating entry */ | 641 | { } /* Terminating entry */ |
379 | }; | 642 | }; |
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 504edf8c3a3f..06e0ecabb3eb 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -114,11 +114,268 @@ | |||
114 | #define FTDI_OOCDLINK_PID 0xbaf8 /* Amontec JTAGkey */ | 114 | #define FTDI_OOCDLINK_PID 0xbaf8 /* Amontec JTAGkey */ |
115 | 115 | ||
116 | /* | 116 | /* |
117 | * The following are the values for the Matrix Orbital VK204-25-USB | 117 | * The following are the values for the Matrix Orbital FTDI Range |
118 | * display, which use the FT232RL. | 118 | * Anything in this range will use an FT232RL. |
119 | */ | 119 | */ |
120 | #define MTXORB_VK_VID 0x1b3d | 120 | #define MTXORB_VID 0x1B3D |
121 | #define MTXORB_VK_PID 0x0158 | 121 | #define MTXORB_FTDI_RANGE_0100_PID 0x0100 |
122 | #define MTXORB_FTDI_RANGE_0101_PID 0x0101 | ||
123 | #define MTXORB_FTDI_RANGE_0102_PID 0x0102 | ||
124 | #define MTXORB_FTDI_RANGE_0103_PID 0x0103 | ||
125 | #define MTXORB_FTDI_RANGE_0104_PID 0x0104 | ||
126 | #define MTXORB_FTDI_RANGE_0105_PID 0x0105 | ||
127 | #define MTXORB_FTDI_RANGE_0106_PID 0x0106 | ||
128 | #define MTXORB_FTDI_RANGE_0107_PID 0x0107 | ||
129 | #define MTXORB_FTDI_RANGE_0108_PID 0x0108 | ||
130 | #define MTXORB_FTDI_RANGE_0109_PID 0x0109 | ||
131 | #define MTXORB_FTDI_RANGE_010A_PID 0x010A | ||
132 | #define MTXORB_FTDI_RANGE_010B_PID 0x010B | ||
133 | #define MTXORB_FTDI_RANGE_010C_PID 0x010C | ||
134 | #define MTXORB_FTDI_RANGE_010D_PID 0x010D | ||
135 | #define MTXORB_FTDI_RANGE_010E_PID 0x010E | ||
136 | #define MTXORB_FTDI_RANGE_010F_PID 0x010F | ||
137 | #define MTXORB_FTDI_RANGE_0110_PID 0x0110 | ||
138 | #define MTXORB_FTDI_RANGE_0111_PID 0x0111 | ||
139 | #define MTXORB_FTDI_RANGE_0112_PID 0x0112 | ||
140 | #define MTXORB_FTDI_RANGE_0113_PID 0x0113 | ||
141 | #define MTXORB_FTDI_RANGE_0114_PID 0x0114 | ||
142 | #define MTXORB_FTDI_RANGE_0115_PID 0x0115 | ||
143 | #define MTXORB_FTDI_RANGE_0116_PID 0x0116 | ||
144 | #define MTXORB_FTDI_RANGE_0117_PID 0x0117 | ||
145 | #define MTXORB_FTDI_RANGE_0118_PID 0x0118 | ||
146 | #define MTXORB_FTDI_RANGE_0119_PID 0x0119 | ||
147 | #define MTXORB_FTDI_RANGE_011A_PID 0x011A | ||
148 | #define MTXORB_FTDI_RANGE_011B_PID 0x011B | ||
149 | #define MTXORB_FTDI_RANGE_011C_PID 0x011C | ||
150 | #define MTXORB_FTDI_RANGE_011D_PID 0x011D | ||
151 | #define MTXORB_FTDI_RANGE_011E_PID 0x011E | ||
152 | #define MTXORB_FTDI_RANGE_011F_PID 0x011F | ||
153 | #define MTXORB_FTDI_RANGE_0120_PID 0x0120 | ||
154 | #define MTXORB_FTDI_RANGE_0121_PID 0x0121 | ||
155 | #define MTXORB_FTDI_RANGE_0122_PID 0x0122 | ||
156 | #define MTXORB_FTDI_RANGE_0123_PID 0x0123 | ||
157 | #define MTXORB_FTDI_RANGE_0124_PID 0x0124 | ||
158 | #define MTXORB_FTDI_RANGE_0125_PID 0x0125 | ||
159 | #define MTXORB_FTDI_RANGE_0126_PID 0x0126 | ||
160 | #define MTXORB_FTDI_RANGE_0127_PID 0x0127 | ||
161 | #define MTXORB_FTDI_RANGE_0128_PID 0x0128 | ||
162 | #define MTXORB_FTDI_RANGE_0129_PID 0x0129 | ||
163 | #define MTXORB_FTDI_RANGE_012A_PID 0x012A | ||
164 | #define MTXORB_FTDI_RANGE_012B_PID 0x012B | ||
165 | #define MTXORB_FTDI_RANGE_012C_PID 0x012C | ||
166 | #define MTXORB_FTDI_RANGE_012D_PID 0x012D | ||
167 | #define MTXORB_FTDI_RANGE_012E_PID 0x012E | ||
168 | #define MTXORB_FTDI_RANGE_012F_PID 0x012F | ||
169 | #define MTXORB_FTDI_RANGE_0130_PID 0x0130 | ||
170 | #define MTXORB_FTDI_RANGE_0131_PID 0x0131 | ||
171 | #define MTXORB_FTDI_RANGE_0132_PID 0x0132 | ||
172 | #define MTXORB_FTDI_RANGE_0133_PID 0x0133 | ||
173 | #define MTXORB_FTDI_RANGE_0134_PID 0x0134 | ||
174 | #define MTXORB_FTDI_RANGE_0135_PID 0x0135 | ||
175 | #define MTXORB_FTDI_RANGE_0136_PID 0x0136 | ||
176 | #define MTXORB_FTDI_RANGE_0137_PID 0x0137 | ||
177 | #define MTXORB_FTDI_RANGE_0138_PID 0x0138 | ||
178 | #define MTXORB_FTDI_RANGE_0139_PID 0x0139 | ||
179 | #define MTXORB_FTDI_RANGE_013A_PID 0x013A | ||
180 | #define MTXORB_FTDI_RANGE_013B_PID 0x013B | ||
181 | #define MTXORB_FTDI_RANGE_013C_PID 0x013C | ||
182 | #define MTXORB_FTDI_RANGE_013D_PID 0x013D | ||
183 | #define MTXORB_FTDI_RANGE_013E_PID 0x013E | ||
184 | #define MTXORB_FTDI_RANGE_013F_PID 0x013F | ||
185 | #define MTXORB_FTDI_RANGE_0140_PID 0x0140 | ||
186 | #define MTXORB_FTDI_RANGE_0141_PID 0x0141 | ||
187 | #define MTXORB_FTDI_RANGE_0142_PID 0x0142 | ||
188 | #define MTXORB_FTDI_RANGE_0143_PID 0x0143 | ||
189 | #define MTXORB_FTDI_RANGE_0144_PID 0x0144 | ||
190 | #define MTXORB_FTDI_RANGE_0145_PID 0x0145 | ||
191 | #define MTXORB_FTDI_RANGE_0146_PID 0x0146 | ||
192 | #define MTXORB_FTDI_RANGE_0147_PID 0x0147 | ||
193 | #define MTXORB_FTDI_RANGE_0148_PID 0x0148 | ||
194 | #define MTXORB_FTDI_RANGE_0149_PID 0x0149 | ||
195 | #define MTXORB_FTDI_RANGE_014A_PID 0x014A | ||
196 | #define MTXORB_FTDI_RANGE_014B_PID 0x014B | ||
197 | #define MTXORB_FTDI_RANGE_014C_PID 0x014C | ||
198 | #define MTXORB_FTDI_RANGE_014D_PID 0x014D | ||
199 | #define MTXORB_FTDI_RANGE_014E_PID 0x014E | ||
200 | #define MTXORB_FTDI_RANGE_014F_PID 0x014F | ||
201 | #define MTXORB_FTDI_RANGE_0150_PID 0x0150 | ||
202 | #define MTXORB_FTDI_RANGE_0151_PID 0x0151 | ||
203 | #define MTXORB_FTDI_RANGE_0152_PID 0x0152 | ||
204 | #define MTXORB_FTDI_RANGE_0153_PID 0x0153 | ||
205 | #define MTXORB_FTDI_RANGE_0154_PID 0x0154 | ||
206 | #define MTXORB_FTDI_RANGE_0155_PID 0x0155 | ||
207 | #define MTXORB_FTDI_RANGE_0156_PID 0x0156 | ||
208 | #define MTXORB_FTDI_RANGE_0157_PID 0x0157 | ||
209 | #define MTXORB_FTDI_RANGE_0158_PID 0x0158 | ||
210 | #define MTXORB_FTDI_RANGE_0159_PID 0x0159 | ||
211 | #define MTXORB_FTDI_RANGE_015A_PID 0x015A | ||
212 | #define MTXORB_FTDI_RANGE_015B_PID 0x015B | ||
213 | #define MTXORB_FTDI_RANGE_015C_PID 0x015C | ||
214 | #define MTXORB_FTDI_RANGE_015D_PID 0x015D | ||
215 | #define MTXORB_FTDI_RANGE_015E_PID 0x015E | ||
216 | #define MTXORB_FTDI_RANGE_015F_PID 0x015F | ||
217 | #define MTXORB_FTDI_RANGE_0160_PID 0x0160 | ||
218 | #define MTXORB_FTDI_RANGE_0161_PID 0x0161 | ||
219 | #define MTXORB_FTDI_RANGE_0162_PID 0x0162 | ||
220 | #define MTXORB_FTDI_RANGE_0163_PID 0x0163 | ||
221 | #define MTXORB_FTDI_RANGE_0164_PID 0x0164 | ||
222 | #define MTXORB_FTDI_RANGE_0165_PID 0x0165 | ||
223 | #define MTXORB_FTDI_RANGE_0166_PID 0x0166 | ||
224 | #define MTXORB_FTDI_RANGE_0167_PID 0x0167 | ||
225 | #define MTXORB_FTDI_RANGE_0168_PID 0x0168 | ||
226 | #define MTXORB_FTDI_RANGE_0169_PID 0x0169 | ||
227 | #define MTXORB_FTDI_RANGE_016A_PID 0x016A | ||
228 | #define MTXORB_FTDI_RANGE_016B_PID 0x016B | ||
229 | #define MTXORB_FTDI_RANGE_016C_PID 0x016C | ||
230 | #define MTXORB_FTDI_RANGE_016D_PID 0x016D | ||
231 | #define MTXORB_FTDI_RANGE_016E_PID 0x016E | ||
232 | #define MTXORB_FTDI_RANGE_016F_PID 0x016F | ||
233 | #define MTXORB_FTDI_RANGE_0170_PID 0x0170 | ||
234 | #define MTXORB_FTDI_RANGE_0171_PID 0x0171 | ||
235 | #define MTXORB_FTDI_RANGE_0172_PID 0x0172 | ||
236 | #define MTXORB_FTDI_RANGE_0173_PID 0x0173 | ||
237 | #define MTXORB_FTDI_RANGE_0174_PID 0x0174 | ||
238 | #define MTXORB_FTDI_RANGE_0175_PID 0x0175 | ||
239 | #define MTXORB_FTDI_RANGE_0176_PID 0x0176 | ||
240 | #define MTXORB_FTDI_RANGE_0177_PID 0x0177 | ||
241 | #define MTXORB_FTDI_RANGE_0178_PID 0x0178 | ||
242 | #define MTXORB_FTDI_RANGE_0179_PID 0x0179 | ||
243 | #define MTXORB_FTDI_RANGE_017A_PID 0x017A | ||
244 | #define MTXORB_FTDI_RANGE_017B_PID 0x017B | ||
245 | #define MTXORB_FTDI_RANGE_017C_PID 0x017C | ||
246 | #define MTXORB_FTDI_RANGE_017D_PID 0x017D | ||
247 | #define MTXORB_FTDI_RANGE_017E_PID 0x017E | ||
248 | #define MTXORB_FTDI_RANGE_017F_PID 0x017F | ||
249 | #define MTXORB_FTDI_RANGE_0180_PID 0x0180 | ||
250 | #define MTXORB_FTDI_RANGE_0181_PID 0x0181 | ||
251 | #define MTXORB_FTDI_RANGE_0182_PID 0x0182 | ||
252 | #define MTXORB_FTDI_RANGE_0183_PID 0x0183 | ||
253 | #define MTXORB_FTDI_RANGE_0184_PID 0x0184 | ||
254 | #define MTXORB_FTDI_RANGE_0185_PID 0x0185 | ||
255 | #define MTXORB_FTDI_RANGE_0186_PID 0x0186 | ||
256 | #define MTXORB_FTDI_RANGE_0187_PID 0x0187 | ||
257 | #define MTXORB_FTDI_RANGE_0188_PID 0x0188 | ||
258 | #define MTXORB_FTDI_RANGE_0189_PID 0x0189 | ||
259 | #define MTXORB_FTDI_RANGE_018A_PID 0x018A | ||
260 | #define MTXORB_FTDI_RANGE_018B_PID 0x018B | ||
261 | #define MTXORB_FTDI_RANGE_018C_PID 0x018C | ||
262 | #define MTXORB_FTDI_RANGE_018D_PID 0x018D | ||
263 | #define MTXORB_FTDI_RANGE_018E_PID 0x018E | ||
264 | #define MTXORB_FTDI_RANGE_018F_PID 0x018F | ||
265 | #define MTXORB_FTDI_RANGE_0190_PID 0x0190 | ||
266 | #define MTXORB_FTDI_RANGE_0191_PID 0x0191 | ||
267 | #define MTXORB_FTDI_RANGE_0192_PID 0x0192 | ||
268 | #define MTXORB_FTDI_RANGE_0193_PID 0x0193 | ||
269 | #define MTXORB_FTDI_RANGE_0194_PID 0x0194 | ||
270 | #define MTXORB_FTDI_RANGE_0195_PID 0x0195 | ||
271 | #define MTXORB_FTDI_RANGE_0196_PID 0x0196 | ||
272 | #define MTXORB_FTDI_RANGE_0197_PID 0x0197 | ||
273 | #define MTXORB_FTDI_RANGE_0198_PID 0x0198 | ||
274 | #define MTXORB_FTDI_RANGE_0199_PID 0x0199 | ||
275 | #define MTXORB_FTDI_RANGE_019A_PID 0x019A | ||
276 | #define MTXORB_FTDI_RANGE_019B_PID 0x019B | ||
277 | #define MTXORB_FTDI_RANGE_019C_PID 0x019C | ||
278 | #define MTXORB_FTDI_RANGE_019D_PID 0x019D | ||
279 | #define MTXORB_FTDI_RANGE_019E_PID 0x019E | ||
280 | #define MTXORB_FTDI_RANGE_019F_PID 0x019F | ||
281 | #define MTXORB_FTDI_RANGE_01A0_PID 0x01A0 | ||
282 | #define MTXORB_FTDI_RANGE_01A1_PID 0x01A1 | ||
283 | #define MTXORB_FTDI_RANGE_01A2_PID 0x01A2 | ||
284 | #define MTXORB_FTDI_RANGE_01A3_PID 0x01A3 | ||
285 | #define MTXORB_FTDI_RANGE_01A4_PID 0x01A4 | ||
286 | #define MTXORB_FTDI_RANGE_01A5_PID 0x01A5 | ||
287 | #define MTXORB_FTDI_RANGE_01A6_PID 0x01A6 | ||
288 | #define MTXORB_FTDI_RANGE_01A7_PID 0x01A7 | ||
289 | #define MTXORB_FTDI_RANGE_01A8_PID 0x01A8 | ||
290 | #define MTXORB_FTDI_RANGE_01A9_PID 0x01A9 | ||
291 | #define MTXORB_FTDI_RANGE_01AA_PID 0x01AA | ||
292 | #define MTXORB_FTDI_RANGE_01AB_PID 0x01AB | ||
293 | #define MTXORB_FTDI_RANGE_01AC_PID 0x01AC | ||
294 | #define MTXORB_FTDI_RANGE_01AD_PID 0x01AD | ||
295 | #define MTXORB_FTDI_RANGE_01AE_PID 0x01AE | ||
296 | #define MTXORB_FTDI_RANGE_01AF_PID 0x01AF | ||
297 | #define MTXORB_FTDI_RANGE_01B0_PID 0x01B0 | ||
298 | #define MTXORB_FTDI_RANGE_01B1_PID 0x01B1 | ||
299 | #define MTXORB_FTDI_RANGE_01B2_PID 0x01B2 | ||
300 | #define MTXORB_FTDI_RANGE_01B3_PID 0x01B3 | ||
301 | #define MTXORB_FTDI_RANGE_01B4_PID 0x01B4 | ||
302 | #define MTXORB_FTDI_RANGE_01B5_PID 0x01B5 | ||
303 | #define MTXORB_FTDI_RANGE_01B6_PID 0x01B6 | ||
304 | #define MTXORB_FTDI_RANGE_01B7_PID 0x01B7 | ||
305 | #define MTXORB_FTDI_RANGE_01B8_PID 0x01B8 | ||
306 | #define MTXORB_FTDI_RANGE_01B9_PID 0x01B9 | ||
307 | #define MTXORB_FTDI_RANGE_01BA_PID 0x01BA | ||
308 | #define MTXORB_FTDI_RANGE_01BB_PID 0x01BB | ||
309 | #define MTXORB_FTDI_RANGE_01BC_PID 0x01BC | ||
310 | #define MTXORB_FTDI_RANGE_01BD_PID 0x01BD | ||
311 | #define MTXORB_FTDI_RANGE_01BE_PID 0x01BE | ||
312 | #define MTXORB_FTDI_RANGE_01BF_PID 0x01BF | ||
313 | #define MTXORB_FTDI_RANGE_01C0_PID 0x01C0 | ||
314 | #define MTXORB_FTDI_RANGE_01C1_PID 0x01C1 | ||
315 | #define MTXORB_FTDI_RANGE_01C2_PID 0x01C2 | ||
316 | #define MTXORB_FTDI_RANGE_01C3_PID 0x01C3 | ||
317 | #define MTXORB_FTDI_RANGE_01C4_PID 0x01C4 | ||
318 | #define MTXORB_FTDI_RANGE_01C5_PID 0x01C5 | ||
319 | #define MTXORB_FTDI_RANGE_01C6_PID 0x01C6 | ||
320 | #define MTXORB_FTDI_RANGE_01C7_PID 0x01C7 | ||
321 | #define MTXORB_FTDI_RANGE_01C8_PID 0x01C8 | ||
322 | #define MTXORB_FTDI_RANGE_01C9_PID 0x01C9 | ||
323 | #define MTXORB_FTDI_RANGE_01CA_PID 0x01CA | ||
324 | #define MTXORB_FTDI_RANGE_01CB_PID 0x01CB | ||
325 | #define MTXORB_FTDI_RANGE_01CC_PID 0x01CC | ||
326 | #define MTXORB_FTDI_RANGE_01CD_PID 0x01CD | ||
327 | #define MTXORB_FTDI_RANGE_01CE_PID 0x01CE | ||
328 | #define MTXORB_FTDI_RANGE_01CF_PID 0x01CF | ||
329 | #define MTXORB_FTDI_RANGE_01D0_PID 0x01D0 | ||
330 | #define MTXORB_FTDI_RANGE_01D1_PID 0x01D1 | ||
331 | #define MTXORB_FTDI_RANGE_01D2_PID 0x01D2 | ||
332 | #define MTXORB_FTDI_RANGE_01D3_PID 0x01D3 | ||
333 | #define MTXORB_FTDI_RANGE_01D4_PID 0x01D4 | ||
334 | #define MTXORB_FTDI_RANGE_01D5_PID 0x01D5 | ||
335 | #define MTXORB_FTDI_RANGE_01D6_PID 0x01D6 | ||
336 | #define MTXORB_FTDI_RANGE_01D7_PID 0x01D7 | ||
337 | #define MTXORB_FTDI_RANGE_01D8_PID 0x01D8 | ||
338 | #define MTXORB_FTDI_RANGE_01D9_PID 0x01D9 | ||
339 | #define MTXORB_FTDI_RANGE_01DA_PID 0x01DA | ||
340 | #define MTXORB_FTDI_RANGE_01DB_PID 0x01DB | ||
341 | #define MTXORB_FTDI_RANGE_01DC_PID 0x01DC | ||
342 | #define MTXORB_FTDI_RANGE_01DD_PID 0x01DD | ||
343 | #define MTXORB_FTDI_RANGE_01DE_PID 0x01DE | ||
344 | #define MTXORB_FTDI_RANGE_01DF_PID 0x01DF | ||
345 | #define MTXORB_FTDI_RANGE_01E0_PID 0x01E0 | ||
346 | #define MTXORB_FTDI_RANGE_01E1_PID 0x01E1 | ||
347 | #define MTXORB_FTDI_RANGE_01E2_PID 0x01E2 | ||
348 | #define MTXORB_FTDI_RANGE_01E3_PID 0x01E3 | ||
349 | #define MTXORB_FTDI_RANGE_01E4_PID 0x01E4 | ||
350 | #define MTXORB_FTDI_RANGE_01E5_PID 0x01E5 | ||
351 | #define MTXORB_FTDI_RANGE_01E6_PID 0x01E6 | ||
352 | #define MTXORB_FTDI_RANGE_01E7_PID 0x01E7 | ||
353 | #define MTXORB_FTDI_RANGE_01E8_PID 0x01E8 | ||
354 | #define MTXORB_FTDI_RANGE_01E9_PID 0x01E9 | ||
355 | #define MTXORB_FTDI_RANGE_01EA_PID 0x01EA | ||
356 | #define MTXORB_FTDI_RANGE_01EB_PID 0x01EB | ||
357 | #define MTXORB_FTDI_RANGE_01EC_PID 0x01EC | ||
358 | #define MTXORB_FTDI_RANGE_01ED_PID 0x01ED | ||
359 | #define MTXORB_FTDI_RANGE_01EE_PID 0x01EE | ||
360 | #define MTXORB_FTDI_RANGE_01EF_PID 0x01EF | ||
361 | #define MTXORB_FTDI_RANGE_01F0_PID 0x01F0 | ||
362 | #define MTXORB_FTDI_RANGE_01F1_PID 0x01F1 | ||
363 | #define MTXORB_FTDI_RANGE_01F2_PID 0x01F2 | ||
364 | #define MTXORB_FTDI_RANGE_01F3_PID 0x01F3 | ||
365 | #define MTXORB_FTDI_RANGE_01F4_PID 0x01F4 | ||
366 | #define MTXORB_FTDI_RANGE_01F5_PID 0x01F5 | ||
367 | #define MTXORB_FTDI_RANGE_01F6_PID 0x01F6 | ||
368 | #define MTXORB_FTDI_RANGE_01F7_PID 0x01F7 | ||
369 | #define MTXORB_FTDI_RANGE_01F8_PID 0x01F8 | ||
370 | #define MTXORB_FTDI_RANGE_01F9_PID 0x01F9 | ||
371 | #define MTXORB_FTDI_RANGE_01FA_PID 0x01FA | ||
372 | #define MTXORB_FTDI_RANGE_01FB_PID 0x01FB | ||
373 | #define MTXORB_FTDI_RANGE_01FC_PID 0x01FC | ||
374 | #define MTXORB_FTDI_RANGE_01FD_PID 0x01FD | ||
375 | #define MTXORB_FTDI_RANGE_01FE_PID 0x01FE | ||
376 | #define MTXORB_FTDI_RANGE_01FF_PID 0x01FF | ||
377 | |||
378 | |||
122 | 379 | ||
123 | /* Interbiometrics USB I/O Board */ | 380 | /* Interbiometrics USB I/O Board */ |
124 | /* Developed for Interbiometrics by Rudolf Gugler */ | 381 | /* Developed for Interbiometrics by Rudolf Gugler */ |
@@ -592,6 +849,12 @@ | |||
592 | #define FIC_NEO1973_DEBUG_PID 0x5118 | 849 | #define FIC_NEO1973_DEBUG_PID 0x5118 |
593 | 850 | ||
594 | /* | 851 | /* |
852 | * RATOC REX-USB60F | ||
853 | */ | ||
854 | #define RATOC_VENDOR_ID 0x0584 | ||
855 | #define RATOC_PRODUCT_ID_USB60F 0xb020 | ||
856 | |||
857 | /* | ||
595 | * BmRequestType: 1100 0000b | 858 | * BmRequestType: 1100 0000b |
596 | * bRequest: FTDI_E2_READ | 859 | * bRequest: FTDI_E2_READ |
597 | * wValue: 0 | 860 | * wValue: 0 |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index e7e016e60333..43cfde83a93b 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -183,6 +183,7 @@ static int option_send_setup(struct usb_serial_port *port); | |||
183 | #define AXESSTEL_PRODUCT_MV110H 0x1000 | 183 | #define AXESSTEL_PRODUCT_MV110H 0x1000 |
184 | 184 | ||
185 | #define ONDA_VENDOR_ID 0x19d2 | 185 | #define ONDA_VENDOR_ID 0x19d2 |
186 | #define ONDA_PRODUCT_MSA501HS 0x0001 | ||
186 | #define ONDA_PRODUCT_ET502HS 0x0002 | 187 | #define ONDA_PRODUCT_ET502HS 0x0002 |
187 | 188 | ||
188 | #define BANDRICH_VENDOR_ID 0x1A8D | 189 | #define BANDRICH_VENDOR_ID 0x1A8D |
@@ -196,6 +197,9 @@ static int option_send_setup(struct usb_serial_port *port); | |||
196 | 197 | ||
197 | #define MAXON_VENDOR_ID 0x16d8 | 198 | #define MAXON_VENDOR_ID 0x16d8 |
198 | 199 | ||
200 | #define TELIT_VENDOR_ID 0x1bc7 | ||
201 | #define TELIT_PRODUCT_UC864E 0x1003 | ||
202 | |||
199 | static struct usb_device_id option_ids[] = { | 203 | static struct usb_device_id option_ids[] = { |
200 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, | 204 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, |
201 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, | 205 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, |
@@ -232,25 +236,25 @@ static struct usb_device_id option_ids[] = { | |||
232 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK_EX) }, | 236 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK_EX) }, |
233 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_MODEM) }, | 237 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_MODEM) }, |
234 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_NETWORK) }, | 238 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_NETWORK) }, |
235 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, | 239 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600, 0xff, 0xff, 0xff) }, |
236 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) }, | 240 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) }, |
237 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) }, | 241 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) }, |
238 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1401) }, | 242 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1401, 0xff, 0xff, 0xff) }, |
239 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1403) }, | 243 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1403, 0xff, 0xff, 0xff) }, |
240 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1405) }, | 244 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1405, 0xff, 0xff, 0xff) }, |
241 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1406) }, | 245 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1406, 0xff, 0xff, 0xff) }, |
242 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1408) }, | 246 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1408, 0xff, 0xff, 0xff) }, |
243 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1409) }, | 247 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1409, 0xff, 0xff, 0xff) }, |
244 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1410) }, | 248 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1410, 0xff, 0xff, 0xff) }, |
245 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1411) }, | 249 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1411, 0xff, 0xff, 0xff) }, |
246 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1412) }, | 250 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1412, 0xff, 0xff, 0xff) }, |
247 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1413) }, | 251 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1413, 0xff, 0xff, 0xff) }, |
248 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1414) }, | 252 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1414, 0xff, 0xff, 0xff) }, |
249 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1415) }, | 253 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1415, 0xff, 0xff, 0xff) }, |
250 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1416) }, | 254 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1416, 0xff, 0xff, 0xff) }, |
251 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1417) }, | 255 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1417, 0xff, 0xff, 0xff) }, |
252 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1418) }, | 256 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1418, 0xff, 0xff, 0xff) }, |
253 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1419) }, | 257 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1419, 0xff, 0xff, 0xff) }, |
254 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_9508) }, | 258 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_9508) }, |
255 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, /* Novatel Merlin V640/XV620 */ | 259 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, /* Novatel Merlin V640/XV620 */ |
256 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, /* Novatel Merlin V620/S620 */ | 260 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, /* Novatel Merlin V620/S620 */ |
@@ -297,13 +301,14 @@ static struct usb_device_id option_ids[] = { | |||
297 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, | 301 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, |
298 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, | 302 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, |
299 | { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) }, | 303 | { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) }, |
304 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_MSA501HS) }, | ||
300 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_ET502HS) }, | 305 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_ET502HS) }, |
301 | { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) }, | 306 | { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) }, |
302 | { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) }, | 307 | { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) }, |
303 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, | 308 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, |
304 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ | 309 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ |
305 | { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */ | 310 | { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */ |
306 | { USB_DEVICE(0x19d2, 0x0001) }, /* Telstra NextG CDMA */ | 311 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) }, |
307 | { } /* Terminating entry */ | 312 | { } /* Terminating entry */ |
308 | }; | 313 | }; |
309 | MODULE_DEVICE_TABLE(usb, option_ids); | 314 | MODULE_DEVICE_TABLE(usb, option_ids); |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index c605fb68f807..103195abd417 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -56,6 +56,7 @@ static struct usb_device_id id_table [] = { | |||
56 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, | 56 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, |
57 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, | 57 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, |
58 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ALDIGA) }, | 58 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ALDIGA) }, |
59 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) }, | ||
59 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, | 60 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, |
60 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, | 61 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, |
61 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, | 62 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, |
@@ -66,7 +67,6 @@ static struct usb_device_id id_table [] = { | |||
66 | { USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID_2080) }, | 67 | { USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID_2080) }, |
67 | { USB_DEVICE(MA620_VENDOR_ID, MA620_PRODUCT_ID) }, | 68 | { USB_DEVICE(MA620_VENDOR_ID, MA620_PRODUCT_ID) }, |
68 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) }, | 69 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) }, |
69 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, | ||
70 | { USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) }, | 70 | { USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) }, |
71 | { USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) }, | 71 | { USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) }, |
72 | { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) }, | 72 | { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) }, |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 10cf872e5ecb..cff160abb130 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #define PL2303_PRODUCT_ID_PHAROS 0xaaa0 | 14 | #define PL2303_PRODUCT_ID_PHAROS 0xaaa0 |
15 | #define PL2303_PRODUCT_ID_RSAQ3 0xaaa2 | 15 | #define PL2303_PRODUCT_ID_RSAQ3 0xaaa2 |
16 | #define PL2303_PRODUCT_ID_ALDIGA 0x0611 | 16 | #define PL2303_PRODUCT_ID_ALDIGA 0x0611 |
17 | #define PL2303_PRODUCT_ID_MMX 0x0612 | ||
17 | 18 | ||
18 | #define ATEN_VENDOR_ID 0x0557 | 19 | #define ATEN_VENDOR_ID 0x0557 |
19 | #define ATEN_VENDOR_ID2 0x0547 | 20 | #define ATEN_VENDOR_ID2 0x0547 |
@@ -36,7 +37,6 @@ | |||
36 | 37 | ||
37 | #define RATOC_VENDOR_ID 0x0584 | 38 | #define RATOC_VENDOR_ID 0x0584 |
38 | #define RATOC_PRODUCT_ID 0xb000 | 39 | #define RATOC_PRODUCT_ID 0xb000 |
39 | #define RATOC_PRODUCT_ID_USB60F 0xb020 | ||
40 | 40 | ||
41 | #define TRIPP_VENDOR_ID 0x2478 | 41 | #define TRIPP_VENDOR_ID 0x2478 |
42 | #define TRIPP_PRODUCT_ID 0x2008 | 42 | #define TRIPP_PRODUCT_ID 0x2008 |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 1b09578cbb10..45fe3663fa7f 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -405,7 +405,7 @@ UNUSUAL_DEV( 0x04a5, 0x3010, 0x0100, 0x0100, | |||
405 | UNUSUAL_DEV( 0x04b4, 0x6830, 0x0000, 0x9999, | 405 | UNUSUAL_DEV( 0x04b4, 0x6830, 0x0000, 0x9999, |
406 | "Cypress", | 406 | "Cypress", |
407 | "Cypress AT2LP", | 407 | "Cypress AT2LP", |
408 | US_SC_CYP_ATACB, US_PR_BULK, NULL, | 408 | US_SC_CYP_ATACB, US_PR_DEVICE, NULL, |
409 | 0), | 409 | 0), |
410 | #endif | 410 | #endif |
411 | 411 | ||
@@ -1522,7 +1522,7 @@ UNUSUAL_DEV( 0x0fce, 0xe031, 0x0000, 0x0000, | |||
1522 | "Sony Ericsson", | 1522 | "Sony Ericsson", |
1523 | "M600i", | 1523 | "M600i", |
1524 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1524 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1525 | US_FL_FIX_CAPACITY ), | 1525 | US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ), |
1526 | 1526 | ||
1527 | /* Reported by Kevin Cernekee <kpc-usbdev@gelato.uiuc.edu> | 1527 | /* Reported by Kevin Cernekee <kpc-usbdev@gelato.uiuc.edu> |
1528 | * Tested on hardware version 1.10. | 1528 | * Tested on hardware version 1.10. |
@@ -1716,10 +1716,12 @@ UNUSUAL_DEV( 0x22b8, 0x3010, 0x0001, 0x0001, | |||
1716 | /* | 1716 | /* |
1717 | * Patch by Pete Zaitcev <zaitcev@redhat.com> | 1717 | * Patch by Pete Zaitcev <zaitcev@redhat.com> |
1718 | * Report by Mark Patton. Red Hat bz#208928. | 1718 | * Report by Mark Patton. Red Hat bz#208928. |
1719 | * Added support for rev 0x0002 (Motorola ROKR W5) | ||
1720 | * by Javier Smaldone <javier@smaldone.com.ar> | ||
1719 | */ | 1721 | */ |
1720 | UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x0001, | 1722 | UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x0002, |
1721 | "Motorola", | 1723 | "Motorola", |
1722 | "RAZR V3i", | 1724 | "RAZR V3i/ROKR W5", |
1723 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1725 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1724 | US_FL_FIX_CAPACITY), | 1726 | US_FL_FIX_CAPACITY), |
1725 | 1727 | ||
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 2cdaf1ff8315..002b61b4f0f6 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -627,11 +627,9 @@ config FB_MAC | |||
627 | select FB_CFB_IMAGEBLIT | 627 | select FB_CFB_IMAGEBLIT |
628 | select FB_MACMODES | 628 | select FB_MACMODES |
629 | 629 | ||
630 | # bool ' Apple DAFB display support' CONFIG_FB_DAFB | ||
631 | config FB_HP300 | 630 | config FB_HP300 |
632 | bool | 631 | bool |
633 | depends on (FB = y) && HP300 | 632 | depends on (FB = y) && DIO |
634 | select FB_CFB_FILLRECT | ||
635 | select FB_CFB_IMAGEBLIT | 633 | select FB_CFB_IMAGEBLIT |
636 | default y | 634 | default y |
637 | 635 | ||
diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c index e6492c1048bf..05a328c11a8b 100644 --- a/drivers/video/amifb.c +++ b/drivers/video/amifb.c | |||
@@ -2261,7 +2261,7 @@ int __init amifb_init(void) | |||
2261 | amifb_setup(option); | 2261 | amifb_setup(option); |
2262 | #endif | 2262 | #endif |
2263 | if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_VIDEO)) | 2263 | if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_VIDEO)) |
2264 | return -ENXIO; | 2264 | return -ENODEV; |
2265 | 2265 | ||
2266 | /* | 2266 | /* |
2267 | * We request all registers starting from bplpt[0] | 2267 | * We request all registers starting from bplpt[0] |
@@ -2333,7 +2333,7 @@ default_chipset: | |||
2333 | strcat(fb_info.fix.id, "Unknown"); | 2333 | strcat(fb_info.fix.id, "Unknown"); |
2334 | goto default_chipset; | 2334 | goto default_chipset; |
2335 | #else /* CONFIG_FB_AMIGA_OCS */ | 2335 | #else /* CONFIG_FB_AMIGA_OCS */ |
2336 | err = -ENXIO; | 2336 | err = -ENODEV; |
2337 | goto amifb_error; | 2337 | goto amifb_error; |
2338 | #endif /* CONFIG_FB_AMIGA_OCS */ | 2338 | #endif /* CONFIG_FB_AMIGA_OCS */ |
2339 | break; | 2339 | break; |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index e4bcf5376a99..bd4ac0bafecb 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -3356,7 +3356,7 @@ static int __devinit atyfb_setup_generic(struct pci_dev *pdev, struct fb_info *i | |||
3356 | 3356 | ||
3357 | info->fix.mmio_start = raddr; | 3357 | info->fix.mmio_start = raddr; |
3358 | par->ati_regbase = ioremap(info->fix.mmio_start, 0x1000); | 3358 | par->ati_regbase = ioremap(info->fix.mmio_start, 0x1000); |
3359 | if (par->ati_regbase == 0) | 3359 | if (par->ati_regbase == NULL) |
3360 | return -ENOMEM; | 3360 | return -ENOMEM; |
3361 | 3361 | ||
3362 | info->fix.mmio_start += par->aux_start ? 0x400 : 0xc00; | 3362 | info->fix.mmio_start += par->aux_start ? 0x400 : 0xc00; |
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 72cd0d2f14ec..400e9264e456 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c | |||
@@ -2277,8 +2277,8 @@ static int __devinit radeonfb_pci_register (struct pci_dev *pdev, | |||
2277 | do { | 2277 | do { |
2278 | rinfo->fb_base = ioremap (rinfo->fb_base_phys, | 2278 | rinfo->fb_base = ioremap (rinfo->fb_base_phys, |
2279 | rinfo->mapped_vram); | 2279 | rinfo->mapped_vram); |
2280 | } while ( rinfo->fb_base == 0 && | 2280 | } while (rinfo->fb_base == NULL && |
2281 | ((rinfo->mapped_vram /=2) >= MIN_MAPPED_VRAM) ); | 2281 | ((rinfo->mapped_vram /= 2) >= MIN_MAPPED_VRAM)); |
2282 | 2282 | ||
2283 | if (rinfo->fb_base == NULL) { | 2283 | if (rinfo->fb_base == NULL) { |
2284 | printk (KERN_ERR "radeonfb (%s): cannot map FB\n", | 2284 | printk (KERN_ERR "radeonfb (%s): cannot map FB\n", |
diff --git a/drivers/video/display/display-sysfs.c b/drivers/video/display/display-sysfs.c index 35477177bef4..6ef800bdf482 100644 --- a/drivers/video/display/display-sysfs.c +++ b/drivers/video/display/display-sysfs.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/ctype.h> | 26 | #include <linux/ctype.h> |
27 | #include <linux/idr.h> | 27 | #include <linux/idr.h> |
28 | #include <linux/err.h> | 28 | #include <linux/err.h> |
29 | #include <linux/kdev_t.h> | ||
29 | 30 | ||
30 | static ssize_t display_show_name(struct device *dev, | 31 | static ssize_t display_show_name(struct device *dev, |
31 | struct device_attribute *attr, char *buf) | 32 | struct device_attribute *attr, char *buf) |
@@ -152,10 +153,13 @@ struct display_device *display_device_register(struct display_driver *driver, | |||
152 | mutex_unlock(&allocated_dsp_lock); | 153 | mutex_unlock(&allocated_dsp_lock); |
153 | 154 | ||
154 | if (!ret) { | 155 | if (!ret) { |
155 | new_dev->dev = device_create(display_class, parent, 0, | 156 | new_dev->dev = device_create_drvdata(display_class, |
156 | "display%d", new_dev->idx); | 157 | parent, |
158 | MKDEV(0,0), | ||
159 | new_dev, | ||
160 | "display%d", | ||
161 | new_dev->idx); | ||
157 | if (!IS_ERR(new_dev->dev)) { | 162 | if (!IS_ERR(new_dev->dev)) { |
158 | dev_set_drvdata(new_dev->dev, new_dev); | ||
159 | new_dev->parent = parent; | 163 | new_dev->parent = parent; |
160 | new_dev->driver = driver; | 164 | new_dev->driver = driver; |
161 | mutex_init(&new_dev->lock); | 165 | mutex_init(&new_dev->lock); |
diff --git a/drivers/video/dnfb.c b/drivers/video/dnfb.c index b083ea7e9c69..606da043f4b4 100644 --- a/drivers/video/dnfb.c +++ b/drivers/video/dnfb.c | |||
@@ -284,6 +284,9 @@ int __init dnfb_init(void) | |||
284 | { | 284 | { |
285 | int ret; | 285 | int ret; |
286 | 286 | ||
287 | if (!MACH_IS_APOLLO) | ||
288 | return -ENODEV; | ||
289 | |||
287 | if (fb_get_options("dnfb", NULL)) | 290 | if (fb_get_options("dnfb", NULL)) |
288 | return -ENODEV; | 291 | return -ENODEV; |
289 | 292 | ||
diff --git a/drivers/video/hpfb.c b/drivers/video/hpfb.c index 2eb4fb159084..b8ebff1e8493 100644 --- a/drivers/video/hpfb.c +++ b/drivers/video/hpfb.c | |||
@@ -382,7 +382,7 @@ int __init hpfb_init(void) | |||
382 | #define INTFBPADDR 0x560000 | 382 | #define INTFBPADDR 0x560000 |
383 | 383 | ||
384 | if (!MACH_IS_HP300) | 384 | if (!MACH_IS_HP300) |
385 | return -ENXIO; | 385 | return -ENODEV; |
386 | 386 | ||
387 | if (fb_get_options("hpfb", NULL)) | 387 | if (fb_get_options("hpfb", NULL)) |
388 | return -ENODEV; | 388 | return -ENODEV; |
diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h index f3107ad7e545..95883236c0cd 100644 --- a/drivers/video/matrox/matroxfb_base.h +++ b/drivers/video/matrox/matroxfb_base.h | |||
@@ -200,7 +200,7 @@ static inline int mga_ioremap(unsigned long phys, unsigned long size, int flags, | |||
200 | virt->vaddr = ioremap_nocache(phys, size); | 200 | virt->vaddr = ioremap_nocache(phys, size); |
201 | else | 201 | else |
202 | virt->vaddr = ioremap(phys, size); | 202 | virt->vaddr = ioremap(phys, size); |
203 | return (virt->vaddr == 0); /* 0, !0... 0, error_code in future */ | 203 | return (virt->vaddr == NULL); /* 0, !0... 0, error_code in future */ |
204 | } | 204 | } |
205 | 205 | ||
206 | static inline void mga_iounmap(vaddr_t va) { | 206 | static inline void mga_iounmap(vaddr_t va) { |
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 48aea39c35a5..274bc93ab7d8 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c | |||
@@ -355,9 +355,8 @@ static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
355 | } | 355 | } |
356 | 356 | ||
357 | #ifdef CONFIG_CPU_FREQ | 357 | #ifdef CONFIG_CPU_FREQ |
358 | pr_debug("pxafb: dma period = %d ps, clock = %d kHz\n", | 358 | pr_debug("pxafb: dma period = %d ps\n", |
359 | pxafb_display_dma_period(var), | 359 | pxafb_display_dma_period(var)); |
360 | get_clk_frequency_khz(0)); | ||
361 | #endif | 360 | #endif |
362 | 361 | ||
363 | return 0; | 362 | return 0; |
@@ -1352,7 +1351,6 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev) | |||
1352 | struct pxafb_info *fbi; | 1351 | struct pxafb_info *fbi; |
1353 | void *addr; | 1352 | void *addr; |
1354 | struct pxafb_mach_info *inf = dev->platform_data; | 1353 | struct pxafb_mach_info *inf = dev->platform_data; |
1355 | struct pxafb_mode_info *mode = inf->modes; | ||
1356 | 1354 | ||
1357 | /* Alloc the pxafb_info and pseudo_palette in one step */ | 1355 | /* Alloc the pxafb_info and pseudo_palette in one step */ |
1358 | fbi = kmalloc(sizeof(struct pxafb_info) + sizeof(u32) * 16, GFP_KERNEL); | 1356 | fbi = kmalloc(sizeof(struct pxafb_info) + sizeof(u32) * 16, GFP_KERNEL); |
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index 13b38cbbe4cf..f0598961c6b0 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c | |||
@@ -1,75 +1,15 @@ | |||
1 | /* | 1 | /* linux/drivers/video/s3c2410fb.c |
2 | * linux/drivers/video/s3c2410fb.c | 2 | * Copyright (c) 2004,2005 Arnaud Patard |
3 | * Copyright (c) Arnaud Patard, Ben Dooks | 3 | * Copyright (c) 2004-2008 Ben Dooks |
4 | * | ||
5 | * S3C2410 LCD Framebuffer Driver | ||
4 | * | 6 | * |
5 | * This file is subject to the terms and conditions of the GNU General Public | 7 | * This file is subject to the terms and conditions of the GNU General Public |
6 | * License. See the file COPYING in the main directory of this archive for | 8 | * License. See the file COPYING in the main directory of this archive for |
7 | * more details. | 9 | * more details. |
8 | * | 10 | * |
9 | * S3C2410 LCD Controller Frame Buffer Driver | 11 | * Driver based on skeletonfb.c, sa1100fb.c and others. |
10 | * based on skeletonfb.c, sa1100fb.c and others | 12 | */ |
11 | * | ||
12 | * ChangeLog | ||
13 | * 2005-04-07: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
14 | * - u32 state -> pm_message_t state | ||
15 | * - S3C2410_{VA,SZ}_LCD -> S3C24XX | ||
16 | * | ||
17 | * 2005-03-15: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
18 | * - Removed the ioctl | ||
19 | * - use readl/writel instead of __raw_writel/__raw_readl | ||
20 | * | ||
21 | * 2004-12-04: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
22 | * - Added the possibility to set on or off the | ||
23 | * debugging messages | ||
24 | * - Replaced 0 and 1 by on or off when reading the | ||
25 | * /sys files | ||
26 | * | ||
27 | * 2005-03-23: Ben Dooks <ben-linux@fluff.org> | ||
28 | * - added non 16bpp modes | ||
29 | * - updated platform information for range of x/y/bpp | ||
30 | * - add code to ensure palette is written correctly | ||
31 | * - add pixel clock divisor control | ||
32 | * | ||
33 | * 2004-11-11: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
34 | * - Removed the use of currcon as it no more exists | ||
35 | * - Added LCD power sysfs interface | ||
36 | * | ||
37 | * 2004-11-03: Ben Dooks <ben-linux@fluff.org> | ||
38 | * - minor cleanups | ||
39 | * - add suspend/resume support | ||
40 | * - s3c2410fb_setcolreg() not valid in >8bpp modes | ||
41 | * - removed last CONFIG_FB_S3C2410_FIXED | ||
42 | * - ensure lcd controller stopped before cleanup | ||
43 | * - added sysfs interface for backlight power | ||
44 | * - added mask for gpio configuration | ||
45 | * - ensured IRQs disabled during GPIO configuration | ||
46 | * - disable TPAL before enabling video | ||
47 | * | ||
48 | * 2004-09-20: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
49 | * - Suppress command line options | ||
50 | * | ||
51 | * 2004-09-15: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
52 | * - code cleanup | ||
53 | * | ||
54 | * 2004-09-07: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
55 | * - Renamed from h1940fb.c to s3c2410fb.c | ||
56 | * - Add support for different devices | ||
57 | * - Backlight support | ||
58 | * | ||
59 | * 2004-09-05: Herbert Pötzl <herbert@13thfloor.at> | ||
60 | * - added clock (de-)allocation code | ||
61 | * - added fixem fbmem option | ||
62 | * | ||
63 | * 2004-07-27: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
64 | * - code cleanup | ||
65 | * - added a forgotten return in h1940fb_init | ||
66 | * | ||
67 | * 2004-07-19: Herbert Pötzl <herbert@13thfloor.at> | ||
68 | * - code cleanup and extended debugging | ||
69 | * | ||
70 | * 2004-07-15: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
71 | * - First version | ||
72 | */ | ||
73 | 13 | ||
74 | #include <linux/module.h> | 14 | #include <linux/module.h> |
75 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
@@ -580,6 +520,27 @@ static int s3c2410fb_setcolreg(unsigned regno, | |||
580 | return 0; | 520 | return 0; |
581 | } | 521 | } |
582 | 522 | ||
523 | /* s3c2410fb_lcd_enable | ||
524 | * | ||
525 | * shutdown the lcd controller | ||
526 | */ | ||
527 | static void s3c2410fb_lcd_enable(struct s3c2410fb_info *fbi, int enable) | ||
528 | { | ||
529 | unsigned long flags; | ||
530 | |||
531 | local_irq_save(flags); | ||
532 | |||
533 | if (enable) | ||
534 | fbi->regs.lcdcon1 |= S3C2410_LCDCON1_ENVID; | ||
535 | else | ||
536 | fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID; | ||
537 | |||
538 | writel(fbi->regs.lcdcon1, fbi->io + S3C2410_LCDCON1); | ||
539 | |||
540 | local_irq_restore(flags); | ||
541 | } | ||
542 | |||
543 | |||
583 | /* | 544 | /* |
584 | * s3c2410fb_blank | 545 | * s3c2410fb_blank |
585 | * @blank_mode: the blank mode we want. | 546 | * @blank_mode: the blank mode we want. |
@@ -589,9 +550,6 @@ static int s3c2410fb_setcolreg(unsigned regno, | |||
589 | * blanking succeeded, != 0 if un-/blanking failed due to e.g. a | 550 | * blanking succeeded, != 0 if un-/blanking failed due to e.g. a |
590 | * video mode which doesn't support it. Implements VESA suspend | 551 | * video mode which doesn't support it. Implements VESA suspend |
591 | * and powerdown modes on hardware that supports disabling hsync/vsync: | 552 | * and powerdown modes on hardware that supports disabling hsync/vsync: |
592 | * blank_mode == 2: suspend vsync | ||
593 | * blank_mode == 3: suspend hsync | ||
594 | * blank_mode == 4: powerdown | ||
595 | * | 553 | * |
596 | * Returns negative errno on error, or zero on success. | 554 | * Returns negative errno on error, or zero on success. |
597 | * | 555 | * |
@@ -605,6 +563,12 @@ static int s3c2410fb_blank(int blank_mode, struct fb_info *info) | |||
605 | 563 | ||
606 | tpal_reg += is_s3c2412(fbi) ? S3C2412_TPAL : S3C2410_TPAL; | 564 | tpal_reg += is_s3c2412(fbi) ? S3C2412_TPAL : S3C2410_TPAL; |
607 | 565 | ||
566 | if (blank_mode == FB_BLANK_POWERDOWN) { | ||
567 | s3c2410fb_lcd_enable(fbi, 0); | ||
568 | } else { | ||
569 | s3c2410fb_lcd_enable(fbi, 1); | ||
570 | } | ||
571 | |||
608 | if (blank_mode == FB_BLANK_UNBLANK) | 572 | if (blank_mode == FB_BLANK_UNBLANK) |
609 | writel(0x0, tpal_reg); | 573 | writel(0x0, tpal_reg); |
610 | else { | 574 | else { |
@@ -948,7 +912,10 @@ static int __init s3c24xxfb_probe(struct platform_device *pdev, | |||
948 | } | 912 | } |
949 | 913 | ||
950 | /* create device files */ | 914 | /* create device files */ |
951 | device_create_file(&pdev->dev, &dev_attr_debug); | 915 | ret = device_create_file(&pdev->dev, &dev_attr_debug); |
916 | if (ret) { | ||
917 | printk(KERN_ERR "failed to add debug attribute\n"); | ||
918 | } | ||
952 | 919 | ||
953 | printk(KERN_INFO "fb%d: %s frame buffer device\n", | 920 | printk(KERN_INFO "fb%d: %s frame buffer device\n", |
954 | fbinfo->node, fbinfo->fix.id); | 921 | fbinfo->node, fbinfo->fix.id); |
@@ -983,21 +950,6 @@ static int __init s3c2412fb_probe(struct platform_device *pdev) | |||
983 | return s3c24xxfb_probe(pdev, DRV_S3C2412); | 950 | return s3c24xxfb_probe(pdev, DRV_S3C2412); |
984 | } | 951 | } |
985 | 952 | ||
986 | /* s3c2410fb_stop_lcd | ||
987 | * | ||
988 | * shutdown the lcd controller | ||
989 | */ | ||
990 | static void s3c2410fb_stop_lcd(struct s3c2410fb_info *fbi) | ||
991 | { | ||
992 | unsigned long flags; | ||
993 | |||
994 | local_irq_save(flags); | ||
995 | |||
996 | fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID; | ||
997 | writel(fbi->regs.lcdcon1, fbi->io + S3C2410_LCDCON1); | ||
998 | |||
999 | local_irq_restore(flags); | ||
1000 | } | ||
1001 | 953 | ||
1002 | /* | 954 | /* |
1003 | * Cleanup | 955 | * Cleanup |
@@ -1010,7 +962,7 @@ static int s3c2410fb_remove(struct platform_device *pdev) | |||
1010 | 962 | ||
1011 | unregister_framebuffer(fbinfo); | 963 | unregister_framebuffer(fbinfo); |
1012 | 964 | ||
1013 | s3c2410fb_stop_lcd(info); | 965 | s3c2410fb_lcd_enable(info, 0); |
1014 | msleep(1); | 966 | msleep(1); |
1015 | 967 | ||
1016 | s3c2410fb_unmap_video_memory(fbinfo); | 968 | s3c2410fb_unmap_video_memory(fbinfo); |
@@ -1043,7 +995,7 @@ static int s3c2410fb_suspend(struct platform_device *dev, pm_message_t state) | |||
1043 | struct fb_info *fbinfo = platform_get_drvdata(dev); | 995 | struct fb_info *fbinfo = platform_get_drvdata(dev); |
1044 | struct s3c2410fb_info *info = fbinfo->par; | 996 | struct s3c2410fb_info *info = fbinfo->par; |
1045 | 997 | ||
1046 | s3c2410fb_stop_lcd(info); | 998 | s3c2410fb_lcd_enable(info, 0); |
1047 | 999 | ||
1048 | /* sleep before disabling the clock, we need to ensure | 1000 | /* sleep before disabling the clock, we need to ensure |
1049 | * the LCD DMA engine is not going to get back on the bus | 1001 | * the LCD DMA engine is not going to get back on the bus |
@@ -1118,3 +1070,5 @@ MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>, " | |||
1118 | "Ben Dooks <ben-linux@fluff.org>"); | 1070 | "Ben Dooks <ben-linux@fluff.org>"); |
1119 | MODULE_DESCRIPTION("Framebuffer driver for the s3c2410"); | 1071 | MODULE_DESCRIPTION("Framebuffer driver for the s3c2410"); |
1120 | MODULE_LICENSE("GPL"); | 1072 | MODULE_LICENSE("GPL"); |
1073 | MODULE_ALIAS("platform:s3c2410-lcd"); | ||
1074 | MODULE_ALIAS("platform:s3c2412-lcd"); | ||
diff --git a/drivers/video/s3c2410fb.h b/drivers/video/s3c2410fb.h index dbb73b95e2ef..9a6ba3e9d1b8 100644 --- a/drivers/video/s3c2410fb.h +++ b/drivers/video/s3c2410fb.h | |||
@@ -1,26 +1,14 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/video/s3c2410fb.h | 2 | * linux/drivers/video/s3c2410fb.h |
3 | * Copyright (c) Arnaud Patard | 3 | * Copyright (c) 2004 Arnaud Patard |
4 | * | ||
5 | * S3C2410 LCD Framebuffer Driver | ||
4 | * | 6 | * |
5 | * This file is subject to the terms and conditions of the GNU General Public | 7 | * This file is subject to the terms and conditions of the GNU General Public |
6 | * License. See the file COPYING in the main directory of this archive for | 8 | * License. See the file COPYING in the main directory of this archive for |
7 | * more details. | 9 | * more details. |
8 | * | 10 | * |
9 | * S3C2410 LCD Controller Frame Buffer Driver | 11 | */ |
10 | * based on skeletonfb.c, sa1100fb.h | ||
11 | * | ||
12 | * ChangeLog | ||
13 | * | ||
14 | * 2004-12-04: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
15 | * - Moved dprintk to s3c2410fb.c | ||
16 | * | ||
17 | * 2004-09-07: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
18 | * - Renamed from h1940fb.h to s3c2410fb.h | ||
19 | * - Changed h1940 to s3c2410 | ||
20 | * | ||
21 | * 2004-07-15: Arnaud Patard <arnaud.patard@rtp-net.org> | ||
22 | * - First version | ||
23 | */ | ||
24 | 12 | ||
25 | #ifndef __S3C2410FB_H | 13 | #ifndef __S3C2410FB_H |
26 | #define __S3C2410FB_H | 14 | #define __S3C2410FB_H |
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index 73803624c131..b9343844cd1f 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c | |||
@@ -5787,7 +5787,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
5787 | } else { | 5787 | } else { |
5788 | struct sis_video_info *countvideo = card_list; | 5788 | struct sis_video_info *countvideo = card_list; |
5789 | ivideo->cardnumber = 1; | 5789 | ivideo->cardnumber = 1; |
5790 | while((countvideo = countvideo->next) != 0) | 5790 | while((countvideo = countvideo->next) != NULL) |
5791 | ivideo->cardnumber++; | 5791 | ivideo->cardnumber++; |
5792 | } | 5792 | } |
5793 | 5793 | ||
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c index 742b5c656d66..15d4a768b1f6 100644 --- a/drivers/video/sm501fb.c +++ b/drivers/video/sm501fb.c | |||
@@ -663,14 +663,14 @@ static void sm501fb_panel_power(struct sm501fb_info *fbi, int to) | |||
663 | sm501fb_sync_regs(fbi); | 663 | sm501fb_sync_regs(fbi); |
664 | mdelay(10); | 664 | mdelay(10); |
665 | 665 | ||
666 | if (pd->flags & SM501FB_FLAG_PANEL_USE_VBIASEN) { | 666 | if (!(pd->flags & SM501FB_FLAG_PANEL_NO_VBIASEN)) { |
667 | control |= SM501_DC_PANEL_CONTROL_BIAS; /* VBIASEN */ | 667 | control |= SM501_DC_PANEL_CONTROL_BIAS; /* VBIASEN */ |
668 | writel(control, ctrl_reg); | 668 | writel(control, ctrl_reg); |
669 | sm501fb_sync_regs(fbi); | 669 | sm501fb_sync_regs(fbi); |
670 | mdelay(10); | 670 | mdelay(10); |
671 | } | 671 | } |
672 | 672 | ||
673 | if (pd->flags & SM501FB_FLAG_PANEL_USE_FPEN) { | 673 | if (!(pd->flags & SM501FB_FLAG_PANEL_NO_FPEN)) { |
674 | control |= SM501_DC_PANEL_CONTROL_FPEN; | 674 | control |= SM501_DC_PANEL_CONTROL_FPEN; |
675 | writel(control, ctrl_reg); | 675 | writel(control, ctrl_reg); |
676 | sm501fb_sync_regs(fbi); | 676 | sm501fb_sync_regs(fbi); |
@@ -678,14 +678,14 @@ static void sm501fb_panel_power(struct sm501fb_info *fbi, int to) | |||
678 | } | 678 | } |
679 | } else if (!to && (control & SM501_DC_PANEL_CONTROL_VDD) != 0) { | 679 | } else if (!to && (control & SM501_DC_PANEL_CONTROL_VDD) != 0) { |
680 | /* disable panel power */ | 680 | /* disable panel power */ |
681 | if (pd->flags & SM501FB_FLAG_PANEL_USE_FPEN) { | 681 | if (!(pd->flags & SM501FB_FLAG_PANEL_NO_FPEN)) { |
682 | control &= ~SM501_DC_PANEL_CONTROL_FPEN; | 682 | control &= ~SM501_DC_PANEL_CONTROL_FPEN; |
683 | writel(control, ctrl_reg); | 683 | writel(control, ctrl_reg); |
684 | sm501fb_sync_regs(fbi); | 684 | sm501fb_sync_regs(fbi); |
685 | mdelay(10); | 685 | mdelay(10); |
686 | } | 686 | } |
687 | 687 | ||
688 | if (pd->flags & SM501FB_FLAG_PANEL_USE_VBIASEN) { | 688 | if (!(pd->flags & SM501FB_FLAG_PANEL_NO_VBIASEN)) { |
689 | control &= ~SM501_DC_PANEL_CONTROL_BIAS; | 689 | control &= ~SM501_DC_PANEL_CONTROL_BIAS; |
690 | writel(control, ctrl_reg); | 690 | writel(control, ctrl_reg); |
691 | sm501fb_sync_regs(fbi); | 691 | sm501fb_sync_regs(fbi); |
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 13866789b356..0f3c2bb7bf35 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c | |||
@@ -2,6 +2,9 @@ | |||
2 | #include <linux/spinlock.h> | 2 | #include <linux/spinlock.h> |
3 | #include <linux/virtio_config.h> | 3 | #include <linux/virtio_config.h> |
4 | 4 | ||
5 | /* Unique numbering for virtio devices. */ | ||
6 | static unsigned int dev_index; | ||
7 | |||
5 | static ssize_t device_show(struct device *_d, | 8 | static ssize_t device_show(struct device *_d, |
6 | struct device_attribute *attr, char *buf) | 9 | struct device_attribute *attr, char *buf) |
7 | { | 10 | { |
@@ -166,7 +169,10 @@ int register_virtio_device(struct virtio_device *dev) | |||
166 | int err; | 169 | int err; |
167 | 170 | ||
168 | dev->dev.bus = &virtio_bus; | 171 | dev->dev.bus = &virtio_bus; |
169 | sprintf(dev->dev.bus_id, "%u", dev->index); | 172 | |
173 | /* Assign a unique device index and hence name. */ | ||
174 | dev->index = dev_index++; | ||
175 | sprintf(dev->dev.bus_id, "virtio%u", dev->index); | ||
170 | 176 | ||
171 | /* We always start by resetting the device, in case a previous | 177 | /* We always start by resetting the device, in case a previous |
172 | * driver messed it up. This also tests that code path a little. */ | 178 | * driver messed it up. This also tests that code path a little. */ |
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 27e9fc9117cd..eae7236310e4 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
@@ -78,9 +78,6 @@ static struct device virtio_pci_root = { | |||
78 | .bus_id = "virtio-pci", | 78 | .bus_id = "virtio-pci", |
79 | }; | 79 | }; |
80 | 80 | ||
81 | /* Unique numbering for devices under the kvm root */ | ||
82 | static unsigned int dev_index; | ||
83 | |||
84 | /* Convert a generic virtio device to our structure */ | 81 | /* Convert a generic virtio device to our structure */ |
85 | static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev) | 82 | static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev) |
86 | { | 83 | { |
@@ -325,10 +322,6 @@ static int __devinit virtio_pci_probe(struct pci_dev *pci_dev, | |||
325 | if (vp_dev == NULL) | 322 | if (vp_dev == NULL) |
326 | return -ENOMEM; | 323 | return -ENOMEM; |
327 | 324 | ||
328 | snprintf(vp_dev->vdev.dev.bus_id, BUS_ID_SIZE, "virtio%d", dev_index); | ||
329 | vp_dev->vdev.index = dev_index; | ||
330 | dev_index++; | ||
331 | |||
332 | vp_dev->vdev.dev.parent = &virtio_pci_root; | 325 | vp_dev->vdev.dev.parent = &virtio_pci_root; |
333 | vp_dev->vdev.config = &virtio_pci_config_ops; | 326 | vp_dev->vdev.config = &virtio_pci_config_ops; |
334 | vp_dev->pci_dev = pci_dev; | 327 | vp_dev->pci_dev = pci_dev; |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 937a49d6772c..72bf8bc09014 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -227,7 +227,6 @@ static bool vring_enable_cb(struct virtqueue *_vq) | |||
227 | struct vring_virtqueue *vq = to_vvq(_vq); | 227 | struct vring_virtqueue *vq = to_vvq(_vq); |
228 | 228 | ||
229 | START_USE(vq); | 229 | START_USE(vq); |
230 | BUG_ON(!(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)); | ||
231 | 230 | ||
232 | /* We optimistically turn back on interrupts, then check if there was | 231 | /* We optimistically turn back on interrupts, then check if there was |
233 | * more to do. */ | 232 | * more to do. */ |
@@ -254,13 +253,6 @@ irqreturn_t vring_interrupt(int irq, void *_vq) | |||
254 | if (unlikely(vq->broken)) | 253 | if (unlikely(vq->broken)) |
255 | return IRQ_HANDLED; | 254 | return IRQ_HANDLED; |
256 | 255 | ||
257 | /* Other side may have missed us turning off the interrupt, | ||
258 | * but we should preserve disable semantic for virtio users. */ | ||
259 | if (unlikely(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) { | ||
260 | pr_debug("virtqueue interrupt after disable for %p\n", vq); | ||
261 | return IRQ_HANDLED; | ||
262 | } | ||
263 | |||
264 | pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback); | 256 | pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback); |
265 | if (vq->vq.callback) | 257 | if (vq->vq.callback) |
266 | vq->vq.callback(&vq->vq); | 258 | vq->vq.callback(&vq->vq); |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 254d115cafab..ccb78f66c2b6 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -295,6 +295,19 @@ config ALIM7101_WDT | |||
295 | 295 | ||
296 | Most people will say N. | 296 | Most people will say N. |
297 | 297 | ||
298 | config GEODE_WDT | ||
299 | tristate "AMD Geode CS5535/CS5536 Watchdog" | ||
300 | depends on MGEODE_LX | ||
301 | help | ||
302 | This driver enables a watchdog capability built into the | ||
303 | CS5535/CS5536 companion chips for the AMD Geode GX and LX | ||
304 | processors. This watchdog watches your kernel to make sure | ||
305 | it doesn't freeze, and if it does, it reboots your computer after | ||
306 | a certain amount of time. | ||
307 | |||
308 | You can compile this driver directly into the kernel, or use | ||
309 | it as a module. The module will be called geodewdt. | ||
310 | |||
298 | config SC520_WDT | 311 | config SC520_WDT |
299 | tristate "AMD Elan SC520 processor Watchdog" | 312 | tristate "AMD Elan SC520 processor Watchdog" |
300 | depends on X86 | 313 | depends on X86 |
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index f3fb170fe5c6..25b352b664d9 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile | |||
@@ -59,6 +59,7 @@ obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o | |||
59 | obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o | 59 | obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o |
60 | obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o | 60 | obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o |
61 | obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o | 61 | obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o |
62 | obj-$(CONFIG_GEODE_WDT) += geodewdt.o | ||
62 | obj-$(CONFIG_SC520_WDT) += sc520_wdt.o | 63 | obj-$(CONFIG_SC520_WDT) += sc520_wdt.o |
63 | obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o | 64 | obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o |
64 | obj-$(CONFIG_IB700_WDT) += ib700wdt.o | 65 | obj-$(CONFIG_IB700_WDT) += ib700wdt.o |
diff --git a/drivers/watchdog/bfin_wdt.c b/drivers/watchdog/bfin_wdt.c index 1237113dc14a..03b3e3d91e7c 100644 --- a/drivers/watchdog/bfin_wdt.c +++ b/drivers/watchdog/bfin_wdt.c | |||
@@ -29,7 +29,8 @@ | |||
29 | 29 | ||
30 | #define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args) | 30 | #define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args) |
31 | #define stampit() stamp("here i am") | 31 | #define stampit() stamp("here i am") |
32 | #define pr_init(fmt, args...) ({ static const __initdata char __fmt[] = fmt; printk(__fmt, ## args); }) | 32 | #define pr_devinit(fmt, args...) ({ static const __devinitconst char __fmt[] = fmt; printk(__fmt, ## args); }) |
33 | #define pr_init(fmt, args...) ({ static const __initconst char __fmt[] = fmt; printk(__fmt, ## args); }) | ||
33 | 34 | ||
34 | #define WATCHDOG_NAME "bfin-wdt" | 35 | #define WATCHDOG_NAME "bfin-wdt" |
35 | #define PFX WATCHDOG_NAME ": " | 36 | #define PFX WATCHDOG_NAME ": " |
@@ -377,20 +378,6 @@ static int bfin_wdt_resume(struct platform_device *pdev) | |||
377 | # define bfin_wdt_resume NULL | 378 | # define bfin_wdt_resume NULL |
378 | #endif | 379 | #endif |
379 | 380 | ||
380 | static struct platform_device bfin_wdt_device = { | ||
381 | .name = WATCHDOG_NAME, | ||
382 | .id = -1, | ||
383 | }; | ||
384 | |||
385 | static struct platform_driver bfin_wdt_driver = { | ||
386 | .driver = { | ||
387 | .name = WATCHDOG_NAME, | ||
388 | .owner = THIS_MODULE, | ||
389 | }, | ||
390 | .suspend = bfin_wdt_suspend, | ||
391 | .resume = bfin_wdt_resume, | ||
392 | }; | ||
393 | |||
394 | static const struct file_operations bfin_wdt_fops = { | 381 | static const struct file_operations bfin_wdt_fops = { |
395 | .owner = THIS_MODULE, | 382 | .owner = THIS_MODULE, |
396 | .llseek = no_llseek, | 383 | .llseek = no_llseek, |
@@ -418,11 +405,67 @@ static struct notifier_block bfin_wdt_notifier = { | |||
418 | }; | 405 | }; |
419 | 406 | ||
420 | /** | 407 | /** |
421 | * bfin_wdt_init - Initialize module | 408 | * bfin_wdt_probe - Initialize module |
422 | * | 409 | * |
423 | * Registers the device and notifier handler. Actual device | 410 | * Registers the misc device and notifier handler. Actual device |
424 | * initialization is handled by bfin_wdt_open(). | 411 | * initialization is handled by bfin_wdt_open(). |
425 | */ | 412 | */ |
413 | static int __devinit bfin_wdt_probe(struct platform_device *pdev) | ||
414 | { | ||
415 | int ret; | ||
416 | |||
417 | ret = register_reboot_notifier(&bfin_wdt_notifier); | ||
418 | if (ret) { | ||
419 | pr_devinit(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", ret); | ||
420 | return ret; | ||
421 | } | ||
422 | |||
423 | ret = misc_register(&bfin_wdt_miscdev); | ||
424 | if (ret) { | ||
425 | pr_devinit(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", | ||
426 | WATCHDOG_MINOR, ret); | ||
427 | unregister_reboot_notifier(&bfin_wdt_notifier); | ||
428 | return ret; | ||
429 | } | ||
430 | |||
431 | pr_devinit(KERN_INFO PFX "initialized: timeout=%d sec (nowayout=%d)\n", | ||
432 | timeout, nowayout); | ||
433 | |||
434 | return 0; | ||
435 | } | ||
436 | |||
437 | /** | ||
438 | * bfin_wdt_remove - Initialize module | ||
439 | * | ||
440 | * Unregisters the misc device and notifier handler. Actual device | ||
441 | * deinitialization is handled by bfin_wdt_close(). | ||
442 | */ | ||
443 | static int __devexit bfin_wdt_remove(struct platform_device *pdev) | ||
444 | { | ||
445 | misc_deregister(&bfin_wdt_miscdev); | ||
446 | unregister_reboot_notifier(&bfin_wdt_notifier); | ||
447 | return 0; | ||
448 | } | ||
449 | |||
450 | static struct platform_device *bfin_wdt_device; | ||
451 | |||
452 | static struct platform_driver bfin_wdt_driver = { | ||
453 | .probe = bfin_wdt_probe, | ||
454 | .remove = __devexit_p(bfin_wdt_remove), | ||
455 | .suspend = bfin_wdt_suspend, | ||
456 | .resume = bfin_wdt_resume, | ||
457 | .driver = { | ||
458 | .name = WATCHDOG_NAME, | ||
459 | .owner = THIS_MODULE, | ||
460 | }, | ||
461 | }; | ||
462 | |||
463 | /** | ||
464 | * bfin_wdt_init - Initialize module | ||
465 | * | ||
466 | * Checks the module params and registers the platform device & driver. | ||
467 | * Real work is in the platform probe function. | ||
468 | */ | ||
426 | static int __init bfin_wdt_init(void) | 469 | static int __init bfin_wdt_init(void) |
427 | { | 470 | { |
428 | int ret; | 471 | int ret; |
@@ -436,44 +479,32 @@ static int __init bfin_wdt_init(void) | |||
436 | /* Since this is an on-chip device and needs no board-specific | 479 | /* Since this is an on-chip device and needs no board-specific |
437 | * resources, we'll handle all the platform device stuff here. | 480 | * resources, we'll handle all the platform device stuff here. |
438 | */ | 481 | */ |
439 | ret = platform_device_register(&bfin_wdt_device); | 482 | ret = platform_driver_register(&bfin_wdt_driver); |
440 | if (ret) | ||
441 | return ret; | ||
442 | |||
443 | ret = platform_driver_probe(&bfin_wdt_driver, NULL); | ||
444 | if (ret) | ||
445 | return ret; | ||
446 | |||
447 | ret = register_reboot_notifier(&bfin_wdt_notifier); | ||
448 | if (ret) { | 483 | if (ret) { |
449 | pr_init(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", ret); | 484 | pr_init(KERN_ERR PFX "unable to register driver\n"); |
450 | return ret; | 485 | return ret; |
451 | } | 486 | } |
452 | 487 | ||
453 | ret = misc_register(&bfin_wdt_miscdev); | 488 | bfin_wdt_device = platform_device_register_simple(WATCHDOG_NAME, -1, NULL, 0); |
454 | if (ret) { | 489 | if (IS_ERR(bfin_wdt_device)) { |
455 | pr_init(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", | 490 | pr_init(KERN_ERR PFX "unable to register device\n"); |
456 | WATCHDOG_MINOR, ret); | 491 | platform_driver_unregister(&bfin_wdt_driver); |
457 | unregister_reboot_notifier(&bfin_wdt_notifier); | 492 | return PTR_ERR(bfin_wdt_device); |
458 | return ret; | ||
459 | } | 493 | } |
460 | 494 | ||
461 | pr_init(KERN_INFO PFX "initialized: timeout=%d sec (nowayout=%d)\n", | ||
462 | timeout, nowayout); | ||
463 | |||
464 | return 0; | 495 | return 0; |
465 | } | 496 | } |
466 | 497 | ||
467 | /** | 498 | /** |
468 | * bfin_wdt_exit - Deinitialize module | 499 | * bfin_wdt_exit - Deinitialize module |
469 | * | 500 | * |
470 | * Unregisters the device and notifier handler. Actual device | 501 | * Back out the platform device & driver steps. Real work is in the |
471 | * deinitialization is handled by bfin_wdt_close(). | 502 | * platform remove function. |
472 | */ | 503 | */ |
473 | static void __exit bfin_wdt_exit(void) | 504 | static void __exit bfin_wdt_exit(void) |
474 | { | 505 | { |
475 | misc_deregister(&bfin_wdt_miscdev); | 506 | platform_device_unregister(bfin_wdt_device); |
476 | unregister_reboot_notifier(&bfin_wdt_notifier); | 507 | platform_driver_unregister(&bfin_wdt_driver); |
477 | } | 508 | } |
478 | 509 | ||
479 | module_init(bfin_wdt_init); | 510 | module_init(bfin_wdt_init); |
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c index d362f5bf658a..c1ba0db48501 100644 --- a/drivers/watchdog/booke_wdt.c +++ b/drivers/watchdog/booke_wdt.c | |||
@@ -1,12 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/char/watchdog/booke_wdt.c | ||
3 | * | ||
4 | * Watchdog timer for PowerPC Book-E systems | 2 | * Watchdog timer for PowerPC Book-E systems |
5 | * | 3 | * |
6 | * Author: Matthew McClintock | 4 | * Author: Matthew McClintock |
7 | * Maintainer: Kumar Gala <galak@kernel.crashing.org> | 5 | * Maintainer: Kumar Gala <galak@kernel.crashing.org> |
8 | * | 6 | * |
9 | * Copyright 2005 Freescale Semiconductor Inc. | 7 | * Copyright 2005, 2008 Freescale Semiconductor Inc. |
10 | * | 8 | * |
11 | * This program is free software; you can redistribute it and/or modify it | 9 | * This program is free software; you can redistribute it and/or modify it |
12 | * under the terms of the GNU General Public License as published by the | 10 | * under the terms of the GNU General Public License as published by the |
@@ -16,6 +14,7 @@ | |||
16 | 14 | ||
17 | #include <linux/module.h> | 15 | #include <linux/module.h> |
18 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
17 | #include <linux/smp.h> | ||
19 | #include <linux/miscdevice.h> | 18 | #include <linux/miscdevice.h> |
20 | #include <linux/notifier.h> | 19 | #include <linux/notifier.h> |
21 | #include <linux/watchdog.h> | 20 | #include <linux/watchdog.h> |
@@ -38,7 +37,7 @@ | |||
38 | #define WDT_PERIOD_DEFAULT 3 /* Refer to the PPC40x and PPC4xx manuals */ | 37 | #define WDT_PERIOD_DEFAULT 3 /* Refer to the PPC40x and PPC4xx manuals */ |
39 | #endif /* for timing information */ | 38 | #endif /* for timing information */ |
40 | 39 | ||
41 | u32 booke_wdt_enabled = 0; | 40 | u32 booke_wdt_enabled; |
42 | u32 booke_wdt_period = WDT_PERIOD_DEFAULT; | 41 | u32 booke_wdt_period = WDT_PERIOD_DEFAULT; |
43 | 42 | ||
44 | #ifdef CONFIG_FSL_BOOKE | 43 | #ifdef CONFIG_FSL_BOOKE |
@@ -47,33 +46,31 @@ u32 booke_wdt_period = WDT_PERIOD_DEFAULT; | |||
47 | #define WDTP(x) (TCR_WP(x)) | 46 | #define WDTP(x) (TCR_WP(x)) |
48 | #endif | 47 | #endif |
49 | 48 | ||
50 | /* | 49 | static DEFINE_SPINLOCK(booke_wdt_lock); |
51 | * booke_wdt_ping: | 50 | |
52 | */ | 51 | static void __booke_wdt_ping(void *data) |
53 | static __inline__ void booke_wdt_ping(void) | ||
54 | { | 52 | { |
55 | mtspr(SPRN_TSR, TSR_ENW|TSR_WIS); | 53 | mtspr(SPRN_TSR, TSR_ENW|TSR_WIS); |
56 | } | 54 | } |
57 | 55 | ||
58 | /* | 56 | static void booke_wdt_ping(void) |
59 | * booke_wdt_enable: | 57 | { |
60 | */ | 58 | on_each_cpu(__booke_wdt_ping, NULL, 0, 0); |
61 | static __inline__ void booke_wdt_enable(void) | 59 | } |
60 | |||
61 | static void __booke_wdt_enable(void *data) | ||
62 | { | 62 | { |
63 | u32 val; | 63 | u32 val; |
64 | 64 | ||
65 | /* clear status before enabling watchdog */ | 65 | /* clear status before enabling watchdog */ |
66 | booke_wdt_ping(); | 66 | __booke_wdt_ping(NULL); |
67 | val = mfspr(SPRN_TCR); | 67 | val = mfspr(SPRN_TCR); |
68 | val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period)); | 68 | val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period)); |
69 | 69 | ||
70 | mtspr(SPRN_TCR, val); | 70 | mtspr(SPRN_TCR, val); |
71 | } | 71 | } |
72 | 72 | ||
73 | /* | 73 | static ssize_t booke_wdt_write(struct file *file, const char __user *buf, |
74 | * booke_wdt_write: | ||
75 | */ | ||
76 | static ssize_t booke_wdt_write (struct file *file, const char __user *buf, | ||
77 | size_t count, loff_t *ppos) | 74 | size_t count, loff_t *ppos) |
78 | { | 75 | { |
79 | booke_wdt_ping(); | 76 | booke_wdt_ping(); |
@@ -81,15 +78,11 @@ static ssize_t booke_wdt_write (struct file *file, const char __user *buf, | |||
81 | } | 78 | } |
82 | 79 | ||
83 | static struct watchdog_info ident = { | 80 | static struct watchdog_info ident = { |
84 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 81 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
85 | .firmware_version = 0, | 82 | .identity = "PowerPC Book-E Watchdog", |
86 | .identity = "PowerPC Book-E Watchdog", | ||
87 | }; | 83 | }; |
88 | 84 | ||
89 | /* | 85 | static int booke_wdt_ioctl(struct inode *inode, struct file *file, |
90 | * booke_wdt_ioctl: | ||
91 | */ | ||
92 | static int booke_wdt_ioctl (struct inode *inode, struct file *file, | ||
93 | unsigned int cmd, unsigned long arg) | 86 | unsigned int cmd, unsigned long arg) |
94 | { | 87 | { |
95 | u32 tmp = 0; | 88 | u32 tmp = 0; |
@@ -97,7 +90,7 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file, | |||
97 | 90 | ||
98 | switch (cmd) { | 91 | switch (cmd) { |
99 | case WDIOC_GETSUPPORT: | 92 | case WDIOC_GETSUPPORT: |
100 | if (copy_to_user ((struct watchdog_info __user *) arg, &ident, | 93 | if (copy_to_user((struct watchdog_info __user *)arg, &ident, |
101 | sizeof(struct watchdog_info))) | 94 | sizeof(struct watchdog_info))) |
102 | return -EFAULT; | 95 | return -EFAULT; |
103 | case WDIOC_GETSTATUS: | 96 | case WDIOC_GETSTATUS: |
@@ -132,33 +125,33 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file, | |||
132 | 125 | ||
133 | return 0; | 126 | return 0; |
134 | } | 127 | } |
135 | /* | 128 | |
136 | * booke_wdt_open: | 129 | static int booke_wdt_open(struct inode *inode, struct file *file) |
137 | */ | ||
138 | static int booke_wdt_open (struct inode *inode, struct file *file) | ||
139 | { | 130 | { |
131 | spin_lock(&booke_wdt_lock); | ||
140 | if (booke_wdt_enabled == 0) { | 132 | if (booke_wdt_enabled == 0) { |
141 | booke_wdt_enabled = 1; | 133 | booke_wdt_enabled = 1; |
142 | booke_wdt_enable(); | 134 | on_each_cpu(__booke_wdt_enable, NULL, 0, 0); |
143 | printk (KERN_INFO "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n", | 135 | printk(KERN_INFO "PowerPC Book-E Watchdog Timer Enabled " |
144 | booke_wdt_period); | 136 | "(wdt_period=%d)\n", booke_wdt_period); |
145 | } | 137 | } |
138 | spin_unlock(&booke_wdt_lock); | ||
146 | 139 | ||
147 | return nonseekable_open(inode, file); | 140 | return nonseekable_open(inode, file); |
148 | } | 141 | } |
149 | 142 | ||
150 | static const struct file_operations booke_wdt_fops = { | 143 | static const struct file_operations booke_wdt_fops = { |
151 | .owner = THIS_MODULE, | 144 | .owner = THIS_MODULE, |
152 | .llseek = no_llseek, | 145 | .llseek = no_llseek, |
153 | .write = booke_wdt_write, | 146 | .write = booke_wdt_write, |
154 | .ioctl = booke_wdt_ioctl, | 147 | .ioctl = booke_wdt_ioctl, |
155 | .open = booke_wdt_open, | 148 | .open = booke_wdt_open, |
156 | }; | 149 | }; |
157 | 150 | ||
158 | static struct miscdevice booke_wdt_miscdev = { | 151 | static struct miscdevice booke_wdt_miscdev = { |
159 | .minor = WATCHDOG_MINOR, | 152 | .minor = WATCHDOG_MINOR, |
160 | .name = "watchdog", | 153 | .name = "watchdog", |
161 | .fops = &booke_wdt_fops, | 154 | .fops = &booke_wdt_fops, |
162 | }; | 155 | }; |
163 | 156 | ||
164 | static void __exit booke_wdt_exit(void) | 157 | static void __exit booke_wdt_exit(void) |
@@ -166,28 +159,27 @@ static void __exit booke_wdt_exit(void) | |||
166 | misc_deregister(&booke_wdt_miscdev); | 159 | misc_deregister(&booke_wdt_miscdev); |
167 | } | 160 | } |
168 | 161 | ||
169 | /* | ||
170 | * booke_wdt_init: | ||
171 | */ | ||
172 | static int __init booke_wdt_init(void) | 162 | static int __init booke_wdt_init(void) |
173 | { | 163 | { |
174 | int ret = 0; | 164 | int ret = 0; |
175 | 165 | ||
176 | printk (KERN_INFO "PowerPC Book-E Watchdog Timer Loaded\n"); | 166 | printk(KERN_INFO "PowerPC Book-E Watchdog Timer Loaded\n"); |
177 | ident.firmware_version = cur_cpu_spec->pvr_value; | 167 | ident.firmware_version = cur_cpu_spec->pvr_value; |
178 | 168 | ||
179 | ret = misc_register(&booke_wdt_miscdev); | 169 | ret = misc_register(&booke_wdt_miscdev); |
180 | if (ret) { | 170 | if (ret) { |
181 | printk (KERN_CRIT "Cannot register miscdev on minor=%d (err=%d)\n", | 171 | printk(KERN_CRIT "Cannot register miscdev on minor=%d: %d\n", |
182 | WATCHDOG_MINOR, ret); | 172 | WATCHDOG_MINOR, ret); |
183 | return ret; | 173 | return ret; |
184 | } | 174 | } |
185 | 175 | ||
176 | spin_lock(&booke_wdt_lock); | ||
186 | if (booke_wdt_enabled == 1) { | 177 | if (booke_wdt_enabled == 1) { |
187 | printk (KERN_INFO "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n", | 178 | printk(KERN_INFO "PowerPC Book-E Watchdog Timer Enabled " |
188 | booke_wdt_period); | 179 | "(wdt_period=%d)\n", booke_wdt_period); |
189 | booke_wdt_enable(); | 180 | on_each_cpu(__booke_wdt_enable, NULL, 0, 0); |
190 | } | 181 | } |
182 | spin_unlock(&booke_wdt_lock); | ||
191 | 183 | ||
192 | return ret; | 184 | return ret; |
193 | } | 185 | } |
diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c new file mode 100644 index 000000000000..30d09cbbad94 --- /dev/null +++ b/drivers/watchdog/geodewdt.c | |||
@@ -0,0 +1,308 @@ | |||
1 | /* Watchdog timer for the Geode GX/LX with the CS5535/CS5536 companion chip | ||
2 | * | ||
3 | * Copyright (C) 2006-2007, Advanced Micro Devices, Inc. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/moduleparam.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/miscdevice.h> | ||
16 | #include <linux/watchdog.h> | ||
17 | #include <linux/fs.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/reboot.h> | ||
20 | |||
21 | #include <asm/uaccess.h> | ||
22 | #include <asm/geode.h> | ||
23 | |||
24 | #define GEODEWDT_HZ 500 | ||
25 | #define GEODEWDT_SCALE 6 | ||
26 | #define GEODEWDT_MAX_SECONDS 131 | ||
27 | |||
28 | #define WDT_FLAGS_OPEN 1 | ||
29 | #define WDT_FLAGS_ORPHAN 2 | ||
30 | |||
31 | #define DRV_NAME "geodewdt" | ||
32 | #define WATCHDOG_NAME "Geode GX/LX WDT" | ||
33 | #define WATCHDOG_TIMEOUT 60 | ||
34 | |||
35 | static int timeout = WATCHDOG_TIMEOUT; | ||
36 | module_param(timeout, int, 0); | ||
37 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=131, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); | ||
38 | |||
39 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
40 | module_param(nowayout, int, 0); | ||
41 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | ||
42 | |||
43 | static struct platform_device *geodewdt_platform_device; | ||
44 | static unsigned long wdt_flags; | ||
45 | static int wdt_timer; | ||
46 | static int safe_close; | ||
47 | |||
48 | static void geodewdt_ping(void) | ||
49 | { | ||
50 | /* Stop the counter */ | ||
51 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); | ||
52 | |||
53 | /* Reset the counter */ | ||
54 | geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); | ||
55 | |||
56 | /* Enable the counter */ | ||
57 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); | ||
58 | } | ||
59 | |||
60 | static void geodewdt_disable(void) | ||
61 | { | ||
62 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); | ||
63 | geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); | ||
64 | } | ||
65 | |||
66 | static int geodewdt_set_heartbeat(int val) | ||
67 | { | ||
68 | if (val < 1 || val > GEODEWDT_MAX_SECONDS) | ||
69 | return -EINVAL; | ||
70 | |||
71 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); | ||
72 | geode_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, val * GEODEWDT_HZ); | ||
73 | geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); | ||
74 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); | ||
75 | |||
76 | timeout = val; | ||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | static int | ||
81 | geodewdt_open(struct inode *inode, struct file *file) | ||
82 | { | ||
83 | if (test_and_set_bit(WDT_FLAGS_OPEN, &wdt_flags)) | ||
84 | return -EBUSY; | ||
85 | |||
86 | if (!test_and_clear_bit(WDT_FLAGS_ORPHAN, &wdt_flags)) | ||
87 | __module_get(THIS_MODULE); | ||
88 | |||
89 | geodewdt_ping(); | ||
90 | return nonseekable_open(inode, file); | ||
91 | } | ||
92 | |||
93 | static int | ||
94 | geodewdt_release(struct inode *inode, struct file *file) | ||
95 | { | ||
96 | if (safe_close) { | ||
97 | geodewdt_disable(); | ||
98 | module_put(THIS_MODULE); | ||
99 | } | ||
100 | else { | ||
101 | printk(KERN_CRIT "Unexpected close - watchdog is not stopping.\n"); | ||
102 | geodewdt_ping(); | ||
103 | |||
104 | set_bit(WDT_FLAGS_ORPHAN, &wdt_flags); | ||
105 | } | ||
106 | |||
107 | clear_bit(WDT_FLAGS_OPEN, &wdt_flags); | ||
108 | safe_close = 0; | ||
109 | return 0; | ||
110 | } | ||
111 | |||
112 | static ssize_t | ||
113 | geodewdt_write(struct file *file, const char __user *data, size_t len, | ||
114 | loff_t *ppos) | ||
115 | { | ||
116 | if(len) { | ||
117 | if (!nowayout) { | ||
118 | size_t i; | ||
119 | safe_close = 0; | ||
120 | |||
121 | for (i = 0; i != len; i++) { | ||
122 | char c; | ||
123 | |||
124 | if (get_user(c, data + i)) | ||
125 | return -EFAULT; | ||
126 | |||
127 | if (c == 'V') | ||
128 | safe_close = 1; | ||
129 | } | ||
130 | } | ||
131 | |||
132 | geodewdt_ping(); | ||
133 | } | ||
134 | return len; | ||
135 | } | ||
136 | |||
137 | static int | ||
138 | geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | ||
139 | unsigned long arg) | ||
140 | { | ||
141 | void __user *argp = (void __user *)arg; | ||
142 | int __user *p = argp; | ||
143 | int interval; | ||
144 | |||
145 | static struct watchdog_info ident = { | ||
146 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | ||
147 | | WDIOF_MAGICCLOSE, | ||
148 | .firmware_version = 1, | ||
149 | .identity = WATCHDOG_NAME, | ||
150 | }; | ||
151 | |||
152 | switch(cmd) { | ||
153 | case WDIOC_GETSUPPORT: | ||
154 | return copy_to_user(argp, &ident, | ||
155 | sizeof(ident)) ? -EFAULT : 0; | ||
156 | break; | ||
157 | |||
158 | case WDIOC_GETSTATUS: | ||
159 | case WDIOC_GETBOOTSTATUS: | ||
160 | return put_user(0, p); | ||
161 | |||
162 | case WDIOC_KEEPALIVE: | ||
163 | geodewdt_ping(); | ||
164 | return 0; | ||
165 | |||
166 | case WDIOC_SETTIMEOUT: | ||
167 | if (get_user(interval, p)) | ||
168 | return -EFAULT; | ||
169 | |||
170 | if (geodewdt_set_heartbeat(interval)) | ||
171 | return -EINVAL; | ||
172 | |||
173 | /* Fall through */ | ||
174 | |||
175 | case WDIOC_GETTIMEOUT: | ||
176 | return put_user(timeout, p); | ||
177 | |||
178 | case WDIOC_SETOPTIONS: | ||
179 | { | ||
180 | int options, ret = -EINVAL; | ||
181 | |||
182 | if (get_user(options, p)) | ||
183 | return -EFAULT; | ||
184 | |||
185 | if (options & WDIOS_DISABLECARD) { | ||
186 | geodewdt_disable(); | ||
187 | ret = 0; | ||
188 | } | ||
189 | |||
190 | if (options & WDIOS_ENABLECARD) { | ||
191 | geodewdt_ping(); | ||
192 | ret = 0; | ||
193 | } | ||
194 | |||
195 | return ret; | ||
196 | } | ||
197 | default: | ||
198 | return -ENOTTY; | ||
199 | } | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static const struct file_operations geodewdt_fops = { | ||
205 | .owner = THIS_MODULE, | ||
206 | .llseek = no_llseek, | ||
207 | .write = geodewdt_write, | ||
208 | .ioctl = geodewdt_ioctl, | ||
209 | .open = geodewdt_open, | ||
210 | .release = geodewdt_release, | ||
211 | }; | ||
212 | |||
213 | static struct miscdevice geodewdt_miscdev = { | ||
214 | .minor = WATCHDOG_MINOR, | ||
215 | .name = "watchdog", | ||
216 | .fops = &geodewdt_fops | ||
217 | }; | ||
218 | |||
219 | static int __devinit | ||
220 | geodewdt_probe(struct platform_device *dev) | ||
221 | { | ||
222 | int ret, timer; | ||
223 | |||
224 | timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING); | ||
225 | |||
226 | if (timer == -1) { | ||
227 | printk(KERN_ERR "geodewdt: No timers were available\n"); | ||
228 | return -ENODEV; | ||
229 | } | ||
230 | |||
231 | wdt_timer = timer; | ||
232 | |||
233 | /* Set up the timer */ | ||
234 | |||
235 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, | ||
236 | GEODEWDT_SCALE | (3 << 8)); | ||
237 | |||
238 | /* Set up comparator 2 to reset when the event fires */ | ||
239 | geode_mfgpt_toggle_event(wdt_timer, MFGPT_CMP2, MFGPT_EVENT_RESET, 1); | ||
240 | |||
241 | /* Set up the initial timeout */ | ||
242 | |||
243 | geode_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, | ||
244 | timeout * GEODEWDT_HZ); | ||
245 | |||
246 | ret = misc_register(&geodewdt_miscdev); | ||
247 | |||
248 | return ret; | ||
249 | } | ||
250 | |||
251 | static int __devexit | ||
252 | geodewdt_remove(struct platform_device *dev) | ||
253 | { | ||
254 | misc_deregister(&geodewdt_miscdev); | ||
255 | return 0; | ||
256 | } | ||
257 | |||
258 | static void | ||
259 | geodewdt_shutdown(struct platform_device *dev) | ||
260 | { | ||
261 | geodewdt_disable(); | ||
262 | } | ||
263 | |||
264 | static struct platform_driver geodewdt_driver = { | ||
265 | .probe = geodewdt_probe, | ||
266 | .remove = __devexit_p(geodewdt_remove), | ||
267 | .shutdown = geodewdt_shutdown, | ||
268 | .driver = { | ||
269 | .owner = THIS_MODULE, | ||
270 | .name = DRV_NAME, | ||
271 | }, | ||
272 | }; | ||
273 | |||
274 | static int __init | ||
275 | geodewdt_init(void) | ||
276 | { | ||
277 | int ret; | ||
278 | |||
279 | ret = platform_driver_register(&geodewdt_driver); | ||
280 | if (ret) | ||
281 | return ret; | ||
282 | |||
283 | geodewdt_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0); | ||
284 | if (IS_ERR(geodewdt_platform_device)) { | ||
285 | ret = PTR_ERR(geodewdt_platform_device); | ||
286 | goto err; | ||
287 | } | ||
288 | |||
289 | return 0; | ||
290 | err: | ||
291 | platform_driver_unregister(&geodewdt_driver); | ||
292 | return ret; | ||
293 | } | ||
294 | |||
295 | static void __exit | ||
296 | geodewdt_exit(void) | ||
297 | { | ||
298 | platform_device_unregister(geodewdt_platform_device); | ||
299 | platform_driver_unregister(&geodewdt_driver); | ||
300 | } | ||
301 | |||
302 | module_init(geodewdt_init); | ||
303 | module_exit(geodewdt_exit); | ||
304 | |||
305 | MODULE_AUTHOR("Advanced Micro Devices, Inc"); | ||
306 | MODULE_DESCRIPTION("Geode GX/LX Watchdog Driver"); | ||
307 | MODULE_LICENSE("GPL"); | ||
308 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index 6483d1066b95..6a63535fc04d 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c | |||
@@ -418,23 +418,20 @@ static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason, | |||
418 | static unsigned long rom_pl; | 418 | static unsigned long rom_pl; |
419 | static int die_nmi_called; | 419 | static int die_nmi_called; |
420 | 420 | ||
421 | if (ulReason != DIE_NMI && ulReason != DIE_NMI_IPI) | 421 | if (ulReason == DIE_NMI || ulReason == DIE_NMI_IPI) { |
422 | return NOTIFY_OK; | 422 | spin_lock_irqsave(&rom_lock, rom_pl); |
423 | 423 | if (!die_nmi_called) | |
424 | spin_lock_irqsave(&rom_lock, rom_pl); | 424 | asminline_call(&cmn_regs, cru_rom_addr); |
425 | if (!die_nmi_called) | 425 | die_nmi_called = 1; |
426 | asminline_call(&cmn_regs, cru_rom_addr); | 426 | spin_unlock_irqrestore(&rom_lock, rom_pl); |
427 | die_nmi_called = 1; | 427 | if (cmn_regs.u1.ral != 0) { |
428 | spin_unlock_irqrestore(&rom_lock, rom_pl); | 428 | panic("An NMI occurred, please see the Integrated " |
429 | if (cmn_regs.u1.ral == 0) { | 429 | "Management Log for details.\n"); |
430 | printk(KERN_WARNING "hpwdt: An NMI occurred, " | 430 | } |
431 | "but unable to determine source.\n"); | ||
432 | } else { | ||
433 | panic("An NMI occurred, please see the Integrated " | ||
434 | "Management Log for details.\n"); | ||
435 | } | 431 | } |
436 | 432 | ||
437 | return NOTIFY_STOP; | 433 | die_nmi_called = 0; |
434 | return NOTIFY_DONE; | ||
438 | } | 435 | } |
439 | 436 | ||
440 | /* | 437 | /* |
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c index a0e6809e369f..95ba985bd341 100644 --- a/drivers/watchdog/iTCO_wdt.c +++ b/drivers/watchdog/iTCO_wdt.c | |||
@@ -41,9 +41,10 @@ | |||
41 | * 82801HH (ICH8DH) : document number 313056-003, 313057-009, | 41 | * 82801HH (ICH8DH) : document number 313056-003, 313057-009, |
42 | * 82801HO (ICH8DO) : document number 313056-003, 313057-009, | 42 | * 82801HO (ICH8DO) : document number 313056-003, 313057-009, |
43 | * 82801HEM (ICH8M-E) : document number 313056-003, 313057-009, | 43 | * 82801HEM (ICH8M-E) : document number 313056-003, 313057-009, |
44 | * 82801IB (ICH9) : document number 316972-001, 316973-001, | 44 | * 82801IB (ICH9) : document number 316972-001, 316973-006, |
45 | * 82801IR (ICH9R) : document number 316972-001, 316973-001, | 45 | * 82801IR (ICH9R) : document number 316972-001, 316973-006, |
46 | * 82801IH (ICH9DH) : document number 316972-001, 316973-001, | 46 | * 82801IH (ICH9DH) : document number 316972-001, 316973-006, |
47 | * 82801IO (ICH9DO) : document number 316972-001, 316973-006, | ||
47 | * 6300ESB (6300ESB) : document number 300641-003, 300884-010, | 48 | * 6300ESB (6300ESB) : document number 300641-003, 300884-010, |
48 | * 631xESB (631xESB) : document number 313082-001, 313075-005, | 49 | * 631xESB (631xESB) : document number 313082-001, 313075-005, |
49 | * 632xESB (632xESB) : document number 313082-001, 313075-005 | 50 | * 632xESB (632xESB) : document number 313082-001, 313075-005 |
@@ -55,8 +56,8 @@ | |||
55 | 56 | ||
56 | /* Module and version information */ | 57 | /* Module and version information */ |
57 | #define DRV_NAME "iTCO_wdt" | 58 | #define DRV_NAME "iTCO_wdt" |
58 | #define DRV_VERSION "1.02" | 59 | #define DRV_VERSION "1.03" |
59 | #define DRV_RELDATE "26-Jul-2007" | 60 | #define DRV_RELDATE "30-Apr-2008" |
60 | #define PFX DRV_NAME ": " | 61 | #define PFX DRV_NAME ": " |
61 | 62 | ||
62 | /* Includes */ | 63 | /* Includes */ |
@@ -104,6 +105,7 @@ enum iTCO_chipsets { | |||
104 | TCO_ICH9, /* ICH9 */ | 105 | TCO_ICH9, /* ICH9 */ |
105 | TCO_ICH9R, /* ICH9R */ | 106 | TCO_ICH9R, /* ICH9R */ |
106 | TCO_ICH9DH, /* ICH9DH */ | 107 | TCO_ICH9DH, /* ICH9DH */ |
108 | TCO_ICH9DO, /* ICH9DO */ | ||
107 | TCO_631XESB, /* 631xESB/632xESB */ | 109 | TCO_631XESB, /* 631xESB/632xESB */ |
108 | }; | 110 | }; |
109 | 111 | ||
@@ -136,6 +138,7 @@ static struct { | |||
136 | {"ICH9", 2}, | 138 | {"ICH9", 2}, |
137 | {"ICH9R", 2}, | 139 | {"ICH9R", 2}, |
138 | {"ICH9DH", 2}, | 140 | {"ICH9DH", 2}, |
141 | {"ICH9DO", 2}, | ||
139 | {"631xESB/632xESB", 2}, | 142 | {"631xESB/632xESB", 2}, |
140 | {NULL,0} | 143 | {NULL,0} |
141 | }; | 144 | }; |
@@ -181,6 +184,7 @@ static struct pci_device_id iTCO_wdt_pci_tbl[] = { | |||
181 | { ITCO_PCI_DEVICE(0x2918, TCO_ICH9 )}, | 184 | { ITCO_PCI_DEVICE(0x2918, TCO_ICH9 )}, |
182 | { ITCO_PCI_DEVICE(0x2916, TCO_ICH9R )}, | 185 | { ITCO_PCI_DEVICE(0x2916, TCO_ICH9R )}, |
183 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_2, TCO_ICH9DH )}, | 186 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_2, TCO_ICH9DH )}, |
187 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_4, TCO_ICH9DO )}, | ||
184 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ESB2_0, TCO_631XESB)}, | 188 | { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ESB2_0, TCO_631XESB)}, |
185 | { ITCO_PCI_DEVICE(0x2671, TCO_631XESB)}, | 189 | { ITCO_PCI_DEVICE(0x2671, TCO_631XESB)}, |
186 | { ITCO_PCI_DEVICE(0x2672, TCO_631XESB)}, | 190 | { ITCO_PCI_DEVICE(0x2672, TCO_631XESB)}, |
diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c index c622a0e6c9ae..528b882420b6 100644 --- a/drivers/watchdog/w83697hf_wdt.c +++ b/drivers/watchdog/w83697hf_wdt.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #define WATCHDOG_NAME "w83697hf/hg WDT" | 44 | #define WATCHDOG_NAME "w83697hf/hg WDT" |
45 | #define PFX WATCHDOG_NAME ": " | 45 | #define PFX WATCHDOG_NAME ": " |
46 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ | 46 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ |
47 | #define WATCHDOG_EARLY_DISABLE 1 /* Disable until userland kicks in */ | ||
47 | 48 | ||
48 | static unsigned long wdt_is_open; | 49 | static unsigned long wdt_is_open; |
49 | static char expect_close; | 50 | static char expect_close; |
@@ -56,12 +57,16 @@ MODULE_PARM_DESC(wdt_io, "w83697hf/hg WDT io port (default 0x2e, 0 = autodetect) | |||
56 | 57 | ||
57 | static int timeout = WATCHDOG_TIMEOUT; /* in seconds */ | 58 | static int timeout = WATCHDOG_TIMEOUT; /* in seconds */ |
58 | module_param(timeout, int, 0); | 59 | module_param(timeout, int, 0); |
59 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); | 60 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255 (default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); |
60 | 61 | ||
61 | static int nowayout = WATCHDOG_NOWAYOUT; | 62 | static int nowayout = WATCHDOG_NOWAYOUT; |
62 | module_param(nowayout, int, 0); | 63 | module_param(nowayout, int, 0); |
63 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 64 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
64 | 65 | ||
66 | static int early_disable = WATCHDOG_EARLY_DISABLE; | ||
67 | module_param(early_disable, int, 0); | ||
68 | MODULE_PARM_DESC(early_disable, "Watchdog gets disabled at boot time (default=" __MODULE_STRING(WATCHDOG_EARLY_DISABLE) ")"); | ||
69 | |||
65 | /* | 70 | /* |
66 | * Kernel methods. | 71 | * Kernel methods. |
67 | */ | 72 | */ |
@@ -140,7 +145,7 @@ w83697hf_init(void) | |||
140 | w83697hf_deselect_wdt(); | 145 | w83697hf_deselect_wdt(); |
141 | } | 146 | } |
142 | 147 | ||
143 | static int | 148 | static void |
144 | wdt_ping(void) | 149 | wdt_ping(void) |
145 | { | 150 | { |
146 | spin_lock(&io_lock); | 151 | spin_lock(&io_lock); |
@@ -150,10 +155,9 @@ wdt_ping(void) | |||
150 | 155 | ||
151 | w83697hf_deselect_wdt(); | 156 | w83697hf_deselect_wdt(); |
152 | spin_unlock(&io_lock); | 157 | spin_unlock(&io_lock); |
153 | return 0; | ||
154 | } | 158 | } |
155 | 159 | ||
156 | static int | 160 | static void |
157 | wdt_enable(void) | 161 | wdt_enable(void) |
158 | { | 162 | { |
159 | spin_lock(&io_lock); | 163 | spin_lock(&io_lock); |
@@ -164,10 +168,9 @@ wdt_enable(void) | |||
164 | 168 | ||
165 | w83697hf_deselect_wdt(); | 169 | w83697hf_deselect_wdt(); |
166 | spin_unlock(&io_lock); | 170 | spin_unlock(&io_lock); |
167 | return 0; | ||
168 | } | 171 | } |
169 | 172 | ||
170 | static int | 173 | static void |
171 | wdt_disable(void) | 174 | wdt_disable(void) |
172 | { | 175 | { |
173 | spin_lock(&io_lock); | 176 | spin_lock(&io_lock); |
@@ -178,7 +181,22 @@ wdt_disable(void) | |||
178 | 181 | ||
179 | w83697hf_deselect_wdt(); | 182 | w83697hf_deselect_wdt(); |
180 | spin_unlock(&io_lock); | 183 | spin_unlock(&io_lock); |
181 | return 0; | 184 | } |
185 | |||
186 | static unsigned char | ||
187 | wdt_running(void) | ||
188 | { | ||
189 | unsigned char t; | ||
190 | |||
191 | spin_lock(&io_lock); | ||
192 | w83697hf_select_wdt(); | ||
193 | |||
194 | t = w83697hf_get_reg(0xF4); /* Read timer */ | ||
195 | |||
196 | w83697hf_deselect_wdt(); | ||
197 | spin_unlock(&io_lock); | ||
198 | |||
199 | return t; | ||
182 | } | 200 | } |
183 | 201 | ||
184 | static int | 202 | static int |
@@ -397,7 +415,11 @@ wdt_init(void) | |||
397 | } | 415 | } |
398 | 416 | ||
399 | w83697hf_init(); | 417 | w83697hf_init(); |
400 | wdt_disable(); /* Disable watchdog until first use */ | 418 | if (early_disable) { |
419 | if (wdt_running()) | ||
420 | printk (KERN_WARNING PFX "Stopping previously enabled watchdog until userland kicks in\n"); | ||
421 | wdt_disable(); | ||
422 | } | ||
401 | 423 | ||
402 | if (wdt_set_heartbeat(timeout)) { | 424 | if (wdt_set_heartbeat(timeout)) { |
403 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); | 425 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); |