aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/Kconfig9
-rw-r--r--drivers/acpi/ac.c16
-rw-r--r--drivers/acpi/battery.c31
-rw-r--r--drivers/acpi/bus.c7
-rw-r--r--drivers/acpi/ec.c14
-rw-r--r--drivers/acpi/events/evregion.c8
-rw-r--r--drivers/acpi/pci_irq.c9
-rw-r--r--drivers/acpi/processor_idle.c4
-rw-r--r--drivers/acpi/sbs.c23
-rw-r--r--drivers/acpi/scan.c6
-rw-r--r--drivers/ata/ata_piix.c51
-rw-r--r--drivers/ata/libata-core.c4
-rw-r--r--drivers/ata/libata-eh.c24
-rw-r--r--drivers/ata/libata-pmp.c12
-rw-r--r--drivers/ata/libata-scsi.c5
-rw-r--r--drivers/ata/libata-sff.c7
-rw-r--r--drivers/ata/pata_bf54x.c3
-rw-r--r--drivers/ata/pata_ixp4xx_cf.c3
-rw-r--r--drivers/ata/pata_legacy.c8
-rw-r--r--drivers/ata/pata_pdc202xx_old.c15
-rw-r--r--drivers/ata/pata_qdi.c8
-rw-r--r--drivers/ata/pata_winbond.c8
-rw-r--r--drivers/ata/sata_qstor.c2
-rw-r--r--drivers/ata/sata_sil24.c42
-rw-r--r--drivers/atm/nicstar.c19
-rw-r--r--drivers/block/cciss.c2
-rw-r--r--drivers/block/loop.c2
-rw-r--r--drivers/bluetooth/hci_ll.c23
-rw-r--r--drivers/char/tpm/tpm.c12
-rw-r--r--drivers/connector/cn_queue.c2
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c4
-rw-r--r--drivers/cpufreq/cpufreq_ondemand.c5
-rw-r--r--drivers/cpufreq/cpufreq_userspace.c4
-rw-r--r--drivers/crypto/padlock-aes.c4
-rw-r--r--drivers/i2c/busses/i2c-at91.c2
-rw-r--r--drivers/i2c/busses/i2c-omap.c2
-rw-r--r--drivers/i2c/busses/i2c-powermac.c2
-rw-r--r--drivers/i2c/busses/i2c-sibyte.c7
-rw-r--r--drivers/i2c/i2c-dev.c2
-rw-r--r--drivers/ide/ide-acpi.c38
-rw-r--r--drivers/ide/ide-iops.c6
-rw-r--r--drivers/ide/pci/trm290.c29
-rw-r--r--drivers/input/gameport/gameport.c2
-rw-r--r--drivers/input/input.c8
-rw-r--r--drivers/input/keyboard/Kconfig12
-rw-r--r--drivers/input/keyboard/jornada680_kbd.c40
-rw-r--r--drivers/input/keyboard/spitzkbd.c1
-rw-r--r--drivers/input/mouse/alps.c2
-rw-r--r--drivers/input/mouse/lifebook.c7
-rw-r--r--drivers/input/mouse/psmouse-base.c2
-rw-r--r--drivers/input/mousedev.c9
-rw-r--r--drivers/input/touchscreen/Kconfig8
-rw-r--r--drivers/input/touchscreen/usbtouchscreen.c55
-rw-r--r--drivers/lguest/Kconfig4
-rw-r--r--drivers/macintosh/adbhid.c3
-rw-r--r--drivers/media/dvb/ttpci/av7110.c10
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.c4
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c3
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c7
-rw-r--r--drivers/net/3c509.c4
-rw-r--r--drivers/net/3c515.c60
-rw-r--r--drivers/net/Kconfig23
-rw-r--r--drivers/net/atl1/atl1_main.c8
-rw-r--r--drivers/net/bonding/bond_alb.c23
-rw-r--r--drivers/net/bonding/bond_main.c64
-rw-r--r--drivers/net/bonding/bond_sysfs.c66
-rw-r--r--drivers/net/bonding/bonding.h4
-rw-r--r--drivers/net/cpmac.c2
-rw-r--r--drivers/net/dl2k.c215
-rw-r--r--drivers/net/dl2k.h157
-rw-r--r--drivers/net/e100.c7
-rw-r--r--drivers/net/e1000/e1000_main.c15
-rw-r--r--drivers/net/e1000e/netdev.c13
-rw-r--r--drivers/net/epic100.c2
-rw-r--r--drivers/net/fec_8xx/fec_main.c5
-rw-r--r--drivers/net/forcedeth.c6
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c14
-rw-r--r--drivers/net/ipg.c36
-rw-r--r--drivers/net/ixgb/ixgb_main.c7
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c13
-rw-r--r--drivers/net/ixp2000/ixpdev.c2
-rw-r--r--drivers/net/loopback.c2
-rw-r--r--drivers/net/macvlan.c7
-rw-r--r--drivers/net/meth.c10
-rw-r--r--drivers/net/myri10ge/myri10ge.c2
-rw-r--r--drivers/net/natsemi.c2
-rw-r--r--drivers/net/netx-eth.c4
-rw-r--r--drivers/net/netxen/netxen_nic.h69
-rw-r--r--drivers/net/netxen/netxen_nic_init.c20
-rw-r--r--drivers/net/netxen/netxen_nic_main.c72
-rw-r--r--drivers/net/netxen/netxen_nic_niu.c8
-rw-r--r--drivers/net/niu.c264
-rw-r--r--drivers/net/niu.h33
-rw-r--r--drivers/net/pcmcia/3c574_cs.c31
-rw-r--r--drivers/net/pcnet32.c5
-rw-r--r--drivers/net/qla3xxx.c7
-rw-r--r--drivers/net/r8169.c4
-rw-r--r--drivers/net/s2io.c20
-rw-r--r--drivers/net/sky2.c27
-rw-r--r--drivers/net/sky2.h4
-rw-r--r--drivers/net/tulip/de4x5.c127
-rw-r--r--drivers/net/tulip/interrupt.c8
-rw-r--r--drivers/net/tulip/tulip_core.c3
-rw-r--r--drivers/net/tulip/xircom_cb.c54
-rw-r--r--drivers/net/usb/asix.c6
-rw-r--r--drivers/net/usb/kaweth.c2
-rw-r--r--drivers/net/usb/mcs7830.c4
-rw-r--r--drivers/net/wan/dscc4.c94
-rw-r--r--drivers/net/wan/lmc/lmc_media.c12
-rw-r--r--drivers/net/wan/sbni.h12
-rw-r--r--drivers/net/wireless/b43/b43.h2
-rw-r--r--drivers/net/wireless/b43/main.h20
-rw-r--r--drivers/net/wireless/b43/rfkill.c11
-rw-r--r--drivers/net/wireless/b43/xmit.c27
-rw-r--r--drivers/net/wireless/b43/xmit.h65
-rw-r--r--drivers/net/wireless/hostap/hostap_plx.c6
-rw-r--r--drivers/net/wireless/ipw2200.c2
-rw-r--r--drivers/net/wireless/libertas/if_sdio.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c20
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c28
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c12
-rw-r--r--drivers/net/xen-netfront.c5
-rw-r--r--drivers/pci/quirks.c6
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c16
-rw-r--r--drivers/scsi/advansys.c2
-rw-r--r--drivers/scsi/qla1280.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c4
-rw-r--r--drivers/ssb/scan.c11
-rw-r--r--drivers/video/atmel_lcdfb.c2
-rw-r--r--drivers/video/modedb.c4
-rw-r--r--drivers/video/ps3fb.c24
-rw-r--r--drivers/video/s3c2410fb.c2
-rw-r--r--drivers/video/uvesafb.c4
-rw-r--r--drivers/w1/w1.c6
-rw-r--r--drivers/watchdog/w83697hf_wdt.c4
136 files changed, 1496 insertions, 1115 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index b9f923ef173d..ccf6ea95f68c 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -82,6 +82,12 @@ config ACPI_PROCFS_POWER
82 and functions, which do not yet exist in /sys 82 and functions, which do not yet exist in /sys
83 83
84 Say N to delete power /proc/acpi/ folders that have moved to /sys/ 84 Say N to delete power /proc/acpi/ folders that have moved to /sys/
85config ACPI_SYSFS_POWER
86 bool "Future power /sys interface"
87 select POWER_SUPPLY
88 default y
89 ---help---
90 Say N to disable power /sys interface
85config ACPI_PROC_EVENT 91config ACPI_PROC_EVENT
86 bool "Deprecated /proc/acpi/event support" 92 bool "Deprecated /proc/acpi/event support"
87 depends on PROC_FS 93 depends on PROC_FS
@@ -103,7 +109,6 @@ config ACPI_PROC_EVENT
103config ACPI_AC 109config ACPI_AC
104 tristate "AC Adapter" 110 tristate "AC Adapter"
105 depends on X86 111 depends on X86
106 select POWER_SUPPLY
107 default y 112 default y
108 help 113 help
109 This driver adds support for the AC Adapter object, which indicates 114 This driver adds support for the AC Adapter object, which indicates
@@ -113,7 +118,6 @@ config ACPI_AC
113config ACPI_BATTERY 118config ACPI_BATTERY
114 tristate "Battery" 119 tristate "Battery"
115 depends on X86 120 depends on X86
116 select POWER_SUPPLY
117 default y 121 default y
118 help 122 help
119 This driver adds support for battery information through 123 This driver adds support for battery information through
@@ -368,7 +372,6 @@ config ACPI_HOTPLUG_MEMORY
368config ACPI_SBS 372config ACPI_SBS
369 tristate "Smart Battery System" 373 tristate "Smart Battery System"
370 depends on X86 374 depends on X86
371 select POWER_SUPPLY
372 help 375 help
373 This driver adds support for the Smart Battery System, another 376 This driver adds support for the Smart Battery System, another
374 type of access to battery information, found on some laptops. 377 type of access to battery information, found on some laptops.
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 76ed4f52bebd..76b9bea98b6d 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -31,7 +31,9 @@
31#include <linux/proc_fs.h> 31#include <linux/proc_fs.h>
32#include <linux/seq_file.h> 32#include <linux/seq_file.h>
33#endif 33#endif
34#ifdef CONFIG_ACPI_SYSFS_POWER
34#include <linux/power_supply.h> 35#include <linux/power_supply.h>
36#endif
35#include <acpi/acpi_bus.h> 37#include <acpi/acpi_bus.h>
36#include <acpi/acpi_drivers.h> 38#include <acpi/acpi_drivers.h>
37 39
@@ -79,7 +81,9 @@ static struct acpi_driver acpi_ac_driver = {
79}; 81};
80 82
81struct acpi_ac { 83struct acpi_ac {
84#ifdef CONFIG_ACPI_SYSFS_POWER
82 struct power_supply charger; 85 struct power_supply charger;
86#endif
83 struct acpi_device * device; 87 struct acpi_device * device;
84 unsigned long state; 88 unsigned long state;
85}; 89};
@@ -94,7 +98,7 @@ static const struct file_operations acpi_ac_fops = {
94 .release = single_release, 98 .release = single_release,
95}; 99};
96#endif 100#endif
97 101#ifdef CONFIG_ACPI_SYSFS_POWER
98static int get_ac_property(struct power_supply *psy, 102static int get_ac_property(struct power_supply *psy,
99 enum power_supply_property psp, 103 enum power_supply_property psp,
100 union power_supply_propval *val) 104 union power_supply_propval *val)
@@ -113,7 +117,7 @@ static int get_ac_property(struct power_supply *psy,
113static enum power_supply_property ac_props[] = { 117static enum power_supply_property ac_props[] = {
114 POWER_SUPPLY_PROP_ONLINE, 118 POWER_SUPPLY_PROP_ONLINE,
115}; 119};
116 120#endif
117/* -------------------------------------------------------------------------- 121/* --------------------------------------------------------------------------
118 AC Adapter Management 122 AC Adapter Management
119 -------------------------------------------------------------------------- */ 123 -------------------------------------------------------------------------- */
@@ -241,7 +245,9 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
241 acpi_bus_generate_netlink_event(device->pnp.device_class, 245 acpi_bus_generate_netlink_event(device->pnp.device_class,
242 device->dev.bus_id, event, 246 device->dev.bus_id, event,
243 (u32) ac->state); 247 (u32) ac->state);
248#ifdef CONFIG_ACPI_SYSFS_POWER
244 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); 249 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
250#endif
245 break; 251 break;
246 default: 252 default:
247 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 253 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -280,12 +286,14 @@ static int acpi_ac_add(struct acpi_device *device)
280#endif 286#endif
281 if (result) 287 if (result)
282 goto end; 288 goto end;
289#ifdef CONFIG_ACPI_SYSFS_POWER
283 ac->charger.name = acpi_device_bid(device); 290 ac->charger.name = acpi_device_bid(device);
284 ac->charger.type = POWER_SUPPLY_TYPE_MAINS; 291 ac->charger.type = POWER_SUPPLY_TYPE_MAINS;
285 ac->charger.properties = ac_props; 292 ac->charger.properties = ac_props;
286 ac->charger.num_properties = ARRAY_SIZE(ac_props); 293 ac->charger.num_properties = ARRAY_SIZE(ac_props);
287 ac->charger.get_property = get_ac_property; 294 ac->charger.get_property = get_ac_property;
288 power_supply_register(&ac->device->dev, &ac->charger); 295 power_supply_register(&ac->device->dev, &ac->charger);
296#endif
289 status = acpi_install_notify_handler(device->handle, 297 status = acpi_install_notify_handler(device->handle,
290 ACPI_ALL_NOTIFY, acpi_ac_notify, 298 ACPI_ALL_NOTIFY, acpi_ac_notify,
291 ac); 299 ac);
@@ -319,8 +327,10 @@ static int acpi_ac_resume(struct acpi_device *device)
319 old_state = ac->state; 327 old_state = ac->state;
320 if (acpi_ac_get_state(ac)) 328 if (acpi_ac_get_state(ac))
321 return 0; 329 return 0;
330#ifdef CONFIG_ACPI_SYSFS_POWER
322 if (old_state != ac->state) 331 if (old_state != ac->state)
323 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); 332 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
333#endif
324 return 0; 334 return 0;
325} 335}
326 336
@@ -337,8 +347,10 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
337 347
338 status = acpi_remove_notify_handler(device->handle, 348 status = acpi_remove_notify_handler(device->handle,
339 ACPI_ALL_NOTIFY, acpi_ac_notify); 349 ACPI_ALL_NOTIFY, acpi_ac_notify);
350#ifdef CONFIG_ACPI_SYSFS_POWER
340 if (ac->charger.dev) 351 if (ac->charger.dev)
341 power_supply_unregister(&ac->charger); 352 power_supply_unregister(&ac->charger);
353#endif
342#ifdef CONFIG_ACPI_PROCFS_POWER 354#ifdef CONFIG_ACPI_PROCFS_POWER
343 acpi_ac_remove_fs(device); 355 acpi_ac_remove_fs(device);
344#endif 356#endif
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 8f7505d304b5..c4a769d1ba85 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -40,7 +40,9 @@
40#include <acpi/acpi_bus.h> 40#include <acpi/acpi_bus.h>
41#include <acpi/acpi_drivers.h> 41#include <acpi/acpi_drivers.h>
42 42
43#ifdef CONFIG_ACPI_SYSFS_POWER
43#include <linux/power_supply.h> 44#include <linux/power_supply.h>
45#endif
44 46
45#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF 47#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF
46 48
@@ -86,7 +88,9 @@ MODULE_DEVICE_TABLE(acpi, battery_device_ids);
86 88
87struct acpi_battery { 89struct acpi_battery {
88 struct mutex lock; 90 struct mutex lock;
91#ifdef CONFIG_ACPI_SYSFS_POWER
89 struct power_supply bat; 92 struct power_supply bat;
93#endif
90 struct acpi_device *device; 94 struct acpi_device *device;
91 unsigned long update_time; 95 unsigned long update_time;
92 int current_now; 96 int current_now;
@@ -117,6 +121,7 @@ inline int acpi_battery_present(struct acpi_battery *battery)
117 return battery->device->status.battery_present; 121 return battery->device->status.battery_present;
118} 122}
119 123
124#ifdef CONFIG_ACPI_SYSFS_POWER
120static int acpi_battery_technology(struct acpi_battery *battery) 125static int acpi_battery_technology(struct acpi_battery *battery)
121{ 126{
122 if (!strcasecmp("NiCd", battery->type)) 127 if (!strcasecmp("NiCd", battery->type))
@@ -222,6 +227,7 @@ static enum power_supply_property energy_battery_props[] = {
222 POWER_SUPPLY_PROP_MODEL_NAME, 227 POWER_SUPPLY_PROP_MODEL_NAME,
223 POWER_SUPPLY_PROP_MANUFACTURER, 228 POWER_SUPPLY_PROP_MANUFACTURER,
224}; 229};
230#endif
225 231
226#ifdef CONFIG_ACPI_PROCFS_POWER 232#ifdef CONFIG_ACPI_PROCFS_POWER
227inline char *acpi_battery_units(struct acpi_battery *battery) 233inline char *acpi_battery_units(struct acpi_battery *battery)
@@ -398,6 +404,7 @@ static int acpi_battery_init_alarm(struct acpi_battery *battery)
398 return acpi_battery_set_alarm(battery); 404 return acpi_battery_set_alarm(battery);
399} 405}
400 406
407#ifdef CONFIG_ACPI_SYSFS_POWER
401static ssize_t acpi_battery_alarm_show(struct device *dev, 408static ssize_t acpi_battery_alarm_show(struct device *dev,
402 struct device_attribute *attr, 409 struct device_attribute *attr,
403 char *buf) 410 char *buf)
@@ -429,11 +436,6 @@ static int sysfs_add_battery(struct acpi_battery *battery)
429{ 436{
430 int result; 437 int result;
431 438
432 battery->update_time = 0;
433 result = acpi_battery_get_info(battery);
434 acpi_battery_init_alarm(battery);
435 if (result)
436 return result;
437 if (battery->power_unit) { 439 if (battery->power_unit) {
438 battery->bat.properties = charge_battery_props; 440 battery->bat.properties = charge_battery_props;
439 battery->bat.num_properties = 441 battery->bat.num_properties =
@@ -462,18 +464,31 @@ static void sysfs_remove_battery(struct acpi_battery *battery)
462 power_supply_unregister(&battery->bat); 464 power_supply_unregister(&battery->bat);
463 battery->bat.dev = NULL; 465 battery->bat.dev = NULL;
464} 466}
467#endif
465 468
466static int acpi_battery_update(struct acpi_battery *battery) 469static int acpi_battery_update(struct acpi_battery *battery)
467{ 470{
468 int result = acpi_battery_get_status(battery); 471 int result;
472 result = acpi_battery_get_status(battery);
469 if (result) 473 if (result)
470 return result; 474 return result;
475#ifdef CONFIG_ACPI_SYSFS_POWER
471 if (!acpi_battery_present(battery)) { 476 if (!acpi_battery_present(battery)) {
472 sysfs_remove_battery(battery); 477 sysfs_remove_battery(battery);
478 battery->update_time = 0;
473 return 0; 479 return 0;
474 } 480 }
481#endif
482 if (!battery->update_time) {
483 result = acpi_battery_get_info(battery);
484 if (result)
485 return result;
486 acpi_battery_init_alarm(battery);
487 }
488#ifdef CONFIG_ACPI_SYSFS_POWER
475 if (!battery->bat.dev) 489 if (!battery->bat.dev)
476 sysfs_add_battery(battery); 490 sysfs_add_battery(battery);
491#endif
477 return acpi_battery_get_state(battery); 492 return acpi_battery_get_state(battery);
478} 493}
479 494
@@ -767,9 +782,11 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
767 acpi_bus_generate_netlink_event(device->pnp.device_class, 782 acpi_bus_generate_netlink_event(device->pnp.device_class,
768 device->dev.bus_id, event, 783 device->dev.bus_id, event,
769 acpi_battery_present(battery)); 784 acpi_battery_present(battery));
785#ifdef CONFIG_ACPI_SYSFS_POWER
770 /* acpi_batter_update could remove power_supply object */ 786 /* acpi_batter_update could remove power_supply object */
771 if (battery->bat.dev) 787 if (battery->bat.dev)
772 kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE); 788 kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE);
789#endif
773} 790}
774 791
775static int acpi_battery_add(struct acpi_device *device) 792static int acpi_battery_add(struct acpi_device *device)
@@ -828,7 +845,9 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
828#ifdef CONFIG_ACPI_PROCFS_POWER 845#ifdef CONFIG_ACPI_PROCFS_POWER
829 acpi_battery_remove_fs(device); 846 acpi_battery_remove_fs(device);
830#endif 847#endif
848#ifdef CONFIG_ACPI_SYSFS_POWER
831 sysfs_remove_battery(battery); 849 sysfs_remove_battery(battery);
850#endif
832 mutex_destroy(&battery->lock); 851 mutex_destroy(&battery->lock);
833 kfree(battery); 852 kfree(battery);
834 return 0; 853 return 0;
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 49d432d0a12c..d7a115c362d1 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -29,7 +29,6 @@
29#include <linux/list.h> 29#include <linux/list.h>
30#include <linux/sched.h> 30#include <linux/sched.h>
31#include <linux/pm.h> 31#include <linux/pm.h>
32#include <linux/pm_legacy.h>
33#include <linux/device.h> 32#include <linux/device.h>
34#include <linux/proc_fs.h> 33#include <linux/proc_fs.h>
35#ifdef CONFIG_X86 34#ifdef CONFIG_X86
@@ -764,16 +763,14 @@ static int __init acpi_init(void)
764 result = acpi_bus_init(); 763 result = acpi_bus_init();
765 764
766 if (!result) { 765 if (!result) {
767#ifdef CONFIG_PM_LEGACY 766 if (!(pm_flags & PM_APM))
768 if (!PM_IS_ACTIVE()) 767 pm_flags |= PM_ACPI;
769 pm_active = 1;
770 else { 768 else {
771 printk(KERN_INFO PREFIX 769 printk(KERN_INFO PREFIX
772 "APM is already active, exiting\n"); 770 "APM is already active, exiting\n");
773 disable_acpi(); 771 disable_acpi();
774 result = -ENODEV; 772 result = -ENODEV;
775 } 773 }
776#endif
777 } else 774 } else
778 disable_acpi(); 775 disable_acpi();
779 776
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index d411017f8c06..97dc16155a55 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -892,6 +892,17 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
892 return 0; 892 return 0;
893} 893}
894 894
895int __init acpi_boot_ec_enable(void)
896{
897 if (!boot_ec || boot_ec->handlers_installed)
898 return 0;
899 if (!ec_install_handlers(boot_ec)) {
900 first_ec = boot_ec;
901 return 0;
902 }
903 return -EFAULT;
904}
905
895int __init acpi_ec_ecdt_probe(void) 906int __init acpi_ec_ecdt_probe(void)
896{ 907{
897 int ret; 908 int ret;
@@ -924,9 +935,10 @@ int __init acpi_ec_ecdt_probe(void)
924 goto error; 935 goto error;
925 /* We really need to limit this workaround, the only ASUS, 936 /* We really need to limit this workaround, the only ASUS,
926 * which needs it, has fake EC._INI method, so use it as flag. 937 * which needs it, has fake EC._INI method, so use it as flag.
938 * Keep boot_ec struct as it will be needed soon.
927 */ 939 */
928 if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x))) 940 if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x)))
929 goto error; 941 return -ENODEV;
930 } 942 }
931 943
932 ret = ec_install_handlers(boot_ec); 944 ret = ec_install_handlers(boot_ec);
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c
index e99f0c435a47..58ad09725dd2 100644
--- a/drivers/acpi/events/evregion.c
+++ b/drivers/acpi/events/evregion.c
@@ -344,7 +344,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
344 * setup will potentially execute control methods 344 * setup will potentially execute control methods
345 * (e.g., _REG method for this region) 345 * (e.g., _REG method for this region)
346 */ 346 */
347 acpi_ex_relinquish_interpreter(); 347 acpi_ex_exit_interpreter();
348 348
349 status = region_setup(region_obj, ACPI_REGION_ACTIVATE, 349 status = region_setup(region_obj, ACPI_REGION_ACTIVATE,
350 handler_desc->address_space.context, 350 handler_desc->address_space.context,
@@ -352,7 +352,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
352 352
353 /* Re-enter the interpreter */ 353 /* Re-enter the interpreter */
354 354
355 acpi_ex_reacquire_interpreter(); 355 acpi_ex_enter_interpreter();
356 356
357 /* Check for failure of the Region Setup */ 357 /* Check for failure of the Region Setup */
358 358
@@ -405,7 +405,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
405 * exit the interpreter because the handler *might* block -- we don't 405 * exit the interpreter because the handler *might* block -- we don't
406 * know what it will do, so we can't hold the lock on the intepreter. 406 * know what it will do, so we can't hold the lock on the intepreter.
407 */ 407 */
408 acpi_ex_relinquish_interpreter(); 408 acpi_ex_exit_interpreter();
409 } 409 }
410 410
411 /* Call the handler */ 411 /* Call the handler */
@@ -426,7 +426,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
426 * We just returned from a non-default handler, we must re-enter the 426 * We just returned from a non-default handler, we must re-enter the
427 * interpreter 427 * interpreter
428 */ 428 */
429 acpi_ex_reacquire_interpreter(); 429 acpi_ex_enter_interpreter();
430 } 430 }
431 431
432 return_ACPI_STATUS(status); 432 return_ACPI_STATUS(status);
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index dd3186abe07a..62010c2481b3 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -429,6 +429,15 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
429 &polarity, &link, 429 &polarity, &link,
430 acpi_pci_allocate_irq); 430 acpi_pci_allocate_irq);
431 431
432 if (irq < 0) {
433 /*
434 * IDE legacy mode controller IRQs are magic. Why do compat
435 * extensions always make such a nasty mess.
436 */
437 if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE &&
438 (dev->class & 0x05) == 0)
439 return 0;
440 }
432 /* 441 /*
433 * No IRQ known to the ACPI subsystem - maybe the BIOS / 442 * No IRQ known to the ACPI subsystem - maybe the BIOS /
434 * driver reported one, then use it. Exit in any case. 443 * driver reported one, then use it. Exit in any case.
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 2fe34cc73c13..2235f4e02d26 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -76,7 +76,11 @@ static void (*pm_idle_save) (void) __read_mostly;
76#define PM_TIMER_TICKS_TO_US(p) (((p) * 1000)/(PM_TIMER_FREQUENCY/1000)) 76#define PM_TIMER_TICKS_TO_US(p) (((p) * 1000)/(PM_TIMER_FREQUENCY/1000))
77 77
78static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER; 78static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER;
79#ifdef CONFIG_CPU_IDLE
79module_param(max_cstate, uint, 0000); 80module_param(max_cstate, uint, 0000);
81#else
82module_param(max_cstate, uint, 0644);
83#endif
80static unsigned int nocst __read_mostly; 84static unsigned int nocst __read_mostly;
81module_param(nocst, uint, 0000); 85module_param(nocst, uint, 0000);
82 86
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 22cb95b349e4..f136c7d3b3c2 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -40,7 +40,9 @@
40#include <linux/jiffies.h> 40#include <linux/jiffies.h>
41#include <linux/delay.h> 41#include <linux/delay.h>
42 42
43#ifdef CONFIG_ACPI_SYSFS_POWER
43#include <linux/power_supply.h> 44#include <linux/power_supply.h>
45#endif
44 46
45#include "sbshc.h" 47#include "sbshc.h"
46 48
@@ -80,7 +82,9 @@ static const struct acpi_device_id sbs_device_ids[] = {
80MODULE_DEVICE_TABLE(acpi, sbs_device_ids); 82MODULE_DEVICE_TABLE(acpi, sbs_device_ids);
81 83
82struct acpi_battery { 84struct acpi_battery {
85#ifdef CONFIG_ACPI_SYSFS_POWER
83 struct power_supply bat; 86 struct power_supply bat;
87#endif
84 struct acpi_sbs *sbs; 88 struct acpi_sbs *sbs;
85#ifdef CONFIG_ACPI_PROCFS_POWER 89#ifdef CONFIG_ACPI_PROCFS_POWER
86 struct proc_dir_entry *proc_entry; 90 struct proc_dir_entry *proc_entry;
@@ -113,7 +117,9 @@ struct acpi_battery {
113#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); 117#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
114 118
115struct acpi_sbs { 119struct acpi_sbs {
120#ifdef CONFIG_ACPI_SYSFS_POWER
116 struct power_supply charger; 121 struct power_supply charger;
122#endif
117 struct acpi_device *device; 123 struct acpi_device *device;
118 struct acpi_smb_hc *hc; 124 struct acpi_smb_hc *hc;
119 struct mutex lock; 125 struct mutex lock;
@@ -157,6 +163,7 @@ static inline int acpi_battery_scale(struct acpi_battery *battery)
157 acpi_battery_ipscale(battery); 163 acpi_battery_ipscale(battery);
158} 164}
159 165
166#ifdef CONFIG_ACPI_SYSFS_POWER
160static int sbs_get_ac_property(struct power_supply *psy, 167static int sbs_get_ac_property(struct power_supply *psy,
161 enum power_supply_property psp, 168 enum power_supply_property psp,
162 union power_supply_propval *val) 169 union power_supply_propval *val)
@@ -294,6 +301,7 @@ static enum power_supply_property sbs_energy_battery_props[] = {
294 POWER_SUPPLY_PROP_MODEL_NAME, 301 POWER_SUPPLY_PROP_MODEL_NAME,
295 POWER_SUPPLY_PROP_MANUFACTURER, 302 POWER_SUPPLY_PROP_MANUFACTURER,
296}; 303};
304#endif
297 305
298/* -------------------------------------------------------------------------- 306/* --------------------------------------------------------------------------
299 Smart Battery System Management 307 Smart Battery System Management
@@ -429,6 +437,7 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs)
429 return result; 437 return result;
430} 438}
431 439
440#ifdef CONFIG_ACPI_SYSFS_POWER
432static ssize_t acpi_battery_alarm_show(struct device *dev, 441static ssize_t acpi_battery_alarm_show(struct device *dev,
433 struct device_attribute *attr, 442 struct device_attribute *attr,
434 char *buf) 443 char *buf)
@@ -458,6 +467,7 @@ static struct device_attribute alarm_attr = {
458 .show = acpi_battery_alarm_show, 467 .show = acpi_battery_alarm_show,
459 .store = acpi_battery_alarm_store, 468 .store = acpi_battery_alarm_store,
460}; 469};
470#endif
461 471
462/* -------------------------------------------------------------------------- 472/* --------------------------------------------------------------------------
463 FS Interface (/proc/acpi) 473 FS Interface (/proc/acpi)
@@ -793,6 +803,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
793 &acpi_battery_state_fops, &acpi_battery_alarm_fops, 803 &acpi_battery_state_fops, &acpi_battery_alarm_fops,
794 battery); 804 battery);
795#endif 805#endif
806#ifdef CONFIG_ACPI_SYSFS_POWER
796 battery->bat.name = battery->name; 807 battery->bat.name = battery->name;
797 battery->bat.type = POWER_SUPPLY_TYPE_BATTERY; 808 battery->bat.type = POWER_SUPPLY_TYPE_BATTERY;
798 if (!acpi_battery_mode(battery)) { 809 if (!acpi_battery_mode(battery)) {
@@ -813,6 +824,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
813 goto end; 824 goto end;
814 battery->have_sysfs_alarm = 1; 825 battery->have_sysfs_alarm = 1;
815 end: 826 end:
827#endif
816 printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", 828 printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n",
817 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), 829 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
818 battery->name, sbs->battery->present ? "present" : "absent"); 830 battery->name, sbs->battery->present ? "present" : "absent");
@@ -822,12 +834,13 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
822static void acpi_battery_remove(struct acpi_sbs *sbs, int id) 834static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
823{ 835{
824 struct acpi_battery *battery = &sbs->battery[id]; 836 struct acpi_battery *battery = &sbs->battery[id];
825 837#ifdef CONFIG_ACPI_SYSFS_POWER
826 if (battery->bat.dev) { 838 if (battery->bat.dev) {
827 if (battery->have_sysfs_alarm) 839 if (battery->have_sysfs_alarm)
828 device_remove_file(battery->bat.dev, &alarm_attr); 840 device_remove_file(battery->bat.dev, &alarm_attr);
829 power_supply_unregister(&battery->bat); 841 power_supply_unregister(&battery->bat);
830 } 842 }
843#endif
831#ifdef CONFIG_ACPI_PROCFS_POWER 844#ifdef CONFIG_ACPI_PROCFS_POWER
832 if (battery->proc_entry) 845 if (battery->proc_entry)
833 acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir); 846 acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir);
@@ -848,12 +861,14 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
848 if (result) 861 if (result)
849 goto end; 862 goto end;
850#endif 863#endif
864#ifdef CONFIG_ACPI_SYSFS_POWER
851 sbs->charger.name = "sbs-charger"; 865 sbs->charger.name = "sbs-charger";
852 sbs->charger.type = POWER_SUPPLY_TYPE_MAINS; 866 sbs->charger.type = POWER_SUPPLY_TYPE_MAINS;
853 sbs->charger.properties = sbs_ac_props; 867 sbs->charger.properties = sbs_ac_props;
854 sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props); 868 sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props);
855 sbs->charger.get_property = sbs_get_ac_property; 869 sbs->charger.get_property = sbs_get_ac_property;
856 power_supply_register(&sbs->device->dev, &sbs->charger); 870 power_supply_register(&sbs->device->dev, &sbs->charger);
871#endif
857 printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n", 872 printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n",
858 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), 873 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
859 ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line"); 874 ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line");
@@ -863,8 +878,10 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
863 878
864static void acpi_charger_remove(struct acpi_sbs *sbs) 879static void acpi_charger_remove(struct acpi_sbs *sbs)
865{ 880{
881#ifdef CONFIG_ACPI_SYSFS_POWER
866 if (sbs->charger.dev) 882 if (sbs->charger.dev)
867 power_supply_unregister(&sbs->charger); 883 power_supply_unregister(&sbs->charger);
884#endif
868#ifdef CONFIG_ACPI_PROCFS_POWER 885#ifdef CONFIG_ACPI_PROCFS_POWER
869 if (sbs->charger_entry) 886 if (sbs->charger_entry)
870 acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); 887 acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir);
@@ -885,7 +902,9 @@ void acpi_sbs_callback(void *context)
885 ACPI_SBS_NOTIFY_STATUS, 902 ACPI_SBS_NOTIFY_STATUS,
886 sbs->charger_present); 903 sbs->charger_present);
887#endif 904#endif
905#ifdef CONFIG_ACPI_SYSFS_POWER
888 kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE); 906 kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE);
907#endif
889 } 908 }
890 if (sbs->manager_present) { 909 if (sbs->manager_present) {
891 for (id = 0; id < MAX_SBS_BAT; ++id) { 910 for (id = 0; id < MAX_SBS_BAT; ++id) {
@@ -902,7 +921,9 @@ void acpi_sbs_callback(void *context)
902 ACPI_SBS_NOTIFY_STATUS, 921 ACPI_SBS_NOTIFY_STATUS,
903 bat->present); 922 bat->present);
904#endif 923#endif
924#ifdef CONFIG_ACPI_SYSFS_POWER
905 kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE); 925 kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE);
926#endif
906 } 927 }
907 } 928 }
908} 929}
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 5b4d462117cf..cbfe9ae7a9e5 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1449,6 +1449,8 @@ static int acpi_bus_scan_fixed(struct acpi_device *root)
1449 return result; 1449 return result;
1450} 1450}
1451 1451
1452int __init acpi_boot_ec_enable(void);
1453
1452static int __init acpi_scan_init(void) 1454static int __init acpi_scan_init(void)
1453{ 1455{
1454 int result; 1456 int result;
@@ -1480,6 +1482,10 @@ static int __init acpi_scan_init(void)
1480 * Enumerate devices in the ACPI namespace. 1482 * Enumerate devices in the ACPI namespace.
1481 */ 1483 */
1482 result = acpi_bus_scan_fixed(acpi_root); 1484 result = acpi_bus_scan_fixed(acpi_root);
1485
1486 /* EC region might be needed at bus_scan, so enable it now */
1487 acpi_boot_ec_enable();
1488
1483 if (!result) 1489 if (!result)
1484 result = acpi_bus_scan(acpi_root, &ops); 1490 result = acpi_bus_scan(acpi_root, &ops);
1485 1491
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index bb62a588f489..b406b39b878e 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -132,6 +132,7 @@ enum {
132 ich8_2port_sata, 132 ich8_2port_sata,
133 ich8m_apple_sata_ahci, /* locks up on second port enable */ 133 ich8m_apple_sata_ahci, /* locks up on second port enable */
134 tolapai_sata_ahci, 134 tolapai_sata_ahci,
135 piix_pata_vmw, /* PIIX4 for VMware, spurious DMA_ERR */
135 136
136 /* constants for mapping table */ 137 /* constants for mapping table */
137 P0 = 0, /* port 0 */ 138 P0 = 0, /* port 0 */
@@ -165,6 +166,7 @@ static void piix_set_piomode(struct ata_port *ap, struct ata_device *adev);
165static void piix_set_dmamode(struct ata_port *ap, struct ata_device *adev); 166static void piix_set_dmamode(struct ata_port *ap, struct ata_device *adev);
166static void ich_set_dmamode(struct ata_port *ap, struct ata_device *adev); 167static void ich_set_dmamode(struct ata_port *ap, struct ata_device *adev);
167static int ich_pata_cable_detect(struct ata_port *ap); 168static int ich_pata_cable_detect(struct ata_port *ap);
169static u8 piix_vmw_bmdma_status(struct ata_port *ap);
168#ifdef CONFIG_PM 170#ifdef CONFIG_PM
169static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); 171static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
170static int piix_pci_device_resume(struct pci_dev *pdev); 172static int piix_pci_device_resume(struct pci_dev *pdev);
@@ -175,6 +177,8 @@ static unsigned int in_module_init = 1;
175static const struct pci_device_id piix_pci_tbl[] = { 177static const struct pci_device_id piix_pci_tbl[] = {
176 /* Intel PIIX3 for the 430HX etc */ 178 /* Intel PIIX3 for the 430HX etc */
177 { 0x8086, 0x7010, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix_pata_mwdma }, 179 { 0x8086, 0x7010, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix_pata_mwdma },
180 /* VMware ICH4 */
181 { 0x8086, 0x7111, 0x15ad, 0x1976, 0, 0, piix_pata_vmw },
178 /* Intel PIIX4 for the 430TX/440BX/MX chipset: UDMA 33 */ 182 /* Intel PIIX4 for the 430TX/440BX/MX chipset: UDMA 33 */
179 /* Also PIIX4E (fn3 rev 2) and PIIX4M (fn3 rev 3) */ 183 /* Also PIIX4E (fn3 rev 2) and PIIX4M (fn3 rev 3) */
180 { 0x8086, 0x7111, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix_pata_33 }, 184 { 0x8086, 0x7111, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix_pata_33 },
@@ -383,6 +387,38 @@ static const struct ata_port_operations piix_sata_ops = {
383 .port_start = ata_port_start, 387 .port_start = ata_port_start,
384}; 388};
385 389
390static const struct ata_port_operations piix_vmw_ops = {
391 .set_piomode = piix_set_piomode,
392 .set_dmamode = piix_set_dmamode,
393 .mode_filter = ata_pci_default_filter,
394
395 .tf_load = ata_tf_load,
396 .tf_read = ata_tf_read,
397 .check_status = ata_check_status,
398 .exec_command = ata_exec_command,
399 .dev_select = ata_std_dev_select,
400
401 .bmdma_setup = ata_bmdma_setup,
402 .bmdma_start = ata_bmdma_start,
403 .bmdma_stop = ata_bmdma_stop,
404 .bmdma_status = piix_vmw_bmdma_status,
405 .qc_prep = ata_qc_prep,
406 .qc_issue = ata_qc_issue_prot,
407 .data_xfer = ata_data_xfer,
408
409 .freeze = ata_bmdma_freeze,
410 .thaw = ata_bmdma_thaw,
411 .error_handler = piix_pata_error_handler,
412 .post_internal_cmd = ata_bmdma_post_internal_cmd,
413 .cable_detect = ata_cable_40wire,
414
415 .irq_handler = ata_interrupt,
416 .irq_clear = ata_bmdma_irq_clear,
417 .irq_on = ata_irq_on,
418
419 .port_start = ata_port_start,
420};
421
386static const struct piix_map_db ich5_map_db = { 422static const struct piix_map_db ich5_map_db = {
387 .mask = 0x7, 423 .mask = 0x7,
388 .port_enable = 0x3, 424 .port_enable = 0x3,
@@ -623,6 +659,16 @@ static struct ata_port_info piix_port_info[] = {
623 .port_ops = &piix_sata_ops, 659 .port_ops = &piix_sata_ops,
624 }, 660 },
625 661
662 [piix_pata_vmw] =
663 {
664 .sht = &piix_sht,
665 .flags = PIIX_PATA_FLAGS,
666 .pio_mask = 0x1f, /* pio0-4 */
667 .mwdma_mask = 0x06, /* mwdma1-2 ?? CHECK 0 should be ok but slow */
668 .udma_mask = ATA_UDMA_MASK_40C,
669 .port_ops = &piix_vmw_ops,
670 },
671
626}; 672};
627 673
628static struct pci_bits piix_enable_bits[] = { 674static struct pci_bits piix_enable_bits[] = {
@@ -1135,6 +1181,11 @@ static int piix_pci_device_resume(struct pci_dev *pdev)
1135} 1181}
1136#endif 1182#endif
1137 1183
1184static u8 piix_vmw_bmdma_status(struct ata_port *ap)
1185{
1186 return ata_bmdma_status(ap) & ~ATA_DMA_ERR;
1187}
1188
1138#define AHCI_PCI_BAR 5 1189#define AHCI_PCI_BAR 5
1139#define AHCI_GLOBAL_CTL 0x04 1190#define AHCI_GLOBAL_CTL 0x04
1140#define AHCI_ENABLE (1 << 31) 1191#define AHCI_ENABLE (1 << 31)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 4753a1831dbc..6380726f7538 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6998,7 +6998,9 @@ int ata_host_start(struct ata_host *host)
6998 rc = ap->ops->port_start(ap); 6998 rc = ap->ops->port_start(ap);
6999 if (rc) { 6999 if (rc) {
7000 if (rc != -ENODEV) 7000 if (rc != -ENODEV)
7001 dev_printk(KERN_ERR, host->dev, "failed to start port %d (errno=%d)\n", i, rc); 7001 dev_printk(KERN_ERR, host->dev,
7002 "failed to start port %d "
7003 "(errno=%d)\n", i, rc);
7002 goto err_out; 7004 goto err_out;
7003 } 7005 }
7004 } 7006 }
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index f0124a8d3134..21a81cd148e4 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1733,11 +1733,15 @@ static void ata_eh_link_autopsy(struct ata_link *link)
1733 ehc->i.action &= ~ATA_EH_PERDEV_MASK; 1733 ehc->i.action &= ~ATA_EH_PERDEV_MASK;
1734 } 1734 }
1735 1735
1736 /* consider speeding down */ 1736 /* propagate timeout to host link */
1737 if ((all_err_mask & AC_ERR_TIMEOUT) && !ata_is_host_link(link))
1738 ap->link.eh_context.i.err_mask |= AC_ERR_TIMEOUT;
1739
1740 /* record error and consider speeding down */
1737 dev = ehc->i.dev; 1741 dev = ehc->i.dev;
1738 if (!dev && ata_link_max_devices(link) == 1 && 1742 if (!dev && ((ata_link_max_devices(link) == 1 &&
1739 ata_dev_enabled(link->device)) 1743 ata_dev_enabled(link->device))))
1740 dev = link->device; 1744 dev = link->device;
1741 1745
1742 if (dev) 1746 if (dev)
1743 ehc->i.action |= ata_eh_speed_down(dev, is_io, all_err_mask); 1747 ehc->i.action |= ata_eh_speed_down(dev, is_io, all_err_mask);
@@ -1759,8 +1763,14 @@ void ata_eh_autopsy(struct ata_port *ap)
1759{ 1763{
1760 struct ata_link *link; 1764 struct ata_link *link;
1761 1765
1762 __ata_port_for_each_link(link, ap) 1766 ata_port_for_each_link(link, ap)
1763 ata_eh_link_autopsy(link); 1767 ata_eh_link_autopsy(link);
1768
1769 /* Autopsy of fanout ports can affect host link autopsy.
1770 * Perform host link autopsy last.
1771 */
1772 if (ap->nr_pmp_links)
1773 ata_eh_link_autopsy(&ap->link);
1764} 1774}
1765 1775
1766/** 1776/**
@@ -2157,13 +2167,11 @@ int ata_eh_reset(struct ata_link *link, int classify,
2157 if (ata_link_offline(link)) 2167 if (ata_link_offline(link))
2158 continue; 2168 continue;
2159 2169
2160 /* apply class override and convert UNKNOWN to NONE */ 2170 /* apply class override */
2161 if (lflags & ATA_LFLAG_ASSUME_ATA) 2171 if (lflags & ATA_LFLAG_ASSUME_ATA)
2162 classes[dev->devno] = ATA_DEV_ATA; 2172 classes[dev->devno] = ATA_DEV_ATA;
2163 else if (lflags & ATA_LFLAG_ASSUME_SEMB) 2173 else if (lflags & ATA_LFLAG_ASSUME_SEMB)
2164 classes[dev->devno] = ATA_DEV_SEMB_UNSUP; /* not yet */ 2174 classes[dev->devno] = ATA_DEV_SEMB_UNSUP; /* not yet */
2165 else if (classes[dev->devno] == ATA_DEV_UNKNOWN)
2166 classes[dev->devno] = ATA_DEV_NONE;
2167 } 2175 }
2168 2176
2169 /* record current link speed */ 2177 /* record current link speed */
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c
index c0c4dbcde091..caef2bbd4a8a 100644
--- a/drivers/ata/libata-pmp.c
+++ b/drivers/ata/libata-pmp.c
@@ -495,14 +495,12 @@ static void sata_pmp_quirks(struct ata_port *ap)
495 /* SError.N need a kick in the ass to get working */ 495 /* SError.N need a kick in the ass to get working */
496 link->flags |= ATA_LFLAG_HRST_TO_RESUME; 496 link->flags |= ATA_LFLAG_HRST_TO_RESUME;
497 497
498 /* class code report is unreliable */ 498 /* Class code report is unreliable and SRST
499 if (link->pmp < 5) 499 * times out under certain configurations.
500 link->flags |= ATA_LFLAG_ASSUME_ATA; 500 * Config device can be at port 0 or 5 and
501 501 * locks up on SRST.
502 /* The config device, which can be either at
503 * port 0 or 5, locks up on SRST.
504 */ 502 */
505 if (link->pmp == 0 || link->pmp == 5) 503 if (link->pmp <= 5)
506 link->flags |= ATA_LFLAG_NO_SRST | 504 link->flags |= ATA_LFLAG_NO_SRST |
507 ATA_LFLAG_ASSUME_ATA; 505 ATA_LFLAG_ASSUME_ATA;
508 506
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index a883bb03d4c7..14daf4848f09 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -841,6 +841,9 @@ static void ata_scsi_dev_config(struct scsi_device *sdev,
841 blk_queue_max_hw_segments(q, q->max_hw_segments - 1); 841 blk_queue_max_hw_segments(q, q->max_hw_segments - 1);
842 } 842 }
843 843
844 if (dev->class == ATA_DEV_ATA)
845 sdev->manage_start_stop = 1;
846
844 if (dev->flags & ATA_DFLAG_AN) 847 if (dev->flags & ATA_DFLAG_AN)
845 set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events); 848 set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events);
846 849
@@ -872,8 +875,6 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
872 875
873 ata_scsi_sdev_config(sdev); 876 ata_scsi_sdev_config(sdev);
874 877
875 sdev->manage_start_stop = 1;
876
877 if (dev) 878 if (dev)
878 ata_scsi_dev_config(sdev, dev); 879 ata_scsi_dev_config(sdev, dev);
879 880
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 48acc09dab96..b7ac80b4b1fb 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -806,7 +806,10 @@ int ata_pci_init_one(struct pci_dev *pdev,
806 if (rc) 806 if (rc)
807 goto err_out; 807 goto err_out;
808 808
809 if (!legacy_mode) { 809 if (!legacy_mode && pdev->irq) {
810 /* We may have no IRQ assigned in which case we can poll. This
811 shouldn't happen on a sane system but robustness is cheap
812 in this case */
810 rc = devm_request_irq(dev, pdev->irq, pi->port_ops->irq_handler, 813 rc = devm_request_irq(dev, pdev->irq, pi->port_ops->irq_handler,
811 IRQF_SHARED, DRV_NAME, host); 814 IRQF_SHARED, DRV_NAME, host);
812 if (rc) 815 if (rc)
@@ -814,7 +817,7 @@ int ata_pci_init_one(struct pci_dev *pdev,
814 817
815 ata_port_desc(host->ports[0], "irq %d", pdev->irq); 818 ata_port_desc(host->ports[0], "irq %d", pdev->irq);
816 ata_port_desc(host->ports[1], "irq %d", pdev->irq); 819 ata_port_desc(host->ports[1], "irq %d", pdev->irq);
817 } else { 820 } else if (legacy_mode) {
818 if (!ata_port_is_dummy(host->ports[0])) { 821 if (!ata_port_is_dummy(host->ports[0])) {
819 rc = devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev), 822 rc = devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev),
820 pi->port_ops->irq_handler, 823 pi->port_ops->irq_handler,
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index 088a41f4e656..7842cc487359 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -1509,7 +1509,8 @@ static int __devinit bfin_atapi_probe(struct platform_device *pdev)
1509 if (res == NULL) 1509 if (res == NULL)
1510 return -EINVAL; 1510 return -EINVAL;
1511 1511
1512 while (bfin_port_info[board_idx].udma_mask>0 && udma_fsclk[udma_mode] > fsclk) { 1512 while (bfin_port_info[board_idx].udma_mask > 0 &&
1513 udma_fsclk[udma_mode] > fsclk) {
1513 udma_mode--; 1514 udma_mode--;
1514 bfin_port_info[board_idx].udma_mask >>= 1; 1515 bfin_port_info[board_idx].udma_mask >>= 1;
1515 } 1516 }
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c
index fcd532afbf2e..120b5bfa7ce6 100644
--- a/drivers/ata/pata_ixp4xx_cf.c
+++ b/drivers/ata/pata_ixp4xx_cf.c
@@ -130,10 +130,11 @@ static struct ata_port_operations ixp4xx_port_ops = {
130 .port_start = ata_port_start, 130 .port_start = ata_port_start,
131}; 131};
132 132
133static void ixp4xx_setup_port(struct ata_ioports *ioaddr, 133static void ixp4xx_setup_port(struct ata_port *ap,
134 struct ixp4xx_pata_data *data, 134 struct ixp4xx_pata_data *data,
135 unsigned long raw_cs0, unsigned long raw_cs1) 135 unsigned long raw_cs0, unsigned long raw_cs1)
136{ 136{
137 struct ata_ioports *ioaddr = &ap->ioaddr;
137 unsigned long raw_cmd = raw_cs0; 138 unsigned long raw_cmd = raw_cs0;
138 unsigned long raw_ctl = raw_cs1 + 0x06; 139 unsigned long raw_ctl = raw_cs1 + 0x06;
139 140
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index 7bed8d806381..17159b5e1e43 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -271,14 +271,12 @@ static void pdc_data_xfer_vlb(struct ata_device *adev, unsigned char *buf, unsig
271 ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); 271 ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
272 272
273 if (unlikely(slop)) { 273 if (unlikely(slop)) {
274 u32 pad; 274 __le32 pad = 0;
275 if (write_data) { 275 if (write_data) {
276 memcpy(&pad, buf + buflen - slop, slop); 276 memcpy(&pad, buf + buflen - slop, slop);
277 pad = le32_to_cpu(pad); 277 iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr);
278 iowrite32(pad, ap->ioaddr.data_addr);
279 } else { 278 } else {
280 pad = ioread32(ap->ioaddr.data_addr); 279 pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr));
281 pad = cpu_to_le16(pad);
282 memcpy(buf + buflen - slop, &pad, slop); 280 memcpy(buf + buflen - slop, &pad, slop);
283 } 281 }
284 } 282 }
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index bc7c2d5d8d5e..8f2815601791 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -215,8 +215,8 @@ static void pdc2026x_bmdma_stop(struct ata_queued_cmd *qc)
215 /* Flip back to 33Mhz for PIO */ 215 /* Flip back to 33Mhz for PIO */
216 if (adev->dma_mode >= XFER_UDMA_2) 216 if (adev->dma_mode >= XFER_UDMA_2)
217 iowrite8(ioread8(clock) & ~sel66, clock); 217 iowrite8(ioread8(clock) & ~sel66, clock);
218
219 ata_bmdma_stop(qc); 218 ata_bmdma_stop(qc);
219 pdc202xx_set_piomode(ap, adev);
220} 220}
221 221
222/** 222/**
@@ -233,6 +233,17 @@ static void pdc2026x_dev_config(struct ata_device *adev)
233 adev->max_sectors = 256; 233 adev->max_sectors = 256;
234} 234}
235 235
236static int pdc2026x_port_start(struct ata_port *ap)
237{
238 void __iomem *bmdma = ap->ioaddr.bmdma_addr;
239 if (bmdma) {
240 /* Enable burst mode */
241 u8 burst = ioread8(bmdma + 0x1f);
242 iowrite8(burst | 0x01, bmdma + 0x1f);
243 }
244 return ata_sff_port_start(ap);
245}
246
236static struct scsi_host_template pdc202xx_sht = { 247static struct scsi_host_template pdc202xx_sht = {
237 .module = THIS_MODULE, 248 .module = THIS_MODULE,
238 .name = DRV_NAME, 249 .name = DRV_NAME,
@@ -313,7 +324,7 @@ static struct ata_port_operations pdc2026x_port_ops = {
313 .irq_clear = ata_bmdma_irq_clear, 324 .irq_clear = ata_bmdma_irq_clear,
314 .irq_on = ata_irq_on, 325 .irq_on = ata_irq_on,
315 326
316 .port_start = ata_sff_port_start, 327 .port_start = pdc2026x_port_start,
317}; 328};
318 329
319static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) 330static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id)
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c
index 7d4c696c4cb6..a4c0e502cb42 100644
--- a/drivers/ata/pata_qdi.c
+++ b/drivers/ata/pata_qdi.c
@@ -136,14 +136,12 @@ static void qdi_data_xfer(struct ata_device *adev, unsigned char *buf, unsigned
136 ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); 136 ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
137 137
138 if (unlikely(slop)) { 138 if (unlikely(slop)) {
139 u32 pad; 139 __le32 pad = 0;
140 if (write_data) { 140 if (write_data) {
141 memcpy(&pad, buf + buflen - slop, slop); 141 memcpy(&pad, buf + buflen - slop, slop);
142 pad = le32_to_cpu(pad); 142 iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr);
143 iowrite32(pad, ap->ioaddr.data_addr);
144 } else { 143 } else {
145 pad = ioread32(ap->ioaddr.data_addr); 144 pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr));
146 pad = cpu_to_le32(pad);
147 memcpy(buf + buflen - slop, &pad, slop); 145 memcpy(buf + buflen - slop, &pad, slop);
148 } 146 }
149 } 147 }
diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c
index 311cdb3a5566..7116a9e7a8b2 100644
--- a/drivers/ata/pata_winbond.c
+++ b/drivers/ata/pata_winbond.c
@@ -104,14 +104,12 @@ static void winbond_data_xfer(struct ata_device *adev, unsigned char *buf, unsig
104 ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); 104 ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
105 105
106 if (unlikely(slop)) { 106 if (unlikely(slop)) {
107 u32 pad; 107 __le32 pad = 0;
108 if (write_data) { 108 if (write_data) {
109 memcpy(&pad, buf + buflen - slop, slop); 109 memcpy(&pad, buf + buflen - slop, slop);
110 pad = le32_to_cpu(pad); 110 iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr);
111 iowrite32(pad, ap->ioaddr.data_addr);
112 } else { 111 } else {
113 pad = ioread32(ap->ioaddr.data_addr); 112 pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr));
114 pad = cpu_to_le16(pad);
115 memcpy(buf + buflen - slop, &pad, slop); 113 memcpy(buf + buflen - slop, &pad, slop);
116 } 114 }
117 } 115 }
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c
index 2f1de6ec044c..c68b241805fd 100644
--- a/drivers/ata/sata_qstor.c
+++ b/drivers/ata/sata_qstor.c
@@ -270,7 +270,7 @@ static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
270static void qs_error_handler(struct ata_port *ap) 270static void qs_error_handler(struct ata_port *ap)
271{ 271{
272 qs_enter_reg_mode(ap); 272 qs_enter_reg_mode(ap);
273 ata_do_eh(ap, qs_prereset, ata_std_softreset, NULL, 273 ata_do_eh(ap, qs_prereset, NULL, sata_std_hardreset,
274 ata_std_postreset); 274 ata_std_postreset);
275} 275}
276 276
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 96fd5260446d..864c1c1b8511 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -301,7 +301,7 @@ static struct sil24_cerr_info {
301 [PORT_CERR_PKT_PROT] = { AC_ERR_HSM, ATA_EH_SOFTRESET, 301 [PORT_CERR_PKT_PROT] = { AC_ERR_HSM, ATA_EH_SOFTRESET,
302 "invalid data directon for ATAPI CDB" }, 302 "invalid data directon for ATAPI CDB" },
303 [PORT_CERR_SGT_BOUNDARY] = { AC_ERR_SYSTEM, ATA_EH_SOFTRESET, 303 [PORT_CERR_SGT_BOUNDARY] = { AC_ERR_SYSTEM, ATA_EH_SOFTRESET,
304 "SGT no on qword boundary" }, 304 "SGT not on qword boundary" },
305 [PORT_CERR_SGT_TGTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET, 305 [PORT_CERR_SGT_TGTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET,
306 "PCI target abort while fetching SGT" }, 306 "PCI target abort while fetching SGT" },
307 [PORT_CERR_SGT_MSTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET, 307 [PORT_CERR_SGT_MSTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET,
@@ -832,16 +832,31 @@ static int sil24_qc_defer(struct ata_queued_cmd *qc)
832 struct ata_link *link = qc->dev->link; 832 struct ata_link *link = qc->dev->link;
833 struct ata_port *ap = link->ap; 833 struct ata_port *ap = link->ap;
834 u8 prot = qc->tf.protocol; 834 u8 prot = qc->tf.protocol;
835 int is_atapi = (prot == ATA_PROT_ATAPI || 835
836 prot == ATA_PROT_ATAPI_NODATA || 836 /*
837 prot == ATA_PROT_ATAPI_DMA); 837 * There is a bug in the chip:
838 838 * Port LRAM Causes the PRB/SGT Data to be Corrupted
839 /* ATAPI commands completing with CHECK_SENSE cause various 839 * If the host issues a read request for LRAM and SActive registers
840 * weird problems if other commands are active. PMP DMA CS 840 * while active commands are available in the port, PRB/SGT data in
841 * errata doesn't cover all and HSM violation occurs even with 841 * the LRAM can become corrupted. This issue applies only when
842 * only one other device active. Always run an ATAPI command 842 * reading from, but not writing to, the LRAM.
843 * by itself. 843 *
844 */ 844 * Therefore, reading LRAM when there is no particular error [and
845 * other commands may be outstanding] is prohibited.
846 *
847 * To avoid this bug there are two situations where a command must run
848 * exclusive of any other commands on the port:
849 *
850 * - ATAPI commands which check the sense data
851 * - Passthrough ATA commands which always have ATA_QCFLAG_RESULT_TF
852 * set.
853 *
854 */
855 int is_excl = (prot == ATA_PROT_ATAPI ||
856 prot == ATA_PROT_ATAPI_NODATA ||
857 prot == ATA_PROT_ATAPI_DMA ||
858 (qc->flags & ATA_QCFLAG_RESULT_TF));
859
845 if (unlikely(ap->excl_link)) { 860 if (unlikely(ap->excl_link)) {
846 if (link == ap->excl_link) { 861 if (link == ap->excl_link) {
847 if (ap->nr_active_links) 862 if (ap->nr_active_links)
@@ -849,7 +864,7 @@ static int sil24_qc_defer(struct ata_queued_cmd *qc)
849 qc->flags |= ATA_QCFLAG_CLEAR_EXCL; 864 qc->flags |= ATA_QCFLAG_CLEAR_EXCL;
850 } else 865 } else
851 return ATA_DEFER_PORT; 866 return ATA_DEFER_PORT;
852 } else if (unlikely(is_atapi)) { 867 } else if (unlikely(is_excl)) {
853 ap->excl_link = link; 868 ap->excl_link = link;
854 if (ap->nr_active_links) 869 if (ap->nr_active_links)
855 return ATA_DEFER_PORT; 870 return ATA_DEFER_PORT;
@@ -1079,10 +1094,13 @@ static void sil24_error_intr(struct ata_port *ap)
1079 if (ci && ci->desc) { 1094 if (ci && ci->desc) {
1080 err_mask |= ci->err_mask; 1095 err_mask |= ci->err_mask;
1081 action |= ci->action; 1096 action |= ci->action;
1097 if (action & ATA_EH_RESET_MASK)
1098 freeze = 1;
1082 ata_ehi_push_desc(ehi, "%s", ci->desc); 1099 ata_ehi_push_desc(ehi, "%s", ci->desc);
1083 } else { 1100 } else {
1084 err_mask |= AC_ERR_OTHER; 1101 err_mask |= AC_ERR_OTHER;
1085 action |= ATA_EH_SOFTRESET; 1102 action |= ATA_EH_SOFTRESET;
1103 freeze = 1;
1086 ata_ehi_push_desc(ehi, "unknown command error %d", 1104 ata_ehi_push_desc(ehi, "unknown command error %d",
1087 cerr); 1105 cerr);
1088 } 1106 }
diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
index 14ced85b3f54..0c205b000e8b 100644
--- a/drivers/atm/nicstar.c
+++ b/drivers/atm/nicstar.c
@@ -625,14 +625,6 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev)
625 if (mac[i] == NULL) 625 if (mac[i] == NULL)
626 nicstar_init_eprom(card->membase); 626 nicstar_init_eprom(card->membase);
627 627
628 if (request_irq(pcidev->irq, &ns_irq_handler, IRQF_DISABLED | IRQF_SHARED, "nicstar", card) != 0)
629 {
630 printk("nicstar%d: can't allocate IRQ %d.\n", i, pcidev->irq);
631 error = 9;
632 ns_init_card_error(card, error);
633 return error;
634 }
635
636 /* Set the VPI/VCI MSb mask to zero so we can receive OAM cells */ 628 /* Set the VPI/VCI MSb mask to zero so we can receive OAM cells */
637 writel(0x00000000, card->membase + VPM); 629 writel(0x00000000, card->membase + VPM);
638 630
@@ -858,8 +850,6 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev)
858 card->iovpool.count++; 850 card->iovpool.count++;
859 } 851 }
860 852
861 card->intcnt = 0;
862
863 /* Configure NICStAR */ 853 /* Configure NICStAR */
864 if (card->rct_size == 4096) 854 if (card->rct_size == 4096)
865 ns_cfg_rctsize = NS_CFG_RCTSIZE_4096_ENTRIES; 855 ns_cfg_rctsize = NS_CFG_RCTSIZE_4096_ENTRIES;
@@ -868,6 +858,15 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev)
868 858
869 card->efbie = 1; 859 card->efbie = 1;
870 860
861 card->intcnt = 0;
862 if (request_irq(pcidev->irq, &ns_irq_handler, IRQF_DISABLED | IRQF_SHARED, "nicstar", card) != 0)
863 {
864 printk("nicstar%d: can't allocate IRQ %d.\n", i, pcidev->irq);
865 error = 9;
866 ns_init_card_error(card, error);
867 return error;
868 }
869
871 /* Register device */ 870 /* Register device */
872 card->atmdev = atm_dev_register("nicstar", &atm_ops, -1, NULL); 871 card->atmdev = atm_dev_register("nicstar", &atm_ops, -1, NULL);
873 if (card->atmdev == NULL) 872 if (card->atmdev == NULL)
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 7d704968765f..509b6490413b 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -2927,7 +2927,7 @@ default_int_mode:
2927 return; 2927 return;
2928} 2928}
2929 2929
2930static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) 2930static int __devinit cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
2931{ 2931{
2932 ushort subsystem_vendor_id, subsystem_device_id, command; 2932 ushort subsystem_vendor_id, subsystem_device_id, command;
2933 __u32 board_id, scratchpad = 0; 2933 __u32 board_id, scratchpad = 0;
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 56e23042728a..b8af22e610df 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -610,7 +610,7 @@ static int loop_thread(void *data)
610static int loop_switch(struct loop_device *lo, struct file *file) 610static int loop_switch(struct loop_device *lo, struct file *file)
611{ 611{
612 struct switch_request w; 612 struct switch_request w;
613 struct bio *bio = bio_alloc(GFP_KERNEL, 1); 613 struct bio *bio = bio_alloc(GFP_KERNEL, 0);
614 if (!bio) 614 if (!bio)
615 return -ENOMEM; 615 return -ENOMEM;
616 init_completion(&w.wait); 616 init_completion(&w.wait);
diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c
index 8c3e62a17b4a..b91d45a41b2f 100644
--- a/drivers/bluetooth/hci_ll.c
+++ b/drivers/bluetooth/hci_ll.c
@@ -204,6 +204,19 @@ static void ll_device_want_to_wakeup(struct hci_uart *hu)
204 spin_lock_irqsave(&ll->hcill_lock, flags); 204 spin_lock_irqsave(&ll->hcill_lock, flags);
205 205
206 switch (ll->hcill_state) { 206 switch (ll->hcill_state) {
207 case HCILL_ASLEEP_TO_AWAKE:
208 /*
209 * This state means that both the host and the BRF chip
210 * have simultaneously sent a wake-up-indication packet.
211 * Traditionaly, in this case, receiving a wake-up-indication
212 * was enough and an additional wake-up-ack wasn't needed.
213 * This has changed with the BRF6350, which does require an
214 * explicit wake-up-ack. Other BRF versions, which do not
215 * require an explicit ack here, do accept it, thus it is
216 * perfectly safe to always send one.
217 */
218 BT_DBG("dual wake-up-indication");
219 /* deliberate fall-through - do not add break */
207 case HCILL_ASLEEP: 220 case HCILL_ASLEEP:
208 /* acknowledge device wake up */ 221 /* acknowledge device wake up */
209 if (send_hcill_cmd(HCILL_WAKE_UP_ACK, hu) < 0) { 222 if (send_hcill_cmd(HCILL_WAKE_UP_ACK, hu) < 0) {
@@ -211,16 +224,8 @@ static void ll_device_want_to_wakeup(struct hci_uart *hu)
211 goto out; 224 goto out;
212 } 225 }
213 break; 226 break;
214 case HCILL_ASLEEP_TO_AWAKE:
215 /*
216 * this state means that a wake-up-indication
217 * is already on its way to the device,
218 * and will serve as the required wake-up-ack
219 */
220 BT_DBG("dual wake-up-indication");
221 break;
222 default: 227 default:
223 /* any other state are illegal */ 228 /* any other state is illegal */
224 BT_ERR("received HCILL_WAKE_UP_IND in state %ld", ll->hcill_state); 229 BT_ERR("received HCILL_WAKE_UP_IND in state %ld", ll->hcill_state);
225 break; 230 break;
226 } 231 }
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 39564b76d4a3..c88424a0c89b 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -1046,12 +1046,6 @@ void tpm_remove_hardware(struct device *dev)
1046} 1046}
1047EXPORT_SYMBOL_GPL(tpm_remove_hardware); 1047EXPORT_SYMBOL_GPL(tpm_remove_hardware);
1048 1048
1049static u8 savestate[] = {
1050 0, 193, /* TPM_TAG_RQU_COMMAND */
1051 0, 0, 0, 10, /* blob length (in bytes) */
1052 0, 0, 0, 152 /* TPM_ORD_SaveState */
1053};
1054
1055/* 1049/*
1056 * We are about to suspend. Save the TPM state 1050 * We are about to suspend. Save the TPM state
1057 * so that it can be restored. 1051 * so that it can be restored.
@@ -1059,6 +1053,12 @@ static u8 savestate[] = {
1059int tpm_pm_suspend(struct device *dev, pm_message_t pm_state) 1053int tpm_pm_suspend(struct device *dev, pm_message_t pm_state)
1060{ 1054{
1061 struct tpm_chip *chip = dev_get_drvdata(dev); 1055 struct tpm_chip *chip = dev_get_drvdata(dev);
1056 u8 savestate[] = {
1057 0, 193, /* TPM_TAG_RQU_COMMAND */
1058 0, 0, 0, 10, /* blob length (in bytes) */
1059 0, 0, 0, 152 /* TPM_ORD_SaveState */
1060 };
1061
1062 if (chip == NULL) 1062 if (chip == NULL)
1063 return -ENODEV; 1063 return -ENODEV;
1064 1064
diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c
index 296f51002b55..12ceed54ab18 100644
--- a/drivers/connector/cn_queue.c
+++ b/drivers/connector/cn_queue.c
@@ -99,8 +99,8 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id
99 spin_unlock_bh(&dev->queue_lock); 99 spin_unlock_bh(&dev->queue_lock);
100 100
101 if (found) { 101 if (found) {
102 atomic_dec(&dev->refcnt);
103 cn_queue_free_callback(cbq); 102 cn_queue_free_callback(cbq);
103 atomic_dec(&dev->refcnt);
104 return -EINVAL; 104 return -EINVAL;
105 } 105 }
106 106
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index 1bba99747f5b..5d3a04ba6ad2 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -603,5 +603,9 @@ MODULE_DESCRIPTION ("'cpufreq_conservative' - A dynamic cpufreq governor for "
603 "optimised for use in a battery environment"); 603 "optimised for use in a battery environment");
604MODULE_LICENSE ("GPL"); 604MODULE_LICENSE ("GPL");
605 605
606#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE
607fs_initcall(cpufreq_gov_dbs_init);
608#else
606module_init(cpufreq_gov_dbs_init); 609module_init(cpufreq_gov_dbs_init);
610#endif
607module_exit(cpufreq_gov_dbs_exit); 611module_exit(cpufreq_gov_dbs_exit);
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 369f44595150..d2af20dda382 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -610,6 +610,9 @@ MODULE_DESCRIPTION("'cpufreq_ondemand' - A dynamic cpufreq governor for "
610 "Low Latency Frequency Transition capable processors"); 610 "Low Latency Frequency Transition capable processors");
611MODULE_LICENSE("GPL"); 611MODULE_LICENSE("GPL");
612 612
613#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND
614fs_initcall(cpufreq_gov_dbs_init);
615#else
613module_init(cpufreq_gov_dbs_init); 616module_init(cpufreq_gov_dbs_init);
617#endif
614module_exit(cpufreq_gov_dbs_exit); 618module_exit(cpufreq_gov_dbs_exit);
615
diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c
index 51bedab6c808..f8cdde4bf6cd 100644
--- a/drivers/cpufreq/cpufreq_userspace.c
+++ b/drivers/cpufreq/cpufreq_userspace.c
@@ -231,5 +231,9 @@ MODULE_AUTHOR ("Dominik Brodowski <linux@brodo.de>, Russell King <rmk@arm.linux.
231MODULE_DESCRIPTION ("CPUfreq policy governor 'userspace'"); 231MODULE_DESCRIPTION ("CPUfreq policy governor 'userspace'");
232MODULE_LICENSE ("GPL"); 232MODULE_LICENSE ("GPL");
233 233
234#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE
234fs_initcall(cpufreq_gov_userspace_init); 235fs_initcall(cpufreq_gov_userspace_init);
236#else
237module_init(cpufreq_gov_userspace_init);
238#endif
235module_exit(cpufreq_gov_userspace_exit); 239module_exit(cpufreq_gov_userspace_exit);
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
index a337b693b6c9..5f7e71810489 100644
--- a/drivers/crypto/padlock-aes.c
+++ b/drivers/crypto/padlock-aes.c
@@ -429,8 +429,8 @@ static inline void padlock_xcrypt(const u8 *input, u8 *output, void *key,
429 429
430static void aes_crypt_copy(const u8 *in, u8 *out, u32 *key, struct cword *cword) 430static void aes_crypt_copy(const u8 *in, u8 *out, u32 *key, struct cword *cword)
431{ 431{
432 u8 tmp[AES_BLOCK_SIZE * 2] 432 u8 buf[AES_BLOCK_SIZE * 2 + PADLOCK_ALIGNMENT - 1];
433 __attribute__ ((__aligned__(PADLOCK_ALIGNMENT))); 433 u8 *tmp = PTR_ALIGN(&buf[0], PADLOCK_ALIGNMENT);
434 434
435 memcpy(tmp, in, AES_BLOCK_SIZE); 435 memcpy(tmp, in, AES_BLOCK_SIZE);
436 padlock_xcrypt(tmp, out, key, cword); 436 padlock_xcrypt(tmp, out, key, cword);
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 9c8b6d5eaec9..c09b036913bd 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -135,7 +135,7 @@ static int xfer_write(struct i2c_adapter *adap, unsigned char *buf, int length)
135 * Generic i2c master transfer entrypoint. 135 * Generic i2c master transfer entrypoint.
136 * 136 *
137 * Note: We do not use Atmel's feature of storing the "internal device address". 137 * Note: We do not use Atmel's feature of storing the "internal device address".
138 * Instead the "internal device address" has to be written using a seperate 138 * Instead the "internal device address" has to be written using a separate
139 * i2c message. 139 * i2c message.
140 * http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2004-September/024411.html 140 * http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2004-September/024411.html
141 */ 141 */
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index cb55cf2ba1e9..f2552b19ea60 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -619,13 +619,13 @@ omap_i2c_probe(struct platform_device *pdev)
619err_free_irq: 619err_free_irq:
620 free_irq(dev->irq, dev); 620 free_irq(dev->irq, dev);
621err_unuse_clocks: 621err_unuse_clocks:
622 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
622 omap_i2c_disable_clocks(dev); 623 omap_i2c_disable_clocks(dev);
623 omap_i2c_put_clocks(dev); 624 omap_i2c_put_clocks(dev);
624err_free_mem: 625err_free_mem:
625 platform_set_drvdata(pdev, NULL); 626 platform_set_drvdata(pdev, NULL);
626 kfree(dev); 627 kfree(dev);
627err_release_region: 628err_release_region:
628 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
629 release_mem_region(mem->start, (mem->end - mem->start) + 1); 629 release_mem_region(mem->start, (mem->end - mem->start) + 1);
630 630
631 return r; 631 return r;
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c
index 0ab4f2627c26..7813127649a1 100644
--- a/drivers/i2c/busses/i2c-powermac.c
+++ b/drivers/i2c/busses/i2c-powermac.c
@@ -94,7 +94,7 @@ static s32 i2c_powermac_smbus_xfer( struct i2c_adapter* adap,
94 break; 94 break;
95 95
96 /* Note that these are broken vs. the expected smbus API where 96 /* Note that these are broken vs. the expected smbus API where
97 * on reads, the lenght is actually returned from the function, 97 * on reads, the length is actually returned from the function,
98 * but I think the current API makes no sense and I don't want 98 * but I think the current API makes no sense and I don't want
99 * any driver that I haven't verified for correctness to go 99 * any driver that I haven't verified for correctness to go
100 * anywhere near a pmac i2c bus anyway ... 100 * anywhere near a pmac i2c bus anyway ...
diff --git a/drivers/i2c/busses/i2c-sibyte.c b/drivers/i2c/busses/i2c-sibyte.c
index 0ca599d3b402..503a134ec803 100644
--- a/drivers/i2c/busses/i2c-sibyte.c
+++ b/drivers/i2c/busses/i2c-sibyte.c
@@ -200,11 +200,14 @@ static struct i2c_adapter sibyte_board_adapter[2] = {
200 200
201static int __init i2c_sibyte_init(void) 201static int __init i2c_sibyte_init(void)
202{ 202{
203 printk("i2c-swarm.o: i2c SMBus adapter module for SiByte board\n"); 203 pr_info("i2c-sibyte: i2c SMBus adapter module for SiByte board\n");
204 if (i2c_sibyte_add_bus(&sibyte_board_adapter[0], K_SMB_FREQ_100KHZ) < 0) 204 if (i2c_sibyte_add_bus(&sibyte_board_adapter[0], K_SMB_FREQ_100KHZ) < 0)
205 return -ENODEV; 205 return -ENODEV;
206 if (i2c_sibyte_add_bus(&sibyte_board_adapter[1], K_SMB_FREQ_400KHZ) < 0) 206 if (i2c_sibyte_add_bus(&sibyte_board_adapter[1],
207 K_SMB_FREQ_400KHZ) < 0) {
208 i2c_del_adapter(&sibyte_board_adapter[0]);
207 return -ENODEV; 209 return -ENODEV;
210 }
208 return 0; 211 return 0;
209} 212}
210 213
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index c21ae20ae362..df540d5dfaf4 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -184,7 +184,7 @@ static ssize_t i2cdev_write (struct file *file, const char __user *buf, size_t c
184 184
185/* This address checking function differs from the one in i2c-core 185/* This address checking function differs from the one in i2c-core
186 in that it considers an address with a registered device, but no 186 in that it considers an address with a registered device, but no
187 bounded driver, as NOT busy. */ 187 bound driver, as NOT busy. */
188static int i2cdev_check_addr(struct i2c_adapter *adapter, unsigned int addr) 188static int i2cdev_check_addr(struct i2c_adapter *adapter, unsigned int addr)
189{ 189{
190 struct list_head *item; 190 struct list_head *item;
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
index 89df48fdc69d..899d56536e80 100644
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -16,6 +16,7 @@
16#include <acpi/acpi.h> 16#include <acpi/acpi.h>
17#include <linux/ide.h> 17#include <linux/ide.h>
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/dmi.h>
19 20
20#include <acpi/acpi_bus.h> 21#include <acpi/acpi_bus.h>
21#include <acpi/acnames.h> 22#include <acpi/acnames.h>
@@ -65,6 +66,39 @@ extern int ide_noacpi;
65extern int ide_noacpitfs; 66extern int ide_noacpitfs;
66extern int ide_noacpionboot; 67extern int ide_noacpionboot;
67 68
69static bool ide_noacpi_psx;
70static int no_acpi_psx(const struct dmi_system_id *id)
71{
72 ide_noacpi_psx = true;
73 printk(KERN_NOTICE"%s detected - disable ACPI _PSx.\n", id->ident);
74 return 0;
75}
76
77static const struct dmi_system_id ide_acpi_dmi_table[] = {
78 /* Bug 9673. */
79 /* We should check if this is because ACPI NVS isn't save/restored. */
80 {
81 .callback = no_acpi_psx,
82 .ident = "HP nx9005",
83 .matches = {
84 DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies Ltd."),
85 DMI_MATCH(DMI_BIOS_VERSION, "KAM1.60")
86 },
87 },
88
89 { } /* terminate list */
90};
91
92static int ide_acpi_blacklist(void)
93{
94 static int done;
95 if (done)
96 return 0;
97 done = 1;
98 dmi_check_system(ide_acpi_dmi_table);
99 return 0;
100}
101
68/** 102/**
69 * ide_get_dev_handle - finds acpi_handle and PCI device.function 103 * ide_get_dev_handle - finds acpi_handle and PCI device.function
70 * @dev: device to locate 104 * @dev: device to locate
@@ -623,7 +657,7 @@ void ide_acpi_set_state(ide_hwif_t *hwif, int on)
623{ 657{
624 int unit; 658 int unit;
625 659
626 if (ide_noacpi) 660 if (ide_noacpi || ide_noacpi_psx)
627 return; 661 return;
628 662
629 DEBPRINT("ENTER:\n"); 663 DEBPRINT("ENTER:\n");
@@ -668,6 +702,8 @@ void ide_acpi_init(ide_hwif_t *hwif)
668 struct ide_acpi_drive_link *master; 702 struct ide_acpi_drive_link *master;
669 struct ide_acpi_drive_link *slave; 703 struct ide_acpi_drive_link *slave;
670 704
705 ide_acpi_blacklist();
706
671 hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL); 707 hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL);
672 if (!hwif->acpidata) 708 if (!hwif->acpidata)
673 return; 709 return;
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index cef405ddaf0e..bb9693dabe41 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -612,12 +612,12 @@ u8 eighty_ninty_three (ide_drive_t *drive)
612 printk(KERN_DEBUG "%s: skipping word 93 validity check\n", 612 printk(KERN_DEBUG "%s: skipping word 93 validity check\n",
613 drive->name); 613 drive->name);
614 614
615 if (ide_dev_is_sata(id) && !ivb)
616 return 1;
617
615 if (hwif->cbl != ATA_CBL_PATA80 && !ivb) 618 if (hwif->cbl != ATA_CBL_PATA80 && !ivb)
616 goto no_80w; 619 goto no_80w;
617 620
618 if (ide_dev_is_sata(id))
619 return 1;
620
621 /* 621 /*
622 * FIXME: 622 * FIXME:
623 * - force bit13 (80c cable present) check also for !ivb devices 623 * - force bit13 (80c cable present) check also for !ivb devices
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c
index 0895e753a35d..0151d7fdfb8a 100644
--- a/drivers/ide/pci/trm290.c
+++ b/drivers/ide/pci/trm290.c
@@ -1,7 +1,8 @@
1/* 1/*
2 * linux/drivers/ide/pci/trm290.c Version 1.02 Mar. 18, 2000 2 * linux/drivers/ide/pci/trm290.c Version 1.05 Dec. 26, 2007
3 * 3 *
4 * Copyright (c) 1997-1998 Mark Lord 4 * Copyright (c) 1997-1998 Mark Lord
5 * Copyright (c) 2007 MontaVista Software, Inc. <source@mvista.com>
5 * May be copied or modified under the terms of the GNU General Public License 6 * May be copied or modified under the terms of the GNU General Public License
6 * 7 *
7 * June 22, 2004 - get rid of check_region 8 * June 22, 2004 - get rid of check_region
@@ -177,7 +178,7 @@ static void trm290_selectproc (ide_drive_t *drive)
177 trm290_prepare_drive(drive, drive->using_dma); 178 trm290_prepare_drive(drive, drive->using_dma);
178} 179}
179 180
180static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command) 181static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command)
181{ 182{
182 BUG_ON(HWGROUP(drive)->handler != NULL); /* paranoia check */ 183 BUG_ON(HWGROUP(drive)->handler != NULL); /* paranoia check */
183 ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL); 184 ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
@@ -185,7 +186,7 @@ static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command)
185 outb(command, IDE_COMMAND_REG); 186 outb(command, IDE_COMMAND_REG);
186} 187}
187 188
188static int trm290_ide_dma_setup(ide_drive_t *drive) 189static int trm290_dma_setup(ide_drive_t *drive)
189{ 190{
190 ide_hwif_t *hwif = drive->hwif; 191 ide_hwif_t *hwif = drive->hwif;
191 struct request *rq = hwif->hwgroup->rq; 192 struct request *rq = hwif->hwgroup->rq;
@@ -215,7 +216,7 @@ static int trm290_ide_dma_setup(ide_drive_t *drive)
215 return 0; 216 return 0;
216} 217}
217 218
218static void trm290_ide_dma_start(ide_drive_t *drive) 219static void trm290_dma_start(ide_drive_t *drive)
219{ 220{
220} 221}
221 222
@@ -240,6 +241,14 @@ static int trm290_ide_dma_test_irq (ide_drive_t *drive)
240 return (status == 0x00ff); 241 return (status == 0x00ff);
241} 242}
242 243
244static void trm290_dma_host_on(ide_drive_t *drive)
245{
246}
247
248static void trm290_dma_host_off(ide_drive_t *drive)
249{
250}
251
243static void __devinit init_hwif_trm290(ide_hwif_t *hwif) 252static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
244{ 253{
245 unsigned int cfgbase = 0; 254 unsigned int cfgbase = 0;
@@ -280,11 +289,13 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
280 289
281 ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->channel ? 0x0080 : 0x0000), 3); 290 ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->channel ? 0x0080 : 0x0000), 3);
282 291
283 hwif->dma_setup = &trm290_ide_dma_setup; 292 hwif->dma_host_off = &trm290_dma_host_off;
284 hwif->dma_exec_cmd = &trm290_ide_dma_exec_cmd; 293 hwif->dma_host_on = &trm290_dma_host_on;
285 hwif->dma_start = &trm290_ide_dma_start; 294 hwif->dma_setup = &trm290_dma_setup;
286 hwif->ide_dma_end = &trm290_ide_dma_end; 295 hwif->dma_exec_cmd = &trm290_dma_exec_cmd;
287 hwif->ide_dma_test_irq = &trm290_ide_dma_test_irq; 296 hwif->dma_start = &trm290_dma_start;
297 hwif->ide_dma_end = &trm290_ide_dma_end;
298 hwif->ide_dma_test_irq = &trm290_ide_dma_test_irq;
288 299
289 hwif->selectproc = &trm290_selectproc; 300 hwif->selectproc = &trm290_selectproc;
290#if 1 301#if 1
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
index bfc6061f1554..1dc2ac9f3d1c 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -38,8 +38,6 @@ EXPORT_SYMBOL(gameport_unregister_driver);
38EXPORT_SYMBOL(gameport_open); 38EXPORT_SYMBOL(gameport_open);
39EXPORT_SYMBOL(gameport_close); 39EXPORT_SYMBOL(gameport_close);
40EXPORT_SYMBOL(gameport_rescan); 40EXPORT_SYMBOL(gameport_rescan);
41EXPORT_SYMBOL(gameport_cooked_read);
42EXPORT_SYMBOL(gameport_set_name);
43EXPORT_SYMBOL(gameport_set_phys); 41EXPORT_SYMBOL(gameport_set_phys);
44EXPORT_SYMBOL(gameport_start_polling); 42EXPORT_SYMBOL(gameport_start_polling);
45EXPORT_SYMBOL(gameport_stop_polling); 43EXPORT_SYMBOL(gameport_stop_polling);
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 307c7b5c2b33..a0be978501ff 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -235,6 +235,10 @@ static void input_handle_event(struct input_dev *dev,
235 if (value >= 0) 235 if (value >= 0)
236 disposition = INPUT_PASS_TO_ALL; 236 disposition = INPUT_PASS_TO_ALL;
237 break; 237 break;
238
239 case EV_PWR:
240 disposition = INPUT_PASS_TO_ALL;
241 break;
238 } 242 }
239 243
240 if (type != EV_SYN) 244 if (type != EV_SYN)
@@ -1266,6 +1270,10 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int
1266 __set_bit(code, dev->ffbit); 1270 __set_bit(code, dev->ffbit);
1267 break; 1271 break;
1268 1272
1273 case EV_PWR:
1274 /* do nothing */
1275 break;
1276
1269 default: 1277 default:
1270 printk(KERN_ERR 1278 printk(KERN_ERR
1271 "input_set_capability: unknown type %u (code %u)\n", 1279 "input_set_capability: unknown type %u (code %u)\n",
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index dfa6592c10f6..086d58c0ccbe 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -209,22 +209,22 @@ config KEYBOARD_HIL
209 to your machine, so normally you should say Y here. 209 to your machine, so normally you should say Y here.
210 210
211config KEYBOARD_HP6XX 211config KEYBOARD_HP6XX
212 tristate "HP Jornada 6XX Keyboard support" 212 tristate "HP Jornada 6xx keyboard"
213 depends on SH_HP6XX 213 depends on SH_HP6XX
214 select INPUT_POLLDEV 214 select INPUT_POLLDEV
215 help 215 help
216 This adds support for the onboard keyboard found on 216 Say Y here if you have a HP Jornada 620/660/680/690 and want to
217 HP Jornada 620/660/680/690. 217 support the built-in keyboard.
218 218
219 To compile this driver as a module, choose M here: the 219 To compile this driver as a module, choose M here: the
220 module will be called jornada680_kbd. 220 module will be called jornada680_kbd.
221 221
222config KEYBOARD_HP7XX 222config KEYBOARD_HP7XX
223 tristate "HP Jornada 7XX Keyboard Driver" 223 tristate "HP Jornada 7xx keyboard"
224 depends on SA1100_JORNADA720_SSP && SA1100_SSP 224 depends on SA1100_JORNADA720_SSP && SA1100_SSP
225 help 225 help
226 Say Y here to add support for the HP Jornada 7xx (710/720/728) 226 Say Y here if you have a HP Jornada 710/720/728 and want to
227 onboard keyboard. 227 support the built-in keyboard.
228 228
229 To compile this driver as a module, choose M here: the 229 To compile this driver as a module, choose M here: the
230 module will be called jornada720_kbd. 230 module will be called jornada720_kbd.
diff --git a/drivers/input/keyboard/jornada680_kbd.c b/drivers/input/keyboard/jornada680_kbd.c
index bec1cf483723..a23633a2e1b4 100644
--- a/drivers/input/keyboard/jornada680_kbd.c
+++ b/drivers/input/keyboard/jornada680_kbd.c
@@ -16,14 +16,14 @@
16 * published by the Free Software Foundation. 16 * published by the Free Software Foundation.
17 */ 17 */
18 18
19#include <linux/input.h>
20#include <linux/kernel.h>
21#include <linux/module.h>
22#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/input.h>
23#include <linux/input-polldev.h> 21#include <linux/input-polldev.h>
22#include <linux/interrupt.h>
24#include <linux/jiffies.h> 23#include <linux/jiffies.h>
24#include <linux/kernel.h>
25#include <linux/module.h>
25#include <linux/platform_device.h> 26#include <linux/platform_device.h>
26#include <linux/interrupt.h>
27 27
28#include <asm/delay.h> 28#include <asm/delay.h>
29#include <asm/io.h> 29#include <asm/io.h>
@@ -43,22 +43,22 @@
43#define PLDR 0xa4000134 43#define PLDR 0xa4000134
44 44
45static const unsigned short jornada_scancodes[] = { 45static const unsigned short jornada_scancodes[] = {
46/* PTD1 */ KEY_CAPSLOCK, KEY_MACRO, KEY_LEFTCTRL, 0, KEY_ESC, 0, 0, 0, /* 1 -> 8 */ 46/* PTD1 */ KEY_CAPSLOCK, KEY_MACRO, KEY_LEFTCTRL, 0, KEY_ESC, KEY_KP5, 0, 0, /* 1 -> 8 */
47 KEY_F1, KEY_F2, KEY_F3, KEY_F8, KEY_F7, KEY_F2, KEY_F4, KEY_F5, /* 9 -> 16 */ 47 KEY_F1, KEY_F2, KEY_F3, KEY_F8, KEY_F7, KEY_F6, KEY_F4, KEY_F5, /* 9 -> 16 */
48/* PTD5 */ KEY_SLASH, KEY_APOSTROPHE, KEY_ENTER, 0, KEY_Z, 0, 0, 0, /* 17 -> 24 */ 48/* PTD5 */ KEY_SLASH, KEY_APOSTROPHE, KEY_ENTER, 0, KEY_Z, 0, 0, 0, /* 17 -> 24 */
49 KEY_X, KEY_C, KEY_V, KEY_DOT, KEY_COMMA, KEY_M, KEY_B, KEY_N, /* 25 -> 32 */ 49 KEY_X, KEY_C, KEY_V, KEY_DOT, KEY_COMMA, KEY_M, KEY_B, KEY_N, /* 25 -> 32 */
50/* PTD7 */ KEY_KP2, KEY_KP6, 0, 0, 0, 0, 0, 0, /* 33 -> 40 */ 50/* PTD7 */ KEY_KP2, KEY_KP6, KEY_KP3, 0, 0, 0, 0, 0, /* 33 -> 40 */
51 0, 0, 0, KEY_KP4, 0, 0, KEY_LEFTALT, KEY_HANJA, /* 41 -> 48 */ 51 KEY_F10, KEY_RO, KEY_F9, KEY_KP4, KEY_NUMLOCK, KEY_SCROLLLOCK, KEY_LEFTALT, KEY_HANJA, /* 41 -> 48 */
52/* PTE0 */ 0, 0, 0, 0, KEY_FINANCE, 0, 0, 0, /* 49 -> 56 */ 52/* PTE0 */ KEY_KATAKANA, KEY_KP0, KEY_GRAVE, 0, KEY_FINANCE, 0, 0, 0, /* 49 -> 56 */
53 KEY_LEFTCTRL, 0, KEY_SPACE, KEY_KPDOT, KEY_VOLUMEUP, 249, 0, 0, /* 57 -> 64 */ 53 KEY_KPMINUS, KEY_HIRAGANA, KEY_SPACE, KEY_KPDOT, KEY_VOLUMEUP, 249, 0, 0, /* 57 -> 64 */
54/* PTE1 */ KEY_SEMICOLON, KEY_RIGHTBRACE, KEY_BACKSLASH, 0, KEY_A, 0, 0, 0,/* 65 -> 72 */ 54/* PTE1 */ KEY_SEMICOLON, KEY_RIGHTBRACE, KEY_BACKSLASH, 0, KEY_A, 0, 0, 0, /* 65 -> 72 */
55 KEY_S, KEY_D, KEY_F, KEY_L, KEY_K, KEY_J, KEY_G, KEY_H, /* 73 -> 80 */ 55 KEY_S, KEY_D, KEY_F, KEY_L, KEY_K, KEY_J, KEY_G, KEY_H, /* 73 -> 80 */
56/* PTE3 */ KEY_KP8, KEY_LEFTMETA, KEY_RIGHTSHIFT, 0, KEY_TAB, 0, 0,0, /* 81 -> 88 */ 56/* PTE3 */ KEY_KP8, KEY_LEFTMETA, KEY_RIGHTSHIFT, 0, KEY_TAB, 0, 0, 0, /* 81 -> 88 */
57 0, KEY_LEFTSHIFT, 0, 0, 0, 0, 0, 0, /* 89 -> 96 */ 57 0, KEY_LEFTSHIFT, KEY_KP7, KEY_KP9, KEY_KP1, KEY_F11, KEY_KPPLUS, KEY_KPASTERISK, /* 89 -> 96 */
58/* PTE6 */ KEY_P, KEY_LEFTBRACE, KEY_BACKSPACE, 0, KEY_Q, 0, 0, 0, /* 97 -> 104 */ 58/* PTE6 */ KEY_P, KEY_LEFTBRACE, KEY_BACKSPACE, 0, KEY_Q, 0, 0, 0, /* 97 -> 104 */
59 KEY_W, KEY_E, KEY_R, KEY_O, KEY_I, KEY_U, KEY_T, KEY_R, /* 105 -> 112 */ 59 KEY_W, KEY_E, KEY_R, KEY_O, KEY_I, KEY_U, KEY_T, KEY_Y, /* 105 -> 112 */
60/* PTE7 */ KEY_0, KEY_MINUS, KEY_EQUAL, 0, KEY_1, 0, 0, 0, /* 113 -> 120 */ 60/* PTE7 */ KEY_0, KEY_MINUS, KEY_EQUAL, 0, KEY_1, 0, 0, 0, /* 113 -> 120 */
61 KEY_2, KEY_3, KEY_4, KEY_9, KEY_8, KEY_7, KEY_5, KEY_6, /* 121 -> 128 */ 61 KEY_2, KEY_3, KEY_4, KEY_9, KEY_8, KEY_7, KEY_5, KEY_6, /* 121 -> 128 */
62/* **** */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62/* **** */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
63 0, 0, 0, 0, 0 63 0, 0, 0, 0, 0
64}; 64};
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c
index 410d78a774d0..1d59a2dc3c17 100644
--- a/drivers/input/keyboard/spitzkbd.c
+++ b/drivers/input/keyboard/spitzkbd.c
@@ -391,6 +391,7 @@ static int __init spitzkbd_probe(struct platform_device *dev)
391 for (i = 0; i < ARRAY_SIZE(spitzkbd_keycode); i++) 391 for (i = 0; i < ARRAY_SIZE(spitzkbd_keycode); i++)
392 set_bit(spitzkbd->keycode[i], input_dev->keybit); 392 set_bit(spitzkbd->keycode[i], input_dev->keybit);
393 clear_bit(0, input_dev->keybit); 393 clear_bit(0, input_dev->keybit);
394 set_bit(KEY_SUSPEND, input_dev->keybit);
394 set_bit(SW_LID, input_dev->swbit); 395 set_bit(SW_LID, input_dev->swbit);
395 set_bit(SW_TABLET_MODE, input_dev->swbit); 396 set_bit(SW_TABLET_MODE, input_dev->swbit);
396 set_bit(SW_HEADPHONE_INSERT, input_dev->swbit); 397 set_bit(SW_HEADPHONE_INSERT, input_dev->swbit);
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 2b5ed119c9a9..b346a3b418ea 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -54,7 +54,7 @@ static const struct alps_model_info alps_model_data[] = {
54 { { 0x20, 0x02, 0x0e }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* XXX */ 54 { { 0x20, 0x02, 0x0e }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* XXX */
55 { { 0x22, 0x02, 0x0a }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, 55 { { 0x22, 0x02, 0x0a }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT },
56 { { 0x22, 0x02, 0x14 }, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */ 56 { { 0x22, 0x02, 0x14 }, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */
57 { { 0x73, 0x02, 0x50 }, 0xcf, 0xff, ALPS_FW_BK_1 } /* Dell Vostro 1400 */ 57 { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FW_BK_1 } /* Dell Vostro 1400 */
58}; 58};
59 59
60/* 60/*
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c
index 9ec57d80186e..df81b0aaa9f8 100644
--- a/drivers/input/mouse/lifebook.c
+++ b/drivers/input/mouse/lifebook.c
@@ -225,8 +225,13 @@ static void lifebook_set_resolution(struct psmouse *psmouse, unsigned int resolu
225 225
226static void lifebook_disconnect(struct psmouse *psmouse) 226static void lifebook_disconnect(struct psmouse *psmouse)
227{ 227{
228 struct lifebook_data *priv = psmouse->private;
229
228 psmouse_reset(psmouse); 230 psmouse_reset(psmouse);
229 kfree(psmouse->private); 231 if (priv) {
232 input_unregister_device(priv->dev2);
233 kfree(priv);
234 }
230 psmouse->private = NULL; 235 psmouse->private = NULL;
231} 236}
232 237
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 21a9c0b69a1f..b8628252e10c 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -1247,6 +1247,8 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv)
1247 err_pt_deactivate: 1247 err_pt_deactivate:
1248 if (parent && parent->pt_deactivate) 1248 if (parent && parent->pt_deactivate)
1249 parent->pt_deactivate(parent); 1249 parent->pt_deactivate(parent);
1250 input_unregister_device(psmouse->dev);
1251 input_dev = NULL; /* so we don't try to free it below */
1250 err_protocol_disconnect: 1252 err_protocol_disconnect:
1251 if (psmouse->disconnect) 1253 if (psmouse->disconnect)
1252 psmouse->disconnect(psmouse); 1254 psmouse->disconnect(psmouse);
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index 78c3ea75da2a..be83516c776c 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -1029,6 +1029,15 @@ static const struct input_device_id mousedev_ids[] = {
1029 BIT_MASK(ABS_PRESSURE) | 1029 BIT_MASK(ABS_PRESSURE) |
1030 BIT_MASK(ABS_TOOL_WIDTH) }, 1030 BIT_MASK(ABS_TOOL_WIDTH) },
1031 }, /* A touchpad */ 1031 }, /* A touchpad */
1032 {
1033 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
1034 INPUT_DEVICE_ID_MATCH_KEYBIT |
1035 INPUT_DEVICE_ID_MATCH_ABSBIT,
1036 .evbit = { BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_SYN) },
1037 .keybit = { [BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) },
1038 .absbit = { BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) },
1039 }, /* Mouse-like device with absolute X and Y but ordinary
1040 clicks, like hp ILO2 High Performance mouse */
1032 1041
1033 { }, /* Terminating entry */ 1042 { }, /* Terminating entry */
1034}; 1043};
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index fa8442b6241c..90e8e92dfe47 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -115,19 +115,17 @@ config TOUCHSCREEN_MK712
115 module will be called mk712. 115 module will be called mk712.
116 116
117config TOUCHSCREEN_HP600 117config TOUCHSCREEN_HP600
118 tristate "HP Jornada 680/690 touchscreen" 118 tristate "HP Jornada 6xx touchscreen"
119 depends on SH_HP6XX && SH_ADC 119 depends on SH_HP6XX && SH_ADC
120 help 120 help
121 Say Y here if you have a HP Jornada 680 or 690 and want to 121 Say Y here if you have a HP Jornada 620/660/680/690 and want to
122 support the built-in touchscreen. 122 support the built-in touchscreen.
123 123
124 If unsure, say N.
125
126 To compile this driver as a module, choose M here: the 124 To compile this driver as a module, choose M here: the
127 module will be called hp680_ts_input. 125 module will be called hp680_ts_input.
128 126
129config TOUCHSCREEN_HP7XX 127config TOUCHSCREEN_HP7XX
130 tristate "HP Jornada 710/720/728 touchscreen" 128 tristate "HP Jornada 7xx touchscreen"
131 depends on SA1100_JORNADA720_SSP 129 depends on SA1100_JORNADA720_SSP
132 help 130 help
133 Say Y here if you have a HP Jornada 710/720/728 and want 131 Say Y here if you have a HP Jornada 710/720/728 and want
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 19055e7381f8..63f9664a066f 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -11,6 +11,7 @@
11 * - DMC TSC-10/25 11 * - DMC TSC-10/25
12 * - IRTOUCHSYSTEMS/UNITOP 12 * - IRTOUCHSYSTEMS/UNITOP
13 * - IdealTEK URTC1000 13 * - IdealTEK URTC1000
14 * - General Touch
14 * - GoTop Super_Q2/GogoPen/PenPower tablets 15 * - GoTop Super_Q2/GogoPen/PenPower tablets
15 * 16 *
16 * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> 17 * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch>
@@ -50,7 +51,7 @@
50#include <linux/usb/input.h> 51#include <linux/usb/input.h>
51 52
52 53
53#define DRIVER_VERSION "v0.5" 54#define DRIVER_VERSION "v0.6"
54#define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>" 55#define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>"
55#define DRIVER_DESC "USB Touchscreen Driver" 56#define DRIVER_DESC "USB Touchscreen Driver"
56 57
@@ -65,17 +66,21 @@ struct usbtouch_device_info {
65 int min_yc, max_yc; 66 int min_yc, max_yc;
66 int min_press, max_press; 67 int min_press, max_press;
67 int rept_size; 68 int rept_size;
68 int flags;
69 69
70 void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len); 70 void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len);
71
72 /*
73 * used to get the packet len. possible return values:
74 * > 0: packet len
75 * = 0: skip one byte
76 * < 0: -return value more bytes needed
77 */
71 int (*get_pkt_len) (unsigned char *pkt, int len); 78 int (*get_pkt_len) (unsigned char *pkt, int len);
79
72 int (*read_data) (struct usbtouch_usb *usbtouch, unsigned char *pkt); 80 int (*read_data) (struct usbtouch_usb *usbtouch, unsigned char *pkt);
73 int (*init) (struct usbtouch_usb *usbtouch); 81 int (*init) (struct usbtouch_usb *usbtouch);
74}; 82};
75 83
76#define USBTOUCH_FLG_BUFFER 0x01
77
78
79/* a usbtouch device */ 84/* a usbtouch device */
80struct usbtouch_usb { 85struct usbtouch_usb {
81 unsigned char *data; 86 unsigned char *data;
@@ -94,15 +99,6 @@ struct usbtouch_usb {
94}; 99};
95 100
96 101
97#if defined(CONFIG_TOUCHSCREEN_USB_EGALAX) || defined(CONFIG_TOUCHSCREEN_USB_ETURBO) || defined(CONFIG_TOUCHSCREEN_USB_IDEALTEK)
98#define MULTI_PACKET
99#endif
100
101#ifdef MULTI_PACKET
102static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
103 unsigned char *pkt, int len);
104#endif
105
106/* device types */ 102/* device types */
107enum { 103enum {
108 DEVTPYE_DUMMY = -1, 104 DEVTPYE_DUMMY = -1,
@@ -186,6 +182,10 @@ static struct usb_device_id usbtouch_devices[] = {
186 182
187#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX 183#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
188 184
185#ifndef MULTI_PACKET
186#define MULTI_PACKET
187#endif
188
189#define EGALAX_PKT_TYPE_MASK 0xFE 189#define EGALAX_PKT_TYPE_MASK 0xFE
190#define EGALAX_PKT_TYPE_REPT 0x80 190#define EGALAX_PKT_TYPE_REPT 0x80
191#define EGALAX_PKT_TYPE_DIAG 0x0A 191#define EGALAX_PKT_TYPE_DIAG 0x0A
@@ -323,6 +323,9 @@ static int itm_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
323 * eTurboTouch part 323 * eTurboTouch part
324 */ 324 */
325#ifdef CONFIG_TOUCHSCREEN_USB_ETURBO 325#ifdef CONFIG_TOUCHSCREEN_USB_ETURBO
326#ifndef MULTI_PACKET
327#define MULTI_PACKET
328#endif
326static int eturbo_read_data(struct usbtouch_usb *dev, unsigned char *pkt) 329static int eturbo_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
327{ 330{
328 unsigned int shift; 331 unsigned int shift;
@@ -461,6 +464,9 @@ static int irtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
461 * IdealTEK URTC1000 Part 464 * IdealTEK URTC1000 Part
462 */ 465 */
463#ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK 466#ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK
467#ifndef MULTI_PACKET
468#define MULTI_PACKET
469#endif
464static int idealtek_get_pkt_len(unsigned char *buf, int len) 470static int idealtek_get_pkt_len(unsigned char *buf, int len)
465{ 471{
466 if (buf[0] & 0x80) 472 if (buf[0] & 0x80)
@@ -525,6 +531,11 @@ static int gotop_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
525/***************************************************************************** 531/*****************************************************************************
526 * the different device descriptors 532 * the different device descriptors
527 */ 533 */
534#ifdef MULTI_PACKET
535static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
536 unsigned char *pkt, int len);
537#endif
538
528static struct usbtouch_device_info usbtouch_dev_info[] = { 539static struct usbtouch_device_info usbtouch_dev_info[] = {
529#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX 540#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
530 [DEVTYPE_EGALAX] = { 541 [DEVTYPE_EGALAX] = {
@@ -533,7 +544,6 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
533 .min_yc = 0x0, 544 .min_yc = 0x0,
534 .max_yc = 0x07ff, 545 .max_yc = 0x07ff,
535 .rept_size = 16, 546 .rept_size = 16,
536 .flags = USBTOUCH_FLG_BUFFER,
537 .process_pkt = usbtouch_process_multi, 547 .process_pkt = usbtouch_process_multi,
538 .get_pkt_len = egalax_get_pkt_len, 548 .get_pkt_len = egalax_get_pkt_len,
539 .read_data = egalax_read_data, 549 .read_data = egalax_read_data,
@@ -582,7 +592,6 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
582 .min_yc = 0x0, 592 .min_yc = 0x0,
583 .max_yc = 0x07ff, 593 .max_yc = 0x07ff,
584 .rept_size = 8, 594 .rept_size = 8,
585 .flags = USBTOUCH_FLG_BUFFER,
586 .process_pkt = usbtouch_process_multi, 595 .process_pkt = usbtouch_process_multi,
587 .get_pkt_len = eturbo_get_pkt_len, 596 .get_pkt_len = eturbo_get_pkt_len,
588 .read_data = eturbo_read_data, 597 .read_data = eturbo_read_data,
@@ -630,7 +639,6 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
630 .min_yc = 0x0, 639 .min_yc = 0x0,
631 .max_yc = 0x0fff, 640 .max_yc = 0x0fff,
632 .rept_size = 8, 641 .rept_size = 8,
633 .flags = USBTOUCH_FLG_BUFFER,
634 .process_pkt = usbtouch_process_multi, 642 .process_pkt = usbtouch_process_multi,
635 .get_pkt_len = idealtek_get_pkt_len, 643 .get_pkt_len = idealtek_get_pkt_len,
636 .read_data = idealtek_read_data, 644 .read_data = idealtek_read_data,
@@ -738,11 +746,14 @@ static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
738 pos = 0; 746 pos = 0;
739 while (pos < buf_len) { 747 while (pos < buf_len) {
740 /* get packet len */ 748 /* get packet len */
741 pkt_len = usbtouch->type->get_pkt_len(buffer + pos, len); 749 pkt_len = usbtouch->type->get_pkt_len(buffer + pos,
750 buf_len - pos);
742 751
743 /* unknown packet: drop everything */ 752 /* unknown packet: skip one byte */
744 if (unlikely(!pkt_len)) 753 if (unlikely(!pkt_len)) {
745 goto out_flush_buf; 754 pos++;
755 continue;
756 }
746 757
747 /* full packet: process */ 758 /* full packet: process */
748 if (likely((pkt_len > 0) && (pkt_len <= buf_len - pos))) { 759 if (likely((pkt_len > 0) && (pkt_len <= buf_len - pos))) {
@@ -857,7 +868,7 @@ static int usbtouch_probe(struct usb_interface *intf,
857 if (!usbtouch->data) 868 if (!usbtouch->data)
858 goto out_free; 869 goto out_free;
859 870
860 if (type->flags & USBTOUCH_FLG_BUFFER) { 871 if (type->get_pkt_len) {
861 usbtouch->buffer = kmalloc(type->rept_size, GFP_KERNEL); 872 usbtouch->buffer = kmalloc(type->rept_size, GFP_KERNEL);
862 if (!usbtouch->buffer) 873 if (!usbtouch->buffer)
863 goto out_free_buffers; 874 goto out_free_buffers;
diff --git a/drivers/lguest/Kconfig b/drivers/lguest/Kconfig
index 7eb9ecff8f4a..002d4f4e93c6 100644
--- a/drivers/lguest/Kconfig
+++ b/drivers/lguest/Kconfig
@@ -2,6 +2,7 @@ config LGUEST
2 tristate "Linux hypervisor example code" 2 tristate "Linux hypervisor example code"
3 depends on X86_32 && EXPERIMENTAL && !X86_PAE && FUTEX && !(X86_VISWS || X86_VOYAGER) 3 depends on X86_32 && EXPERIMENTAL && !X86_PAE && FUTEX && !(X86_VISWS || X86_VOYAGER)
4 select HVC_DRIVER 4 select HVC_DRIVER
5 select LGUEST_GUEST
5 ---help--- 6 ---help---
6 This is a very simple module which allows you to run 7 This is a very simple module which allows you to run
7 multiple instances of the same Linux kernel, using the 8 multiple instances of the same Linux kernel, using the
@@ -15,5 +16,4 @@ config LGUEST_GUEST
15 bool 16 bool
16 help 17 help
17 The guest needs code built-in, even if the host has lguest 18 The guest needs code built-in, even if the host has lguest
18 support as a module. The drivers are tiny, so we build them 19 support as a module.
19 in too.
diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c
index 883da72b5368..ef4c117ea35f 100644
--- a/drivers/macintosh/adbhid.c
+++ b/drivers/macintosh/adbhid.c
@@ -322,8 +322,9 @@ adbhid_input_keycode(int id, int scancode, int repeat)
322 input_sync(ahid->input); 322 input_sync(ahid->input);
323 input_report_key(ahid->input, KEY_CAPSLOCK, 0); 323 input_report_key(ahid->input, KEY_CAPSLOCK, 0);
324 input_sync(ahid->input); 324 input_sync(ahid->input);
325 return;
325 } 326 }
326 return; 327 break;
327#ifdef CONFIG_PPC_PMAC 328#ifdef CONFIG_PPC_PMAC
328 case ADB_KEY_POWER_OLD: /* Power key on PBook 3400 needs remapping */ 329 case ADB_KEY_POWER_OLD: /* Power key on PBook 3400 needs remapping */
329 switch(pmac_call_feature(PMAC_FTR_GET_MB_INFO, 330 switch(pmac_call_feature(PMAC_FTR_GET_MB_INFO,
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index 8b8144f77a73..0d36c155695b 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -2800,12 +2800,12 @@ static void av7110_irq(struct saa7146_dev* dev, u32 *isr)
2800} 2800}
2801 2801
2802 2802
2803static struct saa7146_extension av7110_extension; 2803static struct saa7146_extension av7110_extension_driver;
2804 2804
2805#define MAKE_AV7110_INFO(x_var,x_name) \ 2805#define MAKE_AV7110_INFO(x_var,x_name) \
2806static struct saa7146_pci_extension_data x_var = { \ 2806static struct saa7146_pci_extension_data x_var = { \
2807 .ext_priv = x_name, \ 2807 .ext_priv = x_name, \
2808 .ext = &av7110_extension } 2808 .ext = &av7110_extension_driver }
2809 2809
2810MAKE_AV7110_INFO(tts_1_X_fsc,"Technotrend/Hauppauge WinTV DVB-S rev1.X or Fujitsu Siemens DVB-C"); 2810MAKE_AV7110_INFO(tts_1_X_fsc,"Technotrend/Hauppauge WinTV DVB-S rev1.X or Fujitsu Siemens DVB-C");
2811MAKE_AV7110_INFO(ttt_1_X, "Technotrend/Hauppauge WinTV DVB-T rev1.X"); 2811MAKE_AV7110_INFO(ttt_1_X, "Technotrend/Hauppauge WinTV DVB-T rev1.X");
@@ -2843,7 +2843,7 @@ static struct pci_device_id pci_tbl[] = {
2843MODULE_DEVICE_TABLE(pci, pci_tbl); 2843MODULE_DEVICE_TABLE(pci, pci_tbl);
2844 2844
2845 2845
2846static struct saa7146_extension av7110_extension = { 2846static struct saa7146_extension av7110_extension_driver = {
2847 .name = "dvb", 2847 .name = "dvb",
2848 .flags = SAA7146_USE_I2C_IRQ, 2848 .flags = SAA7146_USE_I2C_IRQ,
2849 2849
@@ -2860,14 +2860,14 @@ static struct saa7146_extension av7110_extension = {
2860static int __init av7110_init(void) 2860static int __init av7110_init(void)
2861{ 2861{
2862 int retval; 2862 int retval;
2863 retval = saa7146_register_extension(&av7110_extension); 2863 retval = saa7146_register_extension(&av7110_extension_driver);
2864 return retval; 2864 return retval;
2865} 2865}
2866 2866
2867 2867
2868static void __exit av7110_exit(void) 2868static void __exit av7110_exit(void)
2869{ 2869{
2870 saa7146_unregister_extension(&av7110_extension); 2870 saa7146_unregister_extension(&av7110_extension_driver);
2871} 2871}
2872 2872
2873module_init(av7110_init); 2873module_init(av7110_init);
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c
index 10d6faf8ccda..6d2dd8764f81 100644
--- a/drivers/media/video/ivtv/ivtv-driver.c
+++ b/drivers/media/video/ivtv/ivtv-driver.c
@@ -1076,10 +1076,6 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
1076 ivtv_process_eeprom(itv); 1076 ivtv_process_eeprom(itv);
1077 } 1077 }
1078 1078
1079 /* The mspx4xx chips need a longer delay for some reason */
1080 if (!(itv->hw_flags & IVTV_HW_MSP34XX))
1081 itv->i2c_algo.udelay = 5;
1082
1083 if (itv->std == 0) { 1079 if (itv->std == 0) {
1084 itv->std = V4L2_STD_NTSC_M; 1080 itv->std = V4L2_STD_NTSC_M;
1085 } 1081 }
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index 4fd187ac9d70..4f0a9157ecb1 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -1202,9 +1202,8 @@ static int saa7134_suspend(struct pci_dev *pci_dev , pm_message_t state)
1202 1202
1203static int saa7134_resume(struct pci_dev *pci_dev) 1203static int saa7134_resume(struct pci_dev *pci_dev)
1204{ 1204{
1205
1206 struct saa7134_dev *dev = pci_get_drvdata(pci_dev); 1205 struct saa7134_dev *dev = pci_get_drvdata(pci_dev);
1207 unsigned int flags; 1206 unsigned long flags;
1208 1207
1209 pci_restore_state(pci_dev); 1208 pci_restore_state(pci_dev);
1210 pci_set_power_state(pci_dev, PCI_D0); 1209 pci_set_power_state(pci_dev, PCI_D0);
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index a9eb1c516247..1707f98c322c 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -1504,9 +1504,12 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
1504 int ret, wbufsize, word_gap, words; 1504 int ret, wbufsize, word_gap, words;
1505 const struct kvec *vec; 1505 const struct kvec *vec;
1506 unsigned long vec_seek; 1506 unsigned long vec_seek;
1507 unsigned long initial_adr;
1508 int initial_len = len;
1507 1509
1508 wbufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize; 1510 wbufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize;
1509 adr += chip->start; 1511 adr += chip->start;
1512 initial_adr = adr;
1510 cmd_adr = adr & ~(wbufsize-1); 1513 cmd_adr = adr & ~(wbufsize-1);
1511 1514
1512 /* Let's determine this according to the interleave only once */ 1515 /* Let's determine this according to the interleave only once */
@@ -1519,7 +1522,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
1519 return ret; 1522 return ret;
1520 } 1523 }
1521 1524
1522 XIP_INVAL_CACHED_RANGE(map, adr, len); 1525 XIP_INVAL_CACHED_RANGE(map, initial_adr, initial_len);
1523 ENABLE_VPP(map); 1526 ENABLE_VPP(map);
1524 xip_disable(map, chip, cmd_adr); 1527 xip_disable(map, chip, cmd_adr);
1525 1528
@@ -1610,7 +1613,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
1610 chip->state = FL_WRITING; 1613 chip->state = FL_WRITING;
1611 1614
1612 ret = INVAL_CACHE_AND_WAIT(map, chip, cmd_adr, 1615 ret = INVAL_CACHE_AND_WAIT(map, chip, cmd_adr,
1613 adr, len, 1616 initial_adr, initial_len,
1614 chip->buffer_write_time); 1617 chip->buffer_write_time);
1615 if (ret) { 1618 if (ret) {
1616 map_write(map, CMD(0x70), cmd_adr); 1619 map_write(map, CMD(0x70), cmd_adr);
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c
index edda6e10ebe5..8fafac987e0b 100644
--- a/drivers/net/3c509.c
+++ b/drivers/net/3c509.c
@@ -385,6 +385,7 @@ static int __init el3_probe(int card_idx)
385#if defined(__ISAPNP__) 385#if defined(__ISAPNP__)
386 static int pnp_cards; 386 static int pnp_cards;
387 struct pnp_dev *idev = NULL; 387 struct pnp_dev *idev = NULL;
388 int pnp_found = 0;
388 389
389 if (nopnp == 1) 390 if (nopnp == 1)
390 goto no_pnp; 391 goto no_pnp;
@@ -430,6 +431,7 @@ __again:
430 pnp_cards++; 431 pnp_cards++;
431 432
432 netdev_boot_setup_check(dev); 433 netdev_boot_setup_check(dev);
434 pnp_found = 1;
433 goto found; 435 goto found;
434 } 436 }
435 } 437 }
@@ -560,6 +562,8 @@ no_pnp:
560 lp = netdev_priv(dev); 562 lp = netdev_priv(dev);
561#if defined(__ISAPNP__) 563#if defined(__ISAPNP__)
562 lp->dev = &idev->dev; 564 lp->dev = &idev->dev;
565 if (pnp_found)
566 lp->type = EL3_PNP;
563#endif 567#endif
564 err = el3_common_init(dev); 568 err = el3_common_init(dev);
565 569
diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c
index 275e7510ebaf..684bab781015 100644
--- a/drivers/net/3c515.c
+++ b/drivers/net/3c515.c
@@ -243,14 +243,16 @@ enum eeprom_offset {
243enum Window3 { /* Window 3: MAC/config bits. */ 243enum Window3 { /* Window 3: MAC/config bits. */
244 Wn3_Config = 0, Wn3_MAC_Ctrl = 6, Wn3_Options = 8, 244 Wn3_Config = 0, Wn3_MAC_Ctrl = 6, Wn3_Options = 8,
245}; 245};
246union wn3_config { 246enum wn3_config {
247 int i; 247 Ram_size = 7,
248 struct w3_config_fields { 248 Ram_width = 8,
249 unsigned int ram_size:3, ram_width:1, ram_speed:2, rom_size:2; 249 Ram_speed = 0x30,
250 int pad8:8; 250 Rom_size = 0xc0,
251 unsigned int ram_split:2, pad18:2, xcvr:3, pad21:1, autoselect:1; 251 Ram_split_shift = 16,
252 int pad24:7; 252 Ram_split = 3 << Ram_split_shift,
253 } u; 253 Xcvr_shift = 20,
254 Xcvr = 7 << Xcvr_shift,
255 Autoselect = 0x1000000,
254}; 256};
255 257
256enum Window4 { 258enum Window4 {
@@ -614,7 +616,7 @@ static int corkscrew_setup(struct net_device *dev, int ioaddr,
614 /* Read the station address from the EEPROM. */ 616 /* Read the station address from the EEPROM. */
615 EL3WINDOW(0); 617 EL3WINDOW(0);
616 for (i = 0; i < 0x18; i++) { 618 for (i = 0; i < 0x18; i++) {
617 short *phys_addr = (short *) dev->dev_addr; 619 __be16 *phys_addr = (__be16 *) dev->dev_addr;
618 int timer; 620 int timer;
619 outw(EEPROM_Read + i, ioaddr + Wn0EepromCmd); 621 outw(EEPROM_Read + i, ioaddr + Wn0EepromCmd);
620 /* Pause for at least 162 us. for the read to take place. */ 622 /* Pause for at least 162 us. for the read to take place. */
@@ -646,22 +648,22 @@ static int corkscrew_setup(struct net_device *dev, int ioaddr,
646 648
647 { 649 {
648 char *ram_split[] = { "5:3", "3:1", "1:1", "3:5" }; 650 char *ram_split[] = { "5:3", "3:1", "1:1", "3:5" };
649 union wn3_config config; 651 __u32 config;
650 EL3WINDOW(3); 652 EL3WINDOW(3);
651 vp->available_media = inw(ioaddr + Wn3_Options); 653 vp->available_media = inw(ioaddr + Wn3_Options);
652 config.i = inl(ioaddr + Wn3_Config); 654 config = inl(ioaddr + Wn3_Config);
653 if (corkscrew_debug > 1) 655 if (corkscrew_debug > 1)
654 printk(KERN_INFO " Internal config register is %4.4x, transceivers %#x.\n", 656 printk(KERN_INFO " Internal config register is %4.4x, transceivers %#x.\n",
655 config.i, inw(ioaddr + Wn3_Options)); 657 config, inw(ioaddr + Wn3_Options));
656 printk(KERN_INFO " %dK %s-wide RAM %s Rx:Tx split, %s%s interface.\n", 658 printk(KERN_INFO " %dK %s-wide RAM %s Rx:Tx split, %s%s interface.\n",
657 8 << config.u.ram_size, 659 8 << config & Ram_size,
658 config.u.ram_width ? "word" : "byte", 660 config & Ram_width ? "word" : "byte",
659 ram_split[config.u.ram_split], 661 ram_split[(config & Ram_split) >> Ram_split_shift],
660 config.u.autoselect ? "autoselect/" : "", 662 config & Autoselect ? "autoselect/" : "",
661 media_tbl[config.u.xcvr].name); 663 media_tbl[(config & Xcvr) >> Xcvr_shift].name);
662 dev->if_port = config.u.xcvr; 664 vp->default_media = (config & Xcvr) >> Xcvr_shift;
663 vp->default_media = config.u.xcvr; 665 vp->autoselect = config & Autoselect ? 1 : 0;
664 vp->autoselect = config.u.autoselect; 666 dev->if_port = vp->default_media;
665 } 667 }
666 if (vp->media_override != 7) { 668 if (vp->media_override != 7) {
667 printk(KERN_INFO " Media override to transceiver type %d (%s).\n", 669 printk(KERN_INFO " Media override to transceiver type %d (%s).\n",
@@ -694,14 +696,14 @@ static int corkscrew_open(struct net_device *dev)
694{ 696{
695 int ioaddr = dev->base_addr; 697 int ioaddr = dev->base_addr;
696 struct corkscrew_private *vp = netdev_priv(dev); 698 struct corkscrew_private *vp = netdev_priv(dev);
697 union wn3_config config; 699 __u32 config;
698 int i; 700 int i;
699 701
700 /* Before initializing select the active media port. */ 702 /* Before initializing select the active media port. */
701 EL3WINDOW(3); 703 EL3WINDOW(3);
702 if (vp->full_duplex) 704 if (vp->full_duplex)
703 outb(0x20, ioaddr + Wn3_MAC_Ctrl); /* Set the full-duplex bit. */ 705 outb(0x20, ioaddr + Wn3_MAC_Ctrl); /* Set the full-duplex bit. */
704 config.i = inl(ioaddr + Wn3_Config); 706 config = inl(ioaddr + Wn3_Config);
705 707
706 if (vp->media_override != 7) { 708 if (vp->media_override != 7) {
707 if (corkscrew_debug > 1) 709 if (corkscrew_debug > 1)
@@ -727,12 +729,12 @@ static int corkscrew_open(struct net_device *dev)
727 } else 729 } else
728 dev->if_port = vp->default_media; 730 dev->if_port = vp->default_media;
729 731
730 config.u.xcvr = dev->if_port; 732 config = (config & ~Xcvr) | (dev->if_port << Xcvr_shift);
731 outl(config.i, ioaddr + Wn3_Config); 733 outl(config, ioaddr + Wn3_Config);
732 734
733 if (corkscrew_debug > 1) { 735 if (corkscrew_debug > 1) {
734 printk("%s: corkscrew_open() InternalConfig %8.8x.\n", 736 printk("%s: corkscrew_open() InternalConfig %8.8x.\n",
735 dev->name, config.i); 737 dev->name, config);
736 } 738 }
737 739
738 outw(TxReset, ioaddr + EL3_CMD); 740 outw(TxReset, ioaddr + EL3_CMD);
@@ -901,7 +903,7 @@ static void corkscrew_timer(unsigned long data)
901 ok = 1; 903 ok = 1;
902 } 904 }
903 if (!ok) { 905 if (!ok) {
904 union wn3_config config; 906 __u32 config;
905 907
906 do { 908 do {
907 dev->if_port = 909 dev->if_port =
@@ -928,9 +930,9 @@ static void corkscrew_timer(unsigned long data)
928 ioaddr + Wn4_Media); 930 ioaddr + Wn4_Media);
929 931
930 EL3WINDOW(3); 932 EL3WINDOW(3);
931 config.i = inl(ioaddr + Wn3_Config); 933 config = inl(ioaddr + Wn3_Config);
932 config.u.xcvr = dev->if_port; 934 config = (config & ~Xcvr) | (dev->if_port << Xcvr_shift);
933 outl(config.i, ioaddr + Wn3_Config); 935 outl(config, ioaddr + Wn3_Config);
934 936
935 outw(dev->if_port == 3 ? StartCoax : StopCoax, 937 outw(dev->if_port == 3 ? StartCoax : StopCoax,
936 ioaddr + EL3_CMD); 938 ioaddr + EL3_CMD);
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index d9107e542dfa..9ae3166e3162 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -166,16 +166,6 @@ config NET_SB1000
166 166
167 If you don't have this card, of course say N. 167 If you don't have this card, of course say N.
168 168
169config IP1000
170 tristate "IP1000 Gigabit Ethernet support"
171 depends on PCI && EXPERIMENTAL
172 select MII
173 ---help---
174 This driver supports IP1000 gigabit Ethernet cards.
175
176 To compile this driver as a module, choose M here: the module
177 will be called ipg. This is recommended.
178
179source "drivers/net/arcnet/Kconfig" 169source "drivers/net/arcnet/Kconfig"
180 170
181source "drivers/net/phy/Kconfig" 171source "drivers/net/phy/Kconfig"
@@ -1986,12 +1976,19 @@ config E1000E
1986 1976
1987 <http://support.intel.com> 1977 <http://support.intel.com>
1988 1978
1989 More specific information on configuring the driver is in
1990 <file:Documentation/networking/e1000e.txt>.
1991
1992 To compile this driver as a module, choose M here. The module 1979 To compile this driver as a module, choose M here. The module
1993 will be called e1000e. 1980 will be called e1000e.
1994 1981
1982config IP1000
1983 tristate "IP1000 Gigabit Ethernet support"
1984 depends on PCI && EXPERIMENTAL
1985 select MII
1986 ---help---
1987 This driver supports IP1000 gigabit Ethernet cards.
1988
1989 To compile this driver as a module, choose M here: the module
1990 will be called ipg. This is recommended.
1991
1995source "drivers/net/ixp2000/Kconfig" 1992source "drivers/net/ixp2000/Kconfig"
1996 1993
1997config MYRI_SBUS 1994config MYRI_SBUS
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 35b0a7dd4ef4..9200ee59d854 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -120,7 +120,7 @@ static int __devinit atl1_sw_init(struct atl1_adapter *adapter)
120 struct atl1_hw *hw = &adapter->hw; 120 struct atl1_hw *hw = &adapter->hw;
121 struct net_device *netdev = adapter->netdev; 121 struct net_device *netdev = adapter->netdev;
122 122
123 hw->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; 123 hw->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
124 hw->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; 124 hw->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
125 125
126 adapter->wol = 0; 126 adapter->wol = 0;
@@ -688,7 +688,7 @@ static int atl1_change_mtu(struct net_device *netdev, int new_mtu)
688{ 688{
689 struct atl1_adapter *adapter = netdev_priv(netdev); 689 struct atl1_adapter *adapter = netdev_priv(netdev);
690 int old_mtu = netdev->mtu; 690 int old_mtu = netdev->mtu;
691 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; 691 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
692 692
693 if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) || 693 if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) ||
694 (max_frame > MAX_JUMBO_FRAME_SIZE)) { 694 (max_frame > MAX_JUMBO_FRAME_SIZE)) {
@@ -853,8 +853,8 @@ static u32 atl1_configure(struct atl1_adapter *adapter)
853 /* set Interrupt Clear Timer */ 853 /* set Interrupt Clear Timer */
854 iowrite16(adapter->ict, hw->hw_addr + REG_CMBDISDMA_TIMER); 854 iowrite16(adapter->ict, hw->hw_addr + REG_CMBDISDMA_TIMER);
855 855
856 /* set MTU, 4 : VLAN */ 856 /* set max frame size hw will accept */
857 iowrite32(hw->max_frame_size + 4, hw->hw_addr + REG_MTU); 857 iowrite32(hw->max_frame_size, hw->hw_addr + REG_MTU);
858 858
859 /* jumbo size & rrd retirement timer */ 859 /* jumbo size & rrd retirement timer */
860 value = (((u32) hw->rx_jumbo_th & RXQ_JMBOSZ_TH_MASK) 860 value = (((u32) hw->rx_jumbo_th & RXQ_JMBOSZ_TH_MASK)
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 25b8dbf6cfd7..b57bc9467dbe 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -979,7 +979,7 @@ static void alb_swap_mac_addr(struct bonding *bond, struct slave *slave1, struct
979/* 979/*
980 * Send learning packets after MAC address swap. 980 * Send learning packets after MAC address swap.
981 * 981 *
982 * Called with RTNL and bond->lock held for read. 982 * Called with RTNL and no other locks
983 */ 983 */
984static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1, 984static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
985 struct slave *slave2) 985 struct slave *slave2)
@@ -987,6 +987,8 @@ static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
987 int slaves_state_differ = (SLAVE_IS_OK(slave1) != SLAVE_IS_OK(slave2)); 987 int slaves_state_differ = (SLAVE_IS_OK(slave1) != SLAVE_IS_OK(slave2));
988 struct slave *disabled_slave = NULL; 988 struct slave *disabled_slave = NULL;
989 989
990 ASSERT_RTNL();
991
990 /* fasten the change in the switch */ 992 /* fasten the change in the switch */
991 if (SLAVE_IS_OK(slave1)) { 993 if (SLAVE_IS_OK(slave1)) {
992 alb_send_learning_packets(slave1, slave1->dev->dev_addr); 994 alb_send_learning_packets(slave1, slave1->dev->dev_addr);
@@ -1031,7 +1033,7 @@ static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
1031 * a slave that has @slave's permanet address as its current address. 1033 * a slave that has @slave's permanet address as its current address.
1032 * We'll make sure that that slave no longer uses @slave's permanent address. 1034 * We'll make sure that that slave no longer uses @slave's permanent address.
1033 * 1035 *
1034 * Caller must hold bond lock 1036 * Caller must hold RTNL and no other locks
1035 */ 1037 */
1036static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *slave) 1038static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *slave)
1037{ 1039{
@@ -1542,7 +1544,12 @@ int bond_alb_init_slave(struct bonding *bond, struct slave *slave)
1542 return 0; 1544 return 0;
1543} 1545}
1544 1546
1545/* Caller must hold bond lock for write */ 1547/*
1548 * Remove slave from tlb and rlb hash tables, and fix up MAC addresses
1549 * if necessary.
1550 *
1551 * Caller must hold RTNL and no other locks
1552 */
1546void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave) 1553void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave)
1547{ 1554{
1548 if (bond->slave_cnt > 1) { 1555 if (bond->slave_cnt > 1) {
@@ -1601,9 +1608,6 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
1601 struct slave *swap_slave; 1608 struct slave *swap_slave;
1602 int i; 1609 int i;
1603 1610
1604 if (new_slave)
1605 ASSERT_RTNL();
1606
1607 if (bond->curr_active_slave == new_slave) { 1611 if (bond->curr_active_slave == new_slave) {
1608 return; 1612 return;
1609 } 1613 }
@@ -1649,6 +1653,8 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
1649 write_unlock_bh(&bond->curr_slave_lock); 1653 write_unlock_bh(&bond->curr_slave_lock);
1650 read_unlock(&bond->lock); 1654 read_unlock(&bond->lock);
1651 1655
1656 ASSERT_RTNL();
1657
1652 /* curr_active_slave must be set before calling alb_swap_mac_addr */ 1658 /* curr_active_slave must be set before calling alb_swap_mac_addr */
1653 if (swap_slave) { 1659 if (swap_slave) {
1654 /* swap mac address */ 1660 /* swap mac address */
@@ -1659,12 +1665,11 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
1659 bond->alb_info.rlb_enabled); 1665 bond->alb_info.rlb_enabled);
1660 } 1666 }
1661 1667
1662 read_lock(&bond->lock);
1663
1664 if (swap_slave) { 1668 if (swap_slave) {
1665 alb_fasten_mac_swap(bond, swap_slave, new_slave); 1669 alb_fasten_mac_swap(bond, swap_slave, new_slave);
1670 read_lock(&bond->lock);
1666 } else { 1671 } else {
1667 /* fasten bond mac on new current slave */ 1672 read_lock(&bond->lock);
1668 alb_send_learning_packets(new_slave, bond->dev->dev_addr); 1673 alb_send_learning_packets(new_slave, bond->dev->dev_addr);
1669 } 1674 }
1670 1675
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index b0b26036266b..49a198206e3d 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1746,7 +1746,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1746 * has been cleared (if our_slave == old_current), 1746 * has been cleared (if our_slave == old_current),
1747 * but before a new active slave is selected. 1747 * but before a new active slave is selected.
1748 */ 1748 */
1749 write_unlock_bh(&bond->lock);
1749 bond_alb_deinit_slave(bond, slave); 1750 bond_alb_deinit_slave(bond, slave);
1751 write_lock_bh(&bond->lock);
1750 } 1752 }
1751 1753
1752 if (oldcurrent == slave) { 1754 if (oldcurrent == slave) {
@@ -1905,6 +1907,12 @@ static int bond_release_all(struct net_device *bond_dev)
1905 slave_dev = slave->dev; 1907 slave_dev = slave->dev;
1906 bond_detach_slave(bond, slave); 1908 bond_detach_slave(bond, slave);
1907 1909
1910 /* now that the slave is detached, unlock and perform
1911 * all the undo steps that should not be called from
1912 * within a lock.
1913 */
1914 write_unlock_bh(&bond->lock);
1915
1908 if ((bond->params.mode == BOND_MODE_TLB) || 1916 if ((bond->params.mode == BOND_MODE_TLB) ||
1909 (bond->params.mode == BOND_MODE_ALB)) { 1917 (bond->params.mode == BOND_MODE_ALB)) {
1910 /* must be called only after the slave 1918 /* must be called only after the slave
@@ -1915,12 +1923,6 @@ static int bond_release_all(struct net_device *bond_dev)
1915 1923
1916 bond_compute_features(bond); 1924 bond_compute_features(bond);
1917 1925
1918 /* now that the slave is detached, unlock and perform
1919 * all the undo steps that should not be called from
1920 * within a lock.
1921 */
1922 write_unlock_bh(&bond->lock);
1923
1924 bond_destroy_slave_symlinks(bond_dev, slave_dev); 1926 bond_destroy_slave_symlinks(bond_dev, slave_dev);
1925 bond_del_vlans_from_slave(bond, slave_dev); 1927 bond_del_vlans_from_slave(bond, slave_dev);
1926 1928
@@ -2384,7 +2386,9 @@ void bond_mii_monitor(struct work_struct *work)
2384 rtnl_lock(); 2386 rtnl_lock();
2385 read_lock(&bond->lock); 2387 read_lock(&bond->lock);
2386 __bond_mii_monitor(bond, 1); 2388 __bond_mii_monitor(bond, 1);
2387 rtnl_unlock(); 2389 read_unlock(&bond->lock);
2390 rtnl_unlock(); /* might sleep, hold no other locks */
2391 read_lock(&bond->lock);
2388 } 2392 }
2389 2393
2390 delay = ((bond->params.miimon * HZ) / 1000) ? : 1; 2394 delay = ((bond->params.miimon * HZ) / 1000) ? : 1;
@@ -3399,9 +3403,7 @@ static int bond_master_netdev_event(unsigned long event, struct net_device *bond
3399 case NETDEV_CHANGENAME: 3403 case NETDEV_CHANGENAME:
3400 return bond_event_changename(event_bond); 3404 return bond_event_changename(event_bond);
3401 case NETDEV_UNREGISTER: 3405 case NETDEV_UNREGISTER:
3402 /* 3406 bond_release_all(event_bond->dev);
3403 * TODO: remove a bond from the list?
3404 */
3405 break; 3407 break;
3406 default: 3408 default:
3407 break; 3409 break;
@@ -4540,18 +4542,27 @@ static void bond_free_all(void)
4540 4542
4541/* 4543/*
4542 * Convert string input module parms. Accept either the 4544 * Convert string input module parms. Accept either the
4543 * number of the mode or its string name. 4545 * number of the mode or its string name. A bit complicated because
4546 * some mode names are substrings of other names, and calls from sysfs
4547 * may have whitespace in the name (trailing newlines, for example).
4544 */ 4548 */
4545int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl) 4549int bond_parse_parm(const char *buf, struct bond_parm_tbl *tbl)
4546{ 4550{
4547 int i; 4551 int mode = -1, i, rv;
4552 char modestr[BOND_MAX_MODENAME_LEN + 1] = { 0, };
4553
4554 rv = sscanf(buf, "%d", &mode);
4555 if (!rv) {
4556 rv = sscanf(buf, "%20s", modestr);
4557 if (!rv)
4558 return -1;
4559 }
4548 4560
4549 for (i = 0; tbl[i].modename; i++) { 4561 for (i = 0; tbl[i].modename; i++) {
4550 if ((isdigit(*mode_arg) && 4562 if (mode == tbl[i].mode)
4551 tbl[i].mode == simple_strtol(mode_arg, NULL, 0)) || 4563 return tbl[i].mode;
4552 (strcmp(mode_arg, tbl[i].modename) == 0)) { 4564 if (strcmp(modestr, tbl[i].modename) == 0)
4553 return tbl[i].mode; 4565 return tbl[i].mode;
4554 }
4555 } 4566 }
4556 4567
4557 return -1; 4568 return -1;
@@ -4865,9 +4876,22 @@ static struct lock_class_key bonding_netdev_xmit_lock_key;
4865int bond_create(char *name, struct bond_params *params, struct bonding **newbond) 4876int bond_create(char *name, struct bond_params *params, struct bonding **newbond)
4866{ 4877{
4867 struct net_device *bond_dev; 4878 struct net_device *bond_dev;
4879 struct bonding *bond, *nxt;
4868 int res; 4880 int res;
4869 4881
4870 rtnl_lock(); 4882 rtnl_lock();
4883 down_write(&bonding_rwsem);
4884
4885 /* Check to see if the bond already exists. */
4886 list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
4887 if (strnicmp(bond->dev->name, name, IFNAMSIZ) == 0) {
4888 printk(KERN_ERR DRV_NAME
4889 ": cannot add bond %s; it already exists\n",
4890 name);
4891 res = -EPERM;
4892 goto out_rtnl;
4893 }
4894
4871 bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "", 4895 bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "",
4872 ether_setup); 4896 ether_setup);
4873 if (!bond_dev) { 4897 if (!bond_dev) {
@@ -4906,10 +4930,12 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond
4906 4930
4907 netif_carrier_off(bond_dev); 4931 netif_carrier_off(bond_dev);
4908 4932
4933 up_write(&bonding_rwsem);
4909 rtnl_unlock(); /* allows sysfs registration of net device */ 4934 rtnl_unlock(); /* allows sysfs registration of net device */
4910 res = bond_create_sysfs_entry(bond_dev->priv); 4935 res = bond_create_sysfs_entry(bond_dev->priv);
4911 if (res < 0) { 4936 if (res < 0) {
4912 rtnl_lock(); 4937 rtnl_lock();
4938 down_write(&bonding_rwsem);
4913 goto out_bond; 4939 goto out_bond;
4914 } 4940 }
4915 4941
@@ -4920,6 +4946,7 @@ out_bond:
4920out_netdev: 4946out_netdev:
4921 free_netdev(bond_dev); 4947 free_netdev(bond_dev);
4922out_rtnl: 4948out_rtnl:
4949 up_write(&bonding_rwsem);
4923 rtnl_unlock(); 4950 rtnl_unlock();
4924 return res; 4951 return res;
4925} 4952}
@@ -4940,6 +4967,9 @@ static int __init bonding_init(void)
4940#ifdef CONFIG_PROC_FS 4967#ifdef CONFIG_PROC_FS
4941 bond_create_proc_dir(); 4968 bond_create_proc_dir();
4942#endif 4969#endif
4970
4971 init_rwsem(&bonding_rwsem);
4972
4943 for (i = 0; i < max_bonds; i++) { 4973 for (i = 0; i < max_bonds; i++) {
4944 res = bond_create(NULL, &bonding_defaults, NULL); 4974 res = bond_create(NULL, &bonding_defaults, NULL);
4945 if (res) 4975 if (res)
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 11b76b352415..90a1f31e8e63 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -109,11 +109,10 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t
109{ 109{
110 char command[IFNAMSIZ + 1] = {0, }; 110 char command[IFNAMSIZ + 1] = {0, };
111 char *ifname; 111 char *ifname;
112 int res = count; 112 int rv, res = count;
113 struct bonding *bond; 113 struct bonding *bond;
114 struct bonding *nxt; 114 struct bonding *nxt;
115 115
116 down_write(&(bonding_rwsem));
117 sscanf(buffer, "%16s", command); /* IFNAMSIZ*/ 116 sscanf(buffer, "%16s", command); /* IFNAMSIZ*/
118 ifname = command + 1; 117 ifname = command + 1;
119 if ((strlen(command) <= 1) || 118 if ((strlen(command) <= 1) ||
@@ -121,39 +120,28 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t
121 goto err_no_cmd; 120 goto err_no_cmd;
122 121
123 if (command[0] == '+') { 122 if (command[0] == '+') {
124
125 /* Check to see if the bond already exists. */
126 list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
127 if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) {
128 printk(KERN_ERR DRV_NAME
129 ": cannot add bond %s; it already exists\n",
130 ifname);
131 res = -EPERM;
132 goto out;
133 }
134
135 printk(KERN_INFO DRV_NAME 123 printk(KERN_INFO DRV_NAME
136 ": %s is being created...\n", ifname); 124 ": %s is being created...\n", ifname);
137 if (bond_create(ifname, &bonding_defaults, &bond)) { 125 rv = bond_create(ifname, &bonding_defaults, &bond);
138 printk(KERN_INFO DRV_NAME 126 if (rv) {
139 ": %s interface already exists. Bond creation failed.\n", 127 printk(KERN_INFO DRV_NAME ": Bond creation failed.\n");
140 ifname); 128 res = rv;
141 res = -EPERM;
142 } 129 }
143 goto out; 130 goto out;
144 } 131 }
145 132
146 if (command[0] == '-') { 133 if (command[0] == '-') {
134 rtnl_lock();
135 down_write(&bonding_rwsem);
136
147 list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) 137 list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
148 if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) { 138 if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) {
149 rtnl_lock();
150 /* check the ref count on the bond's kobject. 139 /* check the ref count on the bond's kobject.
151 * If it's > expected, then there's a file open, 140 * If it's > expected, then there's a file open,
152 * and we have to fail. 141 * and we have to fail.
153 */ 142 */
154 if (atomic_read(&bond->dev->dev.kobj.kref.refcount) 143 if (atomic_read(&bond->dev->dev.kobj.kref.refcount)
155 > expected_refcount){ 144 > expected_refcount){
156 rtnl_unlock();
157 printk(KERN_INFO DRV_NAME 145 printk(KERN_INFO DRV_NAME
158 ": Unable remove bond %s due to open references.\n", 146 ": Unable remove bond %s due to open references.\n",
159 ifname); 147 ifname);
@@ -164,6 +152,7 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t
164 ": %s is being deleted...\n", 152 ": %s is being deleted...\n",
165 bond->dev->name); 153 bond->dev->name);
166 bond_destroy(bond); 154 bond_destroy(bond);
155 up_write(&bonding_rwsem);
167 rtnl_unlock(); 156 rtnl_unlock();
168 goto out; 157 goto out;
169 } 158 }
@@ -171,6 +160,8 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t
171 printk(KERN_ERR DRV_NAME 160 printk(KERN_ERR DRV_NAME
172 ": unable to delete non-existent bond %s\n", ifname); 161 ": unable to delete non-existent bond %s\n", ifname);
173 res = -ENODEV; 162 res = -ENODEV;
163 up_write(&bonding_rwsem);
164 rtnl_unlock();
174 goto out; 165 goto out;
175 } 166 }
176 167
@@ -183,7 +174,6 @@ err_no_cmd:
183 * get called forever, which is bad. 174 * get called forever, which is bad.
184 */ 175 */
185out: 176out:
186 up_write(&(bonding_rwsem));
187 return res; 177 return res;
188} 178}
189/* class attribute for bond_masters file. This ends up in /sys/class/net */ 179/* class attribute for bond_masters file. This ends up in /sys/class/net */
@@ -271,6 +261,9 @@ static ssize_t bonding_store_slaves(struct device *d,
271 261
272 /* Note: We can't hold bond->lock here, as bond_create grabs it. */ 262 /* Note: We can't hold bond->lock here, as bond_create grabs it. */
273 263
264 rtnl_lock();
265 down_write(&(bonding_rwsem));
266
274 sscanf(buffer, "%16s", command); /* IFNAMSIZ*/ 267 sscanf(buffer, "%16s", command); /* IFNAMSIZ*/
275 ifname = command + 1; 268 ifname = command + 1;
276 if ((strlen(command) <= 1) || 269 if ((strlen(command) <= 1) ||
@@ -336,12 +329,10 @@ static ssize_t bonding_store_slaves(struct device *d,
336 dev->mtu = bond->dev->mtu; 329 dev->mtu = bond->dev->mtu;
337 } 330 }
338 } 331 }
339 rtnl_lock();
340 res = bond_enslave(bond->dev, dev); 332 res = bond_enslave(bond->dev, dev);
341 bond_for_each_slave(bond, slave, i) 333 bond_for_each_slave(bond, slave, i)
342 if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0) 334 if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0)
343 slave->original_mtu = original_mtu; 335 slave->original_mtu = original_mtu;
344 rtnl_unlock();
345 if (res) { 336 if (res) {
346 ret = res; 337 ret = res;
347 } 338 }
@@ -359,12 +350,10 @@ static ssize_t bonding_store_slaves(struct device *d,
359 if (dev) { 350 if (dev) {
360 printk(KERN_INFO DRV_NAME ": %s: Removing slave %s\n", 351 printk(KERN_INFO DRV_NAME ": %s: Removing slave %s\n",
361 bond->dev->name, dev->name); 352 bond->dev->name, dev->name);
362 rtnl_lock();
363 if (bond->setup_by_slave) 353 if (bond->setup_by_slave)
364 res = bond_release_and_destroy(bond->dev, dev); 354 res = bond_release_and_destroy(bond->dev, dev);
365 else 355 else
366 res = bond_release(bond->dev, dev); 356 res = bond_release(bond->dev, dev);
367 rtnl_unlock();
368 if (res) { 357 if (res) {
369 ret = res; 358 ret = res;
370 goto out; 359 goto out;
@@ -389,6 +378,8 @@ err_no_cmd:
389 ret = -EPERM; 378 ret = -EPERM;
390 379
391out: 380out:
381 up_write(&(bonding_rwsem));
382 rtnl_unlock();
392 return ret; 383 return ret;
393} 384}
394 385
@@ -423,7 +414,7 @@ static ssize_t bonding_store_mode(struct device *d,
423 goto out; 414 goto out;
424 } 415 }
425 416
426 new_value = bond_parse_parm((char *)buf, bond_mode_tbl); 417 new_value = bond_parse_parm(buf, bond_mode_tbl);
427 if (new_value < 0) { 418 if (new_value < 0) {
428 printk(KERN_ERR DRV_NAME 419 printk(KERN_ERR DRV_NAME
429 ": %s: Ignoring invalid mode value %.*s.\n", 420 ": %s: Ignoring invalid mode value %.*s.\n",
@@ -478,7 +469,7 @@ static ssize_t bonding_store_xmit_hash(struct device *d,
478 goto out; 469 goto out;
479 } 470 }
480 471
481 new_value = bond_parse_parm((char *)buf, xmit_hashtype_tbl); 472 new_value = bond_parse_parm(buf, xmit_hashtype_tbl);
482 if (new_value < 0) { 473 if (new_value < 0) {
483 printk(KERN_ERR DRV_NAME 474 printk(KERN_ERR DRV_NAME
484 ": %s: Ignoring invalid xmit hash policy value %.*s.\n", 475 ": %s: Ignoring invalid xmit hash policy value %.*s.\n",
@@ -518,7 +509,7 @@ static ssize_t bonding_store_arp_validate(struct device *d,
518 int new_value; 509 int new_value;
519 struct bonding *bond = to_bond(d); 510 struct bonding *bond = to_bond(d);
520 511
521 new_value = bond_parse_parm((char *)buf, arp_validate_tbl); 512 new_value = bond_parse_parm(buf, arp_validate_tbl);
522 if (new_value < 0) { 513 if (new_value < 0) {
523 printk(KERN_ERR DRV_NAME 514 printk(KERN_ERR DRV_NAME
524 ": %s: Ignoring invalid arp_validate value %s\n", 515 ": %s: Ignoring invalid arp_validate value %s\n",
@@ -941,7 +932,7 @@ static ssize_t bonding_store_lacp(struct device *d,
941 goto out; 932 goto out;
942 } 933 }
943 934
944 new_value = bond_parse_parm((char *)buf, bond_lacp_tbl); 935 new_value = bond_parse_parm(buf, bond_lacp_tbl);
945 936
946 if ((new_value == 1) || (new_value == 0)) { 937 if ((new_value == 1) || (new_value == 0)) {
947 bond->params.lacp_fast = new_value; 938 bond->params.lacp_fast = new_value;
@@ -1075,7 +1066,10 @@ static ssize_t bonding_store_primary(struct device *d,
1075 struct slave *slave; 1066 struct slave *slave;
1076 struct bonding *bond = to_bond(d); 1067 struct bonding *bond = to_bond(d);
1077 1068
1078 write_lock_bh(&bond->lock); 1069 rtnl_lock();
1070 read_lock(&bond->lock);
1071 write_lock_bh(&bond->curr_slave_lock);
1072
1079 if (!USES_PRIMARY(bond->params.mode)) { 1073 if (!USES_PRIMARY(bond->params.mode)) {
1080 printk(KERN_INFO DRV_NAME 1074 printk(KERN_INFO DRV_NAME
1081 ": %s: Unable to set primary slave; %s is in mode %d\n", 1075 ": %s: Unable to set primary slave; %s is in mode %d\n",
@@ -1109,8 +1103,8 @@ static ssize_t bonding_store_primary(struct device *d,
1109 } 1103 }
1110 } 1104 }
1111out: 1105out:
1112 write_unlock_bh(&bond->lock); 1106 write_unlock_bh(&bond->curr_slave_lock);
1113 1107 read_unlock(&bond->lock);
1114 rtnl_unlock(); 1108 rtnl_unlock();
1115 1109
1116 return count; 1110 return count;
@@ -1190,7 +1184,8 @@ static ssize_t bonding_store_active_slave(struct device *d,
1190 struct bonding *bond = to_bond(d); 1184 struct bonding *bond = to_bond(d);
1191 1185
1192 rtnl_lock(); 1186 rtnl_lock();
1193 write_lock_bh(&bond->lock); 1187 read_lock(&bond->lock);
1188 write_lock_bh(&bond->curr_slave_lock);
1194 1189
1195 if (!USES_PRIMARY(bond->params.mode)) { 1190 if (!USES_PRIMARY(bond->params.mode)) {
1196 printk(KERN_INFO DRV_NAME 1191 printk(KERN_INFO DRV_NAME
@@ -1247,7 +1242,8 @@ static ssize_t bonding_store_active_slave(struct device *d,
1247 } 1242 }
1248 } 1243 }
1249out: 1244out:
1250 write_unlock_bh(&bond->lock); 1245 write_unlock_bh(&bond->curr_slave_lock);
1246 read_unlock(&bond->lock);
1251 rtnl_unlock(); 1247 rtnl_unlock();
1252 1248
1253 return count; 1249 return count;
@@ -1418,8 +1414,6 @@ int bond_create_sysfs(void)
1418 int ret = 0; 1414 int ret = 0;
1419 struct bonding *firstbond; 1415 struct bonding *firstbond;
1420 1416
1421 init_rwsem(&bonding_rwsem);
1422
1423 /* get the netdev class pointer */ 1417 /* get the netdev class pointer */
1424 firstbond = container_of(bond_dev_list.next, struct bonding, bond_list); 1418 firstbond = container_of(bond_dev_list.next, struct bonding, bond_list);
1425 if (!firstbond) 1419 if (!firstbond)
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index e1e4734e23ce..6d83be49899a 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -141,6 +141,8 @@ struct bond_parm_tbl {
141 int mode; 141 int mode;
142}; 142};
143 143
144#define BOND_MAX_MODENAME_LEN 20
145
144struct vlan_entry { 146struct vlan_entry {
145 struct list_head vlan_list; 147 struct list_head vlan_list;
146 __be32 vlan_ip; 148 __be32 vlan_ip;
@@ -314,7 +316,7 @@ void bond_mii_monitor(struct work_struct *);
314void bond_loadbalance_arp_mon(struct work_struct *); 316void bond_loadbalance_arp_mon(struct work_struct *);
315void bond_activebackup_arp_mon(struct work_struct *); 317void bond_activebackup_arp_mon(struct work_struct *);
316void bond_set_mode_ops(struct bonding *bond, int mode); 318void bond_set_mode_ops(struct bonding *bond, int mode);
317int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl); 319int bond_parse_parm(const char *mode_arg, struct bond_parm_tbl *tbl);
318void bond_select_active_slave(struct bonding *bond); 320void bond_select_active_slave(struct bonding *bond);
319void bond_change_active_slave(struct bonding *bond, struct slave *new_active); 321void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
320void bond_register_arp(struct bonding *); 322void bond_register_arp(struct bonding *);
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index 6fd95a2c8cec..6e12d48351b8 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -459,7 +459,7 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
459 return NETDEV_TX_OK; 459 return NETDEV_TX_OK;
460 460
461 len = max(skb->len, ETH_ZLEN); 461 len = max(skb->len, ETH_ZLEN);
462 queue = skb->queue_mapping; 462 queue = skb_get_queue_mapping(skb);
463#ifdef CONFIG_NETDEVICES_MULTIQUEUE 463#ifdef CONFIG_NETDEVICES_MULTIQUEUE
464 netif_stop_subqueue(dev, queue); 464 netif_stop_subqueue(dev, queue);
465#else 465#else
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index 47cce9cad30f..e233d04a2132 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -1316,9 +1316,10 @@ rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
1316 ("%02x:cur:%08x next:%08x status:%08x frag1:%08x frag0:%08x", 1316 ("%02x:cur:%08x next:%08x status:%08x frag1:%08x frag0:%08x",
1317 i, 1317 i,
1318 (u32) (np->tx_ring_dma + i * sizeof (*desc)), 1318 (u32) (np->tx_ring_dma + i * sizeof (*desc)),
1319 (u32) desc->next_desc, 1319 (u32)le64_to_cpu(desc->next_desc),
1320 (u32) desc->status, (u32) (desc->fraginfo >> 32), 1320 (u32)le64_to_cpu(desc->status),
1321 (u32) desc->fraginfo); 1321 (u32)(le64_to_cpu(desc->fraginfo) >> 32),
1322 (u32)le64_to_cpu(desc->fraginfo));
1322 printk ("\n"); 1323 printk ("\n");
1323 } 1324 }
1324 printk ("\n"); 1325 printk ("\n");
@@ -1435,7 +1436,7 @@ mii_write (struct net_device *dev, int phy_addr, int reg_num, u16 data)
1435static int 1436static int
1436mii_wait_link (struct net_device *dev, int wait) 1437mii_wait_link (struct net_device *dev, int wait)
1437{ 1438{
1438 BMSR_t bmsr; 1439 __u16 bmsr;
1439 int phy_addr; 1440 int phy_addr;
1440 struct netdev_private *np; 1441 struct netdev_private *np;
1441 1442
@@ -1443,8 +1444,8 @@ mii_wait_link (struct net_device *dev, int wait)
1443 phy_addr = np->phy_addr; 1444 phy_addr = np->phy_addr;
1444 1445
1445 do { 1446 do {
1446 bmsr.image = mii_read (dev, phy_addr, MII_BMSR); 1447 bmsr = mii_read (dev, phy_addr, MII_BMSR);
1447 if (bmsr.bits.link_status) 1448 if (bmsr & MII_BMSR_LINK_STATUS)
1448 return 0; 1449 return 0;
1449 mdelay (1); 1450 mdelay (1);
1450 } while (--wait > 0); 1451 } while (--wait > 0);
@@ -1453,70 +1454,72 @@ mii_wait_link (struct net_device *dev, int wait)
1453static int 1454static int
1454mii_get_media (struct net_device *dev) 1455mii_get_media (struct net_device *dev)
1455{ 1456{
1456 ANAR_t negotiate; 1457 __u16 negotiate;
1457 BMSR_t bmsr; 1458 __u16 bmsr;
1458 BMCR_t bmcr; 1459 __u16 mscr;
1459 MSCR_t mscr; 1460 __u16 mssr;
1460 MSSR_t mssr;
1461 int phy_addr; 1461 int phy_addr;
1462 struct netdev_private *np; 1462 struct netdev_private *np;
1463 1463
1464 np = netdev_priv(dev); 1464 np = netdev_priv(dev);
1465 phy_addr = np->phy_addr; 1465 phy_addr = np->phy_addr;
1466 1466
1467 bmsr.image = mii_read (dev, phy_addr, MII_BMSR); 1467 bmsr = mii_read (dev, phy_addr, MII_BMSR);
1468 if (np->an_enable) { 1468 if (np->an_enable) {
1469 if (!bmsr.bits.an_complete) { 1469 if (!(bmsr & MII_BMSR_AN_COMPLETE)) {
1470 /* Auto-Negotiation not completed */ 1470 /* Auto-Negotiation not completed */
1471 return -1; 1471 return -1;
1472 } 1472 }
1473 negotiate.image = mii_read (dev, phy_addr, MII_ANAR) & 1473 negotiate = mii_read (dev, phy_addr, MII_ANAR) &
1474 mii_read (dev, phy_addr, MII_ANLPAR); 1474 mii_read (dev, phy_addr, MII_ANLPAR);
1475 mscr.image = mii_read (dev, phy_addr, MII_MSCR); 1475 mscr = mii_read (dev, phy_addr, MII_MSCR);
1476 mssr.image = mii_read (dev, phy_addr, MII_MSSR); 1476 mssr = mii_read (dev, phy_addr, MII_MSSR);
1477 if (mscr.bits.media_1000BT_FD & mssr.bits.lp_1000BT_FD) { 1477 if (mscr & MII_MSCR_1000BT_FD && mssr & MII_MSSR_LP_1000BT_FD) {
1478 np->speed = 1000; 1478 np->speed = 1000;
1479 np->full_duplex = 1; 1479 np->full_duplex = 1;
1480 printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n"); 1480 printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n");
1481 } else if (mscr.bits.media_1000BT_HD & mssr.bits.lp_1000BT_HD) { 1481 } else if (mscr & MII_MSCR_1000BT_HD && mssr & MII_MSSR_LP_1000BT_HD) {
1482 np->speed = 1000; 1482 np->speed = 1000;
1483 np->full_duplex = 0; 1483 np->full_duplex = 0;
1484 printk (KERN_INFO "Auto 1000 Mbps, Half duplex\n"); 1484 printk (KERN_INFO "Auto 1000 Mbps, Half duplex\n");
1485 } else if (negotiate.bits.media_100BX_FD) { 1485 } else if (negotiate & MII_ANAR_100BX_FD) {
1486 np->speed = 100; 1486 np->speed = 100;
1487 np->full_duplex = 1; 1487 np->full_duplex = 1;
1488 printk (KERN_INFO "Auto 100 Mbps, Full duplex\n"); 1488 printk (KERN_INFO "Auto 100 Mbps, Full duplex\n");
1489 } else if (negotiate.bits.media_100BX_HD) { 1489 } else if (negotiate & MII_ANAR_100BX_HD) {
1490 np->speed = 100; 1490 np->speed = 100;
1491 np->full_duplex = 0; 1491 np->full_duplex = 0;
1492 printk (KERN_INFO "Auto 100 Mbps, Half duplex\n"); 1492 printk (KERN_INFO "Auto 100 Mbps, Half duplex\n");
1493 } else if (negotiate.bits.media_10BT_FD) { 1493 } else if (negotiate & MII_ANAR_10BT_FD) {
1494 np->speed = 10; 1494 np->speed = 10;
1495 np->full_duplex = 1; 1495 np->full_duplex = 1;
1496 printk (KERN_INFO "Auto 10 Mbps, Full duplex\n"); 1496 printk (KERN_INFO "Auto 10 Mbps, Full duplex\n");
1497 } else if (negotiate.bits.media_10BT_HD) { 1497 } else if (negotiate & MII_ANAR_10BT_HD) {
1498 np->speed = 10; 1498 np->speed = 10;
1499 np->full_duplex = 0; 1499 np->full_duplex = 0;
1500 printk (KERN_INFO "Auto 10 Mbps, Half duplex\n"); 1500 printk (KERN_INFO "Auto 10 Mbps, Half duplex\n");
1501 } 1501 }
1502 if (negotiate.bits.pause) { 1502 if (negotiate & MII_ANAR_PAUSE) {
1503 np->tx_flow &= 1; 1503 np->tx_flow &= 1;
1504 np->rx_flow &= 1; 1504 np->rx_flow &= 1;
1505 } else if (negotiate.bits.asymmetric) { 1505 } else if (negotiate & MII_ANAR_ASYMMETRIC) {
1506 np->tx_flow = 0; 1506 np->tx_flow = 0;
1507 np->rx_flow &= 1; 1507 np->rx_flow &= 1;
1508 } 1508 }
1509 /* else tx_flow, rx_flow = user select */ 1509 /* else tx_flow, rx_flow = user select */
1510 } else { 1510 } else {
1511 bmcr.image = mii_read (dev, phy_addr, MII_BMCR); 1511 __u16 bmcr = mii_read (dev, phy_addr, MII_BMCR);
1512 if (bmcr.bits.speed100 == 1 && bmcr.bits.speed1000 == 0) { 1512 switch (bmcr & (MII_BMCR_SPEED_100 | MII_BMCR_SPEED_1000)) {
1513 case MII_BMCR_SPEED_1000:
1514 printk (KERN_INFO "Operating at 1000 Mbps, ");
1515 break;
1516 case MII_BMCR_SPEED_100:
1513 printk (KERN_INFO "Operating at 100 Mbps, "); 1517 printk (KERN_INFO "Operating at 100 Mbps, ");
1514 } else if (bmcr.bits.speed100 == 0 && bmcr.bits.speed1000 == 0) { 1518 break;
1519 case 0:
1515 printk (KERN_INFO "Operating at 10 Mbps, "); 1520 printk (KERN_INFO "Operating at 10 Mbps, ");
1516 } else if (bmcr.bits.speed100 == 0 && bmcr.bits.speed1000 == 1) {
1517 printk (KERN_INFO "Operating at 1000 Mbps, ");
1518 } 1521 }
1519 if (bmcr.bits.duplex_mode) { 1522 if (bmcr & MII_BMCR_DUPLEX_MODE) {
1520 printk ("Full duplex\n"); 1523 printk ("Full duplex\n");
1521 } else { 1524 } else {
1522 printk ("Half duplex\n"); 1525 printk ("Half duplex\n");
@@ -1537,10 +1540,10 @@ mii_get_media (struct net_device *dev)
1537static int 1540static int
1538mii_set_media (struct net_device *dev) 1541mii_set_media (struct net_device *dev)
1539{ 1542{
1540 PHY_SCR_t pscr; 1543 __u16 pscr;
1541 BMCR_t bmcr; 1544 __u16 bmcr;
1542 BMSR_t bmsr; 1545 __u16 bmsr;
1543 ANAR_t anar; 1546 __u16 anar;
1544 int phy_addr; 1547 int phy_addr;
1545 struct netdev_private *np; 1548 struct netdev_private *np;
1546 np = netdev_priv(dev); 1549 np = netdev_priv(dev);
@@ -1549,76 +1552,77 @@ mii_set_media (struct net_device *dev)
1549 /* Does user set speed? */ 1552 /* Does user set speed? */
1550 if (np->an_enable) { 1553 if (np->an_enable) {
1551 /* Advertise capabilities */ 1554 /* Advertise capabilities */
1552 bmsr.image = mii_read (dev, phy_addr, MII_BMSR); 1555 bmsr = mii_read (dev, phy_addr, MII_BMSR);
1553 anar.image = mii_read (dev, phy_addr, MII_ANAR); 1556 anar = mii_read (dev, phy_addr, MII_ANAR) &
1554 anar.bits.media_100BX_FD = bmsr.bits.media_100BX_FD; 1557 ~MII_ANAR_100BX_FD &
1555 anar.bits.media_100BX_HD = bmsr.bits.media_100BX_HD; 1558 ~MII_ANAR_100BX_HD &
1556 anar.bits.media_100BT4 = bmsr.bits.media_100BT4; 1559 ~MII_ANAR_100BT4 &
1557 anar.bits.media_10BT_FD = bmsr.bits.media_10BT_FD; 1560 ~MII_ANAR_10BT_FD &
1558 anar.bits.media_10BT_HD = bmsr.bits.media_10BT_HD; 1561 ~MII_ANAR_10BT_HD;
1559 anar.bits.pause = 1; 1562 if (bmsr & MII_BMSR_100BX_FD)
1560 anar.bits.asymmetric = 1; 1563 anar |= MII_ANAR_100BX_FD;
1561 mii_write (dev, phy_addr, MII_ANAR, anar.image); 1564 if (bmsr & MII_BMSR_100BX_HD)
1565 anar |= MII_ANAR_100BX_HD;
1566 if (bmsr & MII_BMSR_100BT4)
1567 anar |= MII_ANAR_100BT4;
1568 if (bmsr & MII_BMSR_10BT_FD)
1569 anar |= MII_ANAR_10BT_FD;
1570 if (bmsr & MII_BMSR_10BT_HD)
1571 anar |= MII_ANAR_10BT_HD;
1572 anar |= MII_ANAR_PAUSE | MII_ANAR_ASYMMETRIC;
1573 mii_write (dev, phy_addr, MII_ANAR, anar);
1562 1574
1563 /* Enable Auto crossover */ 1575 /* Enable Auto crossover */
1564 pscr.image = mii_read (dev, phy_addr, MII_PHY_SCR); 1576 pscr = mii_read (dev, phy_addr, MII_PHY_SCR);
1565 pscr.bits.mdi_crossover_mode = 3; /* 11'b */ 1577 pscr |= 3 << 5; /* 11'b */
1566 mii_write (dev, phy_addr, MII_PHY_SCR, pscr.image); 1578 mii_write (dev, phy_addr, MII_PHY_SCR, pscr);
1567 1579
1568 /* Soft reset PHY */ 1580 /* Soft reset PHY */
1569 mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET); 1581 mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET);
1570 bmcr.image = 0; 1582 bmcr = MII_BMCR_AN_ENABLE | MII_BMCR_RESTART_AN | MII_BMCR_RESET;
1571 bmcr.bits.an_enable = 1; 1583 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1572 bmcr.bits.restart_an = 1;
1573 bmcr.bits.reset = 1;
1574 mii_write (dev, phy_addr, MII_BMCR, bmcr.image);
1575 mdelay(1); 1584 mdelay(1);
1576 } else { 1585 } else {
1577 /* Force speed setting */ 1586 /* Force speed setting */
1578 /* 1) Disable Auto crossover */ 1587 /* 1) Disable Auto crossover */
1579 pscr.image = mii_read (dev, phy_addr, MII_PHY_SCR); 1588 pscr = mii_read (dev, phy_addr, MII_PHY_SCR);
1580 pscr.bits.mdi_crossover_mode = 0; 1589 pscr &= ~(3 << 5);
1581 mii_write (dev, phy_addr, MII_PHY_SCR, pscr.image); 1590 mii_write (dev, phy_addr, MII_PHY_SCR, pscr);
1582 1591
1583 /* 2) PHY Reset */ 1592 /* 2) PHY Reset */
1584 bmcr.image = mii_read (dev, phy_addr, MII_BMCR); 1593 bmcr = mii_read (dev, phy_addr, MII_BMCR);
1585 bmcr.bits.reset = 1; 1594 bmcr |= MII_BMCR_RESET;
1586 mii_write (dev, phy_addr, MII_BMCR, bmcr.image); 1595 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1587 1596
1588 /* 3) Power Down */ 1597 /* 3) Power Down */
1589 bmcr.image = 0x1940; /* must be 0x1940 */ 1598 bmcr = 0x1940; /* must be 0x1940 */
1590 mii_write (dev, phy_addr, MII_BMCR, bmcr.image); 1599 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1591 mdelay (100); /* wait a certain time */ 1600 mdelay (100); /* wait a certain time */
1592 1601
1593 /* 4) Advertise nothing */ 1602 /* 4) Advertise nothing */
1594 mii_write (dev, phy_addr, MII_ANAR, 0); 1603 mii_write (dev, phy_addr, MII_ANAR, 0);
1595 1604
1596 /* 5) Set media and Power Up */ 1605 /* 5) Set media and Power Up */
1597 bmcr.image = 0; 1606 bmcr = MII_BMCR_POWER_DOWN;
1598 bmcr.bits.power_down = 1;
1599 if (np->speed == 100) { 1607 if (np->speed == 100) {
1600 bmcr.bits.speed100 = 1; 1608 bmcr |= MII_BMCR_SPEED_100;
1601 bmcr.bits.speed1000 = 0;
1602 printk (KERN_INFO "Manual 100 Mbps, "); 1609 printk (KERN_INFO "Manual 100 Mbps, ");
1603 } else if (np->speed == 10) { 1610 } else if (np->speed == 10) {
1604 bmcr.bits.speed100 = 0;
1605 bmcr.bits.speed1000 = 0;
1606 printk (KERN_INFO "Manual 10 Mbps, "); 1611 printk (KERN_INFO "Manual 10 Mbps, ");
1607 } 1612 }
1608 if (np->full_duplex) { 1613 if (np->full_duplex) {
1609 bmcr.bits.duplex_mode = 1; 1614 bmcr |= MII_BMCR_DUPLEX_MODE;
1610 printk ("Full duplex\n"); 1615 printk ("Full duplex\n");
1611 } else { 1616 } else {
1612 bmcr.bits.duplex_mode = 0;
1613 printk ("Half duplex\n"); 1617 printk ("Half duplex\n");
1614 } 1618 }
1615#if 0 1619#if 0
1616 /* Set 1000BaseT Master/Slave setting */ 1620 /* Set 1000BaseT Master/Slave setting */
1617 mscr.image = mii_read (dev, phy_addr, MII_MSCR); 1621 mscr = mii_read (dev, phy_addr, MII_MSCR);
1618 mscr.bits.cfg_enable = 1; 1622 mscr |= MII_MSCR_CFG_ENABLE;
1619 mscr.bits.cfg_value = 0; 1623 mscr &= ~MII_MSCR_CFG_VALUE = 0;
1620#endif 1624#endif
1621 mii_write (dev, phy_addr, MII_BMCR, bmcr.image); 1625 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1622 mdelay(10); 1626 mdelay(10);
1623 } 1627 }
1624 return 0; 1628 return 0;
@@ -1627,43 +1631,42 @@ mii_set_media (struct net_device *dev)
1627static int 1631static int
1628mii_get_media_pcs (struct net_device *dev) 1632mii_get_media_pcs (struct net_device *dev)
1629{ 1633{
1630 ANAR_PCS_t negotiate; 1634 __u16 negotiate;
1631 BMSR_t bmsr; 1635 __u16 bmsr;
1632 BMCR_t bmcr;
1633 int phy_addr; 1636 int phy_addr;
1634 struct netdev_private *np; 1637 struct netdev_private *np;
1635 1638
1636 np = netdev_priv(dev); 1639 np = netdev_priv(dev);
1637 phy_addr = np->phy_addr; 1640 phy_addr = np->phy_addr;
1638 1641
1639 bmsr.image = mii_read (dev, phy_addr, PCS_BMSR); 1642 bmsr = mii_read (dev, phy_addr, PCS_BMSR);
1640 if (np->an_enable) { 1643 if (np->an_enable) {
1641 if (!bmsr.bits.an_complete) { 1644 if (!(bmsr & MII_BMSR_AN_COMPLETE)) {
1642 /* Auto-Negotiation not completed */ 1645 /* Auto-Negotiation not completed */
1643 return -1; 1646 return -1;
1644 } 1647 }
1645 negotiate.image = mii_read (dev, phy_addr, PCS_ANAR) & 1648 negotiate = mii_read (dev, phy_addr, PCS_ANAR) &
1646 mii_read (dev, phy_addr, PCS_ANLPAR); 1649 mii_read (dev, phy_addr, PCS_ANLPAR);
1647 np->speed = 1000; 1650 np->speed = 1000;
1648 if (negotiate.bits.full_duplex) { 1651 if (negotiate & PCS_ANAR_FULL_DUPLEX) {
1649 printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n"); 1652 printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n");
1650 np->full_duplex = 1; 1653 np->full_duplex = 1;
1651 } else { 1654 } else {
1652 printk (KERN_INFO "Auto 1000 Mbps, half duplex\n"); 1655 printk (KERN_INFO "Auto 1000 Mbps, half duplex\n");
1653 np->full_duplex = 0; 1656 np->full_duplex = 0;
1654 } 1657 }
1655 if (negotiate.bits.pause) { 1658 if (negotiate & PCS_ANAR_PAUSE) {
1656 np->tx_flow &= 1; 1659 np->tx_flow &= 1;
1657 np->rx_flow &= 1; 1660 np->rx_flow &= 1;
1658 } else if (negotiate.bits.asymmetric) { 1661 } else if (negotiate & PCS_ANAR_ASYMMETRIC) {
1659 np->tx_flow = 0; 1662 np->tx_flow = 0;
1660 np->rx_flow &= 1; 1663 np->rx_flow &= 1;
1661 } 1664 }
1662 /* else tx_flow, rx_flow = user select */ 1665 /* else tx_flow, rx_flow = user select */
1663 } else { 1666 } else {
1664 bmcr.image = mii_read (dev, phy_addr, PCS_BMCR); 1667 __u16 bmcr = mii_read (dev, phy_addr, PCS_BMCR);
1665 printk (KERN_INFO "Operating at 1000 Mbps, "); 1668 printk (KERN_INFO "Operating at 1000 Mbps, ");
1666 if (bmcr.bits.duplex_mode) { 1669 if (bmcr & MII_BMCR_DUPLEX_MODE) {
1667 printk ("Full duplex\n"); 1670 printk ("Full duplex\n");
1668 } else { 1671 } else {
1669 printk ("Half duplex\n"); 1672 printk ("Half duplex\n");
@@ -1684,9 +1687,9 @@ mii_get_media_pcs (struct net_device *dev)
1684static int 1687static int
1685mii_set_media_pcs (struct net_device *dev) 1688mii_set_media_pcs (struct net_device *dev)
1686{ 1689{
1687 BMCR_t bmcr; 1690 __u16 bmcr;
1688 ESR_t esr; 1691 __u16 esr;
1689 ANAR_PCS_t anar; 1692 __u16 anar;
1690 int phy_addr; 1693 int phy_addr;
1691 struct netdev_private *np; 1694 struct netdev_private *np;
1692 np = netdev_priv(dev); 1695 np = netdev_priv(dev);
@@ -1695,41 +1698,37 @@ mii_set_media_pcs (struct net_device *dev)
1695 /* Auto-Negotiation? */ 1698 /* Auto-Negotiation? */
1696 if (np->an_enable) { 1699 if (np->an_enable) {
1697 /* Advertise capabilities */ 1700 /* Advertise capabilities */
1698 esr.image = mii_read (dev, phy_addr, PCS_ESR); 1701 esr = mii_read (dev, phy_addr, PCS_ESR);
1699 anar.image = mii_read (dev, phy_addr, MII_ANAR); 1702 anar = mii_read (dev, phy_addr, MII_ANAR) &
1700 anar.bits.half_duplex = 1703 ~PCS_ANAR_HALF_DUPLEX &
1701 esr.bits.media_1000BT_HD | esr.bits.media_1000BX_HD; 1704 ~PCS_ANAR_FULL_DUPLEX;
1702 anar.bits.full_duplex = 1705 if (esr & (MII_ESR_1000BT_HD | MII_ESR_1000BX_HD))
1703 esr.bits.media_1000BT_FD | esr.bits.media_1000BX_FD; 1706 anar |= PCS_ANAR_HALF_DUPLEX;
1704 anar.bits.pause = 1; 1707 if (esr & (MII_ESR_1000BT_FD | MII_ESR_1000BX_FD))
1705 anar.bits.asymmetric = 1; 1708 anar |= PCS_ANAR_FULL_DUPLEX;
1706 mii_write (dev, phy_addr, MII_ANAR, anar.image); 1709 anar |= PCS_ANAR_PAUSE | PCS_ANAR_ASYMMETRIC;
1710 mii_write (dev, phy_addr, MII_ANAR, anar);
1707 1711
1708 /* Soft reset PHY */ 1712 /* Soft reset PHY */
1709 mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET); 1713 mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET);
1710 bmcr.image = 0; 1714 bmcr = MII_BMCR_AN_ENABLE | MII_BMCR_RESTART_AN |
1711 bmcr.bits.an_enable = 1; 1715 MII_BMCR_RESET;
1712 bmcr.bits.restart_an = 1; 1716 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1713 bmcr.bits.reset = 1;
1714 mii_write (dev, phy_addr, MII_BMCR, bmcr.image);
1715 mdelay(1); 1717 mdelay(1);
1716 } else { 1718 } else {
1717 /* Force speed setting */ 1719 /* Force speed setting */
1718 /* PHY Reset */ 1720 /* PHY Reset */
1719 bmcr.image = 0; 1721 bmcr = MII_BMCR_RESET;
1720 bmcr.bits.reset = 1; 1722 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1721 mii_write (dev, phy_addr, MII_BMCR, bmcr.image);
1722 mdelay(10); 1723 mdelay(10);
1723 bmcr.image = 0;
1724 bmcr.bits.an_enable = 0;
1725 if (np->full_duplex) { 1724 if (np->full_duplex) {
1726 bmcr.bits.duplex_mode = 1; 1725 bmcr = MII_BMCR_DUPLEX_MODE;
1727 printk (KERN_INFO "Manual full duplex\n"); 1726 printk (KERN_INFO "Manual full duplex\n");
1728 } else { 1727 } else {
1729 bmcr.bits.duplex_mode = 0; 1728 bmcr = 0;
1730 printk (KERN_INFO "Manual half duplex\n"); 1729 printk (KERN_INFO "Manual half duplex\n");
1731 } 1730 }
1732 mii_write (dev, phy_addr, MII_BMCR, bmcr.image); 1731 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1733 mdelay(10); 1732 mdelay(10);
1734 1733
1735 /* Advertise nothing */ 1734 /* Advertise nothing */
diff --git a/drivers/net/dl2k.h b/drivers/net/dl2k.h
index 014b77ce96df..d66c605b4075 100644
--- a/drivers/net/dl2k.h
+++ b/drivers/net/dl2k.h
@@ -298,23 +298,6 @@ enum _pcs_reg {
298}; 298};
299 299
300/* Basic Mode Control Register */ 300/* Basic Mode Control Register */
301typedef union t_MII_BMCR {
302 u16 image;
303 struct {
304 u16 _bit_5_0:6; // bit 5:0
305 u16 speed1000:1; // bit 6
306 u16 col_test_enable:1; // bit 7
307 u16 duplex_mode:1; // bit 8
308 u16 restart_an:1; // bit 9
309 u16 isolate:1; // bit 10
310 u16 power_down:1; // bit 11
311 u16 an_enable:1; // bit 12
312 u16 speed100:1; // bit 13
313 u16 loopback:1; // bit 14
314 u16 reset:1; // bit 15
315 } bits;
316} BMCR_t, *PBMCR_t;
317
318enum _mii_bmcr { 301enum _mii_bmcr {
319 MII_BMCR_RESET = 0x8000, 302 MII_BMCR_RESET = 0x8000,
320 MII_BMCR_LOOP_BACK = 0x4000, 303 MII_BMCR_LOOP_BACK = 0x4000,
@@ -333,28 +316,6 @@ enum _mii_bmcr {
333}; 316};
334 317
335/* Basic Mode Status Register */ 318/* Basic Mode Status Register */
336typedef union t_MII_BMSR {
337 u16 image;
338 struct {
339 u16 ext_capability:1; // bit 0
340 u16 japper_detect:1; // bit 1
341 u16 link_status:1; // bit 2
342 u16 an_ability:1; // bit 3
343 u16 remote_fault:1; // bit 4
344 u16 an_complete:1; // bit 5
345 u16 preamble_supp:1; // bit 6
346 u16 _bit_7:1; // bit 7
347 u16 ext_status:1; // bit 8
348 u16 media_100BT2_HD:1; // bit 9
349 u16 media_100BT2_FD:1; // bit 10
350 u16 media_10BT_HD:1; // bit 11
351 u16 media_10BT_FD:1; // bit 12
352 u16 media_100BX_HD:1; // bit 13
353 u16 media_100BX_FD:1; // bit 14
354 u16 media_100BT4:1; // bit 15
355 } bits;
356} BMSR_t, *PBMSR_t;
357
358enum _mii_bmsr { 319enum _mii_bmsr {
359 MII_BMSR_100BT4 = 0x8000, 320 MII_BMSR_100BT4 = 0x8000,
360 MII_BMSR_100BX_FD = 0x4000, 321 MII_BMSR_100BX_FD = 0x4000,
@@ -374,24 +335,6 @@ enum _mii_bmsr {
374}; 335};
375 336
376/* ANAR */ 337/* ANAR */
377typedef union t_MII_ANAR {
378 u16 image;
379 struct {
380 u16 selector:5; // bit 4:0
381 u16 media_10BT_HD:1; // bit 5
382 u16 media_10BT_FD:1; // bit 6
383 u16 media_100BX_HD:1; // bit 7
384 u16 media_100BX_FD:1; // bit 8
385 u16 media_100BT4:1; // bit 9
386 u16 pause:1; // bit 10
387 u16 asymmetric:1; // bit 11
388 u16 _bit12:1; // bit 12
389 u16 remote_fault:1; // bit 13
390 u16 _bit14:1; // bit 14
391 u16 next_page:1; // bit 15
392 } bits;
393} ANAR_t, *PANAR_t;
394
395enum _mii_anar { 338enum _mii_anar {
396 MII_ANAR_NEXT_PAGE = 0x8000, 339 MII_ANAR_NEXT_PAGE = 0x8000,
397 MII_ANAR_REMOTE_FAULT = 0x4000, 340 MII_ANAR_REMOTE_FAULT = 0x4000,
@@ -407,24 +350,6 @@ enum _mii_anar {
407}; 350};
408 351
409/* ANLPAR */ 352/* ANLPAR */
410typedef union t_MII_ANLPAR {
411 u16 image;
412 struct {
413 u16 selector:5; // bit 4:0
414 u16 media_10BT_HD:1; // bit 5
415 u16 media_10BT_FD:1; // bit 6
416 u16 media_100BX_HD:1; // bit 7
417 u16 media_100BX_FD:1; // bit 8
418 u16 media_100BT4:1; // bit 9
419 u16 pause:1; // bit 10
420 u16 asymmetric:1; // bit 11
421 u16 _bit12:1; // bit 12
422 u16 remote_fault:1; // bit 13
423 u16 _bit14:1; // bit 14
424 u16 next_page:1; // bit 15
425 } bits;
426} ANLPAR_t, *PANLPAR_t;
427
428enum _mii_anlpar { 353enum _mii_anlpar {
429 MII_ANLPAR_NEXT_PAGE = MII_ANAR_NEXT_PAGE, 354 MII_ANLPAR_NEXT_PAGE = MII_ANAR_NEXT_PAGE,
430 MII_ANLPAR_REMOTE_FAULT = MII_ANAR_REMOTE_FAULT, 355 MII_ANLPAR_REMOTE_FAULT = MII_ANAR_REMOTE_FAULT,
@@ -439,18 +364,6 @@ enum _mii_anlpar {
439}; 364};
440 365
441/* Auto-Negotiation Expansion Register */ 366/* Auto-Negotiation Expansion Register */
442typedef union t_MII_ANER {
443 u16 image;
444 struct {
445 u16 lp_negotiable:1; // bit 0
446 u16 page_received:1; // bit 1
447 u16 nextpagable:1; // bit 2
448 u16 lp_nextpagable:1; // bit 3
449 u16 pdetect_fault:1; // bit 4
450 u16 _bit15_5:11; // bit 15:5
451 } bits;
452} ANER_t, *PANER_t;
453
454enum _mii_aner { 367enum _mii_aner {
455 MII_ANER_PAR_DETECT_FAULT = 0x0010, 368 MII_ANER_PAR_DETECT_FAULT = 0x0010,
456 MII_ANER_LP_NEXTPAGABLE = 0x0008, 369 MII_ANER_LP_NEXTPAGABLE = 0x0008,
@@ -460,19 +373,6 @@ enum _mii_aner {
460}; 373};
461 374
462/* MASTER-SLAVE Control Register */ 375/* MASTER-SLAVE Control Register */
463typedef union t_MII_MSCR {
464 u16 image;
465 struct {
466 u16 _bit_7_0:8; // bit 7:0
467 u16 media_1000BT_HD:1; // bit 8
468 u16 media_1000BT_FD:1; // bit 9
469 u16 port_type:1; // bit 10
470 u16 cfg_value:1; // bit 11
471 u16 cfg_enable:1; // bit 12
472 u16 test_mode:3; // bit 15:13
473 } bits;
474} MSCR_t, *PMSCR_t;
475
476enum _mii_mscr { 376enum _mii_mscr {
477 MII_MSCR_TEST_MODE = 0xe000, 377 MII_MSCR_TEST_MODE = 0xe000,
478 MII_MSCR_CFG_ENABLE = 0x1000, 378 MII_MSCR_CFG_ENABLE = 0x1000,
@@ -483,20 +383,6 @@ enum _mii_mscr {
483}; 383};
484 384
485/* MASTER-SLAVE Status Register */ 385/* MASTER-SLAVE Status Register */
486typedef union t_MII_MSSR {
487 u16 image;
488 struct {
489 u16 idle_err_count:8; // bit 7:0
490 u16 _bit_9_8:2; // bit 9:8
491 u16 lp_1000BT_HD:1; // bit 10
492 u16 lp_1000BT_FD:1; // bit 11
493 u16 remote_rcv_status:1; // bit 12
494 u16 local_rcv_status:1; // bit 13
495 u16 cfg_resolution:1; // bit 14
496 u16 cfg_fault:1; // bit 15
497 } bits;
498} MSSR_t, *PMSSR_t;
499
500enum _mii_mssr { 386enum _mii_mssr {
501 MII_MSSR_CFG_FAULT = 0x8000, 387 MII_MSSR_CFG_FAULT = 0x8000,
502 MII_MSSR_CFG_RES = 0x4000, 388 MII_MSSR_CFG_RES = 0x4000,
@@ -508,17 +394,6 @@ enum _mii_mssr {
508}; 394};
509 395
510/* IEEE Extened Status Register */ 396/* IEEE Extened Status Register */
511typedef union t_MII_ESR {
512 u16 image;
513 struct {
514 u16 _bit_11_0:12; // bit 11:0
515 u16 media_1000BT_HD:2; // bit 12
516 u16 media_1000BT_FD:1; // bit 13
517 u16 media_1000BX_HD:1; // bit 14
518 u16 media_1000BX_FD:1; // bit 15
519 } bits;
520} ESR_t, *PESR_t;
521
522enum _mii_esr { 397enum _mii_esr {
523 MII_ESR_1000BX_FD = 0x8000, 398 MII_ESR_1000BX_FD = 0x8000,
524 MII_ESR_1000BX_HD = 0x4000, 399 MII_ESR_1000BX_HD = 0x4000,
@@ -526,6 +401,7 @@ enum _mii_esr {
526 MII_ESR_1000BT_HD = 0x1000, 401 MII_ESR_1000BT_HD = 0x1000,
527}; 402};
528/* PHY Specific Control Register */ 403/* PHY Specific Control Register */
404#if 0
529typedef union t_MII_PHY_SCR { 405typedef union t_MII_PHY_SCR {
530 u16 image; 406 u16 image;
531 struct { 407 struct {
@@ -543,6 +419,7 @@ typedef union t_MII_PHY_SCR {
543 u16 xmit_fifo_depth:2; // bit 15:14 419 u16 xmit_fifo_depth:2; // bit 15:14
544 } bits; 420 } bits;
545} PHY_SCR_t, *PPHY_SCR_t; 421} PHY_SCR_t, *PPHY_SCR_t;
422#endif
546 423
547typedef enum t_MII_ADMIN_STATUS { 424typedef enum t_MII_ADMIN_STATUS {
548 adm_reset, 425 adm_reset,
@@ -556,21 +433,6 @@ typedef enum t_MII_ADMIN_STATUS {
556/* PCS control and status registers bitmap as the same as MII */ 433/* PCS control and status registers bitmap as the same as MII */
557/* PCS Extended Status register bitmap as the same as MII */ 434/* PCS Extended Status register bitmap as the same as MII */
558/* PCS ANAR */ 435/* PCS ANAR */
559typedef union t_PCS_ANAR {
560 u16 image;
561 struct {
562 u16 _bit_4_0:5; // bit 4:0
563 u16 full_duplex:1; // bit 5
564 u16 half_duplex:1; // bit 6
565 u16 asymmetric:1; // bit 7
566 u16 pause:1; // bit 8
567 u16 _bit_11_9:3; // bit 11:9
568 u16 remote_fault:2; // bit 13:12
569 u16 _bit_14:1; // bit 14
570 u16 next_page:1; // bit 15
571 } bits;
572} ANAR_PCS_t, *PANAR_PCS_t;
573
574enum _pcs_anar { 436enum _pcs_anar {
575 PCS_ANAR_NEXT_PAGE = 0x8000, 437 PCS_ANAR_NEXT_PAGE = 0x8000,
576 PCS_ANAR_REMOTE_FAULT = 0x3000, 438 PCS_ANAR_REMOTE_FAULT = 0x3000,
@@ -580,21 +442,6 @@ enum _pcs_anar {
580 PCS_ANAR_FULL_DUPLEX = 0x0020, 442 PCS_ANAR_FULL_DUPLEX = 0x0020,
581}; 443};
582/* PCS ANLPAR */ 444/* PCS ANLPAR */
583typedef union t_PCS_ANLPAR {
584 u16 image;
585 struct {
586 u16 _bit_4_0:5; // bit 4:0
587 u16 full_duplex:1; // bit 5
588 u16 half_duplex:1; // bit 6
589 u16 asymmetric:1; // bit 7
590 u16 pause:1; // bit 8
591 u16 _bit_11_9:3; // bit 11:9
592 u16 remote_fault:2; // bit 13:12
593 u16 _bit_14:1; // bit 14
594 u16 next_page:1; // bit 15
595 } bits;
596} ANLPAR_PCS_t, *PANLPAR_PCS_t;
597
598enum _pcs_anlpar { 445enum _pcs_anlpar {
599 PCS_ANLPAR_NEXT_PAGE = PCS_ANAR_NEXT_PAGE, 446 PCS_ANLPAR_NEXT_PAGE = PCS_ANAR_NEXT_PAGE,
600 PCS_ANLPAR_REMOTE_FAULT = PCS_ANAR_REMOTE_FAULT, 447 PCS_ANLPAR_REMOTE_FAULT = PCS_ANAR_REMOTE_FAULT,
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 2b06e4b4dabc..b87402bc8308 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1991,13 +1991,12 @@ static int e100_poll(struct napi_struct *napi, int budget)
1991 struct nic *nic = container_of(napi, struct nic, napi); 1991 struct nic *nic = container_of(napi, struct nic, napi);
1992 struct net_device *netdev = nic->netdev; 1992 struct net_device *netdev = nic->netdev;
1993 unsigned int work_done = 0; 1993 unsigned int work_done = 0;
1994 int tx_cleaned;
1995 1994
1996 e100_rx_clean(nic, &work_done, budget); 1995 e100_rx_clean(nic, &work_done, budget);
1997 tx_cleaned = e100_tx_clean(nic); 1996 e100_tx_clean(nic);
1998 1997
1999 /* If no Rx and Tx cleanup work was done, exit polling mode. */ 1998 /* If budget not fully consumed, exit the polling mode */
2000 if((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) { 1999 if (work_done < budget) {
2001 netif_rx_complete(netdev, napi); 2000 netif_rx_complete(netdev, napi);
2002 e100_enable_irq(nic); 2001 e100_enable_irq(nic);
2003 } 2002 }
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4f37506ad374..0c9a6f7104d2 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3924,27 +3924,24 @@ e1000_clean(struct napi_struct *napi, int budget)
3924 /* Must NOT use netdev_priv macro here. */ 3924 /* Must NOT use netdev_priv macro here. */
3925 adapter = poll_dev->priv; 3925 adapter = poll_dev->priv;
3926 3926
3927 /* Keep link state information with original netdev */
3928 if (!netif_carrier_ok(poll_dev))
3929 goto quit_polling;
3930
3931 /* e1000_clean is called per-cpu. This lock protects 3927 /* e1000_clean is called per-cpu. This lock protects
3932 * tx_ring[0] from being cleaned by multiple cpus 3928 * tx_ring[0] from being cleaned by multiple cpus
3933 * simultaneously. A failure obtaining the lock means 3929 * simultaneously. A failure obtaining the lock means
3934 * tx_ring[0] is currently being cleaned anyway. */ 3930 * tx_ring[0] is currently being cleaned anyway. */
3935 if (spin_trylock(&adapter->tx_queue_lock)) { 3931 if (spin_trylock(&adapter->tx_queue_lock)) {
3936 tx_cleaned = e1000_clean_tx_irq(adapter, 3932 tx_cleaned = e1000_clean_tx_irq(adapter,
3937 &adapter->tx_ring[0]); 3933 &adapter->tx_ring[0]);
3938 spin_unlock(&adapter->tx_queue_lock); 3934 spin_unlock(&adapter->tx_queue_lock);
3939 } 3935 }
3940 3936
3941 adapter->clean_rx(adapter, &adapter->rx_ring[0], 3937 adapter->clean_rx(adapter, &adapter->rx_ring[0],
3942 &work_done, budget); 3938 &work_done, budget);
3943 3939
3944 /* If no Tx and not enough Rx work done, exit the polling mode */ 3940 if (tx_cleaned)
3945 if ((!tx_cleaned && (work_done == 0)) || 3941 work_done = budget;
3946 !netif_running(poll_dev)) { 3942
3947quit_polling: 3943 /* If budget not fully consumed, exit the polling mode */
3944 if (work_done < budget) {
3948 if (likely(adapter->itr_setting & 3)) 3945 if (likely(adapter->itr_setting & 3))
3949 e1000_set_itr(adapter); 3946 e1000_set_itr(adapter);
3950 netif_rx_complete(poll_dev, napi); 3947 netif_rx_complete(poll_dev, napi);
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 4fd2e23720b6..2ab3bfbb8a63 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -1389,10 +1389,6 @@ static int e1000_clean(struct napi_struct *napi, int budget)
1389 /* Must NOT use netdev_priv macro here. */ 1389 /* Must NOT use netdev_priv macro here. */
1390 adapter = poll_dev->priv; 1390 adapter = poll_dev->priv;
1391 1391
1392 /* Keep link state information with original netdev */
1393 if (!netif_carrier_ok(poll_dev))
1394 goto quit_polling;
1395
1396 /* e1000_clean is called per-cpu. This lock protects 1392 /* e1000_clean is called per-cpu. This lock protects
1397 * tx_ring from being cleaned by multiple cpus 1393 * tx_ring from being cleaned by multiple cpus
1398 * simultaneously. A failure obtaining the lock means 1394 * simultaneously. A failure obtaining the lock means
@@ -1404,10 +1400,11 @@ static int e1000_clean(struct napi_struct *napi, int budget)
1404 1400
1405 adapter->clean_rx(adapter, &work_done, budget); 1401 adapter->clean_rx(adapter, &work_done, budget);
1406 1402
1407 /* If no Tx and not enough Rx work done, exit the polling mode */ 1403 if (tx_cleaned)
1408 if ((!tx_cleaned && (work_done < budget)) || 1404 work_done = budget;
1409 !netif_running(poll_dev)) { 1405
1410quit_polling: 1406 /* If budget not fully consumed, exit the polling mode */
1407 if (work_done < budget) {
1411 if (adapter->itr_setting & 3) 1408 if (adapter->itr_setting & 3)
1412 e1000_set_itr(adapter); 1409 e1000_set_itr(adapter);
1413 netif_rx_complete(poll_dev, napi); 1410 netif_rx_complete(poll_dev, napi);
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
index ecdd3fc8d70c..0b365b8d947b 100644
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -1273,7 +1273,7 @@ rx_action:
1273 1273
1274 epic_rx_err(dev, ep); 1274 epic_rx_err(dev, ep);
1275 1275
1276 if (netif_running(dev) && (work_done < budget)) { 1276 if (work_done < budget) {
1277 unsigned long flags; 1277 unsigned long flags;
1278 int more; 1278 int more;
1279 1279
diff --git a/drivers/net/fec_8xx/fec_main.c b/drivers/net/fec_8xx/fec_main.c
index 8d2904fa5789..ab9637ab3a8d 100644
--- a/drivers/net/fec_8xx/fec_main.c
+++ b/drivers/net/fec_8xx/fec_main.c
@@ -476,11 +476,6 @@ static int fec_enet_rx_common(struct fec_enet_private *ep,
476 __u16 pkt_len, sc; 476 __u16 pkt_len, sc;
477 int curidx; 477 int curidx;
478 478
479 if (fpi->use_napi) {
480 if (!netif_running(dev))
481 return 0;
482 }
483
484 /* 479 /*
485 * First, grab all of the stats for the incoming packet. 480 * First, grab all of the stats for the incoming packet.
486 * These get messed up if we get called due to a busy condition. 481 * These get messed up if we get called due to a busy condition.
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index a96583cceb5e..f84c752997a4 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -5199,10 +5199,6 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
5199 dev->dev_addr[3] = (np->orig_mac[0] >> 16) & 0xff; 5199 dev->dev_addr[3] = (np->orig_mac[0] >> 16) & 0xff;
5200 dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff; 5200 dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff;
5201 dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff; 5201 dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff;
5202 /* set permanent address to be correct aswell */
5203 np->orig_mac[0] = (dev->dev_addr[0] << 0) + (dev->dev_addr[1] << 8) +
5204 (dev->dev_addr[2] << 16) + (dev->dev_addr[3] << 24);
5205 np->orig_mac[1] = (dev->dev_addr[4] << 0) + (dev->dev_addr[5] << 8);
5206 writel(txreg|NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll); 5202 writel(txreg|NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll);
5207 } 5203 }
5208 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); 5204 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
@@ -5414,6 +5410,8 @@ static void __devexit nv_remove(struct pci_dev *pci_dev)
5414 */ 5410 */
5415 writel(np->orig_mac[0], base + NvRegMacAddrA); 5411 writel(np->orig_mac[0], base + NvRegMacAddrA);
5416 writel(np->orig_mac[1], base + NvRegMacAddrB); 5412 writel(np->orig_mac[1], base + NvRegMacAddrB);
5413 writel(readl(base + NvRegTransmitPoll) & ~NVREG_TRANSMITPOLL_MAC_ADDR_REV,
5414 base + NvRegTransmitPoll);
5417 5415
5418 /* free all structures */ 5416 /* free all structures */
5419 free_rings(dev); 5417 free_rings(dev);
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index f2a4d399a6e5..c83bd6560088 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -96,9 +96,6 @@ static int fs_enet_rx_napi(struct napi_struct *napi, int budget)
96 u16 pkt_len, sc; 96 u16 pkt_len, sc;
97 int curidx; 97 int curidx;
98 98
99 if (!netif_running(dev))
100 return 0;
101
102 /* 99 /*
103 * First, grab all of the stats for the incoming packet. 100 * First, grab all of the stats for the incoming packet.
104 * These get messed up if we get called due to a busy condition. 101 * These get messed up if we get called due to a busy condition.
@@ -897,14 +894,21 @@ static void fs_get_regs(struct net_device *dev, struct ethtool_regs *regs,
897static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 894static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
898{ 895{
899 struct fs_enet_private *fep = netdev_priv(dev); 896 struct fs_enet_private *fep = netdev_priv(dev);
897
898 if (!fep->phydev)
899 return -ENODEV;
900
900 return phy_ethtool_gset(fep->phydev, cmd); 901 return phy_ethtool_gset(fep->phydev, cmd);
901} 902}
902 903
903static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) 904static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
904{ 905{
905 struct fs_enet_private *fep = netdev_priv(dev); 906 struct fs_enet_private *fep = netdev_priv(dev);
906 phy_ethtool_sset(fep->phydev, cmd); 907
907 return 0; 908 if (!fep->phydev)
909 return -ENODEV;
910
911 return phy_ethtool_sset(fep->phydev, cmd);
908} 912}
909 913
910static int fs_nway_reset(struct net_device *dev) 914static int fs_nway_reset(struct net_device *dev)
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index dbd23bb65d1e..50f0c17451b1 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -857,21 +857,14 @@ static void init_tfdlist(struct net_device *dev)
857static void ipg_nic_txfree(struct net_device *dev) 857static void ipg_nic_txfree(struct net_device *dev)
858{ 858{
859 struct ipg_nic_private *sp = netdev_priv(dev); 859 struct ipg_nic_private *sp = netdev_priv(dev);
860 void __iomem *ioaddr = sp->ioaddr; 860 unsigned int released, pending, dirty;
861 unsigned int curr;
862 u64 txd_map;
863 unsigned int released, pending;
864
865 txd_map = (u64)sp->txd_map;
866 curr = ipg_r32(TFD_LIST_PTR_0) -
867 do_div(txd_map, sizeof(struct ipg_tx)) - 1;
868 861
869 IPG_DEBUG_MSG("_nic_txfree\n"); 862 IPG_DEBUG_MSG("_nic_txfree\n");
870 863
871 pending = sp->tx_current - sp->tx_dirty; 864 pending = sp->tx_current - sp->tx_dirty;
865 dirty = sp->tx_dirty % IPG_TFDLIST_LENGTH;
872 866
873 for (released = 0; released < pending; released++) { 867 for (released = 0; released < pending; released++) {
874 unsigned int dirty = sp->tx_dirty % IPG_TFDLIST_LENGTH;
875 struct sk_buff *skb = sp->TxBuff[dirty]; 868 struct sk_buff *skb = sp->TxBuff[dirty];
876 struct ipg_tx *txfd = sp->txd + dirty; 869 struct ipg_tx *txfd = sp->txd + dirty;
877 870
@@ -882,11 +875,8 @@ static void ipg_nic_txfree(struct net_device *dev)
882 * If the TFDDone bit is set, free the associated 875 * If the TFDDone bit is set, free the associated
883 * buffer. 876 * buffer.
884 */ 877 */
885 if (dirty == curr) 878 if (!(txfd->tfc & cpu_to_le64(IPG_TFC_TFDDONE)))
886 break; 879 break;
887
888 /* Setup TFDDONE for compatible issue. */
889 txfd->tfc |= cpu_to_le64(IPG_TFC_TFDDONE);
890 880
891 /* Free the transmit buffer. */ 881 /* Free the transmit buffer. */
892 if (skb) { 882 if (skb) {
@@ -898,6 +888,7 @@ static void ipg_nic_txfree(struct net_device *dev)
898 888
899 sp->TxBuff[dirty] = NULL; 889 sp->TxBuff[dirty] = NULL;
900 } 890 }
891 dirty = (dirty + 1) % IPG_TFDLIST_LENGTH;
901 } 892 }
902 893
903 sp->tx_dirty += released; 894 sp->tx_dirty += released;
@@ -1630,6 +1621,8 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst)
1630#ifdef JUMBO_FRAME 1621#ifdef JUMBO_FRAME
1631 ipg_nic_rxrestore(dev); 1622 ipg_nic_rxrestore(dev);
1632#endif 1623#endif
1624 spin_lock(&sp->lock);
1625
1633 /* Get interrupt source information, and acknowledge 1626 /* Get interrupt source information, and acknowledge
1634 * some (i.e. TxDMAComplete, RxDMAComplete, RxEarly, 1627 * some (i.e. TxDMAComplete, RxDMAComplete, RxEarly,
1635 * IntRequested, MacControlFrame, LinkEvent) interrupts 1628 * IntRequested, MacControlFrame, LinkEvent) interrupts
@@ -1647,9 +1640,7 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst)
1647 handled = 1; 1640 handled = 1;
1648 1641
1649 if (unlikely(!netif_running(dev))) 1642 if (unlikely(!netif_running(dev)))
1650 goto out; 1643 goto out_unlock;
1651
1652 spin_lock(&sp->lock);
1653 1644
1654 /* If RFDListEnd interrupt, restore all used RFDs. */ 1645 /* If RFDListEnd interrupt, restore all used RFDs. */
1655 if (status & IPG_IS_RFD_LIST_END) { 1646 if (status & IPG_IS_RFD_LIST_END) {
@@ -1733,9 +1724,9 @@ out_enable:
1733 ipg_w16(IPG_IE_TX_DMA_COMPLETE | IPG_IE_RX_DMA_COMPLETE | 1724 ipg_w16(IPG_IE_TX_DMA_COMPLETE | IPG_IE_RX_DMA_COMPLETE |
1734 IPG_IE_HOST_ERROR | IPG_IE_INT_REQUESTED | IPG_IE_TX_COMPLETE | 1725 IPG_IE_HOST_ERROR | IPG_IE_INT_REQUESTED | IPG_IE_TX_COMPLETE |
1735 IPG_IE_LINK_EVENT | IPG_IE_UPDATE_STATS, INT_ENABLE); 1726 IPG_IE_LINK_EVENT | IPG_IE_UPDATE_STATS, INT_ENABLE);
1736 1727out_unlock:
1737 spin_unlock(&sp->lock); 1728 spin_unlock(&sp->lock);
1738out: 1729
1739 return IRQ_RETVAL(handled); 1730 return IRQ_RETVAL(handled);
1740} 1731}
1741 1732
@@ -1943,10 +1934,7 @@ static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
1943 */ 1934 */
1944 if (sp->tenmbpsmode) 1935 if (sp->tenmbpsmode)
1945 txfd->tfc |= cpu_to_le64(IPG_TFC_TXINDICATE); 1936 txfd->tfc |= cpu_to_le64(IPG_TFC_TXINDICATE);
1946 else if (!((sp->tx_current - sp->tx_dirty + 1) > 1937 txfd->tfc |= cpu_to_le64(IPG_TFC_TXDMAINDICATE);
1947 IPG_FRAMESBETWEENTXDMACOMPLETES)) {
1948 txfd->tfc |= cpu_to_le64(IPG_TFC_TXDMAINDICATE);
1949 }
1950 /* Based on compilation option, determine if FCS is to be 1938 /* Based on compilation option, determine if FCS is to be
1951 * appended to transmit frame by IPG. 1939 * appended to transmit frame by IPG.
1952 */ 1940 */
@@ -2003,7 +1991,7 @@ static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
2003 ipg_w32(IPG_DC_TX_DMA_POLL_NOW, DMA_CTRL); 1991 ipg_w32(IPG_DC_TX_DMA_POLL_NOW, DMA_CTRL);
2004 1992
2005 if (sp->tx_current == (sp->tx_dirty + IPG_TFDLIST_LENGTH)) 1993 if (sp->tx_current == (sp->tx_dirty + IPG_TFDLIST_LENGTH))
2006 netif_wake_queue(dev); 1994 netif_stop_queue(dev);
2007 1995
2008 spin_unlock_irqrestore(&sp->lock, flags); 1996 spin_unlock_irqrestore(&sp->lock, flags);
2009 1997
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index bf9085fe035a..d2fb88d5cda2 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -1787,14 +1787,13 @@ ixgb_clean(struct napi_struct *napi, int budget)
1787{ 1787{
1788 struct ixgb_adapter *adapter = container_of(napi, struct ixgb_adapter, napi); 1788 struct ixgb_adapter *adapter = container_of(napi, struct ixgb_adapter, napi);
1789 struct net_device *netdev = adapter->netdev; 1789 struct net_device *netdev = adapter->netdev;
1790 int tx_cleaned;
1791 int work_done = 0; 1790 int work_done = 0;
1792 1791
1793 tx_cleaned = ixgb_clean_tx_irq(adapter); 1792 ixgb_clean_tx_irq(adapter);
1794 ixgb_clean_rx_irq(adapter, &work_done, budget); 1793 ixgb_clean_rx_irq(adapter, &work_done, budget);
1795 1794
1796 /* if no Tx and not enough Rx work done, exit the polling mode */ 1795 /* If budget not fully consumed, exit the polling mode */
1797 if((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) { 1796 if (work_done < budget) {
1798 netif_rx_complete(netdev, napi); 1797 netif_rx_complete(netdev, napi);
1799 ixgb_irq_enable(adapter); 1798 ixgb_irq_enable(adapter);
1800 } 1799 }
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 00bc525c6560..de3f45e4c5ae 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -1470,19 +1470,16 @@ static int ixgbe_clean(struct napi_struct *napi, int budget)
1470 struct net_device *netdev = adapter->netdev; 1470 struct net_device *netdev = adapter->netdev;
1471 int tx_cleaned = 0, work_done = 0; 1471 int tx_cleaned = 0, work_done = 0;
1472 1472
1473 /* Keep link state information with original netdev */
1474 if (!netif_carrier_ok(adapter->netdev))
1475 goto quit_polling;
1476
1477 /* In non-MSIX case, there is no multi-Tx/Rx queue */ 1473 /* In non-MSIX case, there is no multi-Tx/Rx queue */
1478 tx_cleaned = ixgbe_clean_tx_irq(adapter, adapter->tx_ring); 1474 tx_cleaned = ixgbe_clean_tx_irq(adapter, adapter->tx_ring);
1479 ixgbe_clean_rx_irq(adapter, &adapter->rx_ring[0], &work_done, 1475 ixgbe_clean_rx_irq(adapter, &adapter->rx_ring[0], &work_done,
1480 budget); 1476 budget);
1481 1477
1482 /* If no Tx and not enough Rx work done, exit the polling mode */ 1478 if (tx_cleaned)
1483 if ((!tx_cleaned && (work_done < budget)) || 1479 work_done = budget;
1484 !netif_running(adapter->netdev)) { 1480
1485quit_polling: 1481 /* If budget not fully consumed, exit the polling mode */
1482 if (work_done < budget) {
1486 netif_rx_complete(netdev, napi); 1483 netif_rx_complete(netdev, napi);
1487 ixgbe_irq_enable(adapter); 1484 ixgbe_irq_enable(adapter);
1488 } 1485 }
diff --git a/drivers/net/ixp2000/ixpdev.c b/drivers/net/ixp2000/ixpdev.c
index 6c0dd49149d0..484cb2ba717f 100644
--- a/drivers/net/ixp2000/ixpdev.c
+++ b/drivers/net/ixp2000/ixpdev.c
@@ -135,8 +135,6 @@ static int ixpdev_poll(struct napi_struct *napi, int budget)
135 struct net_device *dev = ip->dev; 135 struct net_device *dev = ip->dev;
136 int rx; 136 int rx;
137 137
138 /* @@@ Have to stop polling when nds[0] is administratively
139 * downed while we are polling. */
140 rx = 0; 138 rx = 0;
141 do { 139 do {
142 ixp2000_reg_write(IXP2000_IRQ_THD_RAW_STATUS_A_0, 0x00ff); 140 ixp2000_reg_write(IXP2000_IRQ_THD_RAW_STATUS_A_0, 0x00ff);
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 662b8d16803c..fa147cd5d68c 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -242,7 +242,7 @@ static void loopback_setup(struct net_device *dev)
242 | NETIF_F_NO_CSUM 242 | NETIF_F_NO_CSUM
243 | NETIF_F_HIGHDMA 243 | NETIF_F_HIGHDMA
244 | NETIF_F_LLTX 244 | NETIF_F_LLTX
245 | NETIF_F_NETNS_LOCAL, 245 | NETIF_F_NETNS_LOCAL;
246 dev->ethtool_ops = &loopback_ethtool_ops; 246 dev->ethtool_ops = &loopback_ethtool_ops;
247 dev->header_ops = &eth_header_ops; 247 dev->header_ops = &eth_header_ops;
248 dev->init = loopback_dev_init; 248 dev->init = loopback_dev_init;
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 2e4bcd5654c4..e8dc2f44fec9 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -384,6 +384,13 @@ static int macvlan_newlink(struct net_device *dev,
384 if (lowerdev == NULL) 384 if (lowerdev == NULL)
385 return -ENODEV; 385 return -ENODEV;
386 386
387 /* Don't allow macvlans on top of other macvlans - its not really
388 * wrong, but lockdep can't handle it and its not useful for anything
389 * you couldn't do directly on top of the real device.
390 */
391 if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops)
392 return -ENODEV;
393
387 if (!tb[IFLA_MTU]) 394 if (!tb[IFLA_MTU])
388 dev->mtu = lowerdev->mtu; 395 dev->mtu = lowerdev->mtu;
389 else if (dev->mtu > lowerdev->mtu) 396 else if (dev->mtu > lowerdev->mtu)
diff --git a/drivers/net/meth.c b/drivers/net/meth.c
index 0c89b028a80c..cdaa8fc21809 100644
--- a/drivers/net/meth.c
+++ b/drivers/net/meth.c
@@ -95,11 +95,14 @@ static inline void load_eaddr(struct net_device *dev)
95{ 95{
96 int i; 96 int i;
97 DECLARE_MAC_BUF(mac); 97 DECLARE_MAC_BUF(mac);
98 u64 macaddr;
98 99
99 for (i = 0; i < 6; i++)
100 dev->dev_addr[i] = o2meth_eaddr[i];
101 DPRINTK("Loading MAC Address: %s\n", print_mac(mac, dev->dev_addr)); 100 DPRINTK("Loading MAC Address: %s\n", print_mac(mac, dev->dev_addr));
102 mace->eth.mac_addr = (*(unsigned long*)o2meth_eaddr) >> 16; 101 macaddr = 0;
102 for (i = 0; i < 6; i++)
103 macaddr |= dev->dev_addr[i] << ((5 - i) * 8);
104
105 mace->eth.mac_addr = macaddr;
103} 106}
104 107
105/* 108/*
@@ -794,6 +797,7 @@ static int __init meth_probe(struct platform_device *pdev)
794#endif 797#endif
795 dev->irq = MACE_ETHERNET_IRQ; 798 dev->irq = MACE_ETHERNET_IRQ;
796 dev->base_addr = (unsigned long)&mace->eth; 799 dev->base_addr = (unsigned long)&mace->eth;
800 memcpy(dev->dev_addr, o2meth_eaddr, 6);
797 801
798 priv = netdev_priv(dev); 802 priv = netdev_priv(dev);
799 spin_lock_init(&priv->meth_lock); 803 spin_lock_init(&priv->meth_lock);
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 8def8657251f..c90958f6d3fe 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -1239,7 +1239,7 @@ static int myri10ge_poll(struct napi_struct *napi, int budget)
1239 /* process as many rx events as NAPI will allow */ 1239 /* process as many rx events as NAPI will allow */
1240 work_done = myri10ge_clean_rx_done(mgp, budget); 1240 work_done = myri10ge_clean_rx_done(mgp, budget);
1241 1241
1242 if (work_done < budget || !netif_running(netdev)) { 1242 if (work_done < budget) {
1243 netif_rx_complete(netdev, napi); 1243 netif_rx_complete(netdev, napi);
1244 put_be32(htonl(3), mgp->irq_claim); 1244 put_be32(htonl(3), mgp->irq_claim);
1245 } 1245 }
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 87cde062fd63..c329a4f5840c 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -2266,7 +2266,7 @@ static int natsemi_poll(struct napi_struct *napi, int budget)
2266 /* Reenable interrupts providing nothing is trying to shut 2266 /* Reenable interrupts providing nothing is trying to shut
2267 * the chip down. */ 2267 * the chip down. */
2268 spin_lock(&np->lock); 2268 spin_lock(&np->lock);
2269 if (!np->hands_off && netif_running(dev)) 2269 if (!np->hands_off)
2270 natsemi_irq_enable(dev); 2270 natsemi_irq_enable(dev);
2271 spin_unlock(&np->lock); 2271 spin_unlock(&np->lock);
2272 2272
diff --git a/drivers/net/netx-eth.c b/drivers/net/netx-eth.c
index 5267e031daa0..78d34af13a1c 100644
--- a/drivers/net/netx-eth.c
+++ b/drivers/net/netx-eth.c
@@ -169,8 +169,8 @@ static void netx_eth_receive(struct net_device *ndev)
169 ndev->last_rx = jiffies; 169 ndev->last_rx = jiffies;
170 skb->protocol = eth_type_trans(skb, ndev); 170 skb->protocol = eth_type_trans(skb, ndev);
171 netif_rx(skb); 171 netif_rx(skb);
172 dev->stats.rx_packets++; 172 ndev->stats.rx_packets++;
173 dev->stats.rx_bytes += len; 173 ndev->stats.rx_bytes += len;
174} 174}
175 175
176static irqreturn_t 176static irqreturn_t
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index fbc2553275dc..a8f63c47b3cd 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -65,8 +65,8 @@
65 65
66#define _NETXEN_NIC_LINUX_MAJOR 3 66#define _NETXEN_NIC_LINUX_MAJOR 3
67#define _NETXEN_NIC_LINUX_MINOR 4 67#define _NETXEN_NIC_LINUX_MINOR 4
68#define _NETXEN_NIC_LINUX_SUBVERSION 2 68#define _NETXEN_NIC_LINUX_SUBVERSION 18
69#define NETXEN_NIC_LINUX_VERSIONID "3.4.2" 69#define NETXEN_NIC_LINUX_VERSIONID "3.4.18"
70 70
71#define NETXEN_NUM_FLASH_SECTORS (64) 71#define NETXEN_NUM_FLASH_SECTORS (64)
72#define NETXEN_FLASH_SECTOR_SIZE (64 * 1024) 72#define NETXEN_FLASH_SECTOR_SIZE (64 * 1024)
@@ -309,23 +309,26 @@ struct netxen_ring_ctx {
309 ((cmd_desc)->port_ctxid |= ((var) & 0xF0)) 309 ((cmd_desc)->port_ctxid |= ((var) & 0xF0))
310 310
311#define netxen_set_cmd_desc_flags(cmd_desc, val) \ 311#define netxen_set_cmd_desc_flags(cmd_desc, val) \
312 ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x7f), \ 312 (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \
313 (cmd_desc)->flags_opcode |= cpu_to_le16((val) & 0x7f)) 313 ~cpu_to_le16(0x7f)) | cpu_to_le16((val) & 0x7f)
314#define netxen_set_cmd_desc_opcode(cmd_desc, val) \ 314#define netxen_set_cmd_desc_opcode(cmd_desc, val) \
315 ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x3f<<7), \ 315 (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \
316 (cmd_desc)->flags_opcode |= cpu_to_le16(((val & 0x3f)<<7))) 316 ~cpu_to_le16((u16)0x3f << 7)) | cpu_to_le16(((val) & 0x3f) << 7)
317 317
318#define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \ 318#define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \
319 ((cmd_desc)->num_of_buffers_total_length &= ~cpu_to_le32(0xff), \ 319 (cmd_desc)->num_of_buffers_total_length = \
320 (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32((val) & 0xff)) 320 ((cmd_desc)->num_of_buffers_total_length & \
321 ~cpu_to_le32(0xff)) | cpu_to_le32((val) & 0xff)
321#define netxen_set_cmd_desc_totallength(cmd_desc, val) \ 322#define netxen_set_cmd_desc_totallength(cmd_desc, val) \
322 ((cmd_desc)->num_of_buffers_total_length &= ~cpu_to_le32(0xffffff00), \ 323 (cmd_desc)->num_of_buffers_total_length = \
323 (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32(val << 8)) 324 ((cmd_desc)->num_of_buffers_total_length & \
325 ~cpu_to_le32((u32)0xffffff << 8)) | \
326 cpu_to_le32(((val) & 0xffffff) << 8)
324 327
325#define netxen_get_cmd_desc_opcode(cmd_desc) \ 328#define netxen_get_cmd_desc_opcode(cmd_desc) \
326 ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003F) 329 ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003f)
327#define netxen_get_cmd_desc_totallength(cmd_desc) \ 330#define netxen_get_cmd_desc_totallength(cmd_desc) \
328 (le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8) 331 ((le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8) & 0xffffff)
329 332
330struct cmd_desc_type0 { 333struct cmd_desc_type0 {
331 u8 tcp_hdr_offset; /* For LSO only */ 334 u8 tcp_hdr_offset; /* For LSO only */
@@ -412,29 +415,29 @@ struct rcv_desc {
412#define netxen_get_sts_desc_lro_last_frag(status_desc) \ 415#define netxen_get_sts_desc_lro_last_frag(status_desc) \
413 (((status_desc)->lro & 0x80) >> 7) 416 (((status_desc)->lro & 0x80) >> 7)
414 417
415#define netxen_get_sts_port(status_desc) \ 418#define netxen_get_sts_port(sts_data) \
416 (le64_to_cpu((status_desc)->status_desc_data) & 0x0F) 419 ((sts_data) & 0x0F)
417#define netxen_get_sts_status(status_desc) \ 420#define netxen_get_sts_status(sts_data) \
418 ((le64_to_cpu((status_desc)->status_desc_data) >> 4) & 0x0F) 421 (((sts_data) >> 4) & 0x0F)
419#define netxen_get_sts_type(status_desc) \ 422#define netxen_get_sts_type(sts_data) \
420 ((le64_to_cpu((status_desc)->status_desc_data) >> 8) & 0x0F) 423 (((sts_data) >> 8) & 0x0F)
421#define netxen_get_sts_totallength(status_desc) \ 424#define netxen_get_sts_totallength(sts_data) \
422 ((le64_to_cpu((status_desc)->status_desc_data) >> 12) & 0xFFFF) 425 (((sts_data) >> 12) & 0xFFFF)
423#define netxen_get_sts_refhandle(status_desc) \ 426#define netxen_get_sts_refhandle(sts_data) \
424 ((le64_to_cpu((status_desc)->status_desc_data) >> 28) & 0xFFFF) 427 (((sts_data) >> 28) & 0xFFFF)
425#define netxen_get_sts_prot(status_desc) \ 428#define netxen_get_sts_prot(sts_data) \
426 ((le64_to_cpu((status_desc)->status_desc_data) >> 44) & 0x0F) 429 (((sts_data) >> 44) & 0x0F)
430#define netxen_get_sts_opcode(sts_data) \
431 (((sts_data) >> 58) & 0x03F)
432
427#define netxen_get_sts_owner(status_desc) \ 433#define netxen_get_sts_owner(status_desc) \
428 ((le64_to_cpu((status_desc)->status_desc_data) >> 56) & 0x03) 434 ((le64_to_cpu((status_desc)->status_desc_data) >> 56) & 0x03)
429#define netxen_get_sts_opcode(status_desc) \ 435#define netxen_set_sts_owner(status_desc, val) { \
430 ((le64_to_cpu((status_desc)->status_desc_data) >> 58) & 0x03F) 436 (status_desc)->status_desc_data = \
431 437 ((status_desc)->status_desc_data & \
432#define netxen_clear_sts_owner(status_desc) \ 438 ~cpu_to_le64(0x3ULL << 56)) | \
433 ((status_desc)->status_desc_data &= \ 439 cpu_to_le64((u64)((val) & 0x3) << 56); \
434 ~cpu_to_le64(((unsigned long long)3) << 56 )) 440}
435#define netxen_set_sts_owner(status_desc, val) \
436 ((status_desc)->status_desc_data |= \
437 cpu_to_le64(((unsigned long long)((val) & 0x3)) << 56 ))
438 441
439struct status_desc { 442struct status_desc {
440 /* Bit pattern: 0-3 port, 4-7 status, 8-11 type, 12-27 total_length 443 /* Bit pattern: 0-3 port, 4-7 status, 8-11 type, 12-27 total_length
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 37589265297e..485ff9398910 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -1070,16 +1070,17 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
1070{ 1070{
1071 struct pci_dev *pdev = adapter->pdev; 1071 struct pci_dev *pdev = adapter->pdev;
1072 struct net_device *netdev = adapter->netdev; 1072 struct net_device *netdev = adapter->netdev;
1073 int index = netxen_get_sts_refhandle(desc); 1073 u64 sts_data = le64_to_cpu(desc->status_desc_data);
1074 int index = netxen_get_sts_refhandle(sts_data);
1074 struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctxid]); 1075 struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctxid]);
1075 struct netxen_rx_buffer *buffer; 1076 struct netxen_rx_buffer *buffer;
1076 struct sk_buff *skb; 1077 struct sk_buff *skb;
1077 u32 length = netxen_get_sts_totallength(desc); 1078 u32 length = netxen_get_sts_totallength(sts_data);
1078 u32 desc_ctx; 1079 u32 desc_ctx;
1079 struct netxen_rcv_desc_ctx *rcv_desc; 1080 struct netxen_rcv_desc_ctx *rcv_desc;
1080 int ret; 1081 int ret;
1081 1082
1082 desc_ctx = netxen_get_sts_type(desc); 1083 desc_ctx = netxen_get_sts_type(sts_data);
1083 if (unlikely(desc_ctx >= NUM_RCV_DESC_RINGS)) { 1084 if (unlikely(desc_ctx >= NUM_RCV_DESC_RINGS)) {
1084 printk("%s: %s Bad Rcv descriptor ring\n", 1085 printk("%s: %s Bad Rcv descriptor ring\n",
1085 netxen_nic_driver_name, netdev->name); 1086 netxen_nic_driver_name, netdev->name);
@@ -1119,7 +1120,7 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
1119 skb = (struct sk_buff *)buffer->skb; 1120 skb = (struct sk_buff *)buffer->skb;
1120 1121
1121 if (likely(adapter->rx_csum && 1122 if (likely(adapter->rx_csum &&
1122 netxen_get_sts_status(desc) == STATUS_CKSUM_OK)) { 1123 netxen_get_sts_status(sts_data) == STATUS_CKSUM_OK)) {
1123 adapter->stats.csummed++; 1124 adapter->stats.csummed++;
1124 skb->ip_summed = CHECKSUM_UNNECESSARY; 1125 skb->ip_summed = CHECKSUM_UNNECESSARY;
1125 } else 1126 } else
@@ -1209,7 +1210,6 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max)
1209 break; 1210 break;
1210 } 1211 }
1211 netxen_process_rcv(adapter, ctxid, desc); 1212 netxen_process_rcv(adapter, ctxid, desc);
1212 netxen_clear_sts_owner(desc);
1213 netxen_set_sts_owner(desc, STATUS_OWNER_PHANTOM); 1213 netxen_set_sts_owner(desc, STATUS_OWNER_PHANTOM);
1214 consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1); 1214 consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1);
1215 count++; 1215 count++;
@@ -1248,7 +1248,6 @@ int netxen_process_cmd_ring(unsigned long data)
1248 struct pci_dev *pdev; 1248 struct pci_dev *pdev;
1249 struct netxen_skb_frag *frag; 1249 struct netxen_skb_frag *frag;
1250 u32 i; 1250 u32 i;
1251 struct sk_buff *skb = NULL;
1252 int done; 1251 int done;
1253 1252
1254 spin_lock(&adapter->tx_lock); 1253 spin_lock(&adapter->tx_lock);
@@ -1278,9 +1277,8 @@ int netxen_process_cmd_ring(unsigned long data)
1278 while ((last_consumer != consumer) && (count1 < MAX_STATUS_HANDLE)) { 1277 while ((last_consumer != consumer) && (count1 < MAX_STATUS_HANDLE)) {
1279 buffer = &adapter->cmd_buf_arr[last_consumer]; 1278 buffer = &adapter->cmd_buf_arr[last_consumer];
1280 pdev = adapter->pdev; 1279 pdev = adapter->pdev;
1281 frag = &buffer->frag_array[0]; 1280 if (buffer->skb) {
1282 skb = buffer->skb; 1281 frag = &buffer->frag_array[0];
1283 if (skb && (cmpxchg(&buffer->skb, skb, 0) == skb)) {
1284 pci_unmap_single(pdev, frag->dma, frag->length, 1282 pci_unmap_single(pdev, frag->dma, frag->length,
1285 PCI_DMA_TODEVICE); 1283 PCI_DMA_TODEVICE);
1286 frag->dma = 0ULL; 1284 frag->dma = 0ULL;
@@ -1293,8 +1291,8 @@ int netxen_process_cmd_ring(unsigned long data)
1293 } 1291 }
1294 1292
1295 adapter->stats.skbfreed++; 1293 adapter->stats.skbfreed++;
1296 dev_kfree_skb_any(skb); 1294 dev_kfree_skb_any(buffer->skb);
1297 skb = NULL; 1295 buffer->skb = NULL;
1298 } else if (adapter->proc_cmd_buf_counter == 1) { 1296 } else if (adapter->proc_cmd_buf_counter == 1) {
1299 adapter->stats.txnullskb++; 1297 adapter->stats.txnullskb++;
1300 } 1298 }
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index a80f0cd6b528..263b55e36c7a 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -732,11 +732,6 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
732 732
733 unregister_netdev(netdev); 733 unregister_netdev(netdev);
734 734
735 if (adapter->stop_port)
736 adapter->stop_port(adapter);
737
738 netxen_nic_disable_int(adapter);
739
740 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { 735 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) {
741 init_firmware_done++; 736 init_firmware_done++;
742 netxen_free_hw_resources(adapter); 737 netxen_free_hw_resources(adapter);
@@ -919,6 +914,9 @@ static int netxen_nic_close(struct net_device *netdev)
919 netif_stop_queue(netdev); 914 netif_stop_queue(netdev);
920 napi_disable(&adapter->napi); 915 napi_disable(&adapter->napi);
921 916
917 if (adapter->stop_port)
918 adapter->stop_port(adapter);
919
922 netxen_nic_disable_int(adapter); 920 netxen_nic_disable_int(adapter);
923 921
924 cmd_buff = adapter->cmd_buf_arr; 922 cmd_buff = adapter->cmd_buf_arr;
@@ -996,28 +994,6 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
996 return NETDEV_TX_OK; 994 return NETDEV_TX_OK;
997 } 995 }
998 996
999 /*
1000 * Everything is set up. Now, we just need to transmit it out.
1001 * Note that we have to copy the contents of buffer over to
1002 * right place. Later on, this can be optimized out by de-coupling the
1003 * producer index from the buffer index.
1004 */
1005 retry_getting_window:
1006 spin_lock_bh(&adapter->tx_lock);
1007 if (adapter->total_threads >= MAX_XMIT_PRODUCERS) {
1008 spin_unlock_bh(&adapter->tx_lock);
1009 /*
1010 * Yield CPU
1011 */
1012 if (!in_atomic())
1013 schedule();
1014 else {
1015 for (i = 0; i < 20; i++)
1016 cpu_relax(); /*This a nop instr on i386 */
1017 }
1018 goto retry_getting_window;
1019 }
1020 local_producer = adapter->cmd_producer;
1021 /* There 4 fragments per descriptor */ 997 /* There 4 fragments per descriptor */
1022 no_of_desc = (frag_count + 3) >> 2; 998 no_of_desc = (frag_count + 3) >> 2;
1023 if (netdev->features & NETIF_F_TSO) { 999 if (netdev->features & NETIF_F_TSO) {
@@ -1031,16 +1007,19 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1031 } 1007 }
1032 } 1008 }
1033 } 1009 }
1010
1011 spin_lock_bh(&adapter->tx_lock);
1012 if (adapter->total_threads >= MAX_XMIT_PRODUCERS) {
1013 goto out_requeue;
1014 }
1015 local_producer = adapter->cmd_producer;
1034 k = adapter->cmd_producer; 1016 k = adapter->cmd_producer;
1035 max_tx_desc_count = adapter->max_tx_desc_count; 1017 max_tx_desc_count = adapter->max_tx_desc_count;
1036 last_cmd_consumer = adapter->last_cmd_consumer; 1018 last_cmd_consumer = adapter->last_cmd_consumer;
1037 if ((k + no_of_desc) >= 1019 if ((k + no_of_desc) >=
1038 ((last_cmd_consumer <= k) ? last_cmd_consumer + max_tx_desc_count : 1020 ((last_cmd_consumer <= k) ? last_cmd_consumer + max_tx_desc_count :
1039 last_cmd_consumer)) { 1021 last_cmd_consumer)) {
1040 netif_stop_queue(netdev); 1022 goto out_requeue;
1041 adapter->flags |= NETXEN_NETDEV_STATUS;
1042 spin_unlock_bh(&adapter->tx_lock);
1043 return NETDEV_TX_BUSY;
1044 } 1023 }
1045 k = get_index_range(k, max_tx_desc_count, no_of_desc); 1024 k = get_index_range(k, max_tx_desc_count, no_of_desc);
1046 adapter->cmd_producer = k; 1025 adapter->cmd_producer = k;
@@ -1093,6 +1072,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1093 adapter->max_tx_desc_count); 1072 adapter->max_tx_desc_count);
1094 hwdesc = &hw->cmd_desc_head[producer]; 1073 hwdesc = &hw->cmd_desc_head[producer];
1095 memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); 1074 memset(hwdesc, 0, sizeof(struct cmd_desc_type0));
1075 pbuf = &adapter->cmd_buf_arr[producer];
1076 pbuf->skb = NULL;
1096 } 1077 }
1097 frag = &skb_shinfo(skb)->frags[i - 1]; 1078 frag = &skb_shinfo(skb)->frags[i - 1];
1098 len = frag->size; 1079 len = frag->size;
@@ -1148,6 +1129,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1148 } 1129 }
1149 /* copy the MAC/IP/TCP headers to the cmd descriptor list */ 1130 /* copy the MAC/IP/TCP headers to the cmd descriptor list */
1150 hwdesc = &hw->cmd_desc_head[producer]; 1131 hwdesc = &hw->cmd_desc_head[producer];
1132 pbuf = &adapter->cmd_buf_arr[producer];
1133 pbuf->skb = NULL;
1151 1134
1152 /* copy the first 64 bytes */ 1135 /* copy the first 64 bytes */
1153 memcpy(((void *)hwdesc) + 2, 1136 memcpy(((void *)hwdesc) + 2,
@@ -1156,6 +1139,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1156 1139
1157 if (more_hdr) { 1140 if (more_hdr) {
1158 hwdesc = &hw->cmd_desc_head[producer]; 1141 hwdesc = &hw->cmd_desc_head[producer];
1142 pbuf = &adapter->cmd_buf_arr[producer];
1143 pbuf->skb = NULL;
1159 /* copy the next 64 bytes - should be enough except 1144 /* copy the next 64 bytes - should be enough except
1160 * for pathological case 1145 * for pathological case
1161 */ 1146 */
@@ -1167,16 +1152,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1167 } 1152 }
1168 } 1153 }
1169 1154
1170 i = netxen_get_cmd_desc_totallength(&hw->cmd_desc_head[saved_producer]);
1171
1172 hw->cmd_desc_head[saved_producer].flags_opcode =
1173 cpu_to_le16(hw->cmd_desc_head[saved_producer].flags_opcode);
1174 hw->cmd_desc_head[saved_producer].num_of_buffers_total_length =
1175 cpu_to_le32(hw->cmd_desc_head[saved_producer].
1176 num_of_buffers_total_length);
1177
1178 spin_lock_bh(&adapter->tx_lock); 1155 spin_lock_bh(&adapter->tx_lock);
1179 adapter->stats.txbytes += i; 1156 adapter->stats.txbytes += skb->len;
1180 1157
1181 /* Code to update the adapter considering how many producer threads 1158 /* Code to update the adapter considering how many producer threads
1182 are currently working */ 1159 are currently working */
@@ -1189,14 +1166,17 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1189 } 1166 }
1190 1167
1191 adapter->stats.xmitfinished++; 1168 adapter->stats.xmitfinished++;
1192 spin_unlock_bh(&adapter->tx_lock);
1193
1194 netdev->trans_start = jiffies; 1169 netdev->trans_start = jiffies;
1195 1170
1196 DPRINTK(INFO, "wrote CMD producer %x to phantom\n", producer); 1171 spin_unlock_bh(&adapter->tx_lock);
1197
1198 DPRINTK(INFO, "Done. Send\n");
1199 return NETDEV_TX_OK; 1172 return NETDEV_TX_OK;
1173
1174out_requeue:
1175 netif_stop_queue(netdev);
1176 adapter->flags |= NETXEN_NETDEV_STATUS;
1177
1178 spin_unlock_bh(&adapter->tx_lock);
1179 return NETDEV_TX_BUSY;
1200} 1180}
1201 1181
1202static void netxen_watchdog(unsigned long v) 1182static void netxen_watchdog(unsigned long v)
@@ -1321,7 +1301,7 @@ static int netxen_nic_poll(struct napi_struct *napi, int budget)
1321 budget / MAX_RCV_CTX); 1301 budget / MAX_RCV_CTX);
1322 } 1302 }
1323 1303
1324 if (work_done >= budget && netxen_nic_rx_has_work(adapter) != 0) 1304 if (work_done >= budget)
1325 done = 0; 1305 done = 0;
1326 1306
1327 if (netxen_process_cmd_ring((unsigned long)adapter) == 0) 1307 if (netxen_process_cmd_ring((unsigned long)adapter) == 0)
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c
index 5b9e1b300fab..d04ecb77d08c 100644
--- a/drivers/net/netxen/netxen_nic_niu.c
+++ b/drivers/net/netxen/netxen_nic_niu.c
@@ -736,12 +736,12 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter)
736 __u32 mac_cfg; 736 __u32 mac_cfg;
737 u32 port = physical_port[adapter->portnum]; 737 u32 port = physical_port[adapter->portnum];
738 738
739 if (port != 0) 739 if (port > NETXEN_NIU_MAX_XG_PORTS)
740 return -EINVAL; 740 return -EINVAL;
741
741 mac_cfg = 0; 742 mac_cfg = 0;
742 netxen_xg_soft_reset(mac_cfg); 743 if (netxen_nic_hw_write_wx(adapter,
743 if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XGE_CONFIG_0, 744 NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), &mac_cfg, 4))
744 &mac_cfg, 4))
745 return -EIO; 745 return -EIO;
746 return 0; 746 return 0;
747} 747}
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index abfc61c3a38c..5f6beabf2d17 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -33,8 +33,8 @@
33 33
34#define DRV_MODULE_NAME "niu" 34#define DRV_MODULE_NAME "niu"
35#define PFX DRV_MODULE_NAME ": " 35#define PFX DRV_MODULE_NAME ": "
36#define DRV_MODULE_VERSION "0.5" 36#define DRV_MODULE_VERSION "0.6"
37#define DRV_MODULE_RELDATE "October 5, 2007" 37#define DRV_MODULE_RELDATE "January 5, 2008"
38 38
39static char version[] __devinitdata = 39static char version[] __devinitdata =
40 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 40 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
@@ -801,22 +801,90 @@ static int bcm8704_init_user_dev3(struct niu *np)
801 return 0; 801 return 0;
802} 802}
803 803
804static int xcvr_init_10g(struct niu *np) 804static int mrvl88x2011_act_led(struct niu *np, int val)
805{
806 int err;
807
808 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR,
809 MRVL88X2011_LED_8_TO_11_CTL);
810 if (err < 0)
811 return err;
812
813 err &= ~MRVL88X2011_LED(MRVL88X2011_LED_ACT,MRVL88X2011_LED_CTL_MASK);
814 err |= MRVL88X2011_LED(MRVL88X2011_LED_ACT,val);
815
816 return mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR,
817 MRVL88X2011_LED_8_TO_11_CTL, err);
818}
819
820static int mrvl88x2011_led_blink_rate(struct niu *np, int rate)
821{
822 int err;
823
824 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR,
825 MRVL88X2011_LED_BLINK_CTL);
826 if (err >= 0) {
827 err &= ~MRVL88X2011_LED_BLKRATE_MASK;
828 err |= (rate << 4);
829
830 err = mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR,
831 MRVL88X2011_LED_BLINK_CTL, err);
832 }
833
834 return err;
835}
836
837static int xcvr_init_10g_mrvl88x2011(struct niu *np)
838{
839 int err;
840
841 /* Set LED functions */
842 err = mrvl88x2011_led_blink_rate(np, MRVL88X2011_LED_BLKRATE_134MS);
843 if (err)
844 return err;
845
846 /* led activity */
847 err = mrvl88x2011_act_led(np, MRVL88X2011_LED_CTL_OFF);
848 if (err)
849 return err;
850
851 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR,
852 MRVL88X2011_GENERAL_CTL);
853 if (err < 0)
854 return err;
855
856 err |= MRVL88X2011_ENA_XFPREFCLK;
857
858 err = mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR,
859 MRVL88X2011_GENERAL_CTL, err);
860 if (err < 0)
861 return err;
862
863 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
864 MRVL88X2011_PMA_PMD_CTL_1);
865 if (err < 0)
866 return err;
867
868 if (np->link_config.loopback_mode == LOOPBACK_MAC)
869 err |= MRVL88X2011_LOOPBACK;
870 else
871 err &= ~MRVL88X2011_LOOPBACK;
872
873 err = mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
874 MRVL88X2011_PMA_PMD_CTL_1, err);
875 if (err < 0)
876 return err;
877
878 /* Enable PMD */
879 return mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
880 MRVL88X2011_10G_PMD_TX_DIS, MRVL88X2011_ENA_PMDTX);
881}
882
883static int xcvr_init_10g_bcm8704(struct niu *np)
805{ 884{
806 struct niu_link_config *lp = &np->link_config; 885 struct niu_link_config *lp = &np->link_config;
807 u16 analog_stat0, tx_alarm_status; 886 u16 analog_stat0, tx_alarm_status;
808 int err; 887 int err;
809 u64 val;
810
811 val = nr64_mac(XMAC_CONFIG);
812 val &= ~XMAC_CONFIG_LED_POLARITY;
813 val |= XMAC_CONFIG_FORCE_LED_ON;
814 nw64_mac(XMAC_CONFIG, val);
815
816 /* XXX shared resource, lock parent XXX */
817 val = nr64(MIF_CONFIG);
818 val |= MIF_CONFIG_INDIRECT_MODE;
819 nw64(MIF_CONFIG, val);
820 888
821 err = bcm8704_reset(np); 889 err = bcm8704_reset(np);
822 if (err) 890 if (err)
@@ -896,6 +964,38 @@ static int xcvr_init_10g(struct niu *np)
896 return 0; 964 return 0;
897} 965}
898 966
967static int xcvr_init_10g(struct niu *np)
968{
969 int phy_id, err;
970 u64 val;
971
972 val = nr64_mac(XMAC_CONFIG);
973 val &= ~XMAC_CONFIG_LED_POLARITY;
974 val |= XMAC_CONFIG_FORCE_LED_ON;
975 nw64_mac(XMAC_CONFIG, val);
976
977 /* XXX shared resource, lock parent XXX */
978 val = nr64(MIF_CONFIG);
979 val |= MIF_CONFIG_INDIRECT_MODE;
980 nw64(MIF_CONFIG, val);
981
982 phy_id = phy_decode(np->parent->port_phy, np->port);
983 phy_id = np->parent->phy_probe_info.phy_id[phy_id][np->port];
984
985 /* handle different phy types */
986 switch (phy_id & NIU_PHY_ID_MASK) {
987 case NIU_PHY_ID_MRVL88X2011:
988 err = xcvr_init_10g_mrvl88x2011(np);
989 break;
990
991 default: /* bcom 8704 */
992 err = xcvr_init_10g_bcm8704(np);
993 break;
994 }
995
996 return 0;
997}
998
899static int mii_reset(struct niu *np) 999static int mii_reset(struct niu *np)
900{ 1000{
901 int limit, err; 1001 int limit, err;
@@ -1082,19 +1182,68 @@ static int niu_link_status_common(struct niu *np, int link_up)
1082 return 0; 1182 return 0;
1083} 1183}
1084 1184
1085static int link_status_10g(struct niu *np, int *link_up_p) 1185static int link_status_10g_mrvl(struct niu *np, int *link_up_p)
1086{ 1186{
1087 unsigned long flags; 1187 int err, link_up, pma_status, pcs_status;
1088 int err, link_up;
1089 1188
1090 link_up = 0; 1189 link_up = 0;
1091 1190
1092 spin_lock_irqsave(&np->lock, flags); 1191 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
1192 MRVL88X2011_10G_PMD_STATUS_2);
1193 if (err < 0)
1194 goto out;
1093 1195
1094 err = -EINVAL; 1196 /* Check PMA/PMD Register: 1.0001.2 == 1 */
1095 if (np->link_config.loopback_mode != LOOPBACK_DISABLED) 1197 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
1198 MRVL88X2011_PMA_PMD_STATUS_1);
1199 if (err < 0)
1200 goto out;
1201
1202 pma_status = ((err & MRVL88X2011_LNK_STATUS_OK) ? 1 : 0);
1203
1204 /* Check PMC Register : 3.0001.2 == 1: read twice */
1205 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR,
1206 MRVL88X2011_PMA_PMD_STATUS_1);
1207 if (err < 0)
1208 goto out;
1209
1210 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR,
1211 MRVL88X2011_PMA_PMD_STATUS_1);
1212 if (err < 0)
1096 goto out; 1213 goto out;
1097 1214
1215 pcs_status = ((err & MRVL88X2011_LNK_STATUS_OK) ? 1 : 0);
1216
1217 /* Check XGXS Register : 4.0018.[0-3,12] */
1218 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV4_ADDR,
1219 MRVL88X2011_10G_XGXS_LANE_STAT);
1220 if (err < 0)
1221 goto out;
1222
1223 if (err == (PHYXS_XGXS_LANE_STAT_ALINGED | PHYXS_XGXS_LANE_STAT_LANE3 |
1224 PHYXS_XGXS_LANE_STAT_LANE2 | PHYXS_XGXS_LANE_STAT_LANE1 |
1225 PHYXS_XGXS_LANE_STAT_LANE0 | PHYXS_XGXS_LANE_STAT_MAGIC |
1226 0x800))
1227 link_up = (pma_status && pcs_status) ? 1 : 0;
1228
1229 np->link_config.active_speed = SPEED_10000;
1230 np->link_config.active_duplex = DUPLEX_FULL;
1231 err = 0;
1232out:
1233 mrvl88x2011_act_led(np, (link_up ?
1234 MRVL88X2011_LED_CTL_PCS_ACT :
1235 MRVL88X2011_LED_CTL_OFF));
1236
1237 *link_up_p = link_up;
1238 return err;
1239}
1240
1241static int link_status_10g_bcom(struct niu *np, int *link_up_p)
1242{
1243 int err, link_up;
1244
1245 link_up = 0;
1246
1098 err = mdio_read(np, np->phy_addr, BCM8704_PMA_PMD_DEV_ADDR, 1247 err = mdio_read(np, np->phy_addr, BCM8704_PMA_PMD_DEV_ADDR,
1099 BCM8704_PMD_RCV_SIGDET); 1248 BCM8704_PMD_RCV_SIGDET);
1100 if (err < 0) 1249 if (err < 0)
@@ -1134,14 +1283,43 @@ static int link_status_10g(struct niu *np, int *link_up_p)
1134 err = 0; 1283 err = 0;
1135 1284
1136out: 1285out:
1286 *link_up_p = link_up;
1287 return err;
1288}
1289
1290static int link_status_10g(struct niu *np, int *link_up_p)
1291{
1292 unsigned long flags;
1293 int err = -EINVAL;
1294
1295 spin_lock_irqsave(&np->lock, flags);
1296
1297 if (np->link_config.loopback_mode == LOOPBACK_DISABLED) {
1298 int phy_id;
1299
1300 phy_id = phy_decode(np->parent->port_phy, np->port);
1301 phy_id = np->parent->phy_probe_info.phy_id[phy_id][np->port];
1302
1303 /* handle different phy types */
1304 switch (phy_id & NIU_PHY_ID_MASK) {
1305 case NIU_PHY_ID_MRVL88X2011:
1306 err = link_status_10g_mrvl(np, link_up_p);
1307 break;
1308
1309 default: /* bcom 8704 */
1310 err = link_status_10g_bcom(np, link_up_p);
1311 break;
1312 }
1313 }
1314
1137 spin_unlock_irqrestore(&np->lock, flags); 1315 spin_unlock_irqrestore(&np->lock, flags);
1138 1316
1139 *link_up_p = link_up;
1140 return err; 1317 return err;
1141} 1318}
1142 1319
1143static int link_status_1g(struct niu *np, int *link_up_p) 1320static int link_status_1g(struct niu *np, int *link_up_p)
1144{ 1321{
1322 struct niu_link_config *lp = &np->link_config;
1145 u16 current_speed, bmsr; 1323 u16 current_speed, bmsr;
1146 unsigned long flags; 1324 unsigned long flags;
1147 u8 current_duplex; 1325 u8 current_duplex;
@@ -1209,6 +1387,8 @@ static int link_status_1g(struct niu *np, int *link_up_p)
1209 link_up = 0; 1387 link_up = 0;
1210 } 1388 }
1211 } 1389 }
1390 lp->active_speed = current_speed;
1391 lp->active_duplex = current_duplex;
1212 err = 0; 1392 err = 0;
1213 1393
1214out: 1394out:
@@ -2241,6 +2421,8 @@ static int niu_process_rx_pkt(struct niu *np, struct rx_ring_info *rp)
2241 skb->protocol = eth_type_trans(skb, np->dev); 2421 skb->protocol = eth_type_trans(skb, np->dev);
2242 netif_receive_skb(skb); 2422 netif_receive_skb(skb);
2243 2423
2424 np->dev->last_rx = jiffies;
2425
2244 return num_rcr; 2426 return num_rcr;
2245} 2427}
2246 2428
@@ -2508,15 +2690,19 @@ static int niu_rx_error(struct niu *np, struct rx_ring_info *rp)
2508 u64 stat = nr64(RX_DMA_CTL_STAT(rp->rx_channel)); 2690 u64 stat = nr64(RX_DMA_CTL_STAT(rp->rx_channel));
2509 int err = 0; 2691 int err = 0;
2510 2692
2511 dev_err(np->device, PFX "%s: RX channel %u error, stat[%llx]\n",
2512 np->dev->name, rp->rx_channel, (unsigned long long) stat);
2513
2514 niu_log_rxchan_errors(np, rp, stat);
2515 2693
2516 if (stat & (RX_DMA_CTL_STAT_CHAN_FATAL | 2694 if (stat & (RX_DMA_CTL_STAT_CHAN_FATAL |
2517 RX_DMA_CTL_STAT_PORT_FATAL)) 2695 RX_DMA_CTL_STAT_PORT_FATAL))
2518 err = -EINVAL; 2696 err = -EINVAL;
2519 2697
2698 if (err) {
2699 dev_err(np->device, PFX "%s: RX channel %u error, stat[%llx]\n",
2700 np->dev->name, rp->rx_channel,
2701 (unsigned long long) stat);
2702
2703 niu_log_rxchan_errors(np, rp, stat);
2704 }
2705
2520 nw64(RX_DMA_CTL_STAT(rp->rx_channel), 2706 nw64(RX_DMA_CTL_STAT(rp->rx_channel),
2521 stat & RX_DMA_CTL_WRITE_CLEAR_ERRS); 2707 stat & RX_DMA_CTL_WRITE_CLEAR_ERRS);
2522 2708
@@ -2749,13 +2935,16 @@ static int niu_device_error(struct niu *np)
2749 return -ENODEV; 2935 return -ENODEV;
2750} 2936}
2751 2937
2752static int niu_slowpath_interrupt(struct niu *np, struct niu_ldg *lp) 2938static int niu_slowpath_interrupt(struct niu *np, struct niu_ldg *lp,
2939 u64 v0, u64 v1, u64 v2)
2753{ 2940{
2754 u64 v0 = lp->v0; 2941
2755 u64 v1 = lp->v1;
2756 u64 v2 = lp->v2;
2757 int i, err = 0; 2942 int i, err = 0;
2758 2943
2944 lp->v0 = v0;
2945 lp->v1 = v1;
2946 lp->v2 = v2;
2947
2759 if (v1 & 0x00000000ffffffffULL) { 2948 if (v1 & 0x00000000ffffffffULL) {
2760 u32 rx_vec = (v1 & 0xffffffff); 2949 u32 rx_vec = (v1 & 0xffffffff);
2761 2950
@@ -2764,8 +2953,13 @@ static int niu_slowpath_interrupt(struct niu *np, struct niu_ldg *lp)
2764 2953
2765 if (rx_vec & (1 << rp->rx_channel)) { 2954 if (rx_vec & (1 << rp->rx_channel)) {
2766 int r = niu_rx_error(np, rp); 2955 int r = niu_rx_error(np, rp);
2767 if (r) 2956 if (r) {
2768 err = r; 2957 err = r;
2958 } else {
2959 if (!v0)
2960 nw64(RX_DMA_CTL_STAT(rp->rx_channel),
2961 RX_DMA_CTL_STAT_MEX);
2962 }
2769 } 2963 }
2770 } 2964 }
2771 } 2965 }
@@ -2803,7 +2997,7 @@ static int niu_slowpath_interrupt(struct niu *np, struct niu_ldg *lp)
2803 if (err) 2997 if (err)
2804 niu_enable_interrupts(np, 0); 2998 niu_enable_interrupts(np, 0);
2805 2999
2806 return -EINVAL; 3000 return err;
2807} 3001}
2808 3002
2809static void niu_rxchan_intr(struct niu *np, struct rx_ring_info *rp, 3003static void niu_rxchan_intr(struct niu *np, struct rx_ring_info *rp,
@@ -2905,7 +3099,7 @@ static irqreturn_t niu_interrupt(int irq, void *dev_id)
2905 } 3099 }
2906 3100
2907 if (unlikely((v0 & ((u64)1 << LDN_MIF)) || v1 || v2)) { 3101 if (unlikely((v0 & ((u64)1 << LDN_MIF)) || v1 || v2)) {
2908 int err = niu_slowpath_interrupt(np, lp); 3102 int err = niu_slowpath_interrupt(np, lp, v0, v1, v2);
2909 if (err) 3103 if (err)
2910 goto out; 3104 goto out;
2911 } 3105 }
@@ -5194,7 +5388,8 @@ static int niu_start_xmit(struct sk_buff *skb, struct net_device *dev)
5194 } 5388 }
5195 kfree_skb(skb); 5389 kfree_skb(skb);
5196 skb = skb_new; 5390 skb = skb_new;
5197 } 5391 } else
5392 skb_orphan(skb);
5198 5393
5199 align = ((unsigned long) skb->data & (16 - 1)); 5394 align = ((unsigned long) skb->data & (16 - 1));
5200 headroom = align + sizeof(struct tx_pkt_hdr); 5395 headroom = align + sizeof(struct tx_pkt_hdr);
@@ -6282,7 +6477,8 @@ static int __devinit phy_record(struct niu_parent *parent,
6282 if (dev_id_1 < 0 || dev_id_2 < 0) 6477 if (dev_id_1 < 0 || dev_id_2 < 0)
6283 return 0; 6478 return 0;
6284 if (type == PHY_TYPE_PMA_PMD || type == PHY_TYPE_PCS) { 6479 if (type == PHY_TYPE_PMA_PMD || type == PHY_TYPE_PCS) {
6285 if ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM8704) 6480 if (((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM8704) &&
6481 ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_MRVL88X2011))
6286 return 0; 6482 return 0;
6287 } else { 6483 } else {
6288 if ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM5464R) 6484 if ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM5464R)
diff --git a/drivers/net/niu.h b/drivers/net/niu.h
index 10e3f111b6d5..0e8626adc573 100644
--- a/drivers/net/niu.h
+++ b/drivers/net/niu.h
@@ -2538,6 +2538,39 @@ struct fcram_hash_ipv6 {
2538#define NIU_PHY_ID_MASK 0xfffff0f0 2538#define NIU_PHY_ID_MASK 0xfffff0f0
2539#define NIU_PHY_ID_BCM8704 0x00206030 2539#define NIU_PHY_ID_BCM8704 0x00206030
2540#define NIU_PHY_ID_BCM5464R 0x002060b0 2540#define NIU_PHY_ID_BCM5464R 0x002060b0
2541#define NIU_PHY_ID_MRVL88X2011 0x01410020
2542
2543/* MRVL88X2011 register addresses */
2544#define MRVL88X2011_USER_DEV1_ADDR 1
2545#define MRVL88X2011_USER_DEV2_ADDR 2
2546#define MRVL88X2011_USER_DEV3_ADDR 3
2547#define MRVL88X2011_USER_DEV4_ADDR 4
2548#define MRVL88X2011_PMA_PMD_CTL_1 0x0000
2549#define MRVL88X2011_PMA_PMD_STATUS_1 0x0001
2550#define MRVL88X2011_10G_PMD_STATUS_2 0x0008
2551#define MRVL88X2011_10G_PMD_TX_DIS 0x0009
2552#define MRVL88X2011_10G_XGXS_LANE_STAT 0x0018
2553#define MRVL88X2011_GENERAL_CTL 0x8300
2554#define MRVL88X2011_LED_BLINK_CTL 0x8303
2555#define MRVL88X2011_LED_8_TO_11_CTL 0x8306
2556
2557/* MRVL88X2011 register control */
2558#define MRVL88X2011_ENA_XFPREFCLK 0x0001
2559#define MRVL88X2011_ENA_PMDTX 0x0000
2560#define MRVL88X2011_LOOPBACK 0x1
2561#define MRVL88X2011_LED_ACT 0x1
2562#define MRVL88X2011_LNK_STATUS_OK 0x4
2563#define MRVL88X2011_LED_BLKRATE_MASK 0x70
2564#define MRVL88X2011_LED_BLKRATE_034MS 0x0
2565#define MRVL88X2011_LED_BLKRATE_067MS 0x1
2566#define MRVL88X2011_LED_BLKRATE_134MS 0x2
2567#define MRVL88X2011_LED_BLKRATE_269MS 0x3
2568#define MRVL88X2011_LED_BLKRATE_538MS 0x4
2569#define MRVL88X2011_LED_CTL_OFF 0x0
2570#define MRVL88X2011_LED_CTL_PCS_ACT 0x5
2571#define MRVL88X2011_LED_CTL_MASK 0x7
2572#define MRVL88X2011_LED(n,v) ((v)<<((n)*4))
2573#define MRVL88X2011_LED_STAT(n,v) ((v)>>((n)*4))
2541 2574
2542#define BCM8704_PMA_PMD_DEV_ADDR 1 2575#define BCM8704_PMA_PMD_DEV_ADDR 1
2543#define BCM8704_PCS_DEV_ADDR 2 2576#define BCM8704_PCS_DEV_ADDR 2
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 288177716a49..36a7ba3134ce 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -187,14 +187,16 @@ enum Window1 {
187enum Window3 { /* Window 3: MAC/config bits. */ 187enum Window3 { /* Window 3: MAC/config bits. */
188 Wn3_Config=0, Wn3_MAC_Ctrl=6, Wn3_Options=8, 188 Wn3_Config=0, Wn3_MAC_Ctrl=6, Wn3_Options=8,
189}; 189};
190union wn3_config { 190enum wn3_config {
191 int i; 191 Ram_size = 7,
192 struct w3_config_fields { 192 Ram_width = 8,
193 unsigned int ram_size:3, ram_width:1, ram_speed:2, rom_size:2; 193 Ram_speed = 0x30,
194 int pad8:8; 194 Rom_size = 0xc0,
195 unsigned int ram_split:2, pad18:2, xcvr:3, pad21:1, autoselect:1; 195 Ram_split_shift = 16,
196 int pad24:7; 196 Ram_split = 3 << Ram_split_shift,
197 } u; 197 Xcvr_shift = 20,
198 Xcvr = 7 << Xcvr_shift,
199 Autoselect = 0x1000000,
198}; 200};
199 201
200enum Window4 { /* Window 4: Xcvr/media bits. */ 202enum Window4 { /* Window 4: Xcvr/media bits. */
@@ -342,7 +344,7 @@ static int tc574_config(struct pcmcia_device *link)
342 kio_addr_t ioaddr; 344 kio_addr_t ioaddr;
343 __be16 *phys_addr; 345 __be16 *phys_addr;
344 char *cardname; 346 char *cardname;
345 union wn3_config config; 347 __u32 config;
346 DECLARE_MAC_BUF(mac); 348 DECLARE_MAC_BUF(mac);
347 349
348 phys_addr = (__be16 *)dev->dev_addr; 350 phys_addr = (__be16 *)dev->dev_addr;
@@ -401,9 +403,9 @@ static int tc574_config(struct pcmcia_device *link)
401 outw(0<<11, ioaddr + RunnerRdCtrl); 403 outw(0<<11, ioaddr + RunnerRdCtrl);
402 printk(KERN_INFO " ASIC rev %d,", mcr>>3); 404 printk(KERN_INFO " ASIC rev %d,", mcr>>3);
403 EL3WINDOW(3); 405 EL3WINDOW(3);
404 config.i = inl(ioaddr + Wn3_Config); 406 config = inl(ioaddr + Wn3_Config);
405 lp->default_media = config.u.xcvr; 407 lp->default_media = (config & Xcvr) >> Xcvr_shift;
406 lp->autoselect = config.u.autoselect; 408 lp->autoselect = config & Autoselect ? 1 : 0;
407 } 409 }
408 410
409 init_timer(&lp->media); 411 init_timer(&lp->media);
@@ -464,8 +466,9 @@ static int tc574_config(struct pcmcia_device *link)
464 dev->name, cardname, dev->base_addr, dev->irq, 466 dev->name, cardname, dev->base_addr, dev->irq,
465 print_mac(mac, dev->dev_addr)); 467 print_mac(mac, dev->dev_addr));
466 printk(" %dK FIFO split %s Rx:Tx, %sMII interface.\n", 468 printk(" %dK FIFO split %s Rx:Tx, %sMII interface.\n",
467 8 << config.u.ram_size, ram_split[config.u.ram_split], 469 8 << config & Ram_size,
468 config.u.autoselect ? "autoselect " : ""); 470 ram_split[(config & Ram_split) >> Ram_split_shift],
471 config & Autoselect ? "autoselect " : "");
469 472
470 return 0; 473 return 0;
471 474
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index ff92aca0a7b3..90498ffe26f2 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -455,9 +455,14 @@ static void pcnet32_netif_start(struct net_device *dev)
455{ 455{
456#ifdef CONFIG_PCNET32_NAPI 456#ifdef CONFIG_PCNET32_NAPI
457 struct pcnet32_private *lp = netdev_priv(dev); 457 struct pcnet32_private *lp = netdev_priv(dev);
458 ulong ioaddr = dev->base_addr;
459 u16 val;
458#endif 460#endif
459 netif_wake_queue(dev); 461 netif_wake_queue(dev);
460#ifdef CONFIG_PCNET32_NAPI 462#ifdef CONFIG_PCNET32_NAPI
463 val = lp->a.read_csr(ioaddr, CSR3);
464 val &= 0x00ff;
465 lp->a.write_csr(ioaddr, CSR3, val);
461 napi_enable(&lp->napi); 466 napi_enable(&lp->napi);
462#endif 467#endif
463} 468}
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index a5791114b7bd..cf0774de6c41 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -2320,14 +2320,9 @@ static int ql_poll(struct napi_struct *napi, int budget)
2320 unsigned long hw_flags; 2320 unsigned long hw_flags;
2321 struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; 2321 struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers;
2322 2322
2323 if (!netif_carrier_ok(ndev))
2324 goto quit_polling;
2325
2326 ql_tx_rx_clean(qdev, &tx_cleaned, &rx_cleaned, budget); 2323 ql_tx_rx_clean(qdev, &tx_cleaned, &rx_cleaned, budget);
2327 2324
2328 if (tx_cleaned + rx_cleaned != budget || 2325 if (tx_cleaned + rx_cleaned != budget) {
2329 !netif_running(ndev)) {
2330quit_polling:
2331 spin_lock_irqsave(&qdev->hw_lock, hw_flags); 2326 spin_lock_irqsave(&qdev->hw_lock, hw_flags);
2332 __netif_rx_complete(ndev, napi); 2327 __netif_rx_complete(ndev, napi);
2333 ql_update_small_bufq_prod_index(qdev); 2328 ql_update_small_bufq_prod_index(qdev);
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 5863190894cc..3acfeeabdee1 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -2002,7 +2002,7 @@ static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version)
2002 u32 clk; 2002 u32 clk;
2003 2003
2004 clk = RTL_R8(Config2) & PCI_Clock_66MHz; 2004 clk = RTL_R8(Config2) & PCI_Clock_66MHz;
2005 for (i = 0; i < ARRAY_SIZE(cfg2_info); i++) { 2005 for (i = 0; i < ARRAY_SIZE(cfg2_info); i++, p++) {
2006 if ((p->mac_version == mac_version) && (p->clk == clk)) { 2006 if ((p->mac_version == mac_version) && (p->clk == clk)) {
2007 RTL_W32(0x7c, p->val); 2007 RTL_W32(0x7c, p->val);
2008 break; 2008 break;
@@ -2398,6 +2398,8 @@ static void rtl8169_wait_for_quiescence(struct net_device *dev)
2398 rtl8169_irq_mask_and_ack(ioaddr); 2398 rtl8169_irq_mask_and_ack(ioaddr);
2399 2399
2400#ifdef CONFIG_R8169_NAPI 2400#ifdef CONFIG_R8169_NAPI
2401 tp->intr_mask = 0xffff;
2402 RTL_W16(IntrMask, tp->intr_event);
2401 napi_enable(&tp->napi); 2403 napi_enable(&tp->napi);
2402#endif 2404#endif
2403} 2405}
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 9d80f1cf73ac..f2ba944e035e 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -84,7 +84,7 @@
84#include "s2io.h" 84#include "s2io.h"
85#include "s2io-regs.h" 85#include "s2io-regs.h"
86 86
87#define DRV_VERSION "2.0.26.10" 87#define DRV_VERSION "2.0.26.17"
88 88
89/* S2io Driver name & version. */ 89/* S2io Driver name & version. */
90static char s2io_driver_name[] = "Neterion"; 90static char s2io_driver_name[] = "Neterion";
@@ -2704,9 +2704,6 @@ static int s2io_poll(struct napi_struct *napi, int budget)
2704 struct XENA_dev_config __iomem *bar0 = nic->bar0; 2704 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2705 int i; 2705 int i;
2706 2706
2707 if (!is_s2io_card_up(nic))
2708 return 0;
2709
2710 mac_control = &nic->mac_control; 2707 mac_control = &nic->mac_control;
2711 config = &nic->config; 2708 config = &nic->config;
2712 2709
@@ -3851,8 +3848,6 @@ static int s2io_open(struct net_device *dev)
3851 netif_carrier_off(dev); 3848 netif_carrier_off(dev);
3852 sp->last_link_state = 0; 3849 sp->last_link_state = 0;
3853 3850
3854 napi_enable(&sp->napi);
3855
3856 if (sp->config.intr_type == MSI_X) { 3851 if (sp->config.intr_type == MSI_X) {
3857 int ret = s2io_enable_msi_x(sp); 3852 int ret = s2io_enable_msi_x(sp);
3858 3853
@@ -3895,7 +3890,6 @@ static int s2io_open(struct net_device *dev)
3895 return 0; 3890 return 0;
3896 3891
3897hw_init_failed: 3892hw_init_failed:
3898 napi_disable(&sp->napi);
3899 if (sp->config.intr_type == MSI_X) { 3893 if (sp->config.intr_type == MSI_X) {
3900 if (sp->entries) { 3894 if (sp->entries) {
3901 kfree(sp->entries); 3895 kfree(sp->entries);
@@ -3935,7 +3929,6 @@ static int s2io_close(struct net_device *dev)
3935 return 0; 3929 return 0;
3936 3930
3937 netif_stop_queue(dev); 3931 netif_stop_queue(dev);
3938 napi_disable(&sp->napi);
3939 /* Reset card, kill tasklet and free Tx and Rx buffers. */ 3932 /* Reset card, kill tasklet and free Tx and Rx buffers. */
3940 s2io_card_down(sp); 3933 s2io_card_down(sp);
3941 3934
@@ -6799,6 +6792,8 @@ static void do_s2io_card_down(struct s2io_nic * sp, int do_io)
6799 struct XENA_dev_config __iomem *bar0 = sp->bar0; 6792 struct XENA_dev_config __iomem *bar0 = sp->bar0;
6800 unsigned long flags; 6793 unsigned long flags;
6801 register u64 val64 = 0; 6794 register u64 val64 = 0;
6795 struct config_param *config;
6796 config = &sp->config;
6802 6797
6803 if (!is_s2io_card_up(sp)) 6798 if (!is_s2io_card_up(sp))
6804 return; 6799 return;
@@ -6810,6 +6805,10 @@ static void do_s2io_card_down(struct s2io_nic * sp, int do_io)
6810 } 6805 }
6811 clear_bit(__S2IO_STATE_CARD_UP, &sp->state); 6806 clear_bit(__S2IO_STATE_CARD_UP, &sp->state);
6812 6807
6808 /* Disable napi */
6809 if (config->napi)
6810 napi_disable(&sp->napi);
6811
6813 /* disable Tx and Rx traffic on the NIC */ 6812 /* disable Tx and Rx traffic on the NIC */
6814 if (do_io) 6813 if (do_io)
6815 stop_nic(sp); 6814 stop_nic(sp);
@@ -6903,6 +6902,11 @@ static int s2io_card_up(struct s2io_nic * sp)
6903 DBG_PRINT(INFO_DBG, "Buf in ring:%d is %d:\n", i, 6902 DBG_PRINT(INFO_DBG, "Buf in ring:%d is %d:\n", i,
6904 atomic_read(&sp->rx_bufs_left[i])); 6903 atomic_read(&sp->rx_bufs_left[i]));
6905 } 6904 }
6905
6906 /* Initialise napi */
6907 if (config->napi)
6908 napi_enable(&sp->napi);
6909
6906 /* Maintain the state prior to the open */ 6910 /* Maintain the state prior to the open */
6907 if (sp->promisc_flg) 6911 if (sp->promisc_flg)
6908 sp->promisc_flg = 0; 6912 sp->promisc_flg = 0;
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index a74fc11a6482..bc15940ce1bc 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -944,7 +944,6 @@ static void tx_init(struct sky2_port *sky2)
944 le = get_tx_le(sky2); 944 le = get_tx_le(sky2);
945 le->addr = 0; 945 le->addr = 0;
946 le->opcode = OP_ADDR64 | HW_OWNER; 946 le->opcode = OP_ADDR64 | HW_OWNER;
947 sky2->tx_addr64 = 0;
948} 947}
949 948
950static inline struct tx_ring_info *tx_le_re(struct sky2_port *sky2, 949static inline struct tx_ring_info *tx_le_re(struct sky2_port *sky2,
@@ -978,13 +977,11 @@ static void sky2_rx_add(struct sky2_port *sky2, u8 op,
978 dma_addr_t map, unsigned len) 977 dma_addr_t map, unsigned len)
979{ 978{
980 struct sky2_rx_le *le; 979 struct sky2_rx_le *le;
981 u32 hi = upper_32_bits(map);
982 980
983 if (sky2->rx_addr64 != hi) { 981 if (sizeof(dma_addr_t) > sizeof(u32)) {
984 le = sky2_next_rx(sky2); 982 le = sky2_next_rx(sky2);
985 le->addr = cpu_to_le32(hi); 983 le->addr = cpu_to_le32(upper_32_bits(map));
986 le->opcode = OP_ADDR64 | HW_OWNER; 984 le->opcode = OP_ADDR64 | HW_OWNER;
987 sky2->rx_addr64 = upper_32_bits(map + len);
988 } 985 }
989 986
990 le = sky2_next_rx(sky2); 987 le = sky2_next_rx(sky2);
@@ -1168,6 +1165,7 @@ static void sky2_vlan_rx_register(struct net_device *dev, struct vlan_group *grp
1168 TX_VLAN_TAG_OFF); 1165 TX_VLAN_TAG_OFF);
1169 } 1166 }
1170 1167
1168 sky2_read32(hw, B0_Y2_SP_LISR);
1171 napi_enable(&hw->napi); 1169 napi_enable(&hw->napi);
1172 netif_tx_unlock_bh(dev); 1170 netif_tx_unlock_bh(dev);
1173} 1171}
@@ -1479,7 +1477,6 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1479 struct tx_ring_info *re; 1477 struct tx_ring_info *re;
1480 unsigned i, len; 1478 unsigned i, len;
1481 dma_addr_t mapping; 1479 dma_addr_t mapping;
1482 u32 addr64;
1483 u16 mss; 1480 u16 mss;
1484 u8 ctrl; 1481 u8 ctrl;
1485 1482
@@ -1492,15 +1489,12 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1492 1489
1493 len = skb_headlen(skb); 1490 len = skb_headlen(skb);
1494 mapping = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE); 1491 mapping = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE);
1495 addr64 = upper_32_bits(mapping);
1496 1492
1497 /* Send high bits if changed or crosses boundary */ 1493 /* Send high bits if needed */
1498 if (addr64 != sky2->tx_addr64 || 1494 if (sizeof(dma_addr_t) > sizeof(u32)) {
1499 upper_32_bits(mapping + len) != sky2->tx_addr64) {
1500 le = get_tx_le(sky2); 1495 le = get_tx_le(sky2);
1501 le->addr = cpu_to_le32(addr64); 1496 le->addr = cpu_to_le32(upper_32_bits(mapping));
1502 le->opcode = OP_ADDR64 | HW_OWNER; 1497 le->opcode = OP_ADDR64 | HW_OWNER;
1503 sky2->tx_addr64 = upper_32_bits(mapping + len);
1504 } 1498 }
1505 1499
1506 /* Check for TCP Segmentation Offload */ 1500 /* Check for TCP Segmentation Offload */
@@ -1581,13 +1575,12 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1581 1575
1582 mapping = pci_map_page(hw->pdev, frag->page, frag->page_offset, 1576 mapping = pci_map_page(hw->pdev, frag->page, frag->page_offset,
1583 frag->size, PCI_DMA_TODEVICE); 1577 frag->size, PCI_DMA_TODEVICE);
1584 addr64 = upper_32_bits(mapping); 1578
1585 if (addr64 != sky2->tx_addr64) { 1579 if (sizeof(dma_addr_t) > sizeof(u32)) {
1586 le = get_tx_le(sky2); 1580 le = get_tx_le(sky2);
1587 le->addr = cpu_to_le32(addr64); 1581 le->addr = cpu_to_le32(upper_32_bits(mapping));
1588 le->ctrl = 0; 1582 le->ctrl = 0;
1589 le->opcode = OP_ADDR64 | HW_OWNER; 1583 le->opcode = OP_ADDR64 | HW_OWNER;
1590 sky2->tx_addr64 = addr64;
1591 } 1584 }
1592 1585
1593 le = get_tx_le(sky2); 1586 le = get_tx_le(sky2);
@@ -2043,6 +2036,7 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
2043 err = sky2_rx_start(sky2); 2036 err = sky2_rx_start(sky2);
2044 sky2_write32(hw, B0_IMSK, imask); 2037 sky2_write32(hw, B0_IMSK, imask);
2045 2038
2039 sky2_read32(hw, B0_Y2_SP_LISR);
2046 napi_enable(&hw->napi); 2040 napi_enable(&hw->napi);
2047 2041
2048 if (err) 2042 if (err)
@@ -3861,6 +3855,7 @@ static int sky2_debug_show(struct seq_file *seq, void *v)
3861 last = sky2_read16(hw, Y2_QADDR(rxqaddr[port], PREF_UNIT_PUT_IDX)), 3855 last = sky2_read16(hw, Y2_QADDR(rxqaddr[port], PREF_UNIT_PUT_IDX)),
3862 sky2_read16(hw, Y2_QADDR(rxqaddr[port], PREF_UNIT_LAST_IDX))); 3856 sky2_read16(hw, Y2_QADDR(rxqaddr[port], PREF_UNIT_LAST_IDX)));
3863 3857
3858 sky2_read32(hw, B0_Y2_SP_LISR);
3864 napi_enable(&hw->napi); 3859 napi_enable(&hw->napi);
3865 return 0; 3860 return 0;
3866} 3861}
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index bc646a47edd2..ffe9b8a50a1b 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -1991,14 +1991,14 @@ struct sky2_port {
1991 u16 tx_cons; /* next le to check */ 1991 u16 tx_cons; /* next le to check */
1992 u16 tx_prod; /* next le to use */ 1992 u16 tx_prod; /* next le to use */
1993 u16 tx_next; /* debug only */ 1993 u16 tx_next; /* debug only */
1994 u32 tx_addr64; 1994
1995 u16 tx_pending; 1995 u16 tx_pending;
1996 u16 tx_last_mss; 1996 u16 tx_last_mss;
1997 u32 tx_tcpsum; 1997 u32 tx_tcpsum;
1998 1998
1999 struct rx_ring_info *rx_ring ____cacheline_aligned_in_smp; 1999 struct rx_ring_info *rx_ring ____cacheline_aligned_in_smp;
2000 struct sky2_rx_le *rx_le; 2000 struct sky2_rx_le *rx_le;
2001 u32 rx_addr64; 2001
2002 u16 rx_next; /* next re to check */ 2002 u16 rx_next; /* next re to check */
2003 u16 rx_put; /* next le index to use */ 2003 u16 rx_put; /* next le index to use */
2004 u16 rx_pending; 2004 u16 rx_pending;
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
index 41f34bb91cad..6e8b18a3b3cc 100644
--- a/drivers/net/tulip/de4x5.c
+++ b/drivers/net/tulip/de4x5.c
@@ -911,7 +911,7 @@ static int de4x5_init(struct net_device *dev);
911static int de4x5_sw_reset(struct net_device *dev); 911static int de4x5_sw_reset(struct net_device *dev);
912static int de4x5_rx(struct net_device *dev); 912static int de4x5_rx(struct net_device *dev);
913static int de4x5_tx(struct net_device *dev); 913static int de4x5_tx(struct net_device *dev);
914static int de4x5_ast(struct net_device *dev); 914static void de4x5_ast(struct net_device *dev);
915static int de4x5_txur(struct net_device *dev); 915static int de4x5_txur(struct net_device *dev);
916static int de4x5_rx_ovfc(struct net_device *dev); 916static int de4x5_rx_ovfc(struct net_device *dev);
917 917
@@ -984,11 +984,9 @@ static int test_bad_enet(struct net_device *dev, int status);
984static int an_exception(struct de4x5_private *lp); 984static int an_exception(struct de4x5_private *lp);
985static char *build_setup_frame(struct net_device *dev, int mode); 985static char *build_setup_frame(struct net_device *dev, int mode);
986static void disable_ast(struct net_device *dev); 986static void disable_ast(struct net_device *dev);
987static void enable_ast(struct net_device *dev, u32 time_out);
988static long de4x5_switch_mac_port(struct net_device *dev); 987static long de4x5_switch_mac_port(struct net_device *dev);
989static int gep_rd(struct net_device *dev); 988static int gep_rd(struct net_device *dev);
990static void gep_wr(s32 data, struct net_device *dev); 989static void gep_wr(s32 data, struct net_device *dev);
991static void timeout(struct net_device *dev, void (*fn)(u_long data), u_long data, u_long msec);
992static void yawn(struct net_device *dev, int state); 990static void yawn(struct net_device *dev, int state);
993static void de4x5_parse_params(struct net_device *dev); 991static void de4x5_parse_params(struct net_device *dev);
994static void de4x5_dbg_open(struct net_device *dev); 992static void de4x5_dbg_open(struct net_device *dev);
@@ -1139,6 +1137,8 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev)
1139 lp->gendev = gendev; 1137 lp->gendev = gendev;
1140 spin_lock_init(&lp->lock); 1138 spin_lock_init(&lp->lock);
1141 init_timer(&lp->timer); 1139 init_timer(&lp->timer);
1140 lp->timer.function = (void (*)(unsigned long))de4x5_ast;
1141 lp->timer.data = (unsigned long)dev;
1142 de4x5_parse_params(dev); 1142 de4x5_parse_params(dev);
1143 1143
1144 /* 1144 /*
@@ -1311,7 +1311,7 @@ de4x5_open(struct net_device *dev)
1311 lp->state = OPEN; 1311 lp->state = OPEN;
1312 de4x5_dbg_open(dev); 1312 de4x5_dbg_open(dev);
1313 1313
1314 if (request_irq(dev->irq, (void *)de4x5_interrupt, IRQF_SHARED, 1314 if (request_irq(dev->irq, de4x5_interrupt, IRQF_SHARED,
1315 lp->adapter_name, dev)) { 1315 lp->adapter_name, dev)) {
1316 printk("de4x5_open(): Requested IRQ%d is busy - attemping FAST/SHARE...", dev->irq); 1316 printk("de4x5_open(): Requested IRQ%d is busy - attemping FAST/SHARE...", dev->irq);
1317 if (request_irq(dev->irq, de4x5_interrupt, IRQF_DISABLED | IRQF_SHARED, 1317 if (request_irq(dev->irq, de4x5_interrupt, IRQF_DISABLED | IRQF_SHARED,
@@ -1737,27 +1737,29 @@ de4x5_tx(struct net_device *dev)
1737 return 0; 1737 return 0;
1738} 1738}
1739 1739
1740static int 1740static void
1741de4x5_ast(struct net_device *dev) 1741de4x5_ast(struct net_device *dev)
1742{ 1742{
1743 struct de4x5_private *lp = netdev_priv(dev); 1743 struct de4x5_private *lp = netdev_priv(dev);
1744 int next_tick = DE4X5_AUTOSENSE_MS; 1744 int next_tick = DE4X5_AUTOSENSE_MS;
1745 int dt;
1745 1746
1746 disable_ast(dev); 1747 if (lp->useSROM)
1748 next_tick = srom_autoconf(dev);
1749 else if (lp->chipset == DC21140)
1750 next_tick = dc21140m_autoconf(dev);
1751 else if (lp->chipset == DC21041)
1752 next_tick = dc21041_autoconf(dev);
1753 else if (lp->chipset == DC21040)
1754 next_tick = dc21040_autoconf(dev);
1755 lp->linkOK = 0;
1747 1756
1748 if (lp->useSROM) { 1757 dt = (next_tick * HZ) / 1000;
1749 next_tick = srom_autoconf(dev);
1750 } else if (lp->chipset == DC21140) {
1751 next_tick = dc21140m_autoconf(dev);
1752 } else if (lp->chipset == DC21041) {
1753 next_tick = dc21041_autoconf(dev);
1754 } else if (lp->chipset == DC21040) {
1755 next_tick = dc21040_autoconf(dev);
1756 }
1757 lp->linkOK = 0;
1758 enable_ast(dev, next_tick);
1759 1758
1760 return 0; 1759 if (!dt)
1760 dt = 1;
1761
1762 mod_timer(&lp->timer, jiffies + dt);
1761} 1763}
1762 1764
1763static int 1765static int
@@ -2174,7 +2176,7 @@ srom_search(struct net_device *dev, struct pci_dev *pdev)
2174 for (j=0, i=0; i<ETH_ALEN; i++) { 2176 for (j=0, i=0; i<ETH_ALEN; i++) {
2175 j += (u_char) *((u_char *)&lp->srom + SROM_HWADD + i); 2177 j += (u_char) *((u_char *)&lp->srom + SROM_HWADD + i);
2176 } 2178 }
2177 if ((j != 0) && (j != 0x5fa)) { 2179 if (j != 0 && j != 6 * 0xff) {
2178 last.chipset = device; 2180 last.chipset = device;
2179 last.bus = pb; 2181 last.bus = pb;
2180 last.irq = irq; 2182 last.irq = irq;
@@ -2371,30 +2373,19 @@ static struct pci_driver de4x5_pci_driver = {
2371static int 2373static int
2372autoconf_media(struct net_device *dev) 2374autoconf_media(struct net_device *dev)
2373{ 2375{
2374 struct de4x5_private *lp = netdev_priv(dev); 2376 struct de4x5_private *lp = netdev_priv(dev);
2375 u_long iobase = dev->base_addr; 2377 u_long iobase = dev->base_addr;
2376 int next_tick = DE4X5_AUTOSENSE_MS;
2377 2378
2378 lp->linkOK = 0; 2379 disable_ast(dev);
2379 lp->c_media = AUTO; /* Bogus last media */
2380 disable_ast(dev);
2381 inl(DE4X5_MFC); /* Zero the lost frames counter */
2382 lp->media = INIT;
2383 lp->tcount = 0;
2384 2380
2385 if (lp->useSROM) { 2381 lp->c_media = AUTO; /* Bogus last media */
2386 next_tick = srom_autoconf(dev); 2382 inl(DE4X5_MFC); /* Zero the lost frames counter */
2387 } else if (lp->chipset == DC21040) { 2383 lp->media = INIT;
2388 next_tick = dc21040_autoconf(dev); 2384 lp->tcount = 0;
2389 } else if (lp->chipset == DC21041) {
2390 next_tick = dc21041_autoconf(dev);
2391 } else if (lp->chipset == DC21140) {
2392 next_tick = dc21140m_autoconf(dev);
2393 }
2394 2385
2395 enable_ast(dev, next_tick); 2386 de4x5_ast(dev);
2396 2387
2397 return (lp->media); 2388 return lp->media;
2398} 2389}
2399 2390
2400/* 2391/*
@@ -4018,20 +4009,22 @@ DevicePresent(struct net_device *dev, u_long aprom_addr)
4018 outl(0, aprom_addr); /* Reset Ethernet Address ROM Pointer */ 4009 outl(0, aprom_addr); /* Reset Ethernet Address ROM Pointer */
4019 } 4010 }
4020 } else { /* Read new srom */ 4011 } else { /* Read new srom */
4021 u_short tmp, *p = (short *)((char *)&lp->srom + SROM_HWADD); 4012 u_short tmp;
4013 __le16 *p = (__le16 *)((char *)&lp->srom + SROM_HWADD);
4022 for (i=0; i<(ETH_ALEN>>1); i++) { 4014 for (i=0; i<(ETH_ALEN>>1); i++) {
4023 tmp = srom_rd(aprom_addr, (SROM_HWADD>>1) + i); 4015 tmp = srom_rd(aprom_addr, (SROM_HWADD>>1) + i);
4024 *p = le16_to_cpu(tmp); 4016 j += tmp; /* for check for 0:0:0:0:0:0 or ff:ff:ff:ff:ff:ff */
4025 j += *p++; 4017 *p = cpu_to_le16(tmp);
4026 } 4018 }
4027 if ((j == 0) || (j == 0x2fffd)) { 4019 if (j == 0 || j == 3 * 0xffff) {
4028 return; 4020 /* could get 0 only from all-0 and 3 * 0xffff only from all-1 */
4021 return;
4029 } 4022 }
4030 4023
4031 p=(short *)&lp->srom; 4024 p = (__le16 *)&lp->srom;
4032 for (i=0; i<(sizeof(struct de4x5_srom)>>1); i++) { 4025 for (i=0; i<(sizeof(struct de4x5_srom)>>1); i++) {
4033 tmp = srom_rd(aprom_addr, i); 4026 tmp = srom_rd(aprom_addr, i);
4034 *p++ = le16_to_cpu(tmp); 4027 *p++ = cpu_to_le16(tmp);
4035 } 4028 }
4036 de4x5_dbg_srom((struct de4x5_srom *)&lp->srom); 4029 de4x5_dbg_srom((struct de4x5_srom *)&lp->srom);
4037 } 4030 }
@@ -5161,21 +5154,10 @@ build_setup_frame(struct net_device *dev, int mode)
5161} 5154}
5162 5155
5163static void 5156static void
5164enable_ast(struct net_device *dev, u32 time_out)
5165{
5166 timeout(dev, (void *)&de4x5_ast, (u_long)dev, time_out);
5167
5168 return;
5169}
5170
5171static void
5172disable_ast(struct net_device *dev) 5157disable_ast(struct net_device *dev)
5173{ 5158{
5174 struct de4x5_private *lp = netdev_priv(dev); 5159 struct de4x5_private *lp = netdev_priv(dev);
5175 5160 del_timer_sync(&lp->timer);
5176 del_timer(&lp->timer);
5177
5178 return;
5179} 5161}
5180 5162
5181static long 5163static long
@@ -5245,29 +5227,6 @@ gep_rd(struct net_device *dev)
5245} 5227}
5246 5228
5247static void 5229static void
5248timeout(struct net_device *dev, void (*fn)(u_long data), u_long data, u_long msec)
5249{
5250 struct de4x5_private *lp = netdev_priv(dev);
5251 int dt;
5252
5253 /* First, cancel any pending timer events */
5254 del_timer(&lp->timer);
5255
5256 /* Convert msec to ticks */
5257 dt = (msec * HZ) / 1000;
5258 if (dt==0) dt=1;
5259
5260 /* Set up timer */
5261 init_timer(&lp->timer);
5262 lp->timer.expires = jiffies + dt;
5263 lp->timer.function = fn;
5264 lp->timer.data = data;
5265 add_timer(&lp->timer);
5266
5267 return;
5268}
5269
5270static void
5271yawn(struct net_device *dev, int state) 5230yawn(struct net_device *dev, int state)
5272{ 5231{
5273 struct de4x5_private *lp = netdev_priv(dev); 5232 struct de4x5_private *lp = netdev_priv(dev);
diff --git a/drivers/net/tulip/interrupt.c b/drivers/net/tulip/interrupt.c
index 365331446387..6284afd14bbb 100644
--- a/drivers/net/tulip/interrupt.c
+++ b/drivers/net/tulip/interrupt.c
@@ -117,9 +117,6 @@ int tulip_poll(struct napi_struct *napi, int budget)
117 int received = 0; 117 int received = 0;
118#endif 118#endif
119 119
120 if (!netif_running(dev))
121 goto done;
122
123#ifdef CONFIG_TULIP_NAPI_HW_MITIGATION 120#ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
124 121
125/* that one buffer is needed for mit activation; or might be a 122/* that one buffer is needed for mit activation; or might be a
@@ -151,7 +148,8 @@ int tulip_poll(struct napi_struct *napi, int budget)
151 if (tulip_debug > 5) 148 if (tulip_debug > 5)
152 printk(KERN_DEBUG "%s: In tulip_rx(), entry %d %8.8x.\n", 149 printk(KERN_DEBUG "%s: In tulip_rx(), entry %d %8.8x.\n",
153 dev->name, entry, status); 150 dev->name, entry, status);
154 if (work_done++ >= budget) 151
152 if (++work_done >= budget)
155 goto not_done; 153 goto not_done;
156 154
157 if ((status & 0x38008300) != 0x0300) { 155 if ((status & 0x38008300) != 0x0300) {
@@ -260,8 +258,6 @@ int tulip_poll(struct napi_struct *napi, int budget)
260 * finally: amount of IO did not increase at all. */ 258 * finally: amount of IO did not increase at all. */
261 } while ((ioread32(tp->base_addr + CSR5) & RxIntr)); 259 } while ((ioread32(tp->base_addr + CSR5) & RxIntr));
262 260
263done:
264
265 #ifdef CONFIG_TULIP_NAPI_HW_MITIGATION 261 #ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
266 262
267 /* We use this simplistic scheme for IM. It's proven by 263 /* We use this simplistic scheme for IM. It's proven by
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index e5e2c9c4ebfe..ed600bf56e78 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -797,7 +797,8 @@ static int tulip_close (struct net_device *dev)
797 797
798 tp->rx_ring[i].status = 0; /* Not owned by Tulip chip. */ 798 tp->rx_ring[i].status = 0; /* Not owned by Tulip chip. */
799 tp->rx_ring[i].length = 0; 799 tp->rx_ring[i].length = 0;
800 tp->rx_ring[i].buffer1 = 0xBADF00D0; /* An invalid address. */ 800 /* An invalid address. */
801 tp->rx_ring[i].buffer1 = cpu_to_le32(0xBADF00D0);
801 if (skb) { 802 if (skb) {
802 pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ, 803 pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ,
803 PCI_DMA_FROMDEVICE); 804 PCI_DMA_FROMDEVICE);
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index 70befe33e454..8fc7274642eb 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -83,8 +83,8 @@ static int bufferoffsets[NUMDESCRIPTORS] = {128,2048,4096,6144};
83struct xircom_private { 83struct xircom_private {
84 /* Send and receive buffers, kernel-addressable and dma addressable forms */ 84 /* Send and receive buffers, kernel-addressable and dma addressable forms */
85 85
86 unsigned int *rx_buffer; 86 __le32 *rx_buffer;
87 unsigned int *tx_buffer; 87 __le32 *tx_buffer;
88 88
89 dma_addr_t rx_dma_handle; 89 dma_addr_t rx_dma_handle;
90 dma_addr_t tx_dma_handle; 90 dma_addr_t tx_dma_handle;
@@ -412,19 +412,20 @@ static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev)
412 /* FIXME: The specification tells us that the length we send HAS to be a multiple of 412 /* FIXME: The specification tells us that the length we send HAS to be a multiple of
413 4 bytes. */ 413 4 bytes. */
414 414
415 card->tx_buffer[4*desc+1] = skb->len; 415 card->tx_buffer[4*desc+1] = cpu_to_le32(skb->len);
416 if (desc == NUMDESCRIPTORS-1) 416 if (desc == NUMDESCRIPTORS - 1) /* bit 25: last descriptor of the ring */
417 card->tx_buffer[4*desc+1] |= (1<<25); /* bit 25: last descriptor of the ring */ 417 card->tx_buffer[4*desc+1] |= cpu_to_le32(1<<25);
418 418
419 card->tx_buffer[4*desc+1] |= 0xF0000000; 419 card->tx_buffer[4*desc+1] |= cpu_to_le32(0xF0000000);
420 /* 0xF0... means want interrupts*/ 420 /* 0xF0... means want interrupts*/
421 card->tx_skb[desc] = skb; 421 card->tx_skb[desc] = skb;
422 422
423 wmb(); 423 wmb();
424 /* This gives the descriptor to the card */ 424 /* This gives the descriptor to the card */
425 card->tx_buffer[4*desc] = 0x80000000; 425 card->tx_buffer[4*desc] = cpu_to_le32(0x80000000);
426 trigger_transmit(card); 426 trigger_transmit(card);
427 if (((int)card->tx_buffer[nextdescriptor*4])<0) { /* next descriptor is occupied... */ 427 if (card->tx_buffer[nextdescriptor*4] & cpu_to_le32(0x8000000)) {
428 /* next descriptor is occupied... */
428 netif_stop_queue(dev); 429 netif_stop_queue(dev);
429 } 430 }
430 card->transmit_used = nextdescriptor; 431 card->transmit_used = nextdescriptor;
@@ -590,8 +591,7 @@ descriptors and programs the addresses into the card.
590*/ 591*/
591static void setup_descriptors(struct xircom_private *card) 592static void setup_descriptors(struct xircom_private *card)
592{ 593{
593 unsigned int val; 594 u32 address;
594 unsigned int address;
595 int i; 595 int i;
596 enter("setup_descriptors"); 596 enter("setup_descriptors");
597 597
@@ -604,16 +604,16 @@ static void setup_descriptors(struct xircom_private *card)
604 for (i=0;i<NUMDESCRIPTORS;i++ ) { 604 for (i=0;i<NUMDESCRIPTORS;i++ ) {
605 605
606 /* Rx Descr0: It's empty, let the card own it, no errors -> 0x80000000 */ 606 /* Rx Descr0: It's empty, let the card own it, no errors -> 0x80000000 */
607 card->rx_buffer[i*4 + 0] = 0x80000000; 607 card->rx_buffer[i*4 + 0] = cpu_to_le32(0x80000000);
608 /* Rx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */ 608 /* Rx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */
609 card->rx_buffer[i*4 + 1] = 1536; 609 card->rx_buffer[i*4 + 1] = cpu_to_le32(1536);
610 if (i==NUMDESCRIPTORS-1) 610 if (i == NUMDESCRIPTORS - 1) /* bit 25 is "last descriptor" */
611 card->rx_buffer[i*4 + 1] |= (1 << 25); /* bit 25 is "last descriptor" */ 611 card->rx_buffer[i*4 + 1] |= cpu_to_le32(1 << 25);
612 612
613 /* Rx Descr2: address of the buffer 613 /* Rx Descr2: address of the buffer
614 we store the buffer at the 2nd half of the page */ 614 we store the buffer at the 2nd half of the page */
615 615
616 address = (unsigned long) card->rx_dma_handle; 616 address = card->rx_dma_handle;
617 card->rx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]); 617 card->rx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]);
618 /* Rx Desc3: address of 2nd buffer -> 0 */ 618 /* Rx Desc3: address of 2nd buffer -> 0 */
619 card->rx_buffer[i*4 + 3] = 0; 619 card->rx_buffer[i*4 + 3] = 0;
@@ -621,9 +621,8 @@ static void setup_descriptors(struct xircom_private *card)
621 621
622 wmb(); 622 wmb();
623 /* Write the receive descriptor ring address to the card */ 623 /* Write the receive descriptor ring address to the card */
624 address = (unsigned long) card->rx_dma_handle; 624 address = card->rx_dma_handle;
625 val = cpu_to_le32(address); 625 outl(address, card->io_port + CSR3); /* Receive descr list address */
626 outl(val, card->io_port + CSR3); /* Receive descr list address */
627 626
628 627
629 /* transmit descriptors */ 628 /* transmit descriptors */
@@ -633,13 +632,13 @@ static void setup_descriptors(struct xircom_private *card)
633 /* Tx Descr0: Empty, we own it, no errors -> 0x00000000 */ 632 /* Tx Descr0: Empty, we own it, no errors -> 0x00000000 */
634 card->tx_buffer[i*4 + 0] = 0x00000000; 633 card->tx_buffer[i*4 + 0] = 0x00000000;
635 /* Tx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */ 634 /* Tx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */
636 card->tx_buffer[i*4 + 1] = 1536; 635 card->tx_buffer[i*4 + 1] = cpu_to_le32(1536);
637 if (i==NUMDESCRIPTORS-1) 636 if (i == NUMDESCRIPTORS - 1) /* bit 25 is "last descriptor" */
638 card->tx_buffer[i*4 + 1] |= (1 << 25); /* bit 25 is "last descriptor" */ 637 card->tx_buffer[i*4 + 1] |= cpu_to_le32(1 << 25);
639 638
640 /* Tx Descr2: address of the buffer 639 /* Tx Descr2: address of the buffer
641 we store the buffer at the 2nd half of the page */ 640 we store the buffer at the 2nd half of the page */
642 address = (unsigned long) card->tx_dma_handle; 641 address = card->tx_dma_handle;
643 card->tx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]); 642 card->tx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]);
644 /* Tx Desc3: address of 2nd buffer -> 0 */ 643 /* Tx Desc3: address of 2nd buffer -> 0 */
645 card->tx_buffer[i*4 + 3] = 0; 644 card->tx_buffer[i*4 + 3] = 0;
@@ -647,9 +646,8 @@ static void setup_descriptors(struct xircom_private *card)
647 646
648 wmb(); 647 wmb();
649 /* wite the transmit descriptor ring to the card */ 648 /* wite the transmit descriptor ring to the card */
650 address = (unsigned long) card->tx_dma_handle; 649 address = card->tx_dma_handle;
651 val =cpu_to_le32(address); 650 outl(address, card->io_port + CSR4); /* xmit descr list address */
652 outl(val, card->io_port + CSR4); /* xmit descr list address */
653 651
654 leave("setup_descriptors"); 652 leave("setup_descriptors");
655} 653}
@@ -1180,7 +1178,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri
1180 int status; 1178 int status;
1181 1179
1182 enter("investigate_read_descriptor"); 1180 enter("investigate_read_descriptor");
1183 status = card->rx_buffer[4*descnr]; 1181 status = le32_to_cpu(card->rx_buffer[4*descnr]);
1184 1182
1185 if ((status > 0)) { /* packet received */ 1183 if ((status > 0)) { /* packet received */
1186 1184
@@ -1210,7 +1208,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri
1210 1208
1211 out: 1209 out:
1212 /* give the buffer back to the card */ 1210 /* give the buffer back to the card */
1213 card->rx_buffer[4*descnr] = 0x80000000; 1211 card->rx_buffer[4*descnr] = cpu_to_le32(0x80000000);
1214 trigger_receive(card); 1212 trigger_receive(card);
1215 } 1213 }
1216 1214
@@ -1226,7 +1224,7 @@ static void investigate_write_descriptor(struct net_device *dev, struct xircom_p
1226 1224
1227 enter("investigate_write_descriptor"); 1225 enter("investigate_write_descriptor");
1228 1226
1229 status = card->tx_buffer[4*descnr]; 1227 status = le32_to_cpu(card->tx_buffer[4*descnr]);
1230#if 0 1228#if 0
1231 if (status & 0x8000) { /* Major error */ 1229 if (status & 0x8000) { /* Major error */
1232 printk(KERN_ERR "Major transmit error status %x \n", status); 1230 printk(KERN_ERR "Major transmit error status %x \n", status);
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index 1249f444039e..569028b2baf2 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -202,10 +202,10 @@ static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
202 buf, 202 buf,
203 size, 203 size,
204 USB_CTRL_GET_TIMEOUT); 204 USB_CTRL_GET_TIMEOUT);
205 if (err >= 0 && err < size) 205 if (err == size)
206 err = -EINVAL;
207 if (!err)
208 memcpy(data, buf, size); 206 memcpy(data, buf, size);
207 else if (err >= 0)
208 err = -EINVAL;
209 kfree(buf); 209 kfree(buf);
210 210
211out: 211out:
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index 58a53a641754..569ad8bfd383 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -70,7 +70,7 @@
70#define KAWETH_TX_TIMEOUT (5 * HZ) 70#define KAWETH_TX_TIMEOUT (5 * HZ)
71#define KAWETH_SCRATCH_SIZE 32 71#define KAWETH_SCRATCH_SIZE 32
72#define KAWETH_FIRMWARE_BUF_SIZE 4096 72#define KAWETH_FIRMWARE_BUF_SIZE 4096
73#define KAWETH_CONTROL_TIMEOUT (30 * HZ) 73#define KAWETH_CONTROL_TIMEOUT (30000)
74 74
75#define KAWETH_STATUS_BROKEN 0x0000001 75#define KAWETH_STATUS_BROKEN 0x0000001
76#define KAWETH_STATUS_CLOSING 0x0000002 76#define KAWETH_STATUS_CLOSING 0x0000002
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
index f55a5951733a..5ea7411e1337 100644
--- a/drivers/net/usb/mcs7830.c
+++ b/drivers/net/usb/mcs7830.c
@@ -94,7 +94,7 @@ static int mcs7830_get_reg(struct usbnet *dev, u16 index, u16 size, void *data)
94 94
95 ret = usb_control_msg(xdev, usb_rcvctrlpipe(xdev, 0), MCS7830_RD_BREQ, 95 ret = usb_control_msg(xdev, usb_rcvctrlpipe(xdev, 0), MCS7830_RD_BREQ,
96 MCS7830_RD_BMREQ, 0x0000, index, data, 96 MCS7830_RD_BMREQ, 0x0000, index, data,
97 size, msecs_to_jiffies(MCS7830_CTRL_TIMEOUT)); 97 size, MCS7830_CTRL_TIMEOUT);
98 return ret; 98 return ret;
99} 99}
100 100
@@ -105,7 +105,7 @@ static int mcs7830_set_reg(struct usbnet *dev, u16 index, u16 size, void *data)
105 105
106 ret = usb_control_msg(xdev, usb_sndctrlpipe(xdev, 0), MCS7830_WR_BREQ, 106 ret = usb_control_msg(xdev, usb_sndctrlpipe(xdev, 0), MCS7830_WR_BREQ,
107 MCS7830_WR_BMREQ, 0x0000, index, data, 107 MCS7830_WR_BMREQ, 0x0000, index, data,
108 size, msecs_to_jiffies(MCS7830_CTRL_TIMEOUT)); 108 size, MCS7830_CTRL_TIMEOUT);
109 return ret; 109 return ret;
110} 110}
111 111
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c
index 33dc713b5301..c6f26e28e376 100644
--- a/drivers/net/wan/dscc4.c
+++ b/drivers/net/wan/dscc4.c
@@ -139,19 +139,21 @@ struct thingie {
139}; 139};
140 140
141struct TxFD { 141struct TxFD {
142 u32 state; 142 __le32 state;
143 u32 next; 143 __le32 next;
144 u32 data; 144 __le32 data;
145 u32 complete; 145 __le32 complete;
146 u32 jiffies; /* Allows sizeof(TxFD) == sizeof(RxFD) + extra hack */ 146 u32 jiffies; /* Allows sizeof(TxFD) == sizeof(RxFD) + extra hack */
147 /* FWIW, datasheet calls that "dummy" and says that card
148 * never looks at it; neither does the driver */
147}; 149};
148 150
149struct RxFD { 151struct RxFD {
150 u32 state1; 152 __le32 state1;
151 u32 next; 153 __le32 next;
152 u32 data; 154 __le32 data;
153 u32 state2; 155 __le32 state2;
154 u32 end; 156 __le32 end;
155}; 157};
156 158
157#define DUMMY_SKB_SIZE 64 159#define DUMMY_SKB_SIZE 64
@@ -181,7 +183,7 @@ struct RxFD {
181#define SCC_REG_START(dpriv) (SCC_START+(dpriv->dev_id)*SCC_OFFSET) 183#define SCC_REG_START(dpriv) (SCC_START+(dpriv->dev_id)*SCC_OFFSET)
182 184
183struct dscc4_pci_priv { 185struct dscc4_pci_priv {
184 u32 *iqcfg; 186 __le32 *iqcfg;
185 int cfg_cur; 187 int cfg_cur;
186 spinlock_t lock; 188 spinlock_t lock;
187 struct pci_dev *pdev; 189 struct pci_dev *pdev;
@@ -197,8 +199,8 @@ struct dscc4_dev_priv {
197 199
198 struct RxFD *rx_fd; 200 struct RxFD *rx_fd;
199 struct TxFD *tx_fd; 201 struct TxFD *tx_fd;
200 u32 *iqrx; 202 __le32 *iqrx;
201 u32 *iqtx; 203 __le32 *iqtx;
202 204
203 /* FIXME: check all the volatile are required */ 205 /* FIXME: check all the volatile are required */
204 volatile u32 tx_current; 206 volatile u32 tx_current;
@@ -298,7 +300,7 @@ struct dscc4_dev_priv {
298#define BrrExpMask 0x00000f00 300#define BrrExpMask 0x00000f00
299#define BrrMultMask 0x0000003f 301#define BrrMultMask 0x0000003f
300#define EncodingMask 0x00700000 302#define EncodingMask 0x00700000
301#define Hold 0x40000000 303#define Hold cpu_to_le32(0x40000000)
302#define SccBusy 0x10000000 304#define SccBusy 0x10000000
303#define PowerUp 0x80000000 305#define PowerUp 0x80000000
304#define Vis 0x00001000 306#define Vis 0x00001000
@@ -307,14 +309,14 @@ struct dscc4_dev_priv {
307#define FrameRdo 0x40 309#define FrameRdo 0x40
308#define FrameCrc 0x20 310#define FrameCrc 0x20
309#define FrameRab 0x10 311#define FrameRab 0x10
310#define FrameAborted 0x00000200 312#define FrameAborted cpu_to_le32(0x00000200)
311#define FrameEnd 0x80000000 313#define FrameEnd cpu_to_le32(0x80000000)
312#define DataComplete 0x40000000 314#define DataComplete cpu_to_le32(0x40000000)
313#define LengthCheck 0x00008000 315#define LengthCheck 0x00008000
314#define SccEvt 0x02000000 316#define SccEvt 0x02000000
315#define NoAck 0x00000200 317#define NoAck 0x00000200
316#define Action 0x00000001 318#define Action 0x00000001
317#define HiDesc 0x20000000 319#define HiDesc cpu_to_le32(0x20000000)
318 320
319/* SCC events */ 321/* SCC events */
320#define RxEvt 0xf0000000 322#define RxEvt 0xf0000000
@@ -489,8 +491,8 @@ static void dscc4_release_ring(struct dscc4_dev_priv *dpriv)
489 skbuff = dpriv->tx_skbuff; 491 skbuff = dpriv->tx_skbuff;
490 for (i = 0; i < TX_RING_SIZE; i++) { 492 for (i = 0; i < TX_RING_SIZE; i++) {
491 if (*skbuff) { 493 if (*skbuff) {
492 pci_unmap_single(pdev, tx_fd->data, (*skbuff)->len, 494 pci_unmap_single(pdev, le32_to_cpu(tx_fd->data),
493 PCI_DMA_TODEVICE); 495 (*skbuff)->len, PCI_DMA_TODEVICE);
494 dev_kfree_skb(*skbuff); 496 dev_kfree_skb(*skbuff);
495 } 497 }
496 skbuff++; 498 skbuff++;
@@ -500,7 +502,7 @@ static void dscc4_release_ring(struct dscc4_dev_priv *dpriv)
500 skbuff = dpriv->rx_skbuff; 502 skbuff = dpriv->rx_skbuff;
501 for (i = 0; i < RX_RING_SIZE; i++) { 503 for (i = 0; i < RX_RING_SIZE; i++) {
502 if (*skbuff) { 504 if (*skbuff) {
503 pci_unmap_single(pdev, rx_fd->data, 505 pci_unmap_single(pdev, le32_to_cpu(rx_fd->data),
504 RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE); 506 RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE);
505 dev_kfree_skb(*skbuff); 507 dev_kfree_skb(*skbuff);
506 } 508 }
@@ -522,10 +524,10 @@ static inline int try_get_rx_skb(struct dscc4_dev_priv *dpriv,
522 dpriv->rx_skbuff[dirty] = skb; 524 dpriv->rx_skbuff[dirty] = skb;
523 if (skb) { 525 if (skb) {
524 skb->protocol = hdlc_type_trans(skb, dev); 526 skb->protocol = hdlc_type_trans(skb, dev);
525 rx_fd->data = pci_map_single(dpriv->pci_priv->pdev, skb->data, 527 rx_fd->data = cpu_to_le32(pci_map_single(dpriv->pci_priv->pdev,
526 len, PCI_DMA_FROMDEVICE); 528 skb->data, len, PCI_DMA_FROMDEVICE));
527 } else { 529 } else {
528 rx_fd->data = (u32) NULL; 530 rx_fd->data = 0;
529 ret = -1; 531 ret = -1;
530 } 532 }
531 return ret; 533 return ret;
@@ -587,7 +589,7 @@ static inline int dscc4_xpr_ack(struct dscc4_dev_priv *dpriv)
587 589
588 do { 590 do {
589 if (!(dpriv->flags & (NeedIDR | NeedIDT)) || 591 if (!(dpriv->flags & (NeedIDR | NeedIDT)) ||
590 (dpriv->iqtx[cur] & Xpr)) 592 (dpriv->iqtx[cur] & cpu_to_le32(Xpr)))
591 break; 593 break;
592 smp_rmb(); 594 smp_rmb();
593 schedule_timeout_uninterruptible(10); 595 schedule_timeout_uninterruptible(10);
@@ -650,8 +652,9 @@ static inline void dscc4_rx_skb(struct dscc4_dev_priv *dpriv,
650 printk(KERN_DEBUG "%s: skb=0 (%s)\n", dev->name, __FUNCTION__); 652 printk(KERN_DEBUG "%s: skb=0 (%s)\n", dev->name, __FUNCTION__);
651 goto refill; 653 goto refill;
652 } 654 }
653 pkt_len = TO_SIZE(rx_fd->state2); 655 pkt_len = TO_SIZE(le32_to_cpu(rx_fd->state2));
654 pci_unmap_single(pdev, rx_fd->data, RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE); 656 pci_unmap_single(pdev, le32_to_cpu(rx_fd->data),
657 RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE);
655 if ((skb->data[--pkt_len] & FrameOk) == FrameOk) { 658 if ((skb->data[--pkt_len] & FrameOk) == FrameOk) {
656 stats->rx_packets++; 659 stats->rx_packets++;
657 stats->rx_bytes += pkt_len; 660 stats->rx_bytes += pkt_len;
@@ -679,7 +682,7 @@ refill:
679 } 682 }
680 dscc4_rx_update(dpriv, dev); 683 dscc4_rx_update(dpriv, dev);
681 rx_fd->state2 = 0x00000000; 684 rx_fd->state2 = 0x00000000;
682 rx_fd->end = 0xbabeface; 685 rx_fd->end = cpu_to_le32(0xbabeface);
683} 686}
684 687
685static void dscc4_free1(struct pci_dev *pdev) 688static void dscc4_free1(struct pci_dev *pdev)
@@ -772,8 +775,8 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
772 } 775 }
773 /* Global interrupt queue */ 776 /* Global interrupt queue */
774 writel((u32)(((IRQ_RING_SIZE >> 5) - 1) << 20), ioaddr + IQLENR1); 777 writel((u32)(((IRQ_RING_SIZE >> 5) - 1) << 20), ioaddr + IQLENR1);
775 priv->iqcfg = (u32 *) pci_alloc_consistent(pdev, 778 priv->iqcfg = (__le32 *) pci_alloc_consistent(pdev,
776 IRQ_RING_SIZE*sizeof(u32), &priv->iqcfg_dma); 779 IRQ_RING_SIZE*sizeof(__le32), &priv->iqcfg_dma);
777 if (!priv->iqcfg) 780 if (!priv->iqcfg)
778 goto err_free_irq_5; 781 goto err_free_irq_5;
779 writel(priv->iqcfg_dma, ioaddr + IQCFG); 782 writel(priv->iqcfg_dma, ioaddr + IQCFG);
@@ -786,7 +789,7 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
786 */ 789 */
787 for (i = 0; i < dev_per_card; i++) { 790 for (i = 0; i < dev_per_card; i++) {
788 dpriv = priv->root + i; 791 dpriv = priv->root + i;
789 dpriv->iqtx = (u32 *) pci_alloc_consistent(pdev, 792 dpriv->iqtx = (__le32 *) pci_alloc_consistent(pdev,
790 IRQ_RING_SIZE*sizeof(u32), &dpriv->iqtx_dma); 793 IRQ_RING_SIZE*sizeof(u32), &dpriv->iqtx_dma);
791 if (!dpriv->iqtx) 794 if (!dpriv->iqtx)
792 goto err_free_iqtx_6; 795 goto err_free_iqtx_6;
@@ -794,7 +797,7 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
794 } 797 }
795 for (i = 0; i < dev_per_card; i++) { 798 for (i = 0; i < dev_per_card; i++) {
796 dpriv = priv->root + i; 799 dpriv = priv->root + i;
797 dpriv->iqrx = (u32 *) pci_alloc_consistent(pdev, 800 dpriv->iqrx = (__le32 *) pci_alloc_consistent(pdev,
798 IRQ_RING_SIZE*sizeof(u32), &dpriv->iqrx_dma); 801 IRQ_RING_SIZE*sizeof(u32), &dpriv->iqrx_dma);
799 if (!dpriv->iqrx) 802 if (!dpriv->iqrx)
800 goto err_free_iqrx_7; 803 goto err_free_iqrx_7;
@@ -1156,8 +1159,8 @@ static int dscc4_start_xmit(struct sk_buff *skb, struct net_device *dev)
1156 dpriv->tx_skbuff[next] = skb; 1159 dpriv->tx_skbuff[next] = skb;
1157 tx_fd = dpriv->tx_fd + next; 1160 tx_fd = dpriv->tx_fd + next;
1158 tx_fd->state = FrameEnd | TO_STATE_TX(skb->len); 1161 tx_fd->state = FrameEnd | TO_STATE_TX(skb->len);
1159 tx_fd->data = pci_map_single(ppriv->pdev, skb->data, skb->len, 1162 tx_fd->data = cpu_to_le32(pci_map_single(ppriv->pdev, skb->data, skb->len,
1160 PCI_DMA_TODEVICE); 1163 PCI_DMA_TODEVICE));
1161 tx_fd->complete = 0x00000000; 1164 tx_fd->complete = 0x00000000;
1162 tx_fd->jiffies = jiffies; 1165 tx_fd->jiffies = jiffies;
1163 mb(); 1166 mb();
@@ -1508,7 +1511,7 @@ static irqreturn_t dscc4_irq(int irq, void *token)
1508 if (state & Cfg) { 1511 if (state & Cfg) {
1509 if (debug > 0) 1512 if (debug > 0)
1510 printk(KERN_DEBUG "%s: CfgIV\n", DRV_NAME); 1513 printk(KERN_DEBUG "%s: CfgIV\n", DRV_NAME);
1511 if (priv->iqcfg[priv->cfg_cur++%IRQ_RING_SIZE] & Arf) 1514 if (priv->iqcfg[priv->cfg_cur++%IRQ_RING_SIZE] & cpu_to_le32(Arf))
1512 printk(KERN_ERR "%s: %s failed\n", dev->name, "CFG"); 1515 printk(KERN_ERR "%s: %s failed\n", dev->name, "CFG");
1513 if (!(state &= ~Cfg)) 1516 if (!(state &= ~Cfg))
1514 goto out; 1517 goto out;
@@ -1541,7 +1544,7 @@ static void dscc4_tx_irq(struct dscc4_pci_priv *ppriv,
1541 1544
1542try: 1545try:
1543 cur = dpriv->iqtx_current%IRQ_RING_SIZE; 1546 cur = dpriv->iqtx_current%IRQ_RING_SIZE;
1544 state = dpriv->iqtx[cur]; 1547 state = le32_to_cpu(dpriv->iqtx[cur]);
1545 if (!state) { 1548 if (!state) {
1546 if (debug > 4) 1549 if (debug > 4)
1547 printk(KERN_DEBUG "%s: Tx ISR = 0x%08x\n", dev->name, 1550 printk(KERN_DEBUG "%s: Tx ISR = 0x%08x\n", dev->name,
@@ -1580,7 +1583,7 @@ try:
1580 tx_fd = dpriv->tx_fd + cur; 1583 tx_fd = dpriv->tx_fd + cur;
1581 skb = dpriv->tx_skbuff[cur]; 1584 skb = dpriv->tx_skbuff[cur];
1582 if (skb) { 1585 if (skb) {
1583 pci_unmap_single(ppriv->pdev, tx_fd->data, 1586 pci_unmap_single(ppriv->pdev, le32_to_cpu(tx_fd->data),
1584 skb->len, PCI_DMA_TODEVICE); 1587 skb->len, PCI_DMA_TODEVICE);
1585 if (tx_fd->state & FrameEnd) { 1588 if (tx_fd->state & FrameEnd) {
1586 stats->tx_packets++; 1589 stats->tx_packets++;
@@ -1711,7 +1714,7 @@ static void dscc4_rx_irq(struct dscc4_pci_priv *priv,
1711 1714
1712try: 1715try:
1713 cur = dpriv->iqrx_current%IRQ_RING_SIZE; 1716 cur = dpriv->iqrx_current%IRQ_RING_SIZE;
1714 state = dpriv->iqrx[cur]; 1717 state = le32_to_cpu(dpriv->iqrx[cur]);
1715 if (!state) 1718 if (!state)
1716 return; 1719 return;
1717 dpriv->iqrx[cur] = 0; 1720 dpriv->iqrx[cur] = 0;
@@ -1755,7 +1758,7 @@ try:
1755 goto try; 1758 goto try;
1756 rx_fd->state1 &= ~Hold; 1759 rx_fd->state1 &= ~Hold;
1757 rx_fd->state2 = 0x00000000; 1760 rx_fd->state2 = 0x00000000;
1758 rx_fd->end = 0xbabeface; 1761 rx_fd->end = cpu_to_le32(0xbabeface);
1759 //} 1762 //}
1760 goto try; 1763 goto try;
1761 } 1764 }
@@ -1834,7 +1837,7 @@ try:
1834 hdlc_stats(dev)->rx_over_errors++; 1837 hdlc_stats(dev)->rx_over_errors++;
1835 rx_fd->state1 |= Hold; 1838 rx_fd->state1 |= Hold;
1836 rx_fd->state2 = 0x00000000; 1839 rx_fd->state2 = 0x00000000;
1837 rx_fd->end = 0xbabeface; 1840 rx_fd->end = cpu_to_le32(0xbabeface);
1838 } else 1841 } else
1839 dscc4_rx_skb(dpriv, dev); 1842 dscc4_rx_skb(dpriv, dev);
1840 } while (1); 1843 } while (1);
@@ -1904,8 +1907,9 @@ static struct sk_buff *dscc4_init_dummy_skb(struct dscc4_dev_priv *dpriv)
1904 skb_copy_to_linear_data(skb, version, 1907 skb_copy_to_linear_data(skb, version,
1905 strlen(version) % DUMMY_SKB_SIZE); 1908 strlen(version) % DUMMY_SKB_SIZE);
1906 tx_fd->state = FrameEnd | TO_STATE_TX(DUMMY_SKB_SIZE); 1909 tx_fd->state = FrameEnd | TO_STATE_TX(DUMMY_SKB_SIZE);
1907 tx_fd->data = pci_map_single(dpriv->pci_priv->pdev, skb->data, 1910 tx_fd->data = cpu_to_le32(pci_map_single(dpriv->pci_priv->pdev,
1908 DUMMY_SKB_SIZE, PCI_DMA_TODEVICE); 1911 skb->data, DUMMY_SKB_SIZE,
1912 PCI_DMA_TODEVICE));
1909 dpriv->tx_skbuff[last] = skb; 1913 dpriv->tx_skbuff[last] = skb;
1910 } 1914 }
1911 return skb; 1915 return skb;
@@ -1937,8 +1941,8 @@ static int dscc4_init_ring(struct net_device *dev)
1937 tx_fd->state = FrameEnd | TO_STATE_TX(2*DUMMY_SKB_SIZE); 1941 tx_fd->state = FrameEnd | TO_STATE_TX(2*DUMMY_SKB_SIZE);
1938 tx_fd->complete = 0x00000000; 1942 tx_fd->complete = 0x00000000;
1939 /* FIXME: NULL should be ok - to be tried */ 1943 /* FIXME: NULL should be ok - to be tried */
1940 tx_fd->data = dpriv->tx_fd_dma; 1944 tx_fd->data = cpu_to_le32(dpriv->tx_fd_dma);
1941 (tx_fd++)->next = (u32)(dpriv->tx_fd_dma + 1945 (tx_fd++)->next = cpu_to_le32(dpriv->tx_fd_dma +
1942 (++i%TX_RING_SIZE)*sizeof(*tx_fd)); 1946 (++i%TX_RING_SIZE)*sizeof(*tx_fd));
1943 } while (i < TX_RING_SIZE); 1947 } while (i < TX_RING_SIZE);
1944 1948
@@ -1951,12 +1955,12 @@ static int dscc4_init_ring(struct net_device *dev)
1951 /* size set by the host. Multiple of 4 bytes please */ 1955 /* size set by the host. Multiple of 4 bytes please */
1952 rx_fd->state1 = HiDesc; 1956 rx_fd->state1 = HiDesc;
1953 rx_fd->state2 = 0x00000000; 1957 rx_fd->state2 = 0x00000000;
1954 rx_fd->end = 0xbabeface; 1958 rx_fd->end = cpu_to_le32(0xbabeface);
1955 rx_fd->state1 |= TO_STATE_RX(HDLC_MAX_MRU); 1959 rx_fd->state1 |= TO_STATE_RX(HDLC_MAX_MRU);
1956 // FIXME: return value verifiee mais traitement suspect 1960 // FIXME: return value verifiee mais traitement suspect
1957 if (try_get_rx_skb(dpriv, dev) >= 0) 1961 if (try_get_rx_skb(dpriv, dev) >= 0)
1958 dpriv->rx_dirty++; 1962 dpriv->rx_dirty++;
1959 (rx_fd++)->next = (u32)(dpriv->rx_fd_dma + 1963 (rx_fd++)->next = cpu_to_le32(dpriv->rx_fd_dma +
1960 (++i%RX_RING_SIZE)*sizeof(*rx_fd)); 1964 (++i%RX_RING_SIZE)*sizeof(*rx_fd));
1961 } while (i < RX_RING_SIZE); 1965 } while (i < RX_RING_SIZE);
1962 1966
diff --git a/drivers/net/wan/lmc/lmc_media.c b/drivers/net/wan/lmc/lmc_media.c
index 574737b55f39..c9c878cd5c72 100644
--- a/drivers/net/wan/lmc/lmc_media.c
+++ b/drivers/net/wan/lmc/lmc_media.c
@@ -890,16 +890,8 @@ write_av9110 (lmc_softc_t * sc, u_int32_t n, u_int32_t m, u_int32_t v,
890static void 890static void
891lmc_ssi_watchdog (lmc_softc_t * const sc) 891lmc_ssi_watchdog (lmc_softc_t * const sc)
892{ 892{
893 u_int16_t mii17; 893 u_int16_t mii17 = lmc_mii_readreg (sc, 0, 17);
894 struct ssicsr2 894 if (((mii17 >> 3) & 7) == 7)
895 {
896 unsigned short dtr:1, dsr:1, rts:1, cable:3, crc:1, led0:1, led1:1,
897 led2:1, led3:1, fifo:1, ll:1, rl:1, tm:1, loop:1;
898 };
899 struct ssicsr2 *ssicsr;
900 mii17 = lmc_mii_readreg (sc, 0, 17);
901 ssicsr = (struct ssicsr2 *) &mii17;
902 if (ssicsr->cable == 7)
903 { 895 {
904 lmc_led_off (sc, LMC_MII16_LED2); 896 lmc_led_off (sc, LMC_MII16_LED2);
905 } 897 }
diff --git a/drivers/net/wan/sbni.h b/drivers/net/wan/sbni.h
index 27715e70f28b..84264510a8ed 100644
--- a/drivers/net/wan/sbni.h
+++ b/drivers/net/wan/sbni.h
@@ -44,9 +44,15 @@ enum {
44#define PR_RES 0x80 44#define PR_RES 0x80
45 45
46struct sbni_csr1 { 46struct sbni_csr1 {
47 unsigned rxl : 5; 47#ifdef __LITTLE_ENDIAN_BITFIELD
48 unsigned rate : 2; 48 u8 rxl : 5;
49 unsigned : 1; 49 u8 rate : 2;
50 u8 : 1;
51#else
52 u8 : 1;
53 u8 rate : 2;
54 u8 rxl : 5;
55#endif
50}; 56};
51 57
52/* fields in frame header */ 58/* fields in frame header */
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index a28ad230d63e..7b6fc1ab2b90 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -273,6 +273,8 @@ enum {
273#define B43_PHYTYPE_A 0x00 273#define B43_PHYTYPE_A 0x00
274#define B43_PHYTYPE_B 0x01 274#define B43_PHYTYPE_B 0x01
275#define B43_PHYTYPE_G 0x02 275#define B43_PHYTYPE_G 0x02
276#define B43_PHYTYPE_N 0x04
277#define B43_PHYTYPE_LP 0x05
276 278
277/* PHYRegisters */ 279/* PHYRegisters */
278#define B43_PHY_ILT_A_CTRL 0x0072 280#define B43_PHY_ILT_A_CTRL 0x0072
diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h
index 284d17da17d1..08e2e56e48f4 100644
--- a/drivers/net/wireless/b43/main.h
+++ b/drivers/net/wireless/b43/main.h
@@ -39,11 +39,11 @@
39#define PAD_BYTES(nr_bytes) P4D_BYTES( __LINE__ , (nr_bytes)) 39#define PAD_BYTES(nr_bytes) P4D_BYTES( __LINE__ , (nr_bytes))
40 40
41/* Lightweight function to convert a frequency (in Mhz) to a channel number. */ 41/* Lightweight function to convert a frequency (in Mhz) to a channel number. */
42static inline u8 b43_freq_to_channel_a(int freq) 42static inline u8 b43_freq_to_channel_5ghz(int freq)
43{ 43{
44 return ((freq - 5000) / 5); 44 return ((freq - 5000) / 5);
45} 45}
46static inline u8 b43_freq_to_channel_bg(int freq) 46static inline u8 b43_freq_to_channel_2ghz(int freq)
47{ 47{
48 u8 channel; 48 u8 channel;
49 49
@@ -54,19 +54,13 @@ static inline u8 b43_freq_to_channel_bg(int freq)
54 54
55 return channel; 55 return channel;
56} 56}
57static inline u8 b43_freq_to_channel(struct b43_wldev *dev, int freq)
58{
59 if (dev->phy.type == B43_PHYTYPE_A)
60 return b43_freq_to_channel_a(freq);
61 return b43_freq_to_channel_bg(freq);
62}
63 57
64/* Lightweight function to convert a channel number to a frequency (in Mhz). */ 58/* Lightweight function to convert a channel number to a frequency (in Mhz). */
65static inline int b43_channel_to_freq_a(u8 channel) 59static inline int b43_channel_to_freq_5ghz(u8 channel)
66{ 60{
67 return (5000 + (5 * channel)); 61 return (5000 + (5 * channel));
68} 62}
69static inline int b43_channel_to_freq_bg(u8 channel) 63static inline int b43_channel_to_freq_2ghz(u8 channel)
70{ 64{
71 int freq; 65 int freq;
72 66
@@ -77,12 +71,6 @@ static inline int b43_channel_to_freq_bg(u8 channel)
77 71
78 return freq; 72 return freq;
79} 73}
80static inline int b43_channel_to_freq(struct b43_wldev *dev, u8 channel)
81{
82 if (dev->phy.type == B43_PHYTYPE_A)
83 return b43_channel_to_freq_a(channel);
84 return b43_channel_to_freq_bg(channel);
85}
86 74
87static inline int b43_is_cck_rate(int rate) 75static inline int b43_is_cck_rate(int rate)
88{ 76{
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
index 98cf70c5fd47..11f53cb1139e 100644
--- a/drivers/net/wireless/b43/rfkill.c
+++ b/drivers/net/wireless/b43/rfkill.c
@@ -138,8 +138,11 @@ void b43_rfkill_init(struct b43_wldev *dev)
138 rfk->rfkill->user_claim_unsupported = 1; 138 rfk->rfkill->user_claim_unsupported = 1;
139 139
140 rfk->poll_dev = input_allocate_polled_device(); 140 rfk->poll_dev = input_allocate_polled_device();
141 if (!rfk->poll_dev) 141 if (!rfk->poll_dev) {
142 goto err_free_rfk; 142 rfkill_free(rfk->rfkill);
143 goto err_freed_rfk;
144 }
145
143 rfk->poll_dev->private = dev; 146 rfk->poll_dev->private = dev;
144 rfk->poll_dev->poll = b43_rfkill_poll; 147 rfk->poll_dev->poll = b43_rfkill_poll;
145 rfk->poll_dev->poll_interval = 1000; /* msecs */ 148 rfk->poll_dev->poll_interval = 1000; /* msecs */
@@ -175,8 +178,7 @@ err_unreg_rfk:
175err_free_polldev: 178err_free_polldev:
176 input_free_polled_device(rfk->poll_dev); 179 input_free_polled_device(rfk->poll_dev);
177 rfk->poll_dev = NULL; 180 rfk->poll_dev = NULL;
178err_free_rfk: 181err_freed_rfk:
179 rfkill_free(rfk->rfkill);
180 rfk->rfkill = NULL; 182 rfk->rfkill = NULL;
181out_error: 183out_error:
182 rfk->registered = 0; 184 rfk->registered = 0;
@@ -195,6 +197,5 @@ void b43_rfkill_exit(struct b43_wldev *dev)
195 rfkill_unregister(rfk->rfkill); 197 rfkill_unregister(rfk->rfkill);
196 input_free_polled_device(rfk->poll_dev); 198 input_free_polled_device(rfk->poll_dev);
197 rfk->poll_dev = NULL; 199 rfk->poll_dev = NULL;
198 rfkill_free(rfk->rfkill);
199 rfk->rfkill = NULL; 200 rfk->rfkill = NULL;
200} 201}
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 0bd6f8a348a8..3307ba1856b1 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -531,21 +531,32 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
531 switch (chanstat & B43_RX_CHAN_PHYTYPE) { 531 switch (chanstat & B43_RX_CHAN_PHYTYPE) {
532 case B43_PHYTYPE_A: 532 case B43_PHYTYPE_A:
533 status.phymode = MODE_IEEE80211A; 533 status.phymode = MODE_IEEE80211A;
534 status.freq = chanid; 534 B43_WARN_ON(1);
535 status.channel = b43_freq_to_channel_a(chanid); 535 /* FIXME: We don't really know which value the "chanid" contains.
536 break; 536 * So the following assignment might be wrong. */
537 case B43_PHYTYPE_B: 537 status.channel = chanid;
538 status.phymode = MODE_IEEE80211B; 538 status.freq = b43_channel_to_freq_5ghz(status.channel);
539 status.freq = chanid + 2400;
540 status.channel = b43_freq_to_channel_bg(chanid + 2400);
541 break; 539 break;
542 case B43_PHYTYPE_G: 540 case B43_PHYTYPE_G:
543 status.phymode = MODE_IEEE80211G; 541 status.phymode = MODE_IEEE80211G;
542 /* chanid is the radio channel cookie value as used
543 * to tune the radio. */
544 status.freq = chanid + 2400; 544 status.freq = chanid + 2400;
545 status.channel = b43_freq_to_channel_bg(chanid + 2400); 545 status.channel = b43_freq_to_channel_2ghz(status.freq);
546 break;
547 case B43_PHYTYPE_N:
548 status.phymode = 0xDEAD /*FIXME MODE_IEEE80211N*/;
549 /* chanid is the SHM channel cookie. Which is the plain
550 * channel number in b43. */
551 status.channel = chanid;
552 if (chanstat & B43_RX_CHAN_5GHZ)
553 status.freq = b43_freq_to_channel_5ghz(status.freq);
554 else
555 status.freq = b43_freq_to_channel_2ghz(status.freq);
546 break; 556 break;
547 default: 557 default:
548 B43_WARN_ON(1); 558 B43_WARN_ON(1);
559 goto drop;
549 } 560 }
550 561
551 dev->stats.last_rx = jiffies; 562 dev->stats.last_rx = jiffies;
diff --git a/drivers/net/wireless/b43/xmit.h b/drivers/net/wireless/b43/xmit.h
index 03bddd251618..6dc079382f7f 100644
--- a/drivers/net/wireless/b43/xmit.h
+++ b/drivers/net/wireless/b43/xmit.h
@@ -142,49 +142,56 @@ struct b43_rxhdr_fw4 {
142} __attribute__ ((__packed__)); 142} __attribute__ ((__packed__));
143 143
144/* PHY RX Status 0 */ 144/* PHY RX Status 0 */
145#define B43_RX_PHYST0_GAINCTL 0x4000 /* Gain Control */ 145#define B43_RX_PHYST0_GAINCTL 0x4000 /* Gain Control */
146#define B43_RX_PHYST0_PLCPHCF 0x0200 146#define B43_RX_PHYST0_PLCPHCF 0x0200
147#define B43_RX_PHYST0_PLCPFV 0x0100 147#define B43_RX_PHYST0_PLCPFV 0x0100
148#define B43_RX_PHYST0_SHORTPRMBL 0x0080 /* Received with Short Preamble */ 148#define B43_RX_PHYST0_SHORTPRMBL 0x0080 /* Received with Short Preamble */
149#define B43_RX_PHYST0_LCRS 0x0040 149#define B43_RX_PHYST0_LCRS 0x0040
150#define B43_RX_PHYST0_ANT 0x0020 /* Antenna */ 150#define B43_RX_PHYST0_ANT 0x0020 /* Antenna */
151#define B43_RX_PHYST0_UNSRATE 0x0010 151#define B43_RX_PHYST0_UNSRATE 0x0010
152#define B43_RX_PHYST0_CLIP 0x000C 152#define B43_RX_PHYST0_CLIP 0x000C
153#define B43_RX_PHYST0_CLIP_SHIFT 2 153#define B43_RX_PHYST0_CLIP_SHIFT 2
154#define B43_RX_PHYST0_FTYPE 0x0003 /* Frame type */ 154#define B43_RX_PHYST0_FTYPE 0x0003 /* Frame type */
155#define B43_RX_PHYST0_CCK 0x0000 /* Frame type: CCK */ 155#define B43_RX_PHYST0_CCK 0x0000 /* Frame type: CCK */
156#define B43_RX_PHYST0_OFDM 0x0001 /* Frame type: OFDM */ 156#define B43_RX_PHYST0_OFDM 0x0001 /* Frame type: OFDM */
157#define B43_RX_PHYST0_PRE_N 0x0002 /* Pre-standard N-PHY frame */ 157#define B43_RX_PHYST0_PRE_N 0x0002 /* Pre-standard N-PHY frame */
158#define B43_RX_PHYST0_STD_N 0x0003 /* Standard N-PHY frame */ 158#define B43_RX_PHYST0_STD_N 0x0003 /* Standard N-PHY frame */
159 159
160/* PHY RX Status 2 */ 160/* PHY RX Status 2 */
161#define B43_RX_PHYST2_LNAG 0xC000 /* LNA Gain */ 161#define B43_RX_PHYST2_LNAG 0xC000 /* LNA Gain */
162#define B43_RX_PHYST2_LNAG_SHIFT 14 162#define B43_RX_PHYST2_LNAG_SHIFT 14
163#define B43_RX_PHYST2_PNAG 0x3C00 /* PNA Gain */ 163#define B43_RX_PHYST2_PNAG 0x3C00 /* PNA Gain */
164#define B43_RX_PHYST2_PNAG_SHIFT 10 164#define B43_RX_PHYST2_PNAG_SHIFT 10
165#define B43_RX_PHYST2_FOFF 0x03FF /* F offset */ 165#define B43_RX_PHYST2_FOFF 0x03FF /* F offset */
166 166
167/* PHY RX Status 3 */ 167/* PHY RX Status 3 */
168#define B43_RX_PHYST3_DIGG 0x1800 /* DIG Gain */ 168#define B43_RX_PHYST3_DIGG 0x1800 /* DIG Gain */
169#define B43_RX_PHYST3_DIGG_SHIFT 11 169#define B43_RX_PHYST3_DIGG_SHIFT 11
170#define B43_RX_PHYST3_TRSTATE 0x0400 /* TR state */ 170#define B43_RX_PHYST3_TRSTATE 0x0400 /* TR state */
171 171
172/* MAC RX Status */ 172/* MAC RX Status */
173#define B43_RX_MAC_BEACONSENT 0x00008000 /* Beacon send flag */ 173#define B43_RX_MAC_RXST_VALID 0x01000000 /* PHY RXST valid */
174#define B43_RX_MAC_KEYIDX 0x000007E0 /* Key index */ 174#define B43_RX_MAC_TKIP_MICERR 0x00100000 /* TKIP MIC error */
175#define B43_RX_MAC_KEYIDX_SHIFT 5 175#define B43_RX_MAC_TKIP_MICATT 0x00080000 /* TKIP MIC attempted */
176#define B43_RX_MAC_DECERR 0x00000010 /* Decrypt error */ 176#define B43_RX_MAC_AGGTYPE 0x00060000 /* Aggregation type */
177#define B43_RX_MAC_DEC 0x00000008 /* Decryption attempted */ 177#define B43_RX_MAC_AGGTYPE_SHIFT 17
178#define B43_RX_MAC_PADDING 0x00000004 /* Pad bytes present */ 178#define B43_RX_MAC_AMSDU 0x00010000 /* A-MSDU mask */
179#define B43_RX_MAC_RESP 0x00000002 /* Response frame transmitted */ 179#define B43_RX_MAC_BEACONSENT 0x00008000 /* Beacon sent flag */
180#define B43_RX_MAC_FCSERR 0x00000001 /* FCS error */ 180#define B43_RX_MAC_KEYIDX 0x000007E0 /* Key index */
181#define B43_RX_MAC_KEYIDX_SHIFT 5
182#define B43_RX_MAC_DECERR 0x00000010 /* Decrypt error */
183#define B43_RX_MAC_DEC 0x00000008 /* Decryption attempted */
184#define B43_RX_MAC_PADDING 0x00000004 /* Pad bytes present */
185#define B43_RX_MAC_RESP 0x00000002 /* Response frame transmitted */
186#define B43_RX_MAC_FCSERR 0x00000001 /* FCS error */
181 187
182/* RX channel */ 188/* RX channel */
183#define B43_RX_CHAN_GAIN 0xFC00 /* Gain */ 189#define B43_RX_CHAN_40MHZ 0x1000 /* 40 Mhz channel width */
184#define B43_RX_CHAN_GAIN_SHIFT 10 190#define B43_RX_CHAN_5GHZ 0x0800 /* 5 Ghz band */
185#define B43_RX_CHAN_ID 0x03FC /* Channel ID */ 191#define B43_RX_CHAN_ID 0x07F8 /* Channel ID */
186#define B43_RX_CHAN_ID_SHIFT 2 192#define B43_RX_CHAN_ID_SHIFT 3
187#define B43_RX_CHAN_PHYTYPE 0x0003 /* PHY type */ 193#define B43_RX_CHAN_PHYTYPE 0x0007 /* PHY type */
194
188 195
189u8 b43_plcp_get_ratecode_cck(const u8 bitrate); 196u8 b43_plcp_get_ratecode_cck(const u8 bitrate);
190u8 b43_plcp_get_ratecode_ofdm(const u8 bitrate); 197u8 b43_plcp_get_ratecode_ofdm(const u8 bitrate);
diff --git a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c
index 040dc3e36410..cbf15d703201 100644
--- a/drivers/net/wireless/hostap/hostap_plx.c
+++ b/drivers/net/wireless/hostap/hostap_plx.c
@@ -608,7 +608,7 @@ static void prism2_plx_remove(struct pci_dev *pdev)
608 608
609MODULE_DEVICE_TABLE(pci, prism2_plx_id_table); 609MODULE_DEVICE_TABLE(pci, prism2_plx_id_table);
610 610
611static struct pci_driver prism2_plx_drv_id = { 611static struct pci_driver prism2_plx_driver = {
612 .name = "hostap_plx", 612 .name = "hostap_plx",
613 .id_table = prism2_plx_id_table, 613 .id_table = prism2_plx_id_table,
614 .probe = prism2_plx_probe, 614 .probe = prism2_plx_probe,
@@ -618,13 +618,13 @@ static struct pci_driver prism2_plx_drv_id = {
618 618
619static int __init init_prism2_plx(void) 619static int __init init_prism2_plx(void)
620{ 620{
621 return pci_register_driver(&prism2_plx_drv_id); 621 return pci_register_driver(&prism2_plx_driver);
622} 622}
623 623
624 624
625static void __exit exit_prism2_plx(void) 625static void __exit exit_prism2_plx(void)
626{ 626{
627 pci_unregister_driver(&prism2_plx_drv_id); 627 pci_unregister_driver(&prism2_plx_driver);
628} 628}
629 629
630 630
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 88062c1318a8..003f73f89efa 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -4935,7 +4935,7 @@ static int ipw_queue_reset(struct ipw_priv *priv)
4935/** 4935/**
4936 * Reclaim Tx queue entries no more used by NIC. 4936 * Reclaim Tx queue entries no more used by NIC.
4937 * 4937 *
4938 * When FW adwances 'R' index, all entries between old and 4938 * When FW advances 'R' index, all entries between old and
4939 * new 'R' index need to be reclaimed. As result, some free space 4939 * new 'R' index need to be reclaimed. As result, some free space
4940 * forms. If there is enough free space (> low mark), wake Tx queue. 4940 * forms. If there is enough free space (> low mark), wake Tx queue.
4941 * 4941 *
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index b24425f74883..4f1efb108c28 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -871,6 +871,10 @@ static int if_sdio_probe(struct sdio_func *func,
871 if (sscanf(func->card->info[i], 871 if (sscanf(func->card->info[i],
872 "ID: %x", &model) == 1) 872 "ID: %x", &model) == 1)
873 break; 873 break;
874 if (!strcmp(func->card->info[i], "IBIS Wireless SDIO Card")) {
875 model = 4;
876 break;
877 }
874 } 878 }
875 879
876 if (i == func->card->num_info) { 880 if (i == func->card->num_info) {
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 50775f9234cc..18b1f9145389 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -257,7 +257,7 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = {
257static void rt2500usb_config_mac_addr(struct rt2x00_dev *rt2x00dev, 257static void rt2500usb_config_mac_addr(struct rt2x00_dev *rt2x00dev,
258 __le32 *mac) 258 __le32 *mac)
259{ 259{
260 rt2500usb_register_multiwrite(rt2x00dev, MAC_CSR2, &mac, 260 rt2500usb_register_multiwrite(rt2x00dev, MAC_CSR2, mac,
261 (3 * sizeof(__le16))); 261 (3 * sizeof(__le16)));
262} 262}
263 263
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index 2780df00623c..04663eb31950 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -124,7 +124,10 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
124 struct data_entry *entry; 124 struct data_entry *entry;
125 struct data_desc *rxd; 125 struct data_desc *rxd;
126 struct sk_buff *skb; 126 struct sk_buff *skb;
127 struct ieee80211_hdr *hdr;
127 struct rxdata_entry_desc desc; 128 struct rxdata_entry_desc desc;
129 int header_size;
130 int align;
128 u32 word; 131 u32 word;
129 132
130 while (1) { 133 while (1) {
@@ -138,17 +141,26 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
138 memset(&desc, 0x00, sizeof(desc)); 141 memset(&desc, 0x00, sizeof(desc));
139 rt2x00dev->ops->lib->fill_rxdone(entry, &desc); 142 rt2x00dev->ops->lib->fill_rxdone(entry, &desc);
140 143
144 hdr = (struct ieee80211_hdr *)entry->data_addr;
145 header_size =
146 ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control));
147
148 /*
149 * The data behind the ieee80211 header must be
150 * aligned on a 4 byte boundary.
151 */
152 align = header_size % 4;
153
141 /* 154 /*
142 * Allocate the sk_buffer, initialize it and copy 155 * Allocate the sk_buffer, initialize it and copy
143 * all data into it. 156 * all data into it.
144 */ 157 */
145 skb = dev_alloc_skb(desc.size + NET_IP_ALIGN); 158 skb = dev_alloc_skb(desc.size + align);
146 if (!skb) 159 if (!skb)
147 return; 160 return;
148 161
149 skb_reserve(skb, NET_IP_ALIGN); 162 skb_reserve(skb, align);
150 skb_put(skb, desc.size); 163 memcpy(skb_put(skb, desc.size), entry->data_addr, desc.size);
151 memcpy(skb->data, entry->data_addr, desc.size);
152 164
153 /* 165 /*
154 * Send the frame to rt2x00lib for further processing. 166 * Send the frame to rt2x00lib for further processing.
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 1f5675dd329f..568d73847dca 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -221,7 +221,9 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
221 struct data_ring *ring = entry->ring; 221 struct data_ring *ring = entry->ring;
222 struct rt2x00_dev *rt2x00dev = ring->rt2x00dev; 222 struct rt2x00_dev *rt2x00dev = ring->rt2x00dev;
223 struct sk_buff *skb; 223 struct sk_buff *skb;
224 struct ieee80211_hdr *hdr;
224 struct rxdata_entry_desc desc; 225 struct rxdata_entry_desc desc;
226 int header_size;
225 int frame_size; 227 int frame_size;
226 228
227 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || 229 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) ||
@@ -243,19 +245,37 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
243 * Allocate a new sk buffer to replace the current one. 245 * Allocate a new sk buffer to replace the current one.
244 * If allocation fails, we should drop the current frame 246 * If allocation fails, we should drop the current frame
245 * so we can recycle the existing sk buffer for the new frame. 247 * so we can recycle the existing sk buffer for the new frame.
248 * As alignment we use 2 and not NET_IP_ALIGN because we need
249 * to be sure we have 2 bytes room in the head. (NET_IP_ALIGN
250 * can be 0 on some hardware). We use these 2 bytes for frame
251 * alignment later, we assume that the chance that
252 * header_size % 4 == 2 is bigger then header_size % 2 == 0
253 * and thus optimize alignment by reserving the 2 bytes in
254 * advance.
246 */ 255 */
247 frame_size = entry->ring->data_size + entry->ring->desc_size; 256 frame_size = entry->ring->data_size + entry->ring->desc_size;
248 skb = dev_alloc_skb(frame_size + NET_IP_ALIGN); 257 skb = dev_alloc_skb(frame_size + 2);
249 if (!skb) 258 if (!skb)
250 goto skip_entry; 259 goto skip_entry;
251 260
252 skb_reserve(skb, NET_IP_ALIGN); 261 skb_reserve(skb, 2);
253 skb_put(skb, frame_size); 262 skb_put(skb, frame_size);
254 263
255 /* 264 /*
256 * Trim the skb_buffer to only contain the valid 265 * The data behind the ieee80211 header must be
257 * frame data (so ignore the device's descriptor). 266 * aligned on a 4 byte boundary.
267 * After that trim the entire buffer down to only
268 * contain the valid frame data excluding the device
269 * descriptor.
258 */ 270 */
271 hdr = (struct ieee80211_hdr *)entry->skb->data;
272 header_size =
273 ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control));
274
275 if (header_size % 4 == 0) {
276 skb_push(entry->skb, 2);
277 memmove(entry->skb->data, entry->skb->data + 2, skb->len - 2);
278 }
259 skb_trim(entry->skb, desc.size); 279 skb_trim(entry->skb, desc.size);
260 280
261 /* 281 /*
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 01dbef19d651..ecae968ce091 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -1738,6 +1738,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
1738{ 1738{
1739 struct data_ring *ring; 1739 struct data_ring *ring;
1740 struct data_entry *entry; 1740 struct data_entry *entry;
1741 struct data_entry *entry_done;
1741 struct data_desc *txd; 1742 struct data_desc *txd;
1742 u32 word; 1743 u32 word;
1743 u32 reg; 1744 u32 reg;
@@ -1791,6 +1792,17 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
1791 !rt2x00_get_field32(word, TXD_W0_VALID)) 1792 !rt2x00_get_field32(word, TXD_W0_VALID))
1792 return; 1793 return;
1793 1794
1795 entry_done = rt2x00_get_data_entry_done(ring);
1796 while (entry != entry_done) {
1797 /* Catch up. Just report any entries we missed as
1798 * failed. */
1799 WARNING(rt2x00dev,
1800 "TX status report missed for entry %p\n",
1801 entry_done);
1802 rt2x00lib_txdone(entry_done, TX_FAIL_OTHER, 0);
1803 entry_done = rt2x00_get_data_entry_done(ring);
1804 }
1805
1794 /* 1806 /*
1795 * Obtain the status about this packet. 1807 * Obtain the status about this packet.
1796 */ 1808 */
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 2a8fc431099f..bca37bf0f545 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -852,11 +852,6 @@ static int xennet_poll(struct napi_struct *napi, int budget)
852 852
853 spin_lock(&np->rx_lock); 853 spin_lock(&np->rx_lock);
854 854
855 if (unlikely(!netif_carrier_ok(dev))) {
856 spin_unlock(&np->rx_lock);
857 return 0;
858 }
859
860 skb_queue_head_init(&rxq); 855 skb_queue_head_init(&rxq);
861 skb_queue_head_init(&errq); 856 skb_queue_head_init(&errq);
862 skb_queue_head_init(&tmpq); 857 skb_queue_head_init(&tmpq);
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 26cc4dcf4f0e..72e0bd5d80ac 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -465,6 +465,12 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, quirk
465DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, quirk_ich6_lpc_acpi ); 465DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, quirk_ich6_lpc_acpi );
466DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, quirk_ich6_lpc_acpi ); 466DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, quirk_ich6_lpc_acpi );
467DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, quirk_ich6_lpc_acpi ); 467DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, quirk_ich6_lpc_acpi );
468DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_1, quirk_ich6_lpc_acpi );
469DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_4, quirk_ich6_lpc_acpi );
470DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_2, quirk_ich6_lpc_acpi );
471DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_4, quirk_ich6_lpc_acpi );
472DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_7, quirk_ich6_lpc_acpi );
473DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_8, quirk_ich6_lpc_acpi );
468 474
469/* 475/*
470 * VIA ACPI: One IO region pointed to by longword at 476 * VIA ACPI: One IO region pointed to by longword at
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 3c5eb374adf8..6b9840cce0f4 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -76,6 +76,7 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
76 int i = 0; 76 int i = 0;
77 int irq; 77 int irq;
78 int p, t; 78 int p, t;
79 static unsigned char warned;
79 80
80 if (!valid_IRQ(gsi)) 81 if (!valid_IRQ(gsi))
81 return; 82 return;
@@ -83,9 +84,10 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
83 while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) && 84 while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) &&
84 i < PNP_MAX_IRQ) 85 i < PNP_MAX_IRQ)
85 i++; 86 i++;
86 if (i >= PNP_MAX_IRQ) { 87 if (i >= PNP_MAX_IRQ && !warned) {
87 printk(KERN_ERR "pnpacpi: exceeded the max number of IRQ " 88 printk(KERN_ERR "pnpacpi: exceeded the max number of IRQ "
88 "resources: %d \n", PNP_MAX_IRQ); 89 "resources: %d \n", PNP_MAX_IRQ);
90 warned = 1;
89 return; 91 return;
90 } 92 }
91 /* 93 /*
@@ -169,6 +171,7 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
169 int bus_master, int transfer) 171 int bus_master, int transfer)
170{ 172{
171 int i = 0; 173 int i = 0;
174 static unsigned char warned;
172 175
173 while (i < PNP_MAX_DMA && 176 while (i < PNP_MAX_DMA &&
174 !(res->dma_resource[i].flags & IORESOURCE_UNSET)) 177 !(res->dma_resource[i].flags & IORESOURCE_UNSET))
@@ -183,9 +186,10 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
183 } 186 }
184 res->dma_resource[i].start = dma; 187 res->dma_resource[i].start = dma;
185 res->dma_resource[i].end = dma; 188 res->dma_resource[i].end = dma;
186 } else { 189 } else if (!warned) {
187 printk(KERN_ERR "pnpacpi: exceeded the max number of DMA " 190 printk(KERN_ERR "pnpacpi: exceeded the max number of DMA "
188 "resources: %d \n", PNP_MAX_DMA); 191 "resources: %d \n", PNP_MAX_DMA);
192 warned = 1;
189 } 193 }
190} 194}
191 195
@@ -193,6 +197,7 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
193 u64 io, u64 len, int io_decode) 197 u64 io, u64 len, int io_decode)
194{ 198{
195 int i = 0; 199 int i = 0;
200 static unsigned char warned;
196 201
197 while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && 202 while (!(res->port_resource[i].flags & IORESOURCE_UNSET) &&
198 i < PNP_MAX_PORT) 203 i < PNP_MAX_PORT)
@@ -207,9 +212,10 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
207 } 212 }
208 res->port_resource[i].start = io; 213 res->port_resource[i].start = io;
209 res->port_resource[i].end = io + len - 1; 214 res->port_resource[i].end = io + len - 1;
210 } else { 215 } else if (!warned) {
211 printk(KERN_ERR "pnpacpi: exceeded the max number of IO " 216 printk(KERN_ERR "pnpacpi: exceeded the max number of IO "
212 "resources: %d \n", PNP_MAX_PORT); 217 "resources: %d \n", PNP_MAX_PORT);
218 warned = 1;
213 } 219 }
214} 220}
215 221
@@ -218,6 +224,7 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
218 int write_protect) 224 int write_protect)
219{ 225{
220 int i = 0; 226 int i = 0;
227 static unsigned char warned;
221 228
222 while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) && 229 while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) &&
223 (i < PNP_MAX_MEM)) 230 (i < PNP_MAX_MEM))
@@ -233,9 +240,10 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
233 240
234 res->mem_resource[i].start = mem; 241 res->mem_resource[i].start = mem;
235 res->mem_resource[i].end = mem + len - 1; 242 res->mem_resource[i].end = mem + len - 1;
236 } else { 243 } else if (!warned) {
237 printk(KERN_ERR "pnpacpi: exceeded the max number of mem " 244 printk(KERN_ERR "pnpacpi: exceeded the max number of mem "
238 "resources: %d\n", PNP_MAX_MEM); 245 "resources: %d\n", PNP_MAX_MEM);
246 warned = 1;
239 } 247 }
240} 248}
241 249
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 9dd3952516c5..38a1ee2eacd8 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -13906,7 +13906,7 @@ static int advansys_release(struct Scsi_Host *shost)
13906 13906
13907#define ASC_IOADR_TABLE_MAX_IX 11 13907#define ASC_IOADR_TABLE_MAX_IX 11
13908 13908
13909static PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] __devinitdata = { 13909static PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] = {
13910 0x100, 0x0110, 0x120, 0x0130, 0x140, 0x0150, 0x0190, 13910 0x100, 0x0110, 0x120, 0x0130, 0x140, 0x0150, 0x0190,
13911 0x0210, 0x0230, 0x0250, 0x0330 13911 0x0210, 0x0230, 0x0250, 0x0330
13912}; 13912};
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 146d540f6281..288640756099 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -3041,7 +3041,6 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
3041 int cnt; 3041 int cnt;
3042 int req_cnt; 3042 int req_cnt;
3043 int seg_cnt; 3043 int seg_cnt;
3044 dma_addr_t dma_handle;
3045 u8 dir; 3044 u8 dir;
3046 3045
3047 ENTER("qla1280_32bit_start_scsi"); 3046 ENTER("qla1280_32bit_start_scsi");
@@ -3050,6 +3049,7 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
3050 cmd->cmnd[0]); 3049 cmd->cmnd[0]);
3051 3050
3052 /* Calculate number of entries and segments required. */ 3051 /* Calculate number of entries and segments required. */
3052 req_cnt = 1;
3053 seg_cnt = scsi_dma_map(cmd); 3053 seg_cnt = scsi_dma_map(cmd);
3054 if (seg_cnt) { 3054 if (seg_cnt) {
3055 /* 3055 /*
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index a5bcf1f390b3..8ecc0470b8f3 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1831,7 +1831,7 @@ probe_out:
1831 return ret; 1831 return ret;
1832} 1832}
1833 1833
1834static void __devexit 1834static void
1835qla2x00_remove_one(struct pci_dev *pdev) 1835qla2x00_remove_one(struct pci_dev *pdev)
1836{ 1836{
1837 scsi_qla_host_t *ha; 1837 scsi_qla_host_t *ha;
@@ -2965,7 +2965,7 @@ static struct pci_driver qla2xxx_pci_driver = {
2965 }, 2965 },
2966 .id_table = qla2xxx_pci_tbl, 2966 .id_table = qla2xxx_pci_tbl,
2967 .probe = qla2x00_probe_one, 2967 .probe = qla2x00_probe_one,
2968 .remove = __devexit_p(qla2x00_remove_one), 2968 .remove = qla2x00_remove_one,
2969 .err_handler = &qla2xxx_err_handler, 2969 .err_handler = &qla2xxx_err_handler,
2970}; 2970};
2971 2971
diff --git a/drivers/ssb/scan.c b/drivers/ssb/scan.c
index 96258c60919d..63ee5cfbefbb 100644
--- a/drivers/ssb/scan.c
+++ b/drivers/ssb/scan.c
@@ -388,6 +388,17 @@ int ssb_bus_scan(struct ssb_bus *bus,
388 case SSB_DEV_PCI: 388 case SSB_DEV_PCI:
389 case SSB_DEV_PCIE: 389 case SSB_DEV_PCIE:
390#ifdef CONFIG_SSB_DRIVER_PCICORE 390#ifdef CONFIG_SSB_DRIVER_PCICORE
391 if (bus->bustype == SSB_BUSTYPE_PCI) {
392 /* Ignore PCI cores on PCI-E cards.
393 * Ignore PCI-E cores on PCI cards. */
394 if (dev->id.coreid == SSB_DEV_PCI) {
395 if (bus->host_pci->is_pcie)
396 continue;
397 } else {
398 if (!bus->host_pci->is_pcie)
399 continue;
400 }
401 }
391 if (bus->pcicore.dev) { 402 if (bus->pcicore.dev) {
392 ssb_printk(KERN_WARNING PFX 403 ssb_printk(KERN_WARNING PFX
393 "WARNING: Multiple PCI(E) cores found\n"); 404 "WARNING: Multiple PCI(E) cores found\n");
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 11a3a222dfc3..7c30cc8df71e 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -801,5 +801,5 @@ module_init(atmel_lcdfb_init);
801module_exit(atmel_lcdfb_exit); 801module_exit(atmel_lcdfb_exit);
802 802
803MODULE_DESCRIPTION("AT91/AT32 LCD Controller framebuffer driver"); 803MODULE_DESCRIPTION("AT91/AT32 LCD Controller framebuffer driver");
804MODULE_AUTHOR("Nicolas Ferre <nicolas.ferre@rfo.atmel.com>"); 804MODULE_AUTHOR("Nicolas Ferre <nicolas.ferre@atmel.com>");
805MODULE_LICENSE("GPL"); 805MODULE_LICENSE("GPL");
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c
index 8d81ef019c6c..08d072552233 100644
--- a/drivers/video/modedb.c
+++ b/drivers/video/modedb.c
@@ -259,6 +259,10 @@ static const struct fb_videomode modedb[] = {
259 /* 1366x768, 60 Hz, 47.403 kHz hsync, WXGA 16:9 aspect ratio */ 259 /* 1366x768, 60 Hz, 47.403 kHz hsync, WXGA 16:9 aspect ratio */
260 NULL, 60, 1366, 768, 13806, 120, 10, 14, 3, 32, 5, 260 NULL, 60, 1366, 768, 13806, 120, 10, 14, 3, 32, 5,
261 0, FB_VMODE_NONINTERLACED 261 0, FB_VMODE_NONINTERLACED
262 }, {
263 /* 1280x800, 60 Hz, 47.403 kHz hsync, WXGA 16:10 aspect ratio */
264 NULL, 60, 1280, 800, 12048, 200, 64, 24, 1, 136, 3,
265 0, FB_VMODE_NONINTERLACED
262 }, 266 },
263}; 267};
264 268
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index b3128903d673..044a423a72cb 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -443,8 +443,6 @@ static int ps3fb_sync(struct fb_info *info, u32 frame)
443 u32 ddr_line_length, xdr_line_length; 443 u32 ddr_line_length, xdr_line_length;
444 u64 ddr_base, xdr_base; 444 u64 ddr_base, xdr_base;
445 445
446 acquire_console_sem();
447
448 if (frame > par->num_frames - 1) { 446 if (frame > par->num_frames - 1) {
449 dev_dbg(info->device, "%s: invalid frame number (%u)\n", 447 dev_dbg(info->device, "%s: invalid frame number (%u)\n",
450 __func__, frame); 448 __func__, frame);
@@ -464,7 +462,6 @@ static int ps3fb_sync(struct fb_info *info, u32 frame)
464 xdr_line_length); 462 xdr_line_length);
465 463
466out: 464out:
467 release_console_sem();
468 return error; 465 return error;
469} 466}
470 467
@@ -479,7 +476,10 @@ static int ps3fb_release(struct fb_info *info, int user)
479 if (atomic_dec_and_test(&ps3fb.f_count)) { 476 if (atomic_dec_and_test(&ps3fb.f_count)) {
480 if (atomic_read(&ps3fb.ext_flip)) { 477 if (atomic_read(&ps3fb.ext_flip)) {
481 atomic_set(&ps3fb.ext_flip, 0); 478 atomic_set(&ps3fb.ext_flip, 0);
482 ps3fb_sync(info, 0); /* single buffer */ 479 if (!try_acquire_console_sem()) {
480 ps3fb_sync(info, 0); /* single buffer */
481 release_console_sem();
482 }
483 } 483 }
484 } 484 }
485 return 0; 485 return 0;
@@ -865,7 +865,9 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd,
865 break; 865 break;
866 866
867 dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val); 867 dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val);
868 acquire_console_sem();
868 retval = ps3fb_sync(info, val); 869 retval = ps3fb_sync(info, val);
870 release_console_sem();
869 break; 871 break;
870 872
871 default: 873 default:
@@ -885,7 +887,9 @@ static int ps3fbd(void *arg)
885 set_current_state(TASK_INTERRUPTIBLE); 887 set_current_state(TASK_INTERRUPTIBLE);
886 if (ps3fb.is_kicked) { 888 if (ps3fb.is_kicked) {
887 ps3fb.is_kicked = 0; 889 ps3fb.is_kicked = 0;
890 acquire_console_sem();
888 ps3fb_sync(info, 0); /* single buffer */ 891 ps3fb_sync(info, 0); /* single buffer */
892 release_console_sem();
889 } 893 }
890 schedule(); 894 schedule();
891 } 895 }
@@ -1234,12 +1238,6 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
1234 ps3fb_flip_ctl(0, &ps3fb); /* flip off */ 1238 ps3fb_flip_ctl(0, &ps3fb); /* flip off */
1235 ps3fb.dinfo->irq.mask = 0; 1239 ps3fb.dinfo->irq.mask = 0;
1236 1240
1237 if (info) {
1238 unregister_framebuffer(info);
1239 fb_dealloc_cmap(&info->cmap);
1240 framebuffer_release(info);
1241 }
1242
1243 ps3av_register_flip_ctl(NULL, NULL); 1241 ps3av_register_flip_ctl(NULL, NULL);
1244 if (ps3fb.task) { 1242 if (ps3fb.task) {
1245 struct task_struct *task = ps3fb.task; 1243 struct task_struct *task = ps3fb.task;
@@ -1250,6 +1248,12 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
1250 free_irq(ps3fb.irq_no, &dev->core); 1248 free_irq(ps3fb.irq_no, &dev->core);
1251 ps3_irq_plug_destroy(ps3fb.irq_no); 1249 ps3_irq_plug_destroy(ps3fb.irq_no);
1252 } 1250 }
1251 if (info) {
1252 unregister_framebuffer(info);
1253 fb_dealloc_cmap(&info->cmap);
1254 framebuffer_release(info);
1255 info = dev->core.driver_data = NULL;
1256 }
1253 iounmap((u8 __iomem *)ps3fb.dinfo); 1257 iounmap((u8 __iomem *)ps3fb.dinfo);
1254 1258
1255 status = lv1_gpu_context_free(ps3fb.context_handle); 1259 status = lv1_gpu_context_free(ps3fb.context_handle);
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c
index 5857ccf5f6b1..ad35033f1a48 100644
--- a/drivers/video/s3c2410fb.c
+++ b/drivers/video/s3c2410fb.c
@@ -1026,7 +1026,7 @@ static int s3c2410fb_resume(struct platform_device *dev)
1026 clk_enable(info->clk); 1026 clk_enable(info->clk);
1027 msleep(1); 1027 msleep(1);
1028 1028
1029 s3c2410fb_init_registers(info); 1029 s3c2410fb_init_registers(fbinfo);
1030 1030
1031 return 0; 1031 return 0;
1032} 1032}
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index d1d6c0facd54..a14ef894d571 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -43,7 +43,7 @@ static struct fb_fix_screeninfo uvesafb_fix __devinitdata = {
43}; 43};
44 44
45static int mtrr __devinitdata = 3; /* enable mtrr by default */ 45static int mtrr __devinitdata = 3; /* enable mtrr by default */
46static int blank __devinitdata = 1; /* enable blanking by default */ 46static int blank = 1; /* enable blanking by default */
47static int ypan __devinitdata = 1; /* 0: scroll, 1: ypan, 2: ywrap */ 47static int ypan __devinitdata = 1; /* 0: scroll, 1: ypan, 2: ywrap */
48static int pmi_setpal __devinitdata = 1; /* use PMI for palette changes */ 48static int pmi_setpal __devinitdata = 1; /* use PMI for palette changes */
49static int nocrtc __devinitdata; /* ignore CRTC settings */ 49static int nocrtc __devinitdata; /* ignore CRTC settings */
@@ -1549,7 +1549,7 @@ static void __devinit uvesafb_init_info(struct fb_info *info,
1549 info->fbops->fb_pan_display = NULL; 1549 info->fbops->fb_pan_display = NULL;
1550} 1550}
1551 1551
1552static void uvesafb_init_mtrr(struct fb_info *info) 1552static void __devinit uvesafb_init_mtrr(struct fb_info *info)
1553{ 1553{
1554#ifdef CONFIG_MTRR 1554#ifdef CONFIG_MTRR
1555 if (mtrr && !(info->fix.smem_start & (PAGE_SIZE - 1))) { 1555 if (mtrr && !(info->fix.smem_start & (PAGE_SIZE - 1))) {
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 070217322c9f..33e50310e9e0 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -869,11 +869,9 @@ void w1_search_process(struct w1_master *dev, u8 search_type)
869 w1_search_devices(dev, search_type, w1_slave_found); 869 w1_search_devices(dev, search_type, w1_slave_found);
870 870
871 list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) { 871 list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) {
872 if (!test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags) && !--sl->ttl) { 872 if (!test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags) && !--sl->ttl)
873 w1_slave_detach(sl); 873 w1_slave_detach(sl);
874 874 else if (test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags))
875 dev->slave_count--;
876 } else if (test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags))
877 sl->ttl = dev->slave_ttl; 875 sl->ttl = dev->slave_ttl;
878 } 876 }
879 877
diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c
index 6ea125eabeaa..c622a0e6c9ae 100644
--- a/drivers/watchdog/w83697hf_wdt.c
+++ b/drivers/watchdog/w83697hf_wdt.c
@@ -382,10 +382,8 @@ wdt_init(void)
382 /* we will autodetect the W83697HF/HG watchdog */ 382 /* we will autodetect the W83697HF/HG watchdog */
383 for (i = 0; ((!found) && (w83697hf_ioports[i] != 0)); i++) { 383 for (i = 0; ((!found) && (w83697hf_ioports[i] != 0)); i++) {
384 wdt_io = w83697hf_ioports[i]; 384 wdt_io = w83697hf_ioports[i];
385 if (!w83697hf_check_wdt()) { 385 if (!w83697hf_check_wdt())
386 found++; 386 found++;
387 break;
388 }
389 } 387 }
390 } else { 388 } else {
391 if (!w83697hf_check_wdt()) 389 if (!w83697hf_check_wdt())