aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/agp/Kconfig2
-rw-r--r--drivers/hid/hid-input.c24
-rw-r--r--drivers/i2c/Kconfig9
-rw-r--r--drivers/i2c/Makefile2
-rw-r--r--drivers/i2c/algos/i2c-algo-bit.c9
-rw-r--r--drivers/i2c/busses/i2c-i801.c6
-rw-r--r--drivers/i2c/busses/i2c-powermac.c25
-rw-r--r--drivers/i2c/busses/i2c-xiic.c1
-rw-r--r--drivers/i2c/chips/Kconfig19
-rw-r--r--drivers/i2c/chips/Makefile18
-rw-r--r--drivers/i2c/i2c-smbus.c5
-rw-r--r--drivers/infiniband/core/mad.c3
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch.c2
-rw-r--r--drivers/infiniband/hw/nes/nes_hw.c8
-rw-r--r--drivers/infiniband/hw/nes/nes_hw.h1
-rw-r--r--drivers/infiniband/hw/nes/nes_nic.c30
-rw-r--r--drivers/infiniband/hw/nes/nes_verbs.c1
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c10
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ib.c9
-rw-r--r--drivers/input/evdev.c2
-rw-r--r--drivers/input/input.c38
-rw-r--r--drivers/input/joystick/gamecon.c2
-rw-r--r--drivers/input/keyboard/bf54x-keys.c2
-rw-r--r--drivers/input/misc/Kconfig11
-rw-r--r--drivers/input/misc/Makefile1
-rw-r--r--drivers/input/misc/ati_remote2.c14
-rw-r--r--drivers/input/misc/twl4030-vibra.c297
-rw-r--r--drivers/input/misc/winbond-cir.c12
-rw-r--r--drivers/input/misc/wm831x-on.c9
-rw-r--r--drivers/input/mouse/alps.c49
-rw-r--r--drivers/input/mouse/appletouch.c6
-rw-r--r--drivers/input/mousedev.c6
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h10
-rw-r--r--drivers/input/serio/i8042.c24
-rw-r--r--drivers/input/serio/serio_raw.c11
-rw-r--r--drivers/input/sparse-keymap.c6
-rw-r--r--drivers/input/tablet/wacom_sys.c4
-rw-r--r--drivers/input/tablet/wacom_wac.c165
-rw-r--r--drivers/input/tablet/wacom_wac.h1
-rw-r--r--drivers/input/touchscreen/Kconfig9
-rw-r--r--drivers/input/touchscreen/ad7877.c2
-rw-r--r--drivers/input/touchscreen/ads7846.c20
-rw-r--r--drivers/media/IR/ir-keytable.c4
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-remote.c4
-rw-r--r--drivers/misc/Kconfig10
-rw-r--r--drivers/misc/Makefile1
-rw-r--r--drivers/misc/eeprom/at24.c1
-rw-r--r--drivers/misc/tsl2550.c (renamed from drivers/i2c/chips/tsl2550.c)4
-rw-r--r--drivers/mtd/nand/Kconfig2
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/arm/ks8695net.c2
-rw-r--r--drivers/net/benet/be.h5
-rw-r--r--drivers/net/benet/be_cmds.c6
-rw-r--r--drivers/net/benet/be_hw.h5
-rw-r--r--drivers/net/benet/be_main.c25
-rw-r--r--drivers/net/can/bfin_can.c3
-rw-r--r--drivers/net/can/usb/ems_usb.c4
-rw-r--r--drivers/net/cassini.c2
-rw-r--r--drivers/net/cpmac.c14
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c1
-rw-r--r--drivers/net/davinci_emac.c2
-rw-r--r--drivers/net/e1000e/defines.h2
-rw-r--r--drivers/net/e1000e/ich8lan.c10
-rw-r--r--drivers/net/gianfar.c5
-rw-r--r--drivers/net/irda/irda-usb.c4
-rw-r--r--drivers/net/qlcnic/qlcnic.h13
-rw-r--r--drivers/net/qlcnic/qlcnic_ethtool.c17
-rw-r--r--drivers/net/qlcnic/qlcnic_hw.c32
-rw-r--r--drivers/net/qlcnic/qlcnic_init.c156
-rw-r--r--drivers/net/qlcnic/qlcnic_main.c5
-rw-r--r--drivers/net/r8169.c4
-rw-r--r--drivers/net/s2io.c6
-rw-r--r--drivers/net/sky2.c2
-rw-r--r--drivers/net/smc91x.h42
-rw-r--r--drivers/net/tg3.c4
-rw-r--r--drivers/net/tulip/eeprom.c54
-rw-r--r--drivers/net/typhoon.c6
-rw-r--r--drivers/net/usb/asix.c30
-rw-r--r--drivers/net/usb/pegasus.h6
-rw-r--r--drivers/net/wireless/airo.c3
-rw-r--r--drivers/net/wireless/ath/ar9170/ar9170.h1
-rw-r--r--drivers/net/wireless/ath/ar9170/main.c10
-rw-r--r--drivers/net/wireless/ath/ar9170/usb.c170
-rw-r--r--drivers/net/wireless/ath/ath5k/eeprom.c4
-rw-r--r--drivers/net/wireless/ath/ath5k/phy.c41
-rw-r--r--drivers/net/wireless/ath/ath5k/reg.h1
-rw-r--r--drivers/net/wireless/ath/ath5k/reset.c22
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c6
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c4
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2200.c19
-rw-r--r--drivers/net/wireless/ipw2x00/libipw.h2
-rw-r--r--drivers/net/wireless/ipw2x00/libipw_module.c37
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c159
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c49
-rw-r--r--drivers/net/wireless/rndis_wlan.c66
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00soc.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00soc.h2
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c2
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c10
-rw-r--r--drivers/platform/x86/dell-wmi.c16
-rw-r--r--drivers/platform/x86/hp-wmi.c15
-rw-r--r--drivers/platform/x86/panasonic-laptop.c15
-rw-r--r--drivers/platform/x86/topstar-laptop.c13
-rw-r--r--drivers/platform/x86/toshiba_acpi.c17
-rw-r--r--drivers/s390/net/qeth_core.h3
-rw-r--r--drivers/s390/net/qeth_core_main.c5
-rw-r--r--drivers/s390/net/qeth_core_sys.c3
-rw-r--r--drivers/s390/net/qeth_l2_main.c16
-rw-r--r--drivers/s390/net/qeth_l3_main.c82
-rw-r--r--drivers/scsi/qlogicpti.c2
-rw-r--r--drivers/video/Kconfig14
-rw-r--r--drivers/video/Makefile1
-rw-r--r--drivers/video/sunxvr1000.c228
116 files changed, 1627 insertions, 802 deletions
diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig
index 2fb3a480f6b0..4b66c69eaf57 100644
--- a/drivers/char/agp/Kconfig
+++ b/drivers/char/agp/Kconfig
@@ -57,7 +57,7 @@ config AGP_AMD
57 57
58config AGP_AMD64 58config AGP_AMD64
59 tristate "AMD Opteron/Athlon64 on-CPU GART support" 59 tristate "AMD Opteron/Athlon64 on-CPU GART support"
60 depends on AGP && X86 60 depends on AGP && X86 && K8_NB
61 help 61 help
62 This option gives you AGP support for the GLX component of 62 This option gives you AGP support for the GLX component of
63 X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs. 63 X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs.
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 79d9edd0bdfa..7a0d2e4661a1 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -68,22 +68,25 @@ static const struct {
68#define map_key_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \ 68#define map_key_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \
69 &max, EV_KEY, (c)) 69 &max, EV_KEY, (c))
70 70
71static inline int match_scancode(int code, int scancode) 71static inline int match_scancode(unsigned int code, unsigned int scancode)
72{ 72{
73 if (scancode == 0) 73 if (scancode == 0)
74 return 1; 74 return 1;
75 return ((code & (HID_USAGE_PAGE | HID_USAGE)) == scancode); 75
76 return (code & (HID_USAGE_PAGE | HID_USAGE)) == scancode;
76} 77}
77 78
78static inline int match_keycode(int code, int keycode) 79static inline int match_keycode(unsigned int code, unsigned int keycode)
79{ 80{
80 if (keycode == 0) 81 if (keycode == 0)
81 return 1; 82 return 1;
82 return (code == keycode); 83
84 return code == keycode;
83} 85}
84 86
85static struct hid_usage *hidinput_find_key(struct hid_device *hid, 87static struct hid_usage *hidinput_find_key(struct hid_device *hid,
86 int scancode, int keycode) 88 unsigned int scancode,
89 unsigned int keycode)
87{ 90{
88 int i, j, k; 91 int i, j, k;
89 struct hid_report *report; 92 struct hid_report *report;
@@ -105,8 +108,8 @@ static struct hid_usage *hidinput_find_key(struct hid_device *hid,
105 return NULL; 108 return NULL;
106} 109}
107 110
108static int hidinput_getkeycode(struct input_dev *dev, int scancode, 111static int hidinput_getkeycode(struct input_dev *dev,
109 int *keycode) 112 unsigned int scancode, unsigned int *keycode)
110{ 113{
111 struct hid_device *hid = input_get_drvdata(dev); 114 struct hid_device *hid = input_get_drvdata(dev);
112 struct hid_usage *usage; 115 struct hid_usage *usage;
@@ -119,16 +122,13 @@ static int hidinput_getkeycode(struct input_dev *dev, int scancode,
119 return -EINVAL; 122 return -EINVAL;
120} 123}
121 124
122static int hidinput_setkeycode(struct input_dev *dev, int scancode, 125static int hidinput_setkeycode(struct input_dev *dev,
123 int keycode) 126 unsigned int scancode, unsigned int keycode)
124{ 127{
125 struct hid_device *hid = input_get_drvdata(dev); 128 struct hid_device *hid = input_get_drvdata(dev);
126 struct hid_usage *usage; 129 struct hid_usage *usage;
127 int old_keycode; 130 int old_keycode;
128 131
129 if (keycode < 0 || keycode > KEY_MAX)
130 return -EINVAL;
131
132 usage = hidinput_find_key(hid, scancode, 0); 132 usage = hidinput_find_key(hid, scancode, 0);
133 if (usage) { 133 if (usage) {
134 old_keycode = usage->code; 134 old_keycode = usage->code;
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
index 02ce9cff5fcf..d06083fdffbb 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
@@ -73,7 +73,6 @@ config I2C_SMBUS
73 73
74source drivers/i2c/algos/Kconfig 74source drivers/i2c/algos/Kconfig
75source drivers/i2c/busses/Kconfig 75source drivers/i2c/busses/Kconfig
76source drivers/i2c/chips/Kconfig
77 76
78config I2C_DEBUG_CORE 77config I2C_DEBUG_CORE
79 bool "I2C Core debugging messages" 78 bool "I2C Core debugging messages"
@@ -98,12 +97,4 @@ config I2C_DEBUG_BUS
98 a problem with I2C support and want to see more of what is going 97 a problem with I2C support and want to see more of what is going
99 on. 98 on.
100 99
101config I2C_DEBUG_CHIP
102 bool "I2C Chip debugging messages"
103 help
104 Say Y here if you want the I2C chip drivers to produce a bunch of
105 debug messages to the system log. Select this if you are having
106 a problem with I2C support and want to see more of what is going
107 on.
108
109endif # I2C 100endif # I2C
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
index acd0250c16a0..a7d9b4be9bb3 100644
--- a/drivers/i2c/Makefile
+++ b/drivers/i2c/Makefile
@@ -6,7 +6,7 @@ obj-$(CONFIG_I2C_BOARDINFO) += i2c-boardinfo.o
6obj-$(CONFIG_I2C) += i2c-core.o 6obj-$(CONFIG_I2C) += i2c-core.o
7obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o 7obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o
8obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o 8obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o
9obj-y += busses/ chips/ algos/ 9obj-y += algos/ busses/
10 10
11ifeq ($(CONFIG_I2C_DEBUG_CORE),y) 11ifeq ($(CONFIG_I2C_DEBUG_CORE),y)
12EXTRA_CFLAGS += -DDEBUG 12EXTRA_CFLAGS += -DDEBUG
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index e25e13980af3..e8d568c3fb09 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -522,6 +522,12 @@ static int bit_xfer(struct i2c_adapter *i2c_adap,
522 int i, ret; 522 int i, ret;
523 unsigned short nak_ok; 523 unsigned short nak_ok;
524 524
525 if (adap->pre_xfer) {
526 ret = adap->pre_xfer(i2c_adap);
527 if (ret < 0)
528 return ret;
529 }
530
525 bit_dbg(3, &i2c_adap->dev, "emitting start condition\n"); 531 bit_dbg(3, &i2c_adap->dev, "emitting start condition\n");
526 i2c_start(adap); 532 i2c_start(adap);
527 for (i = 0; i < num; i++) { 533 for (i = 0; i < num; i++) {
@@ -570,6 +576,9 @@ static int bit_xfer(struct i2c_adapter *i2c_adap,
570bailout: 576bailout:
571 bit_dbg(3, &i2c_adap->dev, "emitting stop condition\n"); 577 bit_dbg(3, &i2c_adap->dev, "emitting stop condition\n");
572 i2c_stop(adap); 578 i2c_stop(adap);
579
580 if (adap->post_xfer)
581 adap->post_xfer(i2c_adap);
573 return ret; 582 return ret;
574} 583}
575 584
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 9da5b05cdb52..299b918455a3 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -416,9 +416,11 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
416 data->block[0] = 32; /* max for SMBus block reads */ 416 data->block[0] = 32; /* max for SMBus block reads */
417 } 417 }
418 418
419 /* Experience has shown that the block buffer can only be used for
420 SMBus (not I2C) block transactions, even though the datasheet
421 doesn't mention this limitation. */
419 if ((i801_features & FEATURE_BLOCK_BUFFER) 422 if ((i801_features & FEATURE_BLOCK_BUFFER)
420 && !(command == I2C_SMBUS_I2C_BLOCK_DATA 423 && command != I2C_SMBUS_I2C_BLOCK_DATA
421 && read_write == I2C_SMBUS_READ)
422 && i801_set_block_buffer_mode() == 0) 424 && i801_set_block_buffer_mode() == 0)
423 result = i801_block_transaction_by_block(data, read_write, 425 result = i801_block_transaction_by_block(data, read_write,
424 hwpec); 426 hwpec);
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c
index 1c440a70ec61..b289ec99eeba 100644
--- a/drivers/i2c/busses/i2c-powermac.c
+++ b/drivers/i2c/busses/i2c-powermac.c
@@ -122,9 +122,14 @@ static s32 i2c_powermac_smbus_xfer( struct i2c_adapter* adap,
122 122
123 rc = pmac_i2c_xfer(bus, addrdir, subsize, subaddr, buf, len); 123 rc = pmac_i2c_xfer(bus, addrdir, subsize, subaddr, buf, len);
124 if (rc) { 124 if (rc) {
125 dev_err(&adap->dev, 125 if (rc == -ENXIO)
126 "I2C transfer at 0x%02x failed, size %d, err %d\n", 126 dev_dbg(&adap->dev,
127 addrdir >> 1, size, rc); 127 "I2C transfer at 0x%02x failed, size %d, "
128 "err %d\n", addrdir >> 1, size, rc);
129 else
130 dev_err(&adap->dev,
131 "I2C transfer at 0x%02x failed, size %d, "
132 "err %d\n", addrdir >> 1, size, rc);
128 goto bail; 133 goto bail;
129 } 134 }
130 135
@@ -175,10 +180,16 @@ static int i2c_powermac_master_xfer( struct i2c_adapter *adap,
175 goto bail; 180 goto bail;
176 } 181 }
177 rc = pmac_i2c_xfer(bus, addrdir, 0, 0, msgs->buf, msgs->len); 182 rc = pmac_i2c_xfer(bus, addrdir, 0, 0, msgs->buf, msgs->len);
178 if (rc < 0) 183 if (rc < 0) {
179 dev_err(&adap->dev, "I2C %s 0x%02x failed, err %d\n", 184 if (rc == -ENXIO)
180 addrdir & 1 ? "read from" : "write to", addrdir >> 1, 185 dev_dbg(&adap->dev, "I2C %s 0x%02x failed, err %d\n",
181 rc); 186 addrdir & 1 ? "read from" : "write to",
187 addrdir >> 1, rc);
188 else
189 dev_err(&adap->dev, "I2C %s 0x%02x failed, err %d\n",
190 addrdir & 1 ? "read from" : "write to",
191 addrdir >> 1, rc);
192 }
182 bail: 193 bail:
183 pmac_i2c_close(bus); 194 pmac_i2c_close(bus);
184 return rc < 0 ? rc : 1; 195 return rc < 0 ? rc : 1;
diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index eece39a5a30e..f0ef8da6c554 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -32,6 +32,7 @@
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/errno.h> 34#include <linux/errno.h>
35#include <linux/delay.h>
35#include <linux/platform_device.h> 36#include <linux/platform_device.h>
36#include <linux/i2c.h> 37#include <linux/i2c.h>
37#include <linux/interrupt.h> 38#include <linux/interrupt.h>
diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
deleted file mode 100644
index ae4539d99bef..000000000000
--- a/drivers/i2c/chips/Kconfig
+++ /dev/null
@@ -1,19 +0,0 @@
1#
2# Miscellaneous I2C chip drivers configuration
3#
4# *** DEPRECATED! Do not add new entries! See Makefile ***
5#
6
7menu "Miscellaneous I2C Chip support"
8
9config SENSORS_TSL2550
10 tristate "Taos TSL2550 ambient light sensor"
11 depends on EXPERIMENTAL
12 help
13 If you say yes here you get support for the Taos TSL2550
14 ambient light sensor.
15
16 This driver can also be built as a module. If so, the module
17 will be called tsl2550.
18
19endmenu
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
deleted file mode 100644
index fe0af0f81f2d..000000000000
--- a/drivers/i2c/chips/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
1#
2# Makefile for miscellaneous I2C chip drivers.
3#
4# Do not add new drivers to this directory! It is DEPRECATED.
5#
6# Device drivers are better grouped according to the functionality they
7# implement rather than to the bus they are connected to. In particular:
8# * Hardware monitoring chip drivers go to drivers/hwmon
9# * RTC chip drivers go to drivers/rtc
10# * I/O expander drivers go to drivers/gpio
11#
12
13obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o
14
15ifeq ($(CONFIG_I2C_DEBUG_CHIP),y)
16EXTRA_CFLAGS += -DDEBUG
17endif
18
diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c
index 421278221243..7a8201ed2181 100644
--- a/drivers/i2c/i2c-smbus.c
+++ b/drivers/i2c/i2c-smbus.c
@@ -22,7 +22,6 @@
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/device.h> 24#include <linux/device.h>
25#include <linux/semaphore.h>
26#include <linux/interrupt.h> 25#include <linux/interrupt.h>
27#include <linux/workqueue.h> 26#include <linux/workqueue.h>
28#include <linux/i2c.h> 27#include <linux/i2c.h>
@@ -55,7 +54,7 @@ static int smbus_do_alert(struct device *dev, void *addrp)
55 * Drivers should either disable alerts, or provide at least 54 * Drivers should either disable alerts, or provide at least
56 * a minimal handler. Lock so client->driver won't change. 55 * a minimal handler. Lock so client->driver won't change.
57 */ 56 */
58 down(&dev->sem); 57 device_lock(dev);
59 if (client->driver) { 58 if (client->driver) {
60 if (client->driver->alert) 59 if (client->driver->alert)
61 client->driver->alert(client, data->flag); 60 client->driver->alert(client, data->flag);
@@ -63,7 +62,7 @@ static int smbus_do_alert(struct device *dev, void *addrp)
63 dev_warn(&client->dev, "no driver alert()!\n"); 62 dev_warn(&client->dev, "no driver alert()!\n");
64 } else 63 } else
65 dev_dbg(&client->dev, "alert with no driver\n"); 64 dev_dbg(&client->dev, "alert with no driver\n");
66 up(&dev->sem); 65 device_unlock(dev);
67 66
68 /* Stop iterating after we find the device */ 67 /* Stop iterating after we find the device */
69 return -EBUSY; 68 return -EBUSY;
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index 58463da814d1..e351b1548535 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -2953,6 +2953,9 @@ static void ib_mad_remove_device(struct ib_device *device)
2953{ 2953{
2954 int i, num_ports, cur_port; 2954 int i, num_ports, cur_port;
2955 2955
2956 if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB)
2957 return;
2958
2956 if (device->node_type == RDMA_NODE_IB_SWITCH) { 2959 if (device->node_type == RDMA_NODE_IB_SWITCH) {
2957 num_ports = 1; 2960 num_ports = 1;
2958 cur_port = 0; 2961 cur_port = 0;
diff --git a/drivers/infiniband/hw/cxgb3/iwch.c b/drivers/infiniband/hw/cxgb3/iwch.c
index ee1d8b4d4541..63f975f3e30f 100644
--- a/drivers/infiniband/hw/cxgb3/iwch.c
+++ b/drivers/infiniband/hw/cxgb3/iwch.c
@@ -189,6 +189,7 @@ static void close_rnic_dev(struct t3cdev *tdev)
189 list_for_each_entry_safe(dev, tmp, &dev_list, entry) { 189 list_for_each_entry_safe(dev, tmp, &dev_list, entry) {
190 if (dev->rdev.t3cdev_p == tdev) { 190 if (dev->rdev.t3cdev_p == tdev) {
191 dev->rdev.flags = CXIO_ERROR_FATAL; 191 dev->rdev.flags = CXIO_ERROR_FATAL;
192 synchronize_net();
192 cancel_delayed_work_sync(&dev->db_drop_task); 193 cancel_delayed_work_sync(&dev->db_drop_task);
193 list_del(&dev->entry); 194 list_del(&dev->entry);
194 iwch_unregister_device(dev); 195 iwch_unregister_device(dev);
@@ -217,6 +218,7 @@ static void iwch_event_handler(struct t3cdev *tdev, u32 evt, u32 port_id)
217 switch (evt) { 218 switch (evt) {
218 case OFFLOAD_STATUS_DOWN: { 219 case OFFLOAD_STATUS_DOWN: {
219 rdev->flags = CXIO_ERROR_FATAL; 220 rdev->flags = CXIO_ERROR_FATAL;
221 synchronize_net();
220 event.event = IB_EVENT_DEVICE_FATAL; 222 event.event = IB_EVENT_DEVICE_FATAL;
221 dispatch = 1; 223 dispatch = 1;
222 break; 224 break;
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c
index ce7f53833577..925075557dc2 100644
--- a/drivers/infiniband/hw/nes/nes_hw.c
+++ b/drivers/infiniband/hw/nes/nes_hw.c
@@ -1899,9 +1899,14 @@ void nes_destroy_nic_qp(struct nes_vnic *nesvnic)
1899 u16 wqe_fragment_index; 1899 u16 wqe_fragment_index;
1900 u64 wqe_frag; 1900 u64 wqe_frag;
1901 u32 cqp_head; 1901 u32 cqp_head;
1902 u32 wqm_cfg0;
1902 unsigned long flags; 1903 unsigned long flags;
1903 int ret; 1904 int ret;
1904 1905
1906 /* clear wqe stall before destroying NIC QP */
1907 wqm_cfg0 = nes_read_indexed(nesdev, NES_IDX_WQM_CONFIG0);
1908 nes_write_indexed(nesdev, NES_IDX_WQM_CONFIG0, wqm_cfg0 & 0xFFFF7FFF);
1909
1905 /* Free remaining NIC receive buffers */ 1910 /* Free remaining NIC receive buffers */
1906 while (nesvnic->nic.rq_head != nesvnic->nic.rq_tail) { 1911 while (nesvnic->nic.rq_head != nesvnic->nic.rq_tail) {
1907 nic_rqe = &nesvnic->nic.rq_vbase[nesvnic->nic.rq_tail]; 1912 nic_rqe = &nesvnic->nic.rq_vbase[nesvnic->nic.rq_tail];
@@ -2020,6 +2025,9 @@ void nes_destroy_nic_qp(struct nes_vnic *nesvnic)
2020 2025
2021 pci_free_consistent(nesdev->pcidev, nesvnic->nic_mem_size, nesvnic->nic_vbase, 2026 pci_free_consistent(nesdev->pcidev, nesvnic->nic_mem_size, nesvnic->nic_vbase,
2022 nesvnic->nic_pbase); 2027 nesvnic->nic_pbase);
2028
2029 /* restore old wqm_cfg0 value */
2030 nes_write_indexed(nesdev, NES_IDX_WQM_CONFIG0, wqm_cfg0);
2023} 2031}
2024 2032
2025/** 2033/**
diff --git a/drivers/infiniband/hw/nes/nes_hw.h b/drivers/infiniband/hw/nes/nes_hw.h
index 9b1e7f869d83..bbbfe9fc5a5a 100644
--- a/drivers/infiniband/hw/nes/nes_hw.h
+++ b/drivers/infiniband/hw/nes/nes_hw.h
@@ -160,6 +160,7 @@ enum indexed_regs {
160 NES_IDX_ENDNODE0_NSTAT_TX_OCTETS_HI = 0x7004, 160 NES_IDX_ENDNODE0_NSTAT_TX_OCTETS_HI = 0x7004,
161 NES_IDX_ENDNODE0_NSTAT_TX_FRAMES_LO = 0x7008, 161 NES_IDX_ENDNODE0_NSTAT_TX_FRAMES_LO = 0x7008,
162 NES_IDX_ENDNODE0_NSTAT_TX_FRAMES_HI = 0x700c, 162 NES_IDX_ENDNODE0_NSTAT_TX_FRAMES_HI = 0x700c,
163 NES_IDX_WQM_CONFIG0 = 0x5000,
163 NES_IDX_WQM_CONFIG1 = 0x5004, 164 NES_IDX_WQM_CONFIG1 = 0x5004,
164 NES_IDX_CM_CONFIG = 0x5100, 165 NES_IDX_CM_CONFIG = 0x5100,
165 NES_IDX_NIC_LOGPORT_TO_PHYPORT = 0x6000, 166 NES_IDX_NIC_LOGPORT_TO_PHYPORT = 0x6000,
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c
index a1d79b6856ac..91fdde382e82 100644
--- a/drivers/infiniband/hw/nes/nes_nic.c
+++ b/drivers/infiniband/hw/nes/nes_nic.c
@@ -1595,7 +1595,6 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
1595 struct nes_vnic *nesvnic; 1595 struct nes_vnic *nesvnic;
1596 struct net_device *netdev; 1596 struct net_device *netdev;
1597 struct nic_qp_map *curr_qp_map; 1597 struct nic_qp_map *curr_qp_map;
1598 u32 u32temp;
1599 u8 phy_type = nesdev->nesadapter->phy_type[nesdev->mac_index]; 1598 u8 phy_type = nesdev->nesadapter->phy_type[nesdev->mac_index];
1600 1599
1601 netdev = alloc_etherdev(sizeof(struct nes_vnic)); 1600 netdev = alloc_etherdev(sizeof(struct nes_vnic));
@@ -1707,6 +1706,10 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
1707 ((phy_type == NES_PHY_TYPE_PUMA_1G) && 1706 ((phy_type == NES_PHY_TYPE_PUMA_1G) &&
1708 (((PCI_FUNC(nesdev->pcidev->devfn) == 1) && (nesdev->mac_index == 2)) || 1707 (((PCI_FUNC(nesdev->pcidev->devfn) == 1) && (nesdev->mac_index == 2)) ||
1709 ((PCI_FUNC(nesdev->pcidev->devfn) == 2) && (nesdev->mac_index == 1)))))) { 1708 ((PCI_FUNC(nesdev->pcidev->devfn) == 2) && (nesdev->mac_index == 1)))))) {
1709 u32 u32temp;
1710 u32 link_mask;
1711 u32 link_val;
1712
1710 u32temp = nes_read_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 + 1713 u32temp = nes_read_indexed(nesdev, NES_IDX_PHY_PCS_CONTROL_STATUS0 +
1711 (0x200 * (nesdev->mac_index & 1))); 1714 (0x200 * (nesdev->mac_index & 1)));
1712 if (phy_type != NES_PHY_TYPE_PUMA_1G) { 1715 if (phy_type != NES_PHY_TYPE_PUMA_1G) {
@@ -1715,13 +1718,36 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
1715 (0x200 * (nesdev->mac_index & 1)), u32temp); 1718 (0x200 * (nesdev->mac_index & 1)), u32temp);
1716 } 1719 }
1717 1720
1721 /* Check and set linkup here. This is for back to back */
1722 /* configuration where second port won't get link interrupt */
1723 switch (phy_type) {
1724 case NES_PHY_TYPE_PUMA_1G:
1725 if (nesdev->mac_index < 2) {
1726 link_mask = 0x01010000;
1727 link_val = 0x01010000;
1728 } else {
1729 link_mask = 0x02020000;
1730 link_val = 0x02020000;
1731 }
1732 break;
1733 default:
1734 link_mask = 0x0f1f0000;
1735 link_val = 0x0f0f0000;
1736 break;
1737 }
1738
1739 u32temp = nes_read_indexed(nesdev,
1740 NES_IDX_PHY_PCS_CONTROL_STATUS0 +
1741 (0x200 * (nesdev->mac_index & 1)));
1742 if ((u32temp & link_mask) == link_val)
1743 nesvnic->linkup = 1;
1744
1718 /* clear the MAC interrupt status, assumes direct logical to physical mapping */ 1745 /* clear the MAC interrupt status, assumes direct logical to physical mapping */
1719 u32temp = nes_read_indexed(nesdev, NES_IDX_MAC_INT_STATUS + (0x200 * nesdev->mac_index)); 1746 u32temp = nes_read_indexed(nesdev, NES_IDX_MAC_INT_STATUS + (0x200 * nesdev->mac_index));
1720 nes_debug(NES_DBG_INIT, "Phy interrupt status = 0x%X.\n", u32temp); 1747 nes_debug(NES_DBG_INIT, "Phy interrupt status = 0x%X.\n", u32temp);
1721 nes_write_indexed(nesdev, NES_IDX_MAC_INT_STATUS + (0x200 * nesdev->mac_index), u32temp); 1748 nes_write_indexed(nesdev, NES_IDX_MAC_INT_STATUS + (0x200 * nesdev->mac_index), u32temp);
1722 1749
1723 nes_init_phy(nesdev); 1750 nes_init_phy(nesdev);
1724
1725 } 1751 }
1726 1752
1727 return netdev; 1753 return netdev;
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index 815725f886c4..69928296d74b 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -1323,6 +1323,7 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd,
1323 nesqp->nesqp_context->aeq_token_low = cpu_to_le32((u32)((unsigned long)(nesqp))); 1323 nesqp->nesqp_context->aeq_token_low = cpu_to_le32((u32)((unsigned long)(nesqp)));
1324 nesqp->nesqp_context->aeq_token_high = cpu_to_le32((u32)(upper_32_bits((unsigned long)(nesqp)))); 1324 nesqp->nesqp_context->aeq_token_high = cpu_to_le32((u32)(upper_32_bits((unsigned long)(nesqp))));
1325 nesqp->nesqp_context->ird_ord_sizes = cpu_to_le32(NES_QPCONTEXT_ORDIRD_ALSMM | 1325 nesqp->nesqp_context->ird_ord_sizes = cpu_to_le32(NES_QPCONTEXT_ORDIRD_ALSMM |
1326 NES_QPCONTEXT_ORDIRD_AAH |
1326 ((((u32)nesadapter->max_irrq_wr) << 1327 ((((u32)nesadapter->max_irrq_wr) <<
1327 NES_QPCONTEXT_ORDIRD_IRDSIZE_SHIFT) & NES_QPCONTEXT_ORDIRD_IRDSIZE_MASK)); 1328 NES_QPCONTEXT_ORDIRD_IRDSIZE_SHIFT) & NES_QPCONTEXT_ORDIRD_IRDSIZE_MASK));
1328 if (disable_mpa_crc) { 1329 if (disable_mpa_crc) {
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 83a7751c38d6..bc658373ad55 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -708,6 +708,7 @@ void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_
708 struct ipoib_dev_priv *priv = netdev_priv(dev); 708 struct ipoib_dev_priv *priv = netdev_priv(dev);
709 struct ipoib_cm_tx_buf *tx_req; 709 struct ipoib_cm_tx_buf *tx_req;
710 u64 addr; 710 u64 addr;
711 int rc;
711 712
712 if (unlikely(skb->len > tx->mtu)) { 713 if (unlikely(skb->len > tx->mtu)) {
713 ipoib_warn(priv, "packet len %d (> %d) too long to send, dropping\n", 714 ipoib_warn(priv, "packet len %d (> %d) too long to send, dropping\n",
@@ -739,9 +740,10 @@ void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_
739 740
740 tx_req->mapping = addr; 741 tx_req->mapping = addr;
741 742
742 if (unlikely(post_send(priv, tx, tx->tx_head & (ipoib_sendq_size - 1), 743 rc = post_send(priv, tx, tx->tx_head & (ipoib_sendq_size - 1),
743 addr, skb->len))) { 744 addr, skb->len);
744 ipoib_warn(priv, "post_send failed\n"); 745 if (unlikely(rc)) {
746 ipoib_warn(priv, "post_send failed, error %d\n", rc);
745 ++dev->stats.tx_errors; 747 ++dev->stats.tx_errors;
746 ib_dma_unmap_single(priv->ca, addr, skb->len, DMA_TO_DEVICE); 748 ib_dma_unmap_single(priv->ca, addr, skb->len, DMA_TO_DEVICE);
747 dev_kfree_skb_any(skb); 749 dev_kfree_skb_any(skb);
@@ -752,6 +754,8 @@ void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_
752 if (++priv->tx_outstanding == ipoib_sendq_size) { 754 if (++priv->tx_outstanding == ipoib_sendq_size) {
753 ipoib_dbg(priv, "TX ring 0x%x full, stopping kernel net queue\n", 755 ipoib_dbg(priv, "TX ring 0x%x full, stopping kernel net queue\n",
754 tx->qp->qp_num); 756 tx->qp->qp_num);
757 if (ib_req_notify_cq(priv->send_cq, IB_CQ_NEXT_COMP))
758 ipoib_warn(priv, "request notify on send CQ failed\n");
755 netif_stop_queue(dev); 759 netif_stop_queue(dev);
756 } 760 }
757 } 761 }
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 8c91d9f37ada..5df40b128f81 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -529,7 +529,7 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb,
529{ 529{
530 struct ipoib_dev_priv *priv = netdev_priv(dev); 530 struct ipoib_dev_priv *priv = netdev_priv(dev);
531 struct ipoib_tx_buf *tx_req; 531 struct ipoib_tx_buf *tx_req;
532 int hlen; 532 int hlen, rc;
533 void *phead; 533 void *phead;
534 534
535 if (skb_is_gso(skb)) { 535 if (skb_is_gso(skb)) {
@@ -585,9 +585,10 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb,
585 netif_stop_queue(dev); 585 netif_stop_queue(dev);
586 } 586 }
587 587
588 if (unlikely(post_send(priv, priv->tx_head & (ipoib_sendq_size - 1), 588 rc = post_send(priv, priv->tx_head & (ipoib_sendq_size - 1),
589 address->ah, qpn, tx_req, phead, hlen))) { 589 address->ah, qpn, tx_req, phead, hlen);
590 ipoib_warn(priv, "post_send failed\n"); 590 if (unlikely(rc)) {
591 ipoib_warn(priv, "post_send failed, error %d\n", rc);
591 ++dev->stats.tx_errors; 592 ++dev->stats.tx_errors;
592 --priv->tx_outstanding; 593 --priv->tx_outstanding;
593 ipoib_dma_unmap_tx(priv->ca, tx_req); 594 ipoib_dma_unmap_tx(priv->ca, tx_req);
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 9f9816baeb97..2ee6c7a68bdc 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -515,7 +515,7 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
515 struct input_absinfo abs; 515 struct input_absinfo abs;
516 struct ff_effect effect; 516 struct ff_effect effect;
517 int __user *ip = (int __user *)p; 517 int __user *ip = (int __user *)p;
518 int i, t, u, v; 518 unsigned int i, t, u, v;
519 int error; 519 int error;
520 520
521 switch (cmd) { 521 switch (cmd) {
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 41168d5f8c17..e2aad0a51826 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -582,7 +582,8 @@ static int input_fetch_keycode(struct input_dev *dev, int scancode)
582} 582}
583 583
584static int input_default_getkeycode(struct input_dev *dev, 584static int input_default_getkeycode(struct input_dev *dev,
585 int scancode, int *keycode) 585 unsigned int scancode,
586 unsigned int *keycode)
586{ 587{
587 if (!dev->keycodesize) 588 if (!dev->keycodesize)
588 return -EINVAL; 589 return -EINVAL;
@@ -596,7 +597,8 @@ static int input_default_getkeycode(struct input_dev *dev,
596} 597}
597 598
598static int input_default_setkeycode(struct input_dev *dev, 599static int input_default_setkeycode(struct input_dev *dev,
599 int scancode, int keycode) 600 unsigned int scancode,
601 unsigned int keycode)
600{ 602{
601 int old_keycode; 603 int old_keycode;
602 int i; 604 int i;
@@ -654,11 +656,9 @@ static int input_default_setkeycode(struct input_dev *dev,
654 * This function should be called by anyone interested in retrieving current 656 * This function should be called by anyone interested in retrieving current
655 * keymap. Presently keyboard and evdev handlers use it. 657 * keymap. Presently keyboard and evdev handlers use it.
656 */ 658 */
657int input_get_keycode(struct input_dev *dev, int scancode, int *keycode) 659int input_get_keycode(struct input_dev *dev,
660 unsigned int scancode, unsigned int *keycode)
658{ 661{
659 if (scancode < 0)
660 return -EINVAL;
661
662 return dev->getkeycode(dev, scancode, keycode); 662 return dev->getkeycode(dev, scancode, keycode);
663} 663}
664EXPORT_SYMBOL(input_get_keycode); 664EXPORT_SYMBOL(input_get_keycode);
@@ -672,16 +672,14 @@ EXPORT_SYMBOL(input_get_keycode);
672 * This function should be called by anyone needing to update current 672 * This function should be called by anyone needing to update current
673 * keymap. Presently keyboard and evdev handlers use it. 673 * keymap. Presently keyboard and evdev handlers use it.
674 */ 674 */
675int input_set_keycode(struct input_dev *dev, int scancode, int keycode) 675int input_set_keycode(struct input_dev *dev,
676 unsigned int scancode, unsigned int keycode)
676{ 677{
677 unsigned long flags; 678 unsigned long flags;
678 int old_keycode; 679 int old_keycode;
679 int retval; 680 int retval;
680 681
681 if (scancode < 0) 682 if (keycode > KEY_MAX)
682 return -EINVAL;
683
684 if (keycode < 0 || keycode > KEY_MAX)
685 return -EINVAL; 683 return -EINVAL;
686 684
687 spin_lock_irqsave(&dev->event_lock, flags); 685 spin_lock_irqsave(&dev->event_lock, flags);
@@ -1881,35 +1879,37 @@ static int input_open_file(struct inode *inode, struct file *file)
1881 const struct file_operations *old_fops, *new_fops = NULL; 1879 const struct file_operations *old_fops, *new_fops = NULL;
1882 int err; 1880 int err;
1883 1881
1884 lock_kernel(); 1882 err = mutex_lock_interruptible(&input_mutex);
1883 if (err)
1884 return err;
1885
1885 /* No load-on-demand here? */ 1886 /* No load-on-demand here? */
1886 handler = input_table[iminor(inode) >> 5]; 1887 handler = input_table[iminor(inode) >> 5];
1887 if (!handler || !(new_fops = fops_get(handler->fops))) { 1888 if (handler)
1888 err = -ENODEV; 1889 new_fops = fops_get(handler->fops);
1889 goto out; 1890
1890 } 1891 mutex_unlock(&input_mutex);
1891 1892
1892 /* 1893 /*
1893 * That's _really_ odd. Usually NULL ->open means "nothing special", 1894 * That's _really_ odd. Usually NULL ->open means "nothing special",
1894 * not "no device". Oh, well... 1895 * not "no device". Oh, well...
1895 */ 1896 */
1896 if (!new_fops->open) { 1897 if (!new_fops || !new_fops->open) {
1897 fops_put(new_fops); 1898 fops_put(new_fops);
1898 err = -ENODEV; 1899 err = -ENODEV;
1899 goto out; 1900 goto out;
1900 } 1901 }
1902
1901 old_fops = file->f_op; 1903 old_fops = file->f_op;
1902 file->f_op = new_fops; 1904 file->f_op = new_fops;
1903 1905
1904 err = new_fops->open(inode, file); 1906 err = new_fops->open(inode, file);
1905
1906 if (err) { 1907 if (err) {
1907 fops_put(file->f_op); 1908 fops_put(file->f_op);
1908 file->f_op = fops_get(old_fops); 1909 file->f_op = fops_get(old_fops);
1909 } 1910 }
1910 fops_put(old_fops); 1911 fops_put(old_fops);
1911out: 1912out:
1912 unlock_kernel();
1913 return err; 1913 return err;
1914} 1914}
1915 1915
diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c
index ae998d99a5ae..7a55714a1486 100644
--- a/drivers/input/joystick/gamecon.c
+++ b/drivers/input/joystick/gamecon.c
@@ -819,7 +819,7 @@ static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type)
819 int i; 819 int i;
820 int err; 820 int err;
821 821
822 if (pad_type < 1 || pad_type > GC_MAX) { 822 if (pad_type < 1 || pad_type >= GC_MAX) {
823 pr_err("Pad type %d unknown\n", pad_type); 823 pr_err("Pad type %d unknown\n", pad_type);
824 return -EINVAL; 824 return -EINVAL;
825 } 825 }
diff --git a/drivers/input/keyboard/bf54x-keys.c b/drivers/input/keyboard/bf54x-keys.c
index fe376a27fe57..593c052416b9 100644
--- a/drivers/input/keyboard/bf54x-keys.c
+++ b/drivers/input/keyboard/bf54x-keys.c
@@ -162,7 +162,7 @@ static irqreturn_t bfin_kpad_isr(int irq, void *dev_id)
162 input_sync(input); 162 input_sync(input);
163 163
164 if (bfin_kpad_get_keypressed(bf54x_kpad)) { 164 if (bfin_kpad_get_keypressed(bf54x_kpad)) {
165 disable_irq(bf54x_kpad->irq); 165 disable_irq_nosync(bf54x_kpad->irq);
166 bf54x_kpad->lastkey = key; 166 bf54x_kpad->lastkey = key;
167 mod_timer(&bf54x_kpad->timer, 167 mod_timer(&bf54x_kpad->timer,
168 jiffies + bf54x_kpad->keyup_test_jiffies); 168 jiffies + bf54x_kpad->keyup_test_jiffies);
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 7097bfe581d7..23140a3bb8e0 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -214,6 +214,17 @@ config INPUT_TWL4030_PWRBUTTON
214 To compile this driver as a module, choose M here. The module will 214 To compile this driver as a module, choose M here. The module will
215 be called twl4030_pwrbutton. 215 be called twl4030_pwrbutton.
216 216
217config INPUT_TWL4030_VIBRA
218 tristate "Support for TWL4030 Vibrator"
219 depends on TWL4030_CORE
220 select TWL4030_CODEC
221 select INPUT_FF_MEMLESS
222 help
223 This option enables support for TWL4030 Vibrator Driver.
224
225 To compile this driver as a module, choose M here. The module will
226 be called twl4030_vibra.
227
217config INPUT_UINPUT 228config INPUT_UINPUT
218 tristate "User level driver support" 229 tristate "User level driver support"
219 help 230 help
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index b611615e24ad..7e95a5d474dc 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER) += rotary_encoder.o
26obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o 26obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o
27obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o 27obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o
28obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON) += twl4030-pwrbutton.o 28obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON) += twl4030-pwrbutton.o
29obj-$(CONFIG_INPUT_TWL4030_VIBRA) += twl4030-vibra.o
29obj-$(CONFIG_INPUT_UINPUT) += uinput.o 30obj-$(CONFIG_INPUT_UINPUT) += uinput.o
30obj-$(CONFIG_INPUT_WINBOND_CIR) += winbond-cir.o 31obj-$(CONFIG_INPUT_WINBOND_CIR) += winbond-cir.o
31obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o 32obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o
diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c
index 0501f0e65157..15be5430bc6d 100644
--- a/drivers/input/misc/ati_remote2.c
+++ b/drivers/input/misc/ati_remote2.c
@@ -474,10 +474,11 @@ static void ati_remote2_complete_key(struct urb *urb)
474} 474}
475 475
476static int ati_remote2_getkeycode(struct input_dev *idev, 476static int ati_remote2_getkeycode(struct input_dev *idev,
477 int scancode, int *keycode) 477 unsigned int scancode, unsigned int *keycode)
478{ 478{
479 struct ati_remote2 *ar2 = input_get_drvdata(idev); 479 struct ati_remote2 *ar2 = input_get_drvdata(idev);
480 int index, mode; 480 unsigned int mode;
481 int index;
481 482
482 mode = scancode >> 8; 483 mode = scancode >> 8;
483 if (mode > ATI_REMOTE2_PC || !((1 << mode) & ar2->mode_mask)) 484 if (mode > ATI_REMOTE2_PC || !((1 << mode) & ar2->mode_mask))
@@ -491,10 +492,12 @@ static int ati_remote2_getkeycode(struct input_dev *idev,
491 return 0; 492 return 0;
492} 493}
493 494
494static int ati_remote2_setkeycode(struct input_dev *idev, int scancode, int keycode) 495static int ati_remote2_setkeycode(struct input_dev *idev,
496 unsigned int scancode, unsigned int keycode)
495{ 497{
496 struct ati_remote2 *ar2 = input_get_drvdata(idev); 498 struct ati_remote2 *ar2 = input_get_drvdata(idev);
497 int index, mode, old_keycode; 499 unsigned int mode, old_keycode;
500 int index;
498 501
499 mode = scancode >> 8; 502 mode = scancode >> 8;
500 if (mode > ATI_REMOTE2_PC || !((1 << mode) & ar2->mode_mask)) 503 if (mode > ATI_REMOTE2_PC || !((1 << mode) & ar2->mode_mask))
@@ -504,9 +507,6 @@ static int ati_remote2_setkeycode(struct input_dev *idev, int scancode, int keyc
504 if (index < 0) 507 if (index < 0)
505 return -EINVAL; 508 return -EINVAL;
506 509
507 if (keycode < KEY_RESERVED || keycode > KEY_MAX)
508 return -EINVAL;
509
510 old_keycode = ar2->keycode[mode][index]; 510 old_keycode = ar2->keycode[mode][index];
511 ar2->keycode[mode][index] = keycode; 511 ar2->keycode[mode][index] = keycode;
512 __set_bit(keycode, idev->keybit); 512 __set_bit(keycode, idev->keybit);
diff --git a/drivers/input/misc/twl4030-vibra.c b/drivers/input/misc/twl4030-vibra.c
new file mode 100644
index 000000000000..2fb79e064da3
--- /dev/null
+++ b/drivers/input/misc/twl4030-vibra.c
@@ -0,0 +1,297 @@
1/*
2 * twl4030-vibra.c - TWL4030 Vibrator driver
3 *
4 * Copyright (C) 2008-2010 Nokia Corporation
5 *
6 * Written by Henrik Saari <henrik.saari@nokia.com>
7 * Updates by Felipe Balbi <felipe.balbi@nokia.com>
8 * Input by Jari Vanhala <ext-jari.vanhala@nokia.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22 * 02110-1301 USA
23 *
24 */
25
26#include <linux/module.h>
27#include <linux/jiffies.h>
28#include <linux/platform_device.h>
29#include <linux/workqueue.h>
30#include <linux/i2c/twl.h>
31#include <linux/mfd/twl4030-codec.h>
32#include <linux/input.h>
33
34/* MODULE ID2 */
35#define LEDEN 0x00
36
37/* ForceFeedback */
38#define EFFECT_DIR_180_DEG 0x8000 /* range is 0 - 0xFFFF */
39
40struct vibra_info {
41 struct device *dev;
42 struct input_dev *input_dev;
43
44 struct workqueue_struct *workqueue;
45 struct work_struct play_work;
46
47 bool enabled;
48 int speed;
49 int direction;
50
51 bool coexist;
52};
53
54static void vibra_disable_leds(void)
55{
56 u8 reg;
57
58 /* Disable LEDA & LEDB, cannot be used with vibra (PWM) */
59 twl_i2c_read_u8(TWL4030_MODULE_LED, &reg, LEDEN);
60 reg &= ~0x03;
61 twl_i2c_write_u8(TWL4030_MODULE_LED, LEDEN, reg);
62}
63
64/* Powers H-Bridge and enables audio clk */
65static void vibra_enable(struct vibra_info *info)
66{
67 u8 reg;
68
69 twl4030_codec_enable_resource(TWL4030_CODEC_RES_POWER);
70
71 /* turn H-Bridge on */
72 twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE,
73 &reg, TWL4030_REG_VIBRA_CTL);
74 twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
75 (reg | TWL4030_VIBRA_EN), TWL4030_REG_VIBRA_CTL);
76
77 twl4030_codec_enable_resource(TWL4030_CODEC_RES_APLL);
78
79 info->enabled = true;
80}
81
82static void vibra_disable(struct vibra_info *info)
83{
84 u8 reg;
85
86 /* Power down H-Bridge */
87 twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE,
88 &reg, TWL4030_REG_VIBRA_CTL);
89 twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
90 (reg & ~TWL4030_VIBRA_EN), TWL4030_REG_VIBRA_CTL);
91
92 twl4030_codec_disable_resource(TWL4030_CODEC_RES_POWER);
93 twl4030_codec_disable_resource(TWL4030_CODEC_RES_APLL);
94
95 info->enabled = false;
96}
97
98static void vibra_play_work(struct work_struct *work)
99{
100 struct vibra_info *info = container_of(work,
101 struct vibra_info, play_work);
102 int dir;
103 int pwm;
104 u8 reg;
105
106 dir = info->direction;
107 pwm = info->speed;
108
109 twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE,
110 &reg, TWL4030_REG_VIBRA_CTL);
111 if (pwm && (!info->coexist || !(reg & TWL4030_VIBRA_SEL))) {
112
113 if (!info->enabled)
114 vibra_enable(info);
115
116 /* set vibra rotation direction */
117 twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE,
118 &reg, TWL4030_REG_VIBRA_CTL);
119 reg = (dir) ? (reg | TWL4030_VIBRA_DIR) :
120 (reg & ~TWL4030_VIBRA_DIR);
121 twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
122 reg, TWL4030_REG_VIBRA_CTL);
123
124 /* set PWM, 1 = max, 255 = min */
125 twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
126 256 - pwm, TWL4030_REG_VIBRA_SET);
127 } else {
128 if (info->enabled)
129 vibra_disable(info);
130 }
131}
132
133/*** Input/ForceFeedback ***/
134
135static int vibra_play(struct input_dev *input, void *data,
136 struct ff_effect *effect)
137{
138 struct vibra_info *info = input_get_drvdata(input);
139
140 info->speed = effect->u.rumble.strong_magnitude >> 8;
141 if (!info->speed)
142 info->speed = effect->u.rumble.weak_magnitude >> 9;
143 info->direction = effect->direction < EFFECT_DIR_180_DEG ? 0 : 1;
144 queue_work(info->workqueue, &info->play_work);
145 return 0;
146}
147
148static int twl4030_vibra_open(struct input_dev *input)
149{
150 struct vibra_info *info = input_get_drvdata(input);
151
152 info->workqueue = create_singlethread_workqueue("vibra");
153 if (info->workqueue == NULL) {
154 dev_err(&input->dev, "couldn't create workqueue\n");
155 return -ENOMEM;
156 }
157 return 0;
158}
159
160static void twl4030_vibra_close(struct input_dev *input)
161{
162 struct vibra_info *info = input_get_drvdata(input);
163
164 cancel_work_sync(&info->play_work);
165 INIT_WORK(&info->play_work, vibra_play_work); /* cleanup */
166 destroy_workqueue(info->workqueue);
167 info->workqueue = NULL;
168
169 if (info->enabled)
170 vibra_disable(info);
171}
172
173/*** Module ***/
174#if CONFIG_PM
175static int twl4030_vibra_suspend(struct device *dev)
176{
177 struct platform_device *pdev = to_platform_device(dev);
178 struct vibra_info *info = platform_get_drvdata(pdev);
179
180 if (info->enabled)
181 vibra_disable(info);
182
183 return 0;
184}
185
186static int twl4030_vibra_resume(struct device *dev)
187{
188 vibra_disable_leds();
189 return 0;
190}
191
192static SIMPLE_DEV_PM_OPS(twl4030_vibra_pm_ops,
193 twl4030_vibra_suspend, twl4030_vibra_resume);
194#endif
195
196static int __devinit twl4030_vibra_probe(struct platform_device *pdev)
197{
198 struct twl4030_codec_vibra_data *pdata = pdev->dev.platform_data;
199 struct vibra_info *info;
200 int ret;
201
202 if (!pdata) {
203 dev_dbg(&pdev->dev, "platform_data not available\n");
204 return -EINVAL;
205 }
206
207 info = kzalloc(sizeof(*info), GFP_KERNEL);
208 if (!info)
209 return -ENOMEM;
210
211 info->dev = &pdev->dev;
212 info->coexist = pdata->coexist;
213 INIT_WORK(&info->play_work, vibra_play_work);
214
215 info->input_dev = input_allocate_device();
216 if (info->input_dev == NULL) {
217 dev_err(&pdev->dev, "couldn't allocate input device\n");
218 ret = -ENOMEM;
219 goto err_kzalloc;
220 }
221
222 input_set_drvdata(info->input_dev, info);
223
224 info->input_dev->name = "twl4030:vibrator";
225 info->input_dev->id.version = 1;
226 info->input_dev->dev.parent = pdev->dev.parent;
227 info->input_dev->open = twl4030_vibra_open;
228 info->input_dev->close = twl4030_vibra_close;
229 __set_bit(FF_RUMBLE, info->input_dev->ffbit);
230
231 ret = input_ff_create_memless(info->input_dev, NULL, vibra_play);
232 if (ret < 0) {
233 dev_dbg(&pdev->dev, "couldn't register vibrator to FF\n");
234 goto err_ialloc;
235 }
236
237 ret = input_register_device(info->input_dev);
238 if (ret < 0) {
239 dev_dbg(&pdev->dev, "couldn't register input device\n");
240 goto err_iff;
241 }
242
243 vibra_disable_leds();
244
245 platform_set_drvdata(pdev, info);
246 return 0;
247
248err_iff:
249 input_ff_destroy(info->input_dev);
250err_ialloc:
251 input_free_device(info->input_dev);
252err_kzalloc:
253 kfree(info);
254 return ret;
255}
256
257static int __devexit twl4030_vibra_remove(struct platform_device *pdev)
258{
259 struct vibra_info *info = platform_get_drvdata(pdev);
260
261 /* this also free ff-memless and calls close if needed */
262 input_unregister_device(info->input_dev);
263 kfree(info);
264 platform_set_drvdata(pdev, NULL);
265
266 return 0;
267}
268
269static struct platform_driver twl4030_vibra_driver = {
270 .probe = twl4030_vibra_probe,
271 .remove = __devexit_p(twl4030_vibra_remove),
272 .driver = {
273 .name = "twl4030_codec_vibra",
274 .owner = THIS_MODULE,
275#ifdef CONFIG_PM
276 .pm = &twl4030_vibra_pm_ops,
277#endif
278 },
279};
280
281static int __init twl4030_vibra_init(void)
282{
283 return platform_driver_register(&twl4030_vibra_driver);
284}
285module_init(twl4030_vibra_init);
286
287static void __exit twl4030_vibra_exit(void)
288{
289 platform_driver_unregister(&twl4030_vibra_driver);
290}
291module_exit(twl4030_vibra_exit);
292
293MODULE_ALIAS("platform:twl4030_codec_vibra");
294
295MODULE_DESCRIPTION("TWL4030 Vibra driver");
296MODULE_LICENSE("GPL");
297MODULE_AUTHOR("Nokia Corporation");
diff --git a/drivers/input/misc/winbond-cir.c b/drivers/input/misc/winbond-cir.c
index cbec3dfdd42b..9c155a43abc2 100644
--- a/drivers/input/misc/winbond-cir.c
+++ b/drivers/input/misc/winbond-cir.c
@@ -385,26 +385,24 @@ wbcir_do_getkeycode(struct wbcir_data *data, u32 scancode)
385} 385}
386 386
387static int 387static int
388wbcir_getkeycode(struct input_dev *dev, int scancode, int *keycode) 388wbcir_getkeycode(struct input_dev *dev,
389 unsigned int scancode, unsigned int *keycode)
389{ 390{
390 struct wbcir_data *data = input_get_drvdata(dev); 391 struct wbcir_data *data = input_get_drvdata(dev);
391 392
392 *keycode = (int)wbcir_do_getkeycode(data, (u32)scancode); 393 *keycode = wbcir_do_getkeycode(data, scancode);
393 return 0; 394 return 0;
394} 395}
395 396
396static int 397static int
397wbcir_setkeycode(struct input_dev *dev, int sscancode, int keycode) 398wbcir_setkeycode(struct input_dev *dev,
399 unsigned int scancode, unsigned int keycode)
398{ 400{
399 struct wbcir_data *data = input_get_drvdata(dev); 401 struct wbcir_data *data = input_get_drvdata(dev);
400 struct wbcir_keyentry *keyentry; 402 struct wbcir_keyentry *keyentry;
401 struct wbcir_keyentry *new_keyentry; 403 struct wbcir_keyentry *new_keyentry;
402 unsigned long flags; 404 unsigned long flags;
403 unsigned int old_keycode = KEY_RESERVED; 405 unsigned int old_keycode = KEY_RESERVED;
404 u32 scancode = (u32)sscancode;
405
406 if (keycode < 0 || keycode > KEY_MAX)
407 return -EINVAL;
408 406
409 new_keyentry = kmalloc(sizeof(*new_keyentry), GFP_KERNEL); 407 new_keyentry = kmalloc(sizeof(*new_keyentry), GFP_KERNEL);
410 if (!new_keyentry) 408 if (!new_keyentry)
diff --git a/drivers/input/misc/wm831x-on.c b/drivers/input/misc/wm831x-on.c
index ba4f5dd7c60e..1e54bce72db5 100644
--- a/drivers/input/misc/wm831x-on.c
+++ b/drivers/input/misc/wm831x-on.c
@@ -97,8 +97,9 @@ static int __devinit wm831x_on_probe(struct platform_device *pdev)
97 wm831x_on->dev->phys = "wm831x_on/input0"; 97 wm831x_on->dev->phys = "wm831x_on/input0";
98 wm831x_on->dev->dev.parent = &pdev->dev; 98 wm831x_on->dev->dev.parent = &pdev->dev;
99 99
100 ret = wm831x_request_irq(wm831x, irq, wm831x_on_irq, 100 ret = request_threaded_irq(irq, NULL, wm831x_on_irq,
101 IRQF_TRIGGER_RISING, "wm831x_on", wm831x_on); 101 IRQF_TRIGGER_RISING, "wm831x_on",
102 wm831x_on);
102 if (ret < 0) { 103 if (ret < 0) {
103 dev_err(&pdev->dev, "Unable to request IRQ: %d\n", ret); 104 dev_err(&pdev->dev, "Unable to request IRQ: %d\n", ret);
104 goto err_input_dev; 105 goto err_input_dev;
@@ -114,7 +115,7 @@ static int __devinit wm831x_on_probe(struct platform_device *pdev)
114 return 0; 115 return 0;
115 116
116err_irq: 117err_irq:
117 wm831x_free_irq(wm831x, irq, NULL); 118 free_irq(irq, wm831x_on);
118err_input_dev: 119err_input_dev:
119 input_free_device(wm831x_on->dev); 120 input_free_device(wm831x_on->dev);
120err: 121err:
@@ -127,7 +128,7 @@ static int __devexit wm831x_on_remove(struct platform_device *pdev)
127 struct wm831x_on *wm831x_on = platform_get_drvdata(pdev); 128 struct wm831x_on *wm831x_on = platform_get_drvdata(pdev);
128 int irq = platform_get_irq(pdev, 0); 129 int irq = platform_get_irq(pdev, 0);
129 130
130 wm831x_free_irq(wm831x_on->wm831x, irq, wm831x_on); 131 free_irq(irq, wm831x_on);
131 cancel_delayed_work_sync(&wm831x_on->work); 132 cancel_delayed_work_sync(&wm831x_on->work);
132 input_unregister_device(wm831x_on->dev); 133 input_unregister_device(wm831x_on->dev);
133 kfree(wm831x_on); 134 kfree(wm831x_on);
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index f93c2c0daf1f..7490f1da4a53 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -63,6 +63,8 @@ static const struct alps_model_info alps_model_data[] = {
63 { { 0x62, 0x02, 0x14 }, 0xcf, 0xcf, 63 { { 0x62, 0x02, 0x14 }, 0xcf, 0xcf,
64 ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, 64 ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED },
65 { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ 65 { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */
66 { { 0x52, 0x01, 0x14 }, 0xff, 0xff,
67 ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */
66}; 68};
67 69
68/* 70/*
@@ -118,40 +120,27 @@ static void alps_report_buttons(struct psmouse *psmouse,
118 struct input_dev *dev1, struct input_dev *dev2, 120 struct input_dev *dev1, struct input_dev *dev2,
119 int left, int right, int middle) 121 int left, int right, int middle)
120{ 122{
121 struct alps_data *priv = psmouse->private; 123 struct input_dev *dev;
122 const struct alps_model_info *model = priv->i;
123
124 if (model->flags & ALPS_PS2_INTERLEAVED) {
125 struct input_dev *dev;
126 124
127 /* 125 /*
128 * If shared button has already been reported on the 126 * If shared button has already been reported on the
129 * other device (dev2) then this event should be also 127 * other device (dev2) then this event should be also
130 * sent through that device. 128 * sent through that device.
131 */ 129 */
132 dev = test_bit(BTN_LEFT, dev2->key) ? dev2 : dev1; 130 dev = test_bit(BTN_LEFT, dev2->key) ? dev2 : dev1;
133 input_report_key(dev, BTN_LEFT, left); 131 input_report_key(dev, BTN_LEFT, left);
134 132
135 dev = test_bit(BTN_RIGHT, dev2->key) ? dev2 : dev1; 133 dev = test_bit(BTN_RIGHT, dev2->key) ? dev2 : dev1;
136 input_report_key(dev, BTN_RIGHT, right); 134 input_report_key(dev, BTN_RIGHT, right);
137 135
138 dev = test_bit(BTN_MIDDLE, dev2->key) ? dev2 : dev1; 136 dev = test_bit(BTN_MIDDLE, dev2->key) ? dev2 : dev1;
139 input_report_key(dev, BTN_MIDDLE, middle); 137 input_report_key(dev, BTN_MIDDLE, middle);
140 138
141 /* 139 /*
142 * Sync the _other_ device now, we'll do the first 140 * Sync the _other_ device now, we'll do the first
143 * device later once we report the rest of the events. 141 * device later once we report the rest of the events.
144 */ 142 */
145 input_sync(dev2); 143 input_sync(dev2);
146 } else {
147 /*
148 * For devices with non-interleaved packets we know what
149 * device buttons belong to so we can simply report them.
150 */
151 input_report_key(dev1, BTN_LEFT, left);
152 input_report_key(dev1, BTN_RIGHT, right);
153 input_report_key(dev1, BTN_MIDDLE, middle);
154 }
155} 144}
156 145
157static void alps_process_packet(struct psmouse *psmouse) 146static void alps_process_packet(struct psmouse *psmouse)
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index 908b5b44052f..53ec7ddd1826 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -205,8 +205,8 @@ struct atp {
205 bool overflow_warned; 205 bool overflow_warned;
206 int x_old; /* last reported x/y, */ 206 int x_old; /* last reported x/y, */
207 int y_old; /* used for smoothing */ 207 int y_old; /* used for smoothing */
208 signed char xy_cur[ATP_XSENSORS + ATP_YSENSORS]; 208 u8 xy_cur[ATP_XSENSORS + ATP_YSENSORS];
209 signed char xy_old[ATP_XSENSORS + ATP_YSENSORS]; 209 u8 xy_old[ATP_XSENSORS + ATP_YSENSORS];
210 int xy_acc[ATP_XSENSORS + ATP_YSENSORS]; 210 int xy_acc[ATP_XSENSORS + ATP_YSENSORS];
211 int idlecount; /* number of empty packets */ 211 int idlecount; /* number of empty packets */
212 struct work_struct work; 212 struct work_struct work;
@@ -531,7 +531,7 @@ static void atp_complete_geyser_1_2(struct urb *urb)
531 531
532 for (i = 0; i < ATP_XSENSORS + ATP_YSENSORS; i++) { 532 for (i = 0; i < ATP_XSENSORS + ATP_YSENSORS; i++) {
533 /* accumulate the change */ 533 /* accumulate the change */
534 signed char change = dev->xy_old[i] - dev->xy_cur[i]; 534 int change = dev->xy_old[i] - dev->xy_cur[i];
535 dev->xy_acc[i] -= change; 535 dev->xy_acc[i] -= change;
536 536
537 /* prevent down drifting */ 537 /* prevent down drifting */
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index a13d80f7da17..f34b22bce4ff 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -15,7 +15,6 @@
15 15
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/smp_lock.h>
19#include <linux/poll.h> 18#include <linux/poll.h>
20#include <linux/module.h> 19#include <linux/module.h>
21#include <linux/init.h> 20#include <linux/init.h>
@@ -542,10 +541,8 @@ static int mousedev_open(struct inode *inode, struct file *file)
542 if (i >= MOUSEDEV_MINORS) 541 if (i >= MOUSEDEV_MINORS)
543 return -ENODEV; 542 return -ENODEV;
544 543
545 lock_kernel();
546 error = mutex_lock_interruptible(&mousedev_table_mutex); 544 error = mutex_lock_interruptible(&mousedev_table_mutex);
547 if (error) { 545 if (error) {
548 unlock_kernel();
549 return error; 546 return error;
550 } 547 }
551 mousedev = mousedev_table[i]; 548 mousedev = mousedev_table[i];
@@ -554,7 +551,6 @@ static int mousedev_open(struct inode *inode, struct file *file)
554 mutex_unlock(&mousedev_table_mutex); 551 mutex_unlock(&mousedev_table_mutex);
555 552
556 if (!mousedev) { 553 if (!mousedev) {
557 unlock_kernel();
558 return -ENODEV; 554 return -ENODEV;
559 } 555 }
560 556
@@ -575,7 +571,6 @@ static int mousedev_open(struct inode *inode, struct file *file)
575 goto err_free_client; 571 goto err_free_client;
576 572
577 file->private_data = client; 573 file->private_data = client;
578 unlock_kernel();
579 return 0; 574 return 0;
580 575
581 err_free_client: 576 err_free_client:
@@ -583,7 +578,6 @@ static int mousedev_open(struct inode *inode, struct file *file)
583 kfree(client); 578 kfree(client);
584 err_put_mousedev: 579 err_put_mousedev:
585 put_device(&mousedev->dev); 580 put_device(&mousedev->dev);
586 unlock_kernel();
587 return error; 581 return error;
588} 582}
589 583
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index 2a5982e532f8..ead0494721d0 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -442,6 +442,13 @@ static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = {
442 }, 442 },
443 }, 443 },
444 { 444 {
445 /* Medion Akoya E1222 */
446 .matches = {
447 DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
448 DMI_MATCH(DMI_PRODUCT_NAME, "E122X"),
449 },
450 },
451 {
445 /* Mivvy M310 */ 452 /* Mivvy M310 */
446 .matches = { 453 .matches = {
447 DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"), 454 DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"),
@@ -624,6 +631,9 @@ static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *
624 strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name)); 631 strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
625 } 632 }
626 633
634 /* Keyboard ports are always supposed to be wakeup-enabled */
635 device_set_wakeup_enable(&dev->dev, true);
636
627 i8042_pnp_kbd_devices++; 637 i8042_pnp_kbd_devices++;
628 return 0; 638 return 0;
629} 639}
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index ff4d77c4de11..9302ba0e48f8 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -1386,6 +1386,8 @@ static int __init i8042_probe(struct platform_device *dev)
1386{ 1386{
1387 int error; 1387 int error;
1388 1388
1389 i8042_platform_device = dev;
1390
1389 error = i8042_controller_selftest(); 1391 error = i8042_controller_selftest();
1390 if (error) 1392 if (error)
1391 return error; 1393 return error;
@@ -1421,6 +1423,7 @@ static int __init i8042_probe(struct platform_device *dev)
1421 i8042_free_aux_ports(); /* in case KBD failed but AUX not */ 1423 i8042_free_aux_ports(); /* in case KBD failed but AUX not */
1422 i8042_free_irqs(); 1424 i8042_free_irqs();
1423 i8042_controller_reset(); 1425 i8042_controller_reset();
1426 i8042_platform_device = NULL;
1424 1427
1425 return error; 1428 return error;
1426} 1429}
@@ -1430,6 +1433,7 @@ static int __devexit i8042_remove(struct platform_device *dev)
1430 i8042_unregister_ports(); 1433 i8042_unregister_ports();
1431 i8042_free_irqs(); 1434 i8042_free_irqs();
1432 i8042_controller_reset(); 1435 i8042_controller_reset();
1436 i8042_platform_device = NULL;
1433 1437
1434 return 0; 1438 return 0;
1435} 1439}
@@ -1448,6 +1452,7 @@ static struct platform_driver i8042_driver = {
1448 1452
1449static int __init i8042_init(void) 1453static int __init i8042_init(void)
1450{ 1454{
1455 struct platform_device *pdev;
1451 int err; 1456 int err;
1452 1457
1453 dbg_init(); 1458 dbg_init();
@@ -1460,31 +1465,18 @@ static int __init i8042_init(void)
1460 if (err) 1465 if (err)
1461 goto err_platform_exit; 1466 goto err_platform_exit;
1462 1467
1463 i8042_platform_device = platform_device_alloc("i8042", -1); 1468 pdev = platform_create_bundle(&i8042_driver, i8042_probe, NULL, 0, NULL, 0);
1464 if (!i8042_platform_device) { 1469 if (IS_ERR(pdev)) {
1465 err = -ENOMEM; 1470 err = PTR_ERR(pdev);
1466 goto err_platform_exit; 1471 goto err_platform_exit;
1467 } 1472 }
1468 1473
1469 err = platform_device_add(i8042_platform_device);
1470 if (err)
1471 goto err_free_device;
1472
1473 err = platform_driver_probe(&i8042_driver, i8042_probe);
1474 if (err)
1475 goto err_del_device;
1476
1477 panic_blink = i8042_panic_blink; 1474 panic_blink = i8042_panic_blink;
1478 1475
1479 return 0; 1476 return 0;
1480 1477
1481 err_del_device:
1482 platform_device_del(i8042_platform_device);
1483 err_free_device:
1484 platform_device_put(i8042_platform_device);
1485 err_platform_exit: 1478 err_platform_exit:
1486 i8042_platform_exit(); 1479 i8042_platform_exit();
1487
1488 return err; 1480 return err;
1489} 1481}
1490 1482
diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c
index 27fdaaffbb40..998664854440 100644
--- a/drivers/input/serio/serio_raw.c
+++ b/drivers/input/serio/serio_raw.c
@@ -81,12 +81,12 @@ static int serio_raw_open(struct inode *inode, struct file *file)
81 struct serio_raw_list *list; 81 struct serio_raw_list *list;
82 int retval = 0; 82 int retval = 0;
83 83
84 lock_kernel();
85 retval = mutex_lock_interruptible(&serio_raw_mutex); 84 retval = mutex_lock_interruptible(&serio_raw_mutex);
86 if (retval) 85 if (retval)
87 goto out_bkl; 86 return retval;
88 87
89 if (!(serio_raw = serio_raw_locate(iminor(inode)))) { 88 serio_raw = serio_raw_locate(iminor(inode));
89 if (!serio_raw) {
90 retval = -ENODEV; 90 retval = -ENODEV;
91 goto out; 91 goto out;
92 } 92 }
@@ -96,7 +96,8 @@ static int serio_raw_open(struct inode *inode, struct file *file)
96 goto out; 96 goto out;
97 } 97 }
98 98
99 if (!(list = kzalloc(sizeof(struct serio_raw_list), GFP_KERNEL))) { 99 list = kzalloc(sizeof(struct serio_raw_list), GFP_KERNEL);
100 if (!list) {
100 retval = -ENOMEM; 101 retval = -ENOMEM;
101 goto out; 102 goto out;
102 } 103 }
@@ -109,8 +110,6 @@ static int serio_raw_open(struct inode *inode, struct file *file)
109 110
110out: 111out:
111 mutex_unlock(&serio_raw_mutex); 112 mutex_unlock(&serio_raw_mutex);
112out_bkl:
113 unlock_kernel();
114 return retval; 113 return retval;
115} 114}
116 115
diff --git a/drivers/input/sparse-keymap.c b/drivers/input/sparse-keymap.c
index fbd3987af57f..e6bde55e5203 100644
--- a/drivers/input/sparse-keymap.c
+++ b/drivers/input/sparse-keymap.c
@@ -64,7 +64,8 @@ struct key_entry *sparse_keymap_entry_from_keycode(struct input_dev *dev,
64EXPORT_SYMBOL(sparse_keymap_entry_from_keycode); 64EXPORT_SYMBOL(sparse_keymap_entry_from_keycode);
65 65
66static int sparse_keymap_getkeycode(struct input_dev *dev, 66static int sparse_keymap_getkeycode(struct input_dev *dev,
67 int scancode, int *keycode) 67 unsigned int scancode,
68 unsigned int *keycode)
68{ 69{
69 const struct key_entry *key = 70 const struct key_entry *key =
70 sparse_keymap_entry_from_scancode(dev, scancode); 71 sparse_keymap_entry_from_scancode(dev, scancode);
@@ -78,7 +79,8 @@ static int sparse_keymap_getkeycode(struct input_dev *dev,
78} 79}
79 80
80static int sparse_keymap_setkeycode(struct input_dev *dev, 81static int sparse_keymap_setkeycode(struct input_dev *dev,
81 int scancode, int keycode) 82 unsigned int scancode,
83 unsigned int keycode)
82{ 84{
83 struct key_entry *key; 85 struct key_entry *key;
84 int old_keycode; 86 int old_keycode;
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index a1770e6feeec..8b5d2873f0c4 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -371,7 +371,7 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
371 } else if (pen) { 371 } else if (pen) {
372 /* penabled only accepts exact bytes of data */ 372 /* penabled only accepts exact bytes of data */
373 if (features->type == TABLETPC2FG) 373 if (features->type == TABLETPC2FG)
374 features->pktlen = WACOM_PKGLEN_PENABLED; 374 features->pktlen = WACOM_PKGLEN_GRAPHIRE;
375 features->device_type = BTN_TOOL_PEN; 375 features->device_type = BTN_TOOL_PEN;
376 features->x_max = 376 features->x_max =
377 wacom_le16_to_cpu(&report[i + 3]); 377 wacom_le16_to_cpu(&report[i + 3]);
@@ -410,7 +410,7 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
410 } else if (pen) { 410 } else if (pen) {
411 /* penabled only accepts exact bytes of data */ 411 /* penabled only accepts exact bytes of data */
412 if (features->type == TABLETPC2FG) 412 if (features->type == TABLETPC2FG)
413 features->pktlen = WACOM_PKGLEN_PENABLED; 413 features->pktlen = WACOM_PKGLEN_GRAPHIRE;
414 features->device_type = BTN_TOOL_PEN; 414 features->device_type = BTN_TOOL_PEN;
415 features->y_max = 415 features->y_max =
416 wacom_le16_to_cpu(&report[i + 3]); 416 wacom_le16_to_cpu(&report[i + 3]);
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 3d81443e683a..b3ba3437a2eb 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -155,19 +155,19 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
155{ 155{
156 struct wacom_features *features = &wacom->features; 156 struct wacom_features *features = &wacom->features;
157 unsigned char *data = wacom->data; 157 unsigned char *data = wacom->data;
158 int x, y, rw; 158 int x, y, prox;
159 static int penData = 0; 159 int rw = 0;
160 int retval = 0;
160 161
161 if (data[0] != WACOM_REPORT_PENABLED) { 162 if (data[0] != WACOM_REPORT_PENABLED) {
162 dbg("wacom_graphire_irq: received unknown report #%d", data[0]); 163 dbg("wacom_graphire_irq: received unknown report #%d", data[0]);
163 return 0; 164 goto exit;
164 } 165 }
165 166
166 if (data[1] & 0x80) { 167 prox = data[1] & 0x80;
167 /* in prox and not a pad data */ 168 if (prox || wacom->id[0]) {
168 penData = 1; 169 if (prox) {
169 170 switch ((data[1] >> 5) & 3) {
170 switch ((data[1] >> 5) & 3) {
171 171
172 case 0: /* Pen */ 172 case 0: /* Pen */
173 wacom->tool[0] = BTN_TOOL_PEN; 173 wacom->tool[0] = BTN_TOOL_PEN;
@@ -181,23 +181,13 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
181 181
182 case 2: /* Mouse with wheel */ 182 case 2: /* Mouse with wheel */
183 wacom_report_key(wcombo, BTN_MIDDLE, data[1] & 0x04); 183 wacom_report_key(wcombo, BTN_MIDDLE, data[1] & 0x04);
184 if (features->type == WACOM_G4 || features->type == WACOM_MO) {
185 rw = data[7] & 0x04 ? (data[7] & 0x03)-4 : (data[7] & 0x03);
186 wacom_report_rel(wcombo, REL_WHEEL, -rw);
187 } else
188 wacom_report_rel(wcombo, REL_WHEEL, -(signed char) data[6]);
189 /* fall through */ 184 /* fall through */
190 185
191 case 3: /* Mouse without wheel */ 186 case 3: /* Mouse without wheel */
192 wacom->tool[0] = BTN_TOOL_MOUSE; 187 wacom->tool[0] = BTN_TOOL_MOUSE;
193 wacom->id[0] = CURSOR_DEVICE_ID; 188 wacom->id[0] = CURSOR_DEVICE_ID;
194 wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01);
195 wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02);
196 if (features->type == WACOM_G4 || features->type == WACOM_MO)
197 wacom_report_abs(wcombo, ABS_DISTANCE, data[6] & 0x3f);
198 else
199 wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f);
200 break; 189 break;
190 }
201 } 191 }
202 x = wacom_le16_to_cpu(&data[2]); 192 x = wacom_le16_to_cpu(&data[2]);
203 y = wacom_le16_to_cpu(&data[4]); 193 y = wacom_le16_to_cpu(&data[4]);
@@ -208,36 +198,32 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
208 wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x01); 198 wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x01);
209 wacom_report_key(wcombo, BTN_STYLUS, data[1] & 0x02); 199 wacom_report_key(wcombo, BTN_STYLUS, data[1] & 0x02);
210 wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x04); 200 wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x04);
211 }
212 wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); /* report tool id */
213 wacom_report_key(wcombo, wacom->tool[0], 1);
214 } else if (wacom->id[0]) {
215 wacom_report_abs(wcombo, ABS_X, 0);
216 wacom_report_abs(wcombo, ABS_Y, 0);
217 if (wacom->tool[0] == BTN_TOOL_MOUSE) {
218 wacom_report_key(wcombo, BTN_LEFT, 0);
219 wacom_report_key(wcombo, BTN_RIGHT, 0);
220 wacom_report_abs(wcombo, ABS_DISTANCE, 0);
221 } else { 201 } else {
222 wacom_report_abs(wcombo, ABS_PRESSURE, 0); 202 wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01);
223 wacom_report_key(wcombo, BTN_TOUCH, 0); 203 wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02);
224 wacom_report_key(wcombo, BTN_STYLUS, 0); 204 if (features->type == WACOM_G4 ||
225 wacom_report_key(wcombo, BTN_STYLUS2, 0); 205 features->type == WACOM_MO) {
206 wacom_report_abs(wcombo, ABS_DISTANCE, data[6] & 0x3f);
207 rw = (signed)(data[7] & 0x04) - (data[7] & 0x03);
208 } else {
209 wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f);
210 rw = -(signed)data[6];
211 }
212 wacom_report_rel(wcombo, REL_WHEEL, rw);
226 } 213 }
227 wacom->id[0] = 0; 214
228 wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */ 215 if (!prox)
229 wacom_report_key(wcombo, wacom->tool[0], 0); 216 wacom->id[0] = 0;
217 wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); /* report tool id */
218 wacom_report_key(wcombo, wacom->tool[0], prox);
219 wacom_input_sync(wcombo); /* sync last event */
230 } 220 }
231 221
232 /* send pad data */ 222 /* send pad data */
233 switch (features->type) { 223 switch (features->type) {
234 case WACOM_G4: 224 case WACOM_G4:
235 if (data[7] & 0xf8) { 225 prox = data[7] & 0xf8;
236 if (penData) { 226 if (prox || wacom->id[1]) {
237 wacom_input_sync(wcombo); /* sync last event */
238 if (!wacom->id[0])
239 penData = 0;
240 }
241 wacom->id[1] = PAD_DEVICE_ID; 227 wacom->id[1] = PAD_DEVICE_ID;
242 wacom_report_key(wcombo, BTN_0, (data[7] & 0x40)); 228 wacom_report_key(wcombo, BTN_0, (data[7] & 0x40));
243 wacom_report_key(wcombo, BTN_4, (data[7] & 0x80)); 229 wacom_report_key(wcombo, BTN_4, (data[7] & 0x80));
@@ -245,29 +231,16 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
245 wacom_report_rel(wcombo, REL_WHEEL, rw); 231 wacom_report_rel(wcombo, REL_WHEEL, rw);
246 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0); 232 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0);
247 wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]); 233 wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]);
248 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); 234 if (!prox)
249 } else if (wacom->id[1]) { 235 wacom->id[1] = 0;
250 if (penData) { 236 wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]);
251 wacom_input_sync(wcombo); /* sync last event */
252 if (!wacom->id[0])
253 penData = 0;
254 }
255 wacom->id[1] = 0;
256 wacom_report_key(wcombo, BTN_0, (data[7] & 0x40));
257 wacom_report_key(wcombo, BTN_4, (data[7] & 0x80));
258 wacom_report_rel(wcombo, REL_WHEEL, 0);
259 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0);
260 wacom_report_abs(wcombo, ABS_MISC, 0);
261 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); 237 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0);
262 } 238 }
239 retval = 1;
263 break; 240 break;
264 case WACOM_MO: 241 case WACOM_MO:
265 if ((data[7] & 0xf8) || (data[8] & 0xff)) { 242 prox = (data[7] & 0xf8) || data[8];
266 if (penData) { 243 if (prox || wacom->id[1]) {
267 wacom_input_sync(wcombo); /* sync last event */
268 if (!wacom->id[0])
269 penData = 0;
270 }
271 wacom->id[1] = PAD_DEVICE_ID; 244 wacom->id[1] = PAD_DEVICE_ID;
272 wacom_report_key(wcombo, BTN_0, (data[7] & 0x08)); 245 wacom_report_key(wcombo, BTN_0, (data[7] & 0x08));
273 wacom_report_key(wcombo, BTN_1, (data[7] & 0x20)); 246 wacom_report_key(wcombo, BTN_1, (data[7] & 0x20));
@@ -275,27 +248,16 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo)
275 wacom_report_key(wcombo, BTN_5, (data[7] & 0x40)); 248 wacom_report_key(wcombo, BTN_5, (data[7] & 0x40));
276 wacom_report_abs(wcombo, ABS_WHEEL, (data[8] & 0x7f)); 249 wacom_report_abs(wcombo, ABS_WHEEL, (data[8] & 0x7f));
277 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0); 250 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0xf0);
251 if (!prox)
252 wacom->id[1] = 0;
278 wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]); 253 wacom_report_abs(wcombo, ABS_MISC, wacom->id[1]);
279 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0); 254 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0);
280 } else if (wacom->id[1]) {
281 if (penData) {
282 wacom_input_sync(wcombo); /* sync last event */
283 if (!wacom->id[0])
284 penData = 0;
285 }
286 wacom->id[1] = 0;
287 wacom_report_key(wcombo, BTN_0, (data[7] & 0x08));
288 wacom_report_key(wcombo, BTN_1, (data[7] & 0x20));
289 wacom_report_key(wcombo, BTN_4, (data[7] & 0x10));
290 wacom_report_key(wcombo, BTN_5, (data[7] & 0x40));
291 wacom_report_abs(wcombo, ABS_WHEEL, (data[8] & 0x7f));
292 wacom_report_key(wcombo, BTN_TOOL_FINGER, 0);
293 wacom_report_abs(wcombo, ABS_MISC, 0);
294 wacom_input_event(wcombo, EV_MSC, MSC_SERIAL, 0xf0);
295 } 255 }
256 retval = 1;
296 break; 257 break;
297 } 258 }
298 return 1; 259exit:
260 return retval;
299} 261}
300 262
301static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) 263static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo)
@@ -636,9 +598,9 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
636static void wacom_tpc_finger_in(struct wacom_wac *wacom, void *wcombo, char *data, int idx) 598static void wacom_tpc_finger_in(struct wacom_wac *wacom, void *wcombo, char *data, int idx)
637{ 599{
638 wacom_report_abs(wcombo, ABS_X, 600 wacom_report_abs(wcombo, ABS_X,
639 (data[2 + idx * 2] & 0xff) | ((data[3 + idx * 2] & 0x7f) << 8)); 601 data[2 + idx * 2] | ((data[3 + idx * 2] & 0x7f) << 8));
640 wacom_report_abs(wcombo, ABS_Y, 602 wacom_report_abs(wcombo, ABS_Y,
641 (data[6 + idx * 2] & 0xff) | ((data[7 + idx * 2] & 0x7f) << 8)); 603 data[6 + idx * 2] | ((data[7 + idx * 2] & 0x7f) << 8));
642 wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]); 604 wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]);
643 wacom_report_key(wcombo, wacom->tool[idx], 1); 605 wacom_report_key(wcombo, wacom->tool[idx], 1);
644 if (idx) 606 if (idx)
@@ -782,31 +744,24 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
782 744
783 touchInProx = 0; 745 touchInProx = 0;
784 746
785 if (prox) { /* in prox */ 747 if (!wacom->id[0]) { /* first in prox */
786 if (!wacom->id[0]) { 748 /* Going into proximity select tool */
787 /* Going into proximity select tool */ 749 wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
788 wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; 750 if (wacom->tool[0] == BTN_TOOL_PEN)
789 if (wacom->tool[0] == BTN_TOOL_PEN) 751 wacom->id[0] = STYLUS_DEVICE_ID;
790 wacom->id[0] = STYLUS_DEVICE_ID; 752 else
791 else 753 wacom->id[0] = ERASER_DEVICE_ID;
792 wacom->id[0] = ERASER_DEVICE_ID; 754 }
793 } 755 wacom_report_key(wcombo, BTN_STYLUS, data[1] & 0x02);
794 wacom_report_key(wcombo, BTN_STYLUS, data[1] & 0x02); 756 wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x10);
795 wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x10); 757 wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[2]));
796 wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[2])); 758 wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4]));
797 wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4])); 759 pressure = ((data[7] & 0x01) << 8) | data[6];
798 pressure = ((data[7] & 0x01) << 8) | data[6]; 760 if (pressure < 0)
799 if (pressure < 0) 761 pressure = features->pressure_max + pressure + 1;
800 pressure = features->pressure_max + pressure + 1; 762 wacom_report_abs(wcombo, ABS_PRESSURE, pressure);
801 wacom_report_abs(wcombo, ABS_PRESSURE, pressure); 763 wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x05);
802 wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x05); 764 if (!prox) { /* out-prox */
803 } else {
804 wacom_report_abs(wcombo, ABS_X, 0);
805 wacom_report_abs(wcombo, ABS_Y, 0);
806 wacom_report_abs(wcombo, ABS_PRESSURE, 0);
807 wacom_report_key(wcombo, BTN_STYLUS, 0);
808 wacom_report_key(wcombo, BTN_STYLUS2, 0);
809 wacom_report_key(wcombo, BTN_TOUCH, 0);
810 wacom->id[0] = 0; 765 wacom->id[0] = 0;
811 /* pen is out so touch can be enabled now */ 766 /* pen is out so touch can be enabled now */
812 touchInProx = 1; 767 touchInProx = 1;
@@ -1028,7 +983,7 @@ static const struct wacom_features wacom_features_0x93 =
1028static const struct wacom_features wacom_features_0x9A = 983static const struct wacom_features wacom_features_0x9A =
1029 { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; 984 { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC };
1030static const struct wacom_features wacom_features_0x9F = 985static const struct wacom_features wacom_features_0x9F =
1031 { "Wacom ISDv4 9F", WACOM_PKGLEN_PENABLED, 26202, 16325, 255, 0, TABLETPC }; 986 { "Wacom ISDv4 9F", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC };
1032static const struct wacom_features wacom_features_0xE2 = 987static const struct wacom_features wacom_features_0xE2 =
1033 { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }; 988 { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG };
1034static const struct wacom_features wacom_features_0xE3 = 989static const struct wacom_features wacom_features_0xE3 =
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 8590b1e8ec37..b50cf04e61a8 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -17,7 +17,6 @@
17#define WACOM_PKGLEN_GRAPHIRE 8 17#define WACOM_PKGLEN_GRAPHIRE 8
18#define WACOM_PKGLEN_BBFUN 9 18#define WACOM_PKGLEN_BBFUN 9
19#define WACOM_PKGLEN_INTUOS 10 19#define WACOM_PKGLEN_INTUOS 10
20#define WACOM_PKGLEN_PENABLED 8
21#define WACOM_PKGLEN_TPC1FG 5 20#define WACOM_PKGLEN_TPC1FG 5
22#define WACOM_PKGLEN_TPC2FG 14 21#define WACOM_PKGLEN_TPC2FG 14
23 22
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 7208654a94ae..8a8fa4d2d6a8 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -24,17 +24,18 @@ config TOUCHSCREEN_88PM860X
24 module will be called 88pm860x-ts. 24 module will be called 88pm860x-ts.
25 25
26config TOUCHSCREEN_ADS7846 26config TOUCHSCREEN_ADS7846
27 tristate "ADS7846/TSC2046 and ADS7843 based touchscreens" 27 tristate "ADS7846/TSC2046/AD7873 and AD(S)7843 based touchscreens"
28 depends on SPI_MASTER 28 depends on SPI_MASTER
29 depends on HWMON = n || HWMON 29 depends on HWMON = n || HWMON
30 help 30 help
31 Say Y here if you have a touchscreen interface using the 31 Say Y here if you have a touchscreen interface using the
32 ADS7846/TSC2046 or ADS7843 controller, and your board-specific 32 ADS7846/TSC2046/AD7873 or ADS7843/AD7843 controller,
33 setup code includes that in its table of SPI devices. 33 and your board-specific setup code includes that in its
34 table of SPI devices.
34 35
35 If HWMON is selected, and the driver is told the reference voltage 36 If HWMON is selected, and the driver is told the reference voltage
36 on your board, you will also get hwmon interfaces for the voltage 37 on your board, you will also get hwmon interfaces for the voltage
37 (and on ads7846/tsc2046, temperature) sensors of this chip. 38 (and on ads7846/tsc2046/ad7873, temperature) sensors of this chip.
38 39
39 If unsure, say N (but it's safe to say "Y"). 40 If unsure, say N (but it's safe to say "Y").
40 41
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index eb83939c705e..e019d53d1ab4 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -46,7 +46,7 @@
46#include <linux/spi/ad7877.h> 46#include <linux/spi/ad7877.h>
47#include <asm/irq.h> 47#include <asm/irq.h>
48 48
49#define TS_PEN_UP_TIMEOUT msecs_to_jiffies(50) 49#define TS_PEN_UP_TIMEOUT msecs_to_jiffies(100)
50 50
51#define MAX_SPI_FREQ_HZ 20000000 51#define MAX_SPI_FREQ_HZ 20000000
52#define MAX_12BIT ((1<<12)-1) 52#define MAX_12BIT ((1<<12)-1)
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 8b05d8e97543..532279cda0e4 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -36,6 +36,7 @@
36 * TSC2046 is just newer ads7846 silicon. 36 * TSC2046 is just newer ads7846 silicon.
37 * Support for ads7843 tested on Atmel at91sam926x-EK. 37 * Support for ads7843 tested on Atmel at91sam926x-EK.
38 * Support for ads7845 has only been stubbed in. 38 * Support for ads7845 has only been stubbed in.
39 * Support for Analog Devices AD7873 and AD7843 tested.
39 * 40 *
40 * IRQ handling needs a workaround because of a shortcoming in handling 41 * IRQ handling needs a workaround because of a shortcoming in handling
41 * edge triggered IRQs on some platforms like the OMAP1/2. These 42 * edge triggered IRQs on some platforms like the OMAP1/2. These
@@ -821,6 +822,9 @@ static int ads7846_suspend(struct spi_device *spi, pm_message_t message)
821 822
822 spin_unlock_irq(&ts->lock); 823 spin_unlock_irq(&ts->lock);
823 824
825 if (device_may_wakeup(&ts->spi->dev))
826 enable_irq_wake(ts->spi->irq);
827
824 return 0; 828 return 0;
825 829
826} 830}
@@ -829,6 +833,9 @@ static int ads7846_resume(struct spi_device *spi)
829{ 833{
830 struct ads7846 *ts = dev_get_drvdata(&spi->dev); 834 struct ads7846 *ts = dev_get_drvdata(&spi->dev);
831 835
836 if (device_may_wakeup(&ts->spi->dev))
837 disable_irq_wake(ts->spi->irq);
838
832 spin_lock_irq(&ts->lock); 839 spin_lock_irq(&ts->lock);
833 840
834 ts->is_suspended = 0; 841 ts->is_suspended = 0;
@@ -984,6 +991,15 @@ static int __devinit ads7846_probe(struct spi_device *spi)
984 991
985 vref = pdata->keep_vref_on; 992 vref = pdata->keep_vref_on;
986 993
994 if (ts->model == 7873) {
995 /* The AD7873 is almost identical to the ADS7846
996 * keep VREF off during differential/ratiometric
997 * conversion modes
998 */
999 ts->model = 7846;
1000 vref = 0;
1001 }
1002
987 /* set up the transfers to read touchscreen state; this assumes we 1003 /* set up the transfers to read touchscreen state; this assumes we
988 * use formula #2 for pressure, not #3. 1004 * use formula #2 for pressure, not #3.
989 */ 1005 */
@@ -1191,6 +1207,8 @@ static int __devinit ads7846_probe(struct spi_device *spi)
1191 if (err) 1207 if (err)
1192 goto err_remove_attr_group; 1208 goto err_remove_attr_group;
1193 1209
1210 device_init_wakeup(&spi->dev, pdata->wakeup);
1211
1194 return 0; 1212 return 0;
1195 1213
1196 err_remove_attr_group: 1214 err_remove_attr_group:
@@ -1220,6 +1238,8 @@ static int __devexit ads7846_remove(struct spi_device *spi)
1220{ 1238{
1221 struct ads7846 *ts = dev_get_drvdata(&spi->dev); 1239 struct ads7846 *ts = dev_get_drvdata(&spi->dev);
1222 1240
1241 device_init_wakeup(&spi->dev, false);
1242
1223 ads784x_hwmon_unregister(spi, ts); 1243 ads784x_hwmon_unregister(spi, ts);
1224 input_unregister_device(ts->input); 1244 input_unregister_device(ts->input);
1225 1245
diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c
index 0903f539bf68..0a3b4ed38e48 100644
--- a/drivers/media/IR/ir-keytable.c
+++ b/drivers/media/IR/ir-keytable.c
@@ -123,7 +123,7 @@ static int ir_copy_table(struct ir_scancode_table *destin,
123 * If the key is not found, returns -EINVAL, otherwise, returns 0. 123 * If the key is not found, returns -EINVAL, otherwise, returns 0.
124 */ 124 */
125static int ir_getkeycode(struct input_dev *dev, 125static int ir_getkeycode(struct input_dev *dev,
126 int scancode, int *keycode) 126 unsigned int scancode, unsigned int *keycode)
127{ 127{
128 int elem; 128 int elem;
129 struct ir_input_dev *ir_dev = input_get_drvdata(dev); 129 struct ir_input_dev *ir_dev = input_get_drvdata(dev);
@@ -291,7 +291,7 @@ static int ir_insert_key(struct ir_scancode_table *rc_tab,
291 * If the key is not found, returns -EINVAL, otherwise, returns 0. 291 * If the key is not found, returns -EINVAL, otherwise, returns 0.
292 */ 292 */
293static int ir_setkeycode(struct input_dev *dev, 293static int ir_setkeycode(struct input_dev *dev,
294 int scancode, int keycode) 294 unsigned int scancode, unsigned int keycode)
295{ 295{
296 int rc = 0; 296 int rc = 0;
297 struct ir_input_dev *ir_dev = input_get_drvdata(dev); 297 struct ir_input_dev *ir_dev = input_get_drvdata(dev);
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
index a03ef7efec9a..852fe89539cf 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
@@ -9,7 +9,7 @@
9#include <linux/usb/input.h> 9#include <linux/usb/input.h>
10 10
11static int dvb_usb_getkeycode(struct input_dev *dev, 11static int dvb_usb_getkeycode(struct input_dev *dev,
12 int scancode, int *keycode) 12 unsigned int scancode, unsigned int *keycode)
13{ 13{
14 struct dvb_usb_device *d = input_get_drvdata(dev); 14 struct dvb_usb_device *d = input_get_drvdata(dev);
15 15
@@ -39,7 +39,7 @@ static int dvb_usb_getkeycode(struct input_dev *dev,
39} 39}
40 40
41static int dvb_usb_setkeycode(struct input_dev *dev, 41static int dvb_usb_setkeycode(struct input_dev *dev,
42 int scancode, int keycode) 42 unsigned int scancode, unsigned int keycode)
43{ 43{
44 struct dvb_usb_device *d = input_get_drvdata(dev); 44 struct dvb_usb_device *d = input_get_drvdata(dev);
45 45
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index d16af6a423fb..2191c8d896a0 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -268,6 +268,16 @@ config ISL29003
268 This driver can also be built as a module. If so, the module 268 This driver can also be built as a module. If so, the module
269 will be called isl29003. 269 will be called isl29003.
270 270
271config SENSORS_TSL2550
272 tristate "Taos TSL2550 ambient light sensor"
273 depends on I2C && SYSFS
274 help
275 If you say yes here you get support for the Taos TSL2550
276 ambient light sensor.
277
278 This driver can also be built as a module. If so, the module
279 will be called tsl2550.
280
271config EP93XX_PWM 281config EP93XX_PWM
272 tristate "EP93xx PWM support" 282 tristate "EP93xx PWM support"
273 depends on ARCH_EP93XX 283 depends on ARCH_EP93XX
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 049ff2482f30..27c484355414 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_SGI_GRU) += sgi-gru/
21obj-$(CONFIG_CS5535_MFGPT) += cs5535-mfgpt.o 21obj-$(CONFIG_CS5535_MFGPT) += cs5535-mfgpt.o
22obj-$(CONFIG_HP_ILO) += hpilo.o 22obj-$(CONFIG_HP_ILO) += hpilo.o
23obj-$(CONFIG_ISL29003) += isl29003.o 23obj-$(CONFIG_ISL29003) += isl29003.o
24obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o
24obj-$(CONFIG_EP93XX_PWM) += ep93xx_pwm.o 25obj-$(CONFIG_EP93XX_PWM) += ep93xx_pwm.o
25obj-$(CONFIG_DS1682) += ds1682.o 26obj-$(CONFIG_DS1682) += ds1682.o
26obj-$(CONFIG_TI_DAC7512) += ti_dac7512.o 27obj-$(CONFIG_TI_DAC7512) += ti_dac7512.o
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 2cb2736d65aa..db7d0f21b65d 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -505,6 +505,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
505 * Export the EEPROM bytes through sysfs, since that's convenient. 505 * Export the EEPROM bytes through sysfs, since that's convenient.
506 * By default, only root should see the data (maybe passwords etc) 506 * By default, only root should see the data (maybe passwords etc)
507 */ 507 */
508 sysfs_bin_attr_init(&at24->bin);
508 at24->bin.attr.name = "eeprom"; 509 at24->bin.attr.name = "eeprom";
509 at24->bin.attr.mode = chip.flags & AT24_FLAG_IRUGO ? S_IRUGO : S_IRUSR; 510 at24->bin.attr.mode = chip.flags & AT24_FLAG_IRUGO ? S_IRUGO : S_IRUSR;
510 at24->bin.read = at24_bin_read; 511 at24->bin.read = at24_bin_read;
diff --git a/drivers/i2c/chips/tsl2550.c b/drivers/misc/tsl2550.c
index a0702f36a72f..483ae5f7f68e 100644
--- a/drivers/i2c/chips/tsl2550.c
+++ b/drivers/misc/tsl2550.c
@@ -47,8 +47,8 @@ struct tsl2550_data {
47 struct i2c_client *client; 47 struct i2c_client *client;
48 struct mutex update_lock; 48 struct mutex update_lock;
49 49
50 unsigned int power_state : 1; 50 unsigned int power_state:1;
51 unsigned int operating_mode : 1; 51 unsigned int operating_mode:1;
52}; 52};
53 53
54/* 54/*
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 1157d5679e66..42e5ea49e975 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -457,7 +457,7 @@ config MTD_NAND_NOMADIK
457 457
458config MTD_NAND_SH_FLCTL 458config MTD_NAND_SH_FLCTL
459 tristate "Support for NAND on Renesas SuperH FLCTL" 459 tristate "Support for NAND on Renesas SuperH FLCTL"
460 depends on MTD_NAND && SUPERH 460 depends on MTD_NAND && (SUPERH || ARCH_SHMOBILE)
461 help 461 help
462 Several Renesas SuperH CPU has FLCTL. This option enables support 462 Several Renesas SuperH CPU has FLCTL. This option enables support
463 for NAND Flash using FLCTL. 463 for NAND Flash using FLCTL.
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 7029cd50c458..0ba5b8e50a7c 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -907,7 +907,7 @@ config SMC91X
907 select CRC32 907 select CRC32
908 select MII 908 select MII
909 depends on ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH || \ 909 depends on ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH || \
910 MIPS || BLACKFIN || MN10300 910 MIPS || BLACKFIN || MN10300 || COLDFIRE
911 help 911 help
912 This is a driver for SMC's 91x series of Ethernet chipsets, 912 This is a driver for SMC's 91x series of Ethernet chipsets,
913 including the SMC91C94 and the SMC91C111. Say Y if you want it 913 including the SMC91C94 and the SMC91C111. Say Y if you want it
diff --git a/drivers/net/arm/ks8695net.c b/drivers/net/arm/ks8695net.c
index 8ca639127dbc..a1d4188c430b 100644
--- a/drivers/net/arm/ks8695net.c
+++ b/drivers/net/arm/ks8695net.c
@@ -575,9 +575,9 @@ static int ks8695_poll(struct napi_struct *napi, int budget)
575 if (work_done < budget) { 575 if (work_done < budget) {
576 unsigned long flags; 576 unsigned long flags;
577 spin_lock_irqsave(&ksp->rx_lock, flags); 577 spin_lock_irqsave(&ksp->rx_lock, flags);
578 __napi_complete(napi);
578 /*enable rx interrupt*/ 579 /*enable rx interrupt*/
579 writel(isr | mask_bit, KS8695_IRQ_VA + KS8695_INTEN); 580 writel(isr | mask_bit, KS8695_IRQ_VA + KS8695_INTEN);
580 __napi_complete(napi);
581 spin_unlock_irqrestore(&ksp->rx_lock, flags); 581 spin_unlock_irqrestore(&ksp->rx_lock, flags);
582 } 582 }
583 return work_done; 583 return work_done;
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index be81fb2d10f7..8f0752553681 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -290,11 +290,6 @@ extern const struct ethtool_ops be_ethtool_ops;
290 290
291#define drvr_stats(adapter) (&adapter->stats.drvr_stats) 291#define drvr_stats(adapter) (&adapter->stats.drvr_stats)
292 292
293static inline unsigned int be_pci_func(struct be_adapter *adapter)
294{
295 return PCI_FUNC(adapter->pdev->devfn);
296}
297
298#define BE_SET_NETDEV_OPS(netdev, ops) (netdev->netdev_ops = ops) 293#define BE_SET_NETDEV_OPS(netdev, ops) (netdev->netdev_ops = ops)
299 294
300#define PAGE_SHIFT_4K 12 295#define PAGE_SHIFT_4K 12
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 4b1f80519ca4..c59215361f4e 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -465,8 +465,6 @@ int be_cmd_eq_create(struct be_adapter *adapter,
465 465
466 req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); 466 req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size));
467 467
468 AMAP_SET_BITS(struct amap_eq_context, func, req->context,
469 be_pci_func(adapter));
470 AMAP_SET_BITS(struct amap_eq_context, valid, req->context, 1); 468 AMAP_SET_BITS(struct amap_eq_context, valid, req->context, 1);
471 /* 4byte eqe*/ 469 /* 4byte eqe*/
472 AMAP_SET_BITS(struct amap_eq_context, size, req->context, 0); 470 AMAP_SET_BITS(struct amap_eq_context, size, req->context, 0);
@@ -629,7 +627,6 @@ int be_cmd_cq_create(struct be_adapter *adapter,
629 AMAP_SET_BITS(struct amap_cq_context, eventable, ctxt, 1); 627 AMAP_SET_BITS(struct amap_cq_context, eventable, ctxt, 1);
630 AMAP_SET_BITS(struct amap_cq_context, eqid, ctxt, eq->id); 628 AMAP_SET_BITS(struct amap_cq_context, eqid, ctxt, eq->id);
631 AMAP_SET_BITS(struct amap_cq_context, armed, ctxt, 1); 629 AMAP_SET_BITS(struct amap_cq_context, armed, ctxt, 1);
632 AMAP_SET_BITS(struct amap_cq_context, func, ctxt, be_pci_func(adapter));
633 be_dws_cpu_to_le(ctxt, sizeof(req->context)); 630 be_dws_cpu_to_le(ctxt, sizeof(req->context));
634 631
635 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); 632 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem);
@@ -678,7 +675,6 @@ int be_cmd_mccq_create(struct be_adapter *adapter,
678 675
679 req->num_pages = PAGES_4K_SPANNED(q_mem->va, q_mem->size); 676 req->num_pages = PAGES_4K_SPANNED(q_mem->va, q_mem->size);
680 677
681 AMAP_SET_BITS(struct amap_mcc_context, fid, ctxt, be_pci_func(adapter));
682 AMAP_SET_BITS(struct amap_mcc_context, valid, ctxt, 1); 678 AMAP_SET_BITS(struct amap_mcc_context, valid, ctxt, 1);
683 AMAP_SET_BITS(struct amap_mcc_context, ring_size, ctxt, 679 AMAP_SET_BITS(struct amap_mcc_context, ring_size, ctxt,
684 be_encoded_q_len(mccq->len)); 680 be_encoded_q_len(mccq->len));
@@ -727,8 +723,6 @@ int be_cmd_txq_create(struct be_adapter *adapter,
727 723
728 AMAP_SET_BITS(struct amap_tx_context, tx_ring_size, ctxt, 724 AMAP_SET_BITS(struct amap_tx_context, tx_ring_size, ctxt,
729 be_encoded_q_len(txq->len)); 725 be_encoded_q_len(txq->len));
730 AMAP_SET_BITS(struct amap_tx_context, pci_func_id, ctxt,
731 be_pci_func(adapter));
732 AMAP_SET_BITS(struct amap_tx_context, ctx_valid, ctxt, 1); 726 AMAP_SET_BITS(struct amap_tx_context, ctx_valid, ctxt, 1);
733 AMAP_SET_BITS(struct amap_tx_context, cq_id_send, ctxt, cq->id); 727 AMAP_SET_BITS(struct amap_tx_context, cq_id_send, ctxt, cq->id);
734 728
diff --git a/drivers/net/benet/be_hw.h b/drivers/net/benet/be_hw.h
index 5ffb149181ad..2d4a4b827637 100644
--- a/drivers/net/benet/be_hw.h
+++ b/drivers/net/benet/be_hw.h
@@ -114,8 +114,7 @@
114#define IMG_TYPE_ISCSI_BACKUP 9 114#define IMG_TYPE_ISCSI_BACKUP 9
115#define IMG_TYPE_FCOE_FW_ACTIVE 10 115#define IMG_TYPE_FCOE_FW_ACTIVE 10
116#define IMG_TYPE_FCOE_FW_BACKUP 11 116#define IMG_TYPE_FCOE_FW_BACKUP 11
117#define IMG_TYPE_NCSI_BITFILE 13 117#define IMG_TYPE_NCSI_FW 13
118#define IMG_TYPE_NCSI_8051 14
119 118
120#define FLASHROM_OPER_FLASH 1 119#define FLASHROM_OPER_FLASH 1
121#define FLASHROM_OPER_SAVE 2 120#define FLASHROM_OPER_SAVE 2
@@ -127,6 +126,7 @@
127#define FLASH_IMAGE_MAX_SIZE_g3 (2097152) /* Max fw image size */ 126#define FLASH_IMAGE_MAX_SIZE_g3 (2097152) /* Max fw image size */
128#define FLASH_BIOS_IMAGE_MAX_SIZE_g3 (524288) /* Max OPTION ROM img sz */ 127#define FLASH_BIOS_IMAGE_MAX_SIZE_g3 (524288) /* Max OPTION ROM img sz */
129#define FLASH_REDBOOT_IMAGE_MAX_SIZE_g3 (1048576) /* Max Redboot image sz */ 128#define FLASH_REDBOOT_IMAGE_MAX_SIZE_g3 (1048576) /* Max Redboot image sz */
129#define FLASH_NCSI_IMAGE_MAX_SIZE_g3 (262144) /* Max NSCI image sz */
130 130
131#define FLASH_NCSI_MAGIC (0x16032009) 131#define FLASH_NCSI_MAGIC (0x16032009)
132#define FLASH_NCSI_DISABLED (0) 132#define FLASH_NCSI_DISABLED (0)
@@ -144,6 +144,7 @@
144#define FLASH_FCoE_BIOS_START_g2 (524288) 144#define FLASH_FCoE_BIOS_START_g2 (524288)
145#define FLASH_REDBOOT_START_g2 (0) 145#define FLASH_REDBOOT_START_g2 (0)
146 146
147#define FLASH_NCSI_START_g3 (15990784)
147#define FLASH_iSCSI_PRIMARY_IMAGE_START_g3 (2097152) 148#define FLASH_iSCSI_PRIMARY_IMAGE_START_g3 (2097152)
148#define FLASH_iSCSI_BACKUP_IMAGE_START_g3 (4194304) 149#define FLASH_iSCSI_BACKUP_IMAGE_START_g3 (4194304)
149#define FLASH_FCoE_PRIMARY_IMAGE_START_g3 (6291456) 150#define FLASH_FCoE_PRIMARY_IMAGE_START_g3 (6291456)
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index a703ed8e24fe..43e8032f9236 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -1382,7 +1382,7 @@ rx_eq_free:
1382/* There are 8 evt ids per func. Retruns the evt id's bit number */ 1382/* There are 8 evt ids per func. Retruns the evt id's bit number */
1383static inline int be_evt_bit_get(struct be_adapter *adapter, u32 eq_id) 1383static inline int be_evt_bit_get(struct be_adapter *adapter, u32 eq_id)
1384{ 1384{
1385 return eq_id - 8 * be_pci_func(adapter); 1385 return eq_id % 8;
1386} 1386}
1387 1387
1388static irqreturn_t be_intx(int irq, void *dev) 1388static irqreturn_t be_intx(int irq, void *dev)
@@ -1880,8 +1880,9 @@ static int be_flash_data(struct be_adapter *adapter,
1880 const u8 *p = fw->data; 1880 const u8 *p = fw->data;
1881 struct be_cmd_write_flashrom *req = flash_cmd->va; 1881 struct be_cmd_write_flashrom *req = flash_cmd->va;
1882 struct flash_comp *pflashcomp; 1882 struct flash_comp *pflashcomp;
1883 int num_comp;
1883 1884
1884 struct flash_comp gen3_flash_types[8] = { 1885 struct flash_comp gen3_flash_types[9] = {
1885 { FLASH_iSCSI_PRIMARY_IMAGE_START_g3, IMG_TYPE_ISCSI_ACTIVE, 1886 { FLASH_iSCSI_PRIMARY_IMAGE_START_g3, IMG_TYPE_ISCSI_ACTIVE,
1886 FLASH_IMAGE_MAX_SIZE_g3}, 1887 FLASH_IMAGE_MAX_SIZE_g3},
1887 { FLASH_REDBOOT_START_g3, IMG_TYPE_REDBOOT, 1888 { FLASH_REDBOOT_START_g3, IMG_TYPE_REDBOOT,
@@ -1897,7 +1898,9 @@ static int be_flash_data(struct be_adapter *adapter,
1897 { FLASH_FCoE_PRIMARY_IMAGE_START_g3, IMG_TYPE_FCOE_FW_ACTIVE, 1898 { FLASH_FCoE_PRIMARY_IMAGE_START_g3, IMG_TYPE_FCOE_FW_ACTIVE,
1898 FLASH_IMAGE_MAX_SIZE_g3}, 1899 FLASH_IMAGE_MAX_SIZE_g3},
1899 { FLASH_FCoE_BACKUP_IMAGE_START_g3, IMG_TYPE_FCOE_FW_BACKUP, 1900 { FLASH_FCoE_BACKUP_IMAGE_START_g3, IMG_TYPE_FCOE_FW_BACKUP,
1900 FLASH_IMAGE_MAX_SIZE_g3} 1901 FLASH_IMAGE_MAX_SIZE_g3},
1902 { FLASH_NCSI_START_g3, IMG_TYPE_NCSI_FW,
1903 FLASH_NCSI_IMAGE_MAX_SIZE_g3}
1901 }; 1904 };
1902 struct flash_comp gen2_flash_types[8] = { 1905 struct flash_comp gen2_flash_types[8] = {
1903 { FLASH_iSCSI_PRIMARY_IMAGE_START_g2, IMG_TYPE_ISCSI_ACTIVE, 1906 { FLASH_iSCSI_PRIMARY_IMAGE_START_g2, IMG_TYPE_ISCSI_ACTIVE,
@@ -1921,11 +1924,16 @@ static int be_flash_data(struct be_adapter *adapter,
1921 if (adapter->generation == BE_GEN3) { 1924 if (adapter->generation == BE_GEN3) {
1922 pflashcomp = gen3_flash_types; 1925 pflashcomp = gen3_flash_types;
1923 filehdr_size = sizeof(struct flash_file_hdr_g3); 1926 filehdr_size = sizeof(struct flash_file_hdr_g3);
1927 num_comp = 9;
1924 } else { 1928 } else {
1925 pflashcomp = gen2_flash_types; 1929 pflashcomp = gen2_flash_types;
1926 filehdr_size = sizeof(struct flash_file_hdr_g2); 1930 filehdr_size = sizeof(struct flash_file_hdr_g2);
1931 num_comp = 8;
1927 } 1932 }
1928 for (i = 0; i < 8; i++) { 1933 for (i = 0; i < num_comp; i++) {
1934 if ((pflashcomp[i].optype == IMG_TYPE_NCSI_FW) &&
1935 memcmp(adapter->fw_ver, "3.102.148.0", 11) < 0)
1936 continue;
1929 if ((pflashcomp[i].optype == IMG_TYPE_REDBOOT) && 1937 if ((pflashcomp[i].optype == IMG_TYPE_REDBOOT) &&
1930 (!be_flash_redboot(adapter, fw->data, 1938 (!be_flash_redboot(adapter, fw->data,
1931 pflashcomp[i].offset, pflashcomp[i].size, 1939 pflashcomp[i].offset, pflashcomp[i].size,
@@ -1985,16 +1993,7 @@ int be_load_fw(struct be_adapter *adapter, u8 *func)
1985 struct be_dma_mem flash_cmd; 1993 struct be_dma_mem flash_cmd;
1986 int status, i = 0; 1994 int status, i = 0;
1987 const u8 *p; 1995 const u8 *p;
1988 char fw_ver[FW_VER_LEN];
1989 char fw_cfg;
1990
1991 status = be_cmd_get_fw_ver(adapter, fw_ver);
1992 if (status)
1993 return status;
1994 1996
1995 fw_cfg = *(fw_ver + 2);
1996 if (fw_cfg == '0')
1997 fw_cfg = '1';
1998 strcpy(fw_file, func); 1997 strcpy(fw_file, func);
1999 1998
2000 status = request_firmware(&fw, fw_file, &adapter->pdev->dev); 1999 status = request_firmware(&fw, fw_file, &adapter->pdev->dev);
diff --git a/drivers/net/can/bfin_can.c b/drivers/net/can/bfin_can.c
index bf7f9ba2d903..866905fa4119 100644
--- a/drivers/net/can/bfin_can.c
+++ b/drivers/net/can/bfin_can.c
@@ -26,6 +26,7 @@
26 26
27#define DRV_NAME "bfin_can" 27#define DRV_NAME "bfin_can"
28#define BFIN_CAN_TIMEOUT 100 28#define BFIN_CAN_TIMEOUT 100
29#define TX_ECHO_SKB_MAX 1
29 30
30/* 31/*
31 * transmit and receive channels 32 * transmit and receive channels
@@ -593,7 +594,7 @@ struct net_device *alloc_bfin_candev(void)
593 struct net_device *dev; 594 struct net_device *dev;
594 struct bfin_can_priv *priv; 595 struct bfin_can_priv *priv;
595 596
596 dev = alloc_candev(sizeof(*priv)); 597 dev = alloc_candev(sizeof(*priv), TX_ECHO_SKB_MAX);
597 if (!dev) 598 if (!dev)
598 return NULL; 599 return NULL;
599 600
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index 11c87840cc00..33451092b8e8 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -876,9 +876,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
876 return NETDEV_TX_OK; 876 return NETDEV_TX_OK;
877 877
878nomem: 878nomem:
879 if (skb) 879 dev_kfree_skb(skb);
880 dev_kfree_skb(skb);
881
882 stats->tx_dropped++; 880 stats->tx_dropped++;
883 881
884 return NETDEV_TX_OK; 882 return NETDEV_TX_OK;
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 7cbcfb0ade1c..9bd155e4111c 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -5072,7 +5072,7 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
5072 INIT_WORK(&cp->reset_task, cas_reset_task); 5072 INIT_WORK(&cp->reset_task, cas_reset_task);
5073 5073
5074 /* Default link parameters */ 5074 /* Default link parameters */
5075 if (link_mode >= 0 && link_mode <= 6) 5075 if (link_mode >= 0 && link_mode < 6)
5076 cp->link_cntl = link_modes[link_mode]; 5076 cp->link_cntl = link_modes[link_mode];
5077 else 5077 else
5078 cp->link_cntl = BMCR_ANENABLE; 5078 cp->link_cntl = BMCR_ANENABLE;
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index b85c81f60d10..60777fd90b33 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -28,6 +28,7 @@
28#include <linux/delay.h> 28#include <linux/delay.h>
29 29
30#include <linux/netdevice.h> 30#include <linux/netdevice.h>
31#include <linux/if_vlan.h>
31#include <linux/etherdevice.h> 32#include <linux/etherdevice.h>
32#include <linux/ethtool.h> 33#include <linux/ethtool.h>
33#include <linux/skbuff.h> 34#include <linux/skbuff.h>
@@ -55,9 +56,9 @@ module_param(dumb_switch, int, 0444);
55MODULE_PARM_DESC(debug_level, "Number of NETIF_MSG bits to enable"); 56MODULE_PARM_DESC(debug_level, "Number of NETIF_MSG bits to enable");
56MODULE_PARM_DESC(dumb_switch, "Assume switch is not connected to MDIO bus"); 57MODULE_PARM_DESC(dumb_switch, "Assume switch is not connected to MDIO bus");
57 58
58#define CPMAC_VERSION "0.5.1" 59#define CPMAC_VERSION "0.5.2"
59/* frame size + 802.1q tag */ 60/* frame size + 802.1q tag + FCS size */
60#define CPMAC_SKB_SIZE (ETH_FRAME_LEN + 4) 61#define CPMAC_SKB_SIZE (ETH_FRAME_LEN + ETH_FCS_LEN + VLAN_HLEN)
61#define CPMAC_QUEUES 8 62#define CPMAC_QUEUES 8
62 63
63/* Ethernet registers */ 64/* Ethernet registers */
@@ -1136,8 +1137,9 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
1136 } 1137 }
1137 1138
1138 if (phy_id == PHY_MAX_ADDR) { 1139 if (phy_id == PHY_MAX_ADDR) {
1139 dev_err(&pdev->dev, "no PHY present\n"); 1140 dev_err(&pdev->dev, "no PHY present, falling back to switch on MDIO bus 0\n");
1140 return -ENODEV; 1141 strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */
1142 phy_id = pdev->id;
1141 } 1143 }
1142 1144
1143 dev = alloc_etherdev_mq(sizeof(*priv), CPMAC_QUEUES); 1145 dev = alloc_etherdev_mq(sizeof(*priv), CPMAC_QUEUES);
@@ -1290,8 +1292,8 @@ void __devexit cpmac_exit(void)
1290{ 1292{
1291 platform_driver_unregister(&cpmac_driver); 1293 platform_driver_unregister(&cpmac_driver);
1292 mdiobus_unregister(cpmac_mii); 1294 mdiobus_unregister(cpmac_mii);
1293 mdiobus_free(cpmac_mii);
1294 iounmap(cpmac_mii->priv); 1295 iounmap(cpmac_mii->priv);
1296 mdiobus_free(cpmac_mii);
1295} 1297}
1296 1298
1297module_init(cpmac_init); 1299module_init(cpmac_init);
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 3e453e1d97e7..9e3e8750b46a 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -1294,6 +1294,7 @@ static void cxgb_down(struct adapter *adapter)
1294 1294
1295 free_irq_resources(adapter); 1295 free_irq_resources(adapter);
1296 quiesce_rx(adapter); 1296 quiesce_rx(adapter);
1297 t3_sge_stop(adapter);
1297 flush_workqueue(cxgb3_wq); /* wait for external IRQ handler */ 1298 flush_workqueue(cxgb3_wq); /* wait for external IRQ handler */
1298} 1299}
1299 1300
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 13f9869927e3..8bd086aee56d 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -2385,7 +2385,7 @@ static int emac_dev_open(struct net_device *ndev)
2385 struct emac_priv *priv = netdev_priv(ndev); 2385 struct emac_priv *priv = netdev_priv(ndev);
2386 2386
2387 netif_carrier_off(ndev); 2387 netif_carrier_off(ndev);
2388 for (cnt = 0; cnt <= ETH_ALEN; cnt++) 2388 for (cnt = 0; cnt < ETH_ALEN; cnt++)
2389 ndev->dev_addr[cnt] = priv->mac_addr[cnt]; 2389 ndev->dev_addr[cnt] = priv->mac_addr[cnt];
2390 2390
2391 /* Configuration items */ 2391 /* Configuration items */
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h
index db05ec355749..e301e26d6897 100644
--- a/drivers/net/e1000e/defines.h
+++ b/drivers/net/e1000e/defines.h
@@ -320,6 +320,8 @@
320#define E1000_RXCSUM_IPPCSE 0x00001000 /* IP payload checksum enable */ 320#define E1000_RXCSUM_IPPCSE 0x00001000 /* IP payload checksum enable */
321 321
322/* Header split receive */ 322/* Header split receive */
323#define E1000_RFCTL_NFSW_DIS 0x00000040
324#define E1000_RFCTL_NFSR_DIS 0x00000080
323#define E1000_RFCTL_ACK_DIS 0x00001000 325#define E1000_RFCTL_ACK_DIS 0x00001000
324#define E1000_RFCTL_EXTEN 0x00008000 326#define E1000_RFCTL_EXTEN 0x00008000
325#define E1000_RFCTL_IPV6_EX_DIS 0x00010000 327#define E1000_RFCTL_IPV6_EX_DIS 0x00010000
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index 54d03a0ce3ce..8b5e157e9c87 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -2740,6 +2740,16 @@ static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw)
2740 reg &= ~(1 << 31); 2740 reg &= ~(1 << 31);
2741 ew32(STATUS, reg); 2741 ew32(STATUS, reg);
2742 } 2742 }
2743
2744 /*
2745 * work-around descriptor data corruption issue during nfs v2 udp
2746 * traffic, just disable the nfs filtering capability
2747 */
2748 reg = er32(RFCTL);
2749 reg |= (E1000_RFCTL_NFSW_DIS | E1000_RFCTL_NFSR_DIS);
2750 ew32(RFCTL, reg);
2751
2752 return;
2743} 2753}
2744 2754
2745/** 2755/**
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 61a7b4351e78..b6715553cf17 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -2021,7 +2021,6 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
2021 } 2021 }
2022 2022
2023 /* setup the TxBD length and buffer pointer for the first BD */ 2023 /* setup the TxBD length and buffer pointer for the first BD */
2024 tx_queue->tx_skbuff[tx_queue->skb_curtx] = skb;
2025 txbdp_start->bufPtr = dma_map_single(&priv->ofdev->dev, skb->data, 2024 txbdp_start->bufPtr = dma_map_single(&priv->ofdev->dev, skb->data,
2026 skb_headlen(skb), DMA_TO_DEVICE); 2025 skb_headlen(skb), DMA_TO_DEVICE);
2027 2026
@@ -2053,6 +2052,10 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
2053 2052
2054 txbdp_start->lstatus = lstatus; 2053 txbdp_start->lstatus = lstatus;
2055 2054
2055 eieio(); /* force lstatus write before tx_skbuff */
2056
2057 tx_queue->tx_skbuff[tx_queue->skb_curtx] = skb;
2058
2056 /* Update the current skb pointer to the next entry we will use 2059 /* Update the current skb pointer to the next entry we will use
2057 * (wrapping if necessary) */ 2060 * (wrapping if necessary) */
2058 tx_queue->skb_curtx = (tx_queue->skb_curtx + 1) & 2061 tx_queue->skb_curtx = (tx_queue->skb_curtx + 1) &
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index e8e33bb9d876..2c9b3af16612 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -1651,6 +1651,8 @@ static int irda_usb_probe(struct usb_interface *intf,
1651 1651
1652 self->rx_urb = kcalloc(self->max_rx_urb, sizeof(struct urb *), 1652 self->rx_urb = kcalloc(self->max_rx_urb, sizeof(struct urb *),
1653 GFP_KERNEL); 1653 GFP_KERNEL);
1654 if (!self->rx_urb)
1655 goto err_free_net;
1654 1656
1655 for (i = 0; i < self->max_rx_urb; i++) { 1657 for (i = 0; i < self->max_rx_urb; i++) {
1656 self->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL); 1658 self->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL);
@@ -1783,6 +1785,8 @@ err_out_2:
1783err_out_1: 1785err_out_1:
1784 for (i = 0; i < self->max_rx_urb; i++) 1786 for (i = 0; i < self->max_rx_urb; i++)
1785 usb_free_urb(self->rx_urb[i]); 1787 usb_free_urb(self->rx_urb[i]);
1788 kfree(self->rx_urb);
1789err_free_net:
1786 free_netdev(net); 1790 free_netdev(net);
1787err_out: 1791err_out:
1788 return ret; 1792 return ret;
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index b40a851ec7d1..0da94b208db1 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -423,6 +423,11 @@ struct qlcnic_adapter_stats {
423 u64 lro_pkts; 423 u64 lro_pkts;
424 u64 rxbytes; 424 u64 rxbytes;
425 u64 txbytes; 425 u64 txbytes;
426 u64 lrobytes;
427 u64 lso_frames;
428 u64 xmit_on;
429 u64 xmit_off;
430 u64 skb_alloc_failure;
426}; 431};
427 432
428/* 433/*
@@ -1095,11 +1100,11 @@ struct qlcnic_brdinfo {
1095 1100
1096static const struct qlcnic_brdinfo qlcnic_boards[] = { 1101static const struct qlcnic_brdinfo qlcnic_boards[] = {
1097 {0x1077, 0x8020, 0x1077, 0x203, 1102 {0x1077, 0x8020, 0x1077, 0x203,
1098 "8200 Series Single Port 10GbE Converged Network Adapter \ 1103 "8200 Series Single Port 10GbE Converged Network Adapter "
1099 (TCP/IP Networking)"}, 1104 "(TCP/IP Networking)"},
1100 {0x1077, 0x8020, 0x1077, 0x207, 1105 {0x1077, 0x8020, 0x1077, 0x207,
1101 "8200 Series Dual Port 10GbE Converged Network Adapter \ 1106 "8200 Series Dual Port 10GbE Converged Network Adapter "
1102 (TCP/IP Networking)"}, 1107 "(TCP/IP Networking)"},
1103 {0x1077, 0x8020, 0x1077, 0x20b, 1108 {0x1077, 0x8020, 0x1077, 0x20b,
1104 "3200 Series Dual Port 10Gb Intelligent Ethernet Adapter"}, 1109 "3200 Series Dual Port 10Gb Intelligent Ethernet Adapter"},
1105 {0x1077, 0x8020, 0x1077, 0x20c, 1110 {0x1077, 0x8020, 0x1077, 0x20c,
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index 8da6ec8c13b9..f83e15fe3e1b 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -59,6 +59,17 @@ static const struct qlcnic_stats qlcnic_gstrings_stats[] = {
59 QLC_SIZEOF(stats.rxbytes), QLC_OFF(stats.rxbytes)}, 59 QLC_SIZEOF(stats.rxbytes), QLC_OFF(stats.rxbytes)},
60 {"tx_bytes", 60 {"tx_bytes",
61 QLC_SIZEOF(stats.txbytes), QLC_OFF(stats.txbytes)}, 61 QLC_SIZEOF(stats.txbytes), QLC_OFF(stats.txbytes)},
62 {"lrobytes",
63 QLC_SIZEOF(stats.lrobytes), QLC_OFF(stats.lrobytes)},
64 {"lso_frames",
65 QLC_SIZEOF(stats.lso_frames), QLC_OFF(stats.lso_frames)},
66 {"xmit_on",
67 QLC_SIZEOF(stats.xmit_on), QLC_OFF(stats.xmit_on)},
68 {"xmit_off",
69 QLC_SIZEOF(stats.xmit_off), QLC_OFF(stats.xmit_off)},
70 {"skb_alloc_failure", QLC_SIZEOF(stats.skb_alloc_failure),
71 QLC_OFF(stats.skb_alloc_failure)},
72
62}; 73};
63 74
64#define QLCNIC_STATS_LEN ARRAY_SIZE(qlcnic_gstrings_stats) 75#define QLCNIC_STATS_LEN ARRAY_SIZE(qlcnic_gstrings_stats)
@@ -785,6 +796,11 @@ qlcnic_get_ethtool_stats(struct net_device *dev,
785 } 796 }
786} 797}
787 798
799static u32 qlcnic_get_tx_csum(struct net_device *dev)
800{
801 return dev->features & NETIF_F_IP_CSUM;
802}
803
788static u32 qlcnic_get_rx_csum(struct net_device *dev) 804static u32 qlcnic_get_rx_csum(struct net_device *dev)
789{ 805{
790 struct qlcnic_adapter *adapter = netdev_priv(dev); 806 struct qlcnic_adapter *adapter = netdev_priv(dev);
@@ -995,6 +1011,7 @@ const struct ethtool_ops qlcnic_ethtool_ops = {
995 .set_ringparam = qlcnic_set_ringparam, 1011 .set_ringparam = qlcnic_set_ringparam,
996 .get_pauseparam = qlcnic_get_pauseparam, 1012 .get_pauseparam = qlcnic_get_pauseparam,
997 .set_pauseparam = qlcnic_set_pauseparam, 1013 .set_pauseparam = qlcnic_set_pauseparam,
1014 .get_tx_csum = qlcnic_get_tx_csum,
998 .set_tx_csum = ethtool_op_set_tx_csum, 1015 .set_tx_csum = ethtool_op_set_tx_csum,
999 .set_sg = ethtool_op_set_sg, 1016 .set_sg = ethtool_op_set_sg,
1000 .get_tso = qlcnic_get_tso, 1017 .get_tso = qlcnic_get_tso,
diff --git a/drivers/net/qlcnic/qlcnic_hw.c b/drivers/net/qlcnic/qlcnic_hw.c
index 99a4d1379d00..da00e162b6d3 100644
--- a/drivers/net/qlcnic/qlcnic_hw.c
+++ b/drivers/net/qlcnic/qlcnic_hw.c
@@ -349,6 +349,7 @@ qlcnic_send_cmd_descs(struct qlcnic_adapter *adapter,
349 if (nr_desc >= qlcnic_tx_avail(tx_ring)) { 349 if (nr_desc >= qlcnic_tx_avail(tx_ring)) {
350 netif_tx_stop_queue(tx_ring->txq); 350 netif_tx_stop_queue(tx_ring->txq);
351 __netif_tx_unlock_bh(tx_ring->txq); 351 __netif_tx_unlock_bh(tx_ring->txq);
352 adapter->stats.xmit_off++;
352 return -EBUSY; 353 return -EBUSY;
353 } 354 }
354 355
@@ -397,20 +398,16 @@ qlcnic_sre_macaddr_change(struct qlcnic_adapter *adapter, u8 *addr,
397 return qlcnic_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1); 398 return qlcnic_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1);
398} 399}
399 400
400static int qlcnic_nic_add_mac(struct qlcnic_adapter *adapter, 401static int qlcnic_nic_add_mac(struct qlcnic_adapter *adapter, u8 *addr)
401 u8 *addr, struct list_head *del_list)
402{ 402{
403 struct list_head *head; 403 struct list_head *head;
404 struct qlcnic_mac_list_s *cur; 404 struct qlcnic_mac_list_s *cur;
405 405
406 /* look up if already exists */ 406 /* look up if already exists */
407 list_for_each(head, del_list) { 407 list_for_each(head, &adapter->mac_list) {
408 cur = list_entry(head, struct qlcnic_mac_list_s, list); 408 cur = list_entry(head, struct qlcnic_mac_list_s, list);
409 409 if (memcmp(addr, cur->mac_addr, ETH_ALEN) == 0)
410 if (memcmp(addr, cur->mac_addr, ETH_ALEN) == 0) {
411 list_move_tail(head, &adapter->mac_list);
412 return 0; 410 return 0;
413 }
414 } 411 }
415 412
416 cur = kzalloc(sizeof(struct qlcnic_mac_list_s), GFP_ATOMIC); 413 cur = kzalloc(sizeof(struct qlcnic_mac_list_s), GFP_ATOMIC);
@@ -432,14 +429,9 @@ void qlcnic_set_multi(struct net_device *netdev)
432 struct dev_mc_list *mc_ptr; 429 struct dev_mc_list *mc_ptr;
433 u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 430 u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
434 u32 mode = VPORT_MISS_MODE_DROP; 431 u32 mode = VPORT_MISS_MODE_DROP;
435 LIST_HEAD(del_list);
436 struct list_head *head;
437 struct qlcnic_mac_list_s *cur;
438 432
439 list_splice_tail_init(&adapter->mac_list, &del_list); 433 qlcnic_nic_add_mac(adapter, adapter->mac_addr);
440 434 qlcnic_nic_add_mac(adapter, bcast_addr);
441 qlcnic_nic_add_mac(adapter, adapter->mac_addr, &del_list);
442 qlcnic_nic_add_mac(adapter, bcast_addr, &del_list);
443 435
444 if (netdev->flags & IFF_PROMISC) { 436 if (netdev->flags & IFF_PROMISC) {
445 mode = VPORT_MISS_MODE_ACCEPT_ALL; 437 mode = VPORT_MISS_MODE_ACCEPT_ALL;
@@ -454,22 +446,12 @@ void qlcnic_set_multi(struct net_device *netdev)
454 446
455 if (!netdev_mc_empty(netdev)) { 447 if (!netdev_mc_empty(netdev)) {
456 netdev_for_each_mc_addr(mc_ptr, netdev) { 448 netdev_for_each_mc_addr(mc_ptr, netdev) {
457 qlcnic_nic_add_mac(adapter, mc_ptr->dmi_addr, 449 qlcnic_nic_add_mac(adapter, mc_ptr->dmi_addr);
458 &del_list);
459 } 450 }
460 } 451 }
461 452
462send_fw_cmd: 453send_fw_cmd:
463 qlcnic_nic_set_promisc(adapter, mode); 454 qlcnic_nic_set_promisc(adapter, mode);
464 head = &del_list;
465 while (!list_empty(head)) {
466 cur = list_entry(head->next, struct qlcnic_mac_list_s, list);
467
468 qlcnic_sre_macaddr_change(adapter,
469 cur->mac_addr, QLCNIC_MAC_DEL);
470 list_del(&cur->list);
471 kfree(cur);
472 }
473} 455}
474 456
475int qlcnic_nic_set_promisc(struct qlcnic_adapter *adapter, u32 mode) 457int qlcnic_nic_set_promisc(struct qlcnic_adapter *adapter, u32 mode)
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c
index ea00ab4d4feb..7c34e4e29b3f 100644
--- a/drivers/net/qlcnic/qlcnic_init.c
+++ b/drivers/net/qlcnic/qlcnic_init.c
@@ -568,21 +568,123 @@ struct uni_table_desc *qlcnic_get_table_desc(const u8 *unirom, int section)
568 return NULL; 568 return NULL;
569} 569}
570 570
571#define FILEHEADER_SIZE (14 * 4)
572
571static int 573static int
572qlcnic_set_product_offs(struct qlcnic_adapter *adapter) 574qlcnic_validate_header(struct qlcnic_adapter *adapter)
573{ 575{
574 struct uni_table_desc *ptab_descr;
575 const u8 *unirom = adapter->fw->data; 576 const u8 *unirom = adapter->fw->data;
576 u32 i; 577 struct uni_table_desc *directory = (struct uni_table_desc *) &unirom[0];
578 __le32 fw_file_size = adapter->fw->size;
577 __le32 entries; 579 __le32 entries;
580 __le32 entry_size;
581 __le32 tab_size;
582
583 if (fw_file_size < FILEHEADER_SIZE)
584 return -EINVAL;
585
586 entries = cpu_to_le32(directory->num_entries);
587 entry_size = cpu_to_le32(directory->entry_size);
588 tab_size = cpu_to_le32(directory->findex) + (entries * entry_size);
589
590 if (fw_file_size < tab_size)
591 return -EINVAL;
592
593 return 0;
594}
595
596static int
597qlcnic_validate_bootld(struct qlcnic_adapter *adapter)
598{
599 struct uni_table_desc *tab_desc;
600 struct uni_data_desc *descr;
601 const u8 *unirom = adapter->fw->data;
602 int idx = cpu_to_le32(*((int *)&unirom[adapter->file_prd_off] +
603 QLCNIC_UNI_BOOTLD_IDX_OFF));
604 __le32 offs;
605 __le32 tab_size;
606 __le32 data_size;
607
608 tab_desc = qlcnic_get_table_desc(unirom, QLCNIC_UNI_DIR_SECT_BOOTLD);
609
610 if (!tab_desc)
611 return -EINVAL;
612
613 tab_size = cpu_to_le32(tab_desc->findex) +
614 (cpu_to_le32(tab_desc->entry_size * (idx + 1)));
615
616 if (adapter->fw->size < tab_size)
617 return -EINVAL;
618
619 offs = cpu_to_le32(tab_desc->findex) +
620 (cpu_to_le32(tab_desc->entry_size) * (idx));
621 descr = (struct uni_data_desc *)&unirom[offs];
622
623 data_size = descr->findex + cpu_to_le32(descr->size);
624
625 if (adapter->fw->size < data_size)
626 return -EINVAL;
627
628 return 0;
629}
630
631static int
632qlcnic_validate_fw(struct qlcnic_adapter *adapter)
633{
634 struct uni_table_desc *tab_desc;
635 struct uni_data_desc *descr;
636 const u8 *unirom = adapter->fw->data;
637 int idx = cpu_to_le32(*((int *)&unirom[adapter->file_prd_off] +
638 QLCNIC_UNI_FIRMWARE_IDX_OFF));
639 __le32 offs;
640 __le32 tab_size;
641 __le32 data_size;
642
643 tab_desc = qlcnic_get_table_desc(unirom, QLCNIC_UNI_DIR_SECT_FW);
644
645 if (!tab_desc)
646 return -EINVAL;
647
648 tab_size = cpu_to_le32(tab_desc->findex) +
649 (cpu_to_le32(tab_desc->entry_size * (idx + 1)));
650
651 if (adapter->fw->size < tab_size)
652 return -EINVAL;
653
654 offs = cpu_to_le32(tab_desc->findex) +
655 (cpu_to_le32(tab_desc->entry_size) * (idx));
656 descr = (struct uni_data_desc *)&unirom[offs];
657 data_size = descr->findex + cpu_to_le32(descr->size);
658
659 if (adapter->fw->size < data_size)
660 return -EINVAL;
661
662 return 0;
663}
664
665static int
666qlcnic_validate_product_offs(struct qlcnic_adapter *adapter)
667{
668 struct uni_table_desc *ptab_descr;
669 const u8 *unirom = adapter->fw->data;
578 int mn_present = qlcnic_has_mn(adapter); 670 int mn_present = qlcnic_has_mn(adapter);
671 __le32 entries;
672 __le32 entry_size;
673 __le32 tab_size;
674 u32 i;
579 675
580 ptab_descr = qlcnic_get_table_desc(unirom, 676 ptab_descr = qlcnic_get_table_desc(unirom,
581 QLCNIC_UNI_DIR_SECT_PRODUCT_TBL); 677 QLCNIC_UNI_DIR_SECT_PRODUCT_TBL);
582 if (ptab_descr == NULL) 678 if (!ptab_descr)
583 return -1; 679 return -EINVAL;
584 680
585 entries = cpu_to_le32(ptab_descr->num_entries); 681 entries = cpu_to_le32(ptab_descr->num_entries);
682 entry_size = cpu_to_le32(ptab_descr->entry_size);
683 tab_size = cpu_to_le32(ptab_descr->findex) + (entries * entry_size);
684
685 if (adapter->fw->size < tab_size)
686 return -EINVAL;
687
586nomn: 688nomn:
587 for (i = 0; i < entries; i++) { 689 for (i = 0; i < entries; i++) {
588 690
@@ -609,7 +711,37 @@ nomn:
609 mn_present = 0; 711 mn_present = 0;
610 goto nomn; 712 goto nomn;
611 } 713 }
612 return -1; 714 return -EINVAL;
715}
716
717static int
718qlcnic_validate_unified_romimage(struct qlcnic_adapter *adapter)
719{
720 if (qlcnic_validate_header(adapter)) {
721 dev_err(&adapter->pdev->dev,
722 "unified image: header validation failed\n");
723 return -EINVAL;
724 }
725
726 if (qlcnic_validate_product_offs(adapter)) {
727 dev_err(&adapter->pdev->dev,
728 "unified image: product validation failed\n");
729 return -EINVAL;
730 }
731
732 if (qlcnic_validate_bootld(adapter)) {
733 dev_err(&adapter->pdev->dev,
734 "unified image: bootld validation failed\n");
735 return -EINVAL;
736 }
737
738 if (qlcnic_validate_fw(adapter)) {
739 dev_err(&adapter->pdev->dev,
740 "unified image: firmware validation failed\n");
741 return -EINVAL;
742 }
743
744 return 0;
613} 745}
614 746
615static 747static
@@ -715,7 +847,7 @@ qlcnic_get_bios_version(struct qlcnic_adapter *adapter)
715 bios_ver = cpu_to_le32(*((u32 *) (&fw->data[prd_off]) 847 bios_ver = cpu_to_le32(*((u32 *) (&fw->data[prd_off])
716 + QLCNIC_UNI_BIOS_VERSION_OFF)); 848 + QLCNIC_UNI_BIOS_VERSION_OFF));
717 849
718 return (bios_ver << 24) + ((bios_ver >> 8) & 0xff00) + (bios_ver >> 24); 850 return (bios_ver << 16) + ((bios_ver >> 8) & 0xff00) + (bios_ver >> 24);
719} 851}
720 852
721int 853int
@@ -858,7 +990,7 @@ qlcnic_validate_firmware(struct qlcnic_adapter *adapter)
858 u8 fw_type = adapter->fw_type; 990 u8 fw_type = adapter->fw_type;
859 991
860 if (fw_type == QLCNIC_UNIFIED_ROMIMAGE) { 992 if (fw_type == QLCNIC_UNIFIED_ROMIMAGE) {
861 if (qlcnic_set_product_offs(adapter)) 993 if (qlcnic_validate_unified_romimage(adapter))
862 return -EINVAL; 994 return -EINVAL;
863 995
864 min_size = QLCNIC_UNI_FW_MIN_SIZE; 996 min_size = QLCNIC_UNI_FW_MIN_SIZE;
@@ -1114,8 +1246,10 @@ qlcnic_alloc_rx_skb(struct qlcnic_adapter *adapter,
1114 struct pci_dev *pdev = adapter->pdev; 1246 struct pci_dev *pdev = adapter->pdev;
1115 1247
1116 buffer->skb = dev_alloc_skb(rds_ring->skb_size); 1248 buffer->skb = dev_alloc_skb(rds_ring->skb_size);
1117 if (!buffer->skb) 1249 if (!buffer->skb) {
1250 adapter->stats.skb_alloc_failure++;
1118 return -ENOMEM; 1251 return -ENOMEM;
1252 }
1119 1253
1120 skb = buffer->skb; 1254 skb = buffer->skb;
1121 1255
@@ -1289,7 +1423,7 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter,
1289 netif_receive_skb(skb); 1423 netif_receive_skb(skb);
1290 1424
1291 adapter->stats.lro_pkts++; 1425 adapter->stats.lro_pkts++;
1292 adapter->stats.rxbytes += length; 1426 adapter->stats.lrobytes += length;
1293 1427
1294 return buffer; 1428 return buffer;
1295} 1429}
@@ -1505,6 +1639,8 @@ qlcnic_process_rcv_diag(struct qlcnic_adapter *adapter,
1505 adapter->diag_cnt++; 1639 adapter->diag_cnt++;
1506 1640
1507 dev_kfree_skb_any(skb); 1641 dev_kfree_skb_any(skb);
1642 adapter->stats.rx_pkts++;
1643 adapter->stats.rxbytes += length;
1508 1644
1509 return buffer; 1645 return buffer;
1510} 1646}
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index 665e8e56b6a8..fc721564e69e 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -118,6 +118,7 @@ qlcnic_update_cmd_producer(struct qlcnic_adapter *adapter,
118 if (qlcnic_tx_avail(tx_ring) <= TX_STOP_THRESH) { 118 if (qlcnic_tx_avail(tx_ring) <= TX_STOP_THRESH) {
119 netif_stop_queue(adapter->netdev); 119 netif_stop_queue(adapter->netdev);
120 smp_mb(); 120 smp_mb();
121 adapter->stats.xmit_off++;
121 } 122 }
122} 123}
123 124
@@ -1385,6 +1386,7 @@ qlcnic_tso_check(struct net_device *netdev,
1385 int copied, offset, copy_len, hdr_len = 0, tso = 0, vlan_oob = 0; 1386 int copied, offset, copy_len, hdr_len = 0, tso = 0, vlan_oob = 0;
1386 struct cmd_desc_type0 *hwdesc; 1387 struct cmd_desc_type0 *hwdesc;
1387 struct vlan_ethhdr *vh; 1388 struct vlan_ethhdr *vh;
1389 struct qlcnic_adapter *adapter = netdev_priv(netdev);
1388 1390
1389 if (protocol == cpu_to_be16(ETH_P_8021Q)) { 1391 if (protocol == cpu_to_be16(ETH_P_8021Q)) {
1390 1392
@@ -1494,6 +1496,7 @@ qlcnic_tso_check(struct net_device *netdev,
1494 1496
1495 tx_ring->producer = producer; 1497 tx_ring->producer = producer;
1496 barrier(); 1498 barrier();
1499 adapter->stats.lso_frames++;
1497} 1500}
1498 1501
1499static int 1502static int
@@ -1573,6 +1576,7 @@ qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1573 1576
1574 if (unlikely(no_of_desc + 2 > qlcnic_tx_avail(tx_ring))) { 1577 if (unlikely(no_of_desc + 2 > qlcnic_tx_avail(tx_ring))) {
1575 netif_stop_queue(netdev); 1578 netif_stop_queue(netdev);
1579 adapter->stats.xmit_off++;
1576 return NETDEV_TX_BUSY; 1580 return NETDEV_TX_BUSY;
1577 } 1581 }
1578 1582
@@ -1880,6 +1884,7 @@ static int qlcnic_process_cmd_ring(struct qlcnic_adapter *adapter)
1880 if (qlcnic_tx_avail(tx_ring) > TX_STOP_THRESH) { 1884 if (qlcnic_tx_avail(tx_ring) > TX_STOP_THRESH) {
1881 netif_wake_queue(netdev); 1885 netif_wake_queue(netdev);
1882 adapter->tx_timeo_cnt = 0; 1886 adapter->tx_timeo_cnt = 0;
1887 adapter->stats.xmit_on++;
1883 } 1888 }
1884 __netif_tx_unlock(tx_ring->txq); 1889 __netif_tx_unlock(tx_ring->txq);
1885 } 1890 }
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index dfc3573c91bb..9d3ebf3e975e 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -4270,7 +4270,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
4270 4270
4271 tp->cur_tx += frags + 1; 4271 tp->cur_tx += frags + 1;
4272 4272
4273 smp_wmb(); 4273 wmb();
4274 4274
4275 RTL_W8(TxPoll, NPQ); /* set polling bit */ 4275 RTL_W8(TxPoll, NPQ); /* set polling bit */
4276 4276
@@ -4621,7 +4621,7 @@ static int rtl8169_poll(struct napi_struct *napi, int budget)
4621 * until it does. 4621 * until it does.
4622 */ 4622 */
4623 tp->intr_mask = 0xffff; 4623 tp->intr_mask = 0xffff;
4624 smp_wmb(); 4624 wmb();
4625 RTL_W16(IntrMask, tp->intr_event); 4625 RTL_W16(IntrMask, tp->intr_event);
4626 } 4626 }
4627 4627
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 43bc66aa8405..df70657260dd 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -923,8 +923,8 @@ static int init_shared_mem(struct s2io_nic *nic)
923 tmp_v_addr = mac_control->stats_mem; 923 tmp_v_addr = mac_control->stats_mem;
924 mac_control->stats_info = (struct stat_block *)tmp_v_addr; 924 mac_control->stats_info = (struct stat_block *)tmp_v_addr;
925 memset(tmp_v_addr, 0, size); 925 memset(tmp_v_addr, 0, size);
926 DBG_PRINT(INIT_DBG, "%s: Ring Mem PHY: 0x%llx\n", dev->name, 926 DBG_PRINT(INIT_DBG, "%s: Ring Mem PHY: 0x%llx\n",
927 (unsigned long long)tmp_p_addr); 927 dev_name(&nic->pdev->dev), (unsigned long long)tmp_p_addr);
928 mac_control->stats_info->sw_stat.mem_allocated += mem_allocated; 928 mac_control->stats_info->sw_stat.mem_allocated += mem_allocated;
929 return SUCCESS; 929 return SUCCESS;
930} 930}
@@ -3480,7 +3480,7 @@ static void s2io_reset(struct s2io_nic *sp)
3480 struct swStat *swstats; 3480 struct swStat *swstats;
3481 3481
3482 DBG_PRINT(INIT_DBG, "%s: Resetting XFrame card %s\n", 3482 DBG_PRINT(INIT_DBG, "%s: Resetting XFrame card %s\n",
3483 __func__, sp->dev->name); 3483 __func__, pci_name(sp->pdev));
3484 3484
3485 /* Back up the PCI-X CMD reg, dont want to lose MMRBC, OST settings */ 3485 /* Back up the PCI-X CMD reg, dont want to lose MMRBC, OST settings */
3486 pci_read_config_word(sp->pdev, PCIX_COMMAND_REGISTER, &(pci_cmd)); 3486 pci_read_config_word(sp->pdev, PCIX_COMMAND_REGISTER, &(pci_cmd));
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 653bdd76ef46..d8ec4c11fd49 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -4863,6 +4863,7 @@ static int sky2_resume(struct pci_dev *pdev)
4863 if (!hw) 4863 if (!hw)
4864 return 0; 4864 return 0;
4865 4865
4866 rtnl_lock();
4866 err = pci_set_power_state(pdev, PCI_D0); 4867 err = pci_set_power_state(pdev, PCI_D0);
4867 if (err) 4868 if (err)
4868 goto out; 4869 goto out;
@@ -4884,7 +4885,6 @@ static int sky2_resume(struct pci_dev *pdev)
4884 sky2_write32(hw, B0_IMSK, Y2_IS_BASE); 4885 sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
4885 napi_enable(&hw->napi); 4886 napi_enable(&hw->napi);
4886 4887
4887 rtnl_lock();
4888 for (i = 0; i < hw->ports; i++) { 4888 for (i = 0; i < hw->ports; i++) {
4889 err = sky2_reattach(hw->dev[i]); 4889 err = sky2_reattach(hw->dev[i]);
4890 if (err) 4890 if (err)
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index 54799544bda3..8d2772cc42f2 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -330,6 +330,48 @@ static inline void LPD7_SMC_outsw (unsigned char* a, int r,
330 330
331#include <unit/smc91111.h> 331#include <unit/smc91111.h>
332 332
333#elif defined(CONFIG_ARCH_MSM)
334
335#define SMC_CAN_USE_8BIT 0
336#define SMC_CAN_USE_16BIT 1
337#define SMC_CAN_USE_32BIT 0
338#define SMC_NOWAIT 1
339
340#define SMC_inw(a, r) readw((a) + (r))
341#define SMC_outw(v, a, r) writew(v, (a) + (r))
342#define SMC_insw(a, r, p, l) readsw((a) + (r), p, l)
343#define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l)
344
345#define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH
346
347#elif defined(CONFIG_COLDFIRE)
348
349#define SMC_CAN_USE_8BIT 0
350#define SMC_CAN_USE_16BIT 1
351#define SMC_CAN_USE_32BIT 0
352#define SMC_NOWAIT 1
353
354static inline void mcf_insw(void *a, unsigned char *p, int l)
355{
356 u16 *wp = (u16 *) p;
357 while (l-- > 0)
358 *wp++ = readw(a);
359}
360
361static inline void mcf_outsw(void *a, unsigned char *p, int l)
362{
363 u16 *wp = (u16 *) p;
364 while (l-- > 0)
365 writew(*wp++, a);
366}
367
368#define SMC_inw(a, r) _swapw(readw((a) + (r)))
369#define SMC_outw(v, a, r) writew(_swapw(v), (a) + (r))
370#define SMC_insw(a, r, p, l) mcf_insw(a + r, p, l)
371#define SMC_outsw(a, r, p, l) mcf_outsw(a + r, p, l)
372
373#define SMC_IRQ_FLAGS (IRQF_DISABLED)
374
333#else 375#else
334 376
335/* 377/*
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 0fa7688ab483..22cf1c446de3 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -5279,7 +5279,7 @@ static void tg3_poll_controller(struct net_device *dev)
5279 struct tg3 *tp = netdev_priv(dev); 5279 struct tg3 *tp = netdev_priv(dev);
5280 5280
5281 for (i = 0; i < tp->irq_cnt; i++) 5281 for (i = 0; i < tp->irq_cnt; i++)
5282 tg3_interrupt(tp->napi[i].irq_vec, dev); 5282 tg3_interrupt(tp->napi[i].irq_vec, &tp->napi[i]);
5283} 5283}
5284#endif 5284#endif
5285 5285
@@ -9776,7 +9776,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
9776 ADVERTISED_Pause | 9776 ADVERTISED_Pause |
9777 ADVERTISED_Asym_Pause; 9777 ADVERTISED_Asym_Pause;
9778 9778
9779 if (!(tp->tg3_flags2 & TG3_FLAG_10_100_ONLY)) 9779 if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY))
9780 mask |= ADVERTISED_1000baseT_Half | 9780 mask |= ADVERTISED_1000baseT_Half |
9781 ADVERTISED_1000baseT_Full; 9781 ADVERTISED_1000baseT_Full;
9782 9782
diff --git a/drivers/net/tulip/eeprom.c b/drivers/net/tulip/eeprom.c
index 93f4e8309f81..49f05d1431f5 100644
--- a/drivers/net/tulip/eeprom.c
+++ b/drivers/net/tulip/eeprom.c
@@ -143,6 +143,12 @@ static void __devinit tulip_build_fake_mediatable(struct tulip_private *tp)
143 143
144void __devinit tulip_parse_eeprom(struct net_device *dev) 144void __devinit tulip_parse_eeprom(struct net_device *dev)
145{ 145{
146 /*
147 dev is not registered at this point, so logging messages can't
148 use dev_<level> or netdev_<level> but dev->name is good via a
149 hack in the caller
150 */
151
146 /* The last media info list parsed, for multiport boards. */ 152 /* The last media info list parsed, for multiport boards. */
147 static struct mediatable *last_mediatable; 153 static struct mediatable *last_mediatable;
148 static unsigned char *last_ee_data; 154 static unsigned char *last_ee_data;
@@ -161,15 +167,14 @@ void __devinit tulip_parse_eeprom(struct net_device *dev)
161 if (ee_data[0] == 0xff) { 167 if (ee_data[0] == 0xff) {
162 if (last_mediatable) { 168 if (last_mediatable) {
163 controller_index++; 169 controller_index++;
164 dev_info(&dev->dev, 170 pr_info("%s: Controller %d of multiport board\n",
165 "Controller %d of multiport board\n", 171 dev->name, controller_index);
166 controller_index);
167 tp->mtable = last_mediatable; 172 tp->mtable = last_mediatable;
168 ee_data = last_ee_data; 173 ee_data = last_ee_data;
169 goto subsequent_board; 174 goto subsequent_board;
170 } else 175 } else
171 dev_info(&dev->dev, 176 pr_info("%s: Missing EEPROM, this interface may not work correctly!\n",
172 "Missing EEPROM, this interface may not work correctly!\n"); 177 dev->name);
173 return; 178 return;
174 } 179 }
175 /* Do a fix-up based on the vendor half of the station address prefix. */ 180 /* Do a fix-up based on the vendor half of the station address prefix. */
@@ -181,15 +186,14 @@ void __devinit tulip_parse_eeprom(struct net_device *dev)
181 i++; /* An Accton EN1207, not an outlaw Maxtech. */ 186 i++; /* An Accton EN1207, not an outlaw Maxtech. */
182 memcpy(ee_data + 26, eeprom_fixups[i].newtable, 187 memcpy(ee_data + 26, eeprom_fixups[i].newtable,
183 sizeof(eeprom_fixups[i].newtable)); 188 sizeof(eeprom_fixups[i].newtable));
184 dev_info(&dev->dev, 189 pr_info("%s: Old format EEPROM on '%s' board. Using substitute media control info\n",
185 "Old format EEPROM on '%s' board. Using substitute media control info\n", 190 dev->name, eeprom_fixups[i].name);
186 eeprom_fixups[i].name);
187 break; 191 break;
188 } 192 }
189 } 193 }
190 if (eeprom_fixups[i].name == NULL) { /* No fixup found. */ 194 if (eeprom_fixups[i].name == NULL) { /* No fixup found. */
191 dev_info(&dev->dev, 195 pr_info("%s: Old style EEPROM with no media selection information\n",
192 "Old style EEPROM with no media selection information\n"); 196 dev->name);
193 return; 197 return;
194 } 198 }
195 } 199 }
@@ -217,8 +221,8 @@ subsequent_board:
217 /* there is no phy information, don't even try to build mtable */ 221 /* there is no phy information, don't even try to build mtable */
218 if (count == 0) { 222 if (count == 0) {
219 if (tulip_debug > 0) 223 if (tulip_debug > 0)
220 dev_warn(&dev->dev, 224 pr_warning("%s: no phy info, aborting mtable build\n",
221 "no phy info, aborting mtable build\n"); 225 dev->name);
222 return; 226 return;
223 } 227 }
224 228
@@ -234,8 +238,10 @@ subsequent_board:
234 mtable->has_nonmii = mtable->has_mii = mtable->has_reset = 0; 238 mtable->has_nonmii = mtable->has_mii = mtable->has_reset = 0;
235 mtable->csr15dir = mtable->csr15val = 0; 239 mtable->csr15dir = mtable->csr15val = 0;
236 240
237 dev_info(&dev->dev, "EEPROM default media type %s\n", 241 pr_info("%s: EEPROM default media type %s\n",
238 media & 0x0800 ? "Autosense" : medianame[media & MEDIA_MASK]); 242 dev->name,
243 media & 0x0800 ? "Autosense"
244 : medianame[media & MEDIA_MASK]);
239 for (i = 0; i < count; i++) { 245 for (i = 0; i < count; i++) {
240 struct medialeaf *leaf = &mtable->mleaf[i]; 246 struct medialeaf *leaf = &mtable->mleaf[i];
241 247
@@ -298,17 +304,17 @@ subsequent_board:
298 } 304 }
299 if (tulip_debug > 1 && leaf->media == 11) { 305 if (tulip_debug > 1 && leaf->media == 11) {
300 unsigned char *bp = leaf->leafdata; 306 unsigned char *bp = leaf->leafdata;
301 dev_info(&dev->dev, 307 pr_info("%s: MII interface PHY %d, setup/reset sequences %d/%d long, capabilities %02x %02x\n",
302 "MII interface PHY %d, setup/reset sequences %d/%d long, capabilities %02x %02x\n", 308 dev->name,
303 bp[0], bp[1], bp[2 + bp[1]*2], 309 bp[0], bp[1], bp[2 + bp[1]*2],
304 bp[5 + bp[2 + bp[1]*2]*2], 310 bp[5 + bp[2 + bp[1]*2]*2],
305 bp[4 + bp[2 + bp[1]*2]*2]); 311 bp[4 + bp[2 + bp[1]*2]*2]);
306 } 312 }
307 dev_info(&dev->dev, 313 pr_info("%s: Index #%d - Media %s (#%d) described by a %s (%d) block\n",
308 "Index #%d - Media %s (#%d) described by a %s (%d) block\n", 314 dev->name,
309 i, medianame[leaf->media & 15], leaf->media, 315 i, medianame[leaf->media & 15], leaf->media,
310 leaf->type < ARRAY_SIZE(block_name) ? block_name[leaf->type] : "<unknown>", 316 leaf->type < ARRAY_SIZE(block_name) ? block_name[leaf->type] : "<unknown>",
311 leaf->type); 317 leaf->type);
312 } 318 }
313 if (new_advertise) 319 if (new_advertise)
314 tp->sym_advertise = new_advertise; 320 tp->sym_advertise = new_advertise;
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index 2fbf15235c05..cd24e5f2b2a2 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -480,7 +480,7 @@ typhoon_hello(struct typhoon *tp)
480 typhoon_inc_cmd_index(&ring->lastWrite, 1); 480 typhoon_inc_cmd_index(&ring->lastWrite, 1);
481 481
482 INIT_COMMAND_NO_RESPONSE(cmd, TYPHOON_CMD_HELLO_RESP); 482 INIT_COMMAND_NO_RESPONSE(cmd, TYPHOON_CMD_HELLO_RESP);
483 smp_wmb(); 483 wmb();
484 iowrite32(ring->lastWrite, tp->ioaddr + TYPHOON_REG_CMD_READY); 484 iowrite32(ring->lastWrite, tp->ioaddr + TYPHOON_REG_CMD_READY);
485 spin_unlock(&tp->command_lock); 485 spin_unlock(&tp->command_lock);
486 } 486 }
@@ -1311,13 +1311,15 @@ typhoon_init_interface(struct typhoon *tp)
1311 1311
1312 tp->txlo_dma_addr = le32_to_cpu(iface->txLoAddr); 1312 tp->txlo_dma_addr = le32_to_cpu(iface->txLoAddr);
1313 tp->card_state = Sleeping; 1313 tp->card_state = Sleeping;
1314 smp_wmb();
1315 1314
1316 tp->offload = TYPHOON_OFFLOAD_IP_CHKSUM | TYPHOON_OFFLOAD_TCP_CHKSUM; 1315 tp->offload = TYPHOON_OFFLOAD_IP_CHKSUM | TYPHOON_OFFLOAD_TCP_CHKSUM;
1317 tp->offload |= TYPHOON_OFFLOAD_UDP_CHKSUM | TSO_OFFLOAD_ON; 1316 tp->offload |= TYPHOON_OFFLOAD_UDP_CHKSUM | TSO_OFFLOAD_ON;
1318 1317
1319 spin_lock_init(&tp->command_lock); 1318 spin_lock_init(&tp->command_lock);
1320 spin_lock_init(&tp->state_lock); 1319 spin_lock_init(&tp->state_lock);
1320
1321 /* Force the writes to the shared memory area out before continuing. */
1322 wmb();
1321} 1323}
1322 1324
1323static void 1325static void
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index 20e34608fa4a..9e05639435f2 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -54,6 +54,7 @@ static const char driver_name [] = "asix";
54#define AX_CMD_WRITE_IPG0 0x12 54#define AX_CMD_WRITE_IPG0 0x12
55#define AX_CMD_WRITE_IPG1 0x13 55#define AX_CMD_WRITE_IPG1 0x13
56#define AX_CMD_READ_NODE_ID 0x13 56#define AX_CMD_READ_NODE_ID 0x13
57#define AX_CMD_WRITE_NODE_ID 0x14
57#define AX_CMD_WRITE_IPG2 0x14 58#define AX_CMD_WRITE_IPG2 0x14
58#define AX_CMD_WRITE_MULTI_FILTER 0x16 59#define AX_CMD_WRITE_MULTI_FILTER 0x16
59#define AX88172_CMD_READ_NODE_ID 0x17 60#define AX88172_CMD_READ_NODE_ID 0x17
@@ -165,6 +166,7 @@ static const char driver_name [] = "asix";
165/* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */ 166/* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */
166struct asix_data { 167struct asix_data {
167 u8 multi_filter[AX_MCAST_FILTER_SIZE]; 168 u8 multi_filter[AX_MCAST_FILTER_SIZE];
169 u8 mac_addr[ETH_ALEN];
168 u8 phymode; 170 u8 phymode;
169 u8 ledmode; 171 u8 ledmode;
170 u8 eeprom_len; 172 u8 eeprom_len;
@@ -732,6 +734,30 @@ static int asix_ioctl (struct net_device *net, struct ifreq *rq, int cmd)
732 return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); 734 return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL);
733} 735}
734 736
737static int asix_set_mac_address(struct net_device *net, void *p)
738{
739 struct usbnet *dev = netdev_priv(net);
740 struct asix_data *data = (struct asix_data *)&dev->data;
741 struct sockaddr *addr = p;
742
743 if (netif_running(net))
744 return -EBUSY;
745 if (!is_valid_ether_addr(addr->sa_data))
746 return -EADDRNOTAVAIL;
747
748 memcpy(net->dev_addr, addr->sa_data, ETH_ALEN);
749
750 /* We use the 20 byte dev->data
751 * for our 6 byte mac buffer
752 * to avoid allocating memory that
753 * is tricky to free later */
754 memcpy(data->mac_addr, addr->sa_data, ETH_ALEN);
755 asix_write_cmd_async(dev, AX_CMD_WRITE_NODE_ID, 0, 0, ETH_ALEN,
756 data->mac_addr);
757
758 return 0;
759}
760
735/* We need to override some ethtool_ops so we require our 761/* We need to override some ethtool_ops so we require our
736 own structure so we don't interfere with other usbnet 762 own structure so we don't interfere with other usbnet
737 devices that may be connected at the same time. */ 763 devices that may be connected at the same time. */
@@ -919,7 +945,7 @@ static const struct net_device_ops ax88772_netdev_ops = {
919 .ndo_start_xmit = usbnet_start_xmit, 945 .ndo_start_xmit = usbnet_start_xmit,
920 .ndo_tx_timeout = usbnet_tx_timeout, 946 .ndo_tx_timeout = usbnet_tx_timeout,
921 .ndo_change_mtu = usbnet_change_mtu, 947 .ndo_change_mtu = usbnet_change_mtu,
922 .ndo_set_mac_address = eth_mac_addr, 948 .ndo_set_mac_address = asix_set_mac_address,
923 .ndo_validate_addr = eth_validate_addr, 949 .ndo_validate_addr = eth_validate_addr,
924 .ndo_do_ioctl = asix_ioctl, 950 .ndo_do_ioctl = asix_ioctl,
925 .ndo_set_multicast_list = asix_set_multicast, 951 .ndo_set_multicast_list = asix_set_multicast,
@@ -1213,7 +1239,7 @@ static const struct net_device_ops ax88178_netdev_ops = {
1213 .ndo_stop = usbnet_stop, 1239 .ndo_stop = usbnet_stop,
1214 .ndo_start_xmit = usbnet_start_xmit, 1240 .ndo_start_xmit = usbnet_start_xmit,
1215 .ndo_tx_timeout = usbnet_tx_timeout, 1241 .ndo_tx_timeout = usbnet_tx_timeout,
1216 .ndo_set_mac_address = eth_mac_addr, 1242 .ndo_set_mac_address = asix_set_mac_address,
1217 .ndo_validate_addr = eth_validate_addr, 1243 .ndo_validate_addr = eth_validate_addr,
1218 .ndo_set_multicast_list = asix_set_multicast, 1244 .ndo_set_multicast_list = asix_set_multicast,
1219 .ndo_do_ioctl = asix_ioctl, 1245 .ndo_do_ioctl = asix_ioctl,
diff --git a/drivers/net/usb/pegasus.h b/drivers/net/usb/pegasus.h
index 5d02f0200737..b90d8766ab74 100644
--- a/drivers/net/usb/pegasus.h
+++ b/drivers/net/usb/pegasus.h
@@ -177,7 +177,7 @@ PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x400c,
177PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0xabc1, 177PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0xabc1,
178 DEFAULT_GPIO_RESET ) 178 DEFAULT_GPIO_RESET )
179PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x200c, 179PEGASUS_DEV( "USB 10/100 Fast Ethernet", VENDOR_ABOCOM, 0x200c,
180 DEFAULT_GPIO_RESET | PEGASUS_II ) 180 DEFAULT_GPIO_RESET | PEGASUS_II )
181PEGASUS_DEV( "Accton USB 10/100 Ethernet Adapter", VENDOR_ACCTON, 0x1046, 181PEGASUS_DEV( "Accton USB 10/100 Ethernet Adapter", VENDOR_ACCTON, 0x1046,
182 DEFAULT_GPIO_RESET ) 182 DEFAULT_GPIO_RESET )
183PEGASUS_DEV( "SpeedStream USB 10/100 Ethernet", VENDOR_ACCTON, 0x5046, 183PEGASUS_DEV( "SpeedStream USB 10/100 Ethernet", VENDOR_ACCTON, 0x5046,
@@ -208,6 +208,8 @@ PEGASUS_DEV( "Allied Telesyn Int. AT-USB100", VENDOR_ALLIEDTEL, 0xb100,
208 */ 208 */
209PEGASUS_DEV_CLASS( "Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121, 0x00, 209PEGASUS_DEV_CLASS( "Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121, 0x00,
210 DEFAULT_GPIO_RESET | PEGASUS_II ) 210 DEFAULT_GPIO_RESET | PEGASUS_II )
211PEGASUS_DEV( "Belkin F5U122 10/100 USB Ethernet", VENDOR_BELKIN, 0x0122,
212 DEFAULT_GPIO_RESET | PEGASUS_II )
211PEGASUS_DEV( "Billionton USB-100", VENDOR_BILLIONTON, 0x0986, 213PEGASUS_DEV( "Billionton USB-100", VENDOR_BILLIONTON, 0x0986,
212 DEFAULT_GPIO_RESET ) 214 DEFAULT_GPIO_RESET )
213PEGASUS_DEV( "Billionton USBLP-100", VENDOR_BILLIONTON, 0x0987, 215PEGASUS_DEV( "Billionton USBLP-100", VENDOR_BILLIONTON, 0x0987,
@@ -249,7 +251,7 @@ PEGASUS_DEV( "GIGABYTE GN-BR402W Wireless Router", VENDOR_GIGABYTE, 0x8002,
249PEGASUS_DEV( "Hawking UF100 10/100 Ethernet", VENDOR_HAWKING, 0x400c, 251PEGASUS_DEV( "Hawking UF100 10/100 Ethernet", VENDOR_HAWKING, 0x400c,
250 DEFAULT_GPIO_RESET | PEGASUS_II ) 252 DEFAULT_GPIO_RESET | PEGASUS_II )
251PEGASUS_DEV( "HP hn210c Ethernet USB", VENDOR_HP, 0x811c, 253PEGASUS_DEV( "HP hn210c Ethernet USB", VENDOR_HP, 0x811c,
252 DEFAULT_GPIO_RESET | PEGASUS_II ) 254 DEFAULT_GPIO_RESET | PEGASUS_II )
253PEGASUS_DEV( "IO DATA USB ET/TX", VENDOR_IODATA, 0x0904, 255PEGASUS_DEV( "IO DATA USB ET/TX", VENDOR_IODATA, 0x0904,
254 DEFAULT_GPIO_RESET ) 256 DEFAULT_GPIO_RESET )
255PEGASUS_DEV( "IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913, 257PEGASUS_DEV( "IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913,
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 698d5672a070..dc5018a6d9ed 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -5255,7 +5255,8 @@ static int set_wep_key(struct airo_info *ai, u16 index, const char *key,
5255 WepKeyRid wkr; 5255 WepKeyRid wkr;
5256 int rc; 5256 int rc;
5257 5257
5258 WARN_ON(keylen == 0); 5258 if (WARN_ON(keylen == 0))
5259 return -1;
5259 5260
5260 memset(&wkr, 0, sizeof(wkr)); 5261 memset(&wkr, 0, sizeof(wkr));
5261 wkr.len = cpu_to_le16(sizeof(wkr)); 5262 wkr.len = cpu_to_le16(sizeof(wkr));
diff --git a/drivers/net/wireless/ath/ar9170/ar9170.h b/drivers/net/wireless/ath/ar9170/ar9170.h
index 8c8ce67971e9..dc662b76a1c8 100644
--- a/drivers/net/wireless/ath/ar9170/ar9170.h
+++ b/drivers/net/wireless/ath/ar9170/ar9170.h
@@ -166,6 +166,7 @@ struct ar9170 {
166 struct ath_common common; 166 struct ath_common common;
167 struct mutex mutex; 167 struct mutex mutex;
168 enum ar9170_device_state state; 168 enum ar9170_device_state state;
169 bool registered;
169 unsigned long bad_hw_nagger; 170 unsigned long bad_hw_nagger;
170 171
171 int (*open)(struct ar9170 *); 172 int (*open)(struct ar9170 *);
diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c
index 08dc42da0f63..257c734733d1 100644
--- a/drivers/net/wireless/ath/ar9170/main.c
+++ b/drivers/net/wireless/ath/ar9170/main.c
@@ -2701,7 +2701,8 @@ int ar9170_register(struct ar9170 *ar, struct device *pdev)
2701 dev_info(pdev, "Atheros AR9170 is registered as '%s'\n", 2701 dev_info(pdev, "Atheros AR9170 is registered as '%s'\n",
2702 wiphy_name(ar->hw->wiphy)); 2702 wiphy_name(ar->hw->wiphy));
2703 2703
2704 return err; 2704 ar->registered = true;
2705 return 0;
2705 2706
2706err_unreg: 2707err_unreg:
2707 ieee80211_unregister_hw(ar->hw); 2708 ieee80211_unregister_hw(ar->hw);
@@ -2712,11 +2713,14 @@ err_out:
2712 2713
2713void ar9170_unregister(struct ar9170 *ar) 2714void ar9170_unregister(struct ar9170 *ar)
2714{ 2715{
2716 if (ar->registered) {
2715#ifdef CONFIG_AR9170_LEDS 2717#ifdef CONFIG_AR9170_LEDS
2716 ar9170_unregister_leds(ar); 2718 ar9170_unregister_leds(ar);
2717#endif /* CONFIG_AR9170_LEDS */ 2719#endif /* CONFIG_AR9170_LEDS */
2718 2720
2719 kfree_skb(ar->rx_failover);
2720 ieee80211_unregister_hw(ar->hw); 2721 ieee80211_unregister_hw(ar->hw);
2722 }
2723
2724 kfree_skb(ar->rx_failover);
2721 mutex_destroy(&ar->mutex); 2725 mutex_destroy(&ar->mutex);
2722} 2726}
diff --git a/drivers/net/wireless/ath/ar9170/usb.c b/drivers/net/wireless/ath/ar9170/usb.c
index 0f361186b78f..4e30197afff6 100644
--- a/drivers/net/wireless/ath/ar9170/usb.c
+++ b/drivers/net/wireless/ath/ar9170/usb.c
@@ -582,43 +582,6 @@ static int ar9170_usb_upload(struct ar9170_usb *aru, const void *data,
582 return 0; 582 return 0;
583} 583}
584 584
585static int ar9170_usb_request_firmware(struct ar9170_usb *aru)
586{
587 int err = 0;
588
589 err = request_firmware(&aru->firmware, "ar9170.fw",
590 &aru->udev->dev);
591 if (!err) {
592 aru->init_values = NULL;
593 return 0;
594 }
595
596 if (aru->req_one_stage_fw) {
597 dev_err(&aru->udev->dev, "ar9170.fw firmware file "
598 "not found and is required for this device\n");
599 return -EINVAL;
600 }
601
602 dev_err(&aru->udev->dev, "ar9170.fw firmware file "
603 "not found, trying old firmware...\n");
604
605 err = request_firmware(&aru->init_values, "ar9170-1.fw",
606 &aru->udev->dev);
607 if (err) {
608 dev_err(&aru->udev->dev, "file with init values not found.\n");
609 return err;
610 }
611
612 err = request_firmware(&aru->firmware, "ar9170-2.fw", &aru->udev->dev);
613 if (err) {
614 release_firmware(aru->init_values);
615 dev_err(&aru->udev->dev, "firmware file not found.\n");
616 return err;
617 }
618
619 return err;
620}
621
622static int ar9170_usb_reset(struct ar9170_usb *aru) 585static int ar9170_usb_reset(struct ar9170_usb *aru)
623{ 586{
624 int ret, lock = (aru->intf->condition != USB_INTERFACE_BINDING); 587 int ret, lock = (aru->intf->condition != USB_INTERFACE_BINDING);
@@ -757,6 +720,103 @@ err_out:
757 return err; 720 return err;
758} 721}
759 722
723static void ar9170_usb_firmware_failed(struct ar9170_usb *aru)
724{
725 struct device *parent = aru->udev->dev.parent;
726
727 /* unbind anything failed */
728 if (parent)
729 down(&parent->sem);
730 device_release_driver(&aru->udev->dev);
731 if (parent)
732 up(&parent->sem);
733}
734
735static void ar9170_usb_firmware_finish(const struct firmware *fw, void *context)
736{
737 struct ar9170_usb *aru = context;
738 int err;
739
740 aru->firmware = fw;
741
742 if (!fw) {
743 dev_err(&aru->udev->dev, "firmware file not found.\n");
744 goto err_freefw;
745 }
746
747 err = ar9170_usb_init_device(aru);
748 if (err)
749 goto err_freefw;
750
751 err = ar9170_usb_open(&aru->common);
752 if (err)
753 goto err_unrx;
754
755 err = ar9170_register(&aru->common, &aru->udev->dev);
756
757 ar9170_usb_stop(&aru->common);
758 if (err)
759 goto err_unrx;
760
761 return;
762
763 err_unrx:
764 ar9170_usb_cancel_urbs(aru);
765
766 err_freefw:
767 ar9170_usb_firmware_failed(aru);
768}
769
770static void ar9170_usb_firmware_inits(const struct firmware *fw,
771 void *context)
772{
773 struct ar9170_usb *aru = context;
774 int err;
775
776 if (!fw) {
777 dev_err(&aru->udev->dev, "file with init values not found.\n");
778 ar9170_usb_firmware_failed(aru);
779 return;
780 }
781
782 aru->init_values = fw;
783
784 /* ok so we have the init values -- get code for two-stage */
785
786 err = request_firmware_nowait(THIS_MODULE, 1, "ar9170-2.fw",
787 &aru->udev->dev, GFP_KERNEL, aru,
788 ar9170_usb_firmware_finish);
789 if (err)
790 ar9170_usb_firmware_failed(aru);
791}
792
793static void ar9170_usb_firmware_step2(const struct firmware *fw, void *context)
794{
795 struct ar9170_usb *aru = context;
796 int err;
797
798 if (fw) {
799 ar9170_usb_firmware_finish(fw, context);
800 return;
801 }
802
803 if (aru->req_one_stage_fw) {
804 dev_err(&aru->udev->dev, "ar9170.fw firmware file "
805 "not found and is required for this device\n");
806 ar9170_usb_firmware_failed(aru);
807 return;
808 }
809
810 dev_err(&aru->udev->dev, "ar9170.fw firmware file "
811 "not found, trying old firmware...\n");
812
813 err = request_firmware_nowait(THIS_MODULE, 1, "ar9170-1.fw",
814 &aru->udev->dev, GFP_KERNEL, aru,
815 ar9170_usb_firmware_inits);
816 if (err)
817 ar9170_usb_firmware_failed(aru);
818}
819
760static bool ar9170_requires_one_stage(const struct usb_device_id *id) 820static bool ar9170_requires_one_stage(const struct usb_device_id *id)
761{ 821{
762 if (!id->driver_info) 822 if (!id->driver_info)
@@ -814,33 +874,9 @@ static int ar9170_usb_probe(struct usb_interface *intf,
814 if (err) 874 if (err)
815 goto err_freehw; 875 goto err_freehw;
816 876
817 err = ar9170_usb_request_firmware(aru); 877 return request_firmware_nowait(THIS_MODULE, 1, "ar9170.fw",
818 if (err) 878 &aru->udev->dev, GFP_KERNEL, aru,
819 goto err_freehw; 879 ar9170_usb_firmware_step2);
820
821 err = ar9170_usb_init_device(aru);
822 if (err)
823 goto err_freefw;
824
825 err = ar9170_usb_open(ar);
826 if (err)
827 goto err_unrx;
828
829 err = ar9170_register(ar, &udev->dev);
830
831 ar9170_usb_stop(ar);
832 if (err)
833 goto err_unrx;
834
835 return 0;
836
837err_unrx:
838 ar9170_usb_cancel_urbs(aru);
839
840err_freefw:
841 release_firmware(aru->init_values);
842 release_firmware(aru->firmware);
843
844err_freehw: 880err_freehw:
845 usb_set_intfdata(intf, NULL); 881 usb_set_intfdata(intf, NULL);
846 usb_put_dev(udev); 882 usb_put_dev(udev);
@@ -860,12 +896,12 @@ static void ar9170_usb_disconnect(struct usb_interface *intf)
860 ar9170_unregister(&aru->common); 896 ar9170_unregister(&aru->common);
861 ar9170_usb_cancel_urbs(aru); 897 ar9170_usb_cancel_urbs(aru);
862 898
863 release_firmware(aru->init_values);
864 release_firmware(aru->firmware);
865
866 usb_put_dev(aru->udev); 899 usb_put_dev(aru->udev);
867 usb_set_intfdata(intf, NULL); 900 usb_set_intfdata(intf, NULL);
868 ieee80211_free_hw(aru->common.hw); 901 ieee80211_free_hw(aru->common.hw);
902
903 release_firmware(aru->init_values);
904 release_firmware(aru->firmware);
869} 905}
870 906
871#ifdef CONFIG_PM 907#ifdef CONFIG_PM
diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c
index 6a3f4da7fb48..10b52262b232 100644
--- a/drivers/net/wireless/ath/ath5k/eeprom.c
+++ b/drivers/net/wireless/ath/ath5k/eeprom.c
@@ -429,8 +429,8 @@ static int ath5k_eeprom_read_modes(struct ath5k_hw *ah, u32 *offset,
429 ee->ee_margin_tx_rx[mode] = (val >> 8) & 0x3f; 429 ee->ee_margin_tx_rx[mode] = (val >> 8) & 0x3f;
430 430
431 AR5K_EEPROM_READ(o++, val); 431 AR5K_EEPROM_READ(o++, val);
432 ee->ee_i_cal[mode] = (val >> 8) & 0x3f; 432 ee->ee_i_cal[mode] = (val >> 5) & 0x3f;
433 ee->ee_q_cal[mode] = (val >> 3) & 0x1f; 433 ee->ee_q_cal[mode] = val & 0x1f;
434 434
435 if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_2) { 435 if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_2) {
436 AR5K_EEPROM_READ(o++, val); 436 AR5K_EEPROM_READ(o++, val);
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 72474c0ccaff..eff3323efb4b 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -1386,38 +1386,39 @@ static int ath5k_hw_rf511x_calibrate(struct ath5k_hw *ah,
1386 goto done; 1386 goto done;
1387 1387
1388 /* Calibration has finished, get the results and re-run */ 1388 /* Calibration has finished, get the results and re-run */
1389
1390 /* work around empty results which can apparently happen on 5212 */
1389 for (i = 0; i <= 10; i++) { 1391 for (i = 0; i <= 10; i++) {
1390 iq_corr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_CORR); 1392 iq_corr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_CORR);
1391 i_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_I); 1393 i_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_I);
1392 q_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_Q); 1394 q_pwr = ath5k_hw_reg_read(ah, AR5K_PHY_IQRES_CAL_PWR_Q);
1395 ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_CALIBRATE,
1396 "iq_corr:%x i_pwr:%x q_pwr:%x", iq_corr, i_pwr, q_pwr);
1397 if (i_pwr && q_pwr)
1398 break;
1393 } 1399 }
1394 1400
1395 i_coffd = ((i_pwr >> 1) + (q_pwr >> 1)) >> 7; 1401 i_coffd = ((i_pwr >> 1) + (q_pwr >> 1)) >> 7;
1396 q_coffd = q_pwr >> 7; 1402 q_coffd = q_pwr >> 7;
1397 1403
1398 /* No correction */ 1404 /* protect against divide by 0 and loss of sign bits */
1399 if (i_coffd == 0 || q_coffd == 0) 1405 if (i_coffd == 0 || q_coffd < 2)
1400 goto done; 1406 goto done;
1401 1407
1402 i_coff = ((-iq_corr) / i_coffd); 1408 i_coff = (-iq_corr) / i_coffd;
1403 1409 i_coff = clamp(i_coff, -32, 31); /* signed 6 bit */
1404 /* Boundary check */
1405 if (i_coff > 31)
1406 i_coff = 31;
1407 if (i_coff < -32)
1408 i_coff = -32;
1409 1410
1410 q_coff = (((s32)i_pwr / q_coffd) - 128); 1411 q_coff = (i_pwr / q_coffd) - 128;
1412 q_coff = clamp(q_coff, -16, 15); /* signed 5 bit */
1411 1413
1412 /* Boundary check */ 1414 ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_CALIBRATE,
1413 if (q_coff > 15) 1415 "new I:%d Q:%d (i_coffd:%x q_coffd:%x)",
1414 q_coff = 15; 1416 i_coff, q_coff, i_coffd, q_coffd);
1415 if (q_coff < -16)
1416 q_coff = -16;
1417 1417
1418 /* Commit new I/Q value */ 1418 /* Commit new I/Q values (set enable bit last to match HAL sources) */
1419 AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_ENABLE | 1419 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_Q_I_COFF, i_coff);
1420 ((u32)q_coff) | ((u32)i_coff << AR5K_PHY_IQ_CORR_Q_I_COFF_S)); 1420 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_Q_Q_COFF, q_coff);
1421 AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_ENABLE);
1421 1422
1422 /* Re-enable calibration -if we don't we'll commit 1423 /* Re-enable calibration -if we don't we'll commit
1423 * the same values again and again */ 1424 * the same values again and again */
@@ -1873,7 +1874,7 @@ ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode)
1873 break; 1874 break;
1874 case AR5K_ANTMODE_FIXED_A: 1875 case AR5K_ANTMODE_FIXED_A:
1875 def_ant = 1; 1876 def_ant = 1;
1876 tx_ant = 0; 1877 tx_ant = 1;
1877 use_def_for_tx = true; 1878 use_def_for_tx = true;
1878 update_def_on_tx = false; 1879 update_def_on_tx = false;
1879 use_def_for_rts = true; 1880 use_def_for_rts = true;
@@ -1882,7 +1883,7 @@ ath5k_hw_set_antenna_mode(struct ath5k_hw *ah, u8 ant_mode)
1882 break; 1883 break;
1883 case AR5K_ANTMODE_FIXED_B: 1884 case AR5K_ANTMODE_FIXED_B:
1884 def_ant = 2; 1885 def_ant = 2;
1885 tx_ant = 0; 1886 tx_ant = 2;
1886 use_def_for_tx = true; 1887 use_def_for_tx = true;
1887 update_def_on_tx = false; 1888 update_def_on_tx = false;
1888 use_def_for_rts = true; 1889 use_def_for_rts = true;
diff --git a/drivers/net/wireless/ath/ath5k/reg.h b/drivers/net/wireless/ath/ath5k/reg.h
index 4cb9c5df9f46..1464f89b249c 100644
--- a/drivers/net/wireless/ath/ath5k/reg.h
+++ b/drivers/net/wireless/ath/ath5k/reg.h
@@ -2187,6 +2187,7 @@
2187 */ 2187 */
2188#define AR5K_PHY_IQ 0x9920 /* Register Address */ 2188#define AR5K_PHY_IQ 0x9920 /* Register Address */
2189#define AR5K_PHY_IQ_CORR_Q_Q_COFF 0x0000001f /* Mask for q correction info */ 2189#define AR5K_PHY_IQ_CORR_Q_Q_COFF 0x0000001f /* Mask for q correction info */
2190#define AR5K_PHY_IQ_CORR_Q_Q_COFF_S 0
2190#define AR5K_PHY_IQ_CORR_Q_I_COFF 0x000007e0 /* Mask for i correction info */ 2191#define AR5K_PHY_IQ_CORR_Q_I_COFF 0x000007e0 /* Mask for i correction info */
2191#define AR5K_PHY_IQ_CORR_Q_I_COFF_S 5 2192#define AR5K_PHY_IQ_CORR_Q_I_COFF_S 5
2192#define AR5K_PHY_IQ_CORR_ENABLE 0x00000800 /* Enable i/q correction */ 2193#define AR5K_PHY_IQ_CORR_ENABLE 0x00000800 /* Enable i/q correction */
diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c
index a35a7db0fc4c..cbf28e379843 100644
--- a/drivers/net/wireless/ath/ath5k/reset.c
+++ b/drivers/net/wireless/ath/ath5k/reset.c
@@ -851,12 +851,15 @@ static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
851 AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1, 851 AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1,
852 AR5K_INIT_CYCRSSI_THR1); 852 AR5K_INIT_CYCRSSI_THR1);
853 853
854 /* I/Q correction 854 /* I/Q correction (set enable bit last to match HAL sources) */
855 * TODO: Per channel i/q infos ? */ 855 /* TODO: Per channel i/q infos ? */
856 AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, 856 if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_0) {
857 AR5K_PHY_IQ_CORR_ENABLE | 857 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_Q_I_COFF,
858 (ee->ee_i_cal[ee_mode] << AR5K_PHY_IQ_CORR_Q_I_COFF_S) | 858 ee->ee_i_cal[ee_mode]);
859 ee->ee_q_cal[ee_mode]); 859 AR5K_REG_WRITE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_Q_Q_COFF,
860 ee->ee_q_cal[ee_mode]);
861 AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ, AR5K_PHY_IQ_CORR_ENABLE);
862 }
860 863
861 /* Heavy clipping -disable for now */ 864 /* Heavy clipping -disable for now */
862 if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_5_1) 865 if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_5_1)
@@ -1379,11 +1382,10 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
1379 ath5k_hw_set_sleep_clock(ah, true); 1382 ath5k_hw_set_sleep_clock(ah, true);
1380 1383
1381 /* 1384 /*
1382 * Disable beacons and reset the register 1385 * Disable beacons and reset the TSF
1383 */ 1386 */
1384 AR5K_REG_DISABLE_BITS(ah, AR5K_BEACON, AR5K_BEACON_ENABLE | 1387 AR5K_REG_DISABLE_BITS(ah, AR5K_BEACON, AR5K_BEACON_ENABLE);
1385 AR5K_BEACON_RESET_TSF); 1388 ath5k_hw_reset_tsf(ah);
1386
1387 return 0; 1389 return 0;
1388} 1390}
1389 1391
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index ac34a055c713..0e79e58cf4c9 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -1323,7 +1323,7 @@ static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband,
1323 1323
1324static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband, 1324static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,
1325 struct ieee80211_sta *sta, void *priv_sta, 1325 struct ieee80211_sta *sta, void *priv_sta,
1326 u32 changed) 1326 u32 changed, enum nl80211_channel_type oper_chan_type)
1327{ 1327{
1328 struct ath_softc *sc = priv; 1328 struct ath_softc *sc = priv;
1329 struct ath_rate_priv *ath_rc_priv = priv_sta; 1329 struct ath_rate_priv *ath_rc_priv = priv_sta;
@@ -1340,8 +1340,8 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,
1340 if (sc->sc_ah->opmode != NL80211_IFTYPE_STATION) 1340 if (sc->sc_ah->opmode != NL80211_IFTYPE_STATION)
1341 return; 1341 return;
1342 1342
1343 if (sc->hw->conf.channel_type == NL80211_CHAN_HT40MINUS || 1343 if (oper_chan_type == NL80211_CHAN_HT40MINUS ||
1344 sc->hw->conf.channel_type == NL80211_CHAN_HT40PLUS) 1344 oper_chan_type == NL80211_CHAN_HT40PLUS)
1345 oper_cw40 = true; 1345 oper_cw40 = true;
1346 1346
1347 oper_sgi40 = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? 1347 oper_sgi40 = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ?
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 47294f90bbe5..b2c8207f7bc1 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -2258,7 +2258,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
2258 if (ATH_TXQ_SETUP(sc, i)) { 2258 if (ATH_TXQ_SETUP(sc, i)) {
2259 txq = &sc->tx.txq[i]; 2259 txq = &sc->tx.txq[i];
2260 2260
2261 spin_lock(&txq->axq_lock); 2261 spin_lock_bh(&txq->axq_lock);
2262 2262
2263 list_for_each_entry_safe(ac, 2263 list_for_each_entry_safe(ac,
2264 ac_tmp, &txq->axq_acq, list) { 2264 ac_tmp, &txq->axq_acq, list) {
@@ -2279,7 +2279,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
2279 } 2279 }
2280 } 2280 }
2281 2281
2282 spin_unlock(&txq->axq_lock); 2282 spin_unlock_bh(&txq->axq_lock);
2283 } 2283 }
2284 } 2284 }
2285} 2285}
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 63c2a7ade5fb..5c7aa1b1eb56 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -3177,14 +3177,27 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len)
3177 int total_nr = 0; 3177 int total_nr = 0;
3178 int i; 3178 int i;
3179 struct pci_pool *pool; 3179 struct pci_pool *pool;
3180 u32 *virts[CB_NUMBER_OF_ELEMENTS_SMALL]; 3180 void **virts;
3181 dma_addr_t phys[CB_NUMBER_OF_ELEMENTS_SMALL]; 3181 dma_addr_t *phys;
3182 3182
3183 IPW_DEBUG_TRACE("<< : \n"); 3183 IPW_DEBUG_TRACE("<< : \n");
3184 3184
3185 virts = kmalloc(sizeof(void *) * CB_NUMBER_OF_ELEMENTS_SMALL,
3186 GFP_KERNEL);
3187 if (!virts)
3188 return -ENOMEM;
3189
3190 phys = kmalloc(sizeof(dma_addr_t) * CB_NUMBER_OF_ELEMENTS_SMALL,
3191 GFP_KERNEL);
3192 if (!phys) {
3193 kfree(virts);
3194 return -ENOMEM;
3195 }
3185 pool = pci_pool_create("ipw2200", priv->pci_dev, CB_MAX_LENGTH, 0, 0); 3196 pool = pci_pool_create("ipw2200", priv->pci_dev, CB_MAX_LENGTH, 0, 0);
3186 if (!pool) { 3197 if (!pool) {
3187 IPW_ERROR("pci_pool_create failed\n"); 3198 IPW_ERROR("pci_pool_create failed\n");
3199 kfree(phys);
3200 kfree(virts);
3188 return -ENOMEM; 3201 return -ENOMEM;
3189 } 3202 }
3190 3203
@@ -3254,6 +3267,8 @@ static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len)
3254 pci_pool_free(pool, virts[i], phys[i]); 3267 pci_pool_free(pool, virts[i], phys[i]);
3255 3268
3256 pci_pool_destroy(pool); 3269 pci_pool_destroy(pool);
3270 kfree(phys);
3271 kfree(virts);
3257 3272
3258 return ret; 3273 return ret;
3259} 3274}
diff --git a/drivers/net/wireless/ipw2x00/libipw.h b/drivers/net/wireless/ipw2x00/libipw.h
index bf45391172f3..a6d5e42647e4 100644
--- a/drivers/net/wireless/ipw2x00/libipw.h
+++ b/drivers/net/wireless/ipw2x00/libipw.h
@@ -797,7 +797,7 @@ struct libipw_device {
797 /* Probe / Beacon management */ 797 /* Probe / Beacon management */
798 struct list_head network_free_list; 798 struct list_head network_free_list;
799 struct list_head network_list; 799 struct list_head network_list;
800 struct libipw_network *networks; 800 struct libipw_network *networks[MAX_NETWORK_COUNT];
801 int scans; 801 int scans;
802 int scan_age; 802 int scan_age;
803 803
diff --git a/drivers/net/wireless/ipw2x00/libipw_module.c b/drivers/net/wireless/ipw2x00/libipw_module.c
index 1ae0b2b02c38..2fa55867bd8b 100644
--- a/drivers/net/wireless/ipw2x00/libipw_module.c
+++ b/drivers/net/wireless/ipw2x00/libipw_module.c
@@ -67,16 +67,17 @@ void *libipw_wiphy_privid = &libipw_wiphy_privid;
67 67
68static int libipw_networks_allocate(struct libipw_device *ieee) 68static int libipw_networks_allocate(struct libipw_device *ieee)
69{ 69{
70 if (ieee->networks) 70 int i, j;
71 return 0; 71
72 72 for (i = 0; i < MAX_NETWORK_COUNT; i++) {
73 ieee->networks = 73 ieee->networks[i] = kzalloc(sizeof(struct libipw_network),
74 kzalloc(MAX_NETWORK_COUNT * sizeof(struct libipw_network), 74 GFP_KERNEL);
75 GFP_KERNEL); 75 if (!ieee->networks[i]) {
76 if (!ieee->networks) { 76 LIBIPW_ERROR("Out of memory allocating beacons\n");
77 printk(KERN_WARNING "%s: Out of memory allocating beacons\n", 77 for (j = 0; j < i; j++)
78 ieee->dev->name); 78 kfree(ieee->networks[j]);
79 return -ENOMEM; 79 return -ENOMEM;
80 }
80 } 81 }
81 82
82 return 0; 83 return 0;
@@ -97,15 +98,11 @@ static inline void libipw_networks_free(struct libipw_device *ieee)
97{ 98{
98 int i; 99 int i;
99 100
100 if (!ieee->networks) 101 for (i = 0; i < MAX_NETWORK_COUNT; i++) {
101 return; 102 if (ieee->networks[i]->ibss_dfs)
102 103 kfree(ieee->networks[i]->ibss_dfs);
103 for (i = 0; i < MAX_NETWORK_COUNT; i++) 104 kfree(ieee->networks[i]);
104 if (ieee->networks[i].ibss_dfs) 105 }
105 kfree(ieee->networks[i].ibss_dfs);
106
107 kfree(ieee->networks);
108 ieee->networks = NULL;
109} 106}
110 107
111void libipw_networks_age(struct libipw_device *ieee, 108void libipw_networks_age(struct libipw_device *ieee,
@@ -130,7 +127,7 @@ static void libipw_networks_initialize(struct libipw_device *ieee)
130 INIT_LIST_HEAD(&ieee->network_free_list); 127 INIT_LIST_HEAD(&ieee->network_free_list);
131 INIT_LIST_HEAD(&ieee->network_list); 128 INIT_LIST_HEAD(&ieee->network_list);
132 for (i = 0; i < MAX_NETWORK_COUNT; i++) 129 for (i = 0; i < MAX_NETWORK_COUNT; i++)
133 list_add_tail(&ieee->networks[i].list, 130 list_add_tail(&ieee->networks[i]->list,
134 &ieee->network_free_list); 131 &ieee->network_free_list);
135} 132}
136 133
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 303cc8193adc..e0678d921055 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -184,7 +184,7 @@ static int iwl3945_hwrate_to_plcp_idx(u8 plcp)
184{ 184{
185 int idx; 185 int idx;
186 186
187 for (idx = 0; idx < IWL_RATE_COUNT; idx++) 187 for (idx = 0; idx < IWL_RATE_COUNT_3945; idx++)
188 if (iwl3945_rates[idx].plcp == plcp) 188 if (iwl3945_rates[idx].plcp == plcp)
189 return idx; 189 return idx;
190 return -1; 190 return -1;
@@ -805,7 +805,7 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv,
805 int sta_id, int tx_id) 805 int sta_id, int tx_id)
806{ 806{
807 u16 hw_value = ieee80211_get_tx_rate(priv->hw, info)->hw_value; 807 u16 hw_value = ieee80211_get_tx_rate(priv->hw, info)->hw_value;
808 u16 rate_index = min(hw_value & 0xffff, IWL_RATE_COUNT - 1); 808 u16 rate_index = min(hw_value & 0xffff, IWL_RATE_COUNT_3945);
809 u16 rate_mask; 809 u16 rate_mask;
810 int rate; 810 int rate;
811 u8 rts_retry_limit; 811 u8 rts_retry_limit;
@@ -2146,7 +2146,7 @@ static void iwl3945_hw_reg_init_channel_groups(struct iwl_priv *priv)
2146 2146
2147 /* fill in channel group's nominal powers for each rate */ 2147 /* fill in channel group's nominal powers for each rate */
2148 for (rate_index = 0; 2148 for (rate_index = 0;
2149 rate_index < IWL_RATE_COUNT; rate_index++, clip_pwrs++) { 2149 rate_index < IWL_RATE_COUNT_3945; rate_index++, clip_pwrs++) {
2150 switch (rate_index) { 2150 switch (rate_index) {
2151 case IWL_RATE_36M_INDEX_TABLE: 2151 case IWL_RATE_36M_INDEX_TABLE:
2152 if (i == 0) /* B/G */ 2152 if (i == 0) /* B/G */
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 6aeb82b6992f..818367b57bab 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1463,59 +1463,66 @@ static void iwl_nic_start(struct iwl_priv *priv)
1463} 1463}
1464 1464
1465 1465
1466static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context);
1467static int iwl_mac_setup_register(struct iwl_priv *priv);
1468
1469static int __must_check iwl_request_firmware(struct iwl_priv *priv, bool first)
1470{
1471 const char *name_pre = priv->cfg->fw_name_pre;
1472
1473 if (first)
1474 priv->fw_index = priv->cfg->ucode_api_max;
1475 else
1476 priv->fw_index--;
1477
1478 if (priv->fw_index < priv->cfg->ucode_api_min) {
1479 IWL_ERR(priv, "no suitable firmware found!\n");
1480 return -ENOENT;
1481 }
1482
1483 sprintf(priv->firmware_name, "%s%d%s",
1484 name_pre, priv->fw_index, ".ucode");
1485
1486 IWL_DEBUG_INFO(priv, "attempting to load firmware '%s'\n",
1487 priv->firmware_name);
1488
1489 return request_firmware_nowait(THIS_MODULE, 1, priv->firmware_name,
1490 &priv->pci_dev->dev, GFP_KERNEL, priv,
1491 iwl_ucode_callback);
1492}
1493
1466/** 1494/**
1467 * iwl_read_ucode - Read uCode images from disk file. 1495 * iwl_ucode_callback - callback when firmware was loaded
1468 * 1496 *
1469 * Copy into buffers for card to fetch via bus-mastering 1497 * If loaded successfully, copies the firmware into buffers
1498 * for the card to fetch (via DMA).
1470 */ 1499 */
1471static int iwl_read_ucode(struct iwl_priv *priv) 1500static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
1472{ 1501{
1502 struct iwl_priv *priv = context;
1473 struct iwl_ucode_header *ucode; 1503 struct iwl_ucode_header *ucode;
1474 int ret = -EINVAL, index;
1475 const struct firmware *ucode_raw;
1476 const char *name_pre = priv->cfg->fw_name_pre;
1477 const unsigned int api_max = priv->cfg->ucode_api_max; 1504 const unsigned int api_max = priv->cfg->ucode_api_max;
1478 const unsigned int api_min = priv->cfg->ucode_api_min; 1505 const unsigned int api_min = priv->cfg->ucode_api_min;
1479 char buf[25];
1480 u8 *src; 1506 u8 *src;
1481 size_t len; 1507 size_t len;
1482 u32 api_ver, build; 1508 u32 api_ver, build;
1483 u32 inst_size, data_size, init_size, init_data_size, boot_size; 1509 u32 inst_size, data_size, init_size, init_data_size, boot_size;
1510 int err;
1484 u16 eeprom_ver; 1511 u16 eeprom_ver;
1485 1512
1486 /* Ask kernel firmware_class module to get the boot firmware off disk. 1513 if (!ucode_raw) {
1487 * request_firmware() is synchronous, file is in memory on return. */ 1514 IWL_ERR(priv, "request for firmware file '%s' failed.\n",
1488 for (index = api_max; index >= api_min; index--) { 1515 priv->firmware_name);
1489 sprintf(buf, "%s%d%s", name_pre, index, ".ucode"); 1516 goto try_again;
1490 ret = request_firmware(&ucode_raw, buf, &priv->pci_dev->dev);
1491 if (ret < 0) {
1492 IWL_ERR(priv, "%s firmware file req failed: %d\n",
1493 buf, ret);
1494 if (ret == -ENOENT)
1495 continue;
1496 else
1497 goto error;
1498 } else {
1499 if (index < api_max)
1500 IWL_ERR(priv, "Loaded firmware %s, "
1501 "which is deprecated. "
1502 "Please use API v%u instead.\n",
1503 buf, api_max);
1504
1505 IWL_DEBUG_INFO(priv, "Got firmware '%s' file (%zd bytes) from disk\n",
1506 buf, ucode_raw->size);
1507 break;
1508 }
1509 } 1517 }
1510 1518
1511 if (ret < 0) 1519 IWL_DEBUG_INFO(priv, "Loaded firmware file '%s' (%zd bytes).\n",
1512 goto error; 1520 priv->firmware_name, ucode_raw->size);
1513 1521
1514 /* Make sure that we got at least the v1 header! */ 1522 /* Make sure that we got at least the v1 header! */
1515 if (ucode_raw->size < priv->cfg->ops->ucode->get_header_size(1)) { 1523 if (ucode_raw->size < priv->cfg->ops->ucode->get_header_size(1)) {
1516 IWL_ERR(priv, "File size way too small!\n"); 1524 IWL_ERR(priv, "File size way too small!\n");
1517 ret = -EINVAL; 1525 goto try_again;
1518 goto err_release;
1519 } 1526 }
1520 1527
1521 /* Data from ucode file: header followed by uCode images */ 1528 /* Data from ucode file: header followed by uCode images */
@@ -1540,10 +1547,9 @@ static int iwl_read_ucode(struct iwl_priv *priv)
1540 IWL_ERR(priv, "Driver unable to support your firmware API. " 1547 IWL_ERR(priv, "Driver unable to support your firmware API. "
1541 "Driver supports v%u, firmware is v%u.\n", 1548 "Driver supports v%u, firmware is v%u.\n",
1542 api_max, api_ver); 1549 api_max, api_ver);
1543 priv->ucode_ver = 0; 1550 goto try_again;
1544 ret = -EINVAL;
1545 goto err_release;
1546 } 1551 }
1552
1547 if (api_ver != api_max) 1553 if (api_ver != api_max)
1548 IWL_ERR(priv, "Firmware has old API version. Expected v%u, " 1554 IWL_ERR(priv, "Firmware has old API version. Expected v%u, "
1549 "got v%u. New firmware can be obtained " 1555 "got v%u. New firmware can be obtained "
@@ -1585,6 +1591,12 @@ static int iwl_read_ucode(struct iwl_priv *priv)
1585 IWL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %u\n", 1591 IWL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %u\n",
1586 boot_size); 1592 boot_size);
1587 1593
1594 /*
1595 * For any of the failures below (before allocating pci memory)
1596 * we will try to load a version with a smaller API -- maybe the
1597 * user just got a corrupted version of the latest API.
1598 */
1599
1588 /* Verify size of file vs. image size info in file's header */ 1600 /* Verify size of file vs. image size info in file's header */
1589 if (ucode_raw->size != 1601 if (ucode_raw->size !=
1590 priv->cfg->ops->ucode->get_header_size(api_ver) + 1602 priv->cfg->ops->ucode->get_header_size(api_ver) +
@@ -1594,41 +1606,35 @@ static int iwl_read_ucode(struct iwl_priv *priv)
1594 IWL_DEBUG_INFO(priv, 1606 IWL_DEBUG_INFO(priv,
1595 "uCode file size %d does not match expected size\n", 1607 "uCode file size %d does not match expected size\n",
1596 (int)ucode_raw->size); 1608 (int)ucode_raw->size);
1597 ret = -EINVAL; 1609 goto try_again;
1598 goto err_release;
1599 } 1610 }
1600 1611
1601 /* Verify that uCode images will fit in card's SRAM */ 1612 /* Verify that uCode images will fit in card's SRAM */
1602 if (inst_size > priv->hw_params.max_inst_size) { 1613 if (inst_size > priv->hw_params.max_inst_size) {
1603 IWL_DEBUG_INFO(priv, "uCode instr len %d too large to fit in\n", 1614 IWL_DEBUG_INFO(priv, "uCode instr len %d too large to fit in\n",
1604 inst_size); 1615 inst_size);
1605 ret = -EINVAL; 1616 goto try_again;
1606 goto err_release;
1607 } 1617 }
1608 1618
1609 if (data_size > priv->hw_params.max_data_size) { 1619 if (data_size > priv->hw_params.max_data_size) {
1610 IWL_DEBUG_INFO(priv, "uCode data len %d too large to fit in\n", 1620 IWL_DEBUG_INFO(priv, "uCode data len %d too large to fit in\n",
1611 data_size); 1621 data_size);
1612 ret = -EINVAL; 1622 goto try_again;
1613 goto err_release;
1614 } 1623 }
1615 if (init_size > priv->hw_params.max_inst_size) { 1624 if (init_size > priv->hw_params.max_inst_size) {
1616 IWL_INFO(priv, "uCode init instr len %d too large to fit in\n", 1625 IWL_INFO(priv, "uCode init instr len %d too large to fit in\n",
1617 init_size); 1626 init_size);
1618 ret = -EINVAL; 1627 goto try_again;
1619 goto err_release;
1620 } 1628 }
1621 if (init_data_size > priv->hw_params.max_data_size) { 1629 if (init_data_size > priv->hw_params.max_data_size) {
1622 IWL_INFO(priv, "uCode init data len %d too large to fit in\n", 1630 IWL_INFO(priv, "uCode init data len %d too large to fit in\n",
1623 init_data_size); 1631 init_data_size);
1624 ret = -EINVAL; 1632 goto try_again;
1625 goto err_release;
1626 } 1633 }
1627 if (boot_size > priv->hw_params.max_bsm_size) { 1634 if (boot_size > priv->hw_params.max_bsm_size) {
1628 IWL_INFO(priv, "uCode boot instr len %d too large to fit in\n", 1635 IWL_INFO(priv, "uCode boot instr len %d too large to fit in\n",
1629 boot_size); 1636 boot_size);
1630 ret = -EINVAL; 1637 goto try_again;
1631 goto err_release;
1632 } 1638 }
1633 1639
1634 /* Allocate ucode buffers for card's bus-master loading ... */ 1640 /* Allocate ucode buffers for card's bus-master loading ... */
@@ -1712,20 +1718,36 @@ static int iwl_read_ucode(struct iwl_priv *priv)
1712 IWL_DEBUG_INFO(priv, "Copying (but not loading) boot instr len %Zd\n", len); 1718 IWL_DEBUG_INFO(priv, "Copying (but not loading) boot instr len %Zd\n", len);
1713 memcpy(priv->ucode_boot.v_addr, src, len); 1719 memcpy(priv->ucode_boot.v_addr, src, len);
1714 1720
1721 /**************************************************
1722 * This is still part of probe() in a sense...
1723 *
1724 * 9. Setup and register with mac80211 and debugfs
1725 **************************************************/
1726 err = iwl_mac_setup_register(priv);
1727 if (err)
1728 goto out_unbind;
1729
1730 err = iwl_dbgfs_register(priv, DRV_NAME);
1731 if (err)
1732 IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err);
1733
1715 /* We have our copies now, allow OS release its copies */ 1734 /* We have our copies now, allow OS release its copies */
1716 release_firmware(ucode_raw); 1735 release_firmware(ucode_raw);
1717 return 0; 1736 return;
1737
1738 try_again:
1739 /* try next, if any */
1740 if (iwl_request_firmware(priv, false))
1741 goto out_unbind;
1742 release_firmware(ucode_raw);
1743 return;
1718 1744
1719 err_pci_alloc: 1745 err_pci_alloc:
1720 IWL_ERR(priv, "failed to allocate pci memory\n"); 1746 IWL_ERR(priv, "failed to allocate pci memory\n");
1721 ret = -ENOMEM;
1722 iwl_dealloc_ucode_pci(priv); 1747 iwl_dealloc_ucode_pci(priv);
1723 1748 out_unbind:
1724 err_release: 1749 device_release_driver(&priv->pci_dev->dev);
1725 release_firmware(ucode_raw); 1750 release_firmware(ucode_raw);
1726
1727 error:
1728 return ret;
1729} 1751}
1730 1752
1731static const char *desc_lookup_text[] = { 1753static const char *desc_lookup_text[] = {
@@ -2631,7 +2653,7 @@ static int iwl_mac_setup_register(struct iwl_priv *priv)
2631 */ 2653 */
2632 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; 2654 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
2633 2655
2634 hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX + 1; 2656 hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX;
2635 /* we create the 802.11 header and a zero-length SSID element */ 2657 /* we create the 802.11 header and a zero-length SSID element */
2636 hw->wiphy->max_scan_ie_len = IWL_MAX_PROBE_REQUEST - 24 - 2; 2658 hw->wiphy->max_scan_ie_len = IWL_MAX_PROBE_REQUEST - 24 - 2;
2637 2659
@@ -2667,21 +2689,7 @@ static int iwl_mac_start(struct ieee80211_hw *hw)
2667 2689
2668 /* we should be verifying the device is ready to be opened */ 2690 /* we should be verifying the device is ready to be opened */
2669 mutex_lock(&priv->mutex); 2691 mutex_lock(&priv->mutex);
2670
2671 /* fetch ucode file from disk, alloc and copy to bus-master buffers ...
2672 * ucode filename and max sizes are card-specific. */
2673
2674 if (!priv->ucode_code.len) {
2675 ret = iwl_read_ucode(priv);
2676 if (ret) {
2677 IWL_ERR(priv, "Could not read microcode: %d\n", ret);
2678 mutex_unlock(&priv->mutex);
2679 return ret;
2680 }
2681 }
2682
2683 ret = __iwl_up(priv); 2692 ret = __iwl_up(priv);
2684
2685 mutex_unlock(&priv->mutex); 2693 mutex_unlock(&priv->mutex);
2686 2694
2687 if (ret) 2695 if (ret)
@@ -3654,17 +3662,10 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3654 iwl_power_initialize(priv); 3662 iwl_power_initialize(priv);
3655 iwl_tt_initialize(priv); 3663 iwl_tt_initialize(priv);
3656 3664
3657 /************************************************** 3665 err = iwl_request_firmware(priv, true);
3658 * 9. Setup and register with mac80211 and debugfs
3659 **************************************************/
3660 err = iwl_mac_setup_register(priv);
3661 if (err) 3666 if (err)
3662 goto out_remove_sysfs; 3667 goto out_remove_sysfs;
3663 3668
3664 err = iwl_dbgfs_register(priv, DRV_NAME);
3665 if (err)
3666 IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err);
3667
3668 return 0; 3669 return 0;
3669 3670
3670 out_remove_sysfs: 3671 out_remove_sysfs:
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index ab891b958042..6054c5fba0c1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1132,6 +1132,7 @@ struct iwl_priv {
1132 u8 rev_id; 1132 u8 rev_id;
1133 1133
1134 /* uCode images, save to reload in case of failure */ 1134 /* uCode images, save to reload in case of failure */
1135 int fw_index; /* firmware we're trying to load */
1135 u32 ucode_ver; /* version of ucode, copy of 1136 u32 ucode_ver; /* version of ucode, copy of
1136 iwl_ucode.ver */ 1137 iwl_ucode.ver */
1137 struct fw_desc ucode_code; /* runtime inst */ 1138 struct fw_desc ucode_code; /* runtime inst */
@@ -1142,6 +1143,7 @@ struct iwl_priv {
1142 struct fw_desc ucode_boot; /* bootstrap inst */ 1143 struct fw_desc ucode_boot; /* bootstrap inst */
1143 enum ucode_type ucode_type; 1144 enum ucode_type ucode_type;
1144 u8 ucode_write_complete; /* the image write is complete */ 1145 u8 ucode_write_complete; /* the image write is complete */
1146 char firmware_name[25];
1145 1147
1146 1148
1147 struct iwl_rxon_time_cmd rxon_timing; 1149 struct iwl_rxon_time_cmd rxon_timing;
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index dd9ff2ed645a..bd2f7c420563 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -638,20 +638,9 @@ u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame,
638 if (left < 0) 638 if (left < 0)
639 return 0; 639 return 0;
640 *pos++ = WLAN_EID_SSID; 640 *pos++ = WLAN_EID_SSID;
641 if (!priv->is_internal_short_scan && 641 *pos++ = 0;
642 priv->scan_request->n_ssids) { 642
643 struct cfg80211_ssid *ssid = 643 len += 2;
644 priv->scan_request->ssids;
645
646 /* Broadcast if ssid_len is 0 */
647 *pos++ = ssid->ssid_len;
648 memcpy(pos, ssid->ssid, ssid->ssid_len);
649 pos += ssid->ssid_len;
650 len += 2 + ssid->ssid_len;
651 } else {
652 *pos++ = 0;
653 len += 2;
654 }
655 644
656 if (WARN_ON(left < ie_len)) 645 if (WARN_ON(left < ie_len))
657 return len; 646 return len;
@@ -780,26 +769,20 @@ static void iwl_bg_request_scan(struct work_struct *data)
780 if (priv->is_internal_short_scan) { 769 if (priv->is_internal_short_scan) {
781 IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n"); 770 IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n");
782 } else if (priv->scan_request->n_ssids) { 771 } else if (priv->scan_request->n_ssids) {
772 int i, p = 0;
783 IWL_DEBUG_SCAN(priv, "Kicking off active scan\n"); 773 IWL_DEBUG_SCAN(priv, "Kicking off active scan\n");
784 /* 774 for (i = 0; i < priv->scan_request->n_ssids; i++) {
785 * The first SSID to scan is stuffed into the probe request 775 /* always does wildcard anyway */
786 * template and the remaining ones are handled through the 776 if (!priv->scan_request->ssids[i].ssid_len)
787 * direct_scan array. 777 continue;
788 */ 778 scan->direct_scan[p].id = WLAN_EID_SSID;
789 if (priv->scan_request->n_ssids > 1) { 779 scan->direct_scan[p].len =
790 int i, p = 0; 780 priv->scan_request->ssids[i].ssid_len;
791 for (i = 1; i < priv->scan_request->n_ssids; i++) { 781 memcpy(scan->direct_scan[p].ssid,
792 if (!priv->scan_request->ssids[i].ssid_len) 782 priv->scan_request->ssids[i].ssid,
793 continue; 783 priv->scan_request->ssids[i].ssid_len);
794 scan->direct_scan[p].id = WLAN_EID_SSID; 784 n_probes++;
795 scan->direct_scan[p].len = 785 p++;
796 priv->scan_request->ssids[i].ssid_len;
797 memcpy(scan->direct_scan[p].ssid,
798 priv->scan_request->ssids[i].ssid,
799 priv->scan_request->ssids[i].ssid_len);
800 n_probes++;
801 p++;
802 }
803 } 786 }
804 is_active = true; 787 is_active = true;
805 } else 788 } else
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index 9f6d6bf06b8e..2887047069f2 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -1496,51 +1496,67 @@ static void set_multicast_list(struct usbnet *usbdev)
1496{ 1496{
1497 struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); 1497 struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev);
1498 struct dev_mc_list *mclist; 1498 struct dev_mc_list *mclist;
1499 __le32 filter; 1499 __le32 filter, basefilter;
1500 int ret, i, size; 1500 int ret;
1501 char *buf; 1501 char *mc_addrs = NULL;
1502 int mc_count;
1502 1503
1503 filter = RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST; 1504 basefilter = filter = RNDIS_PACKET_TYPE_DIRECTED |
1505 RNDIS_PACKET_TYPE_BROADCAST;
1504 1506
1505 netif_addr_lock_bh(usbdev->net);
1506 if (usbdev->net->flags & IFF_PROMISC) { 1507 if (usbdev->net->flags & IFF_PROMISC) {
1507 filter |= RNDIS_PACKET_TYPE_PROMISCUOUS | 1508 filter |= RNDIS_PACKET_TYPE_PROMISCUOUS |
1508 RNDIS_PACKET_TYPE_ALL_LOCAL; 1509 RNDIS_PACKET_TYPE_ALL_LOCAL;
1509 } else if (usbdev->net->flags & IFF_ALLMULTI || 1510 } else if (usbdev->net->flags & IFF_ALLMULTI) {
1510 netdev_mc_count(usbdev->net) > priv->multicast_size) { 1511 filter |= RNDIS_PACKET_TYPE_ALL_MULTICAST;
1512 }
1513
1514 if (filter != basefilter)
1515 goto set_filter;
1516
1517 /*
1518 * mc_list should be accessed holding the lock, so copy addresses to
1519 * local buffer first.
1520 */
1521 netif_addr_lock_bh(usbdev->net);
1522 mc_count = netdev_mc_count(usbdev->net);
1523 if (mc_count > priv->multicast_size) {
1511 filter |= RNDIS_PACKET_TYPE_ALL_MULTICAST; 1524 filter |= RNDIS_PACKET_TYPE_ALL_MULTICAST;
1512 } else if (!netdev_mc_empty(usbdev->net)) { 1525 } else if (mc_count) {
1513 size = min(priv->multicast_size, netdev_mc_count(usbdev->net)); 1526 int i = 0;
1514 buf = kmalloc(size * ETH_ALEN, GFP_KERNEL); 1527
1515 if (!buf) { 1528 mc_addrs = kmalloc(mc_count * ETH_ALEN, GFP_ATOMIC);
1529 if (!mc_addrs) {
1516 netdev_warn(usbdev->net, 1530 netdev_warn(usbdev->net,
1517 "couldn't alloc %d bytes of memory\n", 1531 "couldn't alloc %d bytes of memory\n",
1518 size * ETH_ALEN); 1532 mc_count * ETH_ALEN);
1519 netif_addr_unlock_bh(usbdev->net); 1533 netif_addr_unlock_bh(usbdev->net);
1520 return; 1534 return;
1521 } 1535 }
1522 1536
1523 i = 0; 1537 netdev_for_each_mc_addr(mclist, usbdev->net)
1524 netdev_for_each_mc_addr(mclist, usbdev->net) { 1538 memcpy(mc_addrs + i++ * ETH_ALEN,
1525 if (i == size) 1539 mclist->dmi_addr, ETH_ALEN);
1526 break; 1540 }
1527 memcpy(buf + i++ * ETH_ALEN, mclist->dmi_addr, ETH_ALEN); 1541 netif_addr_unlock_bh(usbdev->net);
1528 }
1529 1542
1530 ret = rndis_set_oid(usbdev, OID_802_3_MULTICAST_LIST, buf, 1543 if (filter != basefilter)
1531 i * ETH_ALEN); 1544 goto set_filter;
1532 if (ret == 0 && i > 0) 1545
1546 if (mc_count) {
1547 ret = rndis_set_oid(usbdev, OID_802_3_MULTICAST_LIST, mc_addrs,
1548 mc_count * ETH_ALEN);
1549 kfree(mc_addrs);
1550 if (ret == 0)
1533 filter |= RNDIS_PACKET_TYPE_MULTICAST; 1551 filter |= RNDIS_PACKET_TYPE_MULTICAST;
1534 else 1552 else
1535 filter |= RNDIS_PACKET_TYPE_ALL_MULTICAST; 1553 filter |= RNDIS_PACKET_TYPE_ALL_MULTICAST;
1536 1554
1537 netdev_dbg(usbdev->net, "OID_802_3_MULTICAST_LIST(%d, max: %d) -> %d\n", 1555 netdev_dbg(usbdev->net, "OID_802_3_MULTICAST_LIST(%d, max: %d) -> %d\n",
1538 i, priv->multicast_size, ret); 1556 mc_count, priv->multicast_size, ret);
1539
1540 kfree(buf);
1541 } 1557 }
1542 netif_addr_unlock_bh(usbdev->net);
1543 1558
1559set_filter:
1544 ret = rndis_set_oid(usbdev, OID_GEN_CURRENT_PACKET_FILTER, &filter, 1560 ret = rndis_set_oid(usbdev, OID_GEN_CURRENT_PACKET_FILTER, &filter,
1545 sizeof(filter)); 1561 sizeof(filter));
1546 if (ret < 0) { 1562 if (ret < 0) {
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index aca8c124f434..91cce2d0f6db 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -1225,7 +1225,7 @@ MODULE_LICENSE("GPL");
1225#ifdef CONFIG_RT2800PCI_SOC 1225#ifdef CONFIG_RT2800PCI_SOC
1226static int rt2800soc_probe(struct platform_device *pdev) 1226static int rt2800soc_probe(struct platform_device *pdev)
1227{ 1227{
1228 return rt2x00soc_probe(pdev, rt2800pci_ops); 1228 return rt2x00soc_probe(pdev, &rt2800pci_ops);
1229} 1229}
1230 1230
1231static struct platform_driver rt2800soc_driver = { 1231static struct platform_driver rt2800soc_driver = {
diff --git a/drivers/net/wireless/rt2x00/rt2x00soc.c b/drivers/net/wireless/rt2x00/rt2x00soc.c
index 4efdc96010f6..111c0ff5c6c7 100644
--- a/drivers/net/wireless/rt2x00/rt2x00soc.c
+++ b/drivers/net/wireless/rt2x00/rt2x00soc.c
@@ -112,6 +112,7 @@ exit_free_device:
112 112
113 return retval; 113 return retval;
114} 114}
115EXPORT_SYMBOL_GPL(rt2x00soc_probe);
115 116
116int rt2x00soc_remove(struct platform_device *pdev) 117int rt2x00soc_remove(struct platform_device *pdev)
117{ 118{
diff --git a/drivers/net/wireless/rt2x00/rt2x00soc.h b/drivers/net/wireless/rt2x00/rt2x00soc.h
index 4739edfe2f00..474cbfc1efc7 100644
--- a/drivers/net/wireless/rt2x00/rt2x00soc.h
+++ b/drivers/net/wireless/rt2x00/rt2x00soc.h
@@ -26,8 +26,6 @@
26#ifndef RT2X00SOC_H 26#ifndef RT2X00SOC_H
27#define RT2X00SOC_H 27#define RT2X00SOC_H
28 28
29#define KSEG1ADDR(__ptr) __ptr
30
31/* 29/*
32 * SoC driver handlers. 30 * SoC driver handlers.
33 */ 31 */
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index e77aec8d0a84..290d70bc5d22 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2352,6 +2352,8 @@ static struct usb_device_id rt73usb_device_table[] = {
2352 { USB_DEVICE(0x0411, 0x00f4), USB_DEVICE_DATA(&rt73usb_ops) }, 2352 { USB_DEVICE(0x0411, 0x00f4), USB_DEVICE_DATA(&rt73usb_ops) },
2353 { USB_DEVICE(0x0411, 0x0116), USB_DEVICE_DATA(&rt73usb_ops) }, 2353 { USB_DEVICE(0x0411, 0x0116), USB_DEVICE_DATA(&rt73usb_ops) },
2354 { USB_DEVICE(0x0411, 0x0119), USB_DEVICE_DATA(&rt73usb_ops) }, 2354 { USB_DEVICE(0x0411, 0x0119), USB_DEVICE_DATA(&rt73usb_ops) },
2355 /* CEIVA */
2356 { USB_DEVICE(0x178d, 0x02be), USB_DEVICE_DATA(&rt73usb_ops) },
2355 /* CNet */ 2357 /* CNet */
2356 { USB_DEVICE(0x1371, 0x9022), USB_DEVICE_DATA(&rt73usb_ops) }, 2358 { USB_DEVICE(0x1371, 0x9022), USB_DEVICE_DATA(&rt73usb_ops) },
2357 { USB_DEVICE(0x1371, 0x9032), USB_DEVICE_DATA(&rt73usb_ops) }, 2359 { USB_DEVICE(0x1371, 0x9032), USB_DEVICE_DATA(&rt73usb_ops) },
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index a22a19203120..00e09e26c826 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -350,7 +350,7 @@ static void zd_mac_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
350 first_idx = info->status.rates[0].idx; 350 first_idx = info->status.rates[0].idx;
351 ZD_ASSERT(0<=first_idx && first_idx<ARRAY_SIZE(zd_retry_rates)); 351 ZD_ASSERT(0<=first_idx && first_idx<ARRAY_SIZE(zd_retry_rates));
352 retries = &zd_retry_rates[first_idx]; 352 retries = &zd_retry_rates[first_idx];
353 ZD_ASSERT(0<=retry && retry<=retries->count); 353 ZD_ASSERT(1 <= retry && retry <= retries->count);
354 354
355 info->status.rates[0].idx = retries->rate[0]; 355 info->status.rates[0].idx = retries->rate[0];
356 info->status.rates[0].count = 1; // (retry > 1 ? 2 : 1); 356 info->status.rates[0].count = 1; // (retry > 1 ? 2 : 1);
@@ -360,7 +360,7 @@ static void zd_mac_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
360 info->status.rates[i].count = 1; // ((i==retry-1) && success ? 1:2); 360 info->status.rates[i].count = 1; // ((i==retry-1) && success ? 1:2);
361 } 361 }
362 for (; i<IEEE80211_TX_MAX_RATES && i<retry; i++) { 362 for (; i<IEEE80211_TX_MAX_RATES && i<retry; i++) {
363 info->status.rates[i].idx = retries->rate[retry-1]; 363 info->status.rates[i].idx = retries->rate[retry - 1];
364 info->status.rates[i].count = 1; // (success ? 1:2); 364 info->status.rates[i].count = 1; // (success ? 1:2);
365 } 365 }
366 if (i<IEEE80211_TX_MAX_RATES) 366 if (i<IEEE80211_TX_MAX_RATES)
@@ -424,12 +424,10 @@ void zd_mac_tx_failed(struct urb *urb)
424 first_idx = info->status.rates[0].idx; 424 first_idx = info->status.rates[0].idx;
425 ZD_ASSERT(0<=first_idx && first_idx<ARRAY_SIZE(zd_retry_rates)); 425 ZD_ASSERT(0<=first_idx && first_idx<ARRAY_SIZE(zd_retry_rates));
426 retries = &zd_retry_rates[first_idx]; 426 retries = &zd_retry_rates[first_idx];
427 if (retry < 0 || retry > retries->count) { 427 if (retry <= 0 || retry > retries->count)
428 continue; 428 continue;
429 }
430 429
431 ZD_ASSERT(0<=retry && retry<=retries->count); 430 final_idx = retries->rate[retry - 1];
432 final_idx = retries->rate[retry-1];
433 final_rate = zd_rates[final_idx].hw_value; 431 final_rate = zd_rates[final_idx].hw_value;
434 432
435 if (final_rate != tx_status->rate) { 433 if (final_rate != tx_status->rate) {
diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
index 1b1dddbd5744..bed764e3ea2a 100644
--- a/drivers/platform/x86/dell-wmi.c
+++ b/drivers/platform/x86/dell-wmi.c
@@ -142,7 +142,7 @@ static struct key_entry *dell_wmi_keymap = dell_legacy_wmi_keymap;
142 142
143static struct input_dev *dell_wmi_input_dev; 143static struct input_dev *dell_wmi_input_dev;
144 144
145static struct key_entry *dell_wmi_get_entry_by_scancode(int code) 145static struct key_entry *dell_wmi_get_entry_by_scancode(unsigned int code)
146{ 146{
147 struct key_entry *key; 147 struct key_entry *key;
148 148
@@ -153,7 +153,7 @@ static struct key_entry *dell_wmi_get_entry_by_scancode(int code)
153 return NULL; 153 return NULL;
154} 154}
155 155
156static struct key_entry *dell_wmi_get_entry_by_keycode(int keycode) 156static struct key_entry *dell_wmi_get_entry_by_keycode(unsigned int keycode)
157{ 157{
158 struct key_entry *key; 158 struct key_entry *key;
159 159
@@ -164,8 +164,8 @@ static struct key_entry *dell_wmi_get_entry_by_keycode(int keycode)
164 return NULL; 164 return NULL;
165} 165}
166 166
167static int dell_wmi_getkeycode(struct input_dev *dev, int scancode, 167static int dell_wmi_getkeycode(struct input_dev *dev,
168 int *keycode) 168 unsigned int scancode, unsigned int *keycode)
169{ 169{
170 struct key_entry *key = dell_wmi_get_entry_by_scancode(scancode); 170 struct key_entry *key = dell_wmi_get_entry_by_scancode(scancode);
171 171
@@ -177,13 +177,11 @@ static int dell_wmi_getkeycode(struct input_dev *dev, int scancode,
177 return -EINVAL; 177 return -EINVAL;
178} 178}
179 179
180static int dell_wmi_setkeycode(struct input_dev *dev, int scancode, int keycode) 180static int dell_wmi_setkeycode(struct input_dev *dev,
181 unsigned int scancode, unsigned int keycode)
181{ 182{
182 struct key_entry *key; 183 struct key_entry *key;
183 int old_keycode; 184 unsigned int old_keycode;
184
185 if (keycode < 0 || keycode > KEY_MAX)
186 return -EINVAL;
187 185
188 key = dell_wmi_get_entry_by_scancode(scancode); 186 key = dell_wmi_get_entry_by_scancode(scancode);
189 if (key && key->type == KE_KEY) { 187 if (key && key->type == KE_KEY) {
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 7ccf33c08967..56086363becc 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -278,7 +278,7 @@ static DEVICE_ATTR(als, S_IRUGO | S_IWUSR, show_als, set_als);
278static DEVICE_ATTR(dock, S_IRUGO, show_dock, NULL); 278static DEVICE_ATTR(dock, S_IRUGO, show_dock, NULL);
279static DEVICE_ATTR(tablet, S_IRUGO, show_tablet, NULL); 279static DEVICE_ATTR(tablet, S_IRUGO, show_tablet, NULL);
280 280
281static struct key_entry *hp_wmi_get_entry_by_scancode(int code) 281static struct key_entry *hp_wmi_get_entry_by_scancode(unsigned int code)
282{ 282{
283 struct key_entry *key; 283 struct key_entry *key;
284 284
@@ -289,7 +289,7 @@ static struct key_entry *hp_wmi_get_entry_by_scancode(int code)
289 return NULL; 289 return NULL;
290} 290}
291 291
292static struct key_entry *hp_wmi_get_entry_by_keycode(int keycode) 292static struct key_entry *hp_wmi_get_entry_by_keycode(unsigned int keycode)
293{ 293{
294 struct key_entry *key; 294 struct key_entry *key;
295 295
@@ -300,7 +300,8 @@ static struct key_entry *hp_wmi_get_entry_by_keycode(int keycode)
300 return NULL; 300 return NULL;
301} 301}
302 302
303static int hp_wmi_getkeycode(struct input_dev *dev, int scancode, int *keycode) 303static int hp_wmi_getkeycode(struct input_dev *dev,
304 unsigned int scancode, unsigned int *keycode)
304{ 305{
305 struct key_entry *key = hp_wmi_get_entry_by_scancode(scancode); 306 struct key_entry *key = hp_wmi_get_entry_by_scancode(scancode);
306 307
@@ -312,13 +313,11 @@ static int hp_wmi_getkeycode(struct input_dev *dev, int scancode, int *keycode)
312 return -EINVAL; 313 return -EINVAL;
313} 314}
314 315
315static int hp_wmi_setkeycode(struct input_dev *dev, int scancode, int keycode) 316static int hp_wmi_setkeycode(struct input_dev *dev,
317 unsigned int scancode, unsigned int keycode)
316{ 318{
317 struct key_entry *key; 319 struct key_entry *key;
318 int old_keycode; 320 unsigned int old_keycode;
319
320 if (keycode < 0 || keycode > KEY_MAX)
321 return -EINVAL;
322 321
323 key = hp_wmi_get_entry_by_scancode(scancode); 322 key = hp_wmi_get_entry_by_scancode(scancode);
324 if (key && key->type == KE_KEY) { 323 if (key && key->type == KE_KEY) {
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index fe7cf0188acc..c9fc479fc290 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -200,7 +200,7 @@ static struct acpi_driver acpi_pcc_driver = {
200}; 200};
201 201
202#define KEYMAP_SIZE 11 202#define KEYMAP_SIZE 11
203static const int initial_keymap[KEYMAP_SIZE] = { 203static const unsigned int initial_keymap[KEYMAP_SIZE] = {
204 /* 0 */ KEY_RESERVED, 204 /* 0 */ KEY_RESERVED,
205 /* 1 */ KEY_BRIGHTNESSDOWN, 205 /* 1 */ KEY_BRIGHTNESSDOWN,
206 /* 2 */ KEY_BRIGHTNESSUP, 206 /* 2 */ KEY_BRIGHTNESSUP,
@@ -222,7 +222,7 @@ struct pcc_acpi {
222 struct acpi_device *device; 222 struct acpi_device *device;
223 struct input_dev *input_dev; 223 struct input_dev *input_dev;
224 struct backlight_device *backlight; 224 struct backlight_device *backlight;
225 int keymap[KEYMAP_SIZE]; 225 unsigned int keymap[KEYMAP_SIZE];
226}; 226};
227 227
228struct pcc_keyinput { 228struct pcc_keyinput {
@@ -445,7 +445,8 @@ static struct attribute_group pcc_attr_group = {
445 445
446/* hotkey input device driver */ 446/* hotkey input device driver */
447 447
448static int pcc_getkeycode(struct input_dev *dev, int scancode, int *keycode) 448static int pcc_getkeycode(struct input_dev *dev,
449 unsigned int scancode, unsigned int *keycode)
449{ 450{
450 struct pcc_acpi *pcc = input_get_drvdata(dev); 451 struct pcc_acpi *pcc = input_get_drvdata(dev);
451 452
@@ -457,7 +458,7 @@ static int pcc_getkeycode(struct input_dev *dev, int scancode, int *keycode)
457 return 0; 458 return 0;
458} 459}
459 460
460static int keymap_get_by_keycode(struct pcc_acpi *pcc, int keycode) 461static int keymap_get_by_keycode(struct pcc_acpi *pcc, unsigned int keycode)
461{ 462{
462 int i; 463 int i;
463 464
@@ -469,7 +470,8 @@ static int keymap_get_by_keycode(struct pcc_acpi *pcc, int keycode)
469 return 0; 470 return 0;
470} 471}
471 472
472static int pcc_setkeycode(struct input_dev *dev, int scancode, int keycode) 473static int pcc_setkeycode(struct input_dev *dev,
474 unsigned int scancode, unsigned int keycode)
473{ 475{
474 struct pcc_acpi *pcc = input_get_drvdata(dev); 476 struct pcc_acpi *pcc = input_get_drvdata(dev);
475 int oldkeycode; 477 int oldkeycode;
@@ -477,9 +479,6 @@ static int pcc_setkeycode(struct input_dev *dev, int scancode, int keycode)
477 if (scancode >= ARRAY_SIZE(pcc->keymap)) 479 if (scancode >= ARRAY_SIZE(pcc->keymap))
478 return -EINVAL; 480 return -EINVAL;
479 481
480 if (keycode < 0 || keycode > KEY_MAX)
481 return -EINVAL;
482
483 oldkeycode = pcc->keymap[scancode]; 482 oldkeycode = pcc->keymap[scancode];
484 pcc->keymap[scancode] = keycode; 483 pcc->keymap[scancode] = keycode;
485 484
diff --git a/drivers/platform/x86/topstar-laptop.c b/drivers/platform/x86/topstar-laptop.c
index 02f3d4e9e666..4d6516fded7e 100644
--- a/drivers/platform/x86/topstar-laptop.c
+++ b/drivers/platform/x86/topstar-laptop.c
@@ -46,7 +46,7 @@ static struct tps_key_entry topstar_keymap[] = {
46 { } 46 { }
47}; 47};
48 48
49static struct tps_key_entry *tps_get_key_by_scancode(int code) 49static struct tps_key_entry *tps_get_key_by_scancode(unsigned int code)
50{ 50{
51 struct tps_key_entry *key; 51 struct tps_key_entry *key;
52 52
@@ -57,7 +57,7 @@ static struct tps_key_entry *tps_get_key_by_scancode(int code)
57 return NULL; 57 return NULL;
58} 58}
59 59
60static struct tps_key_entry *tps_get_key_by_keycode(int code) 60static struct tps_key_entry *tps_get_key_by_keycode(unsigned int code)
61{ 61{
62 struct tps_key_entry *key; 62 struct tps_key_entry *key;
63 63
@@ -126,7 +126,8 @@ static int acpi_topstar_fncx_switch(struct acpi_device *device, bool state)
126 return 0; 126 return 0;
127} 127}
128 128
129static int topstar_getkeycode(struct input_dev *dev, int scancode, int *keycode) 129static int topstar_getkeycode(struct input_dev *dev,
130 unsigned int scancode, unsigned int *keycode)
130{ 131{
131 struct tps_key_entry *key = tps_get_key_by_scancode(scancode); 132 struct tps_key_entry *key = tps_get_key_by_scancode(scancode);
132 133
@@ -137,14 +138,12 @@ static int topstar_getkeycode(struct input_dev *dev, int scancode, int *keycode)
137 return 0; 138 return 0;
138} 139}
139 140
140static int topstar_setkeycode(struct input_dev *dev, int scancode, int keycode) 141static int topstar_setkeycode(struct input_dev *dev,
142 unsigned int scancode, unsigned int keycode)
141{ 143{
142 struct tps_key_entry *key; 144 struct tps_key_entry *key;
143 int old_keycode; 145 int old_keycode;
144 146
145 if (keycode < 0 || keycode > KEY_MAX)
146 return -EINVAL;
147
148 key = tps_get_key_by_scancode(scancode); 147 key = tps_get_key_by_scancode(scancode);
149 148
150 if (!key) 149 if (!key)
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 405b969734d6..789240d1b577 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -745,7 +745,7 @@ static struct backlight_ops toshiba_backlight_data = {
745 .update_status = set_lcd_status, 745 .update_status = set_lcd_status,
746}; 746};
747 747
748static struct key_entry *toshiba_acpi_get_entry_by_scancode(int code) 748static struct key_entry *toshiba_acpi_get_entry_by_scancode(unsigned int code)
749{ 749{
750 struct key_entry *key; 750 struct key_entry *key;
751 751
@@ -756,7 +756,7 @@ static struct key_entry *toshiba_acpi_get_entry_by_scancode(int code)
756 return NULL; 756 return NULL;
757} 757}
758 758
759static struct key_entry *toshiba_acpi_get_entry_by_keycode(int code) 759static struct key_entry *toshiba_acpi_get_entry_by_keycode(unsigned int code)
760{ 760{
761 struct key_entry *key; 761 struct key_entry *key;
762 762
@@ -767,8 +767,8 @@ static struct key_entry *toshiba_acpi_get_entry_by_keycode(int code)
767 return NULL; 767 return NULL;
768} 768}
769 769
770static int toshiba_acpi_getkeycode(struct input_dev *dev, int scancode, 770static int toshiba_acpi_getkeycode(struct input_dev *dev,
771 int *keycode) 771 unsigned int scancode, unsigned int *keycode)
772{ 772{
773 struct key_entry *key = toshiba_acpi_get_entry_by_scancode(scancode); 773 struct key_entry *key = toshiba_acpi_get_entry_by_scancode(scancode);
774 774
@@ -780,14 +780,11 @@ static int toshiba_acpi_getkeycode(struct input_dev *dev, int scancode,
780 return -EINVAL; 780 return -EINVAL;
781} 781}
782 782
783static int toshiba_acpi_setkeycode(struct input_dev *dev, int scancode, 783static int toshiba_acpi_setkeycode(struct input_dev *dev,
784 int keycode) 784 unsigned int scancode, unsigned int keycode)
785{ 785{
786 struct key_entry *key; 786 struct key_entry *key;
787 int old_keycode; 787 unsigned int old_keycode;
788
789 if (keycode < 0 || keycode > KEY_MAX)
790 return -EINVAL;
791 788
792 key = toshiba_acpi_get_entry_by_scancode(scancode); 789 key = toshiba_acpi_get_entry_by_scancode(scancode);
793 if (key && key->type == KE_KEY) { 790 if (key && key->type == KE_KEY) {
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index a3ac4456e0b1..fcd005aad989 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -763,7 +763,8 @@ static inline int qeth_get_micros(void)
763 763
764static inline int qeth_get_ip_version(struct sk_buff *skb) 764static inline int qeth_get_ip_version(struct sk_buff *skb)
765{ 765{
766 switch (skb->protocol) { 766 struct ethhdr *ehdr = (struct ethhdr *)skb->data;
767 switch (ehdr->h_proto) {
767 case ETH_P_IPV6: 768 case ETH_P_IPV6:
768 return 6; 769 return 6;
769 case ETH_P_IP: 770 case ETH_P_IP:
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 7d25bdd443cd..3bd4206f3470 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -537,7 +537,8 @@ static void qeth_send_control_data_cb(struct qeth_channel *channel,
537 dev_err(&card->gdev->dev, 537 dev_err(&card->gdev->dev,
538 "The qeth device is not configured " 538 "The qeth device is not configured "
539 "for the OSI layer required by z/VM\n"); 539 "for the OSI layer required by z/VM\n");
540 qeth_schedule_recovery(card); 540 else
541 qeth_schedule_recovery(card);
541 goto out; 542 goto out;
542 } 543 }
543 544
@@ -1113,8 +1114,6 @@ static int qeth_setup_card(struct qeth_card *card)
1113 card->ipato.enabled = 0; 1114 card->ipato.enabled = 0;
1114 card->ipato.invert4 = 0; 1115 card->ipato.invert4 = 0;
1115 card->ipato.invert6 = 0; 1116 card->ipato.invert6 = 0;
1116 if (card->info.type == QETH_CARD_TYPE_IQD)
1117 card->options.checksum_type = NO_CHECKSUMMING;
1118 /* init QDIO stuff */ 1117 /* init QDIO stuff */
1119 qeth_init_qdio_info(card); 1118 qeth_init_qdio_info(card);
1120 return 0; 1119 return 0;
diff --git a/drivers/s390/net/qeth_core_sys.c b/drivers/s390/net/qeth_core_sys.c
index 88ae4357136a..25dfd5abd19b 100644
--- a/drivers/s390/net/qeth_core_sys.c
+++ b/drivers/s390/net/qeth_core_sys.c
@@ -8,6 +8,9 @@
8 * Frank Blaschka <frank.blaschka@de.ibm.com> 8 * Frank Blaschka <frank.blaschka@de.ibm.com>
9 */ 9 */
10 10
11#define KMSG_COMPONENT "qeth"
12#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
13
11#include <linux/list.h> 14#include <linux/list.h>
12#include <linux/rwsem.h> 15#include <linux/rwsem.h>
13#include <asm/ebcdic.h> 16#include <asm/ebcdic.h>
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 51fde6f2e0b8..6f1e3036bafd 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -1071,11 +1071,9 @@ static int qeth_l2_recover(void *ptr)
1071 dev_info(&card->gdev->dev, 1071 dev_info(&card->gdev->dev,
1072 "Device successfully recovered!\n"); 1072 "Device successfully recovered!\n");
1073 else { 1073 else {
1074 if (card->dev) { 1074 rtnl_lock();
1075 rtnl_lock(); 1075 dev_close(card->dev);
1076 dev_close(card->dev); 1076 rtnl_unlock();
1077 rtnl_unlock();
1078 }
1079 dev_warn(&card->gdev->dev, "The qeth device driver " 1077 dev_warn(&card->gdev->dev, "The qeth device driver "
1080 "failed to recover an error on the device\n"); 1078 "failed to recover an error on the device\n");
1081 } 1079 }
@@ -1129,11 +1127,9 @@ static int qeth_l2_pm_resume(struct ccwgroup_device *gdev)
1129 if (card->state == CARD_STATE_RECOVER) { 1127 if (card->state == CARD_STATE_RECOVER) {
1130 rc = __qeth_l2_set_online(card->gdev, 1); 1128 rc = __qeth_l2_set_online(card->gdev, 1);
1131 if (rc) { 1129 if (rc) {
1132 if (card->dev) { 1130 rtnl_lock();
1133 rtnl_lock(); 1131 dev_close(card->dev);
1134 dev_close(card->dev); 1132 rtnl_unlock();
1135 rtnl_unlock();
1136 }
1137 } 1133 }
1138 } else 1134 } else
1139 rc = __qeth_l2_set_online(card->gdev, 0); 1135 rc = __qeth_l2_set_online(card->gdev, 0);
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 5475834ab916..b3b6e872d806 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -1691,39 +1691,43 @@ qeth_diags_trace_cb(struct qeth_card *card, struct qeth_reply *reply,
1691 1691
1692 cmd = (struct qeth_ipa_cmd *)data; 1692 cmd = (struct qeth_ipa_cmd *)data;
1693 rc = cmd->hdr.return_code; 1693 rc = cmd->hdr.return_code;
1694 if (rc) { 1694 if (rc)
1695 QETH_DBF_TEXT_(TRACE, 2, "dxter%x", rc); 1695 QETH_DBF_TEXT_(TRACE, 2, "dxter%x", rc);
1696 if (cmd->data.diagass.action == QETH_DIAGS_CMD_TRACE_ENABLE) {
1697 switch (rc) {
1698 case IPA_RC_HARDWARE_AUTH_ERROR:
1699 dev_warn(&card->gdev->dev, "The device is not "
1700 "authorized to run as a HiperSockets "
1701 "network traffic analyzer\n");
1702 break;
1703 case IPA_RC_TRACE_ALREADY_ACTIVE:
1704 dev_warn(&card->gdev->dev, "A HiperSockets "
1705 "network traffic analyzer is already "
1706 "active in the HiperSockets LAN\n");
1707 break;
1708 default:
1709 break;
1710 }
1711 }
1712 return 0;
1713 }
1714
1715 switch (cmd->data.diagass.action) { 1696 switch (cmd->data.diagass.action) {
1716 case QETH_DIAGS_CMD_TRACE_QUERY: 1697 case QETH_DIAGS_CMD_TRACE_QUERY:
1717 break; 1698 break;
1718 case QETH_DIAGS_CMD_TRACE_DISABLE: 1699 case QETH_DIAGS_CMD_TRACE_DISABLE:
1719 card->info.promisc_mode = SET_PROMISC_MODE_OFF; 1700 switch (rc) {
1720 dev_info(&card->gdev->dev, "The HiperSockets network traffic " 1701 case 0:
1721 "analyzer is deactivated\n"); 1702 case IPA_RC_INVALID_SUBCMD:
1703 card->info.promisc_mode = SET_PROMISC_MODE_OFF;
1704 dev_info(&card->gdev->dev, "The HiperSockets network "
1705 "traffic analyzer is deactivated\n");
1706 break;
1707 default:
1708 break;
1709 }
1722 break; 1710 break;
1723 case QETH_DIAGS_CMD_TRACE_ENABLE: 1711 case QETH_DIAGS_CMD_TRACE_ENABLE:
1724 card->info.promisc_mode = SET_PROMISC_MODE_ON; 1712 switch (rc) {
1725 dev_info(&card->gdev->dev, "The HiperSockets network traffic " 1713 case 0:
1726 "analyzer is activated\n"); 1714 card->info.promisc_mode = SET_PROMISC_MODE_ON;
1715 dev_info(&card->gdev->dev, "The HiperSockets network "
1716 "traffic analyzer is activated\n");
1717 break;
1718 case IPA_RC_HARDWARE_AUTH_ERROR:
1719 dev_warn(&card->gdev->dev, "The device is not "
1720 "authorized to run as a HiperSockets network "
1721 "traffic analyzer\n");
1722 break;
1723 case IPA_RC_TRACE_ALREADY_ACTIVE:
1724 dev_warn(&card->gdev->dev, "A HiperSockets "
1725 "network traffic analyzer is already "
1726 "active in the HiperSockets LAN\n");
1727 break;
1728 default:
1729 break;
1730 }
1727 break; 1731 break;
1728 default: 1732 default:
1729 QETH_DBF_MESSAGE(2, "Unknown sniffer action (0x%04x) on %s\n", 1733 QETH_DBF_MESSAGE(2, "Unknown sniffer action (0x%04x) on %s\n",
@@ -2215,11 +2219,9 @@ static int qeth_l3_stop_card(struct qeth_card *card, int recovery_mode)
2215 if (recovery_mode) 2219 if (recovery_mode)
2216 qeth_l3_stop(card->dev); 2220 qeth_l3_stop(card->dev);
2217 else { 2221 else {
2218 if (card->dev) { 2222 rtnl_lock();
2219 rtnl_lock(); 2223 dev_close(card->dev);
2220 dev_close(card->dev); 2224 rtnl_unlock();
2221 rtnl_unlock();
2222 }
2223 } 2225 }
2224 if (!card->use_hard_stop) { 2226 if (!card->use_hard_stop) {
2225 rc = qeth_send_stoplan(card); 2227 rc = qeth_send_stoplan(card);
@@ -2900,10 +2902,8 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
2900 int data_offset = -1; 2902 int data_offset = -1;
2901 int nr_frags; 2903 int nr_frags;
2902 2904
2903 if ((card->info.type == QETH_CARD_TYPE_IQD) && 2905 if (((card->info.type == QETH_CARD_TYPE_IQD) && (!ipv)) ||
2904 (((skb->protocol != htons(ETH_P_IPV6)) && 2906 card->options.sniffer)
2905 (skb->protocol != htons(ETH_P_IP))) ||
2906 card->options.sniffer))
2907 goto tx_drop; 2907 goto tx_drop;
2908 2908
2909 if ((card->state != CARD_STATE_UP) || !card->lan_online) { 2909 if ((card->state != CARD_STATE_UP) || !card->lan_online) {
@@ -2949,14 +2949,14 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
2949 if (data_offset < 0) 2949 if (data_offset < 0)
2950 skb_pull(new_skb, ETH_HLEN); 2950 skb_pull(new_skb, ETH_HLEN);
2951 } else { 2951 } else {
2952 if (new_skb->protocol == htons(ETH_P_IP)) { 2952 if (ipv == 4) {
2953 if (card->dev->type == ARPHRD_IEEE802_TR) 2953 if (card->dev->type == ARPHRD_IEEE802_TR)
2954 skb_pull(new_skb, TR_HLEN); 2954 skb_pull(new_skb, TR_HLEN);
2955 else 2955 else
2956 skb_pull(new_skb, ETH_HLEN); 2956 skb_pull(new_skb, ETH_HLEN);
2957 } 2957 }
2958 2958
2959 if (new_skb->protocol == ETH_P_IPV6 && card->vlangrp && 2959 if (ipv == 6 && card->vlangrp &&
2960 vlan_tx_tag_present(new_skb)) { 2960 vlan_tx_tag_present(new_skb)) {
2961 skb_push(new_skb, VLAN_HLEN); 2961 skb_push(new_skb, VLAN_HLEN);
2962 skb_copy_to_linear_data(new_skb, new_skb->data + 4, 4); 2962 skb_copy_to_linear_data(new_skb, new_skb->data + 4, 4);
@@ -3534,11 +3534,9 @@ static int qeth_l3_pm_resume(struct ccwgroup_device *gdev)
3534 if (card->state == CARD_STATE_RECOVER) { 3534 if (card->state == CARD_STATE_RECOVER) {
3535 rc = __qeth_l3_set_online(card->gdev, 1); 3535 rc = __qeth_l3_set_online(card->gdev, 1);
3536 if (rc) { 3536 if (rc) {
3537 if (card->dev) { 3537 rtnl_lock();
3538 rtnl_lock(); 3538 dev_close(card->dev);
3539 dev_close(card->dev); 3539 rtnl_unlock();
3540 rtnl_unlock();
3541 }
3542 } 3540 }
3543 } else 3541 } else
3544 rc = __qeth_l3_set_online(card->gdev, 0); 3542 rc = __qeth_l3_set_online(card->gdev, 0);
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index fa34b92850a6..1b8217076b0e 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -738,7 +738,7 @@ static int __devinit qpti_register_irq(struct qlogicpti *qpti)
738 * sanely maintain. 738 * sanely maintain.
739 */ 739 */
740 if (request_irq(qpti->irq, qpti_intr, 740 if (request_irq(qpti->irq, qpti_intr,
741 IRQF_SHARED, "Qlogic/PTI", qpti)) 741 IRQF_SHARED, "QlogicPTI", qpti))
742 goto fail; 742 goto fail;
743 743
744 printk("qlogicpti%d: IRQ %d ", qpti->qpti_id, qpti->irq); 744 printk("qlogicpti%d: IRQ %d ", qpti->qpti_id, qpti->irq);
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 1c60053439a9..4be9b4832c55 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -912,6 +912,18 @@ config FB_XVR2500
912 mostly initialized the card already. It is treated as a 912 mostly initialized the card already. It is treated as a
913 completely dumb framebuffer device. 913 completely dumb framebuffer device.
914 914
915config FB_XVR1000
916 bool "Sun XVR-1000 support"
917 depends on SPARC64
918 select FB_CFB_FILLRECT
919 select FB_CFB_COPYAREA
920 select FB_CFB_IMAGEBLIT
921 help
922 This is the framebuffer device for the Sun XVR-1000 and similar
923 graphics cards. The driver only works on sparc64 systems where
924 the system firmware has mostly initialized the card already. It
925 is treated as a completely dumb framebuffer device.
926
915config FB_PVR2 927config FB_PVR2
916 tristate "NEC PowerVR 2 display support" 928 tristate "NEC PowerVR 2 display support"
917 depends on FB && SH_DREAMCAST 929 depends on FB && SH_DREAMCAST
@@ -1869,7 +1881,7 @@ config FB_W100
1869 1881
1870config FB_SH_MOBILE_LCDC 1882config FB_SH_MOBILE_LCDC
1871 tristate "SuperH Mobile LCDC framebuffer support" 1883 tristate "SuperH Mobile LCDC framebuffer support"
1872 depends on FB && SUPERH && HAVE_CLK 1884 depends on FB && (SUPERH || ARCH_SHMOBILE) && HAVE_CLK
1873 select FB_SYS_FILLRECT 1885 select FB_SYS_FILLRECT
1874 select FB_SYS_COPYAREA 1886 select FB_SYS_COPYAREA
1875 select FB_SYS_IMAGEBLIT 1887 select FB_SYS_IMAGEBLIT
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index a42ad55e3a15..ddc2af2ba45b 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -79,6 +79,7 @@ obj-$(CONFIG_FB_N411) += n411.o
79obj-$(CONFIG_FB_HGA) += hgafb.o 79obj-$(CONFIG_FB_HGA) += hgafb.o
80obj-$(CONFIG_FB_XVR500) += sunxvr500.o 80obj-$(CONFIG_FB_XVR500) += sunxvr500.o
81obj-$(CONFIG_FB_XVR2500) += sunxvr2500.o 81obj-$(CONFIG_FB_XVR2500) += sunxvr2500.o
82obj-$(CONFIG_FB_XVR1000) += sunxvr1000.o
82obj-$(CONFIG_FB_IGA) += igafb.o 83obj-$(CONFIG_FB_IGA) += igafb.o
83obj-$(CONFIG_FB_APOLLO) += dnfb.o 84obj-$(CONFIG_FB_APOLLO) += dnfb.o
84obj-$(CONFIG_FB_Q40) += q40fb.o 85obj-$(CONFIG_FB_Q40) += q40fb.o
diff --git a/drivers/video/sunxvr1000.c b/drivers/video/sunxvr1000.c
new file mode 100644
index 000000000000..a8248c0b9192
--- /dev/null
+++ b/drivers/video/sunxvr1000.c
@@ -0,0 +1,228 @@
1/* sunxvr1000.c: Sun XVR-1000 driver for sparc64 systems
2 *
3 * Copyright (C) 2010 David S. Miller (davem@davemloft.net)
4 */
5
6#include <linux/module.h>
7#include <linux/kernel.h>
8#include <linux/slab.h>
9#include <linux/fb.h>
10#include <linux/init.h>
11#include <linux/of_device.h>
12
13struct gfb_info {
14 struct fb_info *info;
15
16 char __iomem *fb_base;
17 unsigned long fb_base_phys;
18
19 struct device_node *of_node;
20
21 unsigned int width;
22 unsigned int height;
23 unsigned int depth;
24 unsigned int fb_size;
25
26 u32 pseudo_palette[16];
27};
28
29static int __devinit gfb_get_props(struct gfb_info *gp)
30{
31 gp->width = of_getintprop_default(gp->of_node, "width", 0);
32 gp->height = of_getintprop_default(gp->of_node, "height", 0);
33 gp->depth = of_getintprop_default(gp->of_node, "depth", 32);
34
35 if (!gp->width || !gp->height) {
36 printk(KERN_ERR "gfb: Critical properties missing for %s\n",
37 gp->of_node->full_name);
38 return -EINVAL;
39 }
40
41 return 0;
42}
43
44static int gfb_setcolreg(unsigned regno,
45 unsigned red, unsigned green, unsigned blue,
46 unsigned transp, struct fb_info *info)
47{
48 u32 value;
49
50 if (regno < 16) {
51 red >>= 8;
52 green >>= 8;
53 blue >>= 8;
54
55 value = (blue << 16) | (green << 8) | red;
56 ((u32 *)info->pseudo_palette)[regno] = value;
57 }
58
59 return 0;
60}
61
62static struct fb_ops gfb_ops = {
63 .owner = THIS_MODULE,
64 .fb_setcolreg = gfb_setcolreg,
65 .fb_fillrect = cfb_fillrect,
66 .fb_copyarea = cfb_copyarea,
67 .fb_imageblit = cfb_imageblit,
68};
69
70static int __devinit gfb_set_fbinfo(struct gfb_info *gp)
71{
72 struct fb_info *info = gp->info;
73 struct fb_var_screeninfo *var = &info->var;
74
75 info->flags = FBINFO_DEFAULT;
76 info->fbops = &gfb_ops;
77 info->screen_base = gp->fb_base;
78 info->screen_size = gp->fb_size;
79
80 info->pseudo_palette = gp->pseudo_palette;
81
82 /* Fill fix common fields */
83 strlcpy(info->fix.id, "gfb", sizeof(info->fix.id));
84 info->fix.smem_start = gp->fb_base_phys;
85 info->fix.smem_len = gp->fb_size;
86 info->fix.type = FB_TYPE_PACKED_PIXELS;
87 if (gp->depth == 32 || gp->depth == 24)
88 info->fix.visual = FB_VISUAL_TRUECOLOR;
89 else
90 info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
91
92 var->xres = gp->width;
93 var->yres = gp->height;
94 var->xres_virtual = var->xres;
95 var->yres_virtual = var->yres;
96 var->bits_per_pixel = gp->depth;
97
98 var->red.offset = 0;
99 var->red.length = 8;
100 var->green.offset = 8;
101 var->green.length = 8;
102 var->blue.offset = 16;
103 var->blue.length = 8;
104 var->transp.offset = 0;
105 var->transp.length = 0;
106
107 if (fb_alloc_cmap(&info->cmap, 256, 0)) {
108 printk(KERN_ERR "gfb: Cannot allocate color map.\n");
109 return -ENOMEM;
110 }
111
112 return 0;
113}
114
115static int __devinit gfb_probe(struct of_device *op,
116 const struct of_device_id *match)
117{
118 struct device_node *dp = op->node;
119 struct fb_info *info;
120 struct gfb_info *gp;
121 int err;
122
123 info = framebuffer_alloc(sizeof(struct gfb_info), &op->dev);
124 if (!info) {
125 printk(KERN_ERR "gfb: Cannot allocate fb_info\n");
126 err = -ENOMEM;
127 goto err_out;
128 }
129
130 gp = info->par;
131 gp->info = info;
132 gp->of_node = dp;
133
134 gp->fb_base_phys = op->resource[6].start;
135
136 err = gfb_get_props(gp);
137 if (err)
138 goto err_release_fb;
139
140 /* Framebuffer length is the same regardless of resolution. */
141 info->fix.line_length = 16384;
142 gp->fb_size = info->fix.line_length * gp->height;
143
144 gp->fb_base = of_ioremap(&op->resource[6], 0,
145 gp->fb_size, "gfb fb");
146 if (!gp->fb_base)
147 goto err_release_fb;
148
149 err = gfb_set_fbinfo(gp);
150 if (err)
151 goto err_unmap_fb;
152
153 printk("gfb: Found device at %s\n", dp->full_name);
154
155 err = register_framebuffer(info);
156 if (err < 0) {
157 printk(KERN_ERR "gfb: Could not register framebuffer %s\n",
158 dp->full_name);
159 goto err_unmap_fb;
160 }
161
162 dev_set_drvdata(&op->dev, info);
163
164 return 0;
165
166err_unmap_fb:
167 of_iounmap(&op->resource[6], gp->fb_base, gp->fb_size);
168
169err_release_fb:
170 framebuffer_release(info);
171
172err_out:
173 return err;
174}
175
176static int __devexit gfb_remove(struct of_device *op)
177{
178 struct fb_info *info = dev_get_drvdata(&op->dev);
179 struct gfb_info *gp = info->par;
180
181 unregister_framebuffer(info);
182
183 iounmap(gp->fb_base);
184
185 of_iounmap(&op->resource[6], gp->fb_base, gp->fb_size);
186
187 framebuffer_release(info);
188
189 dev_set_drvdata(&op->dev, NULL);
190
191 return 0;
192}
193
194static const struct of_device_id gfb_match[] = {
195 {
196 .name = "SUNW,gfb",
197 },
198 {},
199};
200MODULE_DEVICE_TABLE(of, ffb_match);
201
202static struct of_platform_driver gfb_driver = {
203 .name = "gfb",
204 .match_table = gfb_match,
205 .probe = gfb_probe,
206 .remove = __devexit_p(gfb_remove),
207};
208
209static int __init gfb_init(void)
210{
211 if (fb_get_options("gfb", NULL))
212 return -ENODEV;
213
214 return of_register_driver(&gfb_driver, &of_bus_type);
215}
216
217static void __exit gfb_exit(void)
218{
219 of_unregister_driver(&gfb_driver);
220}
221
222module_init(gfb_init);
223module_exit(gfb_exit);
224
225MODULE_DESCRIPTION("framebuffer driver for Sun XVR-1000 graphics");
226MODULE_AUTHOR("David S. Miller <davem@davemloft.net>");
227MODULE_VERSION("1.0");
228MODULE_LICENSE("GPL");