diff options
author | Paul Mackerras <paulus@samba.org> | 2008-01-23 18:07:21 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-01-23 18:07:21 -0500 |
commit | 9156ad48338e0306e508ead5c0d9986050744475 (patch) | |
tree | 37f3a90e38190052ecf3cdf9171dfdddd37b56fd /drivers | |
parent | fa28237cfcc5827553044cbd6ee52e33692b0faa (diff) | |
parent | 8f7b3d156d348b6766833cd4e272d0d19b501e64 (diff) |
Merge branch 'linux-2.6'
Diffstat (limited to 'drivers')
199 files changed, 2346 insertions, 1709 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/ |
85 | config 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 | ||
85 | config ACPI_PROC_EVENT | 91 | config 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 | |||
103 | config ACPI_AC | 109 | config 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 | |||
113 | config ACPI_BATTERY | 118 | config 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 | |||
368 | config ACPI_SBS | 372 | config 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 | ||
81 | struct acpi_ac { | 83 | struct 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 | |
98 | static int get_ac_property(struct power_supply *psy, | 102 | static 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, | |||
113 | static enum power_supply_property ac_props[] = { | 117 | static 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 | ||
87 | struct acpi_battery { | 89 | struct 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 | ||
120 | static int acpi_battery_technology(struct acpi_battery *battery) | 125 | static 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 |
227 | inline char *acpi_battery_units(struct acpi_battery *battery) | 233 | inline 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 | ||
401 | static ssize_t acpi_battery_alarm_show(struct device *dev, | 408 | static 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 | ||
466 | static int acpi_battery_update(struct acpi_battery *battery) | 469 | static 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 | ||
775 | static int acpi_battery_add(struct acpi_device *device) | 792 | static 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 | ||
895 | int __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 | |||
895 | int __init acpi_ec_ecdt_probe(void) | 906 | int __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 | ||
78 | static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER; | 78 | static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER; |
79 | #ifdef CONFIG_CPU_IDLE | ||
79 | module_param(max_cstate, uint, 0000); | 80 | module_param(max_cstate, uint, 0000); |
81 | #else | ||
82 | module_param(max_cstate, uint, 0644); | ||
83 | #endif | ||
80 | static unsigned int nocst __read_mostly; | 84 | static unsigned int nocst __read_mostly; |
81 | module_param(nocst, uint, 0000); | 85 | module_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[] = { | |||
80 | MODULE_DEVICE_TABLE(acpi, sbs_device_ids); | 82 | MODULE_DEVICE_TABLE(acpi, sbs_device_ids); |
81 | 83 | ||
82 | struct acpi_battery { | 84 | struct 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 | ||
115 | struct acpi_sbs { | 119 | struct 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 | ||
160 | static int sbs_get_ac_property(struct power_supply *psy, | 167 | static 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 | ||
432 | static ssize_t acpi_battery_alarm_show(struct device *dev, | 441 | static 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) | |||
822 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) | 834 | static 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 | ||
864 | static void acpi_charger_remove(struct acpi_sbs *sbs) | 879 | static 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 | ||
1452 | int __init acpi_boot_ec_enable(void); | ||
1453 | |||
1452 | static int __init acpi_scan_init(void) | 1454 | static 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); | |||
165 | static void piix_set_dmamode(struct ata_port *ap, struct ata_device *adev); | 166 | static void piix_set_dmamode(struct ata_port *ap, struct ata_device *adev); |
166 | static void ich_set_dmamode(struct ata_port *ap, struct ata_device *adev); | 167 | static void ich_set_dmamode(struct ata_port *ap, struct ata_device *adev); |
167 | static int ich_pata_cable_detect(struct ata_port *ap); | 168 | static int ich_pata_cable_detect(struct ata_port *ap); |
169 | static u8 piix_vmw_bmdma_status(struct ata_port *ap); | ||
168 | #ifdef CONFIG_PM | 170 | #ifdef CONFIG_PM |
169 | static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); | 171 | static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); |
170 | static int piix_pci_device_resume(struct pci_dev *pdev); | 172 | static int piix_pci_device_resume(struct pci_dev *pdev); |
@@ -175,6 +177,8 @@ static unsigned int in_module_init = 1; | |||
175 | static const struct pci_device_id piix_pci_tbl[] = { | 177 | static 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 | ||
390 | static 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 | |||
386 | static const struct piix_map_db ich5_map_db = { | 422 | static 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 | ||
628 | static struct pci_bits piix_enable_bits[] = { | 674 | static 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 | ||
1184 | static 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 | ||
133 | static void ixp4xx_setup_port(struct ata_ioports *ioaddr, | 133 | static 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..6c9689b59b06 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,35 @@ static void pdc2026x_dev_config(struct ata_device *adev) | |||
233 | adev->max_sectors = 256; | 233 | adev->max_sectors = 256; |
234 | } | 234 | } |
235 | 235 | ||
236 | static 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 | |||
247 | /** | ||
248 | * pdc2026x_check_atapi_dma - Check whether ATAPI DMA can be supported for this command | ||
249 | * @qc: Metadata associated with taskfile to check | ||
250 | * | ||
251 | * Just say no - not supported on older Promise. | ||
252 | * | ||
253 | * LOCKING: | ||
254 | * None (inherited from caller). | ||
255 | * | ||
256 | * RETURNS: 0 when ATAPI DMA can be used | ||
257 | * 1 otherwise | ||
258 | */ | ||
259 | |||
260 | static int pdc2026x_check_atapi_dma(struct ata_queued_cmd *qc) | ||
261 | { | ||
262 | return 1; | ||
263 | } | ||
264 | |||
236 | static struct scsi_host_template pdc202xx_sht = { | 265 | static struct scsi_host_template pdc202xx_sht = { |
237 | .module = THIS_MODULE, | 266 | .module = THIS_MODULE, |
238 | .name = DRV_NAME, | 267 | .name = DRV_NAME, |
@@ -300,6 +329,7 @@ static struct ata_port_operations pdc2026x_port_ops = { | |||
300 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | 329 | .post_internal_cmd = ata_bmdma_post_internal_cmd, |
301 | .cable_detect = pdc2026x_cable_detect, | 330 | .cable_detect = pdc2026x_cable_detect, |
302 | 331 | ||
332 | .check_atapi_dma= pdc2026x_check_atapi_dma, | ||
303 | .bmdma_setup = ata_bmdma_setup, | 333 | .bmdma_setup = ata_bmdma_setup, |
304 | .bmdma_start = pdc2026x_bmdma_start, | 334 | .bmdma_start = pdc2026x_bmdma_start, |
305 | .bmdma_stop = pdc2026x_bmdma_stop, | 335 | .bmdma_stop = pdc2026x_bmdma_stop, |
@@ -313,7 +343,7 @@ static struct ata_port_operations pdc2026x_port_ops = { | |||
313 | .irq_clear = ata_bmdma_irq_clear, | 343 | .irq_clear = ata_bmdma_irq_clear, |
314 | .irq_on = ata_irq_on, | 344 | .irq_on = ata_irq_on, |
315 | 345 | ||
316 | .port_start = ata_sff_port_start, | 346 | .port_start = pdc2026x_port_start, |
317 | }; | 347 | }; |
318 | 348 | ||
319 | static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 349 | static 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) | |||
270 | static void qs_error_handler(struct ata_port *ap) | 270 | static 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/firestream.c b/drivers/atm/firestream.c index f8f7139c07c1..c662d686154a 100644 --- a/drivers/atm/firestream.c +++ b/drivers/atm/firestream.c | |||
@@ -171,8 +171,8 @@ static char *res_strings[] = { | |||
171 | "packet purged", | 171 | "packet purged", |
172 | "packet ageing timeout", | 172 | "packet ageing timeout", |
173 | "channel ageing timeout", | 173 | "channel ageing timeout", |
174 | "calculated lenght error", | 174 | "calculated length error", |
175 | "programmed lenght limit error", | 175 | "programmed length limit error", |
176 | "aal5 crc32 error", | 176 | "aal5 crc32 error", |
177 | "oam transp or transpc crc10 error", | 177 | "oam transp or transpc crc10 error", |
178 | "reserved 25", | 178 | "reserved 25", |
diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c index 0bd657f5dd2a..84672dc57f7a 100644 --- a/drivers/atm/idt77105.c +++ b/drivers/atm/idt77105.c | |||
@@ -357,7 +357,7 @@ static const struct atmphy_ops idt77105_ops = { | |||
357 | }; | 357 | }; |
358 | 358 | ||
359 | 359 | ||
360 | int __devinit idt77105_init(struct atm_dev *dev) | 360 | int idt77105_init(struct atm_dev *dev) |
361 | { | 361 | { |
362 | dev->phy = &idt77105_ops; | 362 | dev->phy = &idt77105_ops; |
363 | return 0; | 363 | return 0; |
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/atm/suni.c b/drivers/atm/suni.c index f04f39c00833..b1d063cc4fbe 100644 --- a/drivers/atm/suni.c +++ b/drivers/atm/suni.c | |||
@@ -289,7 +289,7 @@ static const struct atmphy_ops suni_ops = { | |||
289 | }; | 289 | }; |
290 | 290 | ||
291 | 291 | ||
292 | int __devinit suni_init(struct atm_dev *dev) | 292 | int suni_init(struct atm_dev *dev) |
293 | { | 293 | { |
294 | unsigned char mri; | 294 | unsigned char mri; |
295 | 295 | ||
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 | ||
2930 | static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) | 2930 | static 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) | |||
610 | static int loop_switch(struct loop_device *lo, struct file *file) | 610 | static 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/Kconfig b/drivers/char/Kconfig index ef1ed5d70125..2e3a0d4bc4c2 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -137,7 +137,7 @@ config CYCLADES | |||
137 | your Linux box, for instance in order to become a dial-in server. | 137 | your Linux box, for instance in order to become a dial-in server. |
138 | 138 | ||
139 | For information about the Cyclades-Z card, read | 139 | For information about the Cyclades-Z card, read |
140 | <file:drivers/char/README.cycladesZ>. | 140 | <file:Documentation/README.cycladesZ>. |
141 | 141 | ||
142 | To compile this driver as a module, choose M here: the | 142 | To compile this driver as a module, choose M here: the |
143 | module will be called cyclades. | 143 | module will be called cyclades. |
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 | } |
1047 | EXPORT_SYMBOL_GPL(tpm_remove_hardware); | 1047 | EXPORT_SYMBOL_GPL(tpm_remove_hardware); |
1048 | 1048 | ||
1049 | static 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[] = { | |||
1059 | int tpm_pm_suspend(struct device *dev, pm_message_t pm_state) | 1053 | int 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/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index 1bdd2bf4f37d..d4b6d64e858b 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c | |||
@@ -62,7 +62,7 @@ void tty_wait_until_sent(struct tty_struct * tty, long timeout) | |||
62 | if (!timeout) | 62 | if (!timeout) |
63 | timeout = MAX_SCHEDULE_TIMEOUT; | 63 | timeout = MAX_SCHEDULE_TIMEOUT; |
64 | if (wait_event_interruptible_timeout(tty->write_wait, | 64 | if (wait_event_interruptible_timeout(tty->write_wait, |
65 | !tty->driver->chars_in_buffer(tty), timeout)) | 65 | !tty->driver->chars_in_buffer(tty), timeout) < 0) |
66 | return; | 66 | return; |
67 | if (tty->driver->wait_until_sent) | 67 | if (tty->driver->wait_until_sent) |
68 | tty->driver->wait_until_sent(tty, timeout); | 68 | tty->driver->wait_until_sent(tty, timeout); |
@@ -365,6 +365,25 @@ void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old) | |||
365 | EXPORT_SYMBOL(tty_termios_copy_hw); | 365 | EXPORT_SYMBOL(tty_termios_copy_hw); |
366 | 366 | ||
367 | /** | 367 | /** |
368 | * tty_termios_hw_change - check for setting change | ||
369 | * @a: termios | ||
370 | * @b: termios to compare | ||
371 | * | ||
372 | * Check if any of the bits that affect a dumb device have changed | ||
373 | * between the two termios structures, or a speed change is needed. | ||
374 | */ | ||
375 | |||
376 | int tty_termios_hw_change(struct ktermios *a, struct ktermios *b) | ||
377 | { | ||
378 | if (a->c_ispeed != b->c_ispeed || a->c_ospeed != b->c_ospeed) | ||
379 | return 1; | ||
380 | if ((a->c_cflag ^ b->c_cflag) & ~(HUPCL | CREAD | CLOCAL)) | ||
381 | return 1; | ||
382 | return 0; | ||
383 | } | ||
384 | EXPORT_SYMBOL(tty_termios_hw_change); | ||
385 | |||
386 | /** | ||
368 | * change_termios - update termios values | 387 | * change_termios - update termios values |
369 | * @tty: tty to update | 388 | * @tty: tty to update |
370 | * @new_termios: desired new value | 389 | * @new_termios: desired new value |
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/connector/connector.c b/drivers/connector/connector.c index 6883fcb79ad3..bf9716b75513 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c | |||
@@ -145,6 +145,8 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v | |||
145 | if (queue_work(dev->cbdev->cn_queue, | 145 | if (queue_work(dev->cbdev->cn_queue, |
146 | &__cbq->work)) | 146 | &__cbq->work)) |
147 | err = 0; | 147 | err = 0; |
148 | else | ||
149 | err = -EINVAL; | ||
148 | } else { | 150 | } else { |
149 | struct cn_callback_data *d; | 151 | struct cn_callback_data *d; |
150 | 152 | ||
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"); |
604 | MODULE_LICENSE ("GPL"); | 604 | MODULE_LICENSE ("GPL"); |
605 | 605 | ||
606 | #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE | ||
607 | fs_initcall(cpufreq_gov_dbs_init); | ||
608 | #else | ||
606 | module_init(cpufreq_gov_dbs_init); | 609 | module_init(cpufreq_gov_dbs_init); |
610 | #endif | ||
607 | module_exit(cpufreq_gov_dbs_exit); | 611 | module_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"); |
611 | MODULE_LICENSE("GPL"); | 611 | MODULE_LICENSE("GPL"); |
612 | 612 | ||
613 | #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND | ||
614 | fs_initcall(cpufreq_gov_dbs_init); | ||
615 | #else | ||
613 | module_init(cpufreq_gov_dbs_init); | 616 | module_init(cpufreq_gov_dbs_init); |
617 | #endif | ||
614 | module_exit(cpufreq_gov_dbs_exit); | 618 | module_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. | |||
231 | MODULE_DESCRIPTION ("CPUfreq policy governor 'userspace'"); | 231 | MODULE_DESCRIPTION ("CPUfreq policy governor 'userspace'"); |
232 | MODULE_LICENSE ("GPL"); | 232 | MODULE_LICENSE ("GPL"); |
233 | 233 | ||
234 | #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE | ||
234 | fs_initcall(cpufreq_gov_userspace_init); | 235 | fs_initcall(cpufreq_gov_userspace_init); |
236 | #else | ||
237 | module_init(cpufreq_gov_userspace_init); | ||
238 | #endif | ||
235 | module_exit(cpufreq_gov_userspace_exit); | 239 | module_exit(cpufreq_gov_userspace_exit); |
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c index abbcff0762b1..5f7e71810489 100644 --- a/drivers/crypto/padlock-aes.c +++ b/drivers/crypto/padlock-aes.c | |||
@@ -419,13 +419,58 @@ static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, | |||
419 | /* ====== Encryption/decryption routines ====== */ | 419 | /* ====== Encryption/decryption routines ====== */ |
420 | 420 | ||
421 | /* These are the real call to PadLock. */ | 421 | /* These are the real call to PadLock. */ |
422 | static inline void padlock_xcrypt(const u8 *input, u8 *output, void *key, | ||
423 | void *control_word) | ||
424 | { | ||
425 | asm volatile (".byte 0xf3,0x0f,0xa7,0xc8" /* rep xcryptecb */ | ||
426 | : "+S"(input), "+D"(output) | ||
427 | : "d"(control_word), "b"(key), "c"(1)); | ||
428 | } | ||
429 | |||
430 | static void aes_crypt_copy(const u8 *in, u8 *out, u32 *key, struct cword *cword) | ||
431 | { | ||
432 | u8 buf[AES_BLOCK_SIZE * 2 + PADLOCK_ALIGNMENT - 1]; | ||
433 | u8 *tmp = PTR_ALIGN(&buf[0], PADLOCK_ALIGNMENT); | ||
434 | |||
435 | memcpy(tmp, in, AES_BLOCK_SIZE); | ||
436 | padlock_xcrypt(tmp, out, key, cword); | ||
437 | } | ||
438 | |||
439 | static inline void aes_crypt(const u8 *in, u8 *out, u32 *key, | ||
440 | struct cword *cword) | ||
441 | { | ||
442 | asm volatile ("pushfl; popfl"); | ||
443 | |||
444 | /* padlock_xcrypt requires at least two blocks of data. */ | ||
445 | if (unlikely(!(((unsigned long)in ^ (PAGE_SIZE - AES_BLOCK_SIZE)) & | ||
446 | (PAGE_SIZE - 1)))) { | ||
447 | aes_crypt_copy(in, out, key, cword); | ||
448 | return; | ||
449 | } | ||
450 | |||
451 | padlock_xcrypt(in, out, key, cword); | ||
452 | } | ||
453 | |||
422 | static inline void padlock_xcrypt_ecb(const u8 *input, u8 *output, void *key, | 454 | static inline void padlock_xcrypt_ecb(const u8 *input, u8 *output, void *key, |
423 | void *control_word, u32 count) | 455 | void *control_word, u32 count) |
424 | { | 456 | { |
457 | if (count == 1) { | ||
458 | aes_crypt(input, output, key, control_word); | ||
459 | return; | ||
460 | } | ||
461 | |||
425 | asm volatile ("pushfl; popfl"); /* enforce key reload. */ | 462 | asm volatile ("pushfl; popfl"); /* enforce key reload. */ |
426 | asm volatile (".byte 0xf3,0x0f,0xa7,0xc8" /* rep xcryptecb */ | 463 | asm volatile ("test $1, %%cl;" |
464 | "je 1f;" | ||
465 | "lea -1(%%ecx), %%eax;" | ||
466 | "mov $1, %%ecx;" | ||
467 | ".byte 0xf3,0x0f,0xa7,0xc8;" /* rep xcryptecb */ | ||
468 | "mov %%eax, %%ecx;" | ||
469 | "1:" | ||
470 | ".byte 0xf3,0x0f,0xa7,0xc8" /* rep xcryptecb */ | ||
427 | : "+S"(input), "+D"(output) | 471 | : "+S"(input), "+D"(output) |
428 | : "d"(control_word), "b"(key), "c"(count)); | 472 | : "d"(control_word), "b"(key), "c"(count) |
473 | : "ax"); | ||
429 | } | 474 | } |
430 | 475 | ||
431 | static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key, | 476 | static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key, |
@@ -443,13 +488,13 @@ static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key, | |||
443 | static void aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) | 488 | static void aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) |
444 | { | 489 | { |
445 | struct aes_ctx *ctx = aes_ctx(tfm); | 490 | struct aes_ctx *ctx = aes_ctx(tfm); |
446 | padlock_xcrypt_ecb(in, out, ctx->E, &ctx->cword.encrypt, 1); | 491 | aes_crypt(in, out, ctx->E, &ctx->cword.encrypt); |
447 | } | 492 | } |
448 | 493 | ||
449 | static void aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) | 494 | static void aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) |
450 | { | 495 | { |
451 | struct aes_ctx *ctx = aes_ctx(tfm); | 496 | struct aes_ctx *ctx = aes_ctx(tfm); |
452 | padlock_xcrypt_ecb(in, out, ctx->D, &ctx->cword.decrypt, 1); | 497 | aes_crypt(in, out, ctx->D, &ctx->cword.decrypt); |
453 | } | 498 | } |
454 | 499 | ||
455 | static struct crypto_alg aes_alg = { | 500 | static struct crypto_alg aes_alg = { |
diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c index b6e1eb77d148..bc132d8f79cb 100644 --- a/drivers/firmware/dmi-id.c +++ b/drivers/firmware/dmi-id.c | |||
@@ -175,12 +175,11 @@ static struct device *dmi_dev; | |||
175 | 175 | ||
176 | extern int dmi_available; | 176 | extern int dmi_available; |
177 | 177 | ||
178 | static int __init dmi_id_init(void) | 178 | /* In a separate function to keep gcc 3.2 happy - do NOT merge this in |
179 | dmi_id_init! */ | ||
180 | static void __init dmi_id_init_attr_table(void) | ||
179 | { | 181 | { |
180 | int ret, i; | 182 | int i; |
181 | |||
182 | if (!dmi_available) | ||
183 | return -ENODEV; | ||
184 | 183 | ||
185 | /* Not necessarily all DMI fields are available on all | 184 | /* Not necessarily all DMI fields are available on all |
186 | * systems, hence let's built an attribute table of just | 185 | * systems, hence let's built an attribute table of just |
@@ -205,6 +204,16 @@ static int __init dmi_id_init(void) | |||
205 | ADD_DMI_ATTR(chassis_serial, DMI_CHASSIS_SERIAL); | 204 | ADD_DMI_ATTR(chassis_serial, DMI_CHASSIS_SERIAL); |
206 | ADD_DMI_ATTR(chassis_asset_tag, DMI_CHASSIS_ASSET_TAG); | 205 | ADD_DMI_ATTR(chassis_asset_tag, DMI_CHASSIS_ASSET_TAG); |
207 | sys_dmi_attributes[i++] = &sys_dmi_modalias_attr.attr; | 206 | sys_dmi_attributes[i++] = &sys_dmi_modalias_attr.attr; |
207 | } | ||
208 | |||
209 | static int __init dmi_id_init(void) | ||
210 | { | ||
211 | int ret; | ||
212 | |||
213 | if (!dmi_available) | ||
214 | return -ENODEV; | ||
215 | |||
216 | dmi_id_init_attr_table(); | ||
208 | 217 | ||
209 | ret = class_register(&dmi_class); | 218 | ret = class_register(&dmi_class); |
210 | if (ret) | 219 | if (ret) |
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 6a182e14cf58..ad6c8a319903 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
@@ -2,6 +2,14 @@ | |||
2 | it87.c - Part of lm_sensors, Linux kernel modules for hardware | 2 | it87.c - Part of lm_sensors, Linux kernel modules for hardware |
3 | monitoring. | 3 | monitoring. |
4 | 4 | ||
5 | The IT8705F is an LPC-based Super I/O part that contains UARTs, a | ||
6 | parallel port, an IR port, a MIDI port, a floppy controller, etc., in | ||
7 | addition to an Environment Controller (Enhanced Hardware Monitor and | ||
8 | Fan Controller) | ||
9 | |||
10 | This driver supports only the Environment Controller in the IT8705F and | ||
11 | similar parts. The other devices are supported by different drivers. | ||
12 | |||
5 | Supports: IT8705F Super I/O chip w/LPC interface | 13 | Supports: IT8705F Super I/O chip w/LPC interface |
6 | IT8712F Super I/O chip w/LPC interface | 14 | IT8712F Super I/O chip w/LPC interface |
7 | IT8716F Super I/O chip w/LPC interface | 15 | IT8716F Super I/O chip w/LPC interface |
@@ -118,9 +126,15 @@ static int fix_pwm_polarity; | |||
118 | /* Length of ISA address segment */ | 126 | /* Length of ISA address segment */ |
119 | #define IT87_EXTENT 8 | 127 | #define IT87_EXTENT 8 |
120 | 128 | ||
121 | /* Where are the ISA address/data registers relative to the base address */ | 129 | /* Length of ISA address segment for Environmental Controller */ |
122 | #define IT87_ADDR_REG_OFFSET 5 | 130 | #define IT87_EC_EXTENT 2 |
123 | #define IT87_DATA_REG_OFFSET 6 | 131 | |
132 | /* Offset of EC registers from ISA base address */ | ||
133 | #define IT87_EC_OFFSET 5 | ||
134 | |||
135 | /* Where are the ISA address/data registers relative to the EC base address */ | ||
136 | #define IT87_ADDR_REG_OFFSET 0 | ||
137 | #define IT87_DATA_REG_OFFSET 1 | ||
124 | 138 | ||
125 | /*----- The IT87 registers -----*/ | 139 | /*----- The IT87 registers -----*/ |
126 | 140 | ||
@@ -968,10 +982,10 @@ static int __devinit it87_probe(struct platform_device *pdev) | |||
968 | }; | 982 | }; |
969 | 983 | ||
970 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 984 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
971 | if (!request_region(res->start, IT87_EXTENT, DRVNAME)) { | 985 | if (!request_region(res->start, IT87_EC_EXTENT, DRVNAME)) { |
972 | dev_err(dev, "Failed to request region 0x%lx-0x%lx\n", | 986 | dev_err(dev, "Failed to request region 0x%lx-0x%lx\n", |
973 | (unsigned long)res->start, | 987 | (unsigned long)res->start, |
974 | (unsigned long)(res->start + IT87_EXTENT - 1)); | 988 | (unsigned long)(res->start + IT87_EC_EXTENT - 1)); |
975 | err = -EBUSY; | 989 | err = -EBUSY; |
976 | goto ERROR0; | 990 | goto ERROR0; |
977 | } | 991 | } |
@@ -1124,7 +1138,7 @@ ERROR2: | |||
1124 | platform_set_drvdata(pdev, NULL); | 1138 | platform_set_drvdata(pdev, NULL); |
1125 | kfree(data); | 1139 | kfree(data); |
1126 | ERROR1: | 1140 | ERROR1: |
1127 | release_region(res->start, IT87_EXTENT); | 1141 | release_region(res->start, IT87_EC_EXTENT); |
1128 | ERROR0: | 1142 | ERROR0: |
1129 | return err; | 1143 | return err; |
1130 | } | 1144 | } |
@@ -1137,7 +1151,7 @@ static int __devexit it87_remove(struct platform_device *pdev) | |||
1137 | sysfs_remove_group(&pdev->dev.kobj, &it87_group); | 1151 | sysfs_remove_group(&pdev->dev.kobj, &it87_group); |
1138 | sysfs_remove_group(&pdev->dev.kobj, &it87_group_opt); | 1152 | sysfs_remove_group(&pdev->dev.kobj, &it87_group_opt); |
1139 | 1153 | ||
1140 | release_region(data->addr, IT87_EXTENT); | 1154 | release_region(data->addr, IT87_EC_EXTENT); |
1141 | platform_set_drvdata(pdev, NULL); | 1155 | platform_set_drvdata(pdev, NULL); |
1142 | kfree(data); | 1156 | kfree(data); |
1143 | 1157 | ||
@@ -1402,8 +1416,8 @@ static int __init it87_device_add(unsigned short address, | |||
1402 | const struct it87_sio_data *sio_data) | 1416 | const struct it87_sio_data *sio_data) |
1403 | { | 1417 | { |
1404 | struct resource res = { | 1418 | struct resource res = { |
1405 | .start = address , | 1419 | .start = address + IT87_EC_OFFSET, |
1406 | .end = address + IT87_EXTENT - 1, | 1420 | .end = address + IT87_EC_OFFSET + IT87_EC_EXTENT - 1, |
1407 | .name = DRVNAME, | 1421 | .name = DRVNAME, |
1408 | .flags = IORESOURCE_IO, | 1422 | .flags = IORESOURCE_IO, |
1409 | }; | 1423 | }; |
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index b15c6a998b72..d5aa25ce5dbd 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -1276,23 +1276,31 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) | |||
1276 | 1276 | ||
1277 | data->vrm = vid_which_vrm(); | 1277 | data->vrm = vid_which_vrm(); |
1278 | superio_enter(sio_data->sioreg); | 1278 | superio_enter(sio_data->sioreg); |
1279 | /* Set VID input sensibility if needed. In theory the BIOS should | ||
1280 | have set it, but in practice it's not always the case. */ | ||
1281 | en_vrm10 = superio_inb(sio_data->sioreg, SIO_REG_EN_VRM10); | ||
1282 | if ((en_vrm10 & 0x08) && data->vrm != 100) { | ||
1283 | dev_warn(dev, "Setting VID input voltage to TTL\n"); | ||
1284 | superio_outb(sio_data->sioreg, SIO_REG_EN_VRM10, | ||
1285 | en_vrm10 & ~0x08); | ||
1286 | } else if (!(en_vrm10 & 0x08) && data->vrm == 100) { | ||
1287 | dev_warn(dev, "Setting VID input voltage to VRM10\n"); | ||
1288 | superio_outb(sio_data->sioreg, SIO_REG_EN_VRM10, | ||
1289 | en_vrm10 | 0x08); | ||
1290 | } | ||
1291 | /* Read VID value */ | 1279 | /* Read VID value */ |
1292 | superio_select(sio_data->sioreg, W83627EHF_LD_HWM); | 1280 | superio_select(sio_data->sioreg, W83627EHF_LD_HWM); |
1293 | if (superio_inb(sio_data->sioreg, SIO_REG_VID_CTRL) & 0x80) | 1281 | if (superio_inb(sio_data->sioreg, SIO_REG_VID_CTRL) & 0x80) { |
1282 | /* Set VID input sensibility if needed. In theory the BIOS | ||
1283 | should have set it, but in practice it's not always the | ||
1284 | case. We only do it for the W83627EHF/EHG because the | ||
1285 | W83627DHG is more complex in this respect. */ | ||
1286 | if (sio_data->kind == w83627ehf) { | ||
1287 | en_vrm10 = superio_inb(sio_data->sioreg, | ||
1288 | SIO_REG_EN_VRM10); | ||
1289 | if ((en_vrm10 & 0x08) && data->vrm == 90) { | ||
1290 | dev_warn(dev, "Setting VID input voltage to " | ||
1291 | "TTL\n"); | ||
1292 | superio_outb(sio_data->sioreg, SIO_REG_EN_VRM10, | ||
1293 | en_vrm10 & ~0x08); | ||
1294 | } else if (!(en_vrm10 & 0x08) && data->vrm == 100) { | ||
1295 | dev_warn(dev, "Setting VID input voltage to " | ||
1296 | "VRM10\n"); | ||
1297 | superio_outb(sio_data->sioreg, SIO_REG_EN_VRM10, | ||
1298 | en_vrm10 | 0x08); | ||
1299 | } | ||
1300 | } | ||
1301 | |||
1294 | data->vid = superio_inb(sio_data->sioreg, SIO_REG_VID_DATA) & 0x3f; | 1302 | data->vid = superio_inb(sio_data->sioreg, SIO_REG_VID_DATA) & 0x3f; |
1295 | else { | 1303 | } else { |
1296 | dev_info(dev, "VID pins in output mode, CPU VID not " | 1304 | dev_info(dev, "VID pins in output mode, CPU VID not " |
1297 | "available\n"); | 1305 | "available\n"); |
1298 | data->vid = 0x3f; | 1306 | data->vid = 0x3f; |
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) | |||
619 | err_free_irq: | 619 | err_free_irq: |
620 | free_irq(dev->irq, dev); | 620 | free_irq(dev->irq, dev); |
621 | err_unuse_clocks: | 621 | err_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); |
624 | err_free_mem: | 625 | err_free_mem: |
625 | platform_set_drvdata(pdev, NULL); | 626 | platform_set_drvdata(pdev, NULL); |
626 | kfree(dev); | 627 | kfree(dev); |
627 | err_release_region: | 628 | err_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 | ||
201 | static int __init i2c_sibyte_init(void) | 201 | static 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. */ |
188 | static int i2cdev_check_addr(struct i2c_adapter *adapter, unsigned int addr) | 188 | static 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; | |||
65 | extern int ide_noacpitfs; | 66 | extern int ide_noacpitfs; |
66 | extern int ide_noacpionboot; | 67 | extern int ide_noacpionboot; |
67 | 68 | ||
69 | static bool ide_noacpi_psx; | ||
70 | static 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 | |||
77 | static 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 | |||
92 | static 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-cd.c b/drivers/ide/ide-cd.c index 92ac658dac33..c7d77f0ad892 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -1068,8 +1068,8 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason) | |||
1068 | return 0; | 1068 | return 0; |
1069 | else if (ireason == 0) { | 1069 | else if (ireason == 0) { |
1070 | /* Whoops... The drive is expecting to receive data from us! */ | 1070 | /* Whoops... The drive is expecting to receive data from us! */ |
1071 | printk(KERN_ERR "%s: read_intr: Drive wants to transfer data the " | 1071 | printk(KERN_ERR "%s: %s: wrong transfer direction!\n", |
1072 | "wrong way!\n", drive->name); | 1072 | drive->name, __FUNCTION__); |
1073 | 1073 | ||
1074 | /* Throw some data at the drive so it doesn't hang | 1074 | /* Throw some data at the drive so it doesn't hang |
1075 | and quit this request. */ | 1075 | and quit this request. */ |
@@ -1086,8 +1086,8 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason) | |||
1086 | return 0; | 1086 | return 0; |
1087 | } else { | 1087 | } else { |
1088 | /* Drive wants a command packet, or invalid ireason... */ | 1088 | /* Drive wants a command packet, or invalid ireason... */ |
1089 | printk(KERN_ERR "%s: read_intr: bad interrupt reason %x\n", drive->name, | 1089 | printk(KERN_ERR "%s: %s: bad interrupt reason 0x%02x\n", |
1090 | ireason); | 1090 | drive->name, __FUNCTION__, ireason); |
1091 | } | 1091 | } |
1092 | 1092 | ||
1093 | cdrom_end_request(drive, 0); | 1093 | cdrom_end_request(drive, 0); |
@@ -1112,8 +1112,11 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive) | |||
1112 | */ | 1112 | */ |
1113 | if (dma) { | 1113 | if (dma) { |
1114 | info->dma = 0; | 1114 | info->dma = 0; |
1115 | if ((dma_error = HWIF(drive)->ide_dma_end(drive))) | 1115 | dma_error = HWIF(drive)->ide_dma_end(drive); |
1116 | if (dma_error) { | ||
1117 | printk(KERN_ERR "%s: DMA read error\n", drive->name); | ||
1116 | ide_dma_off(drive); | 1118 | ide_dma_off(drive); |
1119 | } | ||
1117 | } | 1120 | } |
1118 | 1121 | ||
1119 | if (cdrom_decode_status(drive, 0, &stat)) | 1122 | if (cdrom_decode_status(drive, 0, &stat)) |
@@ -1443,7 +1446,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive) | |||
1443 | return ide_stopped; | 1446 | return ide_stopped; |
1444 | 1447 | ||
1445 | /* Read the interrupt reason and the transfer length. */ | 1448 | /* Read the interrupt reason and the transfer length. */ |
1446 | ireason = HWIF(drive)->INB(IDE_IREASON_REG); | 1449 | ireason = HWIF(drive)->INB(IDE_IREASON_REG) & 0x3; |
1447 | lowcyl = HWIF(drive)->INB(IDE_BCOUNTL_REG); | 1450 | lowcyl = HWIF(drive)->INB(IDE_BCOUNTL_REG); |
1448 | highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG); | 1451 | highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG); |
1449 | 1452 | ||
@@ -1484,7 +1487,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive) | |||
1484 | if (thislen > len) thislen = len; | 1487 | if (thislen > len) thislen = len; |
1485 | 1488 | ||
1486 | /* The drive wants to be written to. */ | 1489 | /* The drive wants to be written to. */ |
1487 | if ((ireason & 3) == 0) { | 1490 | if (ireason == 0) { |
1488 | if (!rq->data) { | 1491 | if (!rq->data) { |
1489 | blk_dump_rq_flags(rq, "cdrom_pc_intr, write"); | 1492 | blk_dump_rq_flags(rq, "cdrom_pc_intr, write"); |
1490 | goto confused; | 1493 | goto confused; |
@@ -1506,9 +1509,9 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive) | |||
1506 | } | 1509 | } |
1507 | 1510 | ||
1508 | /* Same drill for reading. */ | 1511 | /* Same drill for reading. */ |
1509 | else if ((ireason & 3) == 2) { | 1512 | else if (ireason == 2) { |
1510 | if (!rq->data) { | 1513 | if (!rq->data) { |
1511 | blk_dump_rq_flags(rq, "cdrom_pc_intr, write"); | 1514 | blk_dump_rq_flags(rq, "cdrom_pc_intr, read"); |
1512 | goto confused; | 1515 | goto confused; |
1513 | } | 1516 | } |
1514 | /* Transfer the data. */ | 1517 | /* Transfer the data. */ |
@@ -1632,8 +1635,8 @@ static int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason) | |||
1632 | return 0; | 1635 | return 0; |
1633 | else if (ireason == 2) { | 1636 | else if (ireason == 2) { |
1634 | /* Whoops... The drive wants to send data. */ | 1637 | /* Whoops... The drive wants to send data. */ |
1635 | printk(KERN_ERR "%s: write_intr: wrong transfer direction!\n", | 1638 | printk(KERN_ERR "%s: %s: wrong transfer direction!\n", |
1636 | drive->name); | 1639 | drive->name, __FUNCTION__); |
1637 | 1640 | ||
1638 | while (len > 0) { | 1641 | while (len > 0) { |
1639 | int dum = 0; | 1642 | int dum = 0; |
@@ -1642,8 +1645,8 @@ static int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason) | |||
1642 | } | 1645 | } |
1643 | } else { | 1646 | } else { |
1644 | /* Drive wants a command packet, or invalid ireason... */ | 1647 | /* Drive wants a command packet, or invalid ireason... */ |
1645 | printk(KERN_ERR "%s: write_intr: bad interrupt reason %x\n", | 1648 | printk(KERN_ERR "%s: %s: bad interrupt reason 0x%02x\n", |
1646 | drive->name, ireason); | 1649 | drive->name, __FUNCTION__, ireason); |
1647 | } | 1650 | } |
1648 | 1651 | ||
1649 | cdrom_end_request(drive, 0); | 1652 | cdrom_end_request(drive, 0); |
@@ -1805,8 +1808,9 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive) | |||
1805 | /* Check for errors. */ | 1808 | /* Check for errors. */ |
1806 | if (dma) { | 1809 | if (dma) { |
1807 | info->dma = 0; | 1810 | info->dma = 0; |
1808 | if ((dma_error = HWIF(drive)->ide_dma_end(drive))) { | 1811 | dma_error = HWIF(drive)->ide_dma_end(drive); |
1809 | printk(KERN_ERR "ide-cd: write dma error\n"); | 1812 | if (dma_error) { |
1813 | printk(KERN_ERR "%s: DMA write error\n", drive->name); | ||
1810 | ide_dma_off(drive); | 1814 | ide_dma_off(drive); |
1811 | } | 1815 | } |
1812 | } | 1816 | } |
@@ -1826,7 +1830,7 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive) | |||
1826 | } | 1830 | } |
1827 | 1831 | ||
1828 | /* Read the interrupt reason and the transfer length. */ | 1832 | /* Read the interrupt reason and the transfer length. */ |
1829 | ireason = HWIF(drive)->INB(IDE_IREASON_REG); | 1833 | ireason = HWIF(drive)->INB(IDE_IREASON_REG) & 0x3; |
1830 | lowcyl = HWIF(drive)->INB(IDE_BCOUNTL_REG); | 1834 | lowcyl = HWIF(drive)->INB(IDE_BCOUNTL_REG); |
1831 | highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG); | 1835 | highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG); |
1832 | 1836 | ||
@@ -1839,8 +1843,9 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive) | |||
1839 | */ | 1843 | */ |
1840 | uptodate = 1; | 1844 | uptodate = 1; |
1841 | if (rq->current_nr_sectors > 0) { | 1845 | if (rq->current_nr_sectors > 0) { |
1842 | printk(KERN_ERR "%s: write_intr: data underrun (%d blocks)\n", | 1846 | printk(KERN_ERR "%s: %s: data underrun (%d blocks)\n", |
1843 | drive->name, rq->current_nr_sectors); | 1847 | drive->name, __FUNCTION__, |
1848 | rq->current_nr_sectors); | ||
1844 | uptodate = 0; | 1849 | uptodate = 0; |
1845 | } | 1850 | } |
1846 | cdrom_end_request(drive, uptodate); | 1851 | cdrom_end_request(drive, uptodate); |
@@ -1860,7 +1865,8 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive) | |||
1860 | int this_transfer; | 1865 | int this_transfer; |
1861 | 1866 | ||
1862 | if (!rq->current_nr_sectors) { | 1867 | if (!rq->current_nr_sectors) { |
1863 | printk(KERN_ERR "ide-cd: write_intr: oops\n"); | 1868 | printk(KERN_ERR "%s: %s: confused, missing data\n", |
1869 | drive->name, __FUNCTION__); | ||
1864 | break; | 1870 | break; |
1865 | } | 1871 | } |
1866 | 1872 | ||
@@ -2688,14 +2694,14 @@ void ide_cdrom_update_speed (ide_drive_t *drive, struct atapi_capabilities_page | |||
2688 | if (!drive->id->model[0] && | 2694 | if (!drive->id->model[0] && |
2689 | !strncmp(drive->id->fw_rev, "241N", 4)) { | 2695 | !strncmp(drive->id->fw_rev, "241N", 4)) { |
2690 | CDROM_STATE_FLAGS(drive)->current_speed = | 2696 | CDROM_STATE_FLAGS(drive)->current_speed = |
2691 | (((unsigned int)cap->curspeed) + (176/2)) / 176; | 2697 | (le16_to_cpu(cap->curspeed) + (176/2)) / 176; |
2692 | CDROM_CONFIG_FLAGS(drive)->max_speed = | 2698 | CDROM_CONFIG_FLAGS(drive)->max_speed = |
2693 | (((unsigned int)cap->maxspeed) + (176/2)) / 176; | 2699 | (le16_to_cpu(cap->maxspeed) + (176/2)) / 176; |
2694 | } else { | 2700 | } else { |
2695 | CDROM_STATE_FLAGS(drive)->current_speed = | 2701 | CDROM_STATE_FLAGS(drive)->current_speed = |
2696 | (ntohs(cap->curspeed) + (176/2)) / 176; | 2702 | (be16_to_cpu(cap->curspeed) + (176/2)) / 176; |
2697 | CDROM_CONFIG_FLAGS(drive)->max_speed = | 2703 | CDROM_CONFIG_FLAGS(drive)->max_speed = |
2698 | (ntohs(cap->maxspeed) + (176/2)) / 176; | 2704 | (be16_to_cpu(cap->maxspeed) + (176/2)) / 176; |
2699 | } | 2705 | } |
2700 | } | 2706 | } |
2701 | 2707 | ||
@@ -2909,6 +2915,9 @@ static int ide_cdrom_register (ide_drive_t *drive, int nslots) | |||
2909 | if (!CDROM_CONFIG_FLAGS(drive)->ram) | 2915 | if (!CDROM_CONFIG_FLAGS(drive)->ram) |
2910 | devinfo->mask |= CDC_RAM; | 2916 | devinfo->mask |= CDC_RAM; |
2911 | 2917 | ||
2918 | if (CDROM_CONFIG_FLAGS(drive)->no_speed_select) | ||
2919 | devinfo->mask |= CDC_SELECT_SPEED; | ||
2920 | |||
2912 | devinfo->disk = info->disk; | 2921 | devinfo->disk = info->disk; |
2913 | return register_cdrom(devinfo); | 2922 | return register_cdrom(devinfo); |
2914 | } | 2923 | } |
@@ -3161,7 +3170,7 @@ int ide_cdrom_setup (ide_drive_t *drive) | |||
3161 | CDROM_CONFIG_FLAGS(drive)->limit_nframes = 1; | 3170 | CDROM_CONFIG_FLAGS(drive)->limit_nframes = 1; |
3162 | /* the 3231 model does not support the SET_CD_SPEED command */ | 3171 | /* the 3231 model does not support the SET_CD_SPEED command */ |
3163 | else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-3231")) | 3172 | else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-3231")) |
3164 | cdi->mask |= CDC_SELECT_SPEED; | 3173 | CDROM_CONFIG_FLAGS(drive)->no_speed_select = 1; |
3165 | 3174 | ||
3166 | #if ! STANDARD_ATAPI | 3175 | #if ! STANDARD_ATAPI |
3167 | /* by default Sanyo 3 CD changer support is turned off and | 3176 | /* by default Sanyo 3 CD changer support is turned off and |
@@ -3504,15 +3513,8 @@ static int ide_cd_probe(ide_drive_t *drive) | |||
3504 | g->driverfs_dev = &drive->gendev; | 3513 | g->driverfs_dev = &drive->gendev; |
3505 | g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE; | 3514 | g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE; |
3506 | if (ide_cdrom_setup(drive)) { | 3515 | if (ide_cdrom_setup(drive)) { |
3507 | struct cdrom_device_info *devinfo = &info->devinfo; | ||
3508 | ide_proc_unregister_driver(drive, &ide_cdrom_driver); | 3516 | ide_proc_unregister_driver(drive, &ide_cdrom_driver); |
3509 | kfree(info->buffer); | 3517 | ide_cd_release(&info->kref); |
3510 | kfree(info->toc); | ||
3511 | kfree(info->changer_info); | ||
3512 | if (devinfo->handle == drive && unregister_cdrom(devinfo)) | ||
3513 | printk (KERN_ERR "%s: ide_cdrom_cleanup failed to unregister device from the cdrom driver.\n", drive->name); | ||
3514 | kfree(info); | ||
3515 | drive->driver_data = NULL; | ||
3516 | goto failed; | 3518 | goto failed; |
3517 | } | 3519 | } |
3518 | 3520 | ||
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index 228b29c5d2e4..1b302fe2724d 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h | |||
@@ -91,7 +91,8 @@ struct ide_cd_config_flags { | |||
91 | __u8 close_tray : 1; /* can close the tray */ | 91 | __u8 close_tray : 1; /* can close the tray */ |
92 | __u8 writing : 1; /* pseudo write in progress */ | 92 | __u8 writing : 1; /* pseudo write in progress */ |
93 | __u8 mo_drive : 1; /* drive is an MO device */ | 93 | __u8 mo_drive : 1; /* drive is an MO device */ |
94 | __u8 reserved : 2; | 94 | __u8 no_speed_select : 1; /* SET_CD_SPEED command is unsupported. */ |
95 | __u8 reserved : 1; | ||
95 | byte max_speed; /* Max speed of the drive */ | 96 | byte max_speed; /* Max speed of the drive */ |
96 | }; | 97 | }; |
97 | #define CDROM_CONFIG_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->config_flags)) | 98 | #define CDROM_CONFIG_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->config_flags)) |
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/cmd64x.c b/drivers/ide/pci/cmd64x.c index 51fca441c294..bc553337b1be 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/cmd64x.c Version 1.51 Nov 8, 2007 | 2 | * linux/drivers/ide/pci/cmd64x.c Version 1.52 Dec 24, 2007 |
3 | * | 3 | * |
4 | * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. | 4 | * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. |
5 | * Due to massive hardware bugs, UltraDMA is only supported | 5 | * Due to massive hardware bugs, UltraDMA is only supported |
@@ -564,6 +564,7 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = { | |||
564 | .init_chipset = init_chipset_cmd64x, | 564 | .init_chipset = init_chipset_cmd64x, |
565 | .init_hwif = init_hwif_cmd64x, | 565 | .init_hwif = init_hwif_cmd64x, |
566 | .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, | 566 | .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, |
567 | .chipset = ide_cmd646, | ||
567 | .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE, | 568 | .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE, |
568 | .pio_mask = ATA_PIO5, | 569 | .pio_mask = ATA_PIO5, |
569 | .mwdma_mask = ATA_MWDMA2, | 570 | .mwdma_mask = ATA_MWDMA2, |
@@ -573,7 +574,6 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = { | |||
573 | .init_chipset = init_chipset_cmd64x, | 574 | .init_chipset = init_chipset_cmd64x, |
574 | .init_hwif = init_hwif_cmd64x, | 575 | .init_hwif = init_hwif_cmd64x, |
575 | .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, | 576 | .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, |
576 | .chipset = ide_cmd646, | ||
577 | .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE, | 577 | .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE, |
578 | .pio_mask = ATA_PIO5, | 578 | .pio_mask = ATA_PIO5, |
579 | .mwdma_mask = ATA_MWDMA2, | 579 | .mwdma_mask = ATA_MWDMA2, |
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c index 9094916e3780..ddcbeba671e1 100644 --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c | |||
@@ -49,7 +49,7 @@ | |||
49 | #define ATAC_BM0_PRD 0x04 | 49 | #define ATAC_BM0_PRD 0x04 |
50 | #define CS5535_CABLE_DETECT 0x48 | 50 | #define CS5535_CABLE_DETECT 0x48 |
51 | 51 | ||
52 | /* Format I PIO settings. We seperate out cmd and data for safer timings */ | 52 | /* Format I PIO settings. We separate out cmd and data for safer timings */ |
53 | 53 | ||
54 | static unsigned int cs5535_pio_cmd_timings[5] = | 54 | static unsigned int cs5535_pio_cmd_timings[5] = |
55 | { 0xF7F4, 0x53F3, 0x13F1, 0x5131, 0x1131 }; | 55 | { 0xF7F4, 0x53F3, 0x13F1, 0x5131, 0x1131 }; |
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 | ||
180 | static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command) | 181 | static 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 | ||
188 | static int trm290_ide_dma_setup(ide_drive_t *drive) | 189 | static 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 | ||
218 | static void trm290_ide_dma_start(ide_drive_t *drive) | 219 | static 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 | ||
244 | static void trm290_dma_host_on(ide_drive_t *drive) | ||
245 | { | ||
246 | } | ||
247 | |||
248 | static void trm290_dma_host_off(ide_drive_t *drive) | ||
249 | { | ||
250 | } | ||
251 | |||
243 | static void __devinit init_hwif_trm290(ide_hwif_t *hwif) | 252 | static 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/infiniband/hw/ipath/ipath_ud.c b/drivers/infiniband/hw/ipath/ipath_ud.c index 16a2a938b520..b3df6f3c705e 100644 --- a/drivers/infiniband/hw/ipath/ipath_ud.c +++ b/drivers/infiniband/hw/ipath/ipath_ud.c | |||
@@ -455,6 +455,28 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, | |||
455 | } | 455 | } |
456 | } | 456 | } |
457 | 457 | ||
458 | /* | ||
459 | * The opcode is in the low byte when its in network order | ||
460 | * (top byte when in host order). | ||
461 | */ | ||
462 | opcode = be32_to_cpu(ohdr->bth[0]) >> 24; | ||
463 | if (qp->ibqp.qp_num > 1 && | ||
464 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { | ||
465 | if (header_in_data) { | ||
466 | wc.imm_data = *(__be32 *) data; | ||
467 | data += sizeof(__be32); | ||
468 | } else | ||
469 | wc.imm_data = ohdr->u.ud.imm_data; | ||
470 | wc.wc_flags = IB_WC_WITH_IMM; | ||
471 | hdrsize += sizeof(u32); | ||
472 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { | ||
473 | wc.imm_data = 0; | ||
474 | wc.wc_flags = 0; | ||
475 | } else { | ||
476 | dev->n_pkt_drops++; | ||
477 | goto bail; | ||
478 | } | ||
479 | |||
458 | /* Get the number of bytes the message was padded by. */ | 480 | /* Get the number of bytes the message was padded by. */ |
459 | pad = (be32_to_cpu(ohdr->bth[0]) >> 20) & 3; | 481 | pad = (be32_to_cpu(ohdr->bth[0]) >> 20) & 3; |
460 | if (unlikely(tlen < (hdrsize + pad + 4))) { | 482 | if (unlikely(tlen < (hdrsize + pad + 4))) { |
@@ -482,28 +504,6 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, | |||
482 | wc.byte_len = tlen + sizeof(struct ib_grh); | 504 | wc.byte_len = tlen + sizeof(struct ib_grh); |
483 | 505 | ||
484 | /* | 506 | /* |
485 | * The opcode is in the low byte when its in network order | ||
486 | * (top byte when in host order). | ||
487 | */ | ||
488 | opcode = be32_to_cpu(ohdr->bth[0]) >> 24; | ||
489 | if (qp->ibqp.qp_num > 1 && | ||
490 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { | ||
491 | if (header_in_data) { | ||
492 | wc.imm_data = *(__be32 *) data; | ||
493 | data += sizeof(__be32); | ||
494 | } else | ||
495 | wc.imm_data = ohdr->u.ud.imm_data; | ||
496 | wc.wc_flags = IB_WC_WITH_IMM; | ||
497 | hdrsize += sizeof(u32); | ||
498 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { | ||
499 | wc.imm_data = 0; | ||
500 | wc.wc_flags = 0; | ||
501 | } else { | ||
502 | dev->n_pkt_drops++; | ||
503 | goto bail; | ||
504 | } | ||
505 | |||
506 | /* | ||
507 | * Get the next work request entry to find where to put the data. | 507 | * Get the next work request entry to find where to put the data. |
508 | */ | 508 | */ |
509 | if (qp->r_reuse_sge) | 509 | if (qp->r_reuse_sge) |
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c index 8bf44daf45ec..9d32c49cc651 100644 --- a/drivers/infiniband/hw/mlx4/cq.c +++ b/drivers/infiniband/hw/mlx4/cq.c | |||
@@ -430,7 +430,7 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq, | |||
430 | wc->dlid_path_bits = (be32_to_cpu(cqe->g_mlpath_rqpn) >> 24) & 0x7f; | 430 | wc->dlid_path_bits = (be32_to_cpu(cqe->g_mlpath_rqpn) >> 24) & 0x7f; |
431 | wc->wc_flags |= be32_to_cpu(cqe->g_mlpath_rqpn) & 0x80000000 ? | 431 | wc->wc_flags |= be32_to_cpu(cqe->g_mlpath_rqpn) & 0x80000000 ? |
432 | IB_WC_GRH : 0; | 432 | IB_WC_GRH : 0; |
433 | wc->pkey_index = be32_to_cpu(cqe->immed_rss_invalid) >> 16; | 433 | wc->pkey_index = be32_to_cpu(cqe->immed_rss_invalid) & 0x7f; |
434 | } | 434 | } |
435 | 435 | ||
436 | return 0; | 436 | return 0; |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 950228fb009f..bdb6f8517401 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -2053,6 +2053,7 @@ static void srp_remove_one(struct ib_device *device) | |||
2053 | 2053 | ||
2054 | list_for_each_entry_safe(target, tmp_target, | 2054 | list_for_each_entry_safe(target, tmp_target, |
2055 | &host->target_list, list) { | 2055 | &host->target_list, list) { |
2056 | srp_remove_host(target->scsi_host); | ||
2056 | scsi_remove_host(target->scsi_host); | 2057 | scsi_remove_host(target->scsi_host); |
2057 | srp_disconnect_target(target); | 2058 | srp_disconnect_target(target); |
2058 | ib_destroy_cm_id(target->cm_id); | 2059 | ib_destroy_cm_id(target->cm_id); |
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); | |||
38 | EXPORT_SYMBOL(gameport_open); | 38 | EXPORT_SYMBOL(gameport_open); |
39 | EXPORT_SYMBOL(gameport_close); | 39 | EXPORT_SYMBOL(gameport_close); |
40 | EXPORT_SYMBOL(gameport_rescan); | 40 | EXPORT_SYMBOL(gameport_rescan); |
41 | EXPORT_SYMBOL(gameport_cooked_read); | ||
42 | EXPORT_SYMBOL(gameport_set_name); | ||
43 | EXPORT_SYMBOL(gameport_set_phys); | 41 | EXPORT_SYMBOL(gameport_set_phys); |
44 | EXPORT_SYMBOL(gameport_start_polling); | 42 | EXPORT_SYMBOL(gameport_start_polling); |
45 | EXPORT_SYMBOL(gameport_stop_polling); | 43 | EXPORT_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 | ||
211 | config KEYBOARD_HP6XX | 211 | config 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 | ||
222 | config KEYBOARD_HP7XX | 222 | config 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 | ||
45 | static const unsigned short jornada_scancodes[] = { | 45 | static 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 | ||
226 | static void lifebook_disconnect(struct psmouse *psmouse) | 226 | static 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 | ||
117 | config TOUCHSCREEN_HP600 | 117 | config 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 | ||
129 | config TOUCHSCREEN_HP7XX | 127 | config 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 */ |
80 | struct usbtouch_usb { | 85 | struct 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 | ||
102 | static void usbtouch_process_multi(struct usbtouch_usb *usbtouch, | ||
103 | unsigned char *pkt, int len); | ||
104 | #endif | ||
105 | |||
106 | /* device types */ | 102 | /* device types */ |
107 | enum { | 103 | enum { |
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 | ||
326 | static int eturbo_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | 329 | static 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 | ||
464 | static int idealtek_get_pkt_len(unsigned char *buf, int len) | 470 | static 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 | ||
535 | static void usbtouch_process_multi(struct usbtouch_usb *usbtouch, | ||
536 | unsigned char *pkt, int len); | ||
537 | #endif | ||
538 | |||
528 | static struct usbtouch_device_info usbtouch_dev_info[] = { | 539 | static 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/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index d6952959d72a..9cef6fcf587b 100644 --- a/drivers/isdn/i4l/isdn_common.c +++ b/drivers/isdn/i4l/isdn_common.c | |||
@@ -914,6 +914,9 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack) | |||
914 | dflag = 0; | 914 | dflag = 0; |
915 | count_pull = count_put = 0; | 915 | count_pull = count_put = 0; |
916 | while ((count_pull < skb->len) && (len > 0)) { | 916 | while ((count_pull < skb->len) && (len > 0)) { |
917 | /* push every character but the last to the tty buffer directly */ | ||
918 | if ( count_put ) | ||
919 | tty_insert_flip_char(tty, last, TTY_NORMAL); | ||
917 | len--; | 920 | len--; |
918 | if (dev->drv[di]->DLEflag & DLEmask) { | 921 | if (dev->drv[di]->DLEflag & DLEmask) { |
919 | last = DLE; | 922 | last = DLE; |
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index 4e5f87c1e714..9cb6e5021adb 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c | |||
@@ -85,6 +85,8 @@ isdn_tty_try_read(modem_info * info, struct sk_buff *skb) | |||
85 | tty_insert_flip_char(tty, DLE, 0); | 85 | tty_insert_flip_char(tty, DLE, 0); |
86 | tty_insert_flip_char(tty, *dp++, 0); | 86 | tty_insert_flip_char(tty, *dp++, 0); |
87 | } | 87 | } |
88 | if (*dp == DLE) | ||
89 | tty_insert_flip_char(tty, DLE, 0); | ||
88 | last = *dp; | 90 | last = *dp; |
89 | } else { | 91 | } else { |
90 | #endif | 92 | #endif |
@@ -2645,7 +2647,12 @@ isdn_tty_modem_result(int code, modem_info * info) | |||
2645 | if ((info->flags & ISDN_ASYNC_CLOSING) || (!info->tty)) { | 2647 | if ((info->flags & ISDN_ASYNC_CLOSING) || (!info->tty)) { |
2646 | return; | 2648 | return; |
2647 | } | 2649 | } |
2650 | #ifdef CONFIG_ISDN_AUDIO | ||
2651 | if ( !info->vonline ) | ||
2652 | tty_ldisc_flush(info->tty); | ||
2653 | #else | ||
2648 | tty_ldisc_flush(info->tty); | 2654 | tty_ldisc_flush(info->tty); |
2655 | #endif | ||
2649 | if ((info->flags & ISDN_ASYNC_CHECK_CD) && | 2656 | if ((info->flags & ISDN_ASYNC_CHECK_CD) && |
2650 | (!((info->flags & ISDN_ASYNC_CALLOUT_ACTIVE) && | 2657 | (!((info->flags & ISDN_ASYNC_CALLOUT_ACTIVE) && |
2651 | (info->flags & ISDN_ASYNC_CALLOUT_NOHUP)))) { | 2658 | (info->flags & ISDN_ASYNC_CALLOUT_NOHUP)))) { |
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index ba8b04b03b9f..64c66b3769c9 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c | |||
@@ -106,9 +106,9 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) | |||
106 | goto err_out; | 106 | goto err_out; |
107 | 107 | ||
108 | /* add to the list of leds */ | 108 | /* add to the list of leds */ |
109 | write_lock(&leds_list_lock); | 109 | down_write(&leds_list_lock); |
110 | list_add_tail(&led_cdev->node, &leds_list); | 110 | list_add_tail(&led_cdev->node, &leds_list); |
111 | write_unlock(&leds_list_lock); | 111 | up_write(&leds_list_lock); |
112 | 112 | ||
113 | #ifdef CONFIG_LEDS_TRIGGERS | 113 | #ifdef CONFIG_LEDS_TRIGGERS |
114 | init_rwsem(&led_cdev->trigger_lock); | 114 | init_rwsem(&led_cdev->trigger_lock); |
@@ -155,9 +155,9 @@ void led_classdev_unregister(struct led_classdev *led_cdev) | |||
155 | 155 | ||
156 | device_unregister(led_cdev->dev); | 156 | device_unregister(led_cdev->dev); |
157 | 157 | ||
158 | write_lock(&leds_list_lock); | 158 | down_write(&leds_list_lock); |
159 | list_del(&led_cdev->node); | 159 | list_del(&led_cdev->node); |
160 | write_unlock(&leds_list_lock); | 160 | up_write(&leds_list_lock); |
161 | } | 161 | } |
162 | EXPORT_SYMBOL_GPL(led_classdev_unregister); | 162 | EXPORT_SYMBOL_GPL(led_classdev_unregister); |
163 | 163 | ||
diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c index 9b015f9af351..5d1ca10524b6 100644 --- a/drivers/leds/led-core.c +++ b/drivers/leds/led-core.c | |||
@@ -14,11 +14,11 @@ | |||
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/list.h> | 15 | #include <linux/list.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/spinlock.h> | 17 | #include <linux/rwsem.h> |
18 | #include <linux/leds.h> | 18 | #include <linux/leds.h> |
19 | #include "leds.h" | 19 | #include "leds.h" |
20 | 20 | ||
21 | DEFINE_RWLOCK(leds_list_lock); | 21 | DECLARE_RWSEM(leds_list_lock); |
22 | LIST_HEAD(leds_list); | 22 | LIST_HEAD(leds_list); |
23 | 23 | ||
24 | EXPORT_SYMBOL_GPL(leds_list); | 24 | EXPORT_SYMBOL_GPL(leds_list); |
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c index 0bdb786210b1..13c9026d68af 100644 --- a/drivers/leds/led-triggers.c +++ b/drivers/leds/led-triggers.c | |||
@@ -169,7 +169,7 @@ int led_trigger_register(struct led_trigger *trigger) | |||
169 | up_write(&triggers_list_lock); | 169 | up_write(&triggers_list_lock); |
170 | 170 | ||
171 | /* Register with any LEDs that have this as a default trigger */ | 171 | /* Register with any LEDs that have this as a default trigger */ |
172 | read_lock(&leds_list_lock); | 172 | down_read(&leds_list_lock); |
173 | list_for_each_entry(led_cdev, &leds_list, node) { | 173 | list_for_each_entry(led_cdev, &leds_list, node) { |
174 | down_write(&led_cdev->trigger_lock); | 174 | down_write(&led_cdev->trigger_lock); |
175 | if (!led_cdev->trigger && led_cdev->default_trigger && | 175 | if (!led_cdev->trigger && led_cdev->default_trigger && |
@@ -177,7 +177,7 @@ int led_trigger_register(struct led_trigger *trigger) | |||
177 | led_trigger_set(led_cdev, trigger); | 177 | led_trigger_set(led_cdev, trigger); |
178 | up_write(&led_cdev->trigger_lock); | 178 | up_write(&led_cdev->trigger_lock); |
179 | } | 179 | } |
180 | read_unlock(&leds_list_lock); | 180 | up_read(&leds_list_lock); |
181 | 181 | ||
182 | return 0; | 182 | return 0; |
183 | } | 183 | } |
@@ -212,14 +212,14 @@ void led_trigger_unregister(struct led_trigger *trigger) | |||
212 | up_write(&triggers_list_lock); | 212 | up_write(&triggers_list_lock); |
213 | 213 | ||
214 | /* Remove anyone actively using this trigger */ | 214 | /* Remove anyone actively using this trigger */ |
215 | read_lock(&leds_list_lock); | 215 | down_read(&leds_list_lock); |
216 | list_for_each_entry(led_cdev, &leds_list, node) { | 216 | list_for_each_entry(led_cdev, &leds_list, node) { |
217 | down_write(&led_cdev->trigger_lock); | 217 | down_write(&led_cdev->trigger_lock); |
218 | if (led_cdev->trigger == trigger) | 218 | if (led_cdev->trigger == trigger) |
219 | led_trigger_set(led_cdev, NULL); | 219 | led_trigger_set(led_cdev, NULL); |
220 | up_write(&led_cdev->trigger_lock); | 220 | up_write(&led_cdev->trigger_lock); |
221 | } | 221 | } |
222 | read_unlock(&leds_list_lock); | 222 | up_read(&leds_list_lock); |
223 | } | 223 | } |
224 | 224 | ||
225 | void led_trigger_unregister_simple(struct led_trigger *trigger) | 225 | void led_trigger_unregister_simple(struct led_trigger *trigger) |
diff --git a/drivers/leds/leds-locomo.c b/drivers/leds/leds-locomo.c index bfac499f3258..2207335e9212 100644 --- a/drivers/leds/leds-locomo.c +++ b/drivers/leds/leds-locomo.c | |||
@@ -19,7 +19,7 @@ | |||
19 | static void locomoled_brightness_set(struct led_classdev *led_cdev, | 19 | static void locomoled_brightness_set(struct led_classdev *led_cdev, |
20 | enum led_brightness value, int offset) | 20 | enum led_brightness value, int offset) |
21 | { | 21 | { |
22 | struct locomo_dev *locomo_dev = LOCOMO_DEV(led_cdev->dev); | 22 | struct locomo_dev *locomo_dev = LOCOMO_DEV(led_cdev->dev->parent); |
23 | unsigned long flags; | 23 | unsigned long flags; |
24 | 24 | ||
25 | local_irq_save(flags); | 25 | local_irq_save(flags); |
diff --git a/drivers/leds/leds.h b/drivers/leds/leds.h index f2f3884fe063..12b6fe93b135 100644 --- a/drivers/leds/leds.h +++ b/drivers/leds/leds.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #define __LEDS_H_INCLUDED | 14 | #define __LEDS_H_INCLUDED |
15 | 15 | ||
16 | #include <linux/device.h> | 16 | #include <linux/device.h> |
17 | #include <linux/rwsem.h> | ||
17 | #include <linux/leds.h> | 18 | #include <linux/leds.h> |
18 | 19 | ||
19 | static inline void led_set_brightness(struct led_classdev *led_cdev, | 20 | static inline void led_set_brightness(struct led_classdev *led_cdev, |
@@ -26,7 +27,7 @@ static inline void led_set_brightness(struct led_classdev *led_cdev, | |||
26 | led_cdev->brightness_set(led_cdev, value); | 27 | led_cdev->brightness_set(led_cdev, value); |
27 | } | 28 | } |
28 | 29 | ||
29 | extern rwlock_t leds_list_lock; | 30 | extern struct rw_semaphore leds_list_lock; |
30 | extern struct list_head leds_list; | 31 | extern struct list_head leds_list; |
31 | 32 | ||
32 | #ifdef CONFIG_LEDS_TRIGGERS | 33 | #ifdef CONFIG_LEDS_TRIGGERS |
diff --git a/drivers/lguest/Kconfig b/drivers/lguest/Kconfig index 7eb9ecff8f4a..6b8dbb9ba73b 100644 --- a/drivers/lguest/Kconfig +++ b/drivers/lguest/Kconfig | |||
@@ -10,10 +10,3 @@ config LGUEST | |||
10 | not "rustyvisor". See Documentation/lguest/lguest.txt. | 10 | not "rustyvisor". See Documentation/lguest/lguest.txt. |
11 | 11 | ||
12 | If unsure, say N. If curious, say M. If masochistic, say Y. | 12 | If unsure, say N. If curious, say M. If masochistic, say Y. |
13 | |||
14 | config LGUEST_GUEST | ||
15 | bool | ||
16 | help | ||
17 | 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 | 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/md/raid5.c b/drivers/md/raid5.c index a5aad8cad843..e8c8157b02fc 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -2865,7 +2865,8 @@ static void handle_stripe5(struct stripe_head *sh) | |||
2865 | md_done_sync(conf->mddev, STRIPE_SECTORS, 1); | 2865 | md_done_sync(conf->mddev, STRIPE_SECTORS, 1); |
2866 | } | 2866 | } |
2867 | 2867 | ||
2868 | if (s.expanding && s.locked == 0) | 2868 | if (s.expanding && s.locked == 0 && |
2869 | !test_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.pending)) | ||
2869 | handle_stripe_expansion(conf, sh, NULL); | 2870 | handle_stripe_expansion(conf, sh, NULL); |
2870 | 2871 | ||
2871 | if (sh->ops.count) | 2872 | if (sh->ops.count) |
@@ -3067,7 +3068,8 @@ static void handle_stripe6(struct stripe_head *sh, struct page *tmp_page) | |||
3067 | md_done_sync(conf->mddev, STRIPE_SECTORS, 1); | 3068 | md_done_sync(conf->mddev, STRIPE_SECTORS, 1); |
3068 | } | 3069 | } |
3069 | 3070 | ||
3070 | if (s.expanding && s.locked == 0) | 3071 | if (s.expanding && s.locked == 0 && |
3072 | !test_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.pending)) | ||
3071 | handle_stripe_expansion(conf, sh, &r6s); | 3073 | handle_stripe_expansion(conf, sh, &r6s); |
3072 | 3074 | ||
3073 | spin_unlock(&sh->lock); | 3075 | spin_unlock(&sh->lock); |
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 | ||
2803 | static struct saa7146_extension av7110_extension; | 2803 | static 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) \ |
2806 | static struct saa7146_pci_extension_data x_var = { \ | 2806 | static 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 | ||
2810 | MAKE_AV7110_INFO(tts_1_X_fsc,"Technotrend/Hauppauge WinTV DVB-S rev1.X or Fujitsu Siemens DVB-C"); | 2810 | MAKE_AV7110_INFO(tts_1_X_fsc,"Technotrend/Hauppauge WinTV DVB-S rev1.X or Fujitsu Siemens DVB-C"); |
2811 | MAKE_AV7110_INFO(ttt_1_X, "Technotrend/Hauppauge WinTV DVB-T rev1.X"); | 2811 | MAKE_AV7110_INFO(ttt_1_X, "Technotrend/Hauppauge WinTV DVB-T rev1.X"); |
@@ -2843,7 +2843,7 @@ static struct pci_device_id pci_tbl[] = { | |||
2843 | MODULE_DEVICE_TABLE(pci, pci_tbl); | 2843 | MODULE_DEVICE_TABLE(pci, pci_tbl); |
2844 | 2844 | ||
2845 | 2845 | ||
2846 | static struct saa7146_extension av7110_extension = { | 2846 | static 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 = { | |||
2860 | static int __init av7110_init(void) | 2860 | static 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 | ||
2868 | static void __exit av7110_exit(void) | 2868 | static void __exit av7110_exit(void) |
2869 | { | 2869 | { |
2870 | saa7146_unregister_extension(&av7110_extension); | 2870 | saa7146_unregister_extension(&av7110_extension_driver); |
2871 | } | 2871 | } |
2872 | 2872 | ||
2873 | module_init(av7110_init); | 2873 | module_init(av7110_init); |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index c02d92deacd2..581a3c955739 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -3063,11 +3063,10 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
3063 | struct video_mbuf *mbuf = arg; | 3063 | struct video_mbuf *mbuf = arg; |
3064 | unsigned int i; | 3064 | unsigned int i; |
3065 | 3065 | ||
3066 | mutex_lock(&fh->cap.lock); | ||
3067 | retval = videobuf_mmap_setup(&fh->cap,gbuffers,gbufsize, | 3066 | retval = videobuf_mmap_setup(&fh->cap,gbuffers,gbufsize, |
3068 | V4L2_MEMORY_MMAP); | 3067 | V4L2_MEMORY_MMAP); |
3069 | if (retval < 0) | 3068 | if (retval < 0) |
3070 | goto fh_unlock_and_return; | 3069 | return retval; |
3071 | 3070 | ||
3072 | gbuffers = retval; | 3071 | gbuffers = retval; |
3073 | memset(mbuf,0,sizeof(*mbuf)); | 3072 | memset(mbuf,0,sizeof(*mbuf)); |
@@ -3075,7 +3074,6 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
3075 | mbuf->size = gbuffers * gbufsize; | 3074 | mbuf->size = gbuffers * gbufsize; |
3076 | for (i = 0; i < gbuffers; i++) | 3075 | for (i = 0; i < gbuffers; i++) |
3077 | mbuf->offsets[i] = i * gbufsize; | 3076 | mbuf->offsets[i] = i * gbufsize; |
3078 | mutex_unlock(&fh->cap.lock); | ||
3079 | return 0; | 3077 | return 0; |
3080 | } | 3078 | } |
3081 | case VIDIOCMCAPTURE: | 3079 | case VIDIOCMCAPTURE: |
diff --git a/drivers/media/video/cx23885/Kconfig b/drivers/media/video/cx23885/Kconfig index d8b1ccb44913..081ee6e1536f 100644 --- a/drivers/media/video/cx23885/Kconfig +++ b/drivers/media/video/cx23885/Kconfig | |||
@@ -10,6 +10,7 @@ config VIDEO_CX23885 | |||
10 | select VIDEOBUF_DVB | 10 | select VIDEOBUF_DVB |
11 | select DVB_TUNER_MT2131 if !DVB_FE_CUSTOMISE | 11 | select DVB_TUNER_MT2131 if !DVB_FE_CUSTOMISE |
12 | select DVB_S5H1409 if !DVB_FE_CUSTOMISE | 12 | select DVB_S5H1409 if !DVB_FE_CUSTOMISE |
13 | select DVB_LGDT330X if !DVB_FE_CUSTOMISE | ||
13 | select DVB_PLL if !DVB_FE_CUSTOMISE | 14 | select DVB_PLL if !DVB_FE_CUSTOMISE |
14 | ---help--- | 15 | ---help--- |
15 | This is a video4linux driver for Conexant 23885 based | 16 | This is a video4linux driver for Conexant 23885 based |
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index 77b27dc750b1..36e54f78aa2a 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c | |||
@@ -541,7 +541,7 @@ static const struct i2c_algo_bit_data ivtv_i2c_algo_template = { | |||
541 | .setscl = ivtv_setscl_old, | 541 | .setscl = ivtv_setscl_old, |
542 | .getsda = ivtv_getsda_old, | 542 | .getsda = ivtv_getsda_old, |
543 | .getscl = ivtv_getscl_old, | 543 | .getscl = ivtv_getscl_old, |
544 | .udelay = 5, | 544 | .udelay = 10, |
545 | .timeout = 200, | 545 | .timeout = 200, |
546 | }; | 546 | }; |
547 | 547 | ||
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 | ||
1203 | static int saa7134_resume(struct pci_dev *pci_dev) | 1203 | static 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 { | |||
243 | enum Window3 { /* Window 3: MAC/config bits. */ | 243 | enum 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 | }; |
246 | union wn3_config { | 246 | enum 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 | ||
256 | enum Window4 { | 258 | enum 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..9af05a2f4af3 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 | ||
169 | config 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 | |||
179 | source "drivers/net/arcnet/Kconfig" | 169 | source "drivers/net/arcnet/Kconfig" |
180 | 170 | ||
181 | source "drivers/net/phy/Kconfig" | 171 | source "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 | ||
1982 | config 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 | |||
1995 | source "drivers/net/ixp2000/Kconfig" | 1992 | source "drivers/net/ixp2000/Kconfig" |
1996 | 1993 | ||
1997 | config MYRI_SBUS | 1994 | config MYRI_SBUS |
@@ -2468,9 +2465,6 @@ config IXGBE | |||
2468 | 2465 | ||
2469 | <http://support.intel.com> | 2466 | <http://support.intel.com> |
2470 | 2467 | ||
2471 | More specific information on configuring the driver is in | ||
2472 | <file:Documentation/networking/ixgbe.txt>. | ||
2473 | |||
2474 | To compile this driver as a module, choose M here. The module | 2468 | To compile this driver as a module, choose M here. The module |
2475 | will be called ixgbe. | 2469 | will be called ixgbe. |
2476 | 2470 | ||
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 | */ |
984 | static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1, | 984 | static 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 | */ |
1036 | static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *slave) | 1038 | static 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 | */ | ||
1546 | void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave) | 1553 | void 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 | */ |
4545 | int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl) | 4549 | int 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; | |||
4865 | int bond_create(char *name, struct bond_params *params, struct bonding **newbond) | 4876 | int 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: | |||
4920 | out_netdev: | 4946 | out_netdev: |
4921 | free_netdev(bond_dev); | 4947 | free_netdev(bond_dev); |
4922 | out_rtnl: | 4948 | out_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 | */ |
185 | out: | 176 | out: |
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 | ||
391 | out: | 380 | out: |
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 | } |
1111 | out: | 1105 | out: |
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 | } |
1249 | out: | 1244 | out: |
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 | |||
144 | struct vlan_entry { | 146 | struct 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 *); | |||
314 | void bond_loadbalance_arp_mon(struct work_struct *); | 316 | void bond_loadbalance_arp_mon(struct work_struct *); |
315 | void bond_activebackup_arp_mon(struct work_struct *); | 317 | void bond_activebackup_arp_mon(struct work_struct *); |
316 | void bond_set_mode_ops(struct bonding *bond, int mode); | 318 | void bond_set_mode_ops(struct bonding *bond, int mode); |
317 | int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl); | 319 | int bond_parse_parm(const char *mode_arg, struct bond_parm_tbl *tbl); |
318 | void bond_select_active_slave(struct bonding *bond); | 320 | void bond_select_active_slave(struct bonding *bond); |
319 | void bond_change_active_slave(struct bonding *bond, struct slave *new_active); | 321 | void bond_change_active_slave(struct bonding *bond, struct slave *new_active); |
320 | void bond_register_arp(struct bonding *); | 322 | void bond_register_arp(struct bonding *); |
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 7df31b5561cc..d66915d82b24 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c | |||
@@ -142,8 +142,8 @@ | |||
142 | 142 | ||
143 | #define DRV_MODULE_NAME "cassini" | 143 | #define DRV_MODULE_NAME "cassini" |
144 | #define PFX DRV_MODULE_NAME ": " | 144 | #define PFX DRV_MODULE_NAME ": " |
145 | #define DRV_MODULE_VERSION "1.4" | 145 | #define DRV_MODULE_VERSION "1.5" |
146 | #define DRV_MODULE_RELDATE "1 July 2004" | 146 | #define DRV_MODULE_RELDATE "4 Jan 2008" |
147 | 147 | ||
148 | #define CAS_DEF_MSG_ENABLE \ | 148 | #define CAS_DEF_MSG_ENABLE \ |
149 | (NETIF_MSG_DRV | \ | 149 | (NETIF_MSG_DRV | \ |
@@ -336,30 +336,6 @@ static inline void cas_mask_intr(struct cas *cp) | |||
336 | cas_disable_irq(cp, i); | 336 | cas_disable_irq(cp, i); |
337 | } | 337 | } |
338 | 338 | ||
339 | static inline void cas_buffer_init(cas_page_t *cp) | ||
340 | { | ||
341 | struct page *page = cp->buffer; | ||
342 | atomic_set((atomic_t *)&page->lru.next, 1); | ||
343 | } | ||
344 | |||
345 | static inline int cas_buffer_count(cas_page_t *cp) | ||
346 | { | ||
347 | struct page *page = cp->buffer; | ||
348 | return atomic_read((atomic_t *)&page->lru.next); | ||
349 | } | ||
350 | |||
351 | static inline void cas_buffer_inc(cas_page_t *cp) | ||
352 | { | ||
353 | struct page *page = cp->buffer; | ||
354 | atomic_inc((atomic_t *)&page->lru.next); | ||
355 | } | ||
356 | |||
357 | static inline void cas_buffer_dec(cas_page_t *cp) | ||
358 | { | ||
359 | struct page *page = cp->buffer; | ||
360 | atomic_dec((atomic_t *)&page->lru.next); | ||
361 | } | ||
362 | |||
363 | static void cas_enable_irq(struct cas *cp, const int ring) | 339 | static void cas_enable_irq(struct cas *cp, const int ring) |
364 | { | 340 | { |
365 | if (ring == 0) { /* all but TX_DONE */ | 341 | if (ring == 0) { /* all but TX_DONE */ |
@@ -497,7 +473,6 @@ static int cas_page_free(struct cas *cp, cas_page_t *page) | |||
497 | { | 473 | { |
498 | pci_unmap_page(cp->pdev, page->dma_addr, cp->page_size, | 474 | pci_unmap_page(cp->pdev, page->dma_addr, cp->page_size, |
499 | PCI_DMA_FROMDEVICE); | 475 | PCI_DMA_FROMDEVICE); |
500 | cas_buffer_dec(page); | ||
501 | __free_pages(page->buffer, cp->page_order); | 476 | __free_pages(page->buffer, cp->page_order); |
502 | kfree(page); | 477 | kfree(page); |
503 | return 0; | 478 | return 0; |
@@ -527,7 +502,6 @@ static cas_page_t *cas_page_alloc(struct cas *cp, const gfp_t flags) | |||
527 | page->buffer = alloc_pages(flags, cp->page_order); | 502 | page->buffer = alloc_pages(flags, cp->page_order); |
528 | if (!page->buffer) | 503 | if (!page->buffer) |
529 | goto page_err; | 504 | goto page_err; |
530 | cas_buffer_init(page); | ||
531 | page->dma_addr = pci_map_page(cp->pdev, page->buffer, 0, | 505 | page->dma_addr = pci_map_page(cp->pdev, page->buffer, 0, |
532 | cp->page_size, PCI_DMA_FROMDEVICE); | 506 | cp->page_size, PCI_DMA_FROMDEVICE); |
533 | return page; | 507 | return page; |
@@ -606,7 +580,7 @@ static void cas_spare_recover(struct cas *cp, const gfp_t flags) | |||
606 | list_for_each_safe(elem, tmp, &list) { | 580 | list_for_each_safe(elem, tmp, &list) { |
607 | cas_page_t *page = list_entry(elem, cas_page_t, list); | 581 | cas_page_t *page = list_entry(elem, cas_page_t, list); |
608 | 582 | ||
609 | if (cas_buffer_count(page) > 1) | 583 | if (page_count(page->buffer) > 1) |
610 | continue; | 584 | continue; |
611 | 585 | ||
612 | list_del(elem); | 586 | list_del(elem); |
@@ -1374,7 +1348,7 @@ static inline cas_page_t *cas_page_spare(struct cas *cp, const int index) | |||
1374 | cas_page_t *page = cp->rx_pages[1][index]; | 1348 | cas_page_t *page = cp->rx_pages[1][index]; |
1375 | cas_page_t *new; | 1349 | cas_page_t *new; |
1376 | 1350 | ||
1377 | if (cas_buffer_count(page) == 1) | 1351 | if (page_count(page->buffer) == 1) |
1378 | return page; | 1352 | return page; |
1379 | 1353 | ||
1380 | new = cas_page_dequeue(cp); | 1354 | new = cas_page_dequeue(cp); |
@@ -1394,7 +1368,7 @@ static cas_page_t *cas_page_swap(struct cas *cp, const int ring, | |||
1394 | cas_page_t **page1 = cp->rx_pages[1]; | 1368 | cas_page_t **page1 = cp->rx_pages[1]; |
1395 | 1369 | ||
1396 | /* swap if buffer is in use */ | 1370 | /* swap if buffer is in use */ |
1397 | if (cas_buffer_count(page0[index]) > 1) { | 1371 | if (page_count(page0[index]->buffer) > 1) { |
1398 | cas_page_t *new = cas_page_spare(cp, index); | 1372 | cas_page_t *new = cas_page_spare(cp, index); |
1399 | if (new) { | 1373 | if (new) { |
1400 | page1[index] = page0[index]; | 1374 | page1[index] = page0[index]; |
@@ -1979,6 +1953,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, | |||
1979 | struct cas_page *page; | 1953 | struct cas_page *page; |
1980 | struct sk_buff *skb; | 1954 | struct sk_buff *skb; |
1981 | void *addr, *crcaddr; | 1955 | void *addr, *crcaddr; |
1956 | __sum16 csum; | ||
1982 | char *p; | 1957 | char *p; |
1983 | 1958 | ||
1984 | hlen = CAS_VAL(RX_COMP2_HDR_SIZE, words[1]); | 1959 | hlen = CAS_VAL(RX_COMP2_HDR_SIZE, words[1]); |
@@ -2062,10 +2037,10 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, | |||
2062 | 2037 | ||
2063 | skb_shinfo(skb)->nr_frags++; | 2038 | skb_shinfo(skb)->nr_frags++; |
2064 | skb->data_len += hlen - swivel; | 2039 | skb->data_len += hlen - swivel; |
2040 | skb->truesize += hlen - swivel; | ||
2065 | skb->len += hlen - swivel; | 2041 | skb->len += hlen - swivel; |
2066 | 2042 | ||
2067 | get_page(page->buffer); | 2043 | get_page(page->buffer); |
2068 | cas_buffer_inc(page); | ||
2069 | frag->page = page->buffer; | 2044 | frag->page = page->buffer; |
2070 | frag->page_offset = off; | 2045 | frag->page_offset = off; |
2071 | frag->size = hlen - swivel; | 2046 | frag->size = hlen - swivel; |
@@ -2090,7 +2065,6 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc, | |||
2090 | frag++; | 2065 | frag++; |
2091 | 2066 | ||
2092 | get_page(page->buffer); | 2067 | get_page(page->buffer); |
2093 | cas_buffer_inc(page); | ||
2094 | frag->page = page->buffer; | 2068 | frag->page = page->buffer; |
2095 | frag->page_offset = 0; | 2069 | frag->page_offset = 0; |
2096 | frag->size = hlen; | 2070 | frag->size = hlen; |
@@ -2158,14 +2132,15 @@ end_copy_pkt: | |||
2158 | skb_put(skb, alloclen); | 2132 | skb_put(skb, alloclen); |
2159 | } | 2133 | } |
2160 | 2134 | ||
2161 | i = CAS_VAL(RX_COMP4_TCP_CSUM, words[3]); | 2135 | csum = (__force __sum16)htons(CAS_VAL(RX_COMP4_TCP_CSUM, words[3])); |
2162 | if (cp->crc_size) { | 2136 | if (cp->crc_size) { |
2163 | /* checksum includes FCS. strip it out. */ | 2137 | /* checksum includes FCS. strip it out. */ |
2164 | i = csum_fold(csum_partial(crcaddr, cp->crc_size, i)); | 2138 | csum = csum_fold(csum_partial(crcaddr, cp->crc_size, |
2139 | csum_unfold(csum))); | ||
2165 | if (addr) | 2140 | if (addr) |
2166 | cas_page_unmap(addr); | 2141 | cas_page_unmap(addr); |
2167 | } | 2142 | } |
2168 | skb->csum = ntohs(i ^ 0xffff); | 2143 | skb->csum = csum_unfold(~csum); |
2169 | skb->ip_summed = CHECKSUM_COMPLETE; | 2144 | skb->ip_summed = CHECKSUM_COMPLETE; |
2170 | skb->protocol = eth_type_trans(skb, cp->dev); | 2145 | skb->protocol = eth_type_trans(skb, cp->dev); |
2171 | return len; | 2146 | return len; |
@@ -2253,7 +2228,7 @@ static int cas_post_rxds_ringN(struct cas *cp, int ring, int num) | |||
2253 | released = 0; | 2228 | released = 0; |
2254 | while (entry != last) { | 2229 | while (entry != last) { |
2255 | /* make a new buffer if it's still in use */ | 2230 | /* make a new buffer if it's still in use */ |
2256 | if (cas_buffer_count(page[entry]) > 1) { | 2231 | if (page_count(page[entry]->buffer) > 1) { |
2257 | cas_page_t *new = cas_page_dequeue(cp); | 2232 | cas_page_t *new = cas_page_dequeue(cp); |
2258 | if (!new) { | 2233 | if (!new) { |
2259 | /* let the timer know that we need to | 2234 | /* let the timer know that we need to |
@@ -2611,7 +2586,7 @@ static int cas_poll(struct napi_struct *napi, int budget) | |||
2611 | { | 2586 | { |
2612 | struct cas *cp = container_of(napi, struct cas, napi); | 2587 | struct cas *cp = container_of(napi, struct cas, napi); |
2613 | struct net_device *dev = cp->dev; | 2588 | struct net_device *dev = cp->dev; |
2614 | int i, enable_intr, todo, credits; | 2589 | int i, enable_intr, credits; |
2615 | u32 status = readl(cp->regs + REG_INTR_STATUS); | 2590 | u32 status = readl(cp->regs + REG_INTR_STATUS); |
2616 | unsigned long flags; | 2591 | unsigned long flags; |
2617 | 2592 | ||
@@ -4375,7 +4350,7 @@ static int cas_close(struct net_device *dev) | |||
4375 | struct cas *cp = netdev_priv(dev); | 4350 | struct cas *cp = netdev_priv(dev); |
4376 | 4351 | ||
4377 | #ifdef USE_NAPI | 4352 | #ifdef USE_NAPI |
4378 | napi_enable(&cp->napi); | 4353 | napi_disable(&cp->napi); |
4379 | #endif | 4354 | #endif |
4380 | /* Make sure we don't get distracted by suspend/resume */ | 4355 | /* Make sure we don't get distracted by suspend/resume */ |
4381 | mutex_lock(&cp->pm_mutex); | 4356 | mutex_lock(&cp->pm_mutex); |
@@ -4872,6 +4847,90 @@ static int cas_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
4872 | return rc; | 4847 | return rc; |
4873 | } | 4848 | } |
4874 | 4849 | ||
4850 | /* When this chip sits underneath an Intel 31154 bridge, it is the | ||
4851 | * only subordinate device and we can tweak the bridge settings to | ||
4852 | * reflect that fact. | ||
4853 | */ | ||
4854 | static void __devinit cas_program_bridge(struct pci_dev *cas_pdev) | ||
4855 | { | ||
4856 | struct pci_dev *pdev = cas_pdev->bus->self; | ||
4857 | u32 val; | ||
4858 | |||
4859 | if (!pdev) | ||
4860 | return; | ||
4861 | |||
4862 | if (pdev->vendor != 0x8086 || pdev->device != 0x537c) | ||
4863 | return; | ||
4864 | |||
4865 | /* Clear bit 10 (Bus Parking Control) in the Secondary | ||
4866 | * Arbiter Control/Status Register which lives at offset | ||
4867 | * 0x41. Using a 32-bit word read/modify/write at 0x40 | ||
4868 | * is much simpler so that's how we do this. | ||
4869 | */ | ||
4870 | pci_read_config_dword(pdev, 0x40, &val); | ||
4871 | val &= ~0x00040000; | ||
4872 | pci_write_config_dword(pdev, 0x40, val); | ||
4873 | |||
4874 | /* Max out the Multi-Transaction Timer settings since | ||
4875 | * Cassini is the only device present. | ||
4876 | * | ||
4877 | * The register is 16-bit and lives at 0x50. When the | ||
4878 | * settings are enabled, it extends the GRANT# signal | ||
4879 | * for a requestor after a transaction is complete. This | ||
4880 | * allows the next request to run without first needing | ||
4881 | * to negotiate the GRANT# signal back. | ||
4882 | * | ||
4883 | * Bits 12:10 define the grant duration: | ||
4884 | * | ||
4885 | * 1 -- 16 clocks | ||
4886 | * 2 -- 32 clocks | ||
4887 | * 3 -- 64 clocks | ||
4888 | * 4 -- 128 clocks | ||
4889 | * 5 -- 256 clocks | ||
4890 | * | ||
4891 | * All other values are illegal. | ||
4892 | * | ||
4893 | * Bits 09:00 define which REQ/GNT signal pairs get the | ||
4894 | * GRANT# signal treatment. We set them all. | ||
4895 | */ | ||
4896 | pci_write_config_word(pdev, 0x50, (5 << 10) | 0x3ff); | ||
4897 | |||
4898 | /* The Read Prefecth Policy register is 16-bit and sits at | ||
4899 | * offset 0x52. It enables a "smart" pre-fetch policy. We | ||
4900 | * enable it and max out all of the settings since only one | ||
4901 | * device is sitting underneath and thus bandwidth sharing is | ||
4902 | * not an issue. | ||
4903 | * | ||
4904 | * The register has several 3 bit fields, which indicates a | ||
4905 | * multiplier applied to the base amount of prefetching the | ||
4906 | * chip would do. These fields are at: | ||
4907 | * | ||
4908 | * 15:13 --- ReRead Primary Bus | ||
4909 | * 12:10 --- FirstRead Primary Bus | ||
4910 | * 09:07 --- ReRead Secondary Bus | ||
4911 | * 06:04 --- FirstRead Secondary Bus | ||
4912 | * | ||
4913 | * Bits 03:00 control which REQ/GNT pairs the prefetch settings | ||
4914 | * get enabled on. Bit 3 is a grouped enabler which controls | ||
4915 | * all of the REQ/GNT pairs from [8:3]. Bits 2 to 0 control | ||
4916 | * the individual REQ/GNT pairs [2:0]. | ||
4917 | */ | ||
4918 | pci_write_config_word(pdev, 0x52, | ||
4919 | (0x7 << 13) | | ||
4920 | (0x7 << 10) | | ||
4921 | (0x7 << 7) | | ||
4922 | (0x7 << 4) | | ||
4923 | (0xf << 0)); | ||
4924 | |||
4925 | /* Force cacheline size to 0x8 */ | ||
4926 | pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, 0x08); | ||
4927 | |||
4928 | /* Force latency timer to maximum setting so Cassini can | ||
4929 | * sit on the bus as long as it likes. | ||
4930 | */ | ||
4931 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xff); | ||
4932 | } | ||
4933 | |||
4875 | static int __devinit cas_init_one(struct pci_dev *pdev, | 4934 | static int __devinit cas_init_one(struct pci_dev *pdev, |
4876 | const struct pci_device_id *ent) | 4935 | const struct pci_device_id *ent) |
4877 | { | 4936 | { |
@@ -4927,6 +4986,8 @@ static int __devinit cas_init_one(struct pci_dev *pdev, | |||
4927 | printk(KERN_WARNING PFX "Could not enable MWI for %s\n", | 4986 | printk(KERN_WARNING PFX "Could not enable MWI for %s\n", |
4928 | pci_name(pdev)); | 4987 | pci_name(pdev)); |
4929 | 4988 | ||
4989 | cas_program_bridge(pdev); | ||
4990 | |||
4930 | /* | 4991 | /* |
4931 | * On some architectures, the default cache line size set | 4992 | * On some architectures, the default cache line size set |
4932 | * by pci_try_set_mwi reduces perforamnce. We have to increase | 4993 | * by pci_try_set_mwi reduces perforamnce. We have to increase |
diff --git a/drivers/net/cassini.h b/drivers/net/cassini.h index 2f93f83342d2..552af89ca1cf 100644 --- a/drivers/net/cassini.h +++ b/drivers/net/cassini.h | |||
@@ -4122,8 +4122,8 @@ cas_saturn_patch_t cas_saturn_patch[] = { | |||
4122 | inserted into | 4122 | inserted into |
4123 | outgoing frame. */ | 4123 | outgoing frame. */ |
4124 | struct cas_tx_desc { | 4124 | struct cas_tx_desc { |
4125 | u64 control; | 4125 | __le64 control; |
4126 | u64 buffer; | 4126 | __le64 buffer; |
4127 | }; | 4127 | }; |
4128 | 4128 | ||
4129 | /* descriptor ring for free buffers contains page-sized buffers. the index | 4129 | /* descriptor ring for free buffers contains page-sized buffers. the index |
@@ -4131,8 +4131,8 @@ struct cas_tx_desc { | |||
4131 | * the completion ring. | 4131 | * the completion ring. |
4132 | */ | 4132 | */ |
4133 | struct cas_rx_desc { | 4133 | struct cas_rx_desc { |
4134 | u64 index; | 4134 | __le64 index; |
4135 | u64 buffer; | 4135 | __le64 buffer; |
4136 | }; | 4136 | }; |
4137 | 4137 | ||
4138 | /* received packets are put on the completion ring. */ | 4138 | /* received packets are put on the completion ring. */ |
@@ -4210,10 +4210,10 @@ struct cas_rx_desc { | |||
4210 | #define RX_INDEX_RELEASE 0x0000000000002000ULL | 4210 | #define RX_INDEX_RELEASE 0x0000000000002000ULL |
4211 | 4211 | ||
4212 | struct cas_rx_comp { | 4212 | struct cas_rx_comp { |
4213 | u64 word1; | 4213 | __le64 word1; |
4214 | u64 word2; | 4214 | __le64 word2; |
4215 | u64 word3; | 4215 | __le64 word3; |
4216 | u64 word4; | 4216 | __le64 word4; |
4217 | }; | 4217 | }; |
4218 | 4218 | ||
4219 | enum link_state { | 4219 | enum link_state { |
@@ -4252,7 +4252,7 @@ struct cas_init_block { | |||
4252 | struct cas_rx_comp rxcs[N_RX_COMP_RINGS][INIT_BLOCK_RX_COMP]; | 4252 | struct cas_rx_comp rxcs[N_RX_COMP_RINGS][INIT_BLOCK_RX_COMP]; |
4253 | struct cas_rx_desc rxds[N_RX_DESC_RINGS][INIT_BLOCK_RX_DESC]; | 4253 | struct cas_rx_desc rxds[N_RX_DESC_RINGS][INIT_BLOCK_RX_DESC]; |
4254 | struct cas_tx_desc txds[N_TX_RINGS][INIT_BLOCK_TX]; | 4254 | struct cas_tx_desc txds[N_TX_RINGS][INIT_BLOCK_TX]; |
4255 | u64 tx_compwb; | 4255 | __le64 tx_compwb; |
4256 | }; | 4256 | }; |
4257 | 4257 | ||
4258 | /* tiny buffers to deal with target abort issue. we allocate a bit | 4258 | /* tiny buffers to deal with target abort issue. we allocate a bit |
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 5066beb2e7bc..e233d04a2132 100644 --- a/drivers/net/dl2k.c +++ b/drivers/net/dl2k.c | |||
@@ -332,7 +332,7 @@ parse_eeprom (struct net_device *dev) | |||
332 | #endif | 332 | #endif |
333 | /* Read eeprom */ | 333 | /* Read eeprom */ |
334 | for (i = 0; i < 128; i++) { | 334 | for (i = 0; i < 128; i++) { |
335 | ((u16 *) sromdata)[i] = le16_to_cpu (read_eeprom (ioaddr, i)); | 335 | ((__le16 *) sromdata)[i] = cpu_to_le16(read_eeprom (ioaddr, i)); |
336 | } | 336 | } |
337 | #ifdef MEM_MAPPING | 337 | #ifdef MEM_MAPPING |
338 | ioaddr = dev->base_addr; | 338 | ioaddr = dev->base_addr; |
@@ -516,7 +516,7 @@ rio_timer (unsigned long data) | |||
516 | PCI_DMA_FROMDEVICE)); | 516 | PCI_DMA_FROMDEVICE)); |
517 | } | 517 | } |
518 | np->rx_ring[entry].fraginfo |= | 518 | np->rx_ring[entry].fraginfo |= |
519 | cpu_to_le64 (np->rx_buf_sz) << 48; | 519 | cpu_to_le64((u64)np->rx_buf_sz << 48); |
520 | np->rx_ring[entry].status = 0; | 520 | np->rx_ring[entry].status = 0; |
521 | } /* end for */ | 521 | } /* end for */ |
522 | } /* end if */ | 522 | } /* end if */ |
@@ -584,11 +584,11 @@ alloc_list (struct net_device *dev) | |||
584 | cpu_to_le64 ( pci_map_single ( | 584 | cpu_to_le64 ( pci_map_single ( |
585 | np->pdev, skb->data, np->rx_buf_sz, | 585 | np->pdev, skb->data, np->rx_buf_sz, |
586 | PCI_DMA_FROMDEVICE)); | 586 | PCI_DMA_FROMDEVICE)); |
587 | np->rx_ring[i].fraginfo |= cpu_to_le64 (np->rx_buf_sz) << 48; | 587 | np->rx_ring[i].fraginfo |= cpu_to_le64((u64)np->rx_buf_sz << 48); |
588 | } | 588 | } |
589 | 589 | ||
590 | /* Set RFDListPtr */ | 590 | /* Set RFDListPtr */ |
591 | writel (cpu_to_le32 (np->rx_ring_dma), dev->base_addr + RFDListPtr0); | 591 | writel (np->rx_ring_dma, dev->base_addr + RFDListPtr0); |
592 | writel (0, dev->base_addr + RFDListPtr1); | 592 | writel (0, dev->base_addr + RFDListPtr1); |
593 | 593 | ||
594 | return; | 594 | return; |
@@ -620,15 +620,14 @@ start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
620 | } | 620 | } |
621 | #endif | 621 | #endif |
622 | if (np->vlan) { | 622 | if (np->vlan) { |
623 | tfc_vlan_tag = | 623 | tfc_vlan_tag = VLANTagInsert | |
624 | cpu_to_le64 (VLANTagInsert) | | 624 | ((u64)np->vlan << 32) | |
625 | (cpu_to_le64 (np->vlan) << 32) | | 625 | ((u64)skb->priority << 45); |
626 | (cpu_to_le64 (skb->priority) << 45); | ||
627 | } | 626 | } |
628 | txdesc->fraginfo = cpu_to_le64 (pci_map_single (np->pdev, skb->data, | 627 | txdesc->fraginfo = cpu_to_le64 (pci_map_single (np->pdev, skb->data, |
629 | skb->len, | 628 | skb->len, |
630 | PCI_DMA_TODEVICE)); | 629 | PCI_DMA_TODEVICE)); |
631 | txdesc->fraginfo |= cpu_to_le64 (skb->len) << 48; | 630 | txdesc->fraginfo |= cpu_to_le64((u64)skb->len << 48); |
632 | 631 | ||
633 | /* DL2K bug: DMA fails to get next descriptor ptr in 10Mbps mode | 632 | /* DL2K bug: DMA fails to get next descriptor ptr in 10Mbps mode |
634 | * Work around: Always use 1 descriptor in 10Mbps mode */ | 633 | * Work around: Always use 1 descriptor in 10Mbps mode */ |
@@ -708,6 +707,11 @@ rio_interrupt (int irq, void *dev_instance) | |||
708 | return IRQ_RETVAL(handled); | 707 | return IRQ_RETVAL(handled); |
709 | } | 708 | } |
710 | 709 | ||
710 | static inline dma_addr_t desc_to_dma(struct netdev_desc *desc) | ||
711 | { | ||
712 | return le64_to_cpu(desc->fraginfo) & DMA_48BIT_MASK; | ||
713 | } | ||
714 | |||
711 | static void | 715 | static void |
712 | rio_free_tx (struct net_device *dev, int irq) | 716 | rio_free_tx (struct net_device *dev, int irq) |
713 | { | 717 | { |
@@ -725,11 +729,11 @@ rio_free_tx (struct net_device *dev, int irq) | |||
725 | while (entry != np->cur_tx) { | 729 | while (entry != np->cur_tx) { |
726 | struct sk_buff *skb; | 730 | struct sk_buff *skb; |
727 | 731 | ||
728 | if (!(np->tx_ring[entry].status & TFDDone)) | 732 | if (!(np->tx_ring[entry].status & cpu_to_le64(TFDDone))) |
729 | break; | 733 | break; |
730 | skb = np->tx_skbuff[entry]; | 734 | skb = np->tx_skbuff[entry]; |
731 | pci_unmap_single (np->pdev, | 735 | pci_unmap_single (np->pdev, |
732 | np->tx_ring[entry].fraginfo & DMA_48BIT_MASK, | 736 | desc_to_dma(&np->tx_ring[entry]), |
733 | skb->len, PCI_DMA_TODEVICE); | 737 | skb->len, PCI_DMA_TODEVICE); |
734 | if (irq) | 738 | if (irq) |
735 | dev_kfree_skb_irq (skb); | 739 | dev_kfree_skb_irq (skb); |
@@ -831,13 +835,14 @@ receive_packet (struct net_device *dev) | |||
831 | int pkt_len; | 835 | int pkt_len; |
832 | u64 frame_status; | 836 | u64 frame_status; |
833 | 837 | ||
834 | if (!(desc->status & RFDDone) || | 838 | if (!(desc->status & cpu_to_le64(RFDDone)) || |
835 | !(desc->status & FrameStart) || !(desc->status & FrameEnd)) | 839 | !(desc->status & cpu_to_le64(FrameStart)) || |
840 | !(desc->status & cpu_to_le64(FrameEnd))) | ||
836 | break; | 841 | break; |
837 | 842 | ||
838 | /* Chip omits the CRC. */ | 843 | /* Chip omits the CRC. */ |
839 | pkt_len = le64_to_cpu (desc->status & 0xffff); | 844 | frame_status = le64_to_cpu(desc->status); |
840 | frame_status = le64_to_cpu (desc->status); | 845 | pkt_len = frame_status & 0xffff; |
841 | if (--cnt < 0) | 846 | if (--cnt < 0) |
842 | break; | 847 | break; |
843 | /* Update rx error statistics, drop packet. */ | 848 | /* Update rx error statistics, drop packet. */ |
@@ -857,15 +862,14 @@ receive_packet (struct net_device *dev) | |||
857 | /* Small skbuffs for short packets */ | 862 | /* Small skbuffs for short packets */ |
858 | if (pkt_len > copy_thresh) { | 863 | if (pkt_len > copy_thresh) { |
859 | pci_unmap_single (np->pdev, | 864 | pci_unmap_single (np->pdev, |
860 | desc->fraginfo & DMA_48BIT_MASK, | 865 | desc_to_dma(desc), |
861 | np->rx_buf_sz, | 866 | np->rx_buf_sz, |
862 | PCI_DMA_FROMDEVICE); | 867 | PCI_DMA_FROMDEVICE); |
863 | skb_put (skb = np->rx_skbuff[entry], pkt_len); | 868 | skb_put (skb = np->rx_skbuff[entry], pkt_len); |
864 | np->rx_skbuff[entry] = NULL; | 869 | np->rx_skbuff[entry] = NULL; |
865 | } else if ((skb = dev_alloc_skb (pkt_len + 2)) != NULL) { | 870 | } else if ((skb = dev_alloc_skb (pkt_len + 2)) != NULL) { |
866 | pci_dma_sync_single_for_cpu(np->pdev, | 871 | pci_dma_sync_single_for_cpu(np->pdev, |
867 | desc->fraginfo & | 872 | desc_to_dma(desc), |
868 | DMA_48BIT_MASK, | ||
869 | np->rx_buf_sz, | 873 | np->rx_buf_sz, |
870 | PCI_DMA_FROMDEVICE); | 874 | PCI_DMA_FROMDEVICE); |
871 | /* 16 byte align the IP header */ | 875 | /* 16 byte align the IP header */ |
@@ -875,8 +879,7 @@ receive_packet (struct net_device *dev) | |||
875 | pkt_len); | 879 | pkt_len); |
876 | skb_put (skb, pkt_len); | 880 | skb_put (skb, pkt_len); |
877 | pci_dma_sync_single_for_device(np->pdev, | 881 | pci_dma_sync_single_for_device(np->pdev, |
878 | desc->fraginfo & | 882 | desc_to_dma(desc), |
879 | DMA_48BIT_MASK, | ||
880 | np->rx_buf_sz, | 883 | np->rx_buf_sz, |
881 | PCI_DMA_FROMDEVICE); | 884 | PCI_DMA_FROMDEVICE); |
882 | } | 885 | } |
@@ -919,7 +922,7 @@ receive_packet (struct net_device *dev) | |||
919 | PCI_DMA_FROMDEVICE)); | 922 | PCI_DMA_FROMDEVICE)); |
920 | } | 923 | } |
921 | np->rx_ring[entry].fraginfo |= | 924 | np->rx_ring[entry].fraginfo |= |
922 | cpu_to_le64 (np->rx_buf_sz) << 48; | 925 | cpu_to_le64((u64)np->rx_buf_sz << 48); |
923 | np->rx_ring[entry].status = 0; | 926 | np->rx_ring[entry].status = 0; |
924 | entry = (entry + 1) % RX_RING_SIZE; | 927 | entry = (entry + 1) % RX_RING_SIZE; |
925 | } | 928 | } |
@@ -1121,7 +1124,7 @@ set_multicast (struct net_device *dev) | |||
1121 | 1124 | ||
1122 | hash_table[0] = hash_table[1] = 0; | 1125 | hash_table[0] = hash_table[1] = 0; |
1123 | /* RxFlowcontrol DA: 01-80-C2-00-00-01. Hash index=0x39 */ | 1126 | /* RxFlowcontrol DA: 01-80-C2-00-00-01. Hash index=0x39 */ |
1124 | hash_table[1] |= cpu_to_le32(0x02000000); | 1127 | hash_table[1] |= 0x02000000; |
1125 | if (dev->flags & IFF_PROMISC) { | 1128 | if (dev->flags & IFF_PROMISC) { |
1126 | /* Receive all frames promiscuously. */ | 1129 | /* Receive all frames promiscuously. */ |
1127 | rx_mode = ReceiveAllFrames; | 1130 | rx_mode = ReceiveAllFrames; |
@@ -1313,9 +1316,10 @@ rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) | |||
1313 | ("%02x:cur:%08x next:%08x status:%08x frag1:%08x frag0:%08x", | 1316 | ("%02x:cur:%08x next:%08x status:%08x frag1:%08x frag0:%08x", |
1314 | i, | 1317 | i, |
1315 | (u32) (np->tx_ring_dma + i * sizeof (*desc)), | 1318 | (u32) (np->tx_ring_dma + i * sizeof (*desc)), |
1316 | (u32) desc->next_desc, | 1319 | (u32)le64_to_cpu(desc->next_desc), |
1317 | (u32) desc->status, (u32) (desc->fraginfo >> 32), | 1320 | (u32)le64_to_cpu(desc->status), |
1318 | (u32) desc->fraginfo); | 1321 | (u32)(le64_to_cpu(desc->fraginfo) >> 32), |
1322 | (u32)le64_to_cpu(desc->fraginfo)); | ||
1319 | printk ("\n"); | 1323 | printk ("\n"); |
1320 | } | 1324 | } |
1321 | printk ("\n"); | 1325 | printk ("\n"); |
@@ -1432,7 +1436,7 @@ mii_write (struct net_device *dev, int phy_addr, int reg_num, u16 data) | |||
1432 | static int | 1436 | static int |
1433 | mii_wait_link (struct net_device *dev, int wait) | 1437 | mii_wait_link (struct net_device *dev, int wait) |
1434 | { | 1438 | { |
1435 | BMSR_t bmsr; | 1439 | __u16 bmsr; |
1436 | int phy_addr; | 1440 | int phy_addr; |
1437 | struct netdev_private *np; | 1441 | struct netdev_private *np; |
1438 | 1442 | ||
@@ -1440,8 +1444,8 @@ mii_wait_link (struct net_device *dev, int wait) | |||
1440 | phy_addr = np->phy_addr; | 1444 | phy_addr = np->phy_addr; |
1441 | 1445 | ||
1442 | do { | 1446 | do { |
1443 | bmsr.image = mii_read (dev, phy_addr, MII_BMSR); | 1447 | bmsr = mii_read (dev, phy_addr, MII_BMSR); |
1444 | if (bmsr.bits.link_status) | 1448 | if (bmsr & MII_BMSR_LINK_STATUS) |
1445 | return 0; | 1449 | return 0; |
1446 | mdelay (1); | 1450 | mdelay (1); |
1447 | } while (--wait > 0); | 1451 | } while (--wait > 0); |
@@ -1450,70 +1454,72 @@ mii_wait_link (struct net_device *dev, int wait) | |||
1450 | static int | 1454 | static int |
1451 | mii_get_media (struct net_device *dev) | 1455 | mii_get_media (struct net_device *dev) |
1452 | { | 1456 | { |
1453 | ANAR_t negotiate; | 1457 | __u16 negotiate; |
1454 | BMSR_t bmsr; | 1458 | __u16 bmsr; |
1455 | BMCR_t bmcr; | 1459 | __u16 mscr; |
1456 | MSCR_t mscr; | 1460 | __u16 mssr; |
1457 | MSSR_t mssr; | ||
1458 | int phy_addr; | 1461 | int phy_addr; |
1459 | struct netdev_private *np; | 1462 | struct netdev_private *np; |
1460 | 1463 | ||
1461 | np = netdev_priv(dev); | 1464 | np = netdev_priv(dev); |
1462 | phy_addr = np->phy_addr; | 1465 | phy_addr = np->phy_addr; |
1463 | 1466 | ||
1464 | bmsr.image = mii_read (dev, phy_addr, MII_BMSR); | 1467 | bmsr = mii_read (dev, phy_addr, MII_BMSR); |
1465 | if (np->an_enable) { | 1468 | if (np->an_enable) { |
1466 | if (!bmsr.bits.an_complete) { | 1469 | if (!(bmsr & MII_BMSR_AN_COMPLETE)) { |
1467 | /* Auto-Negotiation not completed */ | 1470 | /* Auto-Negotiation not completed */ |
1468 | return -1; | 1471 | return -1; |
1469 | } | 1472 | } |
1470 | negotiate.image = mii_read (dev, phy_addr, MII_ANAR) & | 1473 | negotiate = mii_read (dev, phy_addr, MII_ANAR) & |
1471 | mii_read (dev, phy_addr, MII_ANLPAR); | 1474 | mii_read (dev, phy_addr, MII_ANLPAR); |
1472 | mscr.image = mii_read (dev, phy_addr, MII_MSCR); | 1475 | mscr = mii_read (dev, phy_addr, MII_MSCR); |
1473 | mssr.image = mii_read (dev, phy_addr, MII_MSSR); | 1476 | mssr = mii_read (dev, phy_addr, MII_MSSR); |
1474 | if (mscr.bits.media_1000BT_FD & mssr.bits.lp_1000BT_FD) { | 1477 | if (mscr & MII_MSCR_1000BT_FD && mssr & MII_MSSR_LP_1000BT_FD) { |
1475 | np->speed = 1000; | 1478 | np->speed = 1000; |
1476 | np->full_duplex = 1; | 1479 | np->full_duplex = 1; |
1477 | printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n"); | 1480 | printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n"); |
1478 | } 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) { |
1479 | np->speed = 1000; | 1482 | np->speed = 1000; |
1480 | np->full_duplex = 0; | 1483 | np->full_duplex = 0; |
1481 | printk (KERN_INFO "Auto 1000 Mbps, Half duplex\n"); | 1484 | printk (KERN_INFO "Auto 1000 Mbps, Half duplex\n"); |
1482 | } else if (negotiate.bits.media_100BX_FD) { | 1485 | } else if (negotiate & MII_ANAR_100BX_FD) { |
1483 | np->speed = 100; | 1486 | np->speed = 100; |
1484 | np->full_duplex = 1; | 1487 | np->full_duplex = 1; |
1485 | printk (KERN_INFO "Auto 100 Mbps, Full duplex\n"); | 1488 | printk (KERN_INFO "Auto 100 Mbps, Full duplex\n"); |
1486 | } else if (negotiate.bits.media_100BX_HD) { | 1489 | } else if (negotiate & MII_ANAR_100BX_HD) { |
1487 | np->speed = 100; | 1490 | np->speed = 100; |
1488 | np->full_duplex = 0; | 1491 | np->full_duplex = 0; |
1489 | printk (KERN_INFO "Auto 100 Mbps, Half duplex\n"); | 1492 | printk (KERN_INFO "Auto 100 Mbps, Half duplex\n"); |
1490 | } else if (negotiate.bits.media_10BT_FD) { | 1493 | } else if (negotiate & MII_ANAR_10BT_FD) { |
1491 | np->speed = 10; | 1494 | np->speed = 10; |
1492 | np->full_duplex = 1; | 1495 | np->full_duplex = 1; |
1493 | printk (KERN_INFO "Auto 10 Mbps, Full duplex\n"); | 1496 | printk (KERN_INFO "Auto 10 Mbps, Full duplex\n"); |
1494 | } else if (negotiate.bits.media_10BT_HD) { | 1497 | } else if (negotiate & MII_ANAR_10BT_HD) { |
1495 | np->speed = 10; | 1498 | np->speed = 10; |
1496 | np->full_duplex = 0; | 1499 | np->full_duplex = 0; |
1497 | printk (KERN_INFO "Auto 10 Mbps, Half duplex\n"); | 1500 | printk (KERN_INFO "Auto 10 Mbps, Half duplex\n"); |
1498 | } | 1501 | } |
1499 | if (negotiate.bits.pause) { | 1502 | if (negotiate & MII_ANAR_PAUSE) { |
1500 | np->tx_flow &= 1; | 1503 | np->tx_flow &= 1; |
1501 | np->rx_flow &= 1; | 1504 | np->rx_flow &= 1; |
1502 | } else if (negotiate.bits.asymmetric) { | 1505 | } else if (negotiate & MII_ANAR_ASYMMETRIC) { |
1503 | np->tx_flow = 0; | 1506 | np->tx_flow = 0; |
1504 | np->rx_flow &= 1; | 1507 | np->rx_flow &= 1; |
1505 | } | 1508 | } |
1506 | /* else tx_flow, rx_flow = user select */ | 1509 | /* else tx_flow, rx_flow = user select */ |
1507 | } else { | 1510 | } else { |
1508 | bmcr.image = mii_read (dev, phy_addr, MII_BMCR); | 1511 | __u16 bmcr = mii_read (dev, phy_addr, MII_BMCR); |
1509 | 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: | ||
1510 | printk (KERN_INFO "Operating at 100 Mbps, "); | 1517 | printk (KERN_INFO "Operating at 100 Mbps, "); |
1511 | } else if (bmcr.bits.speed100 == 0 && bmcr.bits.speed1000 == 0) { | 1518 | break; |
1519 | case 0: | ||
1512 | printk (KERN_INFO "Operating at 10 Mbps, "); | 1520 | printk (KERN_INFO "Operating at 10 Mbps, "); |
1513 | } else if (bmcr.bits.speed100 == 0 && bmcr.bits.speed1000 == 1) { | ||
1514 | printk (KERN_INFO "Operating at 1000 Mbps, "); | ||
1515 | } | 1521 | } |
1516 | if (bmcr.bits.duplex_mode) { | 1522 | if (bmcr & MII_BMCR_DUPLEX_MODE) { |
1517 | printk ("Full duplex\n"); | 1523 | printk ("Full duplex\n"); |
1518 | } else { | 1524 | } else { |
1519 | printk ("Half duplex\n"); | 1525 | printk ("Half duplex\n"); |
@@ -1534,10 +1540,10 @@ mii_get_media (struct net_device *dev) | |||
1534 | static int | 1540 | static int |
1535 | mii_set_media (struct net_device *dev) | 1541 | mii_set_media (struct net_device *dev) |
1536 | { | 1542 | { |
1537 | PHY_SCR_t pscr; | 1543 | __u16 pscr; |
1538 | BMCR_t bmcr; | 1544 | __u16 bmcr; |
1539 | BMSR_t bmsr; | 1545 | __u16 bmsr; |
1540 | ANAR_t anar; | 1546 | __u16 anar; |
1541 | int phy_addr; | 1547 | int phy_addr; |
1542 | struct netdev_private *np; | 1548 | struct netdev_private *np; |
1543 | np = netdev_priv(dev); | 1549 | np = netdev_priv(dev); |
@@ -1546,76 +1552,77 @@ mii_set_media (struct net_device *dev) | |||
1546 | /* Does user set speed? */ | 1552 | /* Does user set speed? */ |
1547 | if (np->an_enable) { | 1553 | if (np->an_enable) { |
1548 | /* Advertise capabilities */ | 1554 | /* Advertise capabilities */ |
1549 | bmsr.image = mii_read (dev, phy_addr, MII_BMSR); | 1555 | bmsr = mii_read (dev, phy_addr, MII_BMSR); |
1550 | anar.image = mii_read (dev, phy_addr, MII_ANAR); | 1556 | anar = mii_read (dev, phy_addr, MII_ANAR) & |
1551 | anar.bits.media_100BX_FD = bmsr.bits.media_100BX_FD; | 1557 | ~MII_ANAR_100BX_FD & |
1552 | anar.bits.media_100BX_HD = bmsr.bits.media_100BX_HD; | 1558 | ~MII_ANAR_100BX_HD & |
1553 | anar.bits.media_100BT4 = bmsr.bits.media_100BT4; | 1559 | ~MII_ANAR_100BT4 & |
1554 | anar.bits.media_10BT_FD = bmsr.bits.media_10BT_FD; | 1560 | ~MII_ANAR_10BT_FD & |
1555 | anar.bits.media_10BT_HD = bmsr.bits.media_10BT_HD; | 1561 | ~MII_ANAR_10BT_HD; |
1556 | anar.bits.pause = 1; | 1562 | if (bmsr & MII_BMSR_100BX_FD) |
1557 | anar.bits.asymmetric = 1; | 1563 | anar |= MII_ANAR_100BX_FD; |
1558 | 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); | ||
1559 | 1574 | ||
1560 | /* Enable Auto crossover */ | 1575 | /* Enable Auto crossover */ |
1561 | pscr.image = mii_read (dev, phy_addr, MII_PHY_SCR); | 1576 | pscr = mii_read (dev, phy_addr, MII_PHY_SCR); |
1562 | pscr.bits.mdi_crossover_mode = 3; /* 11'b */ | 1577 | pscr |= 3 << 5; /* 11'b */ |
1563 | mii_write (dev, phy_addr, MII_PHY_SCR, pscr.image); | 1578 | mii_write (dev, phy_addr, MII_PHY_SCR, pscr); |
1564 | 1579 | ||
1565 | /* Soft reset PHY */ | 1580 | /* Soft reset PHY */ |
1566 | mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET); | 1581 | mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET); |
1567 | bmcr.image = 0; | 1582 | bmcr = MII_BMCR_AN_ENABLE | MII_BMCR_RESTART_AN | MII_BMCR_RESET; |
1568 | bmcr.bits.an_enable = 1; | 1583 | mii_write (dev, phy_addr, MII_BMCR, bmcr); |
1569 | bmcr.bits.restart_an = 1; | ||
1570 | bmcr.bits.reset = 1; | ||
1571 | mii_write (dev, phy_addr, MII_BMCR, bmcr.image); | ||
1572 | mdelay(1); | 1584 | mdelay(1); |
1573 | } else { | 1585 | } else { |
1574 | /* Force speed setting */ | 1586 | /* Force speed setting */ |
1575 | /* 1) Disable Auto crossover */ | 1587 | /* 1) Disable Auto crossover */ |
1576 | pscr.image = mii_read (dev, phy_addr, MII_PHY_SCR); | 1588 | pscr = mii_read (dev, phy_addr, MII_PHY_SCR); |
1577 | pscr.bits.mdi_crossover_mode = 0; | 1589 | pscr &= ~(3 << 5); |
1578 | mii_write (dev, phy_addr, MII_PHY_SCR, pscr.image); | 1590 | mii_write (dev, phy_addr, MII_PHY_SCR, pscr); |
1579 | 1591 | ||
1580 | /* 2) PHY Reset */ | 1592 | /* 2) PHY Reset */ |
1581 | bmcr.image = mii_read (dev, phy_addr, MII_BMCR); | 1593 | bmcr = mii_read (dev, phy_addr, MII_BMCR); |
1582 | bmcr.bits.reset = 1; | 1594 | bmcr |= MII_BMCR_RESET; |
1583 | mii_write (dev, phy_addr, MII_BMCR, bmcr.image); | 1595 | mii_write (dev, phy_addr, MII_BMCR, bmcr); |
1584 | 1596 | ||
1585 | /* 3) Power Down */ | 1597 | /* 3) Power Down */ |
1586 | bmcr.image = 0x1940; /* must be 0x1940 */ | 1598 | bmcr = 0x1940; /* must be 0x1940 */ |
1587 | mii_write (dev, phy_addr, MII_BMCR, bmcr.image); | 1599 | mii_write (dev, phy_addr, MII_BMCR, bmcr); |
1588 | mdelay (100); /* wait a certain time */ | 1600 | mdelay (100); /* wait a certain time */ |
1589 | 1601 | ||
1590 | /* 4) Advertise nothing */ | 1602 | /* 4) Advertise nothing */ |
1591 | mii_write (dev, phy_addr, MII_ANAR, 0); | 1603 | mii_write (dev, phy_addr, MII_ANAR, 0); |
1592 | 1604 | ||
1593 | /* 5) Set media and Power Up */ | 1605 | /* 5) Set media and Power Up */ |
1594 | bmcr.image = 0; | 1606 | bmcr = MII_BMCR_POWER_DOWN; |
1595 | bmcr.bits.power_down = 1; | ||
1596 | if (np->speed == 100) { | 1607 | if (np->speed == 100) { |
1597 | bmcr.bits.speed100 = 1; | 1608 | bmcr |= MII_BMCR_SPEED_100; |
1598 | bmcr.bits.speed1000 = 0; | ||
1599 | printk (KERN_INFO "Manual 100 Mbps, "); | 1609 | printk (KERN_INFO "Manual 100 Mbps, "); |
1600 | } else if (np->speed == 10) { | 1610 | } else if (np->speed == 10) { |
1601 | bmcr.bits.speed100 = 0; | ||
1602 | bmcr.bits.speed1000 = 0; | ||
1603 | printk (KERN_INFO "Manual 10 Mbps, "); | 1611 | printk (KERN_INFO "Manual 10 Mbps, "); |
1604 | } | 1612 | } |
1605 | if (np->full_duplex) { | 1613 | if (np->full_duplex) { |
1606 | bmcr.bits.duplex_mode = 1; | 1614 | bmcr |= MII_BMCR_DUPLEX_MODE; |
1607 | printk ("Full duplex\n"); | 1615 | printk ("Full duplex\n"); |
1608 | } else { | 1616 | } else { |
1609 | bmcr.bits.duplex_mode = 0; | ||
1610 | printk ("Half duplex\n"); | 1617 | printk ("Half duplex\n"); |
1611 | } | 1618 | } |
1612 | #if 0 | 1619 | #if 0 |
1613 | /* Set 1000BaseT Master/Slave setting */ | 1620 | /* Set 1000BaseT Master/Slave setting */ |
1614 | mscr.image = mii_read (dev, phy_addr, MII_MSCR); | 1621 | mscr = mii_read (dev, phy_addr, MII_MSCR); |
1615 | mscr.bits.cfg_enable = 1; | 1622 | mscr |= MII_MSCR_CFG_ENABLE; |
1616 | mscr.bits.cfg_value = 0; | 1623 | mscr &= ~MII_MSCR_CFG_VALUE = 0; |
1617 | #endif | 1624 | #endif |
1618 | mii_write (dev, phy_addr, MII_BMCR, bmcr.image); | 1625 | mii_write (dev, phy_addr, MII_BMCR, bmcr); |
1619 | mdelay(10); | 1626 | mdelay(10); |
1620 | } | 1627 | } |
1621 | return 0; | 1628 | return 0; |
@@ -1624,43 +1631,42 @@ mii_set_media (struct net_device *dev) | |||
1624 | static int | 1631 | static int |
1625 | mii_get_media_pcs (struct net_device *dev) | 1632 | mii_get_media_pcs (struct net_device *dev) |
1626 | { | 1633 | { |
1627 | ANAR_PCS_t negotiate; | 1634 | __u16 negotiate; |
1628 | BMSR_t bmsr; | 1635 | __u16 bmsr; |
1629 | BMCR_t bmcr; | ||
1630 | int phy_addr; | 1636 | int phy_addr; |
1631 | struct netdev_private *np; | 1637 | struct netdev_private *np; |
1632 | 1638 | ||
1633 | np = netdev_priv(dev); | 1639 | np = netdev_priv(dev); |
1634 | phy_addr = np->phy_addr; | 1640 | phy_addr = np->phy_addr; |
1635 | 1641 | ||
1636 | bmsr.image = mii_read (dev, phy_addr, PCS_BMSR); | 1642 | bmsr = mii_read (dev, phy_addr, PCS_BMSR); |
1637 | if (np->an_enable) { | 1643 | if (np->an_enable) { |
1638 | if (!bmsr.bits.an_complete) { | 1644 | if (!(bmsr & MII_BMSR_AN_COMPLETE)) { |
1639 | /* Auto-Negotiation not completed */ | 1645 | /* Auto-Negotiation not completed */ |
1640 | return -1; | 1646 | return -1; |
1641 | } | 1647 | } |
1642 | negotiate.image = mii_read (dev, phy_addr, PCS_ANAR) & | 1648 | negotiate = mii_read (dev, phy_addr, PCS_ANAR) & |
1643 | mii_read (dev, phy_addr, PCS_ANLPAR); | 1649 | mii_read (dev, phy_addr, PCS_ANLPAR); |
1644 | np->speed = 1000; | 1650 | np->speed = 1000; |
1645 | if (negotiate.bits.full_duplex) { | 1651 | if (negotiate & PCS_ANAR_FULL_DUPLEX) { |
1646 | printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n"); | 1652 | printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n"); |
1647 | np->full_duplex = 1; | 1653 | np->full_duplex = 1; |
1648 | } else { | 1654 | } else { |
1649 | printk (KERN_INFO "Auto 1000 Mbps, half duplex\n"); | 1655 | printk (KERN_INFO "Auto 1000 Mbps, half duplex\n"); |
1650 | np->full_duplex = 0; | 1656 | np->full_duplex = 0; |
1651 | } | 1657 | } |
1652 | if (negotiate.bits.pause) { | 1658 | if (negotiate & PCS_ANAR_PAUSE) { |
1653 | np->tx_flow &= 1; | 1659 | np->tx_flow &= 1; |
1654 | np->rx_flow &= 1; | 1660 | np->rx_flow &= 1; |
1655 | } else if (negotiate.bits.asymmetric) { | 1661 | } else if (negotiate & PCS_ANAR_ASYMMETRIC) { |
1656 | np->tx_flow = 0; | 1662 | np->tx_flow = 0; |
1657 | np->rx_flow &= 1; | 1663 | np->rx_flow &= 1; |
1658 | } | 1664 | } |
1659 | /* else tx_flow, rx_flow = user select */ | 1665 | /* else tx_flow, rx_flow = user select */ |
1660 | } else { | 1666 | } else { |
1661 | bmcr.image = mii_read (dev, phy_addr, PCS_BMCR); | 1667 | __u16 bmcr = mii_read (dev, phy_addr, PCS_BMCR); |
1662 | printk (KERN_INFO "Operating at 1000 Mbps, "); | 1668 | printk (KERN_INFO "Operating at 1000 Mbps, "); |
1663 | if (bmcr.bits.duplex_mode) { | 1669 | if (bmcr & MII_BMCR_DUPLEX_MODE) { |
1664 | printk ("Full duplex\n"); | 1670 | printk ("Full duplex\n"); |
1665 | } else { | 1671 | } else { |
1666 | printk ("Half duplex\n"); | 1672 | printk ("Half duplex\n"); |
@@ -1681,9 +1687,9 @@ mii_get_media_pcs (struct net_device *dev) | |||
1681 | static int | 1687 | static int |
1682 | mii_set_media_pcs (struct net_device *dev) | 1688 | mii_set_media_pcs (struct net_device *dev) |
1683 | { | 1689 | { |
1684 | BMCR_t bmcr; | 1690 | __u16 bmcr; |
1685 | ESR_t esr; | 1691 | __u16 esr; |
1686 | ANAR_PCS_t anar; | 1692 | __u16 anar; |
1687 | int phy_addr; | 1693 | int phy_addr; |
1688 | struct netdev_private *np; | 1694 | struct netdev_private *np; |
1689 | np = netdev_priv(dev); | 1695 | np = netdev_priv(dev); |
@@ -1692,41 +1698,37 @@ mii_set_media_pcs (struct net_device *dev) | |||
1692 | /* Auto-Negotiation? */ | 1698 | /* Auto-Negotiation? */ |
1693 | if (np->an_enable) { | 1699 | if (np->an_enable) { |
1694 | /* Advertise capabilities */ | 1700 | /* Advertise capabilities */ |
1695 | esr.image = mii_read (dev, phy_addr, PCS_ESR); | 1701 | esr = mii_read (dev, phy_addr, PCS_ESR); |
1696 | anar.image = mii_read (dev, phy_addr, MII_ANAR); | 1702 | anar = mii_read (dev, phy_addr, MII_ANAR) & |
1697 | anar.bits.half_duplex = | 1703 | ~PCS_ANAR_HALF_DUPLEX & |
1698 | esr.bits.media_1000BT_HD | esr.bits.media_1000BX_HD; | 1704 | ~PCS_ANAR_FULL_DUPLEX; |
1699 | anar.bits.full_duplex = | 1705 | if (esr & (MII_ESR_1000BT_HD | MII_ESR_1000BX_HD)) |
1700 | esr.bits.media_1000BT_FD | esr.bits.media_1000BX_FD; | 1706 | anar |= PCS_ANAR_HALF_DUPLEX; |
1701 | anar.bits.pause = 1; | 1707 | if (esr & (MII_ESR_1000BT_FD | MII_ESR_1000BX_FD)) |
1702 | anar.bits.asymmetric = 1; | 1708 | anar |= PCS_ANAR_FULL_DUPLEX; |
1703 | 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); | ||
1704 | 1711 | ||
1705 | /* Soft reset PHY */ | 1712 | /* Soft reset PHY */ |
1706 | mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET); | 1713 | mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET); |
1707 | bmcr.image = 0; | 1714 | bmcr = MII_BMCR_AN_ENABLE | MII_BMCR_RESTART_AN | |
1708 | bmcr.bits.an_enable = 1; | 1715 | MII_BMCR_RESET; |
1709 | bmcr.bits.restart_an = 1; | 1716 | mii_write (dev, phy_addr, MII_BMCR, bmcr); |
1710 | bmcr.bits.reset = 1; | ||
1711 | mii_write (dev, phy_addr, MII_BMCR, bmcr.image); | ||
1712 | mdelay(1); | 1717 | mdelay(1); |
1713 | } else { | 1718 | } else { |
1714 | /* Force speed setting */ | 1719 | /* Force speed setting */ |
1715 | /* PHY Reset */ | 1720 | /* PHY Reset */ |
1716 | bmcr.image = 0; | 1721 | bmcr = MII_BMCR_RESET; |
1717 | bmcr.bits.reset = 1; | 1722 | mii_write (dev, phy_addr, MII_BMCR, bmcr); |
1718 | mii_write (dev, phy_addr, MII_BMCR, bmcr.image); | ||
1719 | mdelay(10); | 1723 | mdelay(10); |
1720 | bmcr.image = 0; | ||
1721 | bmcr.bits.an_enable = 0; | ||
1722 | if (np->full_duplex) { | 1724 | if (np->full_duplex) { |
1723 | bmcr.bits.duplex_mode = 1; | 1725 | bmcr = MII_BMCR_DUPLEX_MODE; |
1724 | printk (KERN_INFO "Manual full duplex\n"); | 1726 | printk (KERN_INFO "Manual full duplex\n"); |
1725 | } else { | 1727 | } else { |
1726 | bmcr.bits.duplex_mode = 0; | 1728 | bmcr = 0; |
1727 | printk (KERN_INFO "Manual half duplex\n"); | 1729 | printk (KERN_INFO "Manual half duplex\n"); |
1728 | } | 1730 | } |
1729 | mii_write (dev, phy_addr, MII_BMCR, bmcr.image); | 1731 | mii_write (dev, phy_addr, MII_BMCR, bmcr); |
1730 | mdelay(10); | 1732 | mdelay(10); |
1731 | 1733 | ||
1732 | /* Advertise nothing */ | 1734 | /* Advertise nothing */ |
@@ -1762,7 +1764,7 @@ rio_close (struct net_device *dev) | |||
1762 | skb = np->rx_skbuff[i]; | 1764 | skb = np->rx_skbuff[i]; |
1763 | if (skb) { | 1765 | if (skb) { |
1764 | pci_unmap_single(np->pdev, | 1766 | pci_unmap_single(np->pdev, |
1765 | np->rx_ring[i].fraginfo & DMA_48BIT_MASK, | 1767 | desc_to_dma(&np->rx_ring[i]), |
1766 | skb->len, PCI_DMA_FROMDEVICE); | 1768 | skb->len, PCI_DMA_FROMDEVICE); |
1767 | dev_kfree_skb (skb); | 1769 | dev_kfree_skb (skb); |
1768 | np->rx_skbuff[i] = NULL; | 1770 | np->rx_skbuff[i] = NULL; |
@@ -1772,7 +1774,7 @@ rio_close (struct net_device *dev) | |||
1772 | skb = np->tx_skbuff[i]; | 1774 | skb = np->tx_skbuff[i]; |
1773 | if (skb) { | 1775 | if (skb) { |
1774 | pci_unmap_single(np->pdev, | 1776 | pci_unmap_single(np->pdev, |
1775 | np->tx_ring[i].fraginfo & DMA_48BIT_MASK, | 1777 | desc_to_dma(&np->tx_ring[i]), |
1776 | skb->len, PCI_DMA_TODEVICE); | 1778 | skb->len, PCI_DMA_TODEVICE); |
1777 | dev_kfree_skb (skb); | 1779 | dev_kfree_skb (skb); |
1778 | np->tx_skbuff[i] = NULL; | 1780 | np->tx_skbuff[i] = NULL; |
diff --git a/drivers/net/dl2k.h b/drivers/net/dl2k.h index 5b801775f42d..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 */ |
301 | typedef 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 | |||
318 | enum _mii_bmcr { | 301 | enum _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 */ |
336 | typedef 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 | |||
358 | enum _mii_bmsr { | 319 | enum _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 */ |
377 | typedef 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 | |||
395 | enum _mii_anar { | 338 | enum _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 */ |
410 | typedef 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 | |||
428 | enum _mii_anlpar { | 353 | enum _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 */ |
442 | typedef 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 | |||
454 | enum _mii_aner { | 367 | enum _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 */ |
463 | typedef 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 | |||
476 | enum _mii_mscr { | 376 | enum _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 */ |
486 | typedef 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 | |||
500 | enum _mii_mssr { | 386 | enum _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 */ |
511 | typedef 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 | |||
522 | enum _mii_esr { | 397 | enum _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 | ||
529 | typedef union t_MII_PHY_SCR { | 405 | typedef 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 | ||
547 | typedef enum t_MII_ADMIN_STATUS { | 424 | typedef 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 */ |
559 | typedef 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 | |||
574 | enum _pcs_anar { | 436 | enum _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 */ |
583 | typedef 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 | |||
598 | enum _pcs_anlpar { | 445 | enum _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, |
@@ -633,9 +480,9 @@ struct mii_data { | |||
633 | 480 | ||
634 | /* The Rx and Tx buffer descriptors. */ | 481 | /* The Rx and Tx buffer descriptors. */ |
635 | struct netdev_desc { | 482 | struct netdev_desc { |
636 | u64 next_desc; | 483 | __le64 next_desc; |
637 | u64 status; | 484 | __le64 status; |
638 | u64 fraginfo; | 485 | __le64 fraginfo; |
639 | }; | 486 | }; |
640 | 487 | ||
641 | #define PRIV_ALIGN 15 /* Required alignment mask */ | 488 | #define PRIV_ALIGN 15 /* Required alignment mask */ |
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..76c0fa690cc6 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -632,6 +632,7 @@ e1000_down(struct e1000_adapter *adapter) | |||
632 | 632 | ||
633 | #ifdef CONFIG_E1000_NAPI | 633 | #ifdef CONFIG_E1000_NAPI |
634 | napi_disable(&adapter->napi); | 634 | napi_disable(&adapter->napi); |
635 | atomic_set(&adapter->irq_sem, 0); | ||
635 | #endif | 636 | #endif |
636 | e1000_irq_disable(adapter); | 637 | e1000_irq_disable(adapter); |
637 | 638 | ||
@@ -3924,27 +3925,24 @@ e1000_clean(struct napi_struct *napi, int budget) | |||
3924 | /* Must NOT use netdev_priv macro here. */ | 3925 | /* Must NOT use netdev_priv macro here. */ |
3925 | adapter = poll_dev->priv; | 3926 | adapter = poll_dev->priv; |
3926 | 3927 | ||
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 | 3928 | /* e1000_clean is called per-cpu. This lock protects |
3932 | * tx_ring[0] from being cleaned by multiple cpus | 3929 | * tx_ring[0] from being cleaned by multiple cpus |
3933 | * simultaneously. A failure obtaining the lock means | 3930 | * simultaneously. A failure obtaining the lock means |
3934 | * tx_ring[0] is currently being cleaned anyway. */ | 3931 | * tx_ring[0] is currently being cleaned anyway. */ |
3935 | if (spin_trylock(&adapter->tx_queue_lock)) { | 3932 | if (spin_trylock(&adapter->tx_queue_lock)) { |
3936 | tx_cleaned = e1000_clean_tx_irq(adapter, | 3933 | tx_cleaned = e1000_clean_tx_irq(adapter, |
3937 | &adapter->tx_ring[0]); | 3934 | &adapter->tx_ring[0]); |
3938 | spin_unlock(&adapter->tx_queue_lock); | 3935 | spin_unlock(&adapter->tx_queue_lock); |
3939 | } | 3936 | } |
3940 | 3937 | ||
3941 | adapter->clean_rx(adapter, &adapter->rx_ring[0], | 3938 | adapter->clean_rx(adapter, &adapter->rx_ring[0], |
3942 | &work_done, budget); | 3939 | &work_done, budget); |
3943 | 3940 | ||
3944 | /* If no Tx and not enough Rx work done, exit the polling mode */ | 3941 | if (tx_cleaned) |
3945 | if ((!tx_cleaned && (work_done == 0)) || | 3942 | work_done = budget; |
3946 | !netif_running(poll_dev)) { | 3943 | |
3947 | quit_polling: | 3944 | /* If budget not fully consumed, exit the polling mode */ |
3945 | if (work_done < budget) { | ||
3948 | if (likely(adapter->itr_setting & 3)) | 3946 | if (likely(adapter->itr_setting & 3)) |
3949 | e1000_set_itr(adapter); | 3947 | e1000_set_itr(adapter); |
3950 | netif_rx_complete(poll_dev, napi); | 3948 | netif_rx_complete(poll_dev, napi); |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 4fd2e23720b6..9cc5a6b01bc1 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 | |
1410 | quit_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); |
@@ -2186,6 +2183,7 @@ void e1000e_down(struct e1000_adapter *adapter) | |||
2186 | msleep(10); | 2183 | msleep(10); |
2187 | 2184 | ||
2188 | napi_disable(&adapter->napi); | 2185 | napi_disable(&adapter->napi); |
2186 | atomic_set(&adapter->irq_sem, 0); | ||
2189 | e1000_irq_disable(adapter); | 2187 | e1000_irq_disable(adapter); |
2190 | 2188 | ||
2191 | del_timer_sync(&adapter->watchdog_timer); | 2189 | del_timer_sync(&adapter->watchdog_timer); |
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/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c index 79f7eade4773..f91ee700e605 100644 --- a/drivers/net/fec_mpc52xx.c +++ b/drivers/net/fec_mpc52xx.c | |||
@@ -568,8 +568,9 @@ static void mpc52xx_fec_reset_stats(struct net_device *dev) | |||
568 | struct mpc52xx_fec __iomem *fec = priv->fec; | 568 | struct mpc52xx_fec __iomem *fec = priv->fec; |
569 | 569 | ||
570 | out_be32(&fec->mib_control, FEC_MIB_DISABLE); | 570 | out_be32(&fec->mib_control, FEC_MIB_DISABLE); |
571 | memset_io(&fec->rmon_t_drop, 0, (__force u32)&fec->reserved10 - | 571 | memset_io(&fec->rmon_t_drop, 0, |
572 | (__force u32)&fec->rmon_t_drop); | 572 | offsetof(struct mpc52xx_fec, reserved10) - |
573 | offsetof(struct mpc52xx_fec, rmon_t_drop)); | ||
573 | out_be32(&fec->mib_control, 0); | 574 | out_be32(&fec->mib_control, 0); |
574 | 575 | ||
575 | memset(&dev->stats, 0, sizeof(dev->stats)); | 576 | memset(&dev->stats, 0, sizeof(dev->stats)); |
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, | |||
897 | static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 894 | static 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 | ||
903 | static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 904 | static 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 | ||
910 | static int fs_nway_reset(struct net_device *dev) | 914 | static 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) | |||
857 | static void ipg_nic_txfree(struct net_device *dev) | 857 | static 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 | 1727 | out_unlock: | |
1737 | spin_unlock(&sp->lock); | 1728 | spin_unlock(&sp->lock); |
1738 | out: | 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..4f63839051b0 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -296,6 +296,11 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog) | |||
296 | { | 296 | { |
297 | struct net_device *netdev = adapter->netdev; | 297 | struct net_device *netdev = adapter->netdev; |
298 | 298 | ||
299 | #ifdef CONFIG_IXGB_NAPI | ||
300 | napi_disable(&adapter->napi); | ||
301 | atomic_set(&adapter->irq_sem, 0); | ||
302 | #endif | ||
303 | |||
299 | ixgb_irq_disable(adapter); | 304 | ixgb_irq_disable(adapter); |
300 | free_irq(adapter->pdev->irq, netdev); | 305 | free_irq(adapter->pdev->irq, netdev); |
301 | 306 | ||
@@ -304,9 +309,7 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog) | |||
304 | 309 | ||
305 | if(kill_watchdog) | 310 | if(kill_watchdog) |
306 | del_timer_sync(&adapter->watchdog_timer); | 311 | del_timer_sync(&adapter->watchdog_timer); |
307 | #ifdef CONFIG_IXGB_NAPI | 312 | |
308 | napi_disable(&adapter->napi); | ||
309 | #endif | ||
310 | adapter->link_speed = 0; | 313 | adapter->link_speed = 0; |
311 | adapter->link_duplex = 0; | 314 | adapter->link_duplex = 0; |
312 | netif_carrier_off(netdev); | 315 | netif_carrier_off(netdev); |
@@ -1787,14 +1790,13 @@ ixgb_clean(struct napi_struct *napi, int budget) | |||
1787 | { | 1790 | { |
1788 | struct ixgb_adapter *adapter = container_of(napi, struct ixgb_adapter, napi); | 1791 | struct ixgb_adapter *adapter = container_of(napi, struct ixgb_adapter, napi); |
1789 | struct net_device *netdev = adapter->netdev; | 1792 | struct net_device *netdev = adapter->netdev; |
1790 | int tx_cleaned; | ||
1791 | int work_done = 0; | 1793 | int work_done = 0; |
1792 | 1794 | ||
1793 | tx_cleaned = ixgb_clean_tx_irq(adapter); | 1795 | ixgb_clean_tx_irq(adapter); |
1794 | ixgb_clean_rx_irq(adapter, &work_done, budget); | 1796 | ixgb_clean_rx_irq(adapter, &work_done, budget); |
1795 | 1797 | ||
1796 | /* if no Tx and not enough Rx work done, exit the polling mode */ | 1798 | /* If budget not fully consumed, exit the polling mode */ |
1797 | if((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) { | 1799 | if (work_done < budget) { |
1798 | netif_rx_complete(netdev, napi); | 1800 | netif_rx_complete(netdev, napi); |
1799 | ixgb_irq_enable(adapter); | 1801 | ixgb_irq_enable(adapter); |
1800 | } | 1802 | } |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 00bc525c6560..a4265bc1cebb 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -1409,9 +1409,11 @@ void ixgbe_down(struct ixgbe_adapter *adapter) | |||
1409 | IXGBE_WRITE_FLUSH(&adapter->hw); | 1409 | IXGBE_WRITE_FLUSH(&adapter->hw); |
1410 | msleep(10); | 1410 | msleep(10); |
1411 | 1411 | ||
1412 | napi_disable(&adapter->napi); | ||
1413 | atomic_set(&adapter->irq_sem, 0); | ||
1414 | |||
1412 | ixgbe_irq_disable(adapter); | 1415 | ixgbe_irq_disable(adapter); |
1413 | 1416 | ||
1414 | napi_disable(&adapter->napi); | ||
1415 | del_timer_sync(&adapter->watchdog_timer); | 1417 | del_timer_sync(&adapter->watchdog_timer); |
1416 | 1418 | ||
1417 | netif_carrier_off(netdev); | 1419 | netif_carrier_off(netdev); |
@@ -1470,19 +1472,16 @@ static int ixgbe_clean(struct napi_struct *napi, int budget) | |||
1470 | struct net_device *netdev = adapter->netdev; | 1472 | struct net_device *netdev = adapter->netdev; |
1471 | int tx_cleaned = 0, work_done = 0; | 1473 | int tx_cleaned = 0, work_done = 0; |
1472 | 1474 | ||
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 */ | 1475 | /* In non-MSIX case, there is no multi-Tx/Rx queue */ |
1478 | tx_cleaned = ixgbe_clean_tx_irq(adapter, adapter->tx_ring); | 1476 | tx_cleaned = ixgbe_clean_tx_irq(adapter, adapter->tx_ring); |
1479 | ixgbe_clean_rx_irq(adapter, &adapter->rx_ring[0], &work_done, | 1477 | ixgbe_clean_rx_irq(adapter, &adapter->rx_ring[0], &work_done, |
1480 | budget); | 1478 | budget); |
1481 | 1479 | ||
1482 | /* If no Tx and not enough Rx work done, exit the polling mode */ | 1480 | if (tx_cleaned) |
1483 | if ((!tx_cleaned && (work_done < budget)) || | 1481 | work_done = budget; |
1484 | !netif_running(adapter->netdev)) { | 1482 | |
1485 | quit_polling: | 1483 | /* If budget not fully consumed, exit the polling mode */ |
1484 | if (work_done < budget) { | ||
1486 | netif_rx_complete(netdev, napi); | 1485 | netif_rx_complete(netdev, napi); |
1487 | ixgbe_irq_enable(adapter); | 1486 | ixgbe_irq_enable(adapter); |
1488 | } | 1487 | } |
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 = ð_header_ops; | 247 | dev->header_ops = ð_header_ops; |
248 | dev->init = loopback_dev_init; | 248 | dev->init = loopback_dev_init; |
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 047ea7be4850..e10528ed9081 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c | |||
@@ -307,8 +307,31 @@ static void macb_tx(struct macb *bp) | |||
307 | (unsigned long)status); | 307 | (unsigned long)status); |
308 | 308 | ||
309 | if (status & MACB_BIT(UND)) { | 309 | if (status & MACB_BIT(UND)) { |
310 | int i; | ||
310 | printk(KERN_ERR "%s: TX underrun, resetting buffers\n", | 311 | printk(KERN_ERR "%s: TX underrun, resetting buffers\n", |
311 | bp->dev->name); | 312 | bp->dev->name); |
313 | |||
314 | head = bp->tx_head; | ||
315 | |||
316 | /*Mark all the buffer as used to avoid sending a lost buffer*/ | ||
317 | for (i = 0; i < TX_RING_SIZE; i++) | ||
318 | bp->tx_ring[i].ctrl = MACB_BIT(TX_USED); | ||
319 | |||
320 | /* free transmit buffer in upper layer*/ | ||
321 | for (tail = bp->tx_tail; tail != head; tail = NEXT_TX(tail)) { | ||
322 | struct ring_info *rp = &bp->tx_skb[tail]; | ||
323 | struct sk_buff *skb = rp->skb; | ||
324 | |||
325 | BUG_ON(skb == NULL); | ||
326 | |||
327 | rmb(); | ||
328 | |||
329 | dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len, | ||
330 | DMA_TO_DEVICE); | ||
331 | rp->skb = NULL; | ||
332 | dev_kfree_skb_irq(skb); | ||
333 | } | ||
334 | |||
312 | bp->tx_head = bp->tx_tail = 0; | 335 | bp->tx_head = bp->tx_tail = 0; |
313 | } | 336 | } |
314 | 337 | ||
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 | ||
176 | static irqreturn_t | 176 | static 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 | ||
330 | struct cmd_desc_type0 { | 333 | struct 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 | ||
439 | struct status_desc { | 442 | struct 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 | |||
1174 | out_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 | ||
1202 | static void netxen_watchdog(unsigned long v) | 1182 | static 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 | ||
39 | static char version[] __devinitdata = | 39 | static 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 | ||
804 | static int xcvr_init_10g(struct niu *np) | 804 | static 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 | |||
820 | static 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 | |||
837 | static 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 | |||
883 | static 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 | ||
967 | static 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 | |||
899 | static int mii_reset(struct niu *np) | 999 | static 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 | ||
1085 | static int link_status_10g(struct niu *np, int *link_up_p) | 1185 | static 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; | ||
1232 | out: | ||
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 | |||
1241 | static 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 | ||
1136 | out: | 1285 | out: |
1286 | *link_up_p = link_up; | ||
1287 | return err; | ||
1288 | } | ||
1289 | |||
1290 | static 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 | ||
1143 | static int link_status_1g(struct niu *np, int *link_up_p) | 1320 | static 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 | ||
1214 | out: | 1394 | out: |
@@ -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 | ||
2752 | static int niu_slowpath_interrupt(struct niu *np, struct niu_ldg *lp) | 2938 | static 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 | ||
2809 | static void niu_rxchan_intr(struct niu *np, struct rx_ring_info *rp, | 3003 | static 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 ad134a61302a..36a7ba3134ce 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c | |||
@@ -187,14 +187,16 @@ enum Window1 { | |||
187 | enum Window3 { /* Window 3: MAC/config bits. */ | 187 | enum 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 | }; |
190 | union wn3_config { | 190 | enum 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 | ||
200 | enum Window4 { /* Window 4: Xcvr/media bits. */ | 202 | enum Window4 { /* Window 4: Xcvr/media bits. */ |
@@ -337,15 +339,15 @@ static int tc574_config(struct pcmcia_device *link) | |||
337 | struct net_device *dev = link->priv; | 339 | struct net_device *dev = link->priv; |
338 | struct el3_private *lp = netdev_priv(dev); | 340 | struct el3_private *lp = netdev_priv(dev); |
339 | tuple_t tuple; | 341 | tuple_t tuple; |
340 | unsigned short buf[32]; | 342 | __le16 buf[32]; |
341 | int last_fn, last_ret, i, j; | 343 | int last_fn, last_ret, i, j; |
342 | kio_addr_t ioaddr; | 344 | kio_addr_t ioaddr; |
343 | u16 *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 = (u16 *)dev->dev_addr; | 350 | phys_addr = (__be16 *)dev->dev_addr; |
349 | 351 | ||
350 | DEBUG(0, "3c574_config(0x%p)\n", link); | 352 | DEBUG(0, "3c574_config(0x%p)\n", link); |
351 | 353 | ||
@@ -378,12 +380,12 @@ static int tc574_config(struct pcmcia_device *link) | |||
378 | if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { | 380 | if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { |
379 | pcmcia_get_tuple_data(link, &tuple); | 381 | pcmcia_get_tuple_data(link, &tuple); |
380 | for (i = 0; i < 3; i++) | 382 | for (i = 0; i < 3; i++) |
381 | phys_addr[i] = htons(buf[i]); | 383 | phys_addr[i] = htons(le16_to_cpu(buf[i])); |
382 | } else { | 384 | } else { |
383 | EL3WINDOW(0); | 385 | EL3WINDOW(0); |
384 | for (i = 0; i < 3; i++) | 386 | for (i = 0; i < 3; i++) |
385 | phys_addr[i] = htons(read_eeprom(ioaddr, i + 10)); | 387 | phys_addr[i] = htons(read_eeprom(ioaddr, i + 10)); |
386 | if (phys_addr[0] == 0x6060) { | 388 | if (phys_addr[0] == htons(0x6060)) { |
387 | printk(KERN_NOTICE "3c574_cs: IO port conflict at 0x%03lx" | 389 | printk(KERN_NOTICE "3c574_cs: IO port conflict at 0x%03lx" |
388 | "-0x%03lx\n", dev->base_addr, dev->base_addr+15); | 390 | "-0x%03lx\n", dev->base_addr, dev->base_addr+15); |
389 | goto failed; | 391 | goto failed; |
@@ -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/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index a98fe07cce70..e862d14ece79 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c | |||
@@ -251,7 +251,8 @@ static int tc589_config(struct pcmcia_device *link) | |||
251 | struct net_device *dev = link->priv; | 251 | struct net_device *dev = link->priv; |
252 | struct el3_private *lp = netdev_priv(dev); | 252 | struct el3_private *lp = netdev_priv(dev); |
253 | tuple_t tuple; | 253 | tuple_t tuple; |
254 | u16 buf[32], *phys_addr; | 254 | __le16 buf[32]; |
255 | __be16 *phys_addr; | ||
255 | int last_fn, last_ret, i, j, multi = 0, fifo; | 256 | int last_fn, last_ret, i, j, multi = 0, fifo; |
256 | kio_addr_t ioaddr; | 257 | kio_addr_t ioaddr; |
257 | char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; | 258 | char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; |
@@ -259,7 +260,7 @@ static int tc589_config(struct pcmcia_device *link) | |||
259 | 260 | ||
260 | DEBUG(0, "3c589_config(0x%p)\n", link); | 261 | DEBUG(0, "3c589_config(0x%p)\n", link); |
261 | 262 | ||
262 | phys_addr = (u16 *)dev->dev_addr; | 263 | phys_addr = (__be16 *)dev->dev_addr; |
263 | tuple.Attributes = 0; | 264 | tuple.Attributes = 0; |
264 | tuple.TupleData = (cisdata_t *)buf; | 265 | tuple.TupleData = (cisdata_t *)buf; |
265 | tuple.TupleDataMax = sizeof(buf); | 266 | tuple.TupleDataMax = sizeof(buf); |
@@ -298,11 +299,11 @@ static int tc589_config(struct pcmcia_device *link) | |||
298 | if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { | 299 | if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { |
299 | pcmcia_get_tuple_data(link, &tuple); | 300 | pcmcia_get_tuple_data(link, &tuple); |
300 | for (i = 0; i < 3; i++) | 301 | for (i = 0; i < 3; i++) |
301 | phys_addr[i] = htons(buf[i]); | 302 | phys_addr[i] = htons(le16_to_cpu(buf[i])); |
302 | } else { | 303 | } else { |
303 | for (i = 0; i < 3; i++) | 304 | for (i = 0; i < 3; i++) |
304 | phys_addr[i] = htons(read_eeprom(ioaddr, i)); | 305 | phys_addr[i] = htons(read_eeprom(ioaddr, i)); |
305 | if (phys_addr[0] == 0x6060) { | 306 | if (phys_addr[0] == htons(0x6060)) { |
306 | printk(KERN_ERR "3c589_cs: IO port conflict at 0x%03lx" | 307 | printk(KERN_ERR "3c589_cs: IO port conflict at 0x%03lx" |
307 | "-0x%03lx\n", dev->base_addr, dev->base_addr+15); | 308 | "-0x%03lx\n", dev->base_addr, dev->base_addr+15); |
308 | goto failed; | 309 | goto failed; |
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)) { | ||
2330 | quit_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 1f647b9ce352..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; |
@@ -2211,7 +2211,7 @@ out: | |||
2211 | 2211 | ||
2212 | static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc) | 2212 | static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc) |
2213 | { | 2213 | { |
2214 | desc->addr = 0x0badbadbadbadbadull; | 2214 | desc->addr = cpu_to_le64(0x0badbadbadbadbadull); |
2215 | desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask); | 2215 | desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask); |
2216 | } | 2216 | } |
2217 | 2217 | ||
@@ -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 | } |
@@ -2835,7 +2837,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev, | |||
2835 | } | 2837 | } |
2836 | 2838 | ||
2837 | /* Work around for AMD plateform. */ | 2839 | /* Work around for AMD plateform. */ |
2838 | if ((desc->opts2 & 0xfffe000) && | 2840 | if ((desc->opts2 & cpu_to_le32(0xfffe000)) && |
2839 | (tp->mac_version == RTL_GIGA_MAC_VER_05)) { | 2841 | (tp->mac_version == RTL_GIGA_MAC_VER_05)) { |
2840 | desc->opts2 = 0; | 2842 | desc->opts2 = 0; |
2841 | cur_rx++; | 2843 | cur_rx++; |
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c index 73a7e6529ee0..55a590ab1e17 100644 --- a/drivers/net/rrunner.c +++ b/drivers/net/rrunner.c | |||
@@ -294,7 +294,6 @@ static int rr_reset(struct net_device *dev) | |||
294 | { | 294 | { |
295 | struct rr_private *rrpriv; | 295 | struct rr_private *rrpriv; |
296 | struct rr_regs __iomem *regs; | 296 | struct rr_regs __iomem *regs; |
297 | struct eeprom *hw = NULL; | ||
298 | u32 start_pc; | 297 | u32 start_pc; |
299 | int i; | 298 | int i; |
300 | 299 | ||
@@ -381,7 +380,8 @@ static int rr_reset(struct net_device *dev) | |||
381 | writel(RBURST_64|WBURST_64, ®s->PciState); | 380 | writel(RBURST_64|WBURST_64, ®s->PciState); |
382 | wmb(); | 381 | wmb(); |
383 | 382 | ||
384 | start_pc = rr_read_eeprom_word(rrpriv, &hw->rncd_info.FwStart); | 383 | start_pc = rr_read_eeprom_word(rrpriv, |
384 | offsetof(struct eeprom, rncd_info.FwStart)); | ||
385 | 385 | ||
386 | #if (DEBUG > 1) | 386 | #if (DEBUG > 1) |
387 | printk("%s: Executing firmware at address 0x%06x\n", | 387 | printk("%s: Executing firmware at address 0x%06x\n", |
@@ -438,12 +438,12 @@ static unsigned int rr_read_eeprom(struct rr_private *rrpriv, | |||
438 | * it to our CPU byte-order. | 438 | * it to our CPU byte-order. |
439 | */ | 439 | */ |
440 | static u32 rr_read_eeprom_word(struct rr_private *rrpriv, | 440 | static u32 rr_read_eeprom_word(struct rr_private *rrpriv, |
441 | void * offset) | 441 | size_t offset) |
442 | { | 442 | { |
443 | u32 word; | 443 | __be32 word; |
444 | 444 | ||
445 | if ((rr_read_eeprom(rrpriv, (unsigned long)offset, | 445 | if ((rr_read_eeprom(rrpriv, offset, |
446 | (char *)&word, 4) == 4)) | 446 | (unsigned char *)&word, 4) == 4)) |
447 | return be32_to_cpu(word); | 447 | return be32_to_cpu(word); |
448 | return 0; | 448 | return 0; |
449 | } | 449 | } |
@@ -510,7 +510,6 @@ static int __devinit rr_init(struct net_device *dev) | |||
510 | { | 510 | { |
511 | struct rr_private *rrpriv; | 511 | struct rr_private *rrpriv; |
512 | struct rr_regs __iomem *regs; | 512 | struct rr_regs __iomem *regs; |
513 | struct eeprom *hw = NULL; | ||
514 | u32 sram_size, rev; | 513 | u32 sram_size, rev; |
515 | DECLARE_MAC_BUF(mac); | 514 | DECLARE_MAC_BUF(mac); |
516 | 515 | ||
@@ -545,14 +544,14 @@ static int __devinit rr_init(struct net_device *dev) | |||
545 | * other method I've seen. -VAL | 544 | * other method I've seen. -VAL |
546 | */ | 545 | */ |
547 | 546 | ||
548 | *(u16 *)(dev->dev_addr) = | 547 | *(__be16 *)(dev->dev_addr) = |
549 | htons(rr_read_eeprom_word(rrpriv, &hw->manf.BoardULA)); | 548 | htons(rr_read_eeprom_word(rrpriv, offsetof(struct eeprom, manf.BoardULA))); |
550 | *(u32 *)(dev->dev_addr+2) = | 549 | *(__be32 *)(dev->dev_addr+2) = |
551 | htonl(rr_read_eeprom_word(rrpriv, &hw->manf.BoardULA[4])); | 550 | htonl(rr_read_eeprom_word(rrpriv, offsetof(struct eeprom, manf.BoardULA[4]))); |
552 | 551 | ||
553 | printk(" MAC: %s\n", print_mac(mac, dev->dev_addr)); | 552 | printk(" MAC: %s\n", print_mac(mac, dev->dev_addr)); |
554 | 553 | ||
555 | sram_size = rr_read_eeprom_word(rrpriv, (void *)8); | 554 | sram_size = rr_read_eeprom_word(rrpriv, 8); |
556 | printk(" SRAM size 0x%06x\n", sram_size); | 555 | printk(" SRAM size 0x%06x\n", sram_size); |
557 | 556 | ||
558 | return 0; | 557 | return 0; |
@@ -1477,11 +1476,10 @@ static int rr_load_firmware(struct net_device *dev) | |||
1477 | { | 1476 | { |
1478 | struct rr_private *rrpriv; | 1477 | struct rr_private *rrpriv; |
1479 | struct rr_regs __iomem *regs; | 1478 | struct rr_regs __iomem *regs; |
1480 | unsigned long eptr, segptr; | 1479 | size_t eptr, segptr; |
1481 | int i, j; | 1480 | int i, j; |
1482 | u32 localctrl, sptr, len, tmp; | 1481 | u32 localctrl, sptr, len, tmp; |
1483 | u32 p2len, p2size, nr_seg, revision, io, sram_size; | 1482 | u32 p2len, p2size, nr_seg, revision, io, sram_size; |
1484 | struct eeprom *hw = NULL; | ||
1485 | 1483 | ||
1486 | rrpriv = netdev_priv(dev); | 1484 | rrpriv = netdev_priv(dev); |
1487 | regs = rrpriv->regs; | 1485 | regs = rrpriv->regs; |
@@ -1509,7 +1507,7 @@ static int rr_load_firmware(struct net_device *dev) | |||
1509 | */ | 1507 | */ |
1510 | io = readl(®s->ExtIo); | 1508 | io = readl(®s->ExtIo); |
1511 | writel(0, ®s->ExtIo); | 1509 | writel(0, ®s->ExtIo); |
1512 | sram_size = rr_read_eeprom_word(rrpriv, (void *)8); | 1510 | sram_size = rr_read_eeprom_word(rrpriv, 8); |
1513 | 1511 | ||
1514 | for (i = 200; i < sram_size / 4; i++){ | 1512 | for (i = 200; i < sram_size / 4; i++){ |
1515 | writel(i * 4, ®s->WinBase); | 1513 | writel(i * 4, ®s->WinBase); |
@@ -1520,13 +1518,13 @@ static int rr_load_firmware(struct net_device *dev) | |||
1520 | writel(io, ®s->ExtIo); | 1518 | writel(io, ®s->ExtIo); |
1521 | mb(); | 1519 | mb(); |
1522 | 1520 | ||
1523 | eptr = (unsigned long)rr_read_eeprom_word(rrpriv, | 1521 | eptr = rr_read_eeprom_word(rrpriv, |
1524 | &hw->rncd_info.AddrRunCodeSegs); | 1522 | offsetof(struct eeprom, rncd_info.AddrRunCodeSegs)); |
1525 | eptr = ((eptr & 0x1fffff) >> 3); | 1523 | eptr = ((eptr & 0x1fffff) >> 3); |
1526 | 1524 | ||
1527 | p2len = rr_read_eeprom_word(rrpriv, (void *)(0x83*4)); | 1525 | p2len = rr_read_eeprom_word(rrpriv, 0x83*4); |
1528 | p2len = (p2len << 2); | 1526 | p2len = (p2len << 2); |
1529 | p2size = rr_read_eeprom_word(rrpriv, (void *)(0x84*4)); | 1527 | p2size = rr_read_eeprom_word(rrpriv, 0x84*4); |
1530 | p2size = ((p2size & 0x1fffff) >> 3); | 1528 | p2size = ((p2size & 0x1fffff) >> 3); |
1531 | 1529 | ||
1532 | if ((eptr < p2size) || (eptr > (p2size + p2len))){ | 1530 | if ((eptr < p2size) || (eptr > (p2size + p2len))){ |
@@ -1534,7 +1532,8 @@ static int rr_load_firmware(struct net_device *dev) | |||
1534 | goto out; | 1532 | goto out; |
1535 | } | 1533 | } |
1536 | 1534 | ||
1537 | revision = rr_read_eeprom_word(rrpriv, &hw->manf.HeaderFmt); | 1535 | revision = rr_read_eeprom_word(rrpriv, |
1536 | offsetof(struct eeprom, manf.HeaderFmt)); | ||
1538 | 1537 | ||
1539 | if (revision != 1){ | 1538 | if (revision != 1){ |
1540 | printk("%s: invalid firmware format (%i)\n", | 1539 | printk("%s: invalid firmware format (%i)\n", |
@@ -1542,18 +1541,18 @@ static int rr_load_firmware(struct net_device *dev) | |||
1542 | goto out; | 1541 | goto out; |
1543 | } | 1542 | } |
1544 | 1543 | ||
1545 | nr_seg = rr_read_eeprom_word(rrpriv, (void *)eptr); | 1544 | nr_seg = rr_read_eeprom_word(rrpriv, eptr); |
1546 | eptr +=4; | 1545 | eptr +=4; |
1547 | #if (DEBUG > 1) | 1546 | #if (DEBUG > 1) |
1548 | printk("%s: nr_seg %i\n", dev->name, nr_seg); | 1547 | printk("%s: nr_seg %i\n", dev->name, nr_seg); |
1549 | #endif | 1548 | #endif |
1550 | 1549 | ||
1551 | for (i = 0; i < nr_seg; i++){ | 1550 | for (i = 0; i < nr_seg; i++){ |
1552 | sptr = rr_read_eeprom_word(rrpriv, (void *)eptr); | 1551 | sptr = rr_read_eeprom_word(rrpriv, eptr); |
1553 | eptr += 4; | 1552 | eptr += 4; |
1554 | len = rr_read_eeprom_word(rrpriv, (void *)eptr); | 1553 | len = rr_read_eeprom_word(rrpriv, eptr); |
1555 | eptr += 4; | 1554 | eptr += 4; |
1556 | segptr = (unsigned long)rr_read_eeprom_word(rrpriv, (void *)eptr); | 1555 | segptr = rr_read_eeprom_word(rrpriv, eptr); |
1557 | segptr = ((segptr & 0x1fffff) >> 3); | 1556 | segptr = ((segptr & 0x1fffff) >> 3); |
1558 | eptr += 4; | 1557 | eptr += 4; |
1559 | #if (DEBUG > 1) | 1558 | #if (DEBUG > 1) |
@@ -1561,7 +1560,7 @@ static int rr_load_firmware(struct net_device *dev) | |||
1561 | dev->name, i, sptr, len, segptr); | 1560 | dev->name, i, sptr, len, segptr); |
1562 | #endif | 1561 | #endif |
1563 | for (j = 0; j < len; j++){ | 1562 | for (j = 0; j < len; j++){ |
1564 | tmp = rr_read_eeprom_word(rrpriv, (void *)segptr); | 1563 | tmp = rr_read_eeprom_word(rrpriv, segptr); |
1565 | writel(sptr, ®s->WinBase); | 1564 | writel(sptr, ®s->WinBase); |
1566 | mb(); | 1565 | mb(); |
1567 | writel(tmp, ®s->WinData); | 1566 | writel(tmp, ®s->WinData); |
diff --git a/drivers/net/rrunner.h b/drivers/net/rrunner.h index 6a79825bc8cf..6173f11218df 100644 --- a/drivers/net/rrunner.h +++ b/drivers/net/rrunner.h | |||
@@ -838,7 +838,7 @@ static unsigned int rr_read_eeprom(struct rr_private *rrpriv, | |||
838 | unsigned long offset, | 838 | unsigned long offset, |
839 | unsigned char *buf, | 839 | unsigned char *buf, |
840 | unsigned long length); | 840 | unsigned long length); |
841 | static u32 rr_read_eeprom_word(struct rr_private *rrpriv, void * offset); | 841 | static u32 rr_read_eeprom_word(struct rr_private *rrpriv, size_t offset); |
842 | static int rr_load_firmware(struct net_device *dev); | 842 | static int rr_load_firmware(struct net_device *dev); |
843 | static inline void rr_raz_tx(struct rr_private *, struct net_device *); | 843 | static inline void rr_raz_tx(struct rr_private *, struct net_device *); |
844 | static inline void rr_raz_rx(struct rr_private *, struct net_device *); | 844 | static inline void rr_raz_rx(struct rr_private *, struct net_device *); |
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. */ |
90 | static char s2io_driver_name[] = "Neterion"; | 90 | static 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 | ||
3897 | hw_init_failed: | 3892 | hw_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 | ||
950 | static inline struct tx_ring_info *tx_le_re(struct sky2_port *sky2, | 949 | static 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/tc35815.c b/drivers/net/tc35815.c index d887c05588d5..370d329d15d9 100644 --- a/drivers/net/tc35815.c +++ b/drivers/net/tc35815.c | |||
@@ -611,7 +611,7 @@ static int __devinit tc35815_mac_match(struct device *dev, void *data) | |||
611 | { | 611 | { |
612 | struct platform_device *plat_dev = to_platform_device(dev); | 612 | struct platform_device *plat_dev = to_platform_device(dev); |
613 | struct pci_dev *pci_dev = data; | 613 | struct pci_dev *pci_dev = data; |
614 | unsigned int id = (pci_dev->bus->number << 8) | pci_dev->devfn; | 614 | unsigned int id = pci_dev->irq; |
615 | return !strcmp(plat_dev->name, "tc35815-mac") && plat_dev->id == id; | 615 | return !strcmp(plat_dev->name, "tc35815-mac") && plat_dev->id == id; |
616 | } | 616 | } |
617 | 617 | ||
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 4942f7d18937..22eb7c8c1a25 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -8189,6 +8189,7 @@ static int tg3_get_eeprom_len(struct net_device *dev) | |||
8189 | } | 8189 | } |
8190 | 8190 | ||
8191 | static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val); | 8191 | static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val); |
8192 | static int tg3_nvram_read_le(struct tg3 *tp, u32 offset, __le32 *val); | ||
8192 | static int tg3_nvram_read_swab(struct tg3 *tp, u32 offset, u32 *val); | 8193 | static int tg3_nvram_read_swab(struct tg3 *tp, u32 offset, u32 *val); |
8193 | 8194 | ||
8194 | static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 *data) | 8195 | static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 *data) |
@@ -8196,7 +8197,8 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
8196 | struct tg3 *tp = netdev_priv(dev); | 8197 | struct tg3 *tp = netdev_priv(dev); |
8197 | int ret; | 8198 | int ret; |
8198 | u8 *pd; | 8199 | u8 *pd; |
8199 | u32 i, offset, len, val, b_offset, b_count; | 8200 | u32 i, offset, len, b_offset, b_count; |
8201 | __le32 val; | ||
8200 | 8202 | ||
8201 | if (tp->link_config.phy_is_low_power) | 8203 | if (tp->link_config.phy_is_low_power) |
8202 | return -EAGAIN; | 8204 | return -EAGAIN; |
@@ -8215,10 +8217,9 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
8215 | /* i.e. offset=1 len=2 */ | 8217 | /* i.e. offset=1 len=2 */ |
8216 | b_count = len; | 8218 | b_count = len; |
8217 | } | 8219 | } |
8218 | ret = tg3_nvram_read(tp, offset-b_offset, &val); | 8220 | ret = tg3_nvram_read_le(tp, offset-b_offset, &val); |
8219 | if (ret) | 8221 | if (ret) |
8220 | return ret; | 8222 | return ret; |
8221 | val = cpu_to_le32(val); | ||
8222 | memcpy(data, ((char*)&val) + b_offset, b_count); | 8223 | memcpy(data, ((char*)&val) + b_offset, b_count); |
8223 | len -= b_count; | 8224 | len -= b_count; |
8224 | offset += b_count; | 8225 | offset += b_count; |
@@ -8228,12 +8229,11 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
8228 | /* read bytes upto the last 4 byte boundary */ | 8229 | /* read bytes upto the last 4 byte boundary */ |
8229 | pd = &data[eeprom->len]; | 8230 | pd = &data[eeprom->len]; |
8230 | for (i = 0; i < (len - (len & 3)); i += 4) { | 8231 | for (i = 0; i < (len - (len & 3)); i += 4) { |
8231 | ret = tg3_nvram_read(tp, offset + i, &val); | 8232 | ret = tg3_nvram_read_le(tp, offset + i, &val); |
8232 | if (ret) { | 8233 | if (ret) { |
8233 | eeprom->len += i; | 8234 | eeprom->len += i; |
8234 | return ret; | 8235 | return ret; |
8235 | } | 8236 | } |
8236 | val = cpu_to_le32(val); | ||
8237 | memcpy(pd + i, &val, 4); | 8237 | memcpy(pd + i, &val, 4); |
8238 | } | 8238 | } |
8239 | eeprom->len += i; | 8239 | eeprom->len += i; |
@@ -8243,11 +8243,10 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
8243 | pd = &data[eeprom->len]; | 8243 | pd = &data[eeprom->len]; |
8244 | b_count = len & 3; | 8244 | b_count = len & 3; |
8245 | b_offset = offset + len - b_count; | 8245 | b_offset = offset + len - b_count; |
8246 | ret = tg3_nvram_read(tp, b_offset, &val); | 8246 | ret = tg3_nvram_read_le(tp, b_offset, &val); |
8247 | if (ret) | 8247 | if (ret) |
8248 | return ret; | 8248 | return ret; |
8249 | val = cpu_to_le32(val); | 8249 | memcpy(pd, &val, b_count); |
8250 | memcpy(pd, ((char*)&val), b_count); | ||
8251 | eeprom->len += b_count; | 8250 | eeprom->len += b_count; |
8252 | } | 8251 | } |
8253 | return 0; | 8252 | return 0; |
@@ -8259,8 +8258,9 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
8259 | { | 8258 | { |
8260 | struct tg3 *tp = netdev_priv(dev); | 8259 | struct tg3 *tp = netdev_priv(dev); |
8261 | int ret; | 8260 | int ret; |
8262 | u32 offset, len, b_offset, odd_len, start, end; | 8261 | u32 offset, len, b_offset, odd_len; |
8263 | u8 *buf; | 8262 | u8 *buf; |
8263 | __le32 start, end; | ||
8264 | 8264 | ||
8265 | if (tp->link_config.phy_is_low_power) | 8265 | if (tp->link_config.phy_is_low_power) |
8266 | return -EAGAIN; | 8266 | return -EAGAIN; |
@@ -8273,10 +8273,9 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
8273 | 8273 | ||
8274 | if ((b_offset = (offset & 3))) { | 8274 | if ((b_offset = (offset & 3))) { |
8275 | /* adjustments to start on required 4 byte boundary */ | 8275 | /* adjustments to start on required 4 byte boundary */ |
8276 | ret = tg3_nvram_read(tp, offset-b_offset, &start); | 8276 | ret = tg3_nvram_read_le(tp, offset-b_offset, &start); |
8277 | if (ret) | 8277 | if (ret) |
8278 | return ret; | 8278 | return ret; |
8279 | start = cpu_to_le32(start); | ||
8280 | len += b_offset; | 8279 | len += b_offset; |
8281 | offset &= ~3; | 8280 | offset &= ~3; |
8282 | if (len < 4) | 8281 | if (len < 4) |
@@ -8288,10 +8287,9 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
8288 | /* adjustments to end on required 4 byte boundary */ | 8287 | /* adjustments to end on required 4 byte boundary */ |
8289 | odd_len = 1; | 8288 | odd_len = 1; |
8290 | len = (len + 3) & ~3; | 8289 | len = (len + 3) & ~3; |
8291 | ret = tg3_nvram_read(tp, offset+len-4, &end); | 8290 | ret = tg3_nvram_read_le(tp, offset+len-4, &end); |
8292 | if (ret) | 8291 | if (ret) |
8293 | return ret; | 8292 | return ret; |
8294 | end = cpu_to_le32(end); | ||
8295 | } | 8293 | } |
8296 | 8294 | ||
8297 | buf = data; | 8295 | buf = data; |
@@ -8734,7 +8732,8 @@ static void tg3_get_ethtool_stats (struct net_device *dev, | |||
8734 | 8732 | ||
8735 | static int tg3_test_nvram(struct tg3 *tp) | 8733 | static int tg3_test_nvram(struct tg3 *tp) |
8736 | { | 8734 | { |
8737 | u32 *buf, csum, magic; | 8735 | u32 csum, magic; |
8736 | __le32 *buf; | ||
8738 | int i, j, k, err = 0, size; | 8737 | int i, j, k, err = 0, size; |
8739 | 8738 | ||
8740 | if (tg3_nvram_read_swab(tp, 0, &magic) != 0) | 8739 | if (tg3_nvram_read_swab(tp, 0, &magic) != 0) |
@@ -8771,21 +8770,19 @@ static int tg3_test_nvram(struct tg3 *tp) | |||
8771 | 8770 | ||
8772 | err = -EIO; | 8771 | err = -EIO; |
8773 | for (i = 0, j = 0; i < size; i += 4, j++) { | 8772 | for (i = 0, j = 0; i < size; i += 4, j++) { |
8774 | u32 val; | 8773 | if ((err = tg3_nvram_read_le(tp, i, &buf[j])) != 0) |
8775 | |||
8776 | if ((err = tg3_nvram_read(tp, i, &val)) != 0) | ||
8777 | break; | 8774 | break; |
8778 | buf[j] = cpu_to_le32(val); | ||
8779 | } | 8775 | } |
8780 | if (i < size) | 8776 | if (i < size) |
8781 | goto out; | 8777 | goto out; |
8782 | 8778 | ||
8783 | /* Selfboot format */ | 8779 | /* Selfboot format */ |
8784 | if ((cpu_to_be32(buf[0]) & TG3_EEPROM_MAGIC_FW_MSK) == | 8780 | magic = swab32(le32_to_cpu(buf[0])); |
8781 | if ((magic & TG3_EEPROM_MAGIC_FW_MSK) == | ||
8785 | TG3_EEPROM_MAGIC_FW) { | 8782 | TG3_EEPROM_MAGIC_FW) { |
8786 | u8 *buf8 = (u8 *) buf, csum8 = 0; | 8783 | u8 *buf8 = (u8 *) buf, csum8 = 0; |
8787 | 8784 | ||
8788 | if ((cpu_to_be32(buf[0]) & TG3_EEPROM_SB_REVISION_MASK) == | 8785 | if ((magic & TG3_EEPROM_SB_REVISION_MASK) == |
8789 | TG3_EEPROM_SB_REVISION_2) { | 8786 | TG3_EEPROM_SB_REVISION_2) { |
8790 | /* For rev 2, the csum doesn't include the MBA. */ | 8787 | /* For rev 2, the csum doesn't include the MBA. */ |
8791 | for (i = 0; i < TG3_EEPROM_SB_F1R2_MBA_OFF; i++) | 8788 | for (i = 0; i < TG3_EEPROM_SB_F1R2_MBA_OFF; i++) |
@@ -8806,7 +8803,7 @@ static int tg3_test_nvram(struct tg3 *tp) | |||
8806 | goto out; | 8803 | goto out; |
8807 | } | 8804 | } |
8808 | 8805 | ||
8809 | if ((cpu_to_be32(buf[0]) & TG3_EEPROM_MAGIC_HW_MSK) == | 8806 | if ((magic & TG3_EEPROM_MAGIC_HW_MSK) == |
8810 | TG3_EEPROM_MAGIC_HW) { | 8807 | TG3_EEPROM_MAGIC_HW) { |
8811 | u8 data[NVRAM_SELFBOOT_DATA_SIZE]; | 8808 | u8 data[NVRAM_SELFBOOT_DATA_SIZE]; |
8812 | u8 parity[NVRAM_SELFBOOT_DATA_SIZE]; | 8809 | u8 parity[NVRAM_SELFBOOT_DATA_SIZE]; |
@@ -8852,12 +8849,12 @@ static int tg3_test_nvram(struct tg3 *tp) | |||
8852 | 8849 | ||
8853 | /* Bootstrap checksum at offset 0x10 */ | 8850 | /* Bootstrap checksum at offset 0x10 */ |
8854 | csum = calc_crc((unsigned char *) buf, 0x10); | 8851 | csum = calc_crc((unsigned char *) buf, 0x10); |
8855 | if(csum != cpu_to_le32(buf[0x10/4])) | 8852 | if(csum != le32_to_cpu(buf[0x10/4])) |
8856 | goto out; | 8853 | goto out; |
8857 | 8854 | ||
8858 | /* Manufacturing block starts at offset 0x74, checksum at 0xfc */ | 8855 | /* Manufacturing block starts at offset 0x74, checksum at 0xfc */ |
8859 | csum = calc_crc((unsigned char *) &buf[0x74/4], 0x88); | 8856 | csum = calc_crc((unsigned char *) &buf[0x74/4], 0x88); |
8860 | if (csum != cpu_to_le32(buf[0xfc/4])) | 8857 | if (csum != le32_to_cpu(buf[0xfc/4])) |
8861 | goto out; | 8858 | goto out; |
8862 | 8859 | ||
8863 | err = 0; | 8860 | err = 0; |
@@ -10171,6 +10168,15 @@ static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val) | |||
10171 | return ret; | 10168 | return ret; |
10172 | } | 10169 | } |
10173 | 10170 | ||
10171 | static int tg3_nvram_read_le(struct tg3 *tp, u32 offset, __le32 *val) | ||
10172 | { | ||
10173 | u32 v; | ||
10174 | int res = tg3_nvram_read(tp, offset, &v); | ||
10175 | if (!res) | ||
10176 | *val = cpu_to_le32(v); | ||
10177 | return res; | ||
10178 | } | ||
10179 | |||
10174 | static int tg3_nvram_read_swab(struct tg3 *tp, u32 offset, u32 *val) | 10180 | static int tg3_nvram_read_swab(struct tg3 *tp, u32 offset, u32 *val) |
10175 | { | 10181 | { |
10176 | int err; | 10182 | int err; |
@@ -10188,13 +10194,14 @@ static int tg3_nvram_write_block_using_eeprom(struct tg3 *tp, | |||
10188 | u32 val; | 10194 | u32 val; |
10189 | 10195 | ||
10190 | for (i = 0; i < len; i += 4) { | 10196 | for (i = 0; i < len; i += 4) { |
10191 | u32 addr, data; | 10197 | u32 addr; |
10198 | __le32 data; | ||
10192 | 10199 | ||
10193 | addr = offset + i; | 10200 | addr = offset + i; |
10194 | 10201 | ||
10195 | memcpy(&data, buf + i, 4); | 10202 | memcpy(&data, buf + i, 4); |
10196 | 10203 | ||
10197 | tw32(GRC_EEPROM_DATA, cpu_to_le32(data)); | 10204 | tw32(GRC_EEPROM_DATA, le32_to_cpu(data)); |
10198 | 10205 | ||
10199 | val = tr32(GRC_EEPROM_ADDR); | 10206 | val = tr32(GRC_EEPROM_ADDR); |
10200 | tw32(GRC_EEPROM_ADDR, val | EEPROM_ADDR_COMPLETE); | 10207 | tw32(GRC_EEPROM_ADDR, val | EEPROM_ADDR_COMPLETE); |
@@ -10244,8 +10251,8 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len, | |||
10244 | phy_addr = offset & ~pagemask; | 10251 | phy_addr = offset & ~pagemask; |
10245 | 10252 | ||
10246 | for (j = 0; j < pagesize; j += 4) { | 10253 | for (j = 0; j < pagesize; j += 4) { |
10247 | if ((ret = tg3_nvram_read(tp, phy_addr + j, | 10254 | if ((ret = tg3_nvram_read_le(tp, phy_addr + j, |
10248 | (u32 *) (tmp + j)))) | 10255 | (__le32 *) (tmp + j)))) |
10249 | break; | 10256 | break; |
10250 | } | 10257 | } |
10251 | if (ret) | 10258 | if (ret) |
@@ -10289,10 +10296,11 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len, | |||
10289 | break; | 10296 | break; |
10290 | 10297 | ||
10291 | for (j = 0; j < pagesize; j += 4) { | 10298 | for (j = 0; j < pagesize; j += 4) { |
10292 | u32 data; | 10299 | __be32 data; |
10293 | 10300 | ||
10294 | data = *((u32 *) (tmp + j)); | 10301 | data = *((__be32 *) (tmp + j)); |
10295 | tw32(NVRAM_WRDATA, cpu_to_be32(data)); | 10302 | /* swab32(le32_to_cpu(data)), actually */ |
10303 | tw32(NVRAM_WRDATA, be32_to_cpu(data)); | ||
10296 | 10304 | ||
10297 | tw32(NVRAM_ADDR, phy_addr + j); | 10305 | tw32(NVRAM_ADDR, phy_addr + j); |
10298 | 10306 | ||
@@ -10326,10 +10334,11 @@ static int tg3_nvram_write_block_buffered(struct tg3 *tp, u32 offset, u32 len, | |||
10326 | int i, ret = 0; | 10334 | int i, ret = 0; |
10327 | 10335 | ||
10328 | for (i = 0; i < len; i += 4, offset += 4) { | 10336 | for (i = 0; i < len; i += 4, offset += 4) { |
10329 | u32 data, page_off, phy_addr, nvram_cmd; | 10337 | u32 page_off, phy_addr, nvram_cmd; |
10338 | __be32 data; | ||
10330 | 10339 | ||
10331 | memcpy(&data, buf + i, 4); | 10340 | memcpy(&data, buf + i, 4); |
10332 | tw32(NVRAM_WRDATA, cpu_to_be32(data)); | 10341 | tw32(NVRAM_WRDATA, be32_to_cpu(data)); |
10333 | 10342 | ||
10334 | page_off = offset % tp->nvram_pagesize; | 10343 | page_off = offset % tp->nvram_pagesize; |
10335 | 10344 | ||
@@ -10831,6 +10840,7 @@ static void __devinit tg3_read_partno(struct tg3 *tp) | |||
10831 | vpd_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_VPD); | 10840 | vpd_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_VPD); |
10832 | for (i = 0; i < 256; i += 4) { | 10841 | for (i = 0; i < 256; i += 4) { |
10833 | u32 tmp, j = 0; | 10842 | u32 tmp, j = 0; |
10843 | __le32 v; | ||
10834 | u16 tmp16; | 10844 | u16 tmp16; |
10835 | 10845 | ||
10836 | pci_write_config_word(tp->pdev, vpd_cap + PCI_VPD_ADDR, | 10846 | pci_write_config_word(tp->pdev, vpd_cap + PCI_VPD_ADDR, |
@@ -10847,8 +10857,8 @@ static void __devinit tg3_read_partno(struct tg3 *tp) | |||
10847 | 10857 | ||
10848 | pci_read_config_dword(tp->pdev, vpd_cap + PCI_VPD_DATA, | 10858 | pci_read_config_dword(tp->pdev, vpd_cap + PCI_VPD_DATA, |
10849 | &tmp); | 10859 | &tmp); |
10850 | tmp = cpu_to_le32(tmp); | 10860 | v = cpu_to_le32(tmp); |
10851 | memcpy(&vpd_data[i], &tmp, 4); | 10861 | memcpy(&vpd_data[i], &v, 4); |
10852 | } | 10862 | } |
10853 | } | 10863 | } |
10854 | 10864 | ||
@@ -10941,11 +10951,11 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp) | |||
10941 | 10951 | ||
10942 | offset = offset + ver_offset - start; | 10952 | offset = offset + ver_offset - start; |
10943 | for (i = 0; i < 16; i += 4) { | 10953 | for (i = 0; i < 16; i += 4) { |
10944 | if (tg3_nvram_read(tp, offset + i, &val)) | 10954 | __le32 v; |
10955 | if (tg3_nvram_read_le(tp, offset + i, &v)) | ||
10945 | return; | 10956 | return; |
10946 | 10957 | ||
10947 | val = le32_to_cpu(val); | 10958 | memcpy(tp->fw_ver + i, &v, 4); |
10948 | memcpy(tp->fw_ver + i, &val, 4); | ||
10949 | } | 10959 | } |
10950 | 10960 | ||
10951 | if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) || | 10961 | if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) || |
@@ -10983,19 +10993,19 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp) | |||
10983 | tp->fw_ver[bcnt++] = ' '; | 10993 | tp->fw_ver[bcnt++] = ' '; |
10984 | 10994 | ||
10985 | for (i = 0; i < 4; i++) { | 10995 | for (i = 0; i < 4; i++) { |
10986 | if (tg3_nvram_read(tp, offset, &val)) | 10996 | __le32 v; |
10997 | if (tg3_nvram_read_le(tp, offset, &v)) | ||
10987 | return; | 10998 | return; |
10988 | 10999 | ||
10989 | val = le32_to_cpu(val); | 11000 | offset += sizeof(v); |
10990 | offset += sizeof(val); | ||
10991 | 11001 | ||
10992 | if (bcnt > TG3_VER_SIZE - sizeof(val)) { | 11002 | if (bcnt > TG3_VER_SIZE - sizeof(v)) { |
10993 | memcpy(&tp->fw_ver[bcnt], &val, TG3_VER_SIZE - bcnt); | 11003 | memcpy(&tp->fw_ver[bcnt], &v, TG3_VER_SIZE - bcnt); |
10994 | break; | 11004 | break; |
10995 | } | 11005 | } |
10996 | 11006 | ||
10997 | memcpy(&tp->fw_ver[bcnt], &val, sizeof(val)); | 11007 | memcpy(&tp->fw_ver[bcnt], &v, sizeof(v)); |
10998 | bcnt += sizeof(val); | 11008 | bcnt += sizeof(v); |
10999 | } | 11009 | } |
11000 | 11010 | ||
11001 | tp->fw_ver[TG3_VER_SIZE - 1] = 0; | 11011 | tp->fw_ver[TG3_VER_SIZE - 1] = 0; |
diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c index 5d31519a6c67..44a06f8b588f 100644 --- a/drivers/net/tokenring/3c359.c +++ b/drivers/net/tokenring/3c359.c | |||
@@ -570,7 +570,7 @@ static int xl_open(struct net_device *dev) | |||
570 | struct xl_private *xl_priv=netdev_priv(dev); | 570 | struct xl_private *xl_priv=netdev_priv(dev); |
571 | u8 __iomem *xl_mmio = xl_priv->xl_mmio ; | 571 | u8 __iomem *xl_mmio = xl_priv->xl_mmio ; |
572 | u8 i ; | 572 | u8 i ; |
573 | u16 hwaddr[3] ; /* Should be u8[6] but we get word return values */ | 573 | __le16 hwaddr[3] ; /* Should be u8[6] but we get word return values */ |
574 | int open_err ; | 574 | int open_err ; |
575 | 575 | ||
576 | u16 switchsettings, switchsettings_eeprom ; | 576 | u16 switchsettings, switchsettings_eeprom ; |
@@ -580,15 +580,12 @@ static int xl_open(struct net_device *dev) | |||
580 | } | 580 | } |
581 | 581 | ||
582 | /* | 582 | /* |
583 | * Read the information from the EEPROM that we need. I know we | 583 | * Read the information from the EEPROM that we need. |
584 | * should use ntohs, but the word gets stored reversed in the 16 | ||
585 | * bit field anyway and it all works its self out when we memcpy | ||
586 | * it into dev->dev_addr. | ||
587 | */ | 584 | */ |
588 | 585 | ||
589 | hwaddr[0] = xl_ee_read(dev,0x10) ; | 586 | hwaddr[0] = cpu_to_le16(xl_ee_read(dev,0x10)); |
590 | hwaddr[1] = xl_ee_read(dev,0x11) ; | 587 | hwaddr[1] = cpu_to_le16(xl_ee_read(dev,0x11)); |
591 | hwaddr[2] = xl_ee_read(dev,0x12) ; | 588 | hwaddr[2] = cpu_to_le16(xl_ee_read(dev,0x12)); |
592 | 589 | ||
593 | /* Ring speed */ | 590 | /* Ring speed */ |
594 | 591 | ||
@@ -665,8 +662,8 @@ static int xl_open(struct net_device *dev) | |||
665 | break ; | 662 | break ; |
666 | 663 | ||
667 | skb->dev = dev ; | 664 | skb->dev = dev ; |
668 | xl_priv->xl_rx_ring[i].upfragaddr = pci_map_single(xl_priv->pdev, skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE) ; | 665 | xl_priv->xl_rx_ring[i].upfragaddr = cpu_to_le32(pci_map_single(xl_priv->pdev, skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE)); |
669 | xl_priv->xl_rx_ring[i].upfraglen = xl_priv->pkt_buf_sz | RXUPLASTFRAG; | 666 | xl_priv->xl_rx_ring[i].upfraglen = cpu_to_le32(xl_priv->pkt_buf_sz) | RXUPLASTFRAG; |
670 | xl_priv->rx_ring_skb[i] = skb ; | 667 | xl_priv->rx_ring_skb[i] = skb ; |
671 | } | 668 | } |
672 | 669 | ||
@@ -680,7 +677,7 @@ static int xl_open(struct net_device *dev) | |||
680 | xl_priv->rx_ring_tail = 0 ; | 677 | xl_priv->rx_ring_tail = 0 ; |
681 | xl_priv->rx_ring_dma_addr = pci_map_single(xl_priv->pdev,xl_priv->xl_rx_ring, sizeof(struct xl_rx_desc) * XL_RX_RING_SIZE, PCI_DMA_TODEVICE) ; | 678 | xl_priv->rx_ring_dma_addr = pci_map_single(xl_priv->pdev,xl_priv->xl_rx_ring, sizeof(struct xl_rx_desc) * XL_RX_RING_SIZE, PCI_DMA_TODEVICE) ; |
682 | for (i=0;i<(xl_priv->rx_ring_no-1);i++) { | 679 | for (i=0;i<(xl_priv->rx_ring_no-1);i++) { |
683 | xl_priv->xl_rx_ring[i].upnextptr = xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * (i+1)) ; | 680 | xl_priv->xl_rx_ring[i].upnextptr = cpu_to_le32(xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * (i+1))); |
684 | } | 681 | } |
685 | xl_priv->xl_rx_ring[i].upnextptr = 0 ; | 682 | xl_priv->xl_rx_ring[i].upnextptr = 0 ; |
686 | 683 | ||
@@ -698,7 +695,7 @@ static int xl_open(struct net_device *dev) | |||
698 | * Setup the first dummy DPD entry for polling to start working. | 695 | * Setup the first dummy DPD entry for polling to start working. |
699 | */ | 696 | */ |
700 | 697 | ||
701 | xl_priv->xl_tx_ring[0].framestartheader = TXDPDEMPTY ; | 698 | xl_priv->xl_tx_ring[0].framestartheader = TXDPDEMPTY; |
702 | xl_priv->xl_tx_ring[0].buffer = 0 ; | 699 | xl_priv->xl_tx_ring[0].buffer = 0 ; |
703 | xl_priv->xl_tx_ring[0].buffer_length = 0 ; | 700 | xl_priv->xl_tx_ring[0].buffer_length = 0 ; |
704 | xl_priv->xl_tx_ring[0].dnnextptr = 0 ; | 701 | xl_priv->xl_tx_ring[0].dnnextptr = 0 ; |
@@ -811,17 +808,17 @@ static int xl_open_hw(struct net_device *dev) | |||
811 | return open_err ; | 808 | return open_err ; |
812 | } else { | 809 | } else { |
813 | writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 8, xl_mmio + MMIO_MAC_ACCESS_CMD) ; | 810 | writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 8, xl_mmio + MMIO_MAC_ACCESS_CMD) ; |
814 | xl_priv->asb = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; | 811 | xl_priv->asb = swab16(readw(xl_mmio + MMIO_MACDATA)) ; |
815 | printk(KERN_INFO "%s: Adapter Opened Details: ",dev->name) ; | 812 | printk(KERN_INFO "%s: Adapter Opened Details: ",dev->name) ; |
816 | printk("ASB: %04x",xl_priv->asb ) ; | 813 | printk("ASB: %04x",xl_priv->asb ) ; |
817 | writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 10, xl_mmio + MMIO_MAC_ACCESS_CMD) ; | 814 | writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 10, xl_mmio + MMIO_MAC_ACCESS_CMD) ; |
818 | printk(", SRB: %04x",ntohs(readw(xl_mmio + MMIO_MACDATA)) ) ; | 815 | printk(", SRB: %04x",swab16(readw(xl_mmio + MMIO_MACDATA)) ) ; |
819 | 816 | ||
820 | writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 12, xl_mmio + MMIO_MAC_ACCESS_CMD) ; | 817 | writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 12, xl_mmio + MMIO_MAC_ACCESS_CMD) ; |
821 | xl_priv->arb = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; | 818 | xl_priv->arb = swab16(readw(xl_mmio + MMIO_MACDATA)) ; |
822 | printk(", ARB: %04x \n",xl_priv->arb ) ; | 819 | printk(", ARB: %04x \n",xl_priv->arb ) ; |
823 | writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 14, xl_mmio + MMIO_MAC_ACCESS_CMD) ; | 820 | writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 14, xl_mmio + MMIO_MAC_ACCESS_CMD) ; |
824 | vsoff = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; | 821 | vsoff = swab16(readw(xl_mmio + MMIO_MACDATA)) ; |
825 | 822 | ||
826 | /* | 823 | /* |
827 | * Interesting, sending the individual characters directly to printk was causing klogd to use | 824 | * Interesting, sending the individual characters directly to printk was causing klogd to use |
@@ -873,16 +870,15 @@ static int xl_open_hw(struct net_device *dev) | |||
873 | static void adv_rx_ring(struct net_device *dev) /* Advance rx_ring, cut down on bloat in xl_rx */ | 870 | static void adv_rx_ring(struct net_device *dev) /* Advance rx_ring, cut down on bloat in xl_rx */ |
874 | { | 871 | { |
875 | struct xl_private *xl_priv=netdev_priv(dev); | 872 | struct xl_private *xl_priv=netdev_priv(dev); |
876 | int prev_ring_loc ; | 873 | int n = xl_priv->rx_ring_tail; |
877 | 874 | int prev_ring_loc; | |
878 | prev_ring_loc = (xl_priv->rx_ring_tail + XL_RX_RING_SIZE - 1) & (XL_RX_RING_SIZE - 1); | 875 | |
879 | xl_priv->xl_rx_ring[prev_ring_loc].upnextptr = xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * xl_priv->rx_ring_tail) ; | 876 | prev_ring_loc = (n + XL_RX_RING_SIZE - 1) & (XL_RX_RING_SIZE - 1); |
880 | xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].framestatus = 0 ; | 877 | xl_priv->xl_rx_ring[prev_ring_loc].upnextptr = cpu_to_le32(xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * n)); |
881 | xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upnextptr = 0 ; | 878 | xl_priv->xl_rx_ring[n].framestatus = 0; |
882 | xl_priv->rx_ring_tail++ ; | 879 | xl_priv->xl_rx_ring[n].upnextptr = 0; |
883 | xl_priv->rx_ring_tail &= (XL_RX_RING_SIZE-1) ; | 880 | xl_priv->rx_ring_tail++; |
884 | 881 | xl_priv->rx_ring_tail &= (XL_RX_RING_SIZE-1); | |
885 | return ; | ||
886 | } | 882 | } |
887 | 883 | ||
888 | static void xl_rx(struct net_device *dev) | 884 | static void xl_rx(struct net_device *dev) |
@@ -914,7 +910,7 @@ static void xl_rx(struct net_device *dev) | |||
914 | temp_ring_loc &= (XL_RX_RING_SIZE-1) ; | 910 | temp_ring_loc &= (XL_RX_RING_SIZE-1) ; |
915 | } | 911 | } |
916 | 912 | ||
917 | frame_length = xl_priv->xl_rx_ring[temp_ring_loc].framestatus & 0x7FFF ; | 913 | frame_length = le32_to_cpu(xl_priv->xl_rx_ring[temp_ring_loc].framestatus) & 0x7FFF; |
918 | 914 | ||
919 | skb = dev_alloc_skb(frame_length) ; | 915 | skb = dev_alloc_skb(frame_length) ; |
920 | 916 | ||
@@ -931,29 +927,29 @@ static void xl_rx(struct net_device *dev) | |||
931 | } | 927 | } |
932 | 928 | ||
933 | while (xl_priv->rx_ring_tail != temp_ring_loc) { | 929 | while (xl_priv->rx_ring_tail != temp_ring_loc) { |
934 | copy_len = xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen & 0x7FFF ; | 930 | copy_len = le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen) & 0x7FFF; |
935 | frame_length -= copy_len ; | 931 | frame_length -= copy_len ; |
936 | pci_dma_sync_single_for_cpu(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; | 932 | pci_dma_sync_single_for_cpu(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE); |
937 | skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail], | 933 | skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail], |
938 | skb_put(skb, copy_len), | 934 | skb_put(skb, copy_len), |
939 | copy_len); | 935 | copy_len); |
940 | pci_dma_sync_single_for_device(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; | 936 | pci_dma_sync_single_for_device(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE); |
941 | adv_rx_ring(dev) ; | 937 | adv_rx_ring(dev) ; |
942 | } | 938 | } |
943 | 939 | ||
944 | /* Now we have found the last fragment */ | 940 | /* Now we have found the last fragment */ |
945 | pci_dma_sync_single_for_cpu(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; | 941 | pci_dma_sync_single_for_cpu(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE); |
946 | skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail], | 942 | skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail], |
947 | skb_put(skb,copy_len), frame_length); | 943 | skb_put(skb,copy_len), frame_length); |
948 | /* memcpy(skb_put(skb,frame_length), bus_to_virt(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr), frame_length) ; */ | 944 | /* memcpy(skb_put(skb,frame_length), bus_to_virt(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr), frame_length) ; */ |
949 | pci_dma_sync_single_for_device(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; | 945 | pci_dma_sync_single_for_device(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE); |
950 | adv_rx_ring(dev) ; | 946 | adv_rx_ring(dev) ; |
951 | skb->protocol = tr_type_trans(skb,dev) ; | 947 | skb->protocol = tr_type_trans(skb,dev) ; |
952 | netif_rx(skb) ; | 948 | netif_rx(skb) ; |
953 | 949 | ||
954 | } else { /* Single Descriptor Used, simply swap buffers over, fast path */ | 950 | } else { /* Single Descriptor Used, simply swap buffers over, fast path */ |
955 | 951 | ||
956 | frame_length = xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].framestatus & 0x7FFF ; | 952 | frame_length = le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].framestatus) & 0x7FFF; |
957 | 953 | ||
958 | skb = dev_alloc_skb(xl_priv->pkt_buf_sz) ; | 954 | skb = dev_alloc_skb(xl_priv->pkt_buf_sz) ; |
959 | 955 | ||
@@ -966,13 +962,13 @@ static void xl_rx(struct net_device *dev) | |||
966 | } | 962 | } |
967 | 963 | ||
968 | skb2 = xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] ; | 964 | skb2 = xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] ; |
969 | pci_unmap_single(xl_priv->pdev, xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr, xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; | 965 | pci_unmap_single(xl_priv->pdev, le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr), xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; |
970 | skb_put(skb2, frame_length) ; | 966 | skb_put(skb2, frame_length) ; |
971 | skb2->protocol = tr_type_trans(skb2,dev) ; | 967 | skb2->protocol = tr_type_trans(skb2,dev) ; |
972 | 968 | ||
973 | xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] = skb ; | 969 | xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] = skb ; |
974 | xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr = pci_map_single(xl_priv->pdev,skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE) ; | 970 | xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr = cpu_to_le32(pci_map_single(xl_priv->pdev,skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE)); |
975 | xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen = xl_priv->pkt_buf_sz | RXUPLASTFRAG ; | 971 | xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen = cpu_to_le32(xl_priv->pkt_buf_sz) | RXUPLASTFRAG; |
976 | adv_rx_ring(dev) ; | 972 | adv_rx_ring(dev) ; |
977 | xl_priv->xl_stats.rx_packets++ ; | 973 | xl_priv->xl_stats.rx_packets++ ; |
978 | xl_priv->xl_stats.rx_bytes += frame_length ; | 974 | xl_priv->xl_stats.rx_bytes += frame_length ; |
@@ -1022,7 +1018,7 @@ static void xl_freemem(struct net_device *dev) | |||
1022 | 1018 | ||
1023 | for (i=0;i<XL_RX_RING_SIZE;i++) { | 1019 | for (i=0;i<XL_RX_RING_SIZE;i++) { |
1024 | dev_kfree_skb_irq(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail]) ; | 1020 | dev_kfree_skb_irq(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail]) ; |
1025 | pci_unmap_single(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE) ; | 1021 | pci_unmap_single(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE); |
1026 | xl_priv->rx_ring_tail++ ; | 1022 | xl_priv->rx_ring_tail++ ; |
1027 | xl_priv->rx_ring_tail &= XL_RX_RING_SIZE-1; | 1023 | xl_priv->rx_ring_tail &= XL_RX_RING_SIZE-1; |
1028 | } | 1024 | } |
@@ -1181,9 +1177,9 @@ static int xl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1181 | 1177 | ||
1182 | txd = &(xl_priv->xl_tx_ring[tx_head]) ; | 1178 | txd = &(xl_priv->xl_tx_ring[tx_head]) ; |
1183 | txd->dnnextptr = 0 ; | 1179 | txd->dnnextptr = 0 ; |
1184 | txd->framestartheader = skb->len | TXDNINDICATE ; | 1180 | txd->framestartheader = cpu_to_le32(skb->len) | TXDNINDICATE; |
1185 | txd->buffer = pci_map_single(xl_priv->pdev, skb->data, skb->len, PCI_DMA_TODEVICE) ; | 1181 | txd->buffer = cpu_to_le32(pci_map_single(xl_priv->pdev, skb->data, skb->len, PCI_DMA_TODEVICE)); |
1186 | txd->buffer_length = skb->len | TXDNFRAGLAST ; | 1182 | txd->buffer_length = cpu_to_le32(skb->len) | TXDNFRAGLAST; |
1187 | xl_priv->tx_ring_skb[tx_head] = skb ; | 1183 | xl_priv->tx_ring_skb[tx_head] = skb ; |
1188 | xl_priv->xl_stats.tx_packets++ ; | 1184 | xl_priv->xl_stats.tx_packets++ ; |
1189 | xl_priv->xl_stats.tx_bytes += skb->len ; | 1185 | xl_priv->xl_stats.tx_bytes += skb->len ; |
@@ -1199,7 +1195,7 @@ static int xl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1199 | xl_priv->tx_ring_head &= (XL_TX_RING_SIZE - 1) ; | 1195 | xl_priv->tx_ring_head &= (XL_TX_RING_SIZE - 1) ; |
1200 | xl_priv->free_ring_entries-- ; | 1196 | xl_priv->free_ring_entries-- ; |
1201 | 1197 | ||
1202 | xl_priv->xl_tx_ring[tx_prev].dnnextptr = xl_priv->tx_ring_dma_addr + (sizeof (struct xl_tx_desc) * tx_head) ; | 1198 | xl_priv->xl_tx_ring[tx_prev].dnnextptr = cpu_to_le32(xl_priv->tx_ring_dma_addr + (sizeof (struct xl_tx_desc) * tx_head)); |
1203 | 1199 | ||
1204 | /* Sneaky, by doing a read on DnListPtr we can force the card to poll on the DnNextPtr */ | 1200 | /* Sneaky, by doing a read on DnListPtr we can force the card to poll on the DnNextPtr */ |
1205 | /* readl(xl_mmio + MMIO_DNLISTPTR) ; */ | 1201 | /* readl(xl_mmio + MMIO_DNLISTPTR) ; */ |
@@ -1237,9 +1233,9 @@ static void xl_dn_comp(struct net_device *dev) | |||
1237 | 1233 | ||
1238 | while (xl_priv->xl_tx_ring[xl_priv->tx_ring_tail].framestartheader & TXDNCOMPLETE ) { | 1234 | while (xl_priv->xl_tx_ring[xl_priv->tx_ring_tail].framestartheader & TXDNCOMPLETE ) { |
1239 | txd = &(xl_priv->xl_tx_ring[xl_priv->tx_ring_tail]) ; | 1235 | txd = &(xl_priv->xl_tx_ring[xl_priv->tx_ring_tail]) ; |
1240 | pci_unmap_single(xl_priv->pdev,txd->buffer, xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]->len, PCI_DMA_TODEVICE) ; | 1236 | pci_unmap_single(xl_priv->pdev, le32_to_cpu(txd->buffer), xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]->len, PCI_DMA_TODEVICE); |
1241 | txd->framestartheader = 0 ; | 1237 | txd->framestartheader = 0 ; |
1242 | txd->buffer = 0xdeadbeef ; | 1238 | txd->buffer = cpu_to_le32(0xdeadbeef); |
1243 | txd->buffer_length = 0 ; | 1239 | txd->buffer_length = 0 ; |
1244 | dev_kfree_skb_irq(xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]) ; | 1240 | dev_kfree_skb_irq(xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]) ; |
1245 | xl_priv->tx_ring_tail++ ; | 1241 | xl_priv->tx_ring_tail++ ; |
@@ -1507,9 +1503,9 @@ static void xl_arb_cmd(struct net_device *dev) | |||
1507 | if (arb_cmd == RING_STATUS_CHANGE) { /* Ring.Status.Change */ | 1503 | if (arb_cmd == RING_STATUS_CHANGE) { /* Ring.Status.Change */ |
1508 | writel( ( (MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ; | 1504 | writel( ( (MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ; |
1509 | 1505 | ||
1510 | printk(KERN_INFO "%s: Ring Status Change: New Status = %04x\n", dev->name, ntohs(readw(xl_mmio + MMIO_MACDATA) )) ; | 1506 | printk(KERN_INFO "%s: Ring Status Change: New Status = %04x\n", dev->name, swab16(readw(xl_mmio + MMIO_MACDATA) )) ; |
1511 | 1507 | ||
1512 | lan_status = ntohs(readw(xl_mmio + MMIO_MACDATA)); | 1508 | lan_status = swab16(readw(xl_mmio + MMIO_MACDATA)); |
1513 | 1509 | ||
1514 | /* Acknowledge interrupt, this tells nic we are done with the arb */ | 1510 | /* Acknowledge interrupt, this tells nic we are done with the arb */ |
1515 | writel(ACK_INTERRUPT | ARBCACK | LATCH_ACK, xl_mmio + MMIO_COMMAND) ; | 1511 | writel(ACK_INTERRUPT | ARBCACK | LATCH_ACK, xl_mmio + MMIO_COMMAND) ; |
@@ -1573,7 +1569,7 @@ static void xl_arb_cmd(struct net_device *dev) | |||
1573 | printk(KERN_INFO "Received.Data \n") ; | 1569 | printk(KERN_INFO "Received.Data \n") ; |
1574 | #endif | 1570 | #endif |
1575 | writel( ((MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ; | 1571 | writel( ((MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ; |
1576 | xl_priv->mac_buffer = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; | 1572 | xl_priv->mac_buffer = swab16(readw(xl_mmio + MMIO_MACDATA)) ; |
1577 | 1573 | ||
1578 | /* Now we are going to be really basic here and not do anything | 1574 | /* Now we are going to be really basic here and not do anything |
1579 | * with the data at all. The tech docs do not give me enough | 1575 | * with the data at all. The tech docs do not give me enough |
@@ -1634,7 +1630,7 @@ static void xl_asb_cmd(struct net_device *dev) | |||
1634 | writeb(0x81, xl_mmio + MMIO_MACDATA) ; | 1630 | writeb(0x81, xl_mmio + MMIO_MACDATA) ; |
1635 | 1631 | ||
1636 | writel(MEM_WORD_WRITE | 0xd0000 | xl_priv->asb | 6, xl_mmio + MMIO_MAC_ACCESS_CMD) ; | 1632 | writel(MEM_WORD_WRITE | 0xd0000 | xl_priv->asb | 6, xl_mmio + MMIO_MAC_ACCESS_CMD) ; |
1637 | writew(ntohs(xl_priv->mac_buffer), xl_mmio + MMIO_MACDATA) ; | 1633 | writew(swab16(xl_priv->mac_buffer), xl_mmio + MMIO_MACDATA) ; |
1638 | 1634 | ||
1639 | xl_wait_misr_flags(dev) ; | 1635 | xl_wait_misr_flags(dev) ; |
1640 | 1636 | ||
diff --git a/drivers/net/tokenring/3c359.h b/drivers/net/tokenring/3c359.h index 05c860368852..b880cba0f6fd 100644 --- a/drivers/net/tokenring/3c359.h +++ b/drivers/net/tokenring/3c359.h | |||
@@ -156,19 +156,19 @@ | |||
156 | #define HOSTERRINT (1<<1) | 156 | #define HOSTERRINT (1<<1) |
157 | 157 | ||
158 | /* Receive descriptor bits */ | 158 | /* Receive descriptor bits */ |
159 | #define RXOVERRUN (1<<19) | 159 | #define RXOVERRUN cpu_to_le32(1<<19) |
160 | #define RXFC (1<<21) | 160 | #define RXFC cpu_to_le32(1<<21) |
161 | #define RXAR (1<<22) | 161 | #define RXAR cpu_to_le32(1<<22) |
162 | #define RXUPDCOMPLETE (1<<23) | 162 | #define RXUPDCOMPLETE cpu_to_le32(1<<23) |
163 | #define RXUPDFULL (1<<24) | 163 | #define RXUPDFULL cpu_to_le32(1<<24) |
164 | #define RXUPLASTFRAG (1<<31) | 164 | #define RXUPLASTFRAG cpu_to_le32(1<<31) |
165 | 165 | ||
166 | /* Transmit descriptor bits */ | 166 | /* Transmit descriptor bits */ |
167 | #define TXDNCOMPLETE (1<<16) | 167 | #define TXDNCOMPLETE cpu_to_le32(1<<16) |
168 | #define TXTXINDICATE (1<<27) | 168 | #define TXTXINDICATE cpu_to_le32(1<<27) |
169 | #define TXDPDEMPTY (1<<29) | 169 | #define TXDPDEMPTY cpu_to_le32(1<<29) |
170 | #define TXDNINDICATE (1<<31) | 170 | #define TXDNINDICATE cpu_to_le32(1<<31) |
171 | #define TXDNFRAGLAST (1<<31) | 171 | #define TXDNFRAGLAST cpu_to_le32(1<<31) |
172 | 172 | ||
173 | /* Interrupts to Acknowledge */ | 173 | /* Interrupts to Acknowledge */ |
174 | #define LATCH_ACK 1 | 174 | #define LATCH_ACK 1 |
@@ -232,17 +232,17 @@ | |||
232 | /* 3c359 data structures */ | 232 | /* 3c359 data structures */ |
233 | 233 | ||
234 | struct xl_tx_desc { | 234 | struct xl_tx_desc { |
235 | u32 dnnextptr ; | 235 | __le32 dnnextptr; |
236 | u32 framestartheader ; | 236 | __le32 framestartheader; |
237 | u32 buffer ; | 237 | __le32 buffer; |
238 | u32 buffer_length ; | 238 | __le32 buffer_length; |
239 | }; | 239 | }; |
240 | 240 | ||
241 | struct xl_rx_desc { | 241 | struct xl_rx_desc { |
242 | u32 upnextptr ; | 242 | __le32 upnextptr; |
243 | u32 framestatus ; | 243 | __le32 framestatus; |
244 | u32 upfragaddr ; | 244 | __le32 upfragaddr; |
245 | u32 upfraglen ; | 245 | __le32 upfraglen; |
246 | }; | 246 | }; |
247 | 247 | ||
248 | struct xl_private { | 248 | struct xl_private { |
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); | |||
911 | static int de4x5_sw_reset(struct net_device *dev); | 911 | static int de4x5_sw_reset(struct net_device *dev); |
912 | static int de4x5_rx(struct net_device *dev); | 912 | static int de4x5_rx(struct net_device *dev); |
913 | static int de4x5_tx(struct net_device *dev); | 913 | static int de4x5_tx(struct net_device *dev); |
914 | static int de4x5_ast(struct net_device *dev); | 914 | static void de4x5_ast(struct net_device *dev); |
915 | static int de4x5_txur(struct net_device *dev); | 915 | static int de4x5_txur(struct net_device *dev); |
916 | static int de4x5_rx_ovfc(struct net_device *dev); | 916 | static 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); | |||
984 | static int an_exception(struct de4x5_private *lp); | 984 | static int an_exception(struct de4x5_private *lp); |
985 | static char *build_setup_frame(struct net_device *dev, int mode); | 985 | static char *build_setup_frame(struct net_device *dev, int mode); |
986 | static void disable_ast(struct net_device *dev); | 986 | static void disable_ast(struct net_device *dev); |
987 | static void enable_ast(struct net_device *dev, u32 time_out); | ||
988 | static long de4x5_switch_mac_port(struct net_device *dev); | 987 | static long de4x5_switch_mac_port(struct net_device *dev); |
989 | static int gep_rd(struct net_device *dev); | 988 | static int gep_rd(struct net_device *dev); |
990 | static void gep_wr(s32 data, struct net_device *dev); | 989 | static void gep_wr(s32 data, struct net_device *dev); |
991 | static void timeout(struct net_device *dev, void (*fn)(u_long data), u_long data, u_long msec); | ||
992 | static void yawn(struct net_device *dev, int state); | 990 | static void yawn(struct net_device *dev, int state); |
993 | static void de4x5_parse_params(struct net_device *dev); | 991 | static void de4x5_parse_params(struct net_device *dev); |
994 | static void de4x5_dbg_open(struct net_device *dev); | 992 | static 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 | ||
1740 | static int | 1740 | static void |
1741 | de4x5_ast(struct net_device *dev) | 1741 | de4x5_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 | ||
1763 | static int | 1765 | static 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 = { | |||
2371 | static int | 2373 | static int |
2372 | autoconf_media(struct net_device *dev) | 2374 | autoconf_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 | ||
5163 | static void | 5156 | static void |
5164 | enable_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 | |||
5171 | static void | ||
5172 | disable_ast(struct net_device *dev) | 5157 | disable_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 | ||
5181 | static long | 5163 | static long |
@@ -5245,29 +5227,6 @@ gep_rd(struct net_device *dev) | |||
5245 | } | 5227 | } |
5246 | 5228 | ||
5247 | static void | 5229 | static void |
5248 | timeout(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 | |||
5270 | static void | ||
5271 | yawn(struct net_device *dev, int state) | 5230 | yawn(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 | ||
263 | done: | ||
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}; | |||
83 | struct xircom_private { | 83 | struct 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 | */ |
591 | static void setup_descriptors(struct xircom_private *card) | 592 | static 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/tun.c b/drivers/net/tun.c index 1f7644695976..f8b8c71187a0 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -610,7 +610,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file, | |||
610 | tun->flags &= ~TUN_PERSIST; | 610 | tun->flags &= ~TUN_PERSIST; |
611 | 611 | ||
612 | DBG(KERN_INFO "%s: persist %s\n", | 612 | DBG(KERN_INFO "%s: persist %s\n", |
613 | tun->dev->name, arg ? "disabled" : "enabled"); | 613 | tun->dev->name, arg ? "enabled" : "disabled"); |
614 | break; | 614 | break; |
615 | 615 | ||
616 | case TUNSETOWNER: | 616 | case TUNSETOWNER: |
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index 94ac5869bb18..f50cb520dffb 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c | |||
@@ -813,8 +813,7 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
813 | first_txd->flags = TYPHOON_TX_DESC | TYPHOON_DESC_VALID; | 813 | first_txd->flags = TYPHOON_TX_DESC | TYPHOON_DESC_VALID; |
814 | first_txd->numDesc = 0; | 814 | first_txd->numDesc = 0; |
815 | first_txd->len = 0; | 815 | first_txd->len = 0; |
816 | first_txd->addr = (u64)((unsigned long) skb) & 0xffffffff; | 816 | first_txd->tx_addr = (u64)((unsigned long) skb); |
817 | first_txd->addrHi = (u64)((unsigned long) skb) >> 32; | ||
818 | first_txd->processFlags = 0; | 817 | first_txd->processFlags = 0; |
819 | 818 | ||
820 | if(skb->ip_summed == CHECKSUM_PARTIAL) { | 819 | if(skb->ip_summed == CHECKSUM_PARTIAL) { |
@@ -850,8 +849,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
850 | PCI_DMA_TODEVICE); | 849 | PCI_DMA_TODEVICE); |
851 | txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; | 850 | txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; |
852 | txd->len = cpu_to_le16(skb->len); | 851 | txd->len = cpu_to_le16(skb->len); |
853 | txd->addr = cpu_to_le32(skb_dma); | 852 | txd->frag.addr = cpu_to_le32(skb_dma); |
854 | txd->addrHi = 0; | 853 | txd->frag.addrHi = 0; |
855 | first_txd->numDesc++; | 854 | first_txd->numDesc++; |
856 | } else { | 855 | } else { |
857 | int i, len; | 856 | int i, len; |
@@ -861,8 +860,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
861 | PCI_DMA_TODEVICE); | 860 | PCI_DMA_TODEVICE); |
862 | txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; | 861 | txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; |
863 | txd->len = cpu_to_le16(len); | 862 | txd->len = cpu_to_le16(len); |
864 | txd->addr = cpu_to_le32(skb_dma); | 863 | txd->frag.addr = cpu_to_le32(skb_dma); |
865 | txd->addrHi = 0; | 864 | txd->frag.addrHi = 0; |
866 | first_txd->numDesc++; | 865 | first_txd->numDesc++; |
867 | 866 | ||
868 | for(i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 867 | for(i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
@@ -880,8 +879,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
880 | PCI_DMA_TODEVICE); | 879 | PCI_DMA_TODEVICE); |
881 | txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; | 880 | txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; |
882 | txd->len = cpu_to_le16(len); | 881 | txd->len = cpu_to_le16(len); |
883 | txd->addr = cpu_to_le32(skb_dma); | 882 | txd->frag.addr = cpu_to_le32(skb_dma); |
884 | txd->addrHi = 0; | 883 | txd->frag.addrHi = 0; |
885 | first_txd->numDesc++; | 884 | first_txd->numDesc++; |
886 | } | 885 | } |
887 | } | 886 | } |
@@ -977,12 +976,12 @@ typhoon_do_get_stats(struct typhoon *tp) | |||
977 | * ethtool_ops->get_{strings,stats}() | 976 | * ethtool_ops->get_{strings,stats}() |
978 | */ | 977 | */ |
979 | stats->tx_packets = le32_to_cpu(s->txPackets); | 978 | stats->tx_packets = le32_to_cpu(s->txPackets); |
980 | stats->tx_bytes = le32_to_cpu(s->txBytes); | 979 | stats->tx_bytes = le64_to_cpu(s->txBytes); |
981 | stats->tx_errors = le32_to_cpu(s->txCarrierLost); | 980 | stats->tx_errors = le32_to_cpu(s->txCarrierLost); |
982 | stats->tx_carrier_errors = le32_to_cpu(s->txCarrierLost); | 981 | stats->tx_carrier_errors = le32_to_cpu(s->txCarrierLost); |
983 | stats->collisions = le32_to_cpu(s->txMultipleCollisions); | 982 | stats->collisions = le32_to_cpu(s->txMultipleCollisions); |
984 | stats->rx_packets = le32_to_cpu(s->rxPacketsGood); | 983 | stats->rx_packets = le32_to_cpu(s->rxPacketsGood); |
985 | stats->rx_bytes = le32_to_cpu(s->rxBytesGood); | 984 | stats->rx_bytes = le64_to_cpu(s->rxBytesGood); |
986 | stats->rx_fifo_errors = le32_to_cpu(s->rxFifoOverruns); | 985 | stats->rx_fifo_errors = le32_to_cpu(s->rxFifoOverruns); |
987 | stats->rx_errors = le32_to_cpu(s->rxFifoOverruns) + | 986 | stats->rx_errors = le32_to_cpu(s->rxFifoOverruns) + |
988 | le32_to_cpu(s->BadSSD) + le32_to_cpu(s->rxCrcErrors); | 987 | le32_to_cpu(s->BadSSD) + le32_to_cpu(s->rxCrcErrors); |
@@ -1056,7 +1055,7 @@ typhoon_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | |||
1056 | if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) { | 1055 | if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) { |
1057 | strcpy(info->fw_version, "Unknown runtime"); | 1056 | strcpy(info->fw_version, "Unknown runtime"); |
1058 | } else { | 1057 | } else { |
1059 | u32 sleep_ver = xp_resp[0].parm2; | 1058 | u32 sleep_ver = le32_to_cpu(xp_resp[0].parm2); |
1060 | snprintf(info->fw_version, 32, "%02x.%03x.%03x", | 1059 | snprintf(info->fw_version, 32, "%02x.%03x.%03x", |
1061 | sleep_ver >> 24, (sleep_ver >> 12) & 0xfff, | 1060 | sleep_ver >> 24, (sleep_ver >> 12) & 0xfff, |
1062 | sleep_ver & 0xfff); | 1061 | sleep_ver & 0xfff); |
@@ -1157,7 +1156,7 @@ typhoon_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1157 | } | 1156 | } |
1158 | 1157 | ||
1159 | INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_XCVR_SELECT); | 1158 | INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_XCVR_SELECT); |
1160 | xp_cmd.parm1 = cpu_to_le16(xcvr); | 1159 | xp_cmd.parm1 = xcvr; |
1161 | err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL); | 1160 | err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL); |
1162 | if(err < 0) | 1161 | if(err < 0) |
1163 | goto out; | 1162 | goto out; |
@@ -1320,7 +1319,7 @@ typhoon_init_interface(struct typhoon *tp) | |||
1320 | tp->txLoRing.writeRegister = TYPHOON_REG_TX_LO_READY; | 1319 | tp->txLoRing.writeRegister = TYPHOON_REG_TX_LO_READY; |
1321 | tp->txHiRing.writeRegister = TYPHOON_REG_TX_HI_READY; | 1320 | tp->txHiRing.writeRegister = TYPHOON_REG_TX_HI_READY; |
1322 | 1321 | ||
1323 | tp->txlo_dma_addr = iface->txLoAddr; | 1322 | tp->txlo_dma_addr = le32_to_cpu(iface->txLoAddr); |
1324 | tp->card_state = Sleeping; | 1323 | tp->card_state = Sleeping; |
1325 | smp_wmb(); | 1324 | smp_wmb(); |
1326 | 1325 | ||
@@ -1358,7 +1357,7 @@ typhoon_download_firmware(struct typhoon *tp) | |||
1358 | u8 *image_data; | 1357 | u8 *image_data; |
1359 | void *dpage; | 1358 | void *dpage; |
1360 | dma_addr_t dpage_dma; | 1359 | dma_addr_t dpage_dma; |
1361 | unsigned int csum; | 1360 | __sum16 csum; |
1362 | u32 irqEnabled; | 1361 | u32 irqEnabled; |
1363 | u32 irqMasked; | 1362 | u32 irqMasked; |
1364 | u32 numSections; | 1363 | u32 numSections; |
@@ -1450,13 +1449,13 @@ typhoon_download_firmware(struct typhoon *tp) | |||
1450 | * summing. Fortunately, due to the properties of | 1449 | * summing. Fortunately, due to the properties of |
1451 | * the checksum, we can do this once, at the end. | 1450 | * the checksum, we can do this once, at the end. |
1452 | */ | 1451 | */ |
1453 | csum = csum_partial_copy_nocheck(image_data, dpage, | 1452 | csum = csum_fold(csum_partial_copy_nocheck(image_data, |
1454 | len, 0); | 1453 | dpage, len, |
1455 | csum = csum_fold(csum); | 1454 | 0)); |
1456 | csum = le16_to_cpu(csum); | ||
1457 | 1455 | ||
1458 | iowrite32(len, ioaddr + TYPHOON_REG_BOOT_LENGTH); | 1456 | iowrite32(len, ioaddr + TYPHOON_REG_BOOT_LENGTH); |
1459 | iowrite32(csum, ioaddr + TYPHOON_REG_BOOT_CHECKSUM); | 1457 | iowrite32(le16_to_cpu((__force __le16)csum), |
1458 | ioaddr + TYPHOON_REG_BOOT_CHECKSUM); | ||
1460 | iowrite32(load_addr, | 1459 | iowrite32(load_addr, |
1461 | ioaddr + TYPHOON_REG_BOOT_DEST_ADDR); | 1460 | ioaddr + TYPHOON_REG_BOOT_DEST_ADDR); |
1462 | iowrite32(0, ioaddr + TYPHOON_REG_BOOT_DATA_HI); | 1461 | iowrite32(0, ioaddr + TYPHOON_REG_BOOT_DATA_HI); |
@@ -1551,13 +1550,13 @@ typhoon_clean_tx(struct typhoon *tp, struct transmit_ring *txRing, | |||
1551 | if(type == TYPHOON_TX_DESC) { | 1550 | if(type == TYPHOON_TX_DESC) { |
1552 | /* This tx_desc describes a packet. | 1551 | /* This tx_desc describes a packet. |
1553 | */ | 1552 | */ |
1554 | unsigned long ptr = tx->addr | ((u64)tx->addrHi << 32); | 1553 | unsigned long ptr = tx->tx_addr; |
1555 | struct sk_buff *skb = (struct sk_buff *) ptr; | 1554 | struct sk_buff *skb = (struct sk_buff *) ptr; |
1556 | dev_kfree_skb_irq(skb); | 1555 | dev_kfree_skb_irq(skb); |
1557 | } else if(type == TYPHOON_FRAG_DESC) { | 1556 | } else if(type == TYPHOON_FRAG_DESC) { |
1558 | /* This tx_desc describes a memory mapping. Free it. | 1557 | /* This tx_desc describes a memory mapping. Free it. |
1559 | */ | 1558 | */ |
1560 | skb_dma = (dma_addr_t) le32_to_cpu(tx->addr); | 1559 | skb_dma = (dma_addr_t) le32_to_cpu(tx->frag.addr); |
1561 | dma_len = le16_to_cpu(tx->len); | 1560 | dma_len = le16_to_cpu(tx->len); |
1562 | pci_unmap_single(tp->pdev, skb_dma, dma_len, | 1561 | pci_unmap_single(tp->pdev, skb_dma, dma_len, |
1563 | PCI_DMA_TODEVICE); | 1562 | PCI_DMA_TODEVICE); |
@@ -1596,7 +1595,7 @@ typhoon_recycle_rx_skb(struct typhoon *tp, u32 idx) | |||
1596 | struct rx_free *r; | 1595 | struct rx_free *r; |
1597 | 1596 | ||
1598 | if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) == | 1597 | if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) == |
1599 | indexes->rxBuffCleared) { | 1598 | le32_to_cpu(indexes->rxBuffCleared)) { |
1600 | /* no room in ring, just drop the skb | 1599 | /* no room in ring, just drop the skb |
1601 | */ | 1600 | */ |
1602 | dev_kfree_skb_any(rxb->skb); | 1601 | dev_kfree_skb_any(rxb->skb); |
@@ -1627,7 +1626,7 @@ typhoon_alloc_rx_skb(struct typhoon *tp, u32 idx) | |||
1627 | rxb->skb = NULL; | 1626 | rxb->skb = NULL; |
1628 | 1627 | ||
1629 | if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) == | 1628 | if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) == |
1630 | indexes->rxBuffCleared) | 1629 | le32_to_cpu(indexes->rxBuffCleared)) |
1631 | return -ENOMEM; | 1630 | return -ENOMEM; |
1632 | 1631 | ||
1633 | skb = dev_alloc_skb(PKT_BUF_SZ); | 1632 | skb = dev_alloc_skb(PKT_BUF_SZ); |
diff --git a/drivers/net/typhoon.h b/drivers/net/typhoon.h index 19df20889b82..dd7022ca7354 100644 --- a/drivers/net/typhoon.h +++ b/drivers/net/typhoon.h | |||
@@ -73,7 +73,7 @@ struct typhoon_indexes { | |||
73 | volatile __le32 txLoCleared; | 73 | volatile __le32 txLoCleared; |
74 | volatile __le32 txHiCleared; | 74 | volatile __le32 txHiCleared; |
75 | volatile __le32 rxLoReady; | 75 | volatile __le32 rxLoReady; |
76 | volatile __u32 rxBuffCleared; /* AV: really? */ | 76 | volatile __le32 rxBuffCleared; |
77 | volatile __le32 cmdCleared; | 77 | volatile __le32 cmdCleared; |
78 | volatile __le32 respReady; | 78 | volatile __le32 respReady; |
79 | volatile __le32 rxHiReady; | 79 | volatile __le32 rxHiReady; |
@@ -166,8 +166,13 @@ struct tx_desc { | |||
166 | #define TYPHOON_DESC_VALID 0x80 | 166 | #define TYPHOON_DESC_VALID 0x80 |
167 | u8 numDesc; | 167 | u8 numDesc; |
168 | __le16 len; | 168 | __le16 len; |
169 | u32 addr; | 169 | union { |
170 | u32 addrHi; | 170 | struct { |
171 | __le32 addr; | ||
172 | __le32 addrHi; | ||
173 | } frag; | ||
174 | u64 tx_addr; /* opaque for hardware, for TX_DESC */ | ||
175 | }; | ||
171 | __le32 processFlags; | 176 | __le32 processFlags; |
172 | #define TYPHOON_TX_PF_NO_CRC __constant_cpu_to_le32(0x00000001) | 177 | #define TYPHOON_TX_PF_NO_CRC __constant_cpu_to_le32(0x00000001) |
173 | #define TYPHOON_TX_PF_IP_CHKSUM __constant_cpu_to_le32(0x00000002) | 178 | #define TYPHOON_TX_PF_IP_CHKSUM __constant_cpu_to_le32(0x00000002) |
@@ -240,8 +245,8 @@ struct rx_desc { | |||
240 | u8 flags; | 245 | u8 flags; |
241 | u8 numDesc; | 246 | u8 numDesc; |
242 | __le16 frameLen; | 247 | __le16 frameLen; |
243 | u32 addr; | 248 | u32 addr; /* opaque, comes from virtAddr */ |
244 | u32 addrHi; | 249 | u32 addrHi; /* opaque, comes from virtAddrHi */ |
245 | __le32 rxStatus; | 250 | __le32 rxStatus; |
246 | #define TYPHOON_RX_ERR_INTERNAL __constant_cpu_to_le32(0x00000000) | 251 | #define TYPHOON_RX_ERR_INTERNAL __constant_cpu_to_le32(0x00000000) |
247 | #define TYPHOON_RX_ERR_FIFO_UNDERRUN __constant_cpu_to_le32(0x00000001) | 252 | #define TYPHOON_RX_ERR_FIFO_UNDERRUN __constant_cpu_to_le32(0x00000001) |
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 61daa096de66..569028b2baf2 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c | |||
@@ -172,45 +172,76 @@ struct asix_data { | |||
172 | }; | 172 | }; |
173 | 173 | ||
174 | struct ax88172_int_data { | 174 | struct ax88172_int_data { |
175 | u16 res1; | 175 | __le16 res1; |
176 | u8 link; | 176 | u8 link; |
177 | u16 res2; | 177 | __le16 res2; |
178 | u8 status; | 178 | u8 status; |
179 | u16 res3; | 179 | __le16 res3; |
180 | } __attribute__ ((packed)); | 180 | } __attribute__ ((packed)); |
181 | 181 | ||
182 | static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, | 182 | static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, |
183 | u16 size, void *data) | 183 | u16 size, void *data) |
184 | { | 184 | { |
185 | void *buf; | ||
186 | int err = -ENOMEM; | ||
187 | |||
185 | devdbg(dev,"asix_read_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d", | 188 | devdbg(dev,"asix_read_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d", |
186 | cmd, value, index, size); | 189 | cmd, value, index, size); |
187 | return usb_control_msg( | 190 | |
191 | buf = kmalloc(size, GFP_KERNEL); | ||
192 | if (!buf) | ||
193 | goto out; | ||
194 | |||
195 | err = usb_control_msg( | ||
188 | dev->udev, | 196 | dev->udev, |
189 | usb_rcvctrlpipe(dev->udev, 0), | 197 | usb_rcvctrlpipe(dev->udev, 0), |
190 | cmd, | 198 | cmd, |
191 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 199 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
192 | value, | 200 | value, |
193 | index, | 201 | index, |
194 | data, | 202 | buf, |
195 | size, | 203 | size, |
196 | USB_CTRL_GET_TIMEOUT); | 204 | USB_CTRL_GET_TIMEOUT); |
205 | if (err == size) | ||
206 | memcpy(data, buf, size); | ||
207 | else if (err >= 0) | ||
208 | err = -EINVAL; | ||
209 | kfree(buf); | ||
210 | |||
211 | out: | ||
212 | return err; | ||
197 | } | 213 | } |
198 | 214 | ||
199 | static int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, | 215 | static int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, |
200 | u16 size, void *data) | 216 | u16 size, void *data) |
201 | { | 217 | { |
218 | void *buf = NULL; | ||
219 | int err = -ENOMEM; | ||
220 | |||
202 | devdbg(dev,"asix_write_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d", | 221 | devdbg(dev,"asix_write_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d", |
203 | cmd, value, index, size); | 222 | cmd, value, index, size); |
204 | return usb_control_msg( | 223 | |
224 | if (data) { | ||
225 | buf = kmalloc(size, GFP_KERNEL); | ||
226 | if (!buf) | ||
227 | goto out; | ||
228 | memcpy(buf, data, size); | ||
229 | } | ||
230 | |||
231 | err = usb_control_msg( | ||
205 | dev->udev, | 232 | dev->udev, |
206 | usb_sndctrlpipe(dev->udev, 0), | 233 | usb_sndctrlpipe(dev->udev, 0), |
207 | cmd, | 234 | cmd, |
208 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 235 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
209 | value, | 236 | value, |
210 | index, | 237 | index, |
211 | data, | 238 | buf, |
212 | size, | 239 | size, |
213 | USB_CTRL_SET_TIMEOUT); | 240 | USB_CTRL_SET_TIMEOUT); |
241 | kfree(buf); | ||
242 | |||
243 | out: | ||
244 | return err; | ||
214 | } | 245 | } |
215 | 246 | ||
216 | static void asix_async_cmd_callback(struct urb *urb) | 247 | static void asix_async_cmd_callback(struct urb *urb) |
@@ -402,25 +433,19 @@ static inline int asix_set_hw_mii(struct usbnet *dev) | |||
402 | 433 | ||
403 | static inline int asix_get_phy_addr(struct usbnet *dev) | 434 | static inline int asix_get_phy_addr(struct usbnet *dev) |
404 | { | 435 | { |
405 | int ret = 0; | 436 | u8 buf[2]; |
406 | void *buf; | 437 | int ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID, 0, 0, 2, buf); |
407 | 438 | ||
408 | devdbg(dev, "asix_get_phy_addr()"); | 439 | devdbg(dev, "asix_get_phy_addr()"); |
409 | 440 | ||
410 | buf = kmalloc(2, GFP_KERNEL); | 441 | if (ret < 0) { |
411 | if (!buf) | ||
412 | goto out1; | ||
413 | |||
414 | if ((ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID, | ||
415 | 0, 0, 2, buf)) < 2) { | ||
416 | deverr(dev, "Error reading PHYID register: %02x", ret); | 442 | deverr(dev, "Error reading PHYID register: %02x", ret); |
417 | goto out2; | 443 | goto out; |
418 | } | 444 | } |
419 | devdbg(dev, "asix_get_phy_addr() returning 0x%04x", *((u16 *)buf)); | 445 | devdbg(dev, "asix_get_phy_addr() returning 0x%04x", *((__le16 *)buf)); |
420 | ret = *((u8 *)buf + 1); | 446 | ret = buf[1]; |
421 | out2: | 447 | |
422 | kfree(buf); | 448 | out: |
423 | out1: | ||
424 | return ret; | 449 | return ret; |
425 | } | 450 | } |
426 | 451 | ||
@@ -437,22 +462,15 @@ static int asix_sw_reset(struct usbnet *dev, u8 flags) | |||
437 | 462 | ||
438 | static u16 asix_read_rx_ctl(struct usbnet *dev) | 463 | static u16 asix_read_rx_ctl(struct usbnet *dev) |
439 | { | 464 | { |
440 | u16 ret = 0; | 465 | __le16 v; |
441 | void *buf; | 466 | int ret = asix_read_cmd(dev, AX_CMD_READ_RX_CTL, 0, 0, 2, &v); |
442 | |||
443 | buf = kmalloc(2, GFP_KERNEL); | ||
444 | if (!buf) | ||
445 | goto out1; | ||
446 | 467 | ||
447 | if ((ret = asix_read_cmd(dev, AX_CMD_READ_RX_CTL, | 468 | if (ret < 0) { |
448 | 0, 0, 2, buf)) < 2) { | ||
449 | deverr(dev, "Error reading RX_CTL register: %02x", ret); | 469 | deverr(dev, "Error reading RX_CTL register: %02x", ret); |
450 | goto out2; | 470 | goto out; |
451 | } | 471 | } |
452 | ret = le16_to_cpu(*((u16 *)buf)); | 472 | ret = le16_to_cpu(v); |
453 | out2: | 473 | out: |
454 | kfree(buf); | ||
455 | out1: | ||
456 | return ret; | 474 | return ret; |
457 | } | 475 | } |
458 | 476 | ||
@@ -471,22 +489,15 @@ static int asix_write_rx_ctl(struct usbnet *dev, u16 mode) | |||
471 | 489 | ||
472 | static u16 asix_read_medium_status(struct usbnet *dev) | 490 | static u16 asix_read_medium_status(struct usbnet *dev) |
473 | { | 491 | { |
474 | u16 ret = 0; | 492 | __le16 v; |
475 | void *buf; | 493 | int ret = asix_read_cmd(dev, AX_CMD_READ_MEDIUM_STATUS, 0, 0, 2, &v); |
476 | 494 | ||
477 | buf = kmalloc(2, GFP_KERNEL); | 495 | if (ret < 0) { |
478 | if (!buf) | ||
479 | goto out1; | ||
480 | |||
481 | if ((ret = asix_read_cmd(dev, AX_CMD_READ_MEDIUM_STATUS, | ||
482 | 0, 0, 2, buf)) < 2) { | ||
483 | deverr(dev, "Error reading Medium Status register: %02x", ret); | 496 | deverr(dev, "Error reading Medium Status register: %02x", ret); |
484 | goto out2; | 497 | goto out; |
485 | } | 498 | } |
486 | ret = le16_to_cpu(*((u16 *)buf)); | 499 | ret = le16_to_cpu(v); |
487 | out2: | 500 | out: |
488 | kfree(buf); | ||
489 | out1: | ||
490 | return ret; | 501 | return ret; |
491 | } | 502 | } |
492 | 503 | ||
@@ -568,31 +579,30 @@ static void asix_set_multicast(struct net_device *net) | |||
568 | static int asix_mdio_read(struct net_device *netdev, int phy_id, int loc) | 579 | static int asix_mdio_read(struct net_device *netdev, int phy_id, int loc) |
569 | { | 580 | { |
570 | struct usbnet *dev = netdev_priv(netdev); | 581 | struct usbnet *dev = netdev_priv(netdev); |
571 | u16 res; | 582 | __le16 res; |
572 | 583 | ||
573 | mutex_lock(&dev->phy_mutex); | 584 | mutex_lock(&dev->phy_mutex); |
574 | asix_set_sw_mii(dev); | 585 | asix_set_sw_mii(dev); |
575 | asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id, | 586 | asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id, |
576 | (__u16)loc, 2, (u16 *)&res); | 587 | (__u16)loc, 2, &res); |
577 | asix_set_hw_mii(dev); | 588 | asix_set_hw_mii(dev); |
578 | mutex_unlock(&dev->phy_mutex); | 589 | mutex_unlock(&dev->phy_mutex); |
579 | 590 | ||
580 | devdbg(dev, "asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x", phy_id, loc, le16_to_cpu(res & 0xffff)); | 591 | devdbg(dev, "asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x", phy_id, loc, le16_to_cpu(res)); |
581 | 592 | ||
582 | return le16_to_cpu(res & 0xffff); | 593 | return le16_to_cpu(res); |
583 | } | 594 | } |
584 | 595 | ||
585 | static void | 596 | static void |
586 | asix_mdio_write(struct net_device *netdev, int phy_id, int loc, int val) | 597 | asix_mdio_write(struct net_device *netdev, int phy_id, int loc, int val) |
587 | { | 598 | { |
588 | struct usbnet *dev = netdev_priv(netdev); | 599 | struct usbnet *dev = netdev_priv(netdev); |
589 | u16 res = cpu_to_le16(val); | 600 | __le16 res = cpu_to_le16(val); |
590 | 601 | ||
591 | devdbg(dev, "asix_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x", phy_id, loc, val); | 602 | devdbg(dev, "asix_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x", phy_id, loc, val); |
592 | mutex_lock(&dev->phy_mutex); | 603 | mutex_lock(&dev->phy_mutex); |
593 | asix_set_sw_mii(dev); | 604 | asix_set_sw_mii(dev); |
594 | asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, | 605 | asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, (__u16)loc, 2, &res); |
595 | (__u16)loc, 2, (u16 *)&res); | ||
596 | asix_set_hw_mii(dev); | 606 | asix_set_hw_mii(dev); |
597 | mutex_unlock(&dev->phy_mutex); | 607 | mutex_unlock(&dev->phy_mutex); |
598 | } | 608 | } |
@@ -644,7 +654,6 @@ asix_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) | |||
644 | { | 654 | { |
645 | struct usbnet *dev = netdev_priv(net); | 655 | struct usbnet *dev = netdev_priv(net); |
646 | u8 opt = 0; | 656 | u8 opt = 0; |
647 | u8 buf[1]; | ||
648 | 657 | ||
649 | if (wolinfo->wolopts & WAKE_PHY) | 658 | if (wolinfo->wolopts & WAKE_PHY) |
650 | opt |= AX_MONITOR_LINK; | 659 | opt |= AX_MONITOR_LINK; |
@@ -654,7 +663,7 @@ asix_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) | |||
654 | opt |= AX_MONITOR_MODE; | 663 | opt |= AX_MONITOR_MODE; |
655 | 664 | ||
656 | if (asix_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE, | 665 | if (asix_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE, |
657 | opt, 0, 0, &buf) < 0) | 666 | opt, 0, 0, NULL) < 0) |
658 | return -EINVAL; | 667 | return -EINVAL; |
659 | 668 | ||
660 | return 0; | 669 | return 0; |
@@ -672,7 +681,7 @@ static int asix_get_eeprom(struct net_device *net, | |||
672 | struct ethtool_eeprom *eeprom, u8 *data) | 681 | struct ethtool_eeprom *eeprom, u8 *data) |
673 | { | 682 | { |
674 | struct usbnet *dev = netdev_priv(net); | 683 | struct usbnet *dev = netdev_priv(net); |
675 | u16 *ebuf = (u16 *)data; | 684 | __le16 *ebuf = (__le16 *)data; |
676 | int i; | 685 | int i; |
677 | 686 | ||
678 | /* Crude hack to ensure that we don't overwrite memory | 687 | /* Crude hack to ensure that we don't overwrite memory |
@@ -801,7 +810,7 @@ static int ax88172_link_reset(struct usbnet *dev) | |||
801 | static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf) | 810 | static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf) |
802 | { | 811 | { |
803 | int ret = 0; | 812 | int ret = 0; |
804 | void *buf; | 813 | u8 buf[ETH_ALEN]; |
805 | int i; | 814 | int i; |
806 | unsigned long gpio_bits = dev->driver_info->data; | 815 | unsigned long gpio_bits = dev->driver_info->data; |
807 | struct asix_data *data = (struct asix_data *)&dev->data; | 816 | struct asix_data *data = (struct asix_data *)&dev->data; |
@@ -810,30 +819,23 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf) | |||
810 | 819 | ||
811 | usbnet_get_endpoints(dev,intf); | 820 | usbnet_get_endpoints(dev,intf); |
812 | 821 | ||
813 | buf = kmalloc(ETH_ALEN, GFP_KERNEL); | ||
814 | if(!buf) { | ||
815 | ret = -ENOMEM; | ||
816 | goto out1; | ||
817 | } | ||
818 | |||
819 | /* Toggle the GPIOs in a manufacturer/model specific way */ | 822 | /* Toggle the GPIOs in a manufacturer/model specific way */ |
820 | for (i = 2; i >= 0; i--) { | 823 | for (i = 2; i >= 0; i--) { |
821 | if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS, | 824 | if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS, |
822 | (gpio_bits >> (i * 8)) & 0xff, 0, 0, | 825 | (gpio_bits >> (i * 8)) & 0xff, 0, 0, |
823 | buf)) < 0) | 826 | NULL)) < 0) |
824 | goto out2; | 827 | goto out; |
825 | msleep(5); | 828 | msleep(5); |
826 | } | 829 | } |
827 | 830 | ||
828 | if ((ret = asix_write_rx_ctl(dev, 0x80)) < 0) | 831 | if ((ret = asix_write_rx_ctl(dev, 0x80)) < 0) |
829 | goto out2; | 832 | goto out; |
830 | 833 | ||
831 | /* Get the MAC address */ | 834 | /* Get the MAC address */ |
832 | memset(buf, 0, ETH_ALEN); | ||
833 | if ((ret = asix_read_cmd(dev, AX88172_CMD_READ_NODE_ID, | 835 | if ((ret = asix_read_cmd(dev, AX88172_CMD_READ_NODE_ID, |
834 | 0, 0, 6, buf)) < 0) { | 836 | 0, 0, ETH_ALEN, buf)) < 0) { |
835 | dbg("read AX_CMD_READ_NODE_ID failed: %d", ret); | 837 | dbg("read AX_CMD_READ_NODE_ID failed: %d", ret); |
836 | goto out2; | 838 | goto out; |
837 | } | 839 | } |
838 | memcpy(dev->net->dev_addr, buf, ETH_ALEN); | 840 | memcpy(dev->net->dev_addr, buf, ETH_ALEN); |
839 | 841 | ||
@@ -855,9 +857,8 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf) | |||
855 | mii_nway_restart(&dev->mii); | 857 | mii_nway_restart(&dev->mii); |
856 | 858 | ||
857 | return 0; | 859 | return 0; |
858 | out2: | 860 | |
859 | kfree(buf); | 861 | out: |
860 | out1: | ||
861 | return ret; | 862 | return ret; |
862 | } | 863 | } |
863 | 864 | ||
@@ -900,66 +901,58 @@ static int ax88772_link_reset(struct usbnet *dev) | |||
900 | static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) | 901 | static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) |
901 | { | 902 | { |
902 | int ret, embd_phy; | 903 | int ret, embd_phy; |
903 | void *buf; | ||
904 | u16 rx_ctl; | 904 | u16 rx_ctl; |
905 | struct asix_data *data = (struct asix_data *)&dev->data; | 905 | struct asix_data *data = (struct asix_data *)&dev->data; |
906 | u8 buf[ETH_ALEN]; | ||
906 | u32 phyid; | 907 | u32 phyid; |
907 | 908 | ||
908 | data->eeprom_len = AX88772_EEPROM_LEN; | 909 | data->eeprom_len = AX88772_EEPROM_LEN; |
909 | 910 | ||
910 | usbnet_get_endpoints(dev,intf); | 911 | usbnet_get_endpoints(dev,intf); |
911 | 912 | ||
912 | buf = kmalloc(6, GFP_KERNEL); | ||
913 | if(!buf) { | ||
914 | dbg ("Cannot allocate memory for buffer"); | ||
915 | ret = -ENOMEM; | ||
916 | goto out1; | ||
917 | } | ||
918 | |||
919 | if ((ret = asix_write_gpio(dev, | 913 | if ((ret = asix_write_gpio(dev, |
920 | AX_GPIO_RSE | AX_GPIO_GPO_2 | AX_GPIO_GPO2EN, 5)) < 0) | 914 | AX_GPIO_RSE | AX_GPIO_GPO_2 | AX_GPIO_GPO2EN, 5)) < 0) |
921 | goto out2; | 915 | goto out; |
922 | 916 | ||
923 | /* 0x10 is the phy id of the embedded 10/100 ethernet phy */ | 917 | /* 0x10 is the phy id of the embedded 10/100 ethernet phy */ |
924 | embd_phy = ((asix_get_phy_addr(dev) & 0x1f) == 0x10 ? 1 : 0); | 918 | embd_phy = ((asix_get_phy_addr(dev) & 0x1f) == 0x10 ? 1 : 0); |
925 | if ((ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, | 919 | if ((ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, |
926 | embd_phy, 0, 0, buf)) < 0) { | 920 | embd_phy, 0, 0, NULL)) < 0) { |
927 | dbg("Select PHY #1 failed: %d", ret); | 921 | dbg("Select PHY #1 failed: %d", ret); |
928 | goto out2; | 922 | goto out; |
929 | } | 923 | } |
930 | 924 | ||
931 | if ((ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL)) < 0) | 925 | if ((ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL)) < 0) |
932 | goto out2; | 926 | goto out; |
933 | 927 | ||
934 | msleep(150); | 928 | msleep(150); |
935 | if ((ret = asix_sw_reset(dev, AX_SWRESET_CLEAR)) < 0) | 929 | if ((ret = asix_sw_reset(dev, AX_SWRESET_CLEAR)) < 0) |
936 | goto out2; | 930 | goto out; |
937 | 931 | ||
938 | msleep(150); | 932 | msleep(150); |
939 | if (embd_phy) { | 933 | if (embd_phy) { |
940 | if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL)) < 0) | 934 | if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL)) < 0) |
941 | goto out2; | 935 | goto out; |
942 | } | 936 | } |
943 | else { | 937 | else { |
944 | if ((ret = asix_sw_reset(dev, AX_SWRESET_PRTE)) < 0) | 938 | if ((ret = asix_sw_reset(dev, AX_SWRESET_PRTE)) < 0) |
945 | goto out2; | 939 | goto out; |
946 | } | 940 | } |
947 | 941 | ||
948 | msleep(150); | 942 | msleep(150); |
949 | rx_ctl = asix_read_rx_ctl(dev); | 943 | rx_ctl = asix_read_rx_ctl(dev); |
950 | dbg("RX_CTL is 0x%04x after software reset", rx_ctl); | 944 | dbg("RX_CTL is 0x%04x after software reset", rx_ctl); |
951 | if ((ret = asix_write_rx_ctl(dev, 0x0000)) < 0) | 945 | if ((ret = asix_write_rx_ctl(dev, 0x0000)) < 0) |
952 | goto out2; | 946 | goto out; |
953 | 947 | ||
954 | rx_ctl = asix_read_rx_ctl(dev); | 948 | rx_ctl = asix_read_rx_ctl(dev); |
955 | dbg("RX_CTL is 0x%04x setting to 0x0000", rx_ctl); | 949 | dbg("RX_CTL is 0x%04x setting to 0x0000", rx_ctl); |
956 | 950 | ||
957 | /* Get the MAC address */ | 951 | /* Get the MAC address */ |
958 | memset(buf, 0, ETH_ALEN); | ||
959 | if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, | 952 | if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, |
960 | 0, 0, ETH_ALEN, buf)) < 0) { | 953 | 0, 0, ETH_ALEN, buf)) < 0) { |
961 | dbg("Failed to read MAC address: %d", ret); | 954 | dbg("Failed to read MAC address: %d", ret); |
962 | goto out2; | 955 | goto out; |
963 | } | 956 | } |
964 | memcpy(dev->net->dev_addr, buf, ETH_ALEN); | 957 | memcpy(dev->net->dev_addr, buf, ETH_ALEN); |
965 | 958 | ||
@@ -976,12 +969,12 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) | |||
976 | dbg("PHYID=0x%08x", phyid); | 969 | dbg("PHYID=0x%08x", phyid); |
977 | 970 | ||
978 | if ((ret = asix_sw_reset(dev, AX_SWRESET_PRL)) < 0) | 971 | if ((ret = asix_sw_reset(dev, AX_SWRESET_PRL)) < 0) |
979 | goto out2; | 972 | goto out; |
980 | 973 | ||
981 | msleep(150); | 974 | msleep(150); |
982 | 975 | ||
983 | if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL)) < 0) | 976 | if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL)) < 0) |
984 | goto out2; | 977 | goto out; |
985 | 978 | ||
986 | msleep(150); | 979 | msleep(150); |
987 | 980 | ||
@@ -994,18 +987,18 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) | |||
994 | mii_nway_restart(&dev->mii); | 987 | mii_nway_restart(&dev->mii); |
995 | 988 | ||
996 | if ((ret = asix_write_medium_mode(dev, AX88772_MEDIUM_DEFAULT)) < 0) | 989 | if ((ret = asix_write_medium_mode(dev, AX88772_MEDIUM_DEFAULT)) < 0) |
997 | goto out2; | 990 | goto out; |
998 | 991 | ||
999 | if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_IPG0, | 992 | if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_IPG0, |
1000 | AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT, | 993 | AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT, |
1001 | AX88772_IPG2_DEFAULT, 0, buf)) < 0) { | 994 | AX88772_IPG2_DEFAULT, 0, NULL)) < 0) { |
1002 | dbg("Write IPG,IPG1,IPG2 failed: %d", ret); | 995 | dbg("Write IPG,IPG1,IPG2 failed: %d", ret); |
1003 | goto out2; | 996 | goto out; |
1004 | } | 997 | } |
1005 | 998 | ||
1006 | /* Set RX_CTL to default values with 2k buffer, and enable cactus */ | 999 | /* Set RX_CTL to default values with 2k buffer, and enable cactus */ |
1007 | if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0) | 1000 | if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0) |
1008 | goto out2; | 1001 | goto out; |
1009 | 1002 | ||
1010 | rx_ctl = asix_read_rx_ctl(dev); | 1003 | rx_ctl = asix_read_rx_ctl(dev); |
1011 | dbg("RX_CTL is 0x%04x after all initializations", rx_ctl); | 1004 | dbg("RX_CTL is 0x%04x after all initializations", rx_ctl); |
@@ -1013,20 +1006,15 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1013 | rx_ctl = asix_read_medium_status(dev); | 1006 | rx_ctl = asix_read_medium_status(dev); |
1014 | dbg("Medium Status is 0x%04x after all initializations", rx_ctl); | 1007 | dbg("Medium Status is 0x%04x after all initializations", rx_ctl); |
1015 | 1008 | ||
1016 | kfree(buf); | ||
1017 | |||
1018 | /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ | 1009 | /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ |
1019 | if (dev->driver_info->flags & FLAG_FRAMING_AX) { | 1010 | if (dev->driver_info->flags & FLAG_FRAMING_AX) { |
1020 | /* hard_mtu is still the default - the device does not support | 1011 | /* hard_mtu is still the default - the device does not support |
1021 | jumbo eth frames */ | 1012 | jumbo eth frames */ |
1022 | dev->rx_urb_size = 2048; | 1013 | dev->rx_urb_size = 2048; |
1023 | } | 1014 | } |
1024 | |||
1025 | return 0; | 1015 | return 0; |
1026 | 1016 | ||
1027 | out2: | 1017 | out: |
1028 | kfree(buf); | ||
1029 | out1: | ||
1030 | return ret; | 1018 | return ret; |
1031 | } | 1019 | } |
1032 | 1020 | ||
@@ -1195,23 +1183,16 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1195 | { | 1183 | { |
1196 | struct asix_data *data = (struct asix_data *)&dev->data; | 1184 | struct asix_data *data = (struct asix_data *)&dev->data; |
1197 | int ret; | 1185 | int ret; |
1198 | void *buf; | 1186 | u8 buf[ETH_ALEN]; |
1199 | u16 eeprom; | 1187 | __le16 eeprom; |
1188 | u8 status; | ||
1200 | int gpio0 = 0; | 1189 | int gpio0 = 0; |
1201 | u32 phyid; | 1190 | u32 phyid; |
1202 | 1191 | ||
1203 | usbnet_get_endpoints(dev,intf); | 1192 | usbnet_get_endpoints(dev,intf); |
1204 | 1193 | ||
1205 | buf = kmalloc(6, GFP_KERNEL); | 1194 | asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status); |
1206 | if(!buf) { | 1195 | dbg("GPIO Status: 0x%04x", status); |
1207 | dbg ("Cannot allocate memory for buffer"); | ||
1208 | ret = -ENOMEM; | ||
1209 | goto out1; | ||
1210 | } | ||
1211 | |||
1212 | eeprom = 0; | ||
1213 | asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &eeprom); | ||
1214 | dbg("GPIO Status: 0x%04x", eeprom); | ||
1215 | 1196 | ||
1216 | asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL); | 1197 | asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL); |
1217 | asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom); | 1198 | asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom); |
@@ -1219,19 +1200,19 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1219 | 1200 | ||
1220 | dbg("EEPROM index 0x17 is 0x%04x", eeprom); | 1201 | dbg("EEPROM index 0x17 is 0x%04x", eeprom); |
1221 | 1202 | ||
1222 | if (eeprom == 0xffff) { | 1203 | if (eeprom == cpu_to_le16(0xffff)) { |
1223 | data->phymode = PHY_MODE_MARVELL; | 1204 | data->phymode = PHY_MODE_MARVELL; |
1224 | data->ledmode = 0; | 1205 | data->ledmode = 0; |
1225 | gpio0 = 1; | 1206 | gpio0 = 1; |
1226 | } else { | 1207 | } else { |
1227 | data->phymode = eeprom & 7; | 1208 | data->phymode = le16_to_cpu(eeprom) & 7; |
1228 | data->ledmode = eeprom >> 8; | 1209 | data->ledmode = le16_to_cpu(eeprom) >> 8; |
1229 | gpio0 = (eeprom & 0x80) ? 0 : 1; | 1210 | gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1; |
1230 | } | 1211 | } |
1231 | dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode); | 1212 | dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode); |
1232 | 1213 | ||
1233 | asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40); | 1214 | asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40); |
1234 | if ((eeprom >> 8) != 1) { | 1215 | if ((le16_to_cpu(eeprom) >> 8) != 1) { |
1235 | asix_write_gpio(dev, 0x003c, 30); | 1216 | asix_write_gpio(dev, 0x003c, 30); |
1236 | asix_write_gpio(dev, 0x001c, 300); | 1217 | asix_write_gpio(dev, 0x001c, 300); |
1237 | asix_write_gpio(dev, 0x003c, 30); | 1218 | asix_write_gpio(dev, 0x003c, 30); |
@@ -1250,11 +1231,10 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1250 | asix_write_rx_ctl(dev, 0); | 1231 | asix_write_rx_ctl(dev, 0); |
1251 | 1232 | ||
1252 | /* Get the MAC address */ | 1233 | /* Get the MAC address */ |
1253 | memset(buf, 0, ETH_ALEN); | ||
1254 | if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, | 1234 | if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, |
1255 | 0, 0, ETH_ALEN, buf)) < 0) { | 1235 | 0, 0, ETH_ALEN, buf)) < 0) { |
1256 | dbg("Failed to read MAC address: %d", ret); | 1236 | dbg("Failed to read MAC address: %d", ret); |
1257 | goto out2; | 1237 | goto out; |
1258 | } | 1238 | } |
1259 | memcpy(dev->net->dev_addr, buf, ETH_ALEN); | 1239 | memcpy(dev->net->dev_addr, buf, ETH_ALEN); |
1260 | 1240 | ||
@@ -1289,12 +1269,10 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1289 | mii_nway_restart(&dev->mii); | 1269 | mii_nway_restart(&dev->mii); |
1290 | 1270 | ||
1291 | if ((ret = asix_write_medium_mode(dev, AX88178_MEDIUM_DEFAULT)) < 0) | 1271 | if ((ret = asix_write_medium_mode(dev, AX88178_MEDIUM_DEFAULT)) < 0) |
1292 | goto out2; | 1272 | goto out; |
1293 | 1273 | ||
1294 | if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0) | 1274 | if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0) |
1295 | goto out2; | 1275 | goto out; |
1296 | |||
1297 | kfree(buf); | ||
1298 | 1276 | ||
1299 | /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ | 1277 | /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ |
1300 | if (dev->driver_info->flags & FLAG_FRAMING_AX) { | 1278 | if (dev->driver_info->flags & FLAG_FRAMING_AX) { |
@@ -1302,12 +1280,9 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1302 | jumbo eth frames */ | 1280 | jumbo eth frames */ |
1303 | dev->rx_urb_size = 2048; | 1281 | dev->rx_urb_size = 2048; |
1304 | } | 1282 | } |
1305 | |||
1306 | return 0; | 1283 | return 0; |
1307 | 1284 | ||
1308 | out2: | 1285 | out: |
1309 | kfree(buf); | ||
1310 | out1: | ||
1311 | return ret; | 1286 | return ret; |
1312 | } | 1287 | } |
1313 | 1288 | ||
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/veth.c b/drivers/net/veth.c index fdd1e034569d..3f67a29593bc 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #include <net/dst.h> | 16 | #include <net/dst.h> |
17 | #include <net/xfrm.h> | 17 | #include <net/xfrm.h> |
18 | #include <net/veth.h> | 18 | #include <linux/veth.h> |
19 | 19 | ||
20 | #define DRV_NAME "veth" | 20 | #define DRV_NAME "veth" |
21 | #define DRV_VERSION "1.0" | 21 | #define DRV_VERSION "1.0" |
@@ -459,19 +459,7 @@ static __init int veth_init(void) | |||
459 | 459 | ||
460 | static __exit void veth_exit(void) | 460 | static __exit void veth_exit(void) |
461 | { | 461 | { |
462 | struct veth_priv *priv, *next; | 462 | rtnl_link_unregister(&veth_link_ops); |
463 | |||
464 | rtnl_lock(); | ||
465 | /* | ||
466 | * cannot trust __rtnl_link_unregister() to unregister all | ||
467 | * devices, as each ->dellink call will remove two devices | ||
468 | * from the list at once. | ||
469 | */ | ||
470 | list_for_each_entry_safe(priv, next, &veth_list, list) | ||
471 | veth_dellink(priv->dev); | ||
472 | |||
473 | __rtnl_link_unregister(&veth_link_ops); | ||
474 | rtnl_unlock(); | ||
475 | } | 463 | } |
476 | 464 | ||
477 | module_init(veth_init); | 465 | module_init(veth_init); |
diff --git a/drivers/net/wan/cycx_x25.c b/drivers/net/wan/cycx_x25.c index 8a1778cf98d1..d3b28b01b9f9 100644 --- a/drivers/net/wan/cycx_x25.c +++ b/drivers/net/wan/cycx_x25.c | |||
@@ -503,7 +503,7 @@ static int cycx_netdevice_init(struct net_device *dev) | |||
503 | dev->addr_len = 0; /* hardware address length */ | 503 | dev->addr_len = 0; /* hardware address length */ |
504 | 504 | ||
505 | if (!chan->svc) | 505 | if (!chan->svc) |
506 | *(u16*)dev->dev_addr = htons(chan->lcn); | 506 | *(__be16*)dev->dev_addr = htons(chan->lcn); |
507 | 507 | ||
508 | /* Initialize hardware parameters (just for reference) */ | 508 | /* Initialize hardware parameters (just for reference) */ |
509 | dev->irq = wandev->irq; | 509 | dev->irq = wandev->irq; |
@@ -565,7 +565,7 @@ static int cycx_netdevice_hard_header(struct sk_buff *skb, | |||
565 | const void *daddr, const void *saddr, | 565 | const void *daddr, const void *saddr, |
566 | unsigned len) | 566 | unsigned len) |
567 | { | 567 | { |
568 | skb->protocol = type; | 568 | skb->protocol = htons(type); |
569 | 569 | ||
570 | return dev->hard_header_len; | 570 | return dev->hard_header_len; |
571 | } | 571 | } |
@@ -600,15 +600,15 @@ static int cycx_netdevice_hard_start_xmit(struct sk_buff *skb, | |||
600 | struct cycx_device *card = chan->card; | 600 | struct cycx_device *card = chan->card; |
601 | 601 | ||
602 | if (!chan->svc) | 602 | if (!chan->svc) |
603 | chan->protocol = skb->protocol; | 603 | chan->protocol = ntohs(skb->protocol); |
604 | 604 | ||
605 | if (card->wandev.state != WAN_CONNECTED) | 605 | if (card->wandev.state != WAN_CONNECTED) |
606 | ++chan->ifstats.tx_dropped; | 606 | ++chan->ifstats.tx_dropped; |
607 | else if (chan->svc && chan->protocol && | 607 | else if (chan->svc && chan->protocol && |
608 | chan->protocol != skb->protocol) { | 608 | chan->protocol != ntohs(skb->protocol)) { |
609 | printk(KERN_INFO | 609 | printk(KERN_INFO |
610 | "%s: unsupported Ethertype 0x%04X on interface %s!\n", | 610 | "%s: unsupported Ethertype 0x%04X on interface %s!\n", |
611 | card->devname, skb->protocol, dev->name); | 611 | card->devname, ntohs(skb->protocol), dev->name); |
612 | ++chan->ifstats.tx_errors; | 612 | ++chan->ifstats.tx_errors; |
613 | } else if (chan->protocol == ETH_P_IP) { | 613 | } else if (chan->protocol == ETH_P_IP) { |
614 | switch (chan->state) { | 614 | switch (chan->state) { |
@@ -1401,7 +1401,7 @@ static void cycx_x25_set_chan_state(struct net_device *dev, u8 state) | |||
1401 | switch (state) { | 1401 | switch (state) { |
1402 | case WAN_CONNECTED: | 1402 | case WAN_CONNECTED: |
1403 | string_state = "connected!"; | 1403 | string_state = "connected!"; |
1404 | *(u16*)dev->dev_addr = htons(chan->lcn); | 1404 | *(__be16*)dev->dev_addr = htons(chan->lcn); |
1405 | netif_wake_queue(dev); | 1405 | netif_wake_queue(dev); |
1406 | reset_timer(dev); | 1406 | reset_timer(dev); |
1407 | 1407 | ||
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 | ||
141 | struct TxFD { | 141 | struct 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 | ||
149 | struct RxFD { | 151 | struct 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 | ||
183 | struct dscc4_pci_priv { | 185 | struct 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 | ||
685 | static void dscc4_free1(struct pci_dev *pdev) | 688 | static 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 | ||
1542 | try: | 1545 | try: |
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 | ||
1712 | try: | 1715 | try: |
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, | |||
890 | static void | 890 | static void |
891 | lmc_ssi_watchdog (lmc_softc_t * const sc) | 891 | lmc_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 | ||
46 | struct sbni_csr1 { | 46 | struct 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/Kconfig b/drivers/net/wireless/Kconfig index 5583719a0dca..2c08c0a5a0df 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig | |||
@@ -68,7 +68,7 @@ config WAVELAN | |||
68 | <http://www.tldp.org/docs.html#howto>. Some more specific | 68 | <http://www.tldp.org/docs.html#howto>. Some more specific |
69 | information is contained in | 69 | information is contained in |
70 | <file:Documentation/networking/wavelan.txt> and in the source code | 70 | <file:Documentation/networking/wavelan.txt> and in the source code |
71 | <file:drivers/net/wavelan.p.h>. | 71 | <file:drivers/net/wireless/wavelan.p.h>. |
72 | 72 | ||
73 | You will also need the wireless tools package available from | 73 | You will also need the wireless tools package available from |
74 | <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>. | 74 | <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>. |
@@ -587,15 +587,66 @@ config ADM8211 | |||
587 | config P54_COMMON | 587 | config P54_COMMON |
588 | tristate "Softmac Prism54 support" | 588 | tristate "Softmac Prism54 support" |
589 | depends on MAC80211 && WLAN_80211 && FW_LOADER && EXPERIMENTAL | 589 | depends on MAC80211 && WLAN_80211 && FW_LOADER && EXPERIMENTAL |
590 | ---help--- | ||
591 | This is common code for isl38xx based cards. | ||
592 | This module does nothing by itself - the USB/PCI frontends | ||
593 | also need to be enabled in order to support any devices. | ||
594 | |||
595 | These devices require softmac firmware which can be found at | ||
596 | http://prism54.org/ | ||
597 | |||
598 | If you choose to build a module, it'll be called p54common. | ||
590 | 599 | ||
591 | config P54_USB | 600 | config P54_USB |
592 | tristate "Prism54 USB support" | 601 | tristate "Prism54 USB support" |
593 | depends on P54_COMMON && USB | 602 | depends on P54_COMMON && USB |
594 | select CRC32 | 603 | select CRC32 |
604 | ---help--- | ||
605 | This driver is for USB isl38xx based wireless cards. | ||
606 | These are USB based adapters found in devices such as: | ||
607 | |||
608 | 3COM 3CRWE254G72 | ||
609 | SMC 2862W-G | ||
610 | Accton 802.11g WN4501 USB | ||
611 | Siemens Gigaset USB | ||
612 | Netgear WG121 | ||
613 | Netgear WG111 | ||
614 | Medion 40900, Roper Europe | ||
615 | Shuttle PN15, Airvast WM168g, IOGear GWU513 | ||
616 | Linksys WUSB54G | ||
617 | Linksys WUSB54G Portable | ||
618 | DLink DWL-G120 Spinnaker | ||
619 | DLink DWL-G122 | ||
620 | Belkin F5D7050 ver 1000 | ||
621 | Cohiba Proto board | ||
622 | SMC 2862W-G version 2 | ||
623 | U.S. Robotics U5 802.11g Adapter | ||
624 | FUJITSU E-5400 USB D1700 | ||
625 | Sagem XG703A | ||
626 | DLink DWL-G120 Cohiba | ||
627 | Spinnaker Proto board | ||
628 | Linksys WUSB54AG | ||
629 | Inventel UR054G | ||
630 | Spinnaker DUT | ||
631 | |||
632 | These devices require softmac firmware which can be found at | ||
633 | http://prism54.org/ | ||
634 | |||
635 | If you choose to build a module, it'll be called p54usb. | ||
595 | 636 | ||
596 | config P54_PCI | 637 | config P54_PCI |
597 | tristate "Prism54 PCI support" | 638 | tristate "Prism54 PCI support" |
598 | depends on P54_COMMON && PCI | 639 | depends on P54_COMMON && PCI |
640 | ---help--- | ||
641 | This driver is for PCI isl38xx based wireless cards. | ||
642 | This driver supports most devices that are supported by the | ||
643 | fullmac prism54 driver plus many devices which are not | ||
644 | supported by the fullmac driver/firmware. | ||
645 | |||
646 | This driver requires softmac firmware which can be found at | ||
647 | http://prism54.org/ | ||
648 | |||
649 | If you choose to build a module, it'll be called p54pci. | ||
599 | 650 | ||
600 | source "drivers/net/wireless/iwlwifi/Kconfig" | 651 | source "drivers/net/wireless/iwlwifi/Kconfig" |
601 | source "drivers/net/wireless/hostap/Kconfig" | 652 | source "drivers/net/wireless/hostap/Kconfig" |
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. */ |
42 | static inline u8 b43_freq_to_channel_a(int freq) | 42 | static inline u8 b43_freq_to_channel_5ghz(int freq) |
43 | { | 43 | { |
44 | return ((freq - 5000) / 5); | 44 | return ((freq - 5000) / 5); |
45 | } | 45 | } |
46 | static inline u8 b43_freq_to_channel_bg(int freq) | 46 | static 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 | } |
57 | static 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). */ |
65 | static inline int b43_channel_to_freq_a(u8 channel) | 59 | static inline int b43_channel_to_freq_5ghz(u8 channel) |
66 | { | 60 | { |
67 | return (5000 + (5 * channel)); | 61 | return (5000 + (5 * channel)); |
68 | } | 62 | } |
69 | static inline int b43_channel_to_freq_bg(u8 channel) | 63 | static 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 | } |
80 | static 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 | ||
87 | static inline int b43_is_cck_rate(int rate) | 75 | static 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: | |||
175 | err_free_polldev: | 178 | err_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; |
178 | err_free_rfk: | 181 | err_freed_rfk: |
179 | rfkill_free(rfk->rfkill); | ||
180 | rfk->rfkill = NULL; | 182 | rfk->rfkill = NULL; |
181 | out_error: | 183 | out_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 | ||
189 | u8 b43_plcp_get_ratecode_cck(const u8 bitrate); | 196 | u8 b43_plcp_get_ratecode_cck(const u8 bitrate); |
190 | u8 b43_plcp_get_ratecode_ofdm(const u8 bitrate); | 197 | u8 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 | ||
609 | MODULE_DEVICE_TABLE(pci, prism2_plx_id_table); | 609 | MODULE_DEVICE_TABLE(pci, prism2_plx_id_table); |
610 | 610 | ||
611 | static struct pci_driver prism2_plx_drv_id = { | 611 | static 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 | ||
619 | static int __init init_prism2_plx(void) | 619 | static 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 | ||
625 | static void __exit exit_prism2_plx(void) | 625 | static 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 da51f477e9df..003f73f89efa 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -1233,9 +1233,19 @@ static ssize_t show_event_log(struct device *d, | |||
1233 | { | 1233 | { |
1234 | struct ipw_priv *priv = dev_get_drvdata(d); | 1234 | struct ipw_priv *priv = dev_get_drvdata(d); |
1235 | u32 log_len = ipw_get_event_log_len(priv); | 1235 | u32 log_len = ipw_get_event_log_len(priv); |
1236 | struct ipw_event log[log_len]; | 1236 | u32 log_size; |
1237 | struct ipw_event *log; | ||
1237 | u32 len = 0, i; | 1238 | u32 len = 0, i; |
1238 | 1239 | ||
1240 | /* not using min() because of its strict type checking */ | ||
1241 | log_size = PAGE_SIZE / sizeof(*log) > log_len ? | ||
1242 | sizeof(*log) * log_len : PAGE_SIZE; | ||
1243 | log = kzalloc(log_size, GFP_KERNEL); | ||
1244 | if (!log) { | ||
1245 | IPW_ERROR("Unable to allocate memory for log\n"); | ||
1246 | return 0; | ||
1247 | } | ||
1248 | log_len = log_size / sizeof(*log); | ||
1239 | ipw_capture_event_log(priv, log_len, log); | 1249 | ipw_capture_event_log(priv, log_len, log); |
1240 | 1250 | ||
1241 | len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len); | 1251 | len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len); |
@@ -1244,6 +1254,7 @@ static ssize_t show_event_log(struct device *d, | |||
1244 | "\n%08X%08X%08X", | 1254 | "\n%08X%08X%08X", |
1245 | log[i].time, log[i].event, log[i].data); | 1255 | log[i].time, log[i].event, log[i].data); |
1246 | len += snprintf(buf + len, PAGE_SIZE - len, "\n"); | 1256 | len += snprintf(buf + len, PAGE_SIZE - len, "\n"); |
1257 | kfree(log); | ||
1247 | return len; | 1258 | return len; |
1248 | } | 1259 | } |
1249 | 1260 | ||
@@ -4924,7 +4935,7 @@ static int ipw_queue_reset(struct ipw_priv *priv) | |||
4924 | /** | 4935 | /** |
4925 | * Reclaim Tx queue entries no more used by NIC. | 4936 | * Reclaim Tx queue entries no more used by NIC. |
4926 | * | 4937 | * |
4927 | * When FW adwances 'R' index, all entries between old and | 4938 | * When FW advances 'R' index, all entries between old and |
4928 | * 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 |
4929 | * 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. |
4930 | * | 4941 | * |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 3d1da0759b97..1a6b0e0edf6f 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -6246,8 +6246,6 @@ static void __iwl_down(struct iwl_priv *priv) | |||
6246 | /* Unblock any waiting calls */ | 6246 | /* Unblock any waiting calls */ |
6247 | wake_up_interruptible_all(&priv->wait_command_queue); | 6247 | wake_up_interruptible_all(&priv->wait_command_queue); |
6248 | 6248 | ||
6249 | iwl_cancel_deferred_work(priv); | ||
6250 | |||
6251 | /* Wipe out the EXIT_PENDING status bit if we are not actually | 6249 | /* Wipe out the EXIT_PENDING status bit if we are not actually |
6252 | * exiting the module */ | 6250 | * exiting the module */ |
6253 | if (!exit_pending) | 6251 | if (!exit_pending) |
@@ -6322,6 +6320,8 @@ static void iwl_down(struct iwl_priv *priv) | |||
6322 | mutex_lock(&priv->mutex); | 6320 | mutex_lock(&priv->mutex); |
6323 | __iwl_down(priv); | 6321 | __iwl_down(priv); |
6324 | mutex_unlock(&priv->mutex); | 6322 | mutex_unlock(&priv->mutex); |
6323 | |||
6324 | iwl_cancel_deferred_work(priv); | ||
6325 | } | 6325 | } |
6326 | 6326 | ||
6327 | #define MAX_HW_RESTARTS 5 | 6327 | #define MAX_HW_RESTARTS 5 |
@@ -8580,10 +8580,9 @@ static void iwl_pci_remove(struct pci_dev *pdev) | |||
8580 | 8580 | ||
8581 | IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); | 8581 | IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); |
8582 | 8582 | ||
8583 | mutex_lock(&priv->mutex); | ||
8584 | set_bit(STATUS_EXIT_PENDING, &priv->status); | 8583 | set_bit(STATUS_EXIT_PENDING, &priv->status); |
8585 | __iwl_down(priv); | 8584 | |
8586 | mutex_unlock(&priv->mutex); | 8585 | iwl_down(priv); |
8587 | 8586 | ||
8588 | /* Free MAC hash list for ADHOC */ | 8587 | /* Free MAC hash list for ADHOC */ |
8589 | for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { | 8588 | for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { |
@@ -8642,12 +8641,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
8642 | { | 8641 | { |
8643 | struct iwl_priv *priv = pci_get_drvdata(pdev); | 8642 | struct iwl_priv *priv = pci_get_drvdata(pdev); |
8644 | 8643 | ||
8645 | mutex_lock(&priv->mutex); | ||
8646 | |||
8647 | set_bit(STATUS_IN_SUSPEND, &priv->status); | 8644 | set_bit(STATUS_IN_SUSPEND, &priv->status); |
8648 | 8645 | ||
8649 | /* Take down the device; powers it off, etc. */ | 8646 | /* Take down the device; powers it off, etc. */ |
8650 | __iwl_down(priv); | 8647 | iwl_down(priv); |
8651 | 8648 | ||
8652 | if (priv->mac80211_registered) | 8649 | if (priv->mac80211_registered) |
8653 | ieee80211_stop_queues(priv->hw); | 8650 | ieee80211_stop_queues(priv->hw); |
@@ -8656,8 +8653,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
8656 | pci_disable_device(pdev); | 8653 | pci_disable_device(pdev); |
8657 | pci_set_power_state(pdev, PCI_D3hot); | 8654 | pci_set_power_state(pdev, PCI_D3hot); |
8658 | 8655 | ||
8659 | mutex_unlock(&priv->mutex); | ||
8660 | |||
8661 | return 0; | 8656 | return 0; |
8662 | } | 8657 | } |
8663 | 8658 | ||
@@ -8715,8 +8710,6 @@ static int iwl_pci_resume(struct pci_dev *pdev) | |||
8715 | 8710 | ||
8716 | printk(KERN_INFO "Coming out of suspend...\n"); | 8711 | printk(KERN_INFO "Coming out of suspend...\n"); |
8717 | 8712 | ||
8718 | mutex_lock(&priv->mutex); | ||
8719 | |||
8720 | pci_set_power_state(pdev, PCI_D0); | 8713 | pci_set_power_state(pdev, PCI_D0); |
8721 | err = pci_enable_device(pdev); | 8714 | err = pci_enable_device(pdev); |
8722 | pci_restore_state(pdev); | 8715 | pci_restore_state(pdev); |
@@ -8730,7 +8723,6 @@ static int iwl_pci_resume(struct pci_dev *pdev) | |||
8730 | pci_write_config_byte(pdev, 0x41, 0x00); | 8723 | pci_write_config_byte(pdev, 0x41, 0x00); |
8731 | 8724 | ||
8732 | iwl_resume(priv); | 8725 | iwl_resume(priv); |
8733 | mutex_unlock(&priv->mutex); | ||
8734 | 8726 | ||
8735 | return 0; | 8727 | return 0; |
8736 | } | 8728 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index b54fe5e6d529..6cd57c220631 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -6601,8 +6601,6 @@ static void __iwl_down(struct iwl_priv *priv) | |||
6601 | /* Unblock any waiting calls */ | 6601 | /* Unblock any waiting calls */ |
6602 | wake_up_interruptible_all(&priv->wait_command_queue); | 6602 | wake_up_interruptible_all(&priv->wait_command_queue); |
6603 | 6603 | ||
6604 | iwl_cancel_deferred_work(priv); | ||
6605 | |||
6606 | /* Wipe out the EXIT_PENDING status bit if we are not actually | 6604 | /* Wipe out the EXIT_PENDING status bit if we are not actually |
6607 | * exiting the module */ | 6605 | * exiting the module */ |
6608 | if (!exit_pending) | 6606 | if (!exit_pending) |
@@ -6677,6 +6675,8 @@ static void iwl_down(struct iwl_priv *priv) | |||
6677 | mutex_lock(&priv->mutex); | 6675 | mutex_lock(&priv->mutex); |
6678 | __iwl_down(priv); | 6676 | __iwl_down(priv); |
6679 | mutex_unlock(&priv->mutex); | 6677 | mutex_unlock(&priv->mutex); |
6678 | |||
6679 | iwl_cancel_deferred_work(priv); | ||
6680 | } | 6680 | } |
6681 | 6681 | ||
6682 | #define MAX_HW_RESTARTS 5 | 6682 | #define MAX_HW_RESTARTS 5 |
@@ -9174,10 +9174,9 @@ static void iwl_pci_remove(struct pci_dev *pdev) | |||
9174 | 9174 | ||
9175 | IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); | 9175 | IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); |
9176 | 9176 | ||
9177 | mutex_lock(&priv->mutex); | ||
9178 | set_bit(STATUS_EXIT_PENDING, &priv->status); | 9177 | set_bit(STATUS_EXIT_PENDING, &priv->status); |
9179 | __iwl_down(priv); | 9178 | |
9180 | mutex_unlock(&priv->mutex); | 9179 | iwl_down(priv); |
9181 | 9180 | ||
9182 | /* Free MAC hash list for ADHOC */ | 9181 | /* Free MAC hash list for ADHOC */ |
9183 | for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { | 9182 | for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { |
@@ -9236,12 +9235,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
9236 | { | 9235 | { |
9237 | struct iwl_priv *priv = pci_get_drvdata(pdev); | 9236 | struct iwl_priv *priv = pci_get_drvdata(pdev); |
9238 | 9237 | ||
9239 | mutex_lock(&priv->mutex); | ||
9240 | |||
9241 | set_bit(STATUS_IN_SUSPEND, &priv->status); | 9238 | set_bit(STATUS_IN_SUSPEND, &priv->status); |
9242 | 9239 | ||
9243 | /* Take down the device; powers it off, etc. */ | 9240 | /* Take down the device; powers it off, etc. */ |
9244 | __iwl_down(priv); | 9241 | iwl_down(priv); |
9245 | 9242 | ||
9246 | if (priv->mac80211_registered) | 9243 | if (priv->mac80211_registered) |
9247 | ieee80211_stop_queues(priv->hw); | 9244 | ieee80211_stop_queues(priv->hw); |
@@ -9250,8 +9247,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
9250 | pci_disable_device(pdev); | 9247 | pci_disable_device(pdev); |
9251 | pci_set_power_state(pdev, PCI_D3hot); | 9248 | pci_set_power_state(pdev, PCI_D3hot); |
9252 | 9249 | ||
9253 | mutex_unlock(&priv->mutex); | ||
9254 | |||
9255 | return 0; | 9250 | return 0; |
9256 | } | 9251 | } |
9257 | 9252 | ||
@@ -9309,8 +9304,6 @@ static int iwl_pci_resume(struct pci_dev *pdev) | |||
9309 | 9304 | ||
9310 | printk(KERN_INFO "Coming out of suspend...\n"); | 9305 | printk(KERN_INFO "Coming out of suspend...\n"); |
9311 | 9306 | ||
9312 | mutex_lock(&priv->mutex); | ||
9313 | |||
9314 | pci_set_power_state(pdev, PCI_D0); | 9307 | pci_set_power_state(pdev, PCI_D0); |
9315 | err = pci_enable_device(pdev); | 9308 | err = pci_enable_device(pdev); |
9316 | pci_restore_state(pdev); | 9309 | pci_restore_state(pdev); |
@@ -9324,7 +9317,6 @@ static int iwl_pci_resume(struct pci_dev *pdev) | |||
9324 | pci_write_config_byte(pdev, 0x41, 0x00); | 9317 | pci_write_config_byte(pdev, 0x41, 0x00); |
9325 | 9318 | ||
9326 | iwl_resume(priv); | 9319 | iwl_resume(priv); |
9327 | mutex_unlock(&priv->mutex); | ||
9328 | 9320 | ||
9329 | return 0; | 9321 | return 0; |
9330 | } | 9322 | } |
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 = { | |||
257 | static void rt2500usb_config_mac_addr(struct rt2x00_dev *rt2x00dev, | 257 | static 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/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c index e454ae83e97a..bd1ab3b3afc0 100644 --- a/drivers/net/wireless/rtl8187_dev.c +++ b/drivers/net/wireless/rtl8187_dev.c | |||
@@ -38,6 +38,8 @@ static struct usb_device_id rtl8187_table[] __devinitdata = { | |||
38 | {USB_DEVICE(0x0846, 0x6a00)}, | 38 | {USB_DEVICE(0x0846, 0x6a00)}, |
39 | /* HP */ | 39 | /* HP */ |
40 | {USB_DEVICE(0x03f0, 0xca02)}, | 40 | {USB_DEVICE(0x03f0, 0xca02)}, |
41 | /* Sitecom */ | ||
42 | {USB_DEVICE(0x0df6, 0x000d)}, | ||
41 | {} | 43 | {} |
42 | }; | 44 | }; |
43 | 45 | ||
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/net/yellowfin.c b/drivers/net/yellowfin.c index 87f002ade531..fe6ff3e3d525 100644 --- a/drivers/net/yellowfin.c +++ b/drivers/net/yellowfin.c | |||
@@ -265,10 +265,10 @@ enum yellowfin_offsets { | |||
265 | /* The Yellowfin Rx and Tx buffer descriptors. | 265 | /* The Yellowfin Rx and Tx buffer descriptors. |
266 | Elements are written as 32 bit for endian portability. */ | 266 | Elements are written as 32 bit for endian portability. */ |
267 | struct yellowfin_desc { | 267 | struct yellowfin_desc { |
268 | u32 dbdma_cmd; | 268 | __le32 dbdma_cmd; |
269 | u32 addr; | 269 | __le32 addr; |
270 | u32 branch_addr; | 270 | __le32 branch_addr; |
271 | u32 result_status; | 271 | __le32 result_status; |
272 | }; | 272 | }; |
273 | 273 | ||
274 | struct tx_status_words { | 274 | struct tx_status_words { |
@@ -922,7 +922,7 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance) | |||
922 | dev->stats.tx_packets++; | 922 | dev->stats.tx_packets++; |
923 | dev->stats.tx_bytes += skb->len; | 923 | dev->stats.tx_bytes += skb->len; |
924 | /* Free the original skb. */ | 924 | /* Free the original skb. */ |
925 | pci_unmap_single(yp->pci_dev, yp->tx_ring[entry].addr, | 925 | pci_unmap_single(yp->pci_dev, le32_to_cpu(yp->tx_ring[entry].addr), |
926 | skb->len, PCI_DMA_TODEVICE); | 926 | skb->len, PCI_DMA_TODEVICE); |
927 | dev_kfree_skb_irq(skb); | 927 | dev_kfree_skb_irq(skb); |
928 | yp->tx_skbuff[entry] = NULL; | 928 | yp->tx_skbuff[entry] = NULL; |
@@ -1056,13 +1056,13 @@ static int yellowfin_rx(struct net_device *dev) | |||
1056 | 1056 | ||
1057 | if(!desc->result_status) | 1057 | if(!desc->result_status) |
1058 | break; | 1058 | break; |
1059 | pci_dma_sync_single_for_cpu(yp->pci_dev, desc->addr, | 1059 | pci_dma_sync_single_for_cpu(yp->pci_dev, le32_to_cpu(desc->addr), |
1060 | yp->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1060 | yp->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1061 | desc_status = le32_to_cpu(desc->result_status) >> 16; | 1061 | desc_status = le32_to_cpu(desc->result_status) >> 16; |
1062 | buf_addr = rx_skb->data; | 1062 | buf_addr = rx_skb->data; |
1063 | data_size = (le32_to_cpu(desc->dbdma_cmd) - | 1063 | data_size = (le32_to_cpu(desc->dbdma_cmd) - |
1064 | le32_to_cpu(desc->result_status)) & 0xffff; | 1064 | le32_to_cpu(desc->result_status)) & 0xffff; |
1065 | frame_status = le16_to_cpu(get_unaligned((s16*)&(buf_addr[data_size - 2]))); | 1065 | frame_status = le16_to_cpu(get_unaligned((__le16*)&(buf_addr[data_size - 2]))); |
1066 | if (yellowfin_debug > 4) | 1066 | if (yellowfin_debug > 4) |
1067 | printk(KERN_DEBUG " yellowfin_rx() status was %4.4x.\n", | 1067 | printk(KERN_DEBUG " yellowfin_rx() status was %4.4x.\n", |
1068 | frame_status); | 1068 | frame_status); |
@@ -1123,7 +1123,7 @@ static int yellowfin_rx(struct net_device *dev) | |||
1123 | if (pkt_len > rx_copybreak) { | 1123 | if (pkt_len > rx_copybreak) { |
1124 | skb_put(skb = rx_skb, pkt_len); | 1124 | skb_put(skb = rx_skb, pkt_len); |
1125 | pci_unmap_single(yp->pci_dev, | 1125 | pci_unmap_single(yp->pci_dev, |
1126 | yp->rx_ring[entry].addr, | 1126 | le32_to_cpu(yp->rx_ring[entry].addr), |
1127 | yp->rx_buf_sz, | 1127 | yp->rx_buf_sz, |
1128 | PCI_DMA_FROMDEVICE); | 1128 | PCI_DMA_FROMDEVICE); |
1129 | yp->rx_skbuff[entry] = NULL; | 1129 | yp->rx_skbuff[entry] = NULL; |
@@ -1134,9 +1134,10 @@ static int yellowfin_rx(struct net_device *dev) | |||
1134 | skb_reserve(skb, 2); /* 16 byte align the IP header */ | 1134 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
1135 | skb_copy_to_linear_data(skb, rx_skb->data, pkt_len); | 1135 | skb_copy_to_linear_data(skb, rx_skb->data, pkt_len); |
1136 | skb_put(skb, pkt_len); | 1136 | skb_put(skb, pkt_len); |
1137 | pci_dma_sync_single_for_device(yp->pci_dev, desc->addr, | 1137 | pci_dma_sync_single_for_device(yp->pci_dev, |
1138 | yp->rx_buf_sz, | 1138 | le32_to_cpu(desc->addr), |
1139 | PCI_DMA_FROMDEVICE); | 1139 | yp->rx_buf_sz, |
1140 | PCI_DMA_FROMDEVICE); | ||
1140 | } | 1141 | } |
1141 | skb->protocol = eth_type_trans(skb, dev); | 1142 | skb->protocol = eth_type_trans(skb, dev); |
1142 | netif_rx(skb); | 1143 | netif_rx(skb); |
@@ -1252,7 +1253,7 @@ static int yellowfin_close(struct net_device *dev) | |||
1252 | /* Free all the skbuffs in the Rx queue. */ | 1253 | /* Free all the skbuffs in the Rx queue. */ |
1253 | for (i = 0; i < RX_RING_SIZE; i++) { | 1254 | for (i = 0; i < RX_RING_SIZE; i++) { |
1254 | yp->rx_ring[i].dbdma_cmd = cpu_to_le32(CMD_STOP); | 1255 | yp->rx_ring[i].dbdma_cmd = cpu_to_le32(CMD_STOP); |
1255 | yp->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */ | 1256 | yp->rx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */ |
1256 | if (yp->rx_skbuff[i]) { | 1257 | if (yp->rx_skbuff[i]) { |
1257 | dev_kfree_skb(yp->rx_skbuff[i]); | 1258 | dev_kfree_skb(yp->rx_skbuff[i]); |
1258 | } | 1259 | } |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 2f75d695eed7..c5ca3134513a 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -455,22 +455,6 @@ struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int | |||
455 | return child; | 455 | return child; |
456 | } | 456 | } |
457 | 457 | ||
458 | static void pci_enable_crs(struct pci_dev *dev) | ||
459 | { | ||
460 | u16 cap, rpctl; | ||
461 | int rpcap = pci_find_capability(dev, PCI_CAP_ID_EXP); | ||
462 | if (!rpcap) | ||
463 | return; | ||
464 | |||
465 | pci_read_config_word(dev, rpcap + PCI_CAP_FLAGS, &cap); | ||
466 | if (((cap & PCI_EXP_FLAGS_TYPE) >> 4) != PCI_EXP_TYPE_ROOT_PORT) | ||
467 | return; | ||
468 | |||
469 | pci_read_config_word(dev, rpcap + PCI_EXP_RTCTL, &rpctl); | ||
470 | rpctl |= PCI_EXP_RTCTL_CRSSVE; | ||
471 | pci_write_config_word(dev, rpcap + PCI_EXP_RTCTL, rpctl); | ||
472 | } | ||
473 | |||
474 | static void pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max) | 458 | static void pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max) |
475 | { | 459 | { |
476 | struct pci_bus *parent = child->parent; | 460 | struct pci_bus *parent = child->parent; |
@@ -517,8 +501,6 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass | |||
517 | pci_write_config_word(dev, PCI_BRIDGE_CONTROL, | 501 | pci_write_config_word(dev, PCI_BRIDGE_CONTROL, |
518 | bctl & ~PCI_BRIDGE_CTL_MASTER_ABORT); | 502 | bctl & ~PCI_BRIDGE_CTL_MASTER_ABORT); |
519 | 503 | ||
520 | pci_enable_crs(dev); | ||
521 | |||
522 | if ((buses & 0xffff00) && !pcibios_assign_all_busses() && !is_cardbus) { | 504 | if ((buses & 0xffff00) && !pcibios_assign_all_busses() && !is_cardbus) { |
523 | unsigned int cmax, busnr; | 505 | unsigned int cmax, busnr; |
524 | /* | 506 | /* |
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 | |||
465 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, quirk_ich6_lpc_acpi ); | 465 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, quirk_ich6_lpc_acpi ); |
466 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, quirk_ich6_lpc_acpi ); | 466 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, quirk_ich6_lpc_acpi ); |
467 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, quirk_ich6_lpc_acpi ); | 467 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, quirk_ich6_lpc_acpi ); |
468 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_1, quirk_ich6_lpc_acpi ); | ||
469 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_4, quirk_ich6_lpc_acpi ); | ||
470 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_2, quirk_ich6_lpc_acpi ); | ||
471 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_4, quirk_ich6_lpc_acpi ); | ||
472 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_7, quirk_ich6_lpc_acpi ); | ||
473 | DECLARE_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/pcmcia/pxa2xx_lubbock.c b/drivers/pcmcia/pxa2xx_lubbock.c index 1510d6cde3e2..4a05802213c8 100644 --- a/drivers/pcmcia/pxa2xx_lubbock.c +++ b/drivers/pcmcia/pxa2xx_lubbock.c | |||
@@ -213,7 +213,7 @@ static struct pcmcia_low_level lubbock_pcmcia_ops = { | |||
213 | 213 | ||
214 | #include "pxa2xx_base.h" | 214 | #include "pxa2xx_base.h" |
215 | 215 | ||
216 | int __init pcmcia_lubbock_init(struct sa1111_dev *sadev) | 216 | int pcmcia_lubbock_init(struct sa1111_dev *sadev) |
217 | { | 217 | { |
218 | int ret = -ENODEV; | 218 | int ret = -ENODEV; |
219 | 219 | ||
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/ps3/ps3-vuart.c b/drivers/ps3/ps3-vuart.c index 9dea585ef806..bb8d5b1eec90 100644 --- a/drivers/ps3/ps3-vuart.c +++ b/drivers/ps3/ps3-vuart.c | |||
@@ -1074,7 +1074,6 @@ static int ps3_vuart_probe(struct ps3_system_bus_device *dev) | |||
1074 | if (result) { | 1074 | if (result) { |
1075 | dev_dbg(&dev->core, "%s:%d: drv->probe failed\n", | 1075 | dev_dbg(&dev->core, "%s:%d: drv->probe failed\n", |
1076 | __func__, __LINE__); | 1076 | __func__, __LINE__); |
1077 | down(&vuart_bus_priv.probe_mutex); | ||
1078 | goto fail_probe; | 1077 | goto fail_probe; |
1079 | } | 1078 | } |
1080 | 1079 | ||
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index a6676be87843..184c7ae78519 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -732,7 +732,7 @@ config SCSI_GDTH | |||
732 | This is a driver for RAID/SCSI Disk Array Controllers (EISA/ISA/PCI) | 732 | This is a driver for RAID/SCSI Disk Array Controllers (EISA/ISA/PCI) |
733 | manufactured by Intel Corporation/ICP vortex GmbH. It is documented | 733 | manufactured by Intel Corporation/ICP vortex GmbH. It is documented |
734 | in the kernel source in <file:drivers/scsi/gdth.c> and | 734 | in the kernel source in <file:drivers/scsi/gdth.c> and |
735 | <file:drivers/scsi/gdth.h.> | 735 | <file:drivers/scsi/gdth.h>. |
736 | 736 | ||
737 | To compile this driver as a module, choose M here: the | 737 | To compile this driver as a module, choose M here: the |
738 | module will be called gdth. | 738 | module will be called gdth. |
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 | ||
13909 | static PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] __devinitdata = { | 13909 | static 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 | ||
1834 | static void __devexit | 1834 | static void |
1835 | qla2x00_remove_one(struct pci_dev *pdev) | 1835 | qla2x00_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/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 0e81e4cf8876..a9ac5b1b1667 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -1332,7 +1332,7 @@ int scsi_prep_return(struct request_queue *q, struct request *req, int ret) | |||
1332 | } | 1332 | } |
1333 | EXPORT_SYMBOL(scsi_prep_return); | 1333 | EXPORT_SYMBOL(scsi_prep_return); |
1334 | 1334 | ||
1335 | static int scsi_prep_fn(struct request_queue *q, struct request *req) | 1335 | int scsi_prep_fn(struct request_queue *q, struct request *req) |
1336 | { | 1336 | { |
1337 | struct scsi_device *sdev = q->queuedata; | 1337 | struct scsi_device *sdev = q->queuedata; |
1338 | int ret = BLKPREP_KILL; | 1338 | int ret = BLKPREP_KILL; |
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h index eff005951895..3f34e9376b0a 100644 --- a/drivers/scsi/scsi_priv.h +++ b/drivers/scsi/scsi_priv.h | |||
@@ -74,6 +74,9 @@ extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev); | |||
74 | extern void scsi_free_queue(struct request_queue *q); | 74 | extern void scsi_free_queue(struct request_queue *q); |
75 | extern int scsi_init_queue(void); | 75 | extern int scsi_init_queue(void); |
76 | extern void scsi_exit_queue(void); | 76 | extern void scsi_exit_queue(void); |
77 | struct request_queue; | ||
78 | struct request; | ||
79 | extern int scsi_prep_fn(struct request_queue *, struct request *); | ||
77 | 80 | ||
78 | /* scsi_proc.c */ | 81 | /* scsi_proc.c */ |
79 | #ifdef CONFIG_SCSI_PROC_FS | 82 | #ifdef CONFIG_SCSI_PROC_FS |
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index f374fdcb6815..00b386677392 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -373,12 +373,29 @@ static int scsi_bus_resume(struct device * dev) | |||
373 | return err; | 373 | return err; |
374 | } | 374 | } |
375 | 375 | ||
376 | static int scsi_bus_remove(struct device *dev) | ||
377 | { | ||
378 | struct device_driver *drv = dev->driver; | ||
379 | struct scsi_device *sdev = to_scsi_device(dev); | ||
380 | int err = 0; | ||
381 | |||
382 | /* reset the prep_fn back to the default since the | ||
383 | * driver may have altered it and it's being removed */ | ||
384 | blk_queue_prep_rq(sdev->request_queue, scsi_prep_fn); | ||
385 | |||
386 | if (drv && drv->remove) | ||
387 | err = drv->remove(dev); | ||
388 | |||
389 | return 0; | ||
390 | } | ||
391 | |||
376 | struct bus_type scsi_bus_type = { | 392 | struct bus_type scsi_bus_type = { |
377 | .name = "scsi", | 393 | .name = "scsi", |
378 | .match = scsi_bus_match, | 394 | .match = scsi_bus_match, |
379 | .uevent = scsi_bus_uevent, | 395 | .uevent = scsi_bus_uevent, |
380 | .suspend = scsi_bus_suspend, | 396 | .suspend = scsi_bus_suspend, |
381 | .resume = scsi_bus_resume, | 397 | .resume = scsi_bus_resume, |
398 | .remove = scsi_bus_remove, | ||
382 | }; | 399 | }; |
383 | 400 | ||
384 | int scsi_sysfs_register(void) | 401 | int scsi_sysfs_register(void) |
diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index 44a340bd937b..65c584db33bd 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c | |||
@@ -265,7 +265,8 @@ EXPORT_SYMBOL_GPL(srp_rport_del); | |||
265 | 265 | ||
266 | static int do_srp_rport_del(struct device *dev, void *data) | 266 | static int do_srp_rport_del(struct device *dev, void *data) |
267 | { | 267 | { |
268 | srp_rport_del(dev_to_rport(dev)); | 268 | if (scsi_is_srp_rport(dev)) |
269 | srp_rport_del(dev_to_rport(dev)); | ||
269 | return 0; | 270 | return 0; |
270 | } | 271 | } |
271 | 272 | ||
diff --git a/drivers/serial/suncore.c b/drivers/serial/suncore.c index 707c5b03bce9..a2d4a19550ab 100644 --- a/drivers/serial/suncore.c +++ b/drivers/serial/suncore.c | |||
@@ -52,7 +52,7 @@ void sunserial_unregister_minors(struct uart_driver *drv, int count) | |||
52 | } | 52 | } |
53 | EXPORT_SYMBOL(sunserial_unregister_minors); | 53 | EXPORT_SYMBOL(sunserial_unregister_minors); |
54 | 54 | ||
55 | int __init sunserial_console_match(struct console *con, struct device_node *dp, | 55 | int sunserial_console_match(struct console *con, struct device_node *dp, |
56 | struct uart_driver *drv, int line) | 56 | struct uart_driver *drv, int line) |
57 | { | 57 | { |
58 | int off; | 58 | int off; |
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index 81639c6be1c7..f7f8580edad8 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c | |||
@@ -184,6 +184,7 @@ int spi_bitbang_setup(struct spi_device *spi) | |||
184 | struct spi_bitbang_cs *cs = spi->controller_state; | 184 | struct spi_bitbang_cs *cs = spi->controller_state; |
185 | struct spi_bitbang *bitbang; | 185 | struct spi_bitbang *bitbang; |
186 | int retval; | 186 | int retval; |
187 | unsigned long flags; | ||
187 | 188 | ||
188 | bitbang = spi_master_get_devdata(spi->master); | 189 | bitbang = spi_master_get_devdata(spi->master); |
189 | 190 | ||
@@ -222,12 +223,12 @@ int spi_bitbang_setup(struct spi_device *spi) | |||
222 | */ | 223 | */ |
223 | 224 | ||
224 | /* deselect chip (low or high) */ | 225 | /* deselect chip (low or high) */ |
225 | spin_lock(&bitbang->lock); | 226 | spin_lock_irqsave(&bitbang->lock, flags); |
226 | if (!bitbang->busy) { | 227 | if (!bitbang->busy) { |
227 | bitbang->chipselect(spi, BITBANG_CS_INACTIVE); | 228 | bitbang->chipselect(spi, BITBANG_CS_INACTIVE); |
228 | ndelay(cs->nsecs); | 229 | ndelay(cs->nsecs); |
229 | } | 230 | } |
230 | spin_unlock(&bitbang->lock); | 231 | spin_unlock_irqrestore(&bitbang->lock, flags); |
231 | 232 | ||
232 | return 0; | 233 | return 0; |
233 | } | 234 | } |
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/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c index 9bb7f64a85cd..038e7d7b4da1 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.c +++ b/drivers/usb/gadget/fsl_usb2_udc.c | |||
@@ -1318,7 +1318,7 @@ static void setup_received_irq(struct fsl_udc *udc, | |||
1318 | | USB_TYPE_STANDARD)) { | 1318 | | USB_TYPE_STANDARD)) { |
1319 | /* Note: The driver has not include OTG support yet. | 1319 | /* Note: The driver has not include OTG support yet. |
1320 | * This will be set when OTG support is added */ | 1320 | * This will be set when OTG support is added */ |
1321 | if (!gadget_is_otg(udc->gadget)) | 1321 | if (!gadget_is_otg(&udc->gadget)) |
1322 | break; | 1322 | break; |
1323 | else if (setup->bRequest == USB_DEVICE_B_HNP_ENABLE) | 1323 | else if (setup->bRequest == USB_DEVICE_B_HNP_ENABLE) |
1324 | udc->gadget.b_hnp_enable = 1; | 1324 | udc->gadget.b_hnp_enable = 1; |
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c index da16b5157816..22833589c4be 100644 --- a/drivers/usb/serial/cp2101.c +++ b/drivers/usb/serial/cp2101.c | |||
@@ -55,6 +55,7 @@ static int debug; | |||
55 | static struct usb_device_id id_table [] = { | 55 | static struct usb_device_id id_table [] = { |
56 | { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */ | 56 | { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */ |
57 | { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */ | 57 | { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */ |
58 | { USB_DEVICE(0x0FCF, 0x1004) }, /* Dynastream ANT2USB */ | ||
58 | { USB_DEVICE(0x10A6, 0xAA26) }, /* Knock-off DCU-11 cable */ | 59 | { USB_DEVICE(0x10A6, 0xAA26) }, /* Knock-off DCU-11 cable */ |
59 | { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ | 60 | { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ |
60 | { USB_DEVICE(0x10B5, 0xAC70) }, /* Nokia CA-42 USB */ | 61 | { USB_DEVICE(0x10B5, 0xAC70) }, /* Nokia CA-42 USB */ |
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index feba9679ace8..7c069a02c1dd 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -447,7 +447,7 @@ static void usa26_indat_callback(struct urb *urb) | |||
447 | 447 | ||
448 | port = (struct usb_serial_port *) urb->context; | 448 | port = (struct usb_serial_port *) urb->context; |
449 | tty = port->tty; | 449 | tty = port->tty; |
450 | if (urb->actual_length) { | 450 | if (tty && urb->actual_length) { |
451 | /* 0x80 bit is error flag */ | 451 | /* 0x80 bit is error flag */ |
452 | if ((data[0] & 0x80) == 0) { | 452 | if ((data[0] & 0x80) == 0) { |
453 | /* no errors on individual bytes, only possible overrun err*/ | 453 | /* no errors on individual bytes, only possible overrun err*/ |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index cf8add91de05..0da1df9c79bf 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -483,6 +483,13 @@ static void pl2303_set_termios(struct usb_serial_port *port, | |||
483 | } | 483 | } |
484 | spin_unlock_irqrestore(&priv->lock, flags); | 484 | spin_unlock_irqrestore(&priv->lock, flags); |
485 | 485 | ||
486 | /* The PL2303 is reported to lose bytes if you change | ||
487 | serial settings even to the same values as before. Thus | ||
488 | we actually need to filter in this specific case */ | ||
489 | |||
490 | if (!tty_termios_hw_change(port->tty->termios, old_termios)) | ||
491 | return; | ||
492 | |||
486 | cflag = port->tty->termios->c_cflag; | 493 | cflag = port->tty->termios->c_cflag; |
487 | 494 | ||
488 | buf = kzalloc(7, GFP_KERNEL); | 495 | buf = kzalloc(7, GFP_KERNEL); |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index e5c274044a5f..c295d0495f96 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -109,6 +109,7 @@ static struct usb_device_id id_table [] = { | |||
109 | { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */ | 109 | { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */ |
110 | { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ | 110 | { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ |
111 | { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */ | 111 | { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */ |
112 | { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 (Thinkpad internal) */ | ||
112 | { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ | 113 | { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ |
113 | { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/ | 114 | { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/ |
114 | { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/ | 115 | { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/ |
@@ -146,6 +147,7 @@ static struct usb_device_id id_table_3port [] = { | |||
146 | { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */ | 147 | { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */ |
147 | { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ | 148 | { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ |
148 | { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */ | 149 | { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */ |
150 | { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 (Thinkpad internal) */ | ||
149 | { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ | 151 | { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ |
150 | { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/ | 152 | { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/ |
151 | { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/ | 153 | { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/ |
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); | |||
801 | module_exit(atmel_lcdfb_exit); | 801 | module_exit(atmel_lcdfb_exit); |
802 | 802 | ||
803 | MODULE_DESCRIPTION("AT91/AT32 LCD Controller framebuffer driver"); | 803 | MODULE_DESCRIPTION("AT91/AT32 LCD Controller framebuffer driver"); |
804 | MODULE_AUTHOR("Nicolas Ferre <nicolas.ferre@rfo.atmel.com>"); | 804 | MODULE_AUTHOR("Nicolas Ferre <nicolas.ferre@atmel.com>"); |
805 | MODULE_LICENSE("GPL"); | 805 | MODULE_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 | ||
466 | out: | 464 | out: |
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..b3c31d9dc591 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c | |||
@@ -488,7 +488,7 @@ static int s3c2410fb_set_par(struct fb_info *info) | |||
488 | break; | 488 | break; |
489 | } | 489 | } |
490 | 490 | ||
491 | info->fix.line_length = (var->width * var->bits_per_pixel) / 8; | 491 | info->fix.line_length = (var->xres_virtual * var->bits_per_pixel) / 8; |
492 | 492 | ||
493 | /* activate this new configuration */ | 493 | /* activate this new configuration */ |
494 | 494 | ||
@@ -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 | ||
45 | static int mtrr __devinitdata = 3; /* enable mtrr by default */ | 45 | static int mtrr __devinitdata = 3; /* enable mtrr by default */ |
46 | static int blank __devinitdata = 1; /* enable blanking by default */ | 46 | static int blank = 1; /* enable blanking by default */ |
47 | static int ypan __devinitdata = 1; /* 0: scroll, 1: ypan, 2: ywrap */ | 47 | static int ypan __devinitdata = 1; /* 0: scroll, 1: ypan, 2: ywrap */ |
48 | static int pmi_setpal __devinitdata = 1; /* use PMI for palette changes */ | 48 | static int pmi_setpal __devinitdata = 1; /* use PMI for palette changes */ |
49 | static int nocrtc __devinitdata; /* ignore CRTC settings */ | 49 | static 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 | ||
1552 | static void uvesafb_init_mtrr(struct fb_info *info) | 1552 | static 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/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c index 4318935678c5..112f4ec59035 100644 --- a/drivers/w1/slaves/w1_therm.c +++ b/drivers/w1/slaves/w1_therm.c | |||
@@ -112,7 +112,7 @@ static struct w1_therm_family_converter w1_therm_families[] = { | |||
112 | 112 | ||
113 | static inline int w1_DS18B20_convert_temp(u8 rom[9]) | 113 | static inline int w1_DS18B20_convert_temp(u8 rom[9]) |
114 | { | 114 | { |
115 | int t = (rom[1] << 8) | rom[0]; | 115 | s16 t = (rom[1] << 8) | rom[0]; |
116 | t /= 16; | 116 | t /= 16; |
117 | return t; | 117 | return t; |
118 | } | 118 | } |
@@ -204,7 +204,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, | |||
204 | 204 | ||
205 | crc = w1_calc_crc8(rom, 8); | 205 | crc = w1_calc_crc8(rom, 8); |
206 | 206 | ||
207 | if (rom[8] == crc && rom[0]) | 207 | if (rom[8] == crc) |
208 | verdict = 1; | 208 | verdict = 1; |
209 | } | 209 | } |
210 | } | 210 | } |
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()) |