aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/Kconfig19
-rw-r--r--drivers/acpi/bus.c2
-rw-r--r--drivers/acpi/button.c1
-rw-r--r--drivers/acpi/ec.c17
-rw-r--r--drivers/acpi/osl.c2
-rw-r--r--drivers/acpi/pci_irq.c98
-rw-r--r--drivers/acpi/pci_root.c2
-rw-r--r--drivers/acpi/processor_core.c25
-rw-r--r--drivers/acpi/scan.c5
-rw-r--r--drivers/acpi/sleep/main.c2
-rw-r--r--drivers/acpi/system.c2
-rw-r--r--drivers/acpi/thermal.c12
-rw-r--r--drivers/acpi/toshiba_acpi.c7
-rw-r--r--drivers/acpi/utilities/utdebug.c2
-rw-r--r--drivers/acpi/utilities/utobject.c2
-rw-r--r--drivers/acpi/utils.c6
-rw-r--r--drivers/acpi/video.c4
-rw-r--r--drivers/acpi/wmi.c10
-rw-r--r--drivers/atm/firestream.c4
-rw-r--r--drivers/atm/fore200e.c4
-rw-r--r--drivers/atm/idt77252.c12
-rw-r--r--drivers/block/floppy.c5
-rw-r--r--drivers/block/viodasd.c3
-rw-r--r--drivers/bluetooth/hci_usb.c3
-rw-r--r--drivers/char/riscom8.c2
-rw-r--r--drivers/dma/dmaengine.c2
-rw-r--r--drivers/dma/fsldma.c58
-rw-r--r--drivers/dma/iop-adma.c32
-rw-r--r--drivers/i2c/busses/i2c-amd756.c2
-rw-r--r--drivers/i2c/chips/Makefile7
-rw-r--r--drivers/i2c/i2c-core.c6
-rw-r--r--drivers/infiniband/hw/ipath/ipath_common.h2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_driver.c28
-rw-r--r--drivers/infiniband/hw/ipath/ipath_kernel.h1
-rw-r--r--drivers/infiniband/hw/ipath/ipath_mad.c7
-rw-r--r--drivers/infiniband/hw/ipath/ipath_qp.c13
-rw-r--r--drivers/infiniband/hw/ipath/ipath_rc.c4
-rw-r--r--drivers/infiniband/hw/ipath/ipath_registers.h2
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c9
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c9
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c2
-rw-r--r--drivers/isdn/i4l/isdn_common.c4
-rw-r--r--drivers/isdn/i4l/isdn_v110.c2
-rw-r--r--drivers/macintosh/via-pmu-backlight.c5
-rw-r--r--drivers/macintosh/via-pmu.c2
-rw-r--r--drivers/misc/Kconfig1
-rw-r--r--drivers/misc/acer-wmi.c44
-rw-r--r--drivers/misc/sony-laptop.c2
-rw-r--r--drivers/net/Kconfig20
-rw-r--r--drivers/net/ac3200.c7
-rw-r--r--drivers/net/apne.c7
-rw-r--r--drivers/net/appletalk/ltpc.c3
-rw-r--r--drivers/net/arcnet/capmode.c6
-rw-r--r--drivers/net/atarilance.c5
-rw-r--r--drivers/net/e100.c29
-rw-r--r--drivers/net/enc28j60.c3
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c2
-rw-r--r--drivers/net/mv643xx_eth.c1
-rw-r--r--drivers/net/pcmcia/axnet_cs.c2
-rw-r--r--drivers/net/phy/Kconfig1
-rw-r--r--drivers/net/phy/davicom.c17
-rw-r--r--drivers/net/pppol2tp.c69
-rw-r--r--drivers/net/s2io.c2
-rw-r--r--drivers/net/tulip/de2104x.c3
-rw-r--r--drivers/net/wan/sbni.c2
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c5
-rw-r--r--drivers/pci/bus.c6
-rw-r--r--drivers/pci/pci-acpi.c24
-rw-r--r--drivers/pnp/quirks.c100
-rw-r--r--drivers/spi/au1550_spi.c4
-rw-r--r--drivers/spi/spi_bitbang.c8
-rw-r--r--drivers/thermal/Kconfig1
-rw-r--r--drivers/thermal/thermal.c169
75 files changed, 675 insertions, 322 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index f688c214be0c..fbcaa069be86 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -283,24 +283,23 @@ config ACPI_TOSHIBA
283 If you have a legacy free Toshiba laptop (such as the Libretto L1 283 If you have a legacy free Toshiba laptop (such as the Libretto L1
284 series), say Y. 284 series), say Y.
285 285
286config ACPI_CUSTOM_DSDT 286config ACPI_CUSTOM_DSDT_FILE
287 bool "Include Custom DSDT" 287 string "Custom DSDT Table file to include"
288 default ""
288 depends on !STANDALONE 289 depends on !STANDALONE
289 default n
290 help 290 help
291 This option supports a custom DSDT by linking it into the kernel. 291 This option supports a custom DSDT by linking it into the kernel.
292 See Documentation/acpi/dsdt-override.txt 292 See Documentation/acpi/dsdt-override.txt
293 293
294 If unsure, say N.
295
296config ACPI_CUSTOM_DSDT_FILE
297 string "Custom DSDT Table file to include"
298 depends on ACPI_CUSTOM_DSDT
299 default ""
300 help
301 Enter the full path name to the file which includes the AmlCode 294 Enter the full path name to the file which includes the AmlCode
302 declaration. 295 declaration.
303 296
297 If unsure, don't enter a file name.
298
299config ACPI_CUSTOM_DSDT
300 bool
301 default ACPI_CUSTOM_DSDT_FILE != ""
302
304config ACPI_CUSTOM_DSDT_INITRD 303config ACPI_CUSTOM_DSDT_INITRD
305 bool "Read Custom DSDT from initramfs" 304 bool "Read Custom DSDT from initramfs"
306 depends on BLK_DEV_INITRD 305 depends on BLK_DEV_INITRD
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index ce3c0a2cbac4..5b6760e0f957 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -776,7 +776,7 @@ static int __init acpi_init(void)
776 776
777 acpi_kobj = kobject_create_and_add("acpi", firmware_kobj); 777 acpi_kobj = kobject_create_and_add("acpi", firmware_kobj);
778 if (!acpi_kobj) { 778 if (!acpi_kobj) {
779 printk(KERN_WARNING "%s: kset create error\n", __FUNCTION__); 779 printk(KERN_WARNING "%s: kset create error\n", __func__);
780 acpi_kobj = NULL; 780 acpi_kobj = NULL;
781 } 781 }
782 782
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 24a7865a57cb..6c5da83cdb68 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -449,6 +449,7 @@ static int acpi_button_add(struct acpi_device *device)
449 input->phys = button->phys; 449 input->phys = button->phys;
450 input->id.bustype = BUS_HOST; 450 input->id.bustype = BUS_HOST;
451 input->id.product = button->type; 451 input->id.product = button->type;
452 input->dev.parent = &device->dev;
452 453
453 switch (button->type) { 454 switch (button->type) {
454 case ACPI_BUTTON_TYPE_POWER: 455 case ACPI_BUTTON_TYPE_POWER:
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index caf873c14bfb..e7e197e3a4ff 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -129,6 +129,7 @@ static struct acpi_ec {
129 struct mutex lock; 129 struct mutex lock;
130 wait_queue_head_t wait; 130 wait_queue_head_t wait;
131 struct list_head list; 131 struct list_head list;
132 atomic_t irq_count;
132 u8 handlers_installed; 133 u8 handlers_installed;
133} *boot_ec, *first_ec; 134} *boot_ec, *first_ec;
134 135
@@ -181,6 +182,8 @@ static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll)
181{ 182{
182 int ret = 0; 183 int ret = 0;
183 184
185 atomic_set(&ec->irq_count, 0);
186
184 if (unlikely(event == ACPI_EC_EVENT_OBF_1 && 187 if (unlikely(event == ACPI_EC_EVENT_OBF_1 &&
185 test_bit(EC_FLAGS_NO_OBF1_GPE, &ec->flags))) 188 test_bit(EC_FLAGS_NO_OBF1_GPE, &ec->flags)))
186 force_poll = 1; 189 force_poll = 1;
@@ -227,6 +230,7 @@ static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll)
227 while (time_before(jiffies, delay)) { 230 while (time_before(jiffies, delay)) {
228 if (acpi_ec_check_status(ec, event)) 231 if (acpi_ec_check_status(ec, event))
229 goto end; 232 goto end;
233 msleep(5);
230 } 234 }
231 } 235 }
232 pr_err(PREFIX "acpi_ec_wait timeout," 236 pr_err(PREFIX "acpi_ec_wait timeout,"
@@ -529,6 +533,13 @@ static u32 acpi_ec_gpe_handler(void *data)
529 struct acpi_ec *ec = data; 533 struct acpi_ec *ec = data;
530 534
531 pr_debug(PREFIX "~~~> interrupt\n"); 535 pr_debug(PREFIX "~~~> interrupt\n");
536 atomic_inc(&ec->irq_count);
537 if (atomic_read(&ec->irq_count) > 5) {
538 pr_err(PREFIX "GPE storm detected, disabling EC GPE\n");
539 acpi_disable_gpe(NULL, ec->gpe, ACPI_ISR);
540 clear_bit(EC_FLAGS_GPE_MODE, &ec->flags);
541 return ACPI_INTERRUPT_HANDLED;
542 }
532 clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); 543 clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
533 if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) 544 if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))
534 wake_up(&ec->wait); 545 wake_up(&ec->wait);
@@ -943,11 +954,7 @@ int __init acpi_ec_ecdt_probe(void)
943 boot_ec->command_addr = ecdt_ptr->control.address; 954 boot_ec->command_addr = ecdt_ptr->control.address;
944 boot_ec->data_addr = ecdt_ptr->data.address; 955 boot_ec->data_addr = ecdt_ptr->data.address;
945 boot_ec->gpe = ecdt_ptr->gpe; 956 boot_ec->gpe = ecdt_ptr->gpe;
946 if (ACPI_FAILURE(acpi_get_handle(NULL, ecdt_ptr->id, 957 boot_ec->handle = ACPI_ROOT_OBJECT;
947 &boot_ec->handle))) {
948 pr_info("Failed to locate handle for boot EC\n");
949 boot_ec->handle = ACPI_ROOT_OBJECT;
950 }
951 } else { 958 } else {
952 /* This workaround is needed only on some broken machines, 959 /* This workaround is needed only on some broken machines,
953 * which require early EC, but fail to provide ECDT */ 960 * which require early EC, but fail to provide ECDT */
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 8edba7b678eb..065819ba87c7 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -1237,7 +1237,7 @@ int acpi_check_resource_conflict(struct resource *res)
1237 1237
1238 if (clash) { 1238 if (clash) {
1239 if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) { 1239 if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) {
1240 printk(KERN_INFO "%sACPI: %s resource %s [0x%llx-0x%llx]" 1240 printk("%sACPI: %s resource %s [0x%llx-0x%llx]"
1241 " conflicts with ACPI region %s" 1241 " conflicts with ACPI region %s"
1242 " [0x%llx-0x%llx]\n", 1242 " [0x%llx-0x%llx]\n",
1243 acpi_enforce_resources == ENFORCE_RESOURCES_LAX 1243 acpi_enforce_resources == ENFORCE_RESOURCES_LAX
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index 7f19859580c7..7af414a3c63e 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -25,6 +25,7 @@
25 */ 25 */
26 26
27 27
28#include <linux/dmi.h>
28#include <linux/kernel.h> 29#include <linux/kernel.h>
29#include <linux/module.h> 30#include <linux/module.h>
30#include <linux/init.h> 31#include <linux/init.h>
@@ -76,6 +77,101 @@ static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment,
76 return NULL; 77 return NULL;
77} 78}
78 79
80/* http://bugzilla.kernel.org/show_bug.cgi?id=4773 */
81static struct dmi_system_id medion_md9580[] = {
82 {
83 .ident = "Medion MD9580-F laptop",
84 .matches = {
85 DMI_MATCH(DMI_SYS_VENDOR, "MEDIONNB"),
86 DMI_MATCH(DMI_PRODUCT_NAME, "A555"),
87 },
88 },
89 { }
90};
91
92/* http://bugzilla.kernel.org/show_bug.cgi?id=5044 */
93static struct dmi_system_id dell_optiplex[] = {
94 {
95 .ident = "Dell Optiplex GX1",
96 .matches = {
97 DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
98 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex GX1 600S+"),
99 },
100 },
101 { }
102};
103
104/* http://bugzilla.kernel.org/show_bug.cgi?id=10138 */
105static struct dmi_system_id hp_t5710[] = {
106 {
107 .ident = "HP t5710",
108 .matches = {
109 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
110 DMI_MATCH(DMI_PRODUCT_NAME, "hp t5000 series"),
111 DMI_MATCH(DMI_BOARD_NAME, "098Ch"),
112 },
113 },
114 { }
115};
116
117struct prt_quirk {
118 struct dmi_system_id *system;
119 unsigned int segment;
120 unsigned int bus;
121 unsigned int device;
122 unsigned char pin;
123 char *source; /* according to BIOS */
124 char *actual_source;
125};
126
127/*
128 * These systems have incorrect _PRT entries. The BIOS claims the PCI
129 * interrupt at the listed segment/bus/device/pin is connected to the first
130 * link device, but it is actually connected to the second.
131 */
132static struct prt_quirk prt_quirks[] = {
133 { medion_md9580, 0, 0, 9, 'A',
134 "\\_SB_.PCI0.ISA.LNKA",
135 "\\_SB_.PCI0.ISA.LNKB"},
136 { dell_optiplex, 0, 0, 0xd, 'A',
137 "\\_SB_.LNKB",
138 "\\_SB_.LNKA"},
139 { hp_t5710, 0, 0, 1, 'A',
140 "\\_SB_.PCI0.LNK1",
141 "\\_SB_.PCI0.LNK3"},
142};
143
144static void
145do_prt_fixups(struct acpi_prt_entry *entry, struct acpi_pci_routing_table *prt)
146{
147 int i;
148 struct prt_quirk *quirk;
149
150 for (i = 0; i < ARRAY_SIZE(prt_quirks); i++) {
151 quirk = &prt_quirks[i];
152
153 /* All current quirks involve link devices, not GSIs */
154 if (!prt->source)
155 continue;
156
157 if (dmi_check_system(quirk->system) &&
158 entry->id.segment == quirk->segment &&
159 entry->id.bus == quirk->bus &&
160 entry->id.device == quirk->device &&
161 entry->pin + 'A' == quirk->pin &&
162 !strcmp(prt->source, quirk->source) &&
163 strlen(prt->source) >= strlen(quirk->actual_source)) {
164 printk(KERN_WARNING PREFIX "firmware reports "
165 "%04x:%02x:%02x[%c] connected to %s; "
166 "changing to %s\n",
167 entry->id.segment, entry->id.bus,
168 entry->id.device, 'A' + entry->pin,
169 prt->source, quirk->actual_source);
170 strcpy(prt->source, quirk->actual_source);
171 }
172 }
173}
174
79static int 175static int
80acpi_pci_irq_add_entry(acpi_handle handle, 176acpi_pci_irq_add_entry(acpi_handle handle,
81 int segment, int bus, struct acpi_pci_routing_table *prt) 177 int segment, int bus, struct acpi_pci_routing_table *prt)
@@ -96,6 +192,8 @@ acpi_pci_irq_add_entry(acpi_handle handle,
96 entry->id.function = prt->address & 0xFFFF; 192 entry->id.function = prt->address & 0xFFFF;
97 entry->pin = prt->pin; 193 entry->pin = prt->pin;
98 194
195 do_prt_fixups(entry, prt);
196
99 /* 197 /*
100 * Type 1: Dynamic 198 * Type 1: Dynamic
101 * --------------- 199 * ---------------
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index f14ff1ffab29..c3fed31166b5 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -184,7 +184,7 @@ static void acpi_pci_bridge_scan(struct acpi_device *device)
184 } 184 }
185} 185}
186 186
187static int acpi_pci_root_add(struct acpi_device *device) 187static int __devinit acpi_pci_root_add(struct acpi_device *device)
188{ 188{
189 int result = 0; 189 int result = 0;
190 struct acpi_pci_root *root = NULL; 190 struct acpi_pci_root *root = NULL;
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index a3cc8a98255c..36a68fa114e3 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -840,17 +840,19 @@ static int is_processor_present(acpi_handle handle)
840 840
841 841
842 status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); 842 status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
843 /*
844 * if a processor object does not have an _STA object,
845 * OSPM assumes that the processor is present.
846 */
847 if (status == AE_NOT_FOUND)
848 return 1;
849 843
850 if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_PRESENT)) 844 if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_PRESENT))
851 return 1; 845 return 1;
852 846
853 ACPI_EXCEPTION((AE_INFO, status, "Processor Device is not present")); 847 /*
848 * _STA is mandatory for a processor that supports hot plug
849 */
850 if (status == AE_NOT_FOUND)
851 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
852 "Processor does not support hot plug\n"));
853 else
854 ACPI_EXCEPTION((AE_INFO, status,
855 "Processor Device is not present"));
854 return 0; 856 return 0;
855} 857}
856 858
@@ -886,8 +888,8 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device)
886 return 0; 888 return 0;
887} 889}
888 890
889static void 891static void __ref acpi_processor_hotplug_notify(acpi_handle handle,
890acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) 892 u32 event, void *data)
891{ 893{
892 struct acpi_processor *pr; 894 struct acpi_processor *pr;
893 struct acpi_device *device = NULL; 895 struct acpi_device *device = NULL;
@@ -897,9 +899,10 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data)
897 switch (event) { 899 switch (event) {
898 case ACPI_NOTIFY_BUS_CHECK: 900 case ACPI_NOTIFY_BUS_CHECK:
899 case ACPI_NOTIFY_DEVICE_CHECK: 901 case ACPI_NOTIFY_DEVICE_CHECK:
900 printk("Processor driver received %s event\n", 902 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
903 "Processor driver received %s event\n",
901 (event == ACPI_NOTIFY_BUS_CHECK) ? 904 (event == ACPI_NOTIFY_BUS_CHECK) ?
902 "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"); 905 "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"));
903 906
904 if (!is_processor_present(handle)) 907 if (!is_processor_present(handle))
905 break; 908 break;
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 3fac011f9cf9..57570ac47803 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -609,7 +609,8 @@ acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd)
609 status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer); 609 status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer);
610 if (ACPI_SUCCESS(status)) { 610 if (ACPI_SUCCESS(status)) {
611 obj = buffer.pointer; 611 obj = buffer.pointer;
612 status = acpi_get_handle(NULL, obj->string.pointer, ejd); 612 status = acpi_get_handle(ACPI_ROOT_OBJECT, obj->string.pointer,
613 ejd);
613 kfree(buffer.pointer); 614 kfree(buffer.pointer);
614 } 615 }
615 return status; 616 return status;
@@ -966,7 +967,7 @@ static void acpi_device_set_id(struct acpi_device *device,
966 case ACPI_BUS_TYPE_DEVICE: 967 case ACPI_BUS_TYPE_DEVICE:
967 status = acpi_get_object_info(handle, &buffer); 968 status = acpi_get_object_info(handle, &buffer);
968 if (ACPI_FAILURE(status)) { 969 if (ACPI_FAILURE(status)) {
969 printk(KERN_ERR PREFIX "%s: Error reading device info\n", __FUNCTION__); 970 printk(KERN_ERR PREFIX "%s: Error reading device info\n", __func__);
970 return; 971 return;
971 } 972 }
972 973
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
index 293a1cbb47c0..d2f71a54726c 100644
--- a/drivers/acpi/sleep/main.c
+++ b/drivers/acpi/sleep/main.c
@@ -504,7 +504,7 @@ static void acpi_power_off_prepare(void)
504static void acpi_power_off(void) 504static void acpi_power_off(void)
505{ 505{
506 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ 506 /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
507 printk("%s called\n", __FUNCTION__); 507 printk("%s called\n", __func__);
508 local_irq_disable(); 508 local_irq_disable();
509 acpi_enable_wakeup_device(ACPI_STATE_S5); 509 acpi_enable_wakeup_device(ACPI_STATE_S5);
510 acpi_enter_sleep_state(ACPI_STATE_S5); 510 acpi_enter_sleep_state(ACPI_STATE_S5);
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c
index 55cf4c05bb74..4749f379a915 100644
--- a/drivers/acpi/system.c
+++ b/drivers/acpi/system.c
@@ -319,7 +319,7 @@ void acpi_irq_stats_init(void)
319 goto fail; 319 goto fail;
320 320
321 for (i = 0; i < num_counters; ++i) { 321 for (i = 0; i < num_counters; ++i) {
322 char buffer[10]; 322 char buffer[12];
323 char *name; 323 char *name;
324 324
325 if (i < num_gpes) 325 if (i < num_gpes)
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 8d4b79b4f933..c4e00ac8ea85 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -879,6 +879,8 @@ static void acpi_thermal_check(void *data)
879} 879}
880 880
881/* sys I/F for generic thermal sysfs support */ 881/* sys I/F for generic thermal sysfs support */
882#define KELVIN_TO_MILLICELSIUS(t) (t * 100 - 273200)
883
882static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf) 884static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf)
883{ 885{
884 struct acpi_thermal *tz = thermal->devdata; 886 struct acpi_thermal *tz = thermal->devdata;
@@ -886,7 +888,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf)
886 if (!tz) 888 if (!tz)
887 return -EINVAL; 889 return -EINVAL;
888 890
889 return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS(tz->temperature)); 891 return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(tz->temperature));
890} 892}
891 893
892static const char enabled[] = "kernel"; 894static const char enabled[] = "kernel";
@@ -980,21 +982,21 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
980 982
981 if (tz->trips.critical.flags.valid) { 983 if (tz->trips.critical.flags.valid) {
982 if (!trip) 984 if (!trip)
983 return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( 985 return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(
984 tz->trips.critical.temperature)); 986 tz->trips.critical.temperature));
985 trip--; 987 trip--;
986 } 988 }
987 989
988 if (tz->trips.hot.flags.valid) { 990 if (tz->trips.hot.flags.valid) {
989 if (!trip) 991 if (!trip)
990 return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( 992 return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(
991 tz->trips.hot.temperature)); 993 tz->trips.hot.temperature));
992 trip--; 994 trip--;
993 } 995 }
994 996
995 if (tz->trips.passive.flags.valid) { 997 if (tz->trips.passive.flags.valid) {
996 if (!trip) 998 if (!trip)
997 return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( 999 return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(
998 tz->trips.passive.temperature)); 1000 tz->trips.passive.temperature));
999 trip--; 1001 trip--;
1000 } 1002 }
@@ -1002,7 +1004,7 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
1002 for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && 1004 for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE &&
1003 tz->trips.active[i].flags.valid; i++) { 1005 tz->trips.active[i].flags.valid; i++) {
1004 if (!trip) 1006 if (!trip)
1005 return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( 1007 return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(
1006 tz->trips.active[i].temperature)); 1008 tz->trips.active[i].temperature));
1007 trip--; 1009 trip--;
1008 } 1010 }
diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c
index 9e8c20c6a0b7..0a43c8e0eff3 100644
--- a/drivers/acpi/toshiba_acpi.c
+++ b/drivers/acpi/toshiba_acpi.c
@@ -99,6 +99,13 @@ MODULE_LICENSE("GPL");
99#define HCI_VIDEO_OUT_CRT 0x2 99#define HCI_VIDEO_OUT_CRT 0x2
100#define HCI_VIDEO_OUT_TV 0x4 100#define HCI_VIDEO_OUT_TV 0x4
101 101
102static const struct acpi_device_id toshiba_device_ids[] = {
103 {"TOS6200", 0},
104 {"TOS1900", 0},
105 {"", 0},
106};
107MODULE_DEVICE_TABLE(acpi, toshiba_device_ids);
108
102/* utility 109/* utility
103 */ 110 */
104 111
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c
index c7e128e5369b..7361204b1eef 100644
--- a/drivers/acpi/utilities/utdebug.c
+++ b/drivers/acpi/utilities/utdebug.c
@@ -109,7 +109,7 @@ void acpi_ut_track_stack_ptr(void)
109 * RETURN: Updated pointer to the function name 109 * RETURN: Updated pointer to the function name
110 * 110 *
111 * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. 111 * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
112 * This allows compiler macros such as __FUNCTION__ to be used 112 * This allows compiler macros such as __func__ to be used
113 * with no change to the debug output. 113 * with no change to the debug output.
114 * 114 *
115 ******************************************************************************/ 115 ******************************************************************************/
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c
index 76ee766c84f9..e08b3fa6639f 100644
--- a/drivers/acpi/utilities/utobject.c
+++ b/drivers/acpi/utilities/utobject.c
@@ -432,7 +432,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
432 * element -- which is legal) 432 * element -- which is legal)
433 */ 433 */
434 if (!internal_object) { 434 if (!internal_object) {
435 *obj_length = 0; 435 *obj_length = sizeof(union acpi_object);
436 return_ACPI_STATUS(AE_OK); 436 return_ACPI_STATUS(AE_OK);
437 } 437 }
438 438
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index eba55b7d6c95..44ea60cf21c0 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -407,6 +407,12 @@ acpi_evaluate_reference(acpi_handle handle,
407 break; 407 break;
408 } 408 }
409 409
410 if (!element->reference.handle) {
411 printk(KERN_WARNING PREFIX "Invalid reference in"
412 " package %s\n", pathname);
413 status = AE_NULL_ENTRY;
414 break;
415 }
410 /* Get the acpi_handle. */ 416 /* Get the acpi_handle. */
411 417
412 list->handles[i] = element->reference.handle; 418 list->handles[i] = element->reference.handle;
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 12cce69b5441..1bc0c74f2755 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -713,7 +713,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
713 713
714 kfree(obj); 714 kfree(obj);
715 715
716 if (device->cap._BCL && device->cap._BCM && device->cap._BQC && max_level > 0){ 716 if (device->cap._BCL && device->cap._BCM && max_level > 0) {
717 int result; 717 int result;
718 static int count = 0; 718 static int count = 0;
719 char *name; 719 char *name;
@@ -1201,7 +1201,7 @@ static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset)
1201 if (!video) 1201 if (!video)
1202 goto end; 1202 goto end;
1203 1203
1204 printk(KERN_INFO PREFIX "Please implement %s\n", __FUNCTION__); 1204 printk(KERN_INFO PREFIX "Please implement %s\n", __func__);
1205 seq_printf(seq, "<TODO>\n"); 1205 seq_printf(seq, "<TODO>\n");
1206 1206
1207 end: 1207 end:
diff --git a/drivers/acpi/wmi.c b/drivers/acpi/wmi.c
index efacc9f8bfe3..c33b1c6e93b1 100644
--- a/drivers/acpi/wmi.c
+++ b/drivers/acpi/wmi.c
@@ -293,7 +293,7 @@ struct acpi_buffer *out)
293{ 293{
294 struct guid_block *block = NULL; 294 struct guid_block *block = NULL;
295 struct wmi_block *wblock = NULL; 295 struct wmi_block *wblock = NULL;
296 acpi_handle handle; 296 acpi_handle handle, wc_handle;
297 acpi_status status, wc_status = AE_ERROR; 297 acpi_status status, wc_status = AE_ERROR;
298 struct acpi_object_list input, wc_input; 298 struct acpi_object_list input, wc_input;
299 union acpi_object wc_params[1], wq_params[1]; 299 union acpi_object wc_params[1], wq_params[1];
@@ -338,8 +338,10 @@ struct acpi_buffer *out)
338 * expensive, but have no corresponding WCxx method. So we 338 * expensive, but have no corresponding WCxx method. So we
339 * should not fail if this happens. 339 * should not fail if this happens.
340 */ 340 */
341 wc_status = acpi_evaluate_object(handle, wc_method, 341 wc_status = acpi_get_handle(handle, wc_method, &wc_handle);
342 &wc_input, NULL); 342 if (ACPI_SUCCESS(wc_status))
343 wc_status = acpi_evaluate_object(handle, wc_method,
344 &wc_input, NULL);
343 } 345 }
344 346
345 strcpy(method, "WQ"); 347 strcpy(method, "WQ");
@@ -351,7 +353,7 @@ struct acpi_buffer *out)
351 * If ACPI_WMI_EXPENSIVE, call the relevant WCxx method, even if 353 * If ACPI_WMI_EXPENSIVE, call the relevant WCxx method, even if
352 * the WQxx method failed - we should disable collection anyway. 354 * the WQxx method failed - we should disable collection anyway.
353 */ 355 */
354 if ((block->flags & ACPI_WMI_EXPENSIVE) && wc_status) { 356 if ((block->flags & ACPI_WMI_EXPENSIVE) && ACPI_SUCCESS(wc_status)) {
355 wc_params[0].integer.value = 0; 357 wc_params[0].integer.value = 0;
356 status = acpi_evaluate_object(handle, 358 status = acpi_evaluate_object(handle,
357 wc_method, &wc_input, NULL); 359 wc_method, &wc_input, NULL);
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index c662d686154a..47c57a4294b7 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -331,8 +331,8 @@ module_param(fs_keystream, int, 0);
331#define FS_DEBUG_QSIZE 0x00001000 331#define FS_DEBUG_QSIZE 0x00001000
332 332
333 333
334#define func_enter() fs_dprintk (FS_DEBUG_FLOW, "fs: enter %s\n", __FUNCTION__) 334#define func_enter() fs_dprintk(FS_DEBUG_FLOW, "fs: enter %s\n", __func__)
335#define func_exit() fs_dprintk (FS_DEBUG_FLOW, "fs: exit %s\n", __FUNCTION__) 335#define func_exit() fs_dprintk(FS_DEBUG_FLOW, "fs: exit %s\n", __func__)
336 336
337 337
338static struct fs_dev *fs_boards = NULL; 338static struct fs_dev *fs_boards = NULL;
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index f97e050338f0..9427a61f62b0 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -95,8 +95,8 @@
95#if 1 95#if 1
96#define ASSERT(expr) if (!(expr)) { \ 96#define ASSERT(expr) if (!(expr)) { \
97 printk(FORE200E "assertion failed! %s[%d]: %s\n", \ 97 printk(FORE200E "assertion failed! %s[%d]: %s\n", \
98 __FUNCTION__, __LINE__, #expr); \ 98 __func__, __LINE__, #expr); \
99 panic(FORE200E "%s", __FUNCTION__); \ 99 panic(FORE200E "%s", __func__); \
100 } 100 }
101#else 101#else
102#define ASSERT(expr) do {} while (0) 102#define ASSERT(expr) do {} while (0)
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index eee54c0cde68..b967919fb7e2 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -555,7 +555,7 @@ idt77252_tx_dump(struct idt77252_dev *card)
555 struct vc_map *vc; 555 struct vc_map *vc;
556 int i; 556 int i;
557 557
558 printk("%s\n", __FUNCTION__); 558 printk("%s\n", __func__);
559 for (i = 0; i < card->tct_size; i++) { 559 for (i = 0; i < card->tct_size; i++) {
560 vc = card->vcs[i]; 560 vc = card->vcs[i];
561 if (!vc) 561 if (!vc)
@@ -1035,7 +1035,7 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
1035 skb = sb_pool_skb(card, le32_to_cpu(rsqe->word_2)); 1035 skb = sb_pool_skb(card, le32_to_cpu(rsqe->word_2));
1036 if (skb == NULL) { 1036 if (skb == NULL) {
1037 printk("%s: NULL skb in %s, rsqe: %08x %08x %08x %08x\n", 1037 printk("%s: NULL skb in %s, rsqe: %08x %08x %08x %08x\n",
1038 card->name, __FUNCTION__, 1038 card->name, __func__,
1039 le32_to_cpu(rsqe->word_1), le32_to_cpu(rsqe->word_2), 1039 le32_to_cpu(rsqe->word_1), le32_to_cpu(rsqe->word_2),
1040 le32_to_cpu(rsqe->word_3), le32_to_cpu(rsqe->word_4)); 1040 le32_to_cpu(rsqe->word_3), le32_to_cpu(rsqe->word_4));
1041 return; 1041 return;
@@ -1873,7 +1873,7 @@ add_rx_skb(struct idt77252_dev *card, int queue,
1873 return; 1873 return;
1874 1874
1875 if (sb_pool_add(card, skb, queue)) { 1875 if (sb_pool_add(card, skb, queue)) {
1876 printk("%s: SB POOL full\n", __FUNCTION__); 1876 printk("%s: SB POOL full\n", __func__);
1877 goto outfree; 1877 goto outfree;
1878 } 1878 }
1879 1879
@@ -1883,7 +1883,7 @@ add_rx_skb(struct idt77252_dev *card, int queue,
1883 IDT77252_PRV_PADDR(skb) = paddr; 1883 IDT77252_PRV_PADDR(skb) = paddr;
1884 1884
1885 if (push_rx_skb(card, skb, queue)) { 1885 if (push_rx_skb(card, skb, queue)) {
1886 printk("%s: FB QUEUE full\n", __FUNCTION__); 1886 printk("%s: FB QUEUE full\n", __func__);
1887 goto outunmap; 1887 goto outunmap;
1888 } 1888 }
1889 } 1889 }
@@ -3821,12 +3821,12 @@ static int __init idt77252_init(void)
3821{ 3821{
3822 struct sk_buff *skb; 3822 struct sk_buff *skb;
3823 3823
3824 printk("%s: at %p\n", __FUNCTION__, idt77252_init); 3824 printk("%s: at %p\n", __func__, idt77252_init);
3825 3825
3826 if (sizeof(skb->cb) < sizeof(struct atm_skb_data) + 3826 if (sizeof(skb->cb) < sizeof(struct atm_skb_data) +
3827 sizeof(struct idt77252_skb_prv)) { 3827 sizeof(struct idt77252_skb_prv)) {
3828 printk(KERN_ERR "%s: skb->cb is too small (%lu < %lu)\n", 3828 printk(KERN_ERR "%s: skb->cb is too small (%lu < %lu)\n",
3829 __FUNCTION__, (unsigned long) sizeof(skb->cb), 3829 __func__, (unsigned long) sizeof(skb->cb),
3830 (unsigned long) sizeof(struct atm_skb_data) + 3830 (unsigned long) sizeof(struct atm_skb_data) +
3831 sizeof(struct idt77252_skb_prv)); 3831 sizeof(struct idt77252_skb_prv));
3832 return -EIO; 3832 return -EIO;
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 32c79a55511b..7652e87d60c5 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -217,7 +217,6 @@ static int use_virtual_dma;
217 */ 217 */
218 218
219static DEFINE_SPINLOCK(floppy_lock); 219static DEFINE_SPINLOCK(floppy_lock);
220static struct completion device_release;
221 220
222static unsigned short virtual_dma_port = 0x3f0; 221static unsigned short virtual_dma_port = 0x3f0;
223irqreturn_t floppy_interrupt(int irq, void *dev_id); 222irqreturn_t floppy_interrupt(int irq, void *dev_id);
@@ -4144,7 +4143,6 @@ DEVICE_ATTR(cmos,S_IRUGO,floppy_cmos_show,NULL);
4144 4143
4145static void floppy_device_release(struct device *dev) 4144static void floppy_device_release(struct device *dev)
4146{ 4145{
4147 complete(&device_release);
4148} 4146}
4149 4147
4150static struct platform_device floppy_device[N_DRIVE]; 4148static struct platform_device floppy_device[N_DRIVE];
@@ -4539,7 +4537,6 @@ void cleanup_module(void)
4539{ 4537{
4540 int drive; 4538 int drive;
4541 4539
4542 init_completion(&device_release);
4543 blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); 4540 blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256);
4544 unregister_blkdev(FLOPPY_MAJOR, "fd"); 4541 unregister_blkdev(FLOPPY_MAJOR, "fd");
4545 4542
@@ -4564,8 +4561,6 @@ void cleanup_module(void)
4564 4561
4565 /* eject disk, if any */ 4562 /* eject disk, if any */
4566 fd_eject(0); 4563 fd_eject(0);
4567
4568 wait_for_completion(&device_release);
4569} 4564}
4570 4565
4571module_param(floppy, charp, 0); 4566module_param(floppy, charp, 0);
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c
index 9e61fca46117..41ca721d2523 100644
--- a/drivers/block/viodasd.c
+++ b/drivers/block/viodasd.c
@@ -528,8 +528,7 @@ static int block_event_to_scatterlist(const struct vioblocklpevent *bevent,
528 numsg = VIOMAXBLOCKDMA; 528 numsg = VIOMAXBLOCKDMA;
529 529
530 *total_len = 0; 530 *total_len = 0;
531 memset(sg, 0, sizeof(sg[0]) * VIOMAXBLOCKDMA); 531 sg_init_table(sg, VIOMAXBLOCKDMA);
532
533 for (i = 0; (i < numsg) && (rw_data->dma_info[i].len > 0); ++i) { 532 for (i = 0; (i < numsg) && (rw_data->dma_info[i].len > 0); ++i) {
534 sg_dma_address(&sg[i]) = rw_data->dma_info[i].token; 533 sg_dma_address(&sg[i]) = rw_data->dma_info[i].token;
535 sg_dma_len(&sg[i]) = rw_data->dma_info[i].len; 534 sg_dma_len(&sg[i]) = rw_data->dma_info[i].len;
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c
index f16c94cbf488..8b884f87d8b7 100644
--- a/drivers/bluetooth/hci_usb.c
+++ b/drivers/bluetooth/hci_usb.c
@@ -149,6 +149,9 @@ static struct usb_device_id blacklist_ids[] = {
149 { USB_DEVICE(0x0400, 0x0807), .driver_info = HCI_BROKEN_ISOC }, 149 { USB_DEVICE(0x0400, 0x0807), .driver_info = HCI_BROKEN_ISOC },
150 { USB_DEVICE(0x0400, 0x080a), .driver_info = HCI_BROKEN_ISOC }, 150 { USB_DEVICE(0x0400, 0x080a), .driver_info = HCI_BROKEN_ISOC },
151 151
152 /* CONWISE Technology based adapters with buggy SCO support */
153 { USB_DEVICE(0x0e5e, 0x6622), .driver_info = HCI_BROKEN_ISOC },
154
152 /* Belkin F8T012 and F8T013 devices */ 155 /* Belkin F8T012 and F8T013 devices */
153 { USB_DEVICE(0x050d, 0x0012), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, 156 { USB_DEVICE(0x050d, 0x0012), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU },
154 { USB_DEVICE(0x050d, 0x0013), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, 157 { USB_DEVICE(0x050d, 0x0013), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU },
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c
index 589ac6f65b9a..3f9d0a9ac36d 100644
--- a/drivers/char/riscom8.c
+++ b/drivers/char/riscom8.c
@@ -1709,7 +1709,7 @@ static int __init riscom8_init_module (void)
1709 1709
1710 if (iobase || iobase1 || iobase2 || iobase3) { 1710 if (iobase || iobase1 || iobase2 || iobase3) {
1711 for(i = 0; i < RC_NBOARD; i++) 1711 for(i = 0; i < RC_NBOARD; i++)
1712 rc_board[0].base = 0; 1712 rc_board[i].base = 0;
1713 } 1713 }
1714 1714
1715 if (iobase) 1715 if (iobase)
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 29965231b912..8db0e7f9d3f4 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -357,7 +357,7 @@ int dma_async_device_register(struct dma_device *device)
357 !device->device_prep_dma_zero_sum); 357 !device->device_prep_dma_zero_sum);
358 BUG_ON(dma_has_cap(DMA_MEMSET, device->cap_mask) && 358 BUG_ON(dma_has_cap(DMA_MEMSET, device->cap_mask) &&
359 !device->device_prep_dma_memset); 359 !device->device_prep_dma_memset);
360 BUG_ON(dma_has_cap(DMA_ZERO_SUM, device->cap_mask) && 360 BUG_ON(dma_has_cap(DMA_INTERRUPT, device->cap_mask) &&
361 !device->device_prep_dma_interrupt); 361 !device->device_prep_dma_interrupt);
362 362
363 BUG_ON(!device->device_alloc_chan_resources); 363 BUG_ON(!device->device_alloc_chan_resources);
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index cc9a68158d99..ad2f938597e2 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -57,12 +57,12 @@ static void dma_init(struct fsl_dma_chan *fsl_chan)
57 57
58} 58}
59 59
60static void set_sr(struct fsl_dma_chan *fsl_chan, dma_addr_t val) 60static void set_sr(struct fsl_dma_chan *fsl_chan, u32 val)
61{ 61{
62 DMA_OUT(fsl_chan, &fsl_chan->reg_base->sr, val, 32); 62 DMA_OUT(fsl_chan, &fsl_chan->reg_base->sr, val, 32);
63} 63}
64 64
65static dma_addr_t get_sr(struct fsl_dma_chan *fsl_chan) 65static u32 get_sr(struct fsl_dma_chan *fsl_chan)
66{ 66{
67 return DMA_IN(fsl_chan, &fsl_chan->reg_base->sr, 32); 67 return DMA_IN(fsl_chan, &fsl_chan->reg_base->sr, 32);
68} 68}
@@ -406,6 +406,32 @@ static void fsl_dma_free_chan_resources(struct dma_chan *chan)
406 dma_pool_destroy(fsl_chan->desc_pool); 406 dma_pool_destroy(fsl_chan->desc_pool);
407} 407}
408 408
409static struct dma_async_tx_descriptor *
410fsl_dma_prep_interrupt(struct dma_chan *chan)
411{
412 struct fsl_dma_chan *fsl_chan;
413 struct fsl_desc_sw *new;
414
415 if (!chan)
416 return NULL;
417
418 fsl_chan = to_fsl_chan(chan);
419
420 new = fsl_dma_alloc_descriptor(fsl_chan);
421 if (!new) {
422 dev_err(fsl_chan->dev, "No free memory for link descriptor\n");
423 return NULL;
424 }
425
426 new->async_tx.cookie = -EBUSY;
427 new->async_tx.ack = 0;
428
429 /* Set End-of-link to the last link descriptor of new list*/
430 set_ld_eol(fsl_chan, new);
431
432 return &new->async_tx;
433}
434
409static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy( 435static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy(
410 struct dma_chan *chan, dma_addr_t dma_dest, dma_addr_t dma_src, 436 struct dma_chan *chan, dma_addr_t dma_dest, dma_addr_t dma_src,
411 size_t len, unsigned long flags) 437 size_t len, unsigned long flags)
@@ -436,7 +462,7 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy(
436 dev_dbg(fsl_chan->dev, "new link desc alloc %p\n", new); 462 dev_dbg(fsl_chan->dev, "new link desc alloc %p\n", new);
437#endif 463#endif
438 464
439 copy = min(len, FSL_DMA_BCR_MAX_CNT); 465 copy = min(len, (size_t)FSL_DMA_BCR_MAX_CNT);
440 466
441 set_desc_cnt(fsl_chan, &new->hw, copy); 467 set_desc_cnt(fsl_chan, &new->hw, copy);
442 set_desc_src(fsl_chan, &new->hw, dma_src); 468 set_desc_src(fsl_chan, &new->hw, dma_src);
@@ -513,7 +539,6 @@ static void fsl_chan_ld_cleanup(struct fsl_dma_chan *fsl_chan)
513 539
514 spin_lock_irqsave(&fsl_chan->desc_lock, flags); 540 spin_lock_irqsave(&fsl_chan->desc_lock, flags);
515 541
516 fsl_dma_update_completed_cookie(fsl_chan);
517 dev_dbg(fsl_chan->dev, "chan completed_cookie = %d\n", 542 dev_dbg(fsl_chan->dev, "chan completed_cookie = %d\n",
518 fsl_chan->completed_cookie); 543 fsl_chan->completed_cookie);
519 list_for_each_entry_safe(desc, _desc, &fsl_chan->ld_queue, node) { 544 list_for_each_entry_safe(desc, _desc, &fsl_chan->ld_queue, node) {
@@ -581,8 +606,8 @@ static void fsl_chan_xfer_ld_queue(struct fsl_dma_chan *fsl_chan)
581 if (ld_node != &fsl_chan->ld_queue) { 606 if (ld_node != &fsl_chan->ld_queue) {
582 /* Get the ld start address from ld_queue */ 607 /* Get the ld start address from ld_queue */
583 next_dest_addr = to_fsl_desc(ld_node)->async_tx.phys; 608 next_dest_addr = to_fsl_desc(ld_node)->async_tx.phys;
584 dev_dbg(fsl_chan->dev, "xfer LDs staring from 0x%016llx\n", 609 dev_dbg(fsl_chan->dev, "xfer LDs staring from %p\n",
585 (u64)next_dest_addr); 610 (void *)next_dest_addr);
586 set_cdar(fsl_chan, next_dest_addr); 611 set_cdar(fsl_chan, next_dest_addr);
587 dma_start(fsl_chan); 612 dma_start(fsl_chan);
588 } else { 613 } else {
@@ -662,7 +687,7 @@ static enum dma_status fsl_dma_is_complete(struct dma_chan *chan,
662static irqreturn_t fsl_dma_chan_do_interrupt(int irq, void *data) 687static irqreturn_t fsl_dma_chan_do_interrupt(int irq, void *data)
663{ 688{
664 struct fsl_dma_chan *fsl_chan = (struct fsl_dma_chan *)data; 689 struct fsl_dma_chan *fsl_chan = (struct fsl_dma_chan *)data;
665 dma_addr_t stat; 690 u32 stat;
666 691
667 stat = get_sr(fsl_chan); 692 stat = get_sr(fsl_chan);
668 dev_dbg(fsl_chan->dev, "event: channel %d, stat = 0x%x\n", 693 dev_dbg(fsl_chan->dev, "event: channel %d, stat = 0x%x\n",
@@ -681,10 +706,10 @@ static irqreturn_t fsl_dma_chan_do_interrupt(int irq, void *data)
681 */ 706 */
682 if (stat & FSL_DMA_SR_EOSI) { 707 if (stat & FSL_DMA_SR_EOSI) {
683 dev_dbg(fsl_chan->dev, "event: End-of-segments INT\n"); 708 dev_dbg(fsl_chan->dev, "event: End-of-segments INT\n");
684 dev_dbg(fsl_chan->dev, "event: clndar 0x%016llx, " 709 dev_dbg(fsl_chan->dev, "event: clndar %p, nlndar %p\n",
685 "nlndar 0x%016llx\n", (u64)get_cdar(fsl_chan), 710 (void *)get_cdar(fsl_chan), (void *)get_ndar(fsl_chan));
686 (u64)get_ndar(fsl_chan));
687 stat &= ~FSL_DMA_SR_EOSI; 711 stat &= ~FSL_DMA_SR_EOSI;
712 fsl_dma_update_completed_cookie(fsl_chan);
688 } 713 }
689 714
690 /* If it current transfer is the end-of-transfer, 715 /* If it current transfer is the end-of-transfer,
@@ -726,12 +751,15 @@ static void dma_do_tasklet(unsigned long data)
726 fsl_chan_ld_cleanup(fsl_chan); 751 fsl_chan_ld_cleanup(fsl_chan);
727} 752}
728 753
754#ifdef FSL_DMA_CALLBACKTEST
729static void fsl_dma_callback_test(struct fsl_dma_chan *fsl_chan) 755static void fsl_dma_callback_test(struct fsl_dma_chan *fsl_chan)
730{ 756{
731 if (fsl_chan) 757 if (fsl_chan)
732 dev_info(fsl_chan->dev, "selftest: callback is ok!\n"); 758 dev_info(fsl_chan->dev, "selftest: callback is ok!\n");
733} 759}
760#endif
734 761
762#ifdef CONFIG_FSL_DMA_SELFTEST
735static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan) 763static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan)
736{ 764{
737 struct dma_chan *chan; 765 struct dma_chan *chan;
@@ -837,9 +865,9 @@ static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan)
837 if (err) { 865 if (err) {
838 for (i = 0; (*(src + i) == *(dest + i)) && (i < test_size); 866 for (i = 0; (*(src + i) == *(dest + i)) && (i < test_size);
839 i++); 867 i++);
840 dev_err(fsl_chan->dev, "selftest: Test failed, data %d/%d is " 868 dev_err(fsl_chan->dev, "selftest: Test failed, data %d/%ld is "
841 "error! src 0x%x, dest 0x%x\n", 869 "error! src 0x%x, dest 0x%x\n",
842 i, test_size, *(src + i), *(dest + i)); 870 i, (long)test_size, *(src + i), *(dest + i));
843 } 871 }
844 872
845free_resources: 873free_resources:
@@ -848,6 +876,7 @@ out:
848 kfree(src); 876 kfree(src);
849 return err; 877 return err;
850} 878}
879#endif
851 880
852static int __devinit of_fsl_dma_chan_probe(struct of_device *dev, 881static int __devinit of_fsl_dma_chan_probe(struct of_device *dev,
853 const struct of_device_id *match) 882 const struct of_device_id *match)
@@ -1008,8 +1037,8 @@ static int __devinit of_fsl_dma_probe(struct of_device *dev,
1008 } 1037 }
1009 1038
1010 dev_info(&dev->dev, "Probe the Freescale DMA driver for %s " 1039 dev_info(&dev->dev, "Probe the Freescale DMA driver for %s "
1011 "controller at 0x%08x...\n", 1040 "controller at %p...\n",
1012 match->compatible, fdev->reg.start); 1041 match->compatible, (void *)fdev->reg.start);
1013 fdev->reg_base = ioremap(fdev->reg.start, fdev->reg.end 1042 fdev->reg_base = ioremap(fdev->reg.start, fdev->reg.end
1014 - fdev->reg.start + 1); 1043 - fdev->reg.start + 1);
1015 1044
@@ -1017,6 +1046,7 @@ static int __devinit of_fsl_dma_probe(struct of_device *dev,
1017 dma_cap_set(DMA_INTERRUPT, fdev->common.cap_mask); 1046 dma_cap_set(DMA_INTERRUPT, fdev->common.cap_mask);
1018 fdev->common.device_alloc_chan_resources = fsl_dma_alloc_chan_resources; 1047 fdev->common.device_alloc_chan_resources = fsl_dma_alloc_chan_resources;
1019 fdev->common.device_free_chan_resources = fsl_dma_free_chan_resources; 1048 fdev->common.device_free_chan_resources = fsl_dma_free_chan_resources;
1049 fdev->common.device_prep_dma_interrupt = fsl_dma_prep_interrupt;
1020 fdev->common.device_prep_dma_memcpy = fsl_dma_prep_memcpy; 1050 fdev->common.device_prep_dma_memcpy = fsl_dma_prep_memcpy;
1021 fdev->common.device_is_tx_complete = fsl_dma_is_complete; 1051 fdev->common.device_is_tx_complete = fsl_dma_is_complete;
1022 fdev->common.device_issue_pending = fsl_dma_memcpy_issue_pending; 1052 fdev->common.device_issue_pending = fsl_dma_memcpy_issue_pending;
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index 3986d54492bd..f82b0906d466 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -140,7 +140,7 @@ static void __iop_adma_slot_cleanup(struct iop_adma_chan *iop_chan)
140 int busy = iop_chan_is_busy(iop_chan); 140 int busy = iop_chan_is_busy(iop_chan);
141 int seen_current = 0, slot_cnt = 0, slots_per_op = 0; 141 int seen_current = 0, slot_cnt = 0, slots_per_op = 0;
142 142
143 dev_dbg(iop_chan->device->common.dev, "%s\n", __FUNCTION__); 143 dev_dbg(iop_chan->device->common.dev, "%s\n", __func__);
144 /* free completed slots from the chain starting with 144 /* free completed slots from the chain starting with
145 * the oldest descriptor 145 * the oldest descriptor
146 */ 146 */
@@ -438,7 +438,7 @@ iop_adma_tx_submit(struct dma_async_tx_descriptor *tx)
438 spin_unlock_bh(&iop_chan->lock); 438 spin_unlock_bh(&iop_chan->lock);
439 439
440 dev_dbg(iop_chan->device->common.dev, "%s cookie: %d slot: %d\n", 440 dev_dbg(iop_chan->device->common.dev, "%s cookie: %d slot: %d\n",
441 __FUNCTION__, sw_desc->async_tx.cookie, sw_desc->idx); 441 __func__, sw_desc->async_tx.cookie, sw_desc->idx);
442 442
443 return cookie; 443 return cookie;
444} 444}
@@ -520,7 +520,7 @@ iop_adma_prep_dma_interrupt(struct dma_chan *chan)
520 struct iop_adma_desc_slot *sw_desc, *grp_start; 520 struct iop_adma_desc_slot *sw_desc, *grp_start;
521 int slot_cnt, slots_per_op; 521 int slot_cnt, slots_per_op;
522 522
523 dev_dbg(iop_chan->device->common.dev, "%s\n", __FUNCTION__); 523 dev_dbg(iop_chan->device->common.dev, "%s\n", __func__);
524 524
525 spin_lock_bh(&iop_chan->lock); 525 spin_lock_bh(&iop_chan->lock);
526 slot_cnt = iop_chan_interrupt_slot_count(&slots_per_op, iop_chan); 526 slot_cnt = iop_chan_interrupt_slot_count(&slots_per_op, iop_chan);
@@ -548,7 +548,7 @@ iop_adma_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dma_dest,
548 BUG_ON(unlikely(len > IOP_ADMA_MAX_BYTE_COUNT)); 548 BUG_ON(unlikely(len > IOP_ADMA_MAX_BYTE_COUNT));
549 549
550 dev_dbg(iop_chan->device->common.dev, "%s len: %u\n", 550 dev_dbg(iop_chan->device->common.dev, "%s len: %u\n",
551 __FUNCTION__, len); 551 __func__, len);
552 552
553 spin_lock_bh(&iop_chan->lock); 553 spin_lock_bh(&iop_chan->lock);
554 slot_cnt = iop_chan_memcpy_slot_count(len, &slots_per_op); 554 slot_cnt = iop_chan_memcpy_slot_count(len, &slots_per_op);
@@ -580,7 +580,7 @@ iop_adma_prep_dma_memset(struct dma_chan *chan, dma_addr_t dma_dest,
580 BUG_ON(unlikely(len > IOP_ADMA_MAX_BYTE_COUNT)); 580 BUG_ON(unlikely(len > IOP_ADMA_MAX_BYTE_COUNT));
581 581
582 dev_dbg(iop_chan->device->common.dev, "%s len: %u\n", 582 dev_dbg(iop_chan->device->common.dev, "%s len: %u\n",
583 __FUNCTION__, len); 583 __func__, len);
584 584
585 spin_lock_bh(&iop_chan->lock); 585 spin_lock_bh(&iop_chan->lock);
586 slot_cnt = iop_chan_memset_slot_count(len, &slots_per_op); 586 slot_cnt = iop_chan_memset_slot_count(len, &slots_per_op);
@@ -614,7 +614,7 @@ iop_adma_prep_dma_xor(struct dma_chan *chan, dma_addr_t dma_dest,
614 614
615 dev_dbg(iop_chan->device->common.dev, 615 dev_dbg(iop_chan->device->common.dev,
616 "%s src_cnt: %d len: %u flags: %lx\n", 616 "%s src_cnt: %d len: %u flags: %lx\n",
617 __FUNCTION__, src_cnt, len, flags); 617 __func__, src_cnt, len, flags);
618 618
619 spin_lock_bh(&iop_chan->lock); 619 spin_lock_bh(&iop_chan->lock);
620 slot_cnt = iop_chan_xor_slot_count(len, src_cnt, &slots_per_op); 620 slot_cnt = iop_chan_xor_slot_count(len, src_cnt, &slots_per_op);
@@ -648,7 +648,7 @@ iop_adma_prep_dma_zero_sum(struct dma_chan *chan, dma_addr_t *dma_src,
648 return NULL; 648 return NULL;
649 649
650 dev_dbg(iop_chan->device->common.dev, "%s src_cnt: %d len: %u\n", 650 dev_dbg(iop_chan->device->common.dev, "%s src_cnt: %d len: %u\n",
651 __FUNCTION__, src_cnt, len); 651 __func__, src_cnt, len);
652 652
653 spin_lock_bh(&iop_chan->lock); 653 spin_lock_bh(&iop_chan->lock);
654 slot_cnt = iop_chan_zero_sum_slot_count(len, src_cnt, &slots_per_op); 654 slot_cnt = iop_chan_zero_sum_slot_count(len, src_cnt, &slots_per_op);
@@ -659,7 +659,7 @@ iop_adma_prep_dma_zero_sum(struct dma_chan *chan, dma_addr_t *dma_src,
659 iop_desc_set_zero_sum_byte_count(grp_start, len); 659 iop_desc_set_zero_sum_byte_count(grp_start, len);
660 grp_start->xor_check_result = result; 660 grp_start->xor_check_result = result;
661 pr_debug("\t%s: grp_start->xor_check_result: %p\n", 661 pr_debug("\t%s: grp_start->xor_check_result: %p\n",
662 __FUNCTION__, grp_start->xor_check_result); 662 __func__, grp_start->xor_check_result);
663 sw_desc->unmap_src_cnt = src_cnt; 663 sw_desc->unmap_src_cnt = src_cnt;
664 sw_desc->unmap_len = len; 664 sw_desc->unmap_len = len;
665 while (src_cnt--) 665 while (src_cnt--)
@@ -700,7 +700,7 @@ static void iop_adma_free_chan_resources(struct dma_chan *chan)
700 iop_chan->last_used = NULL; 700 iop_chan->last_used = NULL;
701 701
702 dev_dbg(iop_chan->device->common.dev, "%s slots_allocated %d\n", 702 dev_dbg(iop_chan->device->common.dev, "%s slots_allocated %d\n",
703 __FUNCTION__, iop_chan->slots_allocated); 703 __func__, iop_chan->slots_allocated);
704 spin_unlock_bh(&iop_chan->lock); 704 spin_unlock_bh(&iop_chan->lock);
705 705
706 /* one is ok since we left it on there on purpose */ 706 /* one is ok since we left it on there on purpose */
@@ -753,7 +753,7 @@ static irqreturn_t iop_adma_eot_handler(int irq, void *data)
753{ 753{
754 struct iop_adma_chan *chan = data; 754 struct iop_adma_chan *chan = data;
755 755
756 dev_dbg(chan->device->common.dev, "%s\n", __FUNCTION__); 756 dev_dbg(chan->device->common.dev, "%s\n", __func__);
757 757
758 tasklet_schedule(&chan->irq_tasklet); 758 tasklet_schedule(&chan->irq_tasklet);
759 759
@@ -766,7 +766,7 @@ static irqreturn_t iop_adma_eoc_handler(int irq, void *data)
766{ 766{
767 struct iop_adma_chan *chan = data; 767 struct iop_adma_chan *chan = data;
768 768
769 dev_dbg(chan->device->common.dev, "%s\n", __FUNCTION__); 769 dev_dbg(chan->device->common.dev, "%s\n", __func__);
770 770
771 tasklet_schedule(&chan->irq_tasklet); 771 tasklet_schedule(&chan->irq_tasklet);
772 772
@@ -823,7 +823,7 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device)
823 int err = 0; 823 int err = 0;
824 struct iop_adma_chan *iop_chan; 824 struct iop_adma_chan *iop_chan;
825 825
826 dev_dbg(device->common.dev, "%s\n", __FUNCTION__); 826 dev_dbg(device->common.dev, "%s\n", __func__);
827 827
828 src = kzalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL); 828 src = kzalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL);
829 if (!src) 829 if (!src)
@@ -906,7 +906,7 @@ iop_adma_xor_zero_sum_self_test(struct iop_adma_device *device)
906 int err = 0; 906 int err = 0;
907 struct iop_adma_chan *iop_chan; 907 struct iop_adma_chan *iop_chan;
908 908
909 dev_dbg(device->common.dev, "%s\n", __FUNCTION__); 909 dev_dbg(device->common.dev, "%s\n", __func__);
910 910
911 for (src_idx = 0; src_idx < IOP_ADMA_NUM_SRC_TEST; src_idx++) { 911 for (src_idx = 0; src_idx < IOP_ADMA_NUM_SRC_TEST; src_idx++) {
912 xor_srcs[src_idx] = alloc_page(GFP_KERNEL); 912 xor_srcs[src_idx] = alloc_page(GFP_KERNEL);
@@ -1159,7 +1159,7 @@ static int __devinit iop_adma_probe(struct platform_device *pdev)
1159 } 1159 }
1160 1160
1161 dev_dbg(&pdev->dev, "%s: allocted descriptor pool virt %p phys %p\n", 1161 dev_dbg(&pdev->dev, "%s: allocted descriptor pool virt %p phys %p\n",
1162 __FUNCTION__, adev->dma_desc_pool_virt, 1162 __func__, adev->dma_desc_pool_virt,
1163 (void *) adev->dma_desc_pool); 1163 (void *) adev->dma_desc_pool);
1164 1164
1165 adev->id = plat_data->hw_id; 1165 adev->id = plat_data->hw_id;
@@ -1289,7 +1289,7 @@ static void iop_chan_start_null_memcpy(struct iop_adma_chan *iop_chan)
1289 dma_cookie_t cookie; 1289 dma_cookie_t cookie;
1290 int slot_cnt, slots_per_op; 1290 int slot_cnt, slots_per_op;
1291 1291
1292 dev_dbg(iop_chan->device->common.dev, "%s\n", __FUNCTION__); 1292 dev_dbg(iop_chan->device->common.dev, "%s\n", __func__);
1293 1293
1294 spin_lock_bh(&iop_chan->lock); 1294 spin_lock_bh(&iop_chan->lock);
1295 slot_cnt = iop_chan_memcpy_slot_count(0, &slots_per_op); 1295 slot_cnt = iop_chan_memcpy_slot_count(0, &slots_per_op);
@@ -1346,7 +1346,7 @@ static void iop_chan_start_null_xor(struct iop_adma_chan *iop_chan)
1346 dma_cookie_t cookie; 1346 dma_cookie_t cookie;
1347 int slot_cnt, slots_per_op; 1347 int slot_cnt, slots_per_op;
1348 1348
1349 dev_dbg(iop_chan->device->common.dev, "%s\n", __FUNCTION__); 1349 dev_dbg(iop_chan->device->common.dev, "%s\n", __func__);
1350 1350
1351 spin_lock_bh(&iop_chan->lock); 1351 spin_lock_bh(&iop_chan->lock);
1352 slot_cnt = iop_chan_xor_slot_count(0, 2, &slots_per_op); 1352 slot_cnt = iop_chan_xor_slot_count(0, 2, &slots_per_op);
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
index 573abe440842..2fa43183d375 100644
--- a/drivers/i2c/busses/i2c-amd756.c
+++ b/drivers/i2c/busses/i2c-amd756.c
@@ -335,7 +335,7 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
335 u8 temp; 335 u8 temp;
336 336
337 /* driver_data might come from user-space, so check it */ 337 /* driver_data might come from user-space, so check it */
338 if (id->driver_data > ARRAY_SIZE(chipname)) 338 if (id->driver_data >= ARRAY_SIZE(chipname))
339 return -EINVAL; 339 return -EINVAL;
340 340
341 if (amd756_ioport) { 341 if (amd756_ioport) {
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
index 501f00cea782..e47aca0ca5ae 100644
--- a/drivers/i2c/chips/Makefile
+++ b/drivers/i2c/chips/Makefile
@@ -1,6 +1,13 @@
1# 1#
2# Makefile for miscellaneous I2C chip drivers. 2# Makefile for miscellaneous I2C chip drivers.
3# 3#
4# Think twice before you add a new driver to this directory.
5# Device drivers are better grouped according to the functionality they
6# implement rather than to the bus they are connected to. In particular:
7# * Hardware monitoring chip drivers go to drivers/hwmon
8# * RTC chip drivers go to drivers/rtc
9# * I/O expander drivers go to drivers/gpio
10#
4 11
5obj-$(CONFIG_DS1682) += ds1682.o 12obj-$(CONFIG_DS1682) += ds1682.o
6obj-$(CONFIG_SENSORS_EEPROM) += eeprom.o 13obj-$(CONFIG_SENSORS_EEPROM) += eeprom.o
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 96da22e9a5a4..fd84b2a36338 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -90,12 +90,16 @@ static int i2c_device_probe(struct device *dev)
90{ 90{
91 struct i2c_client *client = to_i2c_client(dev); 91 struct i2c_client *client = to_i2c_client(dev);
92 struct i2c_driver *driver = to_i2c_driver(dev->driver); 92 struct i2c_driver *driver = to_i2c_driver(dev->driver);
93 int status;
93 94
94 if (!driver->probe) 95 if (!driver->probe)
95 return -ENODEV; 96 return -ENODEV;
96 client->driver = driver; 97 client->driver = driver;
97 dev_dbg(dev, "probe\n"); 98 dev_dbg(dev, "probe\n");
98 return driver->probe(client); 99 status = driver->probe(client);
100 if (status)
101 client->driver = NULL;
102 return status;
99} 103}
100 104
101static int i2c_device_remove(struct device *dev) 105static int i2c_device_remove(struct device *dev)
diff --git a/drivers/infiniband/hw/ipath/ipath_common.h b/drivers/infiniband/hw/ipath/ipath_common.h
index 414621095540..591901aab6b7 100644
--- a/drivers/infiniband/hw/ipath/ipath_common.h
+++ b/drivers/infiniband/hw/ipath/ipath_common.h
@@ -75,7 +75,7 @@
75#define IPATH_IB_LINKDOWN 0 75#define IPATH_IB_LINKDOWN 0
76#define IPATH_IB_LINKARM 1 76#define IPATH_IB_LINKARM 1
77#define IPATH_IB_LINKACTIVE 2 77#define IPATH_IB_LINKACTIVE 2
78#define IPATH_IB_LINKINIT 3 78#define IPATH_IB_LINKDOWN_ONLY 3
79#define IPATH_IB_LINKDOWN_SLEEP 4 79#define IPATH_IB_LINKDOWN_SLEEP 4
80#define IPATH_IB_LINKDOWN_DISABLE 5 80#define IPATH_IB_LINKDOWN_DISABLE 5
81#define IPATH_IB_LINK_LOOPBACK 6 /* enable local loopback */ 81#define IPATH_IB_LINK_LOOPBACK 6 /* enable local loopback */
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c
index d5ff6ca2db30..ca4d0acc6786 100644
--- a/drivers/infiniband/hw/ipath/ipath_driver.c
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c
@@ -851,8 +851,7 @@ void ipath_disarm_piobufs(struct ipath_devdata *dd, unsigned first,
851 * -ETIMEDOUT state can have multiple states set, for any of several 851 * -ETIMEDOUT state can have multiple states set, for any of several
852 * transitions. 852 * transitions.
853 */ 853 */
854static int ipath_wait_linkstate(struct ipath_devdata *dd, u32 state, 854int ipath_wait_linkstate(struct ipath_devdata *dd, u32 state, int msecs)
855 int msecs)
856{ 855{
857 dd->ipath_state_wanted = state; 856 dd->ipath_state_wanted = state;
858 wait_event_interruptible_timeout(ipath_state_wait, 857 wait_event_interruptible_timeout(ipath_state_wait,
@@ -1656,8 +1655,8 @@ void ipath_cancel_sends(struct ipath_devdata *dd, int restore_sendctrl)
1656static void ipath_set_ib_lstate(struct ipath_devdata *dd, int which) 1655static void ipath_set_ib_lstate(struct ipath_devdata *dd, int which)
1657{ 1656{
1658 static const char *what[4] = { 1657 static const char *what[4] = {
1659 [0] = "DOWN", 1658 [0] = "NOP",
1660 [INFINIPATH_IBCC_LINKCMD_INIT] = "INIT", 1659 [INFINIPATH_IBCC_LINKCMD_DOWN] = "DOWN",
1661 [INFINIPATH_IBCC_LINKCMD_ARMED] = "ARMED", 1660 [INFINIPATH_IBCC_LINKCMD_ARMED] = "ARMED",
1662 [INFINIPATH_IBCC_LINKCMD_ACTIVE] = "ACTIVE" 1661 [INFINIPATH_IBCC_LINKCMD_ACTIVE] = "ACTIVE"
1663 }; 1662 };
@@ -1672,9 +1671,9 @@ static void ipath_set_ib_lstate(struct ipath_devdata *dd, int which)
1672 (dd, dd->ipath_kregs->kr_ibcstatus) >> 1671 (dd, dd->ipath_kregs->kr_ibcstatus) >>
1673 INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT) & 1672 INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT) &
1674 INFINIPATH_IBCS_LINKTRAININGSTATE_MASK]); 1673 INFINIPATH_IBCS_LINKTRAININGSTATE_MASK]);
1675 /* flush all queued sends when going to DOWN or INIT, to be sure that 1674 /* flush all queued sends when going to DOWN to be sure that
1676 * they don't block MAD packets */ 1675 * they don't block MAD packets */
1677 if (!linkcmd || linkcmd == INFINIPATH_IBCC_LINKCMD_INIT) 1676 if (linkcmd == INFINIPATH_IBCC_LINKCMD_DOWN)
1678 ipath_cancel_sends(dd, 1); 1677 ipath_cancel_sends(dd, 1);
1679 1678
1680 ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl, 1679 ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl,
@@ -1687,6 +1686,13 @@ int ipath_set_linkstate(struct ipath_devdata *dd, u8 newstate)
1687 int ret; 1686 int ret;
1688 1687
1689 switch (newstate) { 1688 switch (newstate) {
1689 case IPATH_IB_LINKDOWN_ONLY:
1690 ipath_set_ib_lstate(dd, INFINIPATH_IBCC_LINKCMD_DOWN <<
1691 INFINIPATH_IBCC_LINKCMD_SHIFT);
1692 /* don't wait */
1693 ret = 0;
1694 goto bail;
1695
1690 case IPATH_IB_LINKDOWN: 1696 case IPATH_IB_LINKDOWN:
1691 ipath_set_ib_lstate(dd, INFINIPATH_IBCC_LINKINITCMD_POLL << 1697 ipath_set_ib_lstate(dd, INFINIPATH_IBCC_LINKINITCMD_POLL <<
1692 INFINIPATH_IBCC_LINKINITCMD_SHIFT); 1698 INFINIPATH_IBCC_LINKINITCMD_SHIFT);
@@ -1709,16 +1715,6 @@ int ipath_set_linkstate(struct ipath_devdata *dd, u8 newstate)
1709 ret = 0; 1715 ret = 0;
1710 goto bail; 1716 goto bail;
1711 1717
1712 case IPATH_IB_LINKINIT:
1713 if (dd->ipath_flags & IPATH_LINKINIT) {
1714 ret = 0;
1715 goto bail;
1716 }
1717 ipath_set_ib_lstate(dd, INFINIPATH_IBCC_LINKCMD_INIT <<
1718 INFINIPATH_IBCC_LINKCMD_SHIFT);
1719 lstate = IPATH_LINKINIT;
1720 break;
1721
1722 case IPATH_IB_LINKARM: 1718 case IPATH_IB_LINKARM:
1723 if (dd->ipath_flags & IPATH_LINKARMED) { 1719 if (dd->ipath_flags & IPATH_LINKARMED) {
1724 ret = 0; 1720 ret = 0;
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h
index 4cc0f95ea877..ecf3f7ff7717 100644
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -767,6 +767,7 @@ void ipath_kreceive(struct ipath_portdata *);
767int ipath_setrcvhdrsize(struct ipath_devdata *, unsigned); 767int ipath_setrcvhdrsize(struct ipath_devdata *, unsigned);
768int ipath_reset_device(int); 768int ipath_reset_device(int);
769void ipath_get_faststats(unsigned long); 769void ipath_get_faststats(unsigned long);
770int ipath_wait_linkstate(struct ipath_devdata *, u32, int);
770int ipath_set_linkstate(struct ipath_devdata *, u8); 771int ipath_set_linkstate(struct ipath_devdata *, u8);
771int ipath_set_mtu(struct ipath_devdata *, u16); 772int ipath_set_mtu(struct ipath_devdata *, u16);
772int ipath_set_lid(struct ipath_devdata *, u32, u8); 773int ipath_set_lid(struct ipath_devdata *, u32, u8);
diff --git a/drivers/infiniband/hw/ipath/ipath_mad.c b/drivers/infiniband/hw/ipath/ipath_mad.c
index d98d5f103700..b34b91d3723a 100644
--- a/drivers/infiniband/hw/ipath/ipath_mad.c
+++ b/drivers/infiniband/hw/ipath/ipath_mad.c
@@ -555,10 +555,7 @@ static int recv_subn_set_portinfo(struct ib_smp *smp,
555 /* FALLTHROUGH */ 555 /* FALLTHROUGH */
556 case IB_PORT_DOWN: 556 case IB_PORT_DOWN:
557 if (lstate == 0) 557 if (lstate == 0)
558 if (get_linkdowndefaultstate(dd)) 558 lstate = IPATH_IB_LINKDOWN_ONLY;
559 lstate = IPATH_IB_LINKDOWN_SLEEP;
560 else
561 lstate = IPATH_IB_LINKDOWN;
562 else if (lstate == 1) 559 else if (lstate == 1)
563 lstate = IPATH_IB_LINKDOWN_SLEEP; 560 lstate = IPATH_IB_LINKDOWN_SLEEP;
564 else if (lstate == 2) 561 else if (lstate == 2)
@@ -568,6 +565,8 @@ static int recv_subn_set_portinfo(struct ib_smp *smp,
568 else 565 else
569 goto err; 566 goto err;
570 ipath_set_linkstate(dd, lstate); 567 ipath_set_linkstate(dd, lstate);
568 ipath_wait_linkstate(dd, IPATH_LINKINIT | IPATH_LINKARMED |
569 IPATH_LINKACTIVE, 1000);
571 break; 570 break;
572 case IB_PORT_ARMED: 571 case IB_PORT_ARMED:
573 ipath_set_linkstate(dd, IPATH_IB_LINKARM); 572 ipath_set_linkstate(dd, IPATH_IB_LINKARM);
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c
index 80dc623cee40..087ed3166479 100644
--- a/drivers/infiniband/hw/ipath/ipath_qp.c
+++ b/drivers/infiniband/hw/ipath/ipath_qp.c
@@ -329,8 +329,9 @@ struct ipath_qp *ipath_lookup_qpn(struct ipath_qp_table *qpt, u32 qpn)
329/** 329/**
330 * ipath_reset_qp - initialize the QP state to the reset state 330 * ipath_reset_qp - initialize the QP state to the reset state
331 * @qp: the QP to reset 331 * @qp: the QP to reset
332 * @type: the QP type
332 */ 333 */
333static void ipath_reset_qp(struct ipath_qp *qp) 334static void ipath_reset_qp(struct ipath_qp *qp, enum ib_qp_type type)
334{ 335{
335 qp->remote_qpn = 0; 336 qp->remote_qpn = 0;
336 qp->qkey = 0; 337 qp->qkey = 0;
@@ -342,7 +343,7 @@ static void ipath_reset_qp(struct ipath_qp *qp)
342 qp->s_psn = 0; 343 qp->s_psn = 0;
343 qp->r_psn = 0; 344 qp->r_psn = 0;
344 qp->r_msn = 0; 345 qp->r_msn = 0;
345 if (qp->ibqp.qp_type == IB_QPT_RC) { 346 if (type == IB_QPT_RC) {
346 qp->s_state = IB_OPCODE_RC_SEND_LAST; 347 qp->s_state = IB_OPCODE_RC_SEND_LAST;
347 qp->r_state = IB_OPCODE_RC_SEND_LAST; 348 qp->r_state = IB_OPCODE_RC_SEND_LAST;
348 } else { 349 } else {
@@ -414,7 +415,7 @@ int ipath_error_qp(struct ipath_qp *qp, enum ib_wc_status err)
414 wc.wr_id = qp->r_wr_id; 415 wc.wr_id = qp->r_wr_id;
415 wc.opcode = IB_WC_RECV; 416 wc.opcode = IB_WC_RECV;
416 wc.status = err; 417 wc.status = err;
417 ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 1); 418 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 1);
418 } 419 }
419 wc.status = IB_WC_WR_FLUSH_ERR; 420 wc.status = IB_WC_WR_FLUSH_ERR;
420 421
@@ -534,7 +535,7 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
534 535
535 switch (new_state) { 536 switch (new_state) {
536 case IB_QPS_RESET: 537 case IB_QPS_RESET:
537 ipath_reset_qp(qp); 538 ipath_reset_qp(qp, ibqp->qp_type);
538 break; 539 break;
539 540
540 case IB_QPS_ERR: 541 case IB_QPS_ERR:
@@ -647,7 +648,7 @@ int ipath_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
647 attr->port_num = 1; 648 attr->port_num = 1;
648 attr->timeout = qp->timeout; 649 attr->timeout = qp->timeout;
649 attr->retry_cnt = qp->s_retry_cnt; 650 attr->retry_cnt = qp->s_retry_cnt;
650 attr->rnr_retry = qp->s_rnr_retry; 651 attr->rnr_retry = qp->s_rnr_retry_cnt;
651 attr->alt_port_num = 0; 652 attr->alt_port_num = 0;
652 attr->alt_timeout = 0; 653 attr->alt_timeout = 0;
653 654
@@ -839,7 +840,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
839 goto bail_qp; 840 goto bail_qp;
840 } 841 }
841 qp->ip = NULL; 842 qp->ip = NULL;
842 ipath_reset_qp(qp); 843 ipath_reset_qp(qp, init_attr->qp_type);
843 break; 844 break;
844 845
845 default: 846 default:
diff --git a/drivers/infiniband/hw/ipath/ipath_rc.c b/drivers/infiniband/hw/ipath/ipath_rc.c
index 459e46e2c016..40f3e37d7adc 100644
--- a/drivers/infiniband/hw/ipath/ipath_rc.c
+++ b/drivers/infiniband/hw/ipath/ipath_rc.c
@@ -1196,6 +1196,10 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev,
1196 list_move_tail(&qp->timerwait, 1196 list_move_tail(&qp->timerwait,
1197 &dev->pending[dev->pending_index]); 1197 &dev->pending[dev->pending_index]);
1198 spin_unlock(&dev->pending_lock); 1198 spin_unlock(&dev->pending_lock);
1199
1200 if (opcode == OP(RDMA_READ_RESPONSE_MIDDLE))
1201 qp->s_retry = qp->s_retry_cnt;
1202
1199 /* 1203 /*
1200 * Update the RDMA receive state but do the copy w/o 1204 * Update the RDMA receive state but do the copy w/o
1201 * holding the locks and blocking interrupts. 1205 * holding the locks and blocking interrupts.
diff --git a/drivers/infiniband/hw/ipath/ipath_registers.h b/drivers/infiniband/hw/ipath/ipath_registers.h
index 6d2a17f9c1da..92ad73a7fff0 100644
--- a/drivers/infiniband/hw/ipath/ipath_registers.h
+++ b/drivers/infiniband/hw/ipath/ipath_registers.h
@@ -185,7 +185,7 @@
185#define INFINIPATH_IBCC_LINKINITCMD_SLEEP 3 185#define INFINIPATH_IBCC_LINKINITCMD_SLEEP 3
186#define INFINIPATH_IBCC_LINKINITCMD_SHIFT 16 186#define INFINIPATH_IBCC_LINKINITCMD_SHIFT 16
187#define INFINIPATH_IBCC_LINKCMD_MASK 0x3ULL 187#define INFINIPATH_IBCC_LINKCMD_MASK 0x3ULL
188#define INFINIPATH_IBCC_LINKCMD_INIT 1 /* move to 0x11 */ 188#define INFINIPATH_IBCC_LINKCMD_DOWN 1 /* move to 0x11 */
189#define INFINIPATH_IBCC_LINKCMD_ARMED 2 /* move to 0x21 */ 189#define INFINIPATH_IBCC_LINKCMD_ARMED 2 /* move to 0x21 */
190#define INFINIPATH_IBCC_LINKCMD_ACTIVE 3 /* move to 0x31 */ 190#define INFINIPATH_IBCC_LINKCMD_ACTIVE 3 /* move to 0x31 */
191#define INFINIPATH_IBCC_LINKCMD_SHIFT 18 191#define INFINIPATH_IBCC_LINKCMD_SHIFT 18
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 52b1bebfa744..2490b2d79dbb 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -38,6 +38,7 @@
38#include <net/icmp.h> 38#include <net/icmp.h>
39#include <linux/icmpv6.h> 39#include <linux/icmpv6.h>
40#include <linux/delay.h> 40#include <linux/delay.h>
41#include <linux/vmalloc.h>
41 42
42#include "ipoib.h" 43#include "ipoib.h"
43 44
@@ -637,6 +638,7 @@ static inline int post_send(struct ipoib_dev_priv *priv,
637 priv->tx_sge[0].addr = addr; 638 priv->tx_sge[0].addr = addr;
638 priv->tx_sge[0].length = len; 639 priv->tx_sge[0].length = len;
639 640
641 priv->tx_wr.num_sge = 1;
640 priv->tx_wr.wr_id = wr_id | IPOIB_OP_CM; 642 priv->tx_wr.wr_id = wr_id | IPOIB_OP_CM;
641 643
642 return ib_post_send(tx->qp, &priv->tx_wr, &bad_wr); 644 return ib_post_send(tx->qp, &priv->tx_wr, &bad_wr);
@@ -1030,13 +1032,13 @@ static int ipoib_cm_tx_init(struct ipoib_cm_tx *p, u32 qpn,
1030 struct ipoib_dev_priv *priv = netdev_priv(p->dev); 1032 struct ipoib_dev_priv *priv = netdev_priv(p->dev);
1031 int ret; 1033 int ret;
1032 1034
1033 p->tx_ring = kzalloc(ipoib_sendq_size * sizeof *p->tx_ring, 1035 p->tx_ring = vmalloc(ipoib_sendq_size * sizeof *p->tx_ring);
1034 GFP_KERNEL);
1035 if (!p->tx_ring) { 1036 if (!p->tx_ring) {
1036 ipoib_warn(priv, "failed to allocate tx ring\n"); 1037 ipoib_warn(priv, "failed to allocate tx ring\n");
1037 ret = -ENOMEM; 1038 ret = -ENOMEM;
1038 goto err_tx; 1039 goto err_tx;
1039 } 1040 }
1041 memset(p->tx_ring, 0, ipoib_sendq_size * sizeof *p->tx_ring);
1040 1042
1041 p->qp = ipoib_cm_create_tx_qp(p->dev, p); 1043 p->qp = ipoib_cm_create_tx_qp(p->dev, p);
1042 if (IS_ERR(p->qp)) { 1044 if (IS_ERR(p->qp)) {
@@ -1077,6 +1079,7 @@ err_id:
1077 ib_destroy_qp(p->qp); 1079 ib_destroy_qp(p->qp);
1078err_qp: 1080err_qp:
1079 p->qp = NULL; 1081 p->qp = NULL;
1082 vfree(p->tx_ring);
1080err_tx: 1083err_tx:
1081 return ret; 1084 return ret;
1082} 1085}
@@ -1127,7 +1130,7 @@ timeout:
1127 if (p->qp) 1130 if (p->qp)
1128 ib_destroy_qp(p->qp); 1131 ib_destroy_qp(p->qp);
1129 1132
1130 kfree(p->tx_ring); 1133 vfree(p->tx_ring);
1131 kfree(p); 1134 kfree(p);
1132} 1135}
1133 1136
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index f96477a8ca5a..57282048865c 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -41,6 +41,7 @@
41#include <linux/init.h> 41#include <linux/init.h>
42#include <linux/slab.h> 42#include <linux/slab.h>
43#include <linux/kernel.h> 43#include <linux/kernel.h>
44#include <linux/vmalloc.h>
44 45
45#include <linux/if_arp.h> /* For ARPHRD_xxx */ 46#include <linux/if_arp.h> /* For ARPHRD_xxx */
46 47
@@ -887,13 +888,13 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port)
887 goto out; 888 goto out;
888 } 889 }
889 890
890 priv->tx_ring = kzalloc(ipoib_sendq_size * sizeof *priv->tx_ring, 891 priv->tx_ring = vmalloc(ipoib_sendq_size * sizeof *priv->tx_ring);
891 GFP_KERNEL);
892 if (!priv->tx_ring) { 892 if (!priv->tx_ring) {
893 printk(KERN_WARNING "%s: failed to allocate TX ring (%d entries)\n", 893 printk(KERN_WARNING "%s: failed to allocate TX ring (%d entries)\n",
894 ca->name, ipoib_sendq_size); 894 ca->name, ipoib_sendq_size);
895 goto out_rx_ring_cleanup; 895 goto out_rx_ring_cleanup;
896 } 896 }
897 memset(priv->tx_ring, 0, ipoib_sendq_size * sizeof *priv->tx_ring);
897 898
898 /* priv->tx_head, tx_tail & tx_outstanding are already 0 */ 899 /* priv->tx_head, tx_tail & tx_outstanding are already 0 */
899 900
@@ -903,7 +904,7 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port)
903 return 0; 904 return 0;
904 905
905out_tx_ring_cleanup: 906out_tx_ring_cleanup:
906 kfree(priv->tx_ring); 907 vfree(priv->tx_ring);
907 908
908out_rx_ring_cleanup: 909out_rx_ring_cleanup:
909 kfree(priv->rx_ring); 910 kfree(priv->rx_ring);
@@ -928,7 +929,7 @@ void ipoib_dev_cleanup(struct net_device *dev)
928 ipoib_ib_dev_cleanup(dev); 929 ipoib_ib_dev_cleanup(dev);
929 930
930 kfree(priv->rx_ring); 931 kfree(priv->rx_ring);
931 kfree(priv->tx_ring); 932 vfree(priv->tx_ring);
932 933
933 priv->rx_ring = NULL; 934 priv->rx_ring = NULL;
934 priv->tx_ring = NULL; 935 priv->tx_ring = NULL;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index 2628339e3a99..31a53c5bcb13 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -650,7 +650,7 @@ void ipoib_mcast_send(struct net_device *dev, void *mgid, struct sk_buff *skb)
650 */ 650 */
651 spin_lock(&priv->lock); 651 spin_lock(&priv->lock);
652 652
653 if (!test_bit(IPOIB_MCAST_STARTED, &priv->flags) || 653 if (!test_bit(IPOIB_FLAG_OPER_UP, &priv->flags) ||
654 !priv->broadcast || 654 !priv->broadcast ||
655 !test_bit(IPOIB_MCAST_FLAG_ATTACHED, &priv->broadcast->flags)) { 655 !test_bit(IPOIB_MCAST_FLAG_ATTACHED, &priv->broadcast->flags)) {
656 ++dev->stats.tx_dropped; 656 ++dev->stats.tx_dropped;
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index 9cef6fcf587b..d4ad6992f776 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -981,13 +981,13 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
981} 981}
982 982
983 983
984static __inline int 984static inline int
985isdn_minor2drv(int minor) 985isdn_minor2drv(int minor)
986{ 986{
987 return (dev->drvmap[minor]); 987 return (dev->drvmap[minor]);
988} 988}
989 989
990static __inline int 990static inline int
991isdn_minor2chan(int minor) 991isdn_minor2chan(int minor)
992{ 992{
993 return (dev->chanmap[minor]); 993 return (dev->chanmap[minor]);
diff --git a/drivers/isdn/i4l/isdn_v110.c b/drivers/isdn/i4l/isdn_v110.c
index 5484d3c38a57..c5d02b6aafab 100644
--- a/drivers/isdn/i4l/isdn_v110.c
+++ b/drivers/isdn/i4l/isdn_v110.c
@@ -62,7 +62,7 @@ static unsigned char V110_OffMatrix_38400[] =
62 * and to 67452301 when keylen = 2. This is necessary because ordering on 62 * and to 67452301 when keylen = 2. This is necessary because ordering on
63 * the isdn line is the other way. 63 * the isdn line is the other way.
64 */ 64 */
65static __inline unsigned char 65static inline unsigned char
66FlipBits(unsigned char c, int keylen) 66FlipBits(unsigned char c, int keylen)
67{ 67{
68 unsigned char b = c; 68 unsigned char b = c;
diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-pmu-backlight.c
index 741a2e3f4fc6..a348bb0791d3 100644
--- a/drivers/macintosh/via-pmu-backlight.c
+++ b/drivers/macintosh/via-pmu-backlight.c
@@ -17,7 +17,7 @@
17 17
18static struct backlight_ops pmu_backlight_data; 18static struct backlight_ops pmu_backlight_data;
19static DEFINE_SPINLOCK(pmu_backlight_lock); 19static DEFINE_SPINLOCK(pmu_backlight_lock);
20static int sleeping; 20static int sleeping, uses_pmu_bl;
21static u8 bl_curve[FB_BACKLIGHT_LEVELS]; 21static u8 bl_curve[FB_BACKLIGHT_LEVELS];
22 22
23static void pmu_backlight_init_curve(u8 off, u8 min, u8 max) 23static void pmu_backlight_init_curve(u8 off, u8 min, u8 max)
@@ -128,7 +128,7 @@ void pmu_backlight_set_sleep(int sleep)
128 128
129 spin_lock_irqsave(&pmu_backlight_lock, flags); 129 spin_lock_irqsave(&pmu_backlight_lock, flags);
130 sleeping = sleep; 130 sleeping = sleep;
131 if (pmac_backlight) { 131 if (pmac_backlight && uses_pmu_bl) {
132 if (sleep) { 132 if (sleep) {
133 struct adb_request req; 133 struct adb_request req;
134 134
@@ -166,6 +166,7 @@ void __init pmu_backlight_init()
166 printk(KERN_ERR "PMU Backlight registration failed\n"); 166 printk(KERN_ERR "PMU Backlight registration failed\n");
167 return; 167 return;
168 } 168 }
169 uses_pmu_bl = 1;
169 bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; 170 bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
170 pmu_backlight_init_curve(0x7F, 0x46, 0x0E); 171 pmu_backlight_init_curve(0x7F, 0x46, 0x0E);
171 172
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index ebec663d5d37..d6365a9f0637 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -2528,7 +2528,7 @@ EXPORT_SYMBOL(pmu_wait_complete);
2528EXPORT_SYMBOL(pmu_suspend); 2528EXPORT_SYMBOL(pmu_suspend);
2529EXPORT_SYMBOL(pmu_resume); 2529EXPORT_SYMBOL(pmu_resume);
2530EXPORT_SYMBOL(pmu_unlock); 2530EXPORT_SYMBOL(pmu_unlock);
2531#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32) 2531#if defined(CONFIG_PPC32)
2532EXPORT_SYMBOL(pmu_enable_irled); 2532EXPORT_SYMBOL(pmu_enable_irled);
2533EXPORT_SYMBOL(pmu_battery_count); 2533EXPORT_SYMBOL(pmu_battery_count);
2534EXPORT_SYMBOL(pmu_batteries); 2534EXPORT_SYMBOL(pmu_batteries);
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 982e27b86d10..962817e49fba 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -108,6 +108,7 @@ config ACER_WMI
108 depends on ACPI 108 depends on ACPI
109 depends on LEDS_CLASS 109 depends on LEDS_CLASS
110 depends on BACKLIGHT_CLASS_DEVICE 110 depends on BACKLIGHT_CLASS_DEVICE
111 depends on SERIO_I8042
111 select ACPI_WMI 112 select ACPI_WMI
112 ---help--- 113 ---help---
113 This is a driver for newer Acer (and Wistron) laptops. It adds 114 This is a driver for newer Acer (and Wistron) laptops. It adds
diff --git a/drivers/misc/acer-wmi.c b/drivers/misc/acer-wmi.c
index 74d12b4a3abd..dd13a3749927 100644
--- a/drivers/misc/acer-wmi.c
+++ b/drivers/misc/acer-wmi.c
@@ -219,6 +219,15 @@ static struct dmi_system_id acer_quirks[] = {
219 }, 219 },
220 { 220 {
221 .callback = dmi_matched, 221 .callback = dmi_matched,
222 .ident = "Acer Aspire 3610",
223 .matches = {
224 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
225 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 3610"),
226 },
227 .driver_data = &quirk_acer_travelmate_2490,
228 },
229 {
230 .callback = dmi_matched,
222 .ident = "Acer Aspire 5100", 231 .ident = "Acer Aspire 5100",
223 .matches = { 232 .matches = {
224 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 233 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
@@ -228,6 +237,15 @@ static struct dmi_system_id acer_quirks[] = {
228 }, 237 },
229 { 238 {
230 .callback = dmi_matched, 239 .callback = dmi_matched,
240 .ident = "Acer Aspire 5610",
241 .matches = {
242 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
243 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5610"),
244 },
245 .driver_data = &quirk_acer_travelmate_2490,
246 },
247 {
248 .callback = dmi_matched,
231 .ident = "Acer Aspire 5630", 249 .ident = "Acer Aspire 5630",
232 .matches = { 250 .matches = {
233 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 251 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
@@ -761,11 +779,11 @@ enum led_brightness value)
761} 779}
762 780
763static struct led_classdev mail_led = { 781static struct led_classdev mail_led = {
764 .name = "acer-mail:green", 782 .name = "acer-wmi::mail",
765 .brightness_set = mail_led_set, 783 .brightness_set = mail_led_set,
766}; 784};
767 785
768static int __init acer_led_init(struct device *dev) 786static int __devinit acer_led_init(struct device *dev)
769{ 787{
770 return led_classdev_register(dev, &mail_led); 788 return led_classdev_register(dev, &mail_led);
771} 789}
@@ -798,7 +816,7 @@ static struct backlight_ops acer_bl_ops = {
798 .update_status = update_bl_status, 816 .update_status = update_bl_status,
799}; 817};
800 818
801static int __init acer_backlight_init(struct device *dev) 819static int __devinit acer_backlight_init(struct device *dev)
802{ 820{
803 struct backlight_device *bd; 821 struct backlight_device *bd;
804 822
@@ -817,7 +835,7 @@ static int __init acer_backlight_init(struct device *dev)
817 return 0; 835 return 0;
818} 836}
819 837
820static void __exit acer_backlight_exit(void) 838static void acer_backlight_exit(void)
821{ 839{
822 backlight_device_unregister(acer_backlight_device); 840 backlight_device_unregister(acer_backlight_device);
823} 841}
@@ -1052,11 +1070,12 @@ static int __init acer_wmi_init(void)
1052 1070
1053 if (wmi_has_guid(WMID_GUID2) && interface) { 1071 if (wmi_has_guid(WMID_GUID2) && interface) {
1054 if (ACPI_FAILURE(WMID_set_capabilities())) { 1072 if (ACPI_FAILURE(WMID_set_capabilities())) {
1055 printk(ACER_ERR "Unable to detect available devices\n"); 1073 printk(ACER_ERR "Unable to detect available WMID "
1074 "devices\n");
1056 return -ENODEV; 1075 return -ENODEV;
1057 } 1076 }
1058 } else if (!wmi_has_guid(WMID_GUID2) && interface) { 1077 } else if (!wmi_has_guid(WMID_GUID2) && interface) {
1059 printk(ACER_ERR "Unable to detect available devices\n"); 1078 printk(ACER_ERR "No WMID device detection method found\n");
1060 return -ENODEV; 1079 return -ENODEV;
1061 } 1080 }
1062 1081
@@ -1064,21 +1083,20 @@ static int __init acer_wmi_init(void)
1064 interface = &AMW0_interface; 1083 interface = &AMW0_interface;
1065 1084
1066 if (ACPI_FAILURE(AMW0_set_capabilities())) { 1085 if (ACPI_FAILURE(AMW0_set_capabilities())) {
1067 printk(ACER_ERR "Unable to detect available devices\n"); 1086 printk(ACER_ERR "Unable to detect available AMW0 "
1087 "devices\n");
1068 return -ENODEV; 1088 return -ENODEV;
1069 } 1089 }
1070 } 1090 }
1071 1091
1072 if (wmi_has_guid(AMW0_GUID1)) { 1092 if (wmi_has_guid(AMW0_GUID1))
1073 if (ACPI_FAILURE(AMW0_find_mailled())) 1093 AMW0_find_mailled();
1074 printk(ACER_ERR "Unable to detect mail LED\n");
1075 }
1076 1094
1077 find_quirks(); 1095 find_quirks();
1078 1096
1079 if (!interface) { 1097 if (!interface) {
1080 printk(ACER_ERR "No or unsupported WMI interface, unable to "); 1098 printk(ACER_ERR "No or unsupported WMI interface, unable to "
1081 printk(KERN_CONT "load.\n"); 1099 "load\n");
1082 return -ENODEV; 1100 return -ENODEV;
1083 } 1101 }
1084 1102
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 899e3f75f288..02ff3d19b1cc 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -315,7 +315,7 @@ static void sony_laptop_report_input_event(u8 event)
315 break; 315 break;
316 316
317 default: 317 default:
318 if (event > ARRAY_SIZE(sony_laptop_input_index)) { 318 if (event >= ARRAY_SIZE(sony_laptop_input_index)) {
319 dprintk("sony_laptop_report_input_event, event not known: %d\n", event); 319 dprintk("sony_laptop_report_input_event, event not known: %d\n", event);
320 break; 320 break;
321 } 321 }
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index a0f0e605d630..fe7b5ec09708 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2366,15 +2366,15 @@ config GELIC_NET
2366 module will be called ps3_gelic. 2366 module will be called ps3_gelic.
2367 2367
2368config GELIC_WIRELESS 2368config GELIC_WIRELESS
2369 bool "PS3 Wireless support" 2369 bool "PS3 Wireless support"
2370 depends on GELIC_NET 2370 depends on GELIC_NET
2371 select WIRELESS_EXT 2371 select WIRELESS_EXT
2372 help 2372 help
2373 This option adds the support for the wireless feature of PS3. 2373 This option adds the support for the wireless feature of PS3.
2374 If you have the wireless-less model of PS3 or have no plan to 2374 If you have the wireless-less model of PS3 or have no plan to
2375 use wireless feature, disabling this option saves memory. As 2375 use wireless feature, disabling this option saves memory. As
2376 the driver automatically distinguishes the models, you can 2376 the driver automatically distinguishes the models, you can
2377 safely enable this option even if you have a wireless-less model. 2377 safely enable this option even if you have a wireless-less model.
2378 2378
2379config GIANFAR 2379config GIANFAR
2380 tristate "Gianfar Ethernet" 2380 tristate "Gianfar Ethernet"
@@ -2519,7 +2519,7 @@ config CHELSIO_T3
2519 2519
2520config EHEA 2520config EHEA
2521 tristate "eHEA Ethernet support" 2521 tristate "eHEA Ethernet support"
2522 depends on IBMEBUS && INET 2522 depends on IBMEBUS && INET && SPARSEMEM
2523 select INET_LRO 2523 select INET_LRO
2524 ---help--- 2524 ---help---
2525 This driver supports the IBM pSeries eHEA ethernet adapter. 2525 This driver supports the IBM pSeries eHEA ethernet adapter.
diff --git a/drivers/net/ac3200.c b/drivers/net/ac3200.c
index 5136d94923aa..b1448637107f 100644
--- a/drivers/net/ac3200.c
+++ b/drivers/net/ac3200.c
@@ -369,7 +369,7 @@ MODULE_PARM_DESC(mem, "Memory base address(es)");
369MODULE_DESCRIPTION("Ansel AC3200 EISA ethernet driver"); 369MODULE_DESCRIPTION("Ansel AC3200 EISA ethernet driver");
370MODULE_LICENSE("GPL"); 370MODULE_LICENSE("GPL");
371 371
372int __init init_module(void) 372static int __init ac3200_module_init(void)
373{ 373{
374 struct net_device *dev; 374 struct net_device *dev;
375 int this_dev, found = 0; 375 int this_dev, found = 0;
@@ -404,8 +404,7 @@ static void cleanup_card(struct net_device *dev)
404 iounmap(ei_status.mem); 404 iounmap(ei_status.mem);
405} 405}
406 406
407void __exit 407static void __exit ac3200_module_exit(void)
408cleanup_module(void)
409{ 408{
410 int this_dev; 409 int this_dev;
411 410
@@ -418,4 +417,6 @@ cleanup_module(void)
418 } 417 }
419 } 418 }
420} 419}
420module_init(ac3200_module_init);
421module_exit(ac3200_module_exit);
421#endif /* MODULE */ 422#endif /* MODULE */
diff --git a/drivers/net/apne.c b/drivers/net/apne.c
index c12cbdf368b1..47a8275d3962 100644
--- a/drivers/net/apne.c
+++ b/drivers/net/apne.c
@@ -569,7 +569,7 @@ static irqreturn_t apne_interrupt(int irq, void *dev_id)
569#ifdef MODULE 569#ifdef MODULE
570static struct net_device *apne_dev; 570static struct net_device *apne_dev;
571 571
572int __init init_module(void) 572static int __init apne_module_init(void)
573{ 573{
574 apne_dev = apne_probe(-1); 574 apne_dev = apne_probe(-1);
575 if (IS_ERR(apne_dev)) 575 if (IS_ERR(apne_dev))
@@ -577,7 +577,7 @@ int __init init_module(void)
577 return 0; 577 return 0;
578} 578}
579 579
580void __exit cleanup_module(void) 580static void __exit apne_module_exit(void)
581{ 581{
582 unregister_netdev(apne_dev); 582 unregister_netdev(apne_dev);
583 583
@@ -591,7 +591,8 @@ void __exit cleanup_module(void)
591 591
592 free_netdev(apne_dev); 592 free_netdev(apne_dev);
593} 593}
594 594module_init(apne_module_init);
595module_exit(apne_module_exit);
595#endif 596#endif
596 597
597static int init_pcmcia(void) 598static int init_pcmcia(void)
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index 6ab2c2d4d673..fef5560bc7a2 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -1252,7 +1252,7 @@ module_param(irq, int, 0);
1252module_param(dma, int, 0); 1252module_param(dma, int, 0);
1253 1253
1254 1254
1255int __init init_module(void) 1255static int __init ltpc_module_init(void)
1256{ 1256{
1257 if(io == 0) 1257 if(io == 0)
1258 printk(KERN_NOTICE 1258 printk(KERN_NOTICE
@@ -1263,6 +1263,7 @@ int __init init_module(void)
1263 return PTR_ERR(dev_ltpc); 1263 return PTR_ERR(dev_ltpc);
1264 return 0; 1264 return 0;
1265} 1265}
1266module_init(ltpc_module_init);
1266#endif 1267#endif
1267 1268
1268static void __exit ltpc_cleanup(void) 1269static void __exit ltpc_cleanup(void)
diff --git a/drivers/net/arcnet/capmode.c b/drivers/net/arcnet/capmode.c
index cc4610db6395..02cb8f1c1148 100644
--- a/drivers/net/arcnet/capmode.c
+++ b/drivers/net/arcnet/capmode.c
@@ -80,17 +80,19 @@ void arcnet_cap_init(void)
80 80
81#ifdef MODULE 81#ifdef MODULE
82 82
83int __init init_module(void) 83static int __init capmode_module_init(void)
84{ 84{
85 printk(VERSION); 85 printk(VERSION);
86 arcnet_cap_init(); 86 arcnet_cap_init();
87 return 0; 87 return 0;
88} 88}
89 89
90void cleanup_module(void) 90static void __exit capmode_module_exit(void)
91{ 91{
92 arcnet_unregister_proto(&capmode_proto); 92 arcnet_unregister_proto(&capmode_proto);
93} 93}
94module_init(capmode_module_init);
95module_exit(capmode_module_exit);
94 96
95MODULE_LICENSE("GPL"); 97MODULE_LICENSE("GPL");
96#endif /* MODULE */ 98#endif /* MODULE */
diff --git a/drivers/net/atarilance.c b/drivers/net/atarilance.c
index b74dbeef8050..13c293b286de 100644
--- a/drivers/net/atarilance.c
+++ b/drivers/net/atarilance.c
@@ -336,8 +336,6 @@ struct lance_addr {
336 336
337/***************************** Prototypes *****************************/ 337/***************************** Prototypes *****************************/
338 338
339static int addr_accessible( volatile void *regp, int wordflag, int
340 writeflag );
341static unsigned long lance_probe1( struct net_device *dev, struct lance_addr 339static unsigned long lance_probe1( struct net_device *dev, struct lance_addr
342 *init_rec ); 340 *init_rec );
343static int lance_open( struct net_device *dev ); 341static int lance_open( struct net_device *dev );
@@ -406,7 +404,8 @@ struct net_device * __init atarilance_probe(int unit)
406 404
407/* Derived from hwreg_present() in atari/config.c: */ 405/* Derived from hwreg_present() in atari/config.c: */
408 406
409static int __init addr_accessible( volatile void *regp, int wordflag, int writeflag ) 407static noinline int __init addr_accessible(volatile void *regp, int wordflag,
408 int writeflag)
410{ 409{
411 int ret; 410 int ret;
412 long flags; 411 long flags;
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 36ba6dc96acc..cdf3090a1885 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2782,16 +2782,13 @@ static void __devexit e100_remove(struct pci_dev *pdev)
2782 } 2782 }
2783} 2783}
2784 2784
2785#ifdef CONFIG_PM
2786static int e100_suspend(struct pci_dev *pdev, pm_message_t state) 2785static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
2787{ 2786{
2788 struct net_device *netdev = pci_get_drvdata(pdev); 2787 struct net_device *netdev = pci_get_drvdata(pdev);
2789 struct nic *nic = netdev_priv(netdev); 2788 struct nic *nic = netdev_priv(netdev);
2790 2789
2791 if (netif_running(netdev)) 2790 if (netif_running(netdev))
2792 napi_disable(&nic->napi); 2791 e100_down(nic);
2793 del_timer_sync(&nic->watchdog);
2794 netif_carrier_off(nic->netdev);
2795 netif_device_detach(netdev); 2792 netif_device_detach(netdev);
2796 2793
2797 pci_save_state(pdev); 2794 pci_save_state(pdev);
@@ -2804,14 +2801,13 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
2804 pci_enable_wake(pdev, PCI_D3cold, 0); 2801 pci_enable_wake(pdev, PCI_D3cold, 0);
2805 } 2802 }
2806 2803
2807 free_irq(pdev->irq, netdev);
2808
2809 pci_disable_device(pdev); 2804 pci_disable_device(pdev);
2810 pci_set_power_state(pdev, PCI_D3hot); 2805 pci_set_power_state(pdev, PCI_D3hot);
2811 2806
2812 return 0; 2807 return 0;
2813} 2808}
2814 2809
2810#ifdef CONFIG_PM
2815static int e100_resume(struct pci_dev *pdev) 2811static int e100_resume(struct pci_dev *pdev)
2816{ 2812{
2817 struct net_device *netdev = pci_get_drvdata(pdev); 2813 struct net_device *netdev = pci_get_drvdata(pdev);
@@ -2832,26 +2828,7 @@ static int e100_resume(struct pci_dev *pdev)
2832 2828
2833static void e100_shutdown(struct pci_dev *pdev) 2829static void e100_shutdown(struct pci_dev *pdev)
2834{ 2830{
2835 struct net_device *netdev = pci_get_drvdata(pdev); 2831 e100_suspend(pdev, PMSG_SUSPEND);
2836 struct nic *nic = netdev_priv(netdev);
2837
2838 if (netif_running(netdev))
2839 napi_disable(&nic->napi);
2840 del_timer_sync(&nic->watchdog);
2841 netif_carrier_off(nic->netdev);
2842
2843 if ((nic->flags & wol_magic) | e100_asf(nic)) {
2844 pci_enable_wake(pdev, PCI_D3hot, 1);
2845 pci_enable_wake(pdev, PCI_D3cold, 1);
2846 } else {
2847 pci_enable_wake(pdev, PCI_D3hot, 0);
2848 pci_enable_wake(pdev, PCI_D3cold, 0);
2849 }
2850
2851 free_irq(pdev->irq, netdev);
2852
2853 pci_disable_device(pdev);
2854 pci_set_power_state(pdev, PCI_D3hot);
2855} 2832}
2856 2833
2857/* ------------------ PCI Error Recovery infrastructure -------------- */ 2834/* ------------------ PCI Error Recovery infrastructure -------------- */
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index 0809a6a5a286..46a90e9ec563 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -900,7 +900,7 @@ static void enc28j60_hw_rx(struct net_device *ndev)
900 if (RSV_GETBIT(rxstat, RSV_LENCHECKERR)) 900 if (RSV_GETBIT(rxstat, RSV_LENCHECKERR))
901 ndev->stats.rx_frame_errors++; 901 ndev->stats.rx_frame_errors++;
902 } else { 902 } else {
903 skb = dev_alloc_skb(len); 903 skb = dev_alloc_skb(len + NET_IP_ALIGN);
904 if (!skb) { 904 if (!skb) {
905 if (netif_msg_rx_err(priv)) 905 if (netif_msg_rx_err(priv))
906 dev_err(&ndev->dev, 906 dev_err(&ndev->dev,
@@ -908,6 +908,7 @@ static void enc28j60_hw_rx(struct net_device *ndev)
908 ndev->stats.rx_dropped++; 908 ndev->stats.rx_dropped++;
909 } else { 909 } else {
910 skb->dev = ndev; 910 skb->dev = ndev;
911 skb_reserve(skb, NET_IP_ALIGN);
911 /* copy the packet from the receive buffer */ 912 /* copy the packet from the receive buffer */
912 enc28j60_mem_read(priv, priv->next_pk_ptr + sizeof(rsv), 913 enc28j60_mem_read(priv, priv->next_pk_ptr + sizeof(rsv),
913 len, skb_put(skb, len)); 914 len, skb_put(skb, len));
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 23d0a4afe0e1..c2095ce531c9 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -2133,7 +2133,7 @@ static void ixgbe_watchdog(unsigned long data)
2133 (link_speed == IXGBE_LINK_SPEED_10GB_FULL ? 2133 (link_speed == IXGBE_LINK_SPEED_10GB_FULL ?
2134 "10 Gbps" : 2134 "10 Gbps" :
2135 (link_speed == IXGBE_LINK_SPEED_1GB_FULL ? 2135 (link_speed == IXGBE_LINK_SPEED_1GB_FULL ?
2136 "1 Gpbs" : "unknown speed")), 2136 "1 Gbps" : "unknown speed")),
2137 ((FLOW_RX && FLOW_TX) ? "RX/TX" : 2137 ((FLOW_RX && FLOW_TX) ? "RX/TX" :
2138 (FLOW_RX ? "RX" : 2138 (FLOW_RX ? "RX" :
2139 (FLOW_TX ? "TX" : "None")))); 2139 (FLOW_TX ? "TX" : "None"))));
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index b528ce77c406..771139e283af 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -2104,6 +2104,7 @@ MODULE_LICENSE("GPL");
2104MODULE_AUTHOR( "Rabeeh Khoury, Assaf Hoffman, Matthew Dharm, Manish Lachwani" 2104MODULE_AUTHOR( "Rabeeh Khoury, Assaf Hoffman, Matthew Dharm, Manish Lachwani"
2105 " and Dale Farnsworth"); 2105 " and Dale Farnsworth");
2106MODULE_DESCRIPTION("Ethernet driver for Marvell MV643XX"); 2106MODULE_DESCRIPTION("Ethernet driver for Marvell MV643XX");
2107MODULE_ALIAS("platform:mv643xx_eth");
2107 2108
2108/* 2109/*
2109 * The second part is the low level driver of the gigE ethernet ports. 2110 * The second part is the low level driver of the gigE ethernet ports.
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index e8a63e483a2b..ce95c5d168fe 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -1268,7 +1268,7 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id)
1268 } 1268 }
1269 } 1269 }
1270 1270
1271 if (interrupts && ei_debug) 1271 if (interrupts && ei_debug > 3)
1272 { 1272 {
1273 handled = 1; 1273 handled = 1;
1274 if (nr_serviced >= MAX_SERVICE) 1274 if (nr_serviced >= MAX_SERVICE)
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index f4ca0591231d..3ac8529bb92c 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -67,6 +67,7 @@ config REALTEK_PHY
67 67
68config FIXED_PHY 68config FIXED_PHY
69 bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" 69 bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs"
70 depends on PHYLIB=y
70 ---help--- 71 ---help---
71 Adds the platform "fixed" MDIO Bus to cover the boards that use 72 Adds the platform "fixed" MDIO Bus to cover the boards that use
72 PHYs that are not connected to the real MDIO bus. 73 PHYs that are not connected to the real MDIO bus.
diff --git a/drivers/net/phy/davicom.c b/drivers/net/phy/davicom.c
index 7ed632db00d7..d926168bc780 100644
--- a/drivers/net/phy/davicom.c
+++ b/drivers/net/phy/davicom.c
@@ -37,6 +37,7 @@
37 37
38#define MII_DM9161_SCR 0x10 38#define MII_DM9161_SCR 0x10
39#define MII_DM9161_SCR_INIT 0x0610 39#define MII_DM9161_SCR_INIT 0x0610
40#define MII_DM9161_SCR_RMII 0x0100
40 41
41/* DM9161 Interrupt Register */ 42/* DM9161 Interrupt Register */
42#define MII_DM9161_INTR 0x15 43#define MII_DM9161_INTR 0x15
@@ -103,7 +104,7 @@ static int dm9161_config_aneg(struct phy_device *phydev)
103 104
104static int dm9161_config_init(struct phy_device *phydev) 105static int dm9161_config_init(struct phy_device *phydev)
105{ 106{
106 int err; 107 int err, temp;
107 108
108 /* Isolate the PHY */ 109 /* Isolate the PHY */
109 err = phy_write(phydev, MII_BMCR, BMCR_ISOLATE); 110 err = phy_write(phydev, MII_BMCR, BMCR_ISOLATE);
@@ -111,9 +112,19 @@ static int dm9161_config_init(struct phy_device *phydev)
111 if (err < 0) 112 if (err < 0)
112 return err; 113 return err;
113 114
114 /* Do not bypass the scrambler/descrambler */ 115 switch (phydev->interface) {
115 err = phy_write(phydev, MII_DM9161_SCR, MII_DM9161_SCR_INIT); 116 case PHY_INTERFACE_MODE_MII:
117 temp = MII_DM9161_SCR_INIT;
118 break;
119 case PHY_INTERFACE_MODE_RMII:
120 temp = MII_DM9161_SCR_INIT | MII_DM9161_SCR_RMII;
121 break;
122 default:
123 return -EINVAL;
124 }
116 125
126 /* Do not bypass the scrambler/descrambler */
127 err = phy_write(phydev, MII_DM9161_SCR, temp);
117 if (err < 0) 128 if (err < 0)
118 return err; 129 return err;
119 130
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c
index 86e5dba079fe..3d10ca050b79 100644
--- a/drivers/net/pppol2tp.c
+++ b/drivers/net/pppol2tp.c
@@ -302,14 +302,14 @@ pppol2tp_session_find(struct pppol2tp_tunnel *tunnel, u16 session_id)
302 struct pppol2tp_session *session; 302 struct pppol2tp_session *session;
303 struct hlist_node *walk; 303 struct hlist_node *walk;
304 304
305 read_lock(&tunnel->hlist_lock); 305 read_lock_bh(&tunnel->hlist_lock);
306 hlist_for_each_entry(session, walk, session_list, hlist) { 306 hlist_for_each_entry(session, walk, session_list, hlist) {
307 if (session->tunnel_addr.s_session == session_id) { 307 if (session->tunnel_addr.s_session == session_id) {
308 read_unlock(&tunnel->hlist_lock); 308 read_unlock_bh(&tunnel->hlist_lock);
309 return session; 309 return session;
310 } 310 }
311 } 311 }
312 read_unlock(&tunnel->hlist_lock); 312 read_unlock_bh(&tunnel->hlist_lock);
313 313
314 return NULL; 314 return NULL;
315} 315}
@@ -320,14 +320,14 @@ static struct pppol2tp_tunnel *pppol2tp_tunnel_find(u16 tunnel_id)
320{ 320{
321 struct pppol2tp_tunnel *tunnel = NULL; 321 struct pppol2tp_tunnel *tunnel = NULL;
322 322
323 read_lock(&pppol2tp_tunnel_list_lock); 323 read_lock_bh(&pppol2tp_tunnel_list_lock);
324 list_for_each_entry(tunnel, &pppol2tp_tunnel_list, list) { 324 list_for_each_entry(tunnel, &pppol2tp_tunnel_list, list) {
325 if (tunnel->stats.tunnel_id == tunnel_id) { 325 if (tunnel->stats.tunnel_id == tunnel_id) {
326 read_unlock(&pppol2tp_tunnel_list_lock); 326 read_unlock_bh(&pppol2tp_tunnel_list_lock);
327 return tunnel; 327 return tunnel;
328 } 328 }
329 } 329 }
330 read_unlock(&pppol2tp_tunnel_list_lock); 330 read_unlock_bh(&pppol2tp_tunnel_list_lock);
331 331
332 return NULL; 332 return NULL;
333} 333}
@@ -342,10 +342,11 @@ static struct pppol2tp_tunnel *pppol2tp_tunnel_find(u16 tunnel_id)
342static void pppol2tp_recv_queue_skb(struct pppol2tp_session *session, struct sk_buff *skb) 342static void pppol2tp_recv_queue_skb(struct pppol2tp_session *session, struct sk_buff *skb)
343{ 343{
344 struct sk_buff *skbp; 344 struct sk_buff *skbp;
345 struct sk_buff *tmp;
345 u16 ns = PPPOL2TP_SKB_CB(skb)->ns; 346 u16 ns = PPPOL2TP_SKB_CB(skb)->ns;
346 347
347 spin_lock(&session->reorder_q.lock); 348 spin_lock_bh(&session->reorder_q.lock);
348 skb_queue_walk(&session->reorder_q, skbp) { 349 skb_queue_walk_safe(&session->reorder_q, skbp, tmp) {
349 if (PPPOL2TP_SKB_CB(skbp)->ns > ns) { 350 if (PPPOL2TP_SKB_CB(skbp)->ns > ns) {
350 __skb_insert(skb, skbp->prev, skbp, &session->reorder_q); 351 __skb_insert(skb, skbp->prev, skbp, &session->reorder_q);
351 PRINTK(session->debug, PPPOL2TP_MSG_SEQ, KERN_DEBUG, 352 PRINTK(session->debug, PPPOL2TP_MSG_SEQ, KERN_DEBUG,
@@ -360,7 +361,7 @@ static void pppol2tp_recv_queue_skb(struct pppol2tp_session *session, struct sk_
360 __skb_queue_tail(&session->reorder_q, skb); 361 __skb_queue_tail(&session->reorder_q, skb);
361 362
362out: 363out:
363 spin_unlock(&session->reorder_q.lock); 364 spin_unlock_bh(&session->reorder_q.lock);
364} 365}
365 366
366/* Dequeue a single skb. 367/* Dequeue a single skb.
@@ -371,10 +372,9 @@ static void pppol2tp_recv_dequeue_skb(struct pppol2tp_session *session, struct s
371 int length = PPPOL2TP_SKB_CB(skb)->length; 372 int length = PPPOL2TP_SKB_CB(skb)->length;
372 struct sock *session_sock = NULL; 373 struct sock *session_sock = NULL;
373 374
374 /* We're about to requeue the skb, so unlink it and return resources 375 /* We're about to requeue the skb, so return resources
375 * to its current owner (a socket receive buffer). 376 * to its current owner (a socket receive buffer).
376 */ 377 */
377 skb_unlink(skb, &session->reorder_q);
378 skb_orphan(skb); 378 skb_orphan(skb);
379 379
380 tunnel->stats.rx_packets++; 380 tunnel->stats.rx_packets++;
@@ -442,7 +442,7 @@ static void pppol2tp_recv_dequeue(struct pppol2tp_session *session)
442 * expect to send up next, dequeue it and any other 442 * expect to send up next, dequeue it and any other
443 * in-sequence packets behind it. 443 * in-sequence packets behind it.
444 */ 444 */
445 spin_lock(&session->reorder_q.lock); 445 spin_lock_bh(&session->reorder_q.lock);
446 skb_queue_walk_safe(&session->reorder_q, skb, tmp) { 446 skb_queue_walk_safe(&session->reorder_q, skb, tmp) {
447 if (time_after(jiffies, PPPOL2TP_SKB_CB(skb)->expires)) { 447 if (time_after(jiffies, PPPOL2TP_SKB_CB(skb)->expires)) {
448 session->stats.rx_seq_discards++; 448 session->stats.rx_seq_discards++;
@@ -470,13 +470,18 @@ static void pppol2tp_recv_dequeue(struct pppol2tp_session *session)
470 goto out; 470 goto out;
471 } 471 }
472 } 472 }
473 spin_unlock(&session->reorder_q.lock); 473 __skb_unlink(skb, &session->reorder_q);
474
475 /* Process the skb. We release the queue lock while we
476 * do so to let other contexts process the queue.
477 */
478 spin_unlock_bh(&session->reorder_q.lock);
474 pppol2tp_recv_dequeue_skb(session, skb); 479 pppol2tp_recv_dequeue_skb(session, skb);
475 spin_lock(&session->reorder_q.lock); 480 spin_lock_bh(&session->reorder_q.lock);
476 } 481 }
477 482
478out: 483out:
479 spin_unlock(&session->reorder_q.lock); 484 spin_unlock_bh(&session->reorder_q.lock);
480} 485}
481 486
482/* Internal receive frame. Do the real work of receiving an L2TP data frame 487/* Internal receive frame. Do the real work of receiving an L2TP data frame
@@ -1059,7 +1064,7 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
1059 1064
1060 /* Get routing info from the tunnel socket */ 1065 /* Get routing info from the tunnel socket */
1061 dst_release(skb->dst); 1066 dst_release(skb->dst);
1062 skb->dst = sk_dst_get(sk_tun); 1067 skb->dst = dst_clone(__sk_dst_get(sk_tun));
1063 skb_orphan(skb); 1068 skb_orphan(skb);
1064 skb->sk = sk_tun; 1069 skb->sk = sk_tun;
1065 1070
@@ -1107,7 +1112,7 @@ static void pppol2tp_tunnel_closeall(struct pppol2tp_tunnel *tunnel)
1107 PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, 1112 PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO,
1108 "%s: closing all sessions...\n", tunnel->name); 1113 "%s: closing all sessions...\n", tunnel->name);
1109 1114
1110 write_lock(&tunnel->hlist_lock); 1115 write_lock_bh(&tunnel->hlist_lock);
1111 for (hash = 0; hash < PPPOL2TP_HASH_SIZE; hash++) { 1116 for (hash = 0; hash < PPPOL2TP_HASH_SIZE; hash++) {
1112again: 1117again:
1113 hlist_for_each_safe(walk, tmp, &tunnel->session_hlist[hash]) { 1118 hlist_for_each_safe(walk, tmp, &tunnel->session_hlist[hash]) {
@@ -1129,7 +1134,7 @@ again:
1129 * disappear as we're jumping between locks. 1134 * disappear as we're jumping between locks.
1130 */ 1135 */
1131 sock_hold(sk); 1136 sock_hold(sk);
1132 write_unlock(&tunnel->hlist_lock); 1137 write_unlock_bh(&tunnel->hlist_lock);
1133 lock_sock(sk); 1138 lock_sock(sk);
1134 1139
1135 if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { 1140 if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) {
@@ -1154,11 +1159,11 @@ again:
1154 * list so we are guaranteed to make forward 1159 * list so we are guaranteed to make forward
1155 * progress. 1160 * progress.
1156 */ 1161 */
1157 write_lock(&tunnel->hlist_lock); 1162 write_lock_bh(&tunnel->hlist_lock);
1158 goto again; 1163 goto again;
1159 } 1164 }
1160 } 1165 }
1161 write_unlock(&tunnel->hlist_lock); 1166 write_unlock_bh(&tunnel->hlist_lock);
1162} 1167}
1163 1168
1164/* Really kill the tunnel. 1169/* Really kill the tunnel.
@@ -1167,9 +1172,9 @@ again:
1167static void pppol2tp_tunnel_free(struct pppol2tp_tunnel *tunnel) 1172static void pppol2tp_tunnel_free(struct pppol2tp_tunnel *tunnel)
1168{ 1173{
1169 /* Remove from socket list */ 1174 /* Remove from socket list */
1170 write_lock(&pppol2tp_tunnel_list_lock); 1175 write_lock_bh(&pppol2tp_tunnel_list_lock);
1171 list_del_init(&tunnel->list); 1176 list_del_init(&tunnel->list);
1172 write_unlock(&pppol2tp_tunnel_list_lock); 1177 write_unlock_bh(&pppol2tp_tunnel_list_lock);
1173 1178
1174 atomic_dec(&pppol2tp_tunnel_count); 1179 atomic_dec(&pppol2tp_tunnel_count);
1175 kfree(tunnel); 1180 kfree(tunnel);
@@ -1245,9 +1250,9 @@ static void pppol2tp_session_destruct(struct sock *sk)
1245 /* Delete the session socket from the 1250 /* Delete the session socket from the
1246 * hash 1251 * hash
1247 */ 1252 */
1248 write_lock(&tunnel->hlist_lock); 1253 write_lock_bh(&tunnel->hlist_lock);
1249 hlist_del_init(&session->hlist); 1254 hlist_del_init(&session->hlist);
1250 write_unlock(&tunnel->hlist_lock); 1255 write_unlock_bh(&tunnel->hlist_lock);
1251 1256
1252 atomic_dec(&pppol2tp_session_count); 1257 atomic_dec(&pppol2tp_session_count);
1253 } 1258 }
@@ -1392,9 +1397,9 @@ static struct sock *pppol2tp_prepare_tunnel_socket(int fd, u16 tunnel_id,
1392 1397
1393 /* Add tunnel to our list */ 1398 /* Add tunnel to our list */
1394 INIT_LIST_HEAD(&tunnel->list); 1399 INIT_LIST_HEAD(&tunnel->list);
1395 write_lock(&pppol2tp_tunnel_list_lock); 1400 write_lock_bh(&pppol2tp_tunnel_list_lock);
1396 list_add(&tunnel->list, &pppol2tp_tunnel_list); 1401 list_add(&tunnel->list, &pppol2tp_tunnel_list);
1397 write_unlock(&pppol2tp_tunnel_list_lock); 1402 write_unlock_bh(&pppol2tp_tunnel_list_lock);
1398 atomic_inc(&pppol2tp_tunnel_count); 1403 atomic_inc(&pppol2tp_tunnel_count);
1399 1404
1400 /* Bump the reference count. The tunnel context is deleted 1405 /* Bump the reference count. The tunnel context is deleted
@@ -1599,11 +1604,11 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
1599 sk->sk_user_data = session; 1604 sk->sk_user_data = session;
1600 1605
1601 /* Add session to the tunnel's hash list */ 1606 /* Add session to the tunnel's hash list */
1602 write_lock(&tunnel->hlist_lock); 1607 write_lock_bh(&tunnel->hlist_lock);
1603 hlist_add_head(&session->hlist, 1608 hlist_add_head(&session->hlist,
1604 pppol2tp_session_id_hash(tunnel, 1609 pppol2tp_session_id_hash(tunnel,
1605 session->tunnel_addr.s_session)); 1610 session->tunnel_addr.s_session));
1606 write_unlock(&tunnel->hlist_lock); 1611 write_unlock_bh(&tunnel->hlist_lock);
1607 1612
1608 atomic_inc(&pppol2tp_session_count); 1613 atomic_inc(&pppol2tp_session_count);
1609 1614
@@ -2205,7 +2210,7 @@ static struct pppol2tp_session *next_session(struct pppol2tp_tunnel *tunnel, str
2205 int next = 0; 2210 int next = 0;
2206 int i; 2211 int i;
2207 2212
2208 read_lock(&tunnel->hlist_lock); 2213 read_lock_bh(&tunnel->hlist_lock);
2209 for (i = 0; i < PPPOL2TP_HASH_SIZE; i++) { 2214 for (i = 0; i < PPPOL2TP_HASH_SIZE; i++) {
2210 hlist_for_each_entry(session, walk, &tunnel->session_hlist[i], hlist) { 2215 hlist_for_each_entry(session, walk, &tunnel->session_hlist[i], hlist) {
2211 if (curr == NULL) { 2216 if (curr == NULL) {
@@ -2223,7 +2228,7 @@ static struct pppol2tp_session *next_session(struct pppol2tp_tunnel *tunnel, str
2223 } 2228 }
2224 } 2229 }
2225out: 2230out:
2226 read_unlock(&tunnel->hlist_lock); 2231 read_unlock_bh(&tunnel->hlist_lock);
2227 if (!found) 2232 if (!found)
2228 session = NULL; 2233 session = NULL;
2229 2234
@@ -2234,13 +2239,13 @@ static struct pppol2tp_tunnel *next_tunnel(struct pppol2tp_tunnel *curr)
2234{ 2239{
2235 struct pppol2tp_tunnel *tunnel = NULL; 2240 struct pppol2tp_tunnel *tunnel = NULL;
2236 2241
2237 read_lock(&pppol2tp_tunnel_list_lock); 2242 read_lock_bh(&pppol2tp_tunnel_list_lock);
2238 if (list_is_last(&curr->list, &pppol2tp_tunnel_list)) { 2243 if (list_is_last(&curr->list, &pppol2tp_tunnel_list)) {
2239 goto out; 2244 goto out;
2240 } 2245 }
2241 tunnel = list_entry(curr->list.next, struct pppol2tp_tunnel, list); 2246 tunnel = list_entry(curr->list.next, struct pppol2tp_tunnel, list);
2242out: 2247out:
2243 read_unlock(&pppol2tp_tunnel_list_lock); 2248 read_unlock_bh(&pppol2tp_tunnel_list_lock);
2244 2249
2245 return tunnel; 2250 return tunnel;
2246} 2251}
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 6179a0a2032c..c72787adeba3 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -1088,7 +1088,7 @@ static int s2io_print_pci_mode(struct s2io_nic *nic)
1088 * '-1' on failure 1088 * '-1' on failure
1089 */ 1089 */
1090 1090
1091int init_tti(struct s2io_nic *nic, int link) 1091static int init_tti(struct s2io_nic *nic, int link)
1092{ 1092{
1093 struct XENA_dev_config __iomem *bar0 = nic->bar0; 1093 struct XENA_dev_config __iomem *bar0 = nic->bar0;
1094 register u64 val64 = 0; 1094 register u64 val64 = 0;
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
index 77d9dd7ea34f..567c62757e9d 100644
--- a/drivers/net/tulip/de2104x.c
+++ b/drivers/net/tulip/de2104x.c
@@ -910,7 +910,8 @@ static void de_set_media (struct de_private *de)
910 unsigned media = de->media_type; 910 unsigned media = de->media_type;
911 u32 macmode = dr32(MacMode); 911 u32 macmode = dr32(MacMode);
912 912
913 BUG_ON(de_is_running(de)); 913 if (de_is_running(de))
914 printk(KERN_WARNING "%s: chip is running while changing media!\n", de->dev->name);
914 915
915 if (de->de21040) 916 if (de->de21040)
916 dw32(CSR11, FULL_DUPLEX_MAGIC); 917 dw32(CSR11, FULL_DUPLEX_MAGIC);
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
index 15d5c58e57bc..e59255a155a9 100644
--- a/drivers/net/wan/sbni.c
+++ b/drivers/net/wan/sbni.c
@@ -751,7 +751,7 @@ upload_data( struct net_device *dev, unsigned framelen, unsigned frameno,
751} 751}
752 752
753 753
754static __inline void 754static inline void
755send_complete( struct net_local *nl ) 755send_complete( struct net_local *nl )
756{ 756{
757#ifdef CONFIG_SBNI_MULTILINE 757#ifdef CONFIG_SBNI_MULTILINE
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index bdc6a1cc2103..f0ef7081bdeb 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -578,7 +578,7 @@ int lbs_process_rx_command(struct lbs_private *priv)
578 goto done; 578 goto done;
579 } 579 }
580 if (respcmd != CMD_RET(curcmd) && 580 if (respcmd != CMD_RET(curcmd) &&
581 respcmd != CMD_802_11_ASSOCIATE && curcmd != CMD_RET_802_11_ASSOCIATE) { 581 respcmd != CMD_RET_802_11_ASSOCIATE && curcmd != CMD_802_11_ASSOCIATE) {
582 lbs_pr_info("Invalid CMD_RESP %x to command %x!\n", respcmd, curcmd); 582 lbs_pr_info("Invalid CMD_RESP %x to command %x!\n", respcmd, curcmd);
583 spin_unlock_irqrestore(&priv->driver_lock, flags); 583 spin_unlock_irqrestore(&priv->driver_lock, flags);
584 ret = -1; 584 ret = -1;
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index e808db98f2f5..93ea212fedd5 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2302,9 +2302,9 @@ static void rt61pci_configure_filter(struct ieee80211_hw *hw,
2302 * Apply some rules to the filters: 2302 * Apply some rules to the filters:
2303 * - Some filters imply different filters to be set. 2303 * - Some filters imply different filters to be set.
2304 * - Some things we can't filter out at all. 2304 * - Some things we can't filter out at all.
2305 * - Multicast filter seems to kill broadcast traffic so never use it.
2305 */ 2306 */
2306 if (mc_count) 2307 *total_flags |= FIF_ALLMULTI;
2307 *total_flags |= FIF_ALLMULTI;
2308 if (*total_flags & FIF_OTHER_BSS || 2308 if (*total_flags & FIF_OTHER_BSS ||
2309 *total_flags & FIF_PROMISC_IN_BSS) 2309 *total_flags & FIF_PROMISC_IN_BSS)
2310 *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; 2310 *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 4fac2d414d84..8103d41a1543 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -1869,9 +1869,9 @@ static void rt73usb_configure_filter(struct ieee80211_hw *hw,
1869 * Apply some rules to the filters: 1869 * Apply some rules to the filters:
1870 * - Some filters imply different filters to be set. 1870 * - Some filters imply different filters to be set.
1871 * - Some things we can't filter out at all. 1871 * - Some things we can't filter out at all.
1872 * - Multicast filter seems to kill broadcast traffic so never use it.
1872 */ 1873 */
1873 if (mc_count) 1874 *total_flags |= FIF_ALLMULTI;
1874 *total_flags |= FIF_ALLMULTI;
1875 if (*total_flags & FIF_OTHER_BSS || 1875 if (*total_flags & FIF_OTHER_BSS ||
1876 *total_flags & FIF_PROMISC_IN_BSS) 1876 *total_flags & FIF_PROMISC_IN_BSS)
1877 *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; 1877 *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS;
@@ -2098,6 +2098,7 @@ static struct usb_device_id rt73usb_device_table[] = {
2098 /* D-Link */ 2098 /* D-Link */
2099 { USB_DEVICE(0x07d1, 0x3c03), USB_DEVICE_DATA(&rt73usb_ops) }, 2099 { USB_DEVICE(0x07d1, 0x3c03), USB_DEVICE_DATA(&rt73usb_ops) },
2100 { USB_DEVICE(0x07d1, 0x3c04), USB_DEVICE_DATA(&rt73usb_ops) }, 2100 { USB_DEVICE(0x07d1, 0x3c04), USB_DEVICE_DATA(&rt73usb_ops) },
2101 { USB_DEVICE(0x07d1, 0x3c07), USB_DEVICE_DATA(&rt73usb_ops) },
2101 /* Gemtek */ 2102 /* Gemtek */
2102 { USB_DEVICE(0x15a9, 0x0004), USB_DEVICE_DATA(&rt73usb_ops) }, 2103 { USB_DEVICE(0x15a9, 0x0004), USB_DEVICE_DATA(&rt73usb_ops) },
2103 /* Gigabyte */ 2104 /* Gigabyte */
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index 6a9403d79e0c..d708358326e5 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -143,14 +143,18 @@ void pci_bus_add_devices(struct pci_bus *bus)
143 /* register the bus with sysfs as the parent is now 143 /* register the bus with sysfs as the parent is now
144 * properly registered. */ 144 * properly registered. */
145 child_bus = dev->subordinate; 145 child_bus = dev->subordinate;
146 if (child_bus->is_added)
147 continue;
146 child_bus->dev.parent = child_bus->bridge; 148 child_bus->dev.parent = child_bus->bridge;
147 retval = device_register(&child_bus->dev); 149 retval = device_register(&child_bus->dev);
148 if (retval) 150 if (retval)
149 dev_err(&dev->dev, "Error registering pci_bus," 151 dev_err(&dev->dev, "Error registering pci_bus,"
150 " continuing...\n"); 152 " continuing...\n");
151 else 153 else {
154 child_bus->is_added = 1;
152 retval = device_create_file(&child_bus->dev, 155 retval = device_create_file(&child_bus->dev,
153 &dev_attr_cpuaffinity); 156 &dev_attr_cpuaffinity);
157 }
154 if (retval) 158 if (retval)
155 dev_err(&dev->dev, "Error creating cpuaffinity" 159 dev_err(&dev->dev, "Error creating cpuaffinity"
156 " file, continuing...\n"); 160 " file, continuing...\n");
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 4a23654184fc..72f7476930c8 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -272,21 +272,29 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
272{ 272{
273 acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); 273 acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev);
274 acpi_handle tmp; 274 acpi_handle tmp;
275 static int state_conv[] = { 275 static const u8 state_conv[] = {
276 [0] = 0, 276 [PCI_D0] = ACPI_STATE_D0,
277 [1] = 1, 277 [PCI_D1] = ACPI_STATE_D1,
278 [2] = 2, 278 [PCI_D2] = ACPI_STATE_D2,
279 [3] = 3, 279 [PCI_D3hot] = ACPI_STATE_D3,
280 [4] = 3 280 [PCI_D3cold] = ACPI_STATE_D3
281 }; 281 };
282 int acpi_state = state_conv[(int __force) state];
283 282
284 if (!handle) 283 if (!handle)
285 return -ENODEV; 284 return -ENODEV;
286 /* If the ACPI device has _EJ0, ignore the device */ 285 /* If the ACPI device has _EJ0, ignore the device */
287 if (ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp))) 286 if (ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp)))
288 return 0; 287 return 0;
289 return acpi_bus_set_power(handle, acpi_state); 288
289 switch (state) {
290 case PCI_D0:
291 case PCI_D1:
292 case PCI_D2:
293 case PCI_D3hot:
294 case PCI_D3cold:
295 return acpi_bus_set_power(handle, state_conv[state]);
296 }
297 return -EINVAL;
290} 298}
291 299
292 300
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index 4065139753b6..37993206ae5d 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -17,7 +17,6 @@
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/pnp.h> 18#include <linux/pnp.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/dmi.h>
21#include <linux/kallsyms.h> 20#include <linux/kallsyms.h>
22#include "base.h" 21#include "base.h"
23 22
@@ -109,42 +108,73 @@ static void quirk_sb16audio_resources(struct pnp_dev *dev)
109 "pnp: SB audio device quirk - increasing port range\n"); 108 "pnp: SB audio device quirk - increasing port range\n");
110} 109}
111 110
112static void quirk_supermicro_h8dce_system(struct pnp_dev *dev) 111
112#include <linux/pci.h>
113
114static void quirk_system_pci_resources(struct pnp_dev *dev)
113{ 115{
114 int i; 116 struct pci_dev *pdev = NULL;
115 static struct dmi_system_id supermicro_h8dce[] = { 117 resource_size_t pnp_start, pnp_end, pci_start, pci_end;
116 { 118 int i, j;
117 .ident = "Supermicro H8DCE",
118 .matches = {
119 DMI_MATCH(DMI_SYS_VENDOR, "Supermicro"),
120 DMI_MATCH(DMI_PRODUCT_NAME, "H8DCE"),
121 },
122 },
123 { }
124 };
125
126 if (!dmi_check_system(supermicro_h8dce))
127 return;
128 119
129 /* 120 /*
130 * On the Supermicro H8DCE, there's a system device with resources 121 * Some BIOSes have PNP motherboard devices with resources that
131 * that overlap BAR 6 of the built-in SATA PCI adapter. If the PNP 122 * partially overlap PCI BARs. The PNP system driver claims these
132 * system device claims them, the sata_nv driver won't be able to. 123 * motherboard resources, which prevents the normal PCI driver from
133 * More details at: 124 * requesting them later.
134 * https://bugzilla.redhat.com/show_bug.cgi?id=280641 125 *
135 * https://bugzilla.redhat.com/show_bug.cgi?id=313491 126 * This patch disables the PNP resources that conflict with PCI BARs
136 * http://lkml.org/lkml/2008/1/9/449 127 * so they won't be claimed by the PNP system driver.
137 * http://thread.gmane.org/gmane.linux.acpi.devel/27312
138 */ 128 */
139 for (i = 0; i < PNP_MAX_MEM; i++) { 129 for_each_pci_dev(pdev) {
140 if (pnp_mem_valid(dev, i) && pnp_mem_len(dev, i) && 130 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
141 (pnp_mem_start(dev, i) & 0xdfef0000) == 0xdfef0000) { 131 if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM) ||
142 dev_warn(&dev->dev, "disabling 0x%llx-0x%llx to prevent" 132 pci_resource_len(pdev, i) == 0)
143 " conflict with sata_nv PCI device\n", 133 continue;
144 (unsigned long long) pnp_mem_start(dev, i), 134
145 (unsigned long long) (pnp_mem_start(dev, i) + 135 pci_start = pci_resource_start(pdev, i);
146 pnp_mem_len(dev, i) - 1)); 136 pci_end = pci_resource_end(pdev, i);
147 pnp_mem_flags(dev, i) = 0; 137 for (j = 0; j < PNP_MAX_MEM; j++) {
138 if (!pnp_mem_valid(dev, j) ||
139 pnp_mem_len(dev, j) == 0)
140 continue;
141
142 pnp_start = pnp_mem_start(dev, j);
143 pnp_end = pnp_mem_end(dev, j);
144
145 /*
146 * If the PNP region doesn't overlap the PCI
147 * region at all, there's no problem.
148 */
149 if (pnp_end < pci_start || pnp_start > pci_end)
150 continue;
151
152 /*
153 * If the PNP region completely encloses (or is
154 * at least as large as) the PCI region, that's
155 * also OK. For example, this happens when the
156 * PNP device describes a bridge with PCI
157 * behind it.
158 */
159 if (pnp_start <= pci_start &&
160 pnp_end >= pci_end)
161 continue;
162
163 /*
164 * Otherwise, the PNP region overlaps *part* of
165 * the PCI region, and that might prevent a PCI
166 * driver from requesting its resources.
167 */
168 dev_warn(&dev->dev, "mem resource "
169 "(0x%llx-0x%llx) overlaps %s BAR %d "
170 "(0x%llx-0x%llx), disabling\n",
171 (unsigned long long) pnp_start,
172 (unsigned long long) pnp_end,
173 pci_name(pdev), i,
174 (unsigned long long) pci_start,
175 (unsigned long long) pci_end);
176 pnp_mem_flags(dev, j) = 0;
177 }
148 } 178 }
149 } 179 }
150} 180}
@@ -169,8 +199,8 @@ static struct pnp_fixup pnp_fixups[] = {
169 {"CTL0043", quirk_sb16audio_resources}, 199 {"CTL0043", quirk_sb16audio_resources},
170 {"CTL0044", quirk_sb16audio_resources}, 200 {"CTL0044", quirk_sb16audio_resources},
171 {"CTL0045", quirk_sb16audio_resources}, 201 {"CTL0045", quirk_sb16audio_resources},
172 {"PNP0c01", quirk_supermicro_h8dce_system}, 202 {"PNP0c01", quirk_system_pci_resources},
173 {"PNP0c02", quirk_supermicro_h8dce_system}, 203 {"PNP0c02", quirk_system_pci_resources},
174 {""} 204 {""}
175}; 205};
176 206
diff --git a/drivers/spi/au1550_spi.c b/drivers/spi/au1550_spi.c
index c47a650183a1..41a3d00c4515 100644
--- a/drivers/spi/au1550_spi.c
+++ b/drivers/spi/au1550_spi.c
@@ -99,7 +99,7 @@ static dbdev_tab_t au1550_spi_mem_dbdev =
99static void au1550_spi_bits_handlers_set(struct au1550_spi *hw, int bpw); 99static void au1550_spi_bits_handlers_set(struct au1550_spi *hw, int bpw);
100 100
101 101
102/** 102/*
103 * compute BRG and DIV bits to setup spi clock based on main input clock rate 103 * compute BRG and DIV bits to setup spi clock based on main input clock rate
104 * that was specified in platform data structure 104 * that was specified in platform data structure
105 * according to au1550 datasheet: 105 * according to au1550 datasheet:
@@ -650,7 +650,7 @@ static int au1550_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
650 return hw->txrx_bufs(spi, t); 650 return hw->txrx_bufs(spi, t);
651} 651}
652 652
653static irqreturn_t au1550_spi_irq(int irq, void *dev, struct pt_regs *regs) 653static irqreturn_t au1550_spi_irq(int irq, void *dev)
654{ 654{
655 struct au1550_spi *hw = dev; 655 struct au1550_spi *hw = dev;
656 return hw->irq_callback(hw); 656 return hw->irq_callback(hw);
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c
index f7f8580edad8..71e881419cdd 100644
--- a/drivers/spi/spi_bitbang.c
+++ b/drivers/spi/spi_bitbang.c
@@ -344,12 +344,14 @@ static void bitbang_work(struct work_struct *work)
344 t->rx_dma = t->tx_dma = 0; 344 t->rx_dma = t->tx_dma = 0;
345 status = bitbang->txrx_bufs(spi, t); 345 status = bitbang->txrx_bufs(spi, t);
346 } 346 }
347 if (status > 0)
348 m->actual_length += status;
347 if (status != t->len) { 349 if (status != t->len) {
348 if (status > 0) 350 /* always report some kind of error */
349 status = -EMSGSIZE; 351 if (status >= 0)
352 status = -EREMOTEIO;
350 break; 353 break;
351 } 354 }
352 m->actual_length += status;
353 status = 0; 355 status = 0;
354 356
355 /* protocol tweaks before next transfer */ 357 /* protocol tweaks before next transfer */
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 69f19f224875..3ab313ed441c 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -4,6 +4,7 @@
4 4
5menuconfig THERMAL 5menuconfig THERMAL
6 bool "Generic Thermal sysfs driver" 6 bool "Generic Thermal sysfs driver"
7 select HWMON
7 default y 8 default y
8 help 9 help
9 Generic Thermal Sysfs driver offers a generic mechanism for 10 Generic Thermal Sysfs driver offers a generic mechanism for
diff --git a/drivers/thermal/thermal.c b/drivers/thermal/thermal.c
index 8b86e53ccf7a..41bd4c805ace 100644
--- a/drivers/thermal/thermal.c
+++ b/drivers/thermal/thermal.c
@@ -30,8 +30,10 @@
30#include <linux/idr.h> 30#include <linux/idr.h>
31#include <linux/thermal.h> 31#include <linux/thermal.h>
32#include <linux/spinlock.h> 32#include <linux/spinlock.h>
33#include <linux/hwmon.h>
34#include <linux/hwmon-sysfs.h>
33 35
34MODULE_AUTHOR("Zhang Rui") 36MODULE_AUTHOR("Zhang Rui");
35MODULE_DESCRIPTION("Generic thermal management sysfs support"); 37MODULE_DESCRIPTION("Generic thermal management sysfs support");
36MODULE_LICENSE("GPL"); 38MODULE_LICENSE("GPL");
37 39
@@ -56,6 +58,9 @@ static LIST_HEAD(thermal_tz_list);
56static LIST_HEAD(thermal_cdev_list); 58static LIST_HEAD(thermal_cdev_list);
57static DEFINE_MUTEX(thermal_list_lock); 59static DEFINE_MUTEX(thermal_list_lock);
58 60
61static struct device *thermal_hwmon;
62#define MAX_THERMAL_ZONES 10
63
59static int get_idr(struct idr *idr, struct mutex *lock, int *id) 64static int get_idr(struct idr *idr, struct mutex *lock, int *id)
60{ 65{
61 int err; 66 int err;
@@ -87,7 +92,67 @@ static void release_idr(struct idr *idr, struct mutex *lock, int id)
87 mutex_unlock(lock); 92 mutex_unlock(lock);
88} 93}
89 94
90/* sys I/F for thermal zone */ 95/* hwmon sys I/F*/
96static ssize_t
97name_show(struct device *dev, struct device_attribute *attr, char *buf)
98{
99 return sprintf(buf, "thermal_sys_class\n");
100}
101
102static ssize_t
103temp_input_show(struct device *dev, struct device_attribute *attr, char *buf)
104{
105 struct thermal_zone_device *tz;
106 struct sensor_device_attribute *sensor_attr
107 = to_sensor_dev_attr(attr);
108
109 list_for_each_entry(tz, &thermal_tz_list, node)
110 if (tz->id == sensor_attr->index)
111 return tz->ops->get_temp(tz, buf);
112
113 return -ENODEV;
114}
115
116static ssize_t
117temp_crit_show(struct device *dev, struct device_attribute *attr,
118 char *buf)
119{
120 struct thermal_zone_device *tz;
121 struct sensor_device_attribute *sensor_attr
122 = to_sensor_dev_attr(attr);
123
124 list_for_each_entry(tz, &thermal_tz_list, node)
125 if (tz->id == sensor_attr->index)
126 return tz->ops->get_trip_temp(tz, 0, buf);
127
128 return -ENODEV;
129}
130
131static DEVICE_ATTR(name, 0444, name_show, NULL);
132static struct sensor_device_attribute sensor_attrs[] = {
133 SENSOR_ATTR(temp1_input, 0444, temp_input_show, NULL, 0),
134 SENSOR_ATTR(temp1_crit, 0444, temp_crit_show, NULL, 0),
135 SENSOR_ATTR(temp2_input, 0444, temp_input_show, NULL, 1),
136 SENSOR_ATTR(temp2_crit, 0444, temp_crit_show, NULL, 1),
137 SENSOR_ATTR(temp3_input, 0444, temp_input_show, NULL, 2),
138 SENSOR_ATTR(temp3_crit, 0444, temp_crit_show, NULL, 2),
139 SENSOR_ATTR(temp4_input, 0444, temp_input_show, NULL, 3),
140 SENSOR_ATTR(temp4_crit, 0444, temp_crit_show, NULL, 3),
141 SENSOR_ATTR(temp5_input, 0444, temp_input_show, NULL, 4),
142 SENSOR_ATTR(temp5_crit, 0444, temp_crit_show, NULL, 4),
143 SENSOR_ATTR(temp6_input, 0444, temp_input_show, NULL, 5),
144 SENSOR_ATTR(temp6_crit, 0444, temp_crit_show, NULL, 5),
145 SENSOR_ATTR(temp7_input, 0444, temp_input_show, NULL, 6),
146 SENSOR_ATTR(temp7_crit, 0444, temp_crit_show, NULL, 6),
147 SENSOR_ATTR(temp8_input, 0444, temp_input_show, NULL, 7),
148 SENSOR_ATTR(temp8_crit, 0444, temp_crit_show, NULL, 7),
149 SENSOR_ATTR(temp9_input, 0444, temp_input_show, NULL, 8),
150 SENSOR_ATTR(temp9_crit, 0444, temp_crit_show, NULL, 8),
151 SENSOR_ATTR(temp10_input, 0444, temp_input_show, NULL, 9),
152 SENSOR_ATTR(temp10_crit, 0444, temp_crit_show, NULL, 9),
153};
154
155/* thermal zone sys I/F */
91 156
92#define to_thermal_zone(_dev) \ 157#define to_thermal_zone(_dev) \
93 container_of(_dev, struct thermal_zone_device, device) 158 container_of(_dev, struct thermal_zone_device, device)
@@ -214,7 +279,7 @@ do { \
214 device_remove_file(_dev, &trip_point_attrs[_index * 2 + 1]); \ 279 device_remove_file(_dev, &trip_point_attrs[_index * 2 + 1]); \
215} while (0) 280} while (0)
216 281
217/* sys I/F for cooling device */ 282/* cooling device sys I/F */
218#define to_cooling_device(_dev) \ 283#define to_cooling_device(_dev) \
219 container_of(_dev, struct thermal_cooling_device, device) 284 container_of(_dev, struct thermal_cooling_device, device)
220 285
@@ -447,6 +512,9 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type,
447 struct thermal_zone_device *pos; 512 struct thermal_zone_device *pos;
448 int result; 513 int result;
449 514
515 if (!type)
516 return ERR_PTR(-EINVAL);
517
450 if (strlen(type) >= THERMAL_NAME_LENGTH) 518 if (strlen(type) >= THERMAL_NAME_LENGTH)
451 return ERR_PTR(-EINVAL); 519 return ERR_PTR(-EINVAL);
452 520
@@ -477,11 +545,9 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type,
477 } 545 }
478 546
479 /* sys I/F */ 547 /* sys I/F */
480 if (type) { 548 result = device_create_file(&cdev->device, &dev_attr_cdev_type);
481 result = device_create_file(&cdev->device, &dev_attr_cdev_type); 549 if (result)
482 if (result) 550 goto unregister;
483 goto unregister;
484 }
485 551
486 result = device_create_file(&cdev->device, &dev_attr_max_state); 552 result = device_create_file(&cdev->device, &dev_attr_max_state);
487 if (result) 553 if (result)
@@ -547,8 +613,8 @@ void thermal_cooling_device_unregister(struct
547 tz->ops->unbind(tz, cdev); 613 tz->ops->unbind(tz, cdev);
548 } 614 }
549 mutex_unlock(&thermal_list_lock); 615 mutex_unlock(&thermal_list_lock);
550 if (cdev->type[0]) 616
551 device_remove_file(&cdev->device, &dev_attr_cdev_type); 617 device_remove_file(&cdev->device, &dev_attr_cdev_type);
552 device_remove_file(&cdev->device, &dev_attr_max_state); 618 device_remove_file(&cdev->device, &dev_attr_max_state);
553 device_remove_file(&cdev->device, &dev_attr_cur_state); 619 device_remove_file(&cdev->device, &dev_attr_cur_state);
554 620
@@ -580,6 +646,9 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
580 int result; 646 int result;
581 int count; 647 int count;
582 648
649 if (!type)
650 return ERR_PTR(-EINVAL);
651
583 if (strlen(type) >= THERMAL_NAME_LENGTH) 652 if (strlen(type) >= THERMAL_NAME_LENGTH)
584 return ERR_PTR(-EINVAL); 653 return ERR_PTR(-EINVAL);
585 654
@@ -601,6 +670,13 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
601 kfree(tz); 670 kfree(tz);
602 return ERR_PTR(result); 671 return ERR_PTR(result);
603 } 672 }
673 if (tz->id >= MAX_THERMAL_ZONES) {
674 printk(KERN_ERR PREFIX
675 "Too many thermal zones\n");
676 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id);
677 kfree(tz);
678 return ERR_PTR(-EINVAL);
679 }
604 680
605 strcpy(tz->type, type); 681 strcpy(tz->type, type);
606 tz->ops = ops; 682 tz->ops = ops;
@@ -615,13 +691,28 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
615 return ERR_PTR(result); 691 return ERR_PTR(result);
616 } 692 }
617 693
618 /* sys I/F */ 694 /* hwmon sys I/F */
619 if (type) { 695 result = device_create_file(thermal_hwmon,
620 result = device_create_file(&tz->device, &dev_attr_type); 696 &sensor_attrs[tz->id * 2].dev_attr);
621 if (result) 697 if (result)
622 goto unregister; 698 goto unregister;
699
700 if (trips > 0) {
701 char buf[40];
702 result = tz->ops->get_trip_type(tz, 0, buf);
703 if (result > 0 && !strcmp(buf, "critical\n")) {
704 result = device_create_file(thermal_hwmon,
705 &sensor_attrs[tz->id * 2 + 1].dev_attr);
706 if (result)
707 goto unregister;
708 }
623 } 709 }
624 710
711 /* sys I/F */
712 result = device_create_file(&tz->device, &dev_attr_type);
713 if (result)
714 goto unregister;
715
625 result = device_create_file(&tz->device, &dev_attr_temp); 716 result = device_create_file(&tz->device, &dev_attr_temp);
626 if (result) 717 if (result)
627 goto unregister; 718 goto unregister;
@@ -687,8 +778,17 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
687 tz->ops->unbind(tz, cdev); 778 tz->ops->unbind(tz, cdev);
688 mutex_unlock(&thermal_list_lock); 779 mutex_unlock(&thermal_list_lock);
689 780
690 if (tz->type[0]) 781 device_remove_file(thermal_hwmon,
691 device_remove_file(&tz->device, &dev_attr_type); 782 &sensor_attrs[tz->id * 2].dev_attr);
783 if (tz->trips > 0) {
784 char buf[40];
785 if (tz->ops->get_trip_type(tz, 0, buf) > 0)
786 if (!strcmp(buf, "critical\n"))
787 device_remove_file(thermal_hwmon,
788 &sensor_attrs[tz->id * 2 + 1].dev_attr);
789 }
790
791 device_remove_file(&tz->device, &dev_attr_type);
692 device_remove_file(&tz->device, &dev_attr_temp); 792 device_remove_file(&tz->device, &dev_attr_temp);
693 if (tz->ops->get_mode) 793 if (tz->ops->get_mode)
694 device_remove_file(&tz->device, &dev_attr_mode); 794 device_remove_file(&tz->device, &dev_attr_mode);
@@ -705,6 +805,19 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
705 805
706EXPORT_SYMBOL(thermal_zone_device_unregister); 806EXPORT_SYMBOL(thermal_zone_device_unregister);
707 807
808static void thermal_exit(void)
809{
810 if (thermal_hwmon) {
811 device_remove_file(thermal_hwmon, &dev_attr_name);
812 hwmon_device_unregister(thermal_hwmon);
813 }
814 class_unregister(&thermal_class);
815 idr_destroy(&thermal_tz_idr);
816 idr_destroy(&thermal_cdev_idr);
817 mutex_destroy(&thermal_idr_lock);
818 mutex_destroy(&thermal_list_lock);
819}
820
708static int __init thermal_init(void) 821static int __init thermal_init(void)
709{ 822{
710 int result = 0; 823 int result = 0;
@@ -716,16 +829,20 @@ static int __init thermal_init(void)
716 mutex_destroy(&thermal_idr_lock); 829 mutex_destroy(&thermal_idr_lock);
717 mutex_destroy(&thermal_list_lock); 830 mutex_destroy(&thermal_list_lock);
718 } 831 }
719 return result;
720}
721 832
722static void __exit thermal_exit(void) 833 thermal_hwmon = hwmon_device_register(NULL);
723{ 834 if (IS_ERR(thermal_hwmon)) {
724 class_unregister(&thermal_class); 835 result = PTR_ERR(thermal_hwmon);
725 idr_destroy(&thermal_tz_idr); 836 thermal_hwmon = NULL;
726 idr_destroy(&thermal_cdev_idr); 837 printk(KERN_ERR PREFIX
727 mutex_destroy(&thermal_idr_lock); 838 "unable to register hwmon device\n");
728 mutex_destroy(&thermal_list_lock); 839 thermal_exit();
840 return result;
841 }
842
843 result = device_create_file(thermal_hwmon, &dev_attr_name);
844
845 return result;
729} 846}
730 847
731subsys_initcall(thermal_init); 848subsys_initcall(thermal_init);