diff options
158 files changed, 4045 insertions, 830 deletions
diff --git a/Documentation/ABI/testing/sysfs-platform-at91 b/Documentation/ABI/testing/sysfs-platform-at91 new file mode 100644 index 00000000000..4cc6a865ae6 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-platform-at91 | |||
@@ -0,0 +1,25 @@ | |||
1 | What: /sys/devices/platform/at91_can/net/<iface>/mb0_id | ||
2 | Date: January 2011 | ||
3 | KernelVersion: 2.6.38 | ||
4 | Contact: Marc Kleine-Budde <kernel@pengutronix.de> | ||
5 | Description: | ||
6 | Value representing the can_id of mailbox 0. | ||
7 | |||
8 | Default: 0x7ff (standard frame) | ||
9 | |||
10 | Due to a chip bug (errata 50.2.6.3 & 50.3.5.3 in | ||
11 | "AT91SAM9263 Preliminary 6249H-ATARM-27-Jul-09") the | ||
12 | contents of mailbox 0 may be send under certain | ||
13 | conditions (even if disabled or in rx mode). | ||
14 | |||
15 | The workaround in the errata suggests not to use the | ||
16 | mailbox and load it with an unused identifier. | ||
17 | |||
18 | In order to use an extended can_id add the | ||
19 | CAN_EFF_FLAG (0x80000000U) to the can_id. Example: | ||
20 | |||
21 | - standard id 0x7ff: | ||
22 | echo 0x7ff > /sys/class/net/can0/mb0_id | ||
23 | |||
24 | - extended id 0x1fffffff: | ||
25 | echo 0x9fffffff > /sys/class/net/can0/mb0_id | ||
diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt index 5dc638791d9..25d2f4141d2 100644 --- a/Documentation/networking/bonding.txt +++ b/Documentation/networking/bonding.txt | |||
@@ -49,7 +49,8 @@ Table of Contents | |||
49 | 3.3 Configuring Bonding Manually with Ifenslave | 49 | 3.3 Configuring Bonding Manually with Ifenslave |
50 | 3.3.1 Configuring Multiple Bonds Manually | 50 | 3.3.1 Configuring Multiple Bonds Manually |
51 | 3.4 Configuring Bonding Manually via Sysfs | 51 | 3.4 Configuring Bonding Manually via Sysfs |
52 | 3.5 Overriding Configuration for Special Cases | 52 | 3.5 Configuration with Interfaces Support |
53 | 3.6 Overriding Configuration for Special Cases | ||
53 | 54 | ||
54 | 4. Querying Bonding Configuration | 55 | 4. Querying Bonding Configuration |
55 | 4.1 Bonding Configuration | 56 | 4.1 Bonding Configuration |
@@ -161,8 +162,8 @@ onwards) do not have /usr/include/linux symbolically linked to the | |||
161 | default kernel source include directory. | 162 | default kernel source include directory. |
162 | 163 | ||
163 | SECOND IMPORTANT NOTE: | 164 | SECOND IMPORTANT NOTE: |
164 | If you plan to configure bonding using sysfs, you do not need | 165 | If you plan to configure bonding using sysfs or using the |
165 | to use ifenslave. | 166 | /etc/network/interfaces file, you do not need to use ifenslave. |
166 | 167 | ||
167 | 2. Bonding Driver Options | 168 | 2. Bonding Driver Options |
168 | ========================= | 169 | ========================= |
@@ -779,22 +780,26 @@ resend_igmp | |||
779 | 780 | ||
780 | You can configure bonding using either your distro's network | 781 | You can configure bonding using either your distro's network |
781 | initialization scripts, or manually using either ifenslave or the | 782 | initialization scripts, or manually using either ifenslave or the |
782 | sysfs interface. Distros generally use one of two packages for the | 783 | sysfs interface. Distros generally use one of three packages for the |
783 | network initialization scripts: initscripts or sysconfig. Recent | 784 | network initialization scripts: initscripts, sysconfig or interfaces. |
784 | versions of these packages have support for bonding, while older | 785 | Recent versions of these packages have support for bonding, while older |
785 | versions do not. | 786 | versions do not. |
786 | 787 | ||
787 | We will first describe the options for configuring bonding for | 788 | We will first describe the options for configuring bonding for |
788 | distros using versions of initscripts and sysconfig with full or | 789 | distros using versions of initscripts, sysconfig and interfaces with full |
789 | partial support for bonding, then provide information on enabling | 790 | or partial support for bonding, then provide information on enabling |
790 | bonding without support from the network initialization scripts (i.e., | 791 | bonding without support from the network initialization scripts (i.e., |
791 | older versions of initscripts or sysconfig). | 792 | older versions of initscripts or sysconfig). |
792 | 793 | ||
793 | If you're unsure whether your distro uses sysconfig or | 794 | If you're unsure whether your distro uses sysconfig, |
794 | initscripts, or don't know if it's new enough, have no fear. | 795 | initscripts or interfaces, or don't know if it's new enough, have no fear. |
795 | Determining this is fairly straightforward. | 796 | Determining this is fairly straightforward. |
796 | 797 | ||
797 | First, issue the command: | 798 | First, look for a file called interfaces in /etc/network directory. |
799 | If this file is present in your system, then your system use interfaces. See | ||
800 | Configuration with Interfaces Support. | ||
801 | |||
802 | Else, issue the command: | ||
798 | 803 | ||
799 | $ rpm -qf /sbin/ifup | 804 | $ rpm -qf /sbin/ifup |
800 | 805 | ||
@@ -1327,8 +1332,62 @@ echo 2000 > /sys/class/net/bond1/bonding/arp_interval | |||
1327 | echo +eth2 > /sys/class/net/bond1/bonding/slaves | 1332 | echo +eth2 > /sys/class/net/bond1/bonding/slaves |
1328 | echo +eth3 > /sys/class/net/bond1/bonding/slaves | 1333 | echo +eth3 > /sys/class/net/bond1/bonding/slaves |
1329 | 1334 | ||
1330 | 3.5 Overriding Configuration for Special Cases | 1335 | 3.5 Configuration with Interfaces Support |
1336 | ----------------------------------------- | ||
1337 | |||
1338 | This section applies to distros which use /etc/network/interfaces file | ||
1339 | to describe network interface configuration, most notably Debian and it's | ||
1340 | derivatives. | ||
1341 | |||
1342 | The ifup and ifdown commands on Debian don't support bonding out of | ||
1343 | the box. The ifenslave-2.6 package should be installed to provide bonding | ||
1344 | support. Once installed, this package will provide bond-* options to be used | ||
1345 | into /etc/network/interfaces. | ||
1346 | |||
1347 | Note that ifenslave-2.6 package will load the bonding module and use | ||
1348 | the ifenslave command when appropriate. | ||
1349 | |||
1350 | Example Configurations | ||
1351 | ---------------------- | ||
1352 | |||
1353 | In /etc/network/interfaces, the following stanza will configure bond0, in | ||
1354 | active-backup mode, with eth0 and eth1 as slaves. | ||
1355 | |||
1356 | auto bond0 | ||
1357 | iface bond0 inet dhcp | ||
1358 | bond-slaves eth0 eth1 | ||
1359 | bond-mode active-backup | ||
1360 | bond-miimon 100 | ||
1361 | bond-primary eth0 eth1 | ||
1362 | |||
1363 | If the above configuration doesn't work, you might have a system using | ||
1364 | upstart for system startup. This is most notably true for recent | ||
1365 | Ubuntu versions. The following stanza in /etc/network/interfaces will | ||
1366 | produce the same result on those systems. | ||
1367 | |||
1368 | auto bond0 | ||
1369 | iface bond0 inet dhcp | ||
1370 | bond-slaves none | ||
1371 | bond-mode active-backup | ||
1372 | bond-miimon 100 | ||
1373 | |||
1374 | auto eth0 | ||
1375 | iface eth0 inet manual | ||
1376 | bond-master bond0 | ||
1377 | bond-primary eth0 eth1 | ||
1378 | |||
1379 | auto eth1 | ||
1380 | iface eth1 inet manual | ||
1381 | bond-master bond0 | ||
1382 | bond-primary eth0 eth1 | ||
1383 | |||
1384 | For a full list of bond-* supported options in /etc/network/interfaces and some | ||
1385 | more advanced examples tailored to you particular distros, see the files in | ||
1386 | /usr/share/doc/ifenslave-2.6. | ||
1387 | |||
1388 | 3.6 Overriding Configuration for Special Cases | ||
1331 | ---------------------------------------------- | 1389 | ---------------------------------------------- |
1390 | |||
1332 | When using the bonding driver, the physical port which transmits a frame is | 1391 | When using the bonding driver, the physical port which transmits a frame is |
1333 | typically selected by the bonding driver, and is not relevant to the user or | 1392 | typically selected by the bonding driver, and is not relevant to the user or |
1334 | system administrator. The output port is simply selected using the policies of | 1393 | system administrator. The output port is simply selected using the policies of |
diff --git a/MAINTAINERS b/MAINTAINERS index cf0f3a5c09c..9d12977b6ba 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -3327,7 +3327,6 @@ F: drivers/net/wimax/i2400m/ | |||
3327 | F: include/linux/wimax/i2400m.h | 3327 | F: include/linux/wimax/i2400m.h |
3328 | 3328 | ||
3329 | INTEL WIRELESS WIFI LINK (iwlwifi) | 3329 | INTEL WIRELESS WIFI LINK (iwlwifi) |
3330 | M: Reinette Chatre <reinette.chatre@intel.com> | ||
3331 | M: Wey-Yi Guy <wey-yi.w.guy@intel.com> | 3330 | M: Wey-Yi Guy <wey-yi.w.guy@intel.com> |
3332 | M: Intel Linux Wireless <ilw@linux.intel.com> | 3331 | M: Intel Linux Wireless <ilw@linux.intel.com> |
3333 | L: linux-wireless@vger.kernel.org | 3332 | L: linux-wireless@vger.kernel.org |
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c index 9e5dc8ed51e..97feb3ab6a6 100644 --- a/arch/arm/mach-omap2/pm24xx.c +++ b/arch/arm/mach-omap2/pm24xx.c | |||
@@ -134,7 +134,7 @@ static void omap2_enter_full_retention(void) | |||
134 | 134 | ||
135 | /* Block console output in case it is on one of the OMAP UARTs */ | 135 | /* Block console output in case it is on one of the OMAP UARTs */ |
136 | if (!is_suspending()) | 136 | if (!is_suspending()) |
137 | if (try_acquire_console_sem()) | 137 | if (!console_trylock()) |
138 | goto no_sleep; | 138 | goto no_sleep; |
139 | 139 | ||
140 | omap_uart_prepare_idle(0); | 140 | omap_uart_prepare_idle(0); |
@@ -151,7 +151,7 @@ static void omap2_enter_full_retention(void) | |||
151 | omap_uart_resume_idle(0); | 151 | omap_uart_resume_idle(0); |
152 | 152 | ||
153 | if (!is_suspending()) | 153 | if (!is_suspending()) |
154 | release_console_sem(); | 154 | console_unlock(); |
155 | 155 | ||
156 | no_sleep: | 156 | no_sleep: |
157 | if (omap2_pm_debug) { | 157 | if (omap2_pm_debug) { |
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 8cbbeade4b8..a4aa1920a75 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
@@ -398,7 +398,7 @@ void omap_sram_idle(void) | |||
398 | if (!is_suspending()) | 398 | if (!is_suspending()) |
399 | if (per_next_state < PWRDM_POWER_ON || | 399 | if (per_next_state < PWRDM_POWER_ON || |
400 | core_next_state < PWRDM_POWER_ON) | 400 | core_next_state < PWRDM_POWER_ON) |
401 | if (try_acquire_console_sem()) | 401 | if (!console_trylock()) |
402 | goto console_still_active; | 402 | goto console_still_active; |
403 | 403 | ||
404 | /* PER */ | 404 | /* PER */ |
@@ -481,7 +481,7 @@ void omap_sram_idle(void) | |||
481 | } | 481 | } |
482 | 482 | ||
483 | if (!is_suspending()) | 483 | if (!is_suspending()) |
484 | release_console_sem(); | 484 | console_unlock(); |
485 | 485 | ||
486 | console_still_active: | 486 | console_still_active: |
487 | /* Disable IO-PAD and IO-CHAIN wakeup */ | 487 | /* Disable IO-PAD and IO-CHAIN wakeup */ |
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 302da7403a1..32e91a9c8b6 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c | |||
@@ -812,7 +812,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata) | |||
812 | 812 | ||
813 | oh->dev_attr = uart; | 813 | oh->dev_attr = uart; |
814 | 814 | ||
815 | acquire_console_sem(); /* in case the earlycon is on the UART */ | 815 | console_lock(); /* in case the earlycon is on the UART */ |
816 | 816 | ||
817 | /* | 817 | /* |
818 | * Because of early UART probing, UART did not get idled | 818 | * Because of early UART probing, UART did not get idled |
@@ -838,7 +838,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata) | |||
838 | omap_uart_block_sleep(uart); | 838 | omap_uart_block_sleep(uart); |
839 | uart->timeout = DEFAULT_TIMEOUT; | 839 | uart->timeout = DEFAULT_TIMEOUT; |
840 | 840 | ||
841 | release_console_sem(); | 841 | console_unlock(); |
842 | 842 | ||
843 | if ((cpu_is_omap34xx() && uart->padconf) || | 843 | if ((cpu_is_omap34xx() && uart->padconf) || |
844 | (uart->wk_en && uart->wk_mask)) { | 844 | (uart->wk_en && uart->wk_mask)) { |
diff --git a/arch/arm/mach-tegra/include/mach/kbc.h b/arch/arm/mach-tegra/include/mach/kbc.h new file mode 100644 index 00000000000..66ad2760c62 --- /dev/null +++ b/arch/arm/mach-tegra/include/mach/kbc.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * Platform definitions for tegra-kbc keyboard input driver | ||
3 | * | ||
4 | * Copyright (c) 2010-2011, NVIDIA Corporation. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
14 | * more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef ASMARM_ARCH_TEGRA_KBC_H | ||
22 | #define ASMARM_ARCH_TEGRA_KBC_H | ||
23 | |||
24 | #include <linux/types.h> | ||
25 | #include <linux/input/matrix_keypad.h> | ||
26 | |||
27 | #ifdef CONFIG_ARCH_TEGRA_2x_SOC | ||
28 | #define KBC_MAX_GPIO 24 | ||
29 | #define KBC_MAX_KPENT 8 | ||
30 | #else | ||
31 | #define KBC_MAX_GPIO 20 | ||
32 | #define KBC_MAX_KPENT 7 | ||
33 | #endif | ||
34 | |||
35 | #define KBC_MAX_ROW 16 | ||
36 | #define KBC_MAX_COL 8 | ||
37 | #define KBC_MAX_KEY (KBC_MAX_ROW * KBC_MAX_COL) | ||
38 | |||
39 | struct tegra_kbc_pin_cfg { | ||
40 | bool is_row; | ||
41 | unsigned char num; | ||
42 | }; | ||
43 | |||
44 | struct tegra_kbc_wake_key { | ||
45 | u8 row:4; | ||
46 | u8 col:4; | ||
47 | }; | ||
48 | |||
49 | struct tegra_kbc_platform_data { | ||
50 | unsigned int debounce_cnt; | ||
51 | unsigned int repeat_cnt; | ||
52 | |||
53 | unsigned int wake_cnt; /* 0:wake on any key >1:wake on wake_cfg */ | ||
54 | const struct tegra_kbc_wake_key *wake_cfg; | ||
55 | |||
56 | struct tegra_kbc_pin_cfg pin_cfg[KBC_MAX_GPIO]; | ||
57 | const struct matrix_keymap_data *keymap_data; | ||
58 | |||
59 | bool wakeup; | ||
60 | }; | ||
61 | #endif | ||
diff --git a/arch/avr32/include/asm/pgalloc.h b/arch/avr32/include/asm/pgalloc.h index 92ecd8446ef..bc7e8ae479e 100644 --- a/arch/avr32/include/asm/pgalloc.h +++ b/arch/avr32/include/asm/pgalloc.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #ifndef __ASM_AVR32_PGALLOC_H | 8 | #ifndef __ASM_AVR32_PGALLOC_H |
9 | #define __ASM_AVR32_PGALLOC_H | 9 | #define __ASM_AVR32_PGALLOC_H |
10 | 10 | ||
11 | #include <linux/mm.h> | ||
11 | #include <linux/quicklist.h> | 12 | #include <linux/quicklist.h> |
12 | #include <asm/page.h> | 13 | #include <asm/page.h> |
13 | #include <asm/pgtable.h> | 14 | #include <asm/pgtable.h> |
diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c index 11bdd68e576..fc770be465f 100644 --- a/arch/parisc/kernel/pdc_cons.c +++ b/arch/parisc/kernel/pdc_cons.c | |||
@@ -169,11 +169,11 @@ static int __init pdc_console_tty_driver_init(void) | |||
169 | 169 | ||
170 | struct console *tmp; | 170 | struct console *tmp; |
171 | 171 | ||
172 | acquire_console_sem(); | 172 | console_lock(); |
173 | for_each_console(tmp) | 173 | for_each_console(tmp) |
174 | if (tmp == &pdc_cons) | 174 | if (tmp == &pdc_cons) |
175 | break; | 175 | break; |
176 | release_console_sem(); | 176 | console_unlock(); |
177 | 177 | ||
178 | if (!tmp) { | 178 | if (!tmp) { |
179 | printk(KERN_INFO "PDC console driver not registered anymore, not creating %s\n", pdc_cons.name); | 179 | printk(KERN_INFO "PDC console driver not registered anymore, not creating %s\n", pdc_cons.name); |
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index 2071a8b2b32..ebbc4d8ab17 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h | |||
@@ -558,13 +558,12 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, | |||
558 | static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, | 558 | static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, |
559 | pmd_t *pmdp, pmd_t pmd) | 559 | pmd_t *pmdp, pmd_t pmd) |
560 | { | 560 | { |
561 | #if PAGETABLE_LEVELS >= 3 | ||
562 | if (sizeof(pmdval_t) > sizeof(long)) | 561 | if (sizeof(pmdval_t) > sizeof(long)) |
563 | /* 5 arg words */ | 562 | /* 5 arg words */ |
564 | pv_mmu_ops.set_pmd_at(mm, addr, pmdp, pmd); | 563 | pv_mmu_ops.set_pmd_at(mm, addr, pmdp, pmd); |
565 | else | 564 | else |
566 | PVOP_VCALL4(pv_mmu_ops.set_pmd_at, mm, addr, pmdp, pmd.pmd); | 565 | PVOP_VCALL4(pv_mmu_ops.set_pmd_at, mm, addr, pmdp, |
567 | #endif | 566 | native_pmd_val(pmd)); |
568 | } | 567 | } |
569 | #endif | 568 | #endif |
570 | 569 | ||
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index 3788f4649db..7e172955ee5 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h | |||
@@ -273,34 +273,34 @@ do { \ | |||
273 | typeof(var) pxo_new__ = (nval); \ | 273 | typeof(var) pxo_new__ = (nval); \ |
274 | switch (sizeof(var)) { \ | 274 | switch (sizeof(var)) { \ |
275 | case 1: \ | 275 | case 1: \ |
276 | asm("\n1:mov "__percpu_arg(1)",%%al" \ | 276 | asm("\n\tmov "__percpu_arg(1)",%%al" \ |
277 | "\n\tcmpxchgb %2, "__percpu_arg(1) \ | 277 | "\n1:\tcmpxchgb %2, "__percpu_arg(1) \ |
278 | "\n\tjnz 1b" \ | 278 | "\n\tjnz 1b" \ |
279 | : "=a" (pxo_ret__), "+m" (var) \ | 279 | : "=&a" (pxo_ret__), "+m" (var) \ |
280 | : "q" (pxo_new__) \ | 280 | : "q" (pxo_new__) \ |
281 | : "memory"); \ | 281 | : "memory"); \ |
282 | break; \ | 282 | break; \ |
283 | case 2: \ | 283 | case 2: \ |
284 | asm("\n1:mov "__percpu_arg(1)",%%ax" \ | 284 | asm("\n\tmov "__percpu_arg(1)",%%ax" \ |
285 | "\n\tcmpxchgw %2, "__percpu_arg(1) \ | 285 | "\n1:\tcmpxchgw %2, "__percpu_arg(1) \ |
286 | "\n\tjnz 1b" \ | 286 | "\n\tjnz 1b" \ |
287 | : "=a" (pxo_ret__), "+m" (var) \ | 287 | : "=&a" (pxo_ret__), "+m" (var) \ |
288 | : "r" (pxo_new__) \ | 288 | : "r" (pxo_new__) \ |
289 | : "memory"); \ | 289 | : "memory"); \ |
290 | break; \ | 290 | break; \ |
291 | case 4: \ | 291 | case 4: \ |
292 | asm("\n1:mov "__percpu_arg(1)",%%eax" \ | 292 | asm("\n\tmov "__percpu_arg(1)",%%eax" \ |
293 | "\n\tcmpxchgl %2, "__percpu_arg(1) \ | 293 | "\n1:\tcmpxchgl %2, "__percpu_arg(1) \ |
294 | "\n\tjnz 1b" \ | 294 | "\n\tjnz 1b" \ |
295 | : "=a" (pxo_ret__), "+m" (var) \ | 295 | : "=&a" (pxo_ret__), "+m" (var) \ |
296 | : "r" (pxo_new__) \ | 296 | : "r" (pxo_new__) \ |
297 | : "memory"); \ | 297 | : "memory"); \ |
298 | break; \ | 298 | break; \ |
299 | case 8: \ | 299 | case 8: \ |
300 | asm("\n1:mov "__percpu_arg(1)",%%rax" \ | 300 | asm("\n\tmov "__percpu_arg(1)",%%rax" \ |
301 | "\n\tcmpxchgq %2, "__percpu_arg(1) \ | 301 | "\n1:\tcmpxchgq %2, "__percpu_arg(1) \ |
302 | "\n\tjnz 1b" \ | 302 | "\n\tjnz 1b" \ |
303 | : "=a" (pxo_ret__), "+m" (var) \ | 303 | : "=&a" (pxo_ret__), "+m" (var) \ |
304 | : "r" (pxo_new__) \ | 304 | : "r" (pxo_new__) \ |
305 | : "memory"); \ | 305 | : "memory"); \ |
306 | break; \ | 306 | break; \ |
diff --git a/arch/x86/include/asm/system_64.h b/arch/x86/include/asm/system_64.h deleted file mode 100644 index 1159e091ad0..00000000000 --- a/arch/x86/include/asm/system_64.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | #ifndef _ASM_X86_SYSTEM_64_H | ||
2 | #define _ASM_X86_SYSTEM_64_H | ||
3 | |||
4 | #include <asm/segment.h> | ||
5 | #include <asm/cmpxchg.h> | ||
6 | |||
7 | |||
8 | static inline unsigned long read_cr8(void) | ||
9 | { | ||
10 | unsigned long cr8; | ||
11 | asm volatile("movq %%cr8,%0" : "=r" (cr8)); | ||
12 | return cr8; | ||
13 | } | ||
14 | |||
15 | static inline void write_cr8(unsigned long val) | ||
16 | { | ||
17 | asm volatile("movq %0,%%cr8" :: "r" (val) : "memory"); | ||
18 | } | ||
19 | |||
20 | #include <linux/irqflags.h> | ||
21 | |||
22 | #endif /* _ASM_X86_SYSTEM_64_H */ | ||
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c index 64101335de1..a6b6fcf7f0a 100644 --- a/arch/x86/kernel/dumpstack_64.c +++ b/arch/x86/kernel/dumpstack_64.c | |||
@@ -149,13 +149,13 @@ void dump_trace(struct task_struct *task, | |||
149 | unsigned used = 0; | 149 | unsigned used = 0; |
150 | struct thread_info *tinfo; | 150 | struct thread_info *tinfo; |
151 | int graph = 0; | 151 | int graph = 0; |
152 | unsigned long dummy; | ||
152 | unsigned long bp; | 153 | unsigned long bp; |
153 | 154 | ||
154 | if (!task) | 155 | if (!task) |
155 | task = current; | 156 | task = current; |
156 | 157 | ||
157 | if (!stack) { | 158 | if (!stack) { |
158 | unsigned long dummy; | ||
159 | stack = &dummy; | 159 | stack = &dummy; |
160 | if (task && task != current) | 160 | if (task && task != current) |
161 | stack = (unsigned long *)task->thread.sp; | 161 | stack = (unsigned long *)task->thread.sp; |
diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c index bca9cb89a11..487a5473985 100644 --- a/drivers/atm/idt77105.c +++ b/drivers/atm/idt77105.c | |||
@@ -151,7 +151,7 @@ static int fetch_stats(struct atm_dev *dev,struct idt77105_stats __user *arg,int | |||
151 | spin_unlock_irqrestore(&idt77105_priv_lock, flags); | 151 | spin_unlock_irqrestore(&idt77105_priv_lock, flags); |
152 | if (arg == NULL) | 152 | if (arg == NULL) |
153 | return 0; | 153 | return 0; |
154 | return copy_to_user(arg, &PRIV(dev)->stats, | 154 | return copy_to_user(arg, &stats, |
155 | sizeof(struct idt77105_stats)) ? -EFAULT : 0; | 155 | sizeof(struct idt77105_stats)) ? -EFAULT : 0; |
156 | } | 156 | } |
157 | 157 | ||
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 656493a5e07..42615b419df 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
@@ -407,12 +407,15 @@ static int rpm_suspend(struct device *dev, int rpmflags) | |||
407 | goto out; | 407 | goto out; |
408 | } | 408 | } |
409 | 409 | ||
410 | /* Maybe the parent is now able to suspend. */ | ||
410 | if (parent && !parent->power.ignore_children && !dev->power.irq_safe) { | 411 | if (parent && !parent->power.ignore_children && !dev->power.irq_safe) { |
411 | spin_unlock_irq(&dev->power.lock); | 412 | spin_unlock(&dev->power.lock); |
412 | 413 | ||
413 | pm_request_idle(parent); | 414 | spin_lock(&parent->power.lock); |
415 | rpm_idle(parent, RPM_ASYNC); | ||
416 | spin_unlock(&parent->power.lock); | ||
414 | 417 | ||
415 | spin_lock_irq(&dev->power.lock); | 418 | spin_lock(&dev->power.lock); |
416 | } | 419 | } |
417 | 420 | ||
418 | out: | 421 | out: |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index 949ed09c636..a126e614601 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -47,46 +47,40 @@ MODULE_DEVICE_TABLE(usb, ath3k_table); | |||
47 | #define USB_REQ_DFU_DNLOAD 1 | 47 | #define USB_REQ_DFU_DNLOAD 1 |
48 | #define BULK_SIZE 4096 | 48 | #define BULK_SIZE 4096 |
49 | 49 | ||
50 | struct ath3k_data { | 50 | static int ath3k_load_firmware(struct usb_device *udev, |
51 | struct usb_device *udev; | 51 | const struct firmware *firmware) |
52 | u8 *fw_data; | ||
53 | u32 fw_size; | ||
54 | u32 fw_sent; | ||
55 | }; | ||
56 | |||
57 | static int ath3k_load_firmware(struct ath3k_data *data, | ||
58 | unsigned char *firmware, | ||
59 | int count) | ||
60 | { | 52 | { |
61 | u8 *send_buf; | 53 | u8 *send_buf; |
62 | int err, pipe, len, size, sent = 0; | 54 | int err, pipe, len, size, sent = 0; |
55 | int count = firmware->size; | ||
63 | 56 | ||
64 | BT_DBG("ath3k %p udev %p", data, data->udev); | 57 | BT_DBG("udev %p", udev); |
65 | 58 | ||
66 | pipe = usb_sndctrlpipe(data->udev, 0); | 59 | pipe = usb_sndctrlpipe(udev, 0); |
67 | 60 | ||
68 | if ((usb_control_msg(data->udev, pipe, | 61 | send_buf = kmalloc(BULK_SIZE, GFP_ATOMIC); |
62 | if (!send_buf) { | ||
63 | BT_ERR("Can't allocate memory chunk for firmware"); | ||
64 | return -ENOMEM; | ||
65 | } | ||
66 | |||
67 | memcpy(send_buf, firmware->data, 20); | ||
68 | if ((err = usb_control_msg(udev, pipe, | ||
69 | USB_REQ_DFU_DNLOAD, | 69 | USB_REQ_DFU_DNLOAD, |
70 | USB_TYPE_VENDOR, 0, 0, | 70 | USB_TYPE_VENDOR, 0, 0, |
71 | firmware, 20, USB_CTRL_SET_TIMEOUT)) < 0) { | 71 | send_buf, 20, USB_CTRL_SET_TIMEOUT)) < 0) { |
72 | BT_ERR("Can't change to loading configuration err"); | 72 | BT_ERR("Can't change to loading configuration err"); |
73 | return -EBUSY; | 73 | goto error; |
74 | } | 74 | } |
75 | sent += 20; | 75 | sent += 20; |
76 | count -= 20; | 76 | count -= 20; |
77 | 77 | ||
78 | send_buf = kmalloc(BULK_SIZE, GFP_ATOMIC); | ||
79 | if (!send_buf) { | ||
80 | BT_ERR("Can't allocate memory chunk for firmware"); | ||
81 | return -ENOMEM; | ||
82 | } | ||
83 | |||
84 | while (count) { | 78 | while (count) { |
85 | size = min_t(uint, count, BULK_SIZE); | 79 | size = min_t(uint, count, BULK_SIZE); |
86 | pipe = usb_sndbulkpipe(data->udev, 0x02); | 80 | pipe = usb_sndbulkpipe(udev, 0x02); |
87 | memcpy(send_buf, firmware + sent, size); | 81 | memcpy(send_buf, firmware->data + sent, size); |
88 | 82 | ||
89 | err = usb_bulk_msg(data->udev, pipe, send_buf, size, | 83 | err = usb_bulk_msg(udev, pipe, send_buf, size, |
90 | &len, 3000); | 84 | &len, 3000); |
91 | 85 | ||
92 | if (err || (len != size)) { | 86 | if (err || (len != size)) { |
@@ -112,57 +106,28 @@ static int ath3k_probe(struct usb_interface *intf, | |||
112 | { | 106 | { |
113 | const struct firmware *firmware; | 107 | const struct firmware *firmware; |
114 | struct usb_device *udev = interface_to_usbdev(intf); | 108 | struct usb_device *udev = interface_to_usbdev(intf); |
115 | struct ath3k_data *data; | ||
116 | int size; | ||
117 | 109 | ||
118 | BT_DBG("intf %p id %p", intf, id); | 110 | BT_DBG("intf %p id %p", intf, id); |
119 | 111 | ||
120 | if (intf->cur_altsetting->desc.bInterfaceNumber != 0) | 112 | if (intf->cur_altsetting->desc.bInterfaceNumber != 0) |
121 | return -ENODEV; | 113 | return -ENODEV; |
122 | 114 | ||
123 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
124 | if (!data) | ||
125 | return -ENOMEM; | ||
126 | |||
127 | data->udev = udev; | ||
128 | |||
129 | if (request_firmware(&firmware, "ath3k-1.fw", &udev->dev) < 0) { | 115 | if (request_firmware(&firmware, "ath3k-1.fw", &udev->dev) < 0) { |
130 | kfree(data); | ||
131 | return -EIO; | 116 | return -EIO; |
132 | } | 117 | } |
133 | 118 | ||
134 | size = max_t(uint, firmware->size, 4096); | 119 | if (ath3k_load_firmware(udev, firmware)) { |
135 | data->fw_data = kmalloc(size, GFP_KERNEL); | ||
136 | if (!data->fw_data) { | ||
137 | release_firmware(firmware); | 120 | release_firmware(firmware); |
138 | kfree(data); | ||
139 | return -ENOMEM; | ||
140 | } | ||
141 | |||
142 | memcpy(data->fw_data, firmware->data, firmware->size); | ||
143 | data->fw_size = firmware->size; | ||
144 | data->fw_sent = 0; | ||
145 | release_firmware(firmware); | ||
146 | |||
147 | usb_set_intfdata(intf, data); | ||
148 | if (ath3k_load_firmware(data, data->fw_data, data->fw_size)) { | ||
149 | usb_set_intfdata(intf, NULL); | ||
150 | kfree(data->fw_data); | ||
151 | kfree(data); | ||
152 | return -EIO; | 121 | return -EIO; |
153 | } | 122 | } |
123 | release_firmware(firmware); | ||
154 | 124 | ||
155 | return 0; | 125 | return 0; |
156 | } | 126 | } |
157 | 127 | ||
158 | static void ath3k_disconnect(struct usb_interface *intf) | 128 | static void ath3k_disconnect(struct usb_interface *intf) |
159 | { | 129 | { |
160 | struct ath3k_data *data = usb_get_intfdata(intf); | ||
161 | |||
162 | BT_DBG("ath3k_disconnect intf %p", intf); | 130 | BT_DBG("ath3k_disconnect intf %p", intf); |
163 | |||
164 | kfree(data->fw_data); | ||
165 | kfree(data); | ||
166 | } | 131 | } |
167 | 132 | ||
168 | static struct usb_driver ath3k_driver = { | 133 | static struct usb_driver ath3k_driver = { |
diff --git a/drivers/char/bfin_jtag_comm.c b/drivers/char/bfin_jtag_comm.c index e397df3ad98..16402445f2b 100644 --- a/drivers/char/bfin_jtag_comm.c +++ b/drivers/char/bfin_jtag_comm.c | |||
@@ -183,16 +183,16 @@ bfin_jc_circ_write(const unsigned char *buf, int count) | |||
183 | } | 183 | } |
184 | 184 | ||
185 | #ifndef CONFIG_BFIN_JTAG_COMM_CONSOLE | 185 | #ifndef CONFIG_BFIN_JTAG_COMM_CONSOLE |
186 | # define acquire_console_sem() | 186 | # define console_lock() |
187 | # define release_console_sem() | 187 | # define console_unlock() |
188 | #endif | 188 | #endif |
189 | static int | 189 | static int |
190 | bfin_jc_write(struct tty_struct *tty, const unsigned char *buf, int count) | 190 | bfin_jc_write(struct tty_struct *tty, const unsigned char *buf, int count) |
191 | { | 191 | { |
192 | int i; | 192 | int i; |
193 | acquire_console_sem(); | 193 | console_lock(); |
194 | i = bfin_jc_circ_write(buf, count); | 194 | i = bfin_jc_circ_write(buf, count); |
195 | release_console_sem(); | 195 | console_unlock(); |
196 | wake_up_process(bfin_jc_kthread); | 196 | wake_up_process(bfin_jc_kthread); |
197 | return i; | 197 | return i; |
198 | } | 198 | } |
diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c index 01b886e6882..79c47e88d5d 100644 --- a/drivers/clocksource/tcb_clksrc.c +++ b/drivers/clocksource/tcb_clksrc.c | |||
@@ -196,9 +196,9 @@ static void __init setup_clkevents(struct atmel_tc *tc, int clk32k_divisor_idx) | |||
196 | clkevt.clkevt.min_delta_ns = clockevent_delta2ns(1, &clkevt.clkevt) + 1; | 196 | clkevt.clkevt.min_delta_ns = clockevent_delta2ns(1, &clkevt.clkevt) + 1; |
197 | clkevt.clkevt.cpumask = cpumask_of(0); | 197 | clkevt.clkevt.cpumask = cpumask_of(0); |
198 | 198 | ||
199 | setup_irq(irq, &tc_irqaction); | ||
200 | |||
201 | clockevents_register_device(&clkevt.clkevt); | 199 | clockevents_register_device(&clkevt.clkevt); |
200 | |||
201 | setup_irq(irq, &tc_irqaction); | ||
202 | } | 202 | } |
203 | 203 | ||
204 | #else /* !CONFIG_GENERIC_CLOCKEVENTS */ | 204 | #else /* !CONFIG_GENERIC_CLOCKEVENTS */ |
diff --git a/drivers/gpio/langwell_gpio.c b/drivers/gpio/langwell_gpio.c index d81cc748e77..54d70a47afc 100644 --- a/drivers/gpio/langwell_gpio.c +++ b/drivers/gpio/langwell_gpio.c | |||
@@ -187,7 +187,7 @@ MODULE_DEVICE_TABLE(pci, lnw_gpio_ids); | |||
187 | 187 | ||
188 | static void lnw_irq_handler(unsigned irq, struct irq_desc *desc) | 188 | static void lnw_irq_handler(unsigned irq, struct irq_desc *desc) |
189 | { | 189 | { |
190 | struct lnw_gpio *lnw = (struct lnw_gpio *)get_irq_data(irq); | 190 | struct lnw_gpio *lnw = get_irq_data(irq); |
191 | u32 base, gpio; | 191 | u32 base, gpio; |
192 | void __iomem *gedr; | 192 | void __iomem *gedr; |
193 | u32 gedr_v; | 193 | u32 gedr_v; |
@@ -206,7 +206,12 @@ static void lnw_irq_handler(unsigned irq, struct irq_desc *desc) | |||
206 | /* clear the edge detect status bit */ | 206 | /* clear the edge detect status bit */ |
207 | writel(gedr_v, gedr); | 207 | writel(gedr_v, gedr); |
208 | } | 208 | } |
209 | desc->chip->eoi(irq); | 209 | |
210 | if (desc->chip->irq_eoi) | ||
211 | desc->chip->irq_eoi(irq_get_irq_data(irq)); | ||
212 | else | ||
213 | dev_warn(lnw->chip.dev, "missing EOI handler for irq %d\n", irq); | ||
214 | |||
210 | } | 215 | } |
211 | 216 | ||
212 | static int __devinit lnw_gpio_probe(struct pci_dev *pdev, | 217 | static int __devinit lnw_gpio_probe(struct pci_dev *pdev, |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c index 13bb672a16f..f658a04eecf 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.c +++ b/drivers/gpu/drm/nouveau/nouveau_drv.c | |||
@@ -234,9 +234,9 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state) | |||
234 | pci_set_power_state(pdev, PCI_D3hot); | 234 | pci_set_power_state(pdev, PCI_D3hot); |
235 | } | 235 | } |
236 | 236 | ||
237 | acquire_console_sem(); | 237 | console_lock(); |
238 | nouveau_fbcon_set_suspend(dev, 1); | 238 | nouveau_fbcon_set_suspend(dev, 1); |
239 | release_console_sem(); | 239 | console_unlock(); |
240 | nouveau_fbcon_restore_accel(dev); | 240 | nouveau_fbcon_restore_accel(dev); |
241 | return 0; | 241 | return 0; |
242 | 242 | ||
@@ -359,9 +359,9 @@ nouveau_pci_resume(struct pci_dev *pdev) | |||
359 | nv_crtc->lut.depth = 0; | 359 | nv_crtc->lut.depth = 0; |
360 | } | 360 | } |
361 | 361 | ||
362 | acquire_console_sem(); | 362 | console_lock(); |
363 | nouveau_fbcon_set_suspend(dev, 0); | 363 | nouveau_fbcon_set_suspend(dev, 0); |
364 | release_console_sem(); | 364 | console_unlock(); |
365 | 365 | ||
366 | nouveau_fbcon_zfill_all(dev); | 366 | nouveau_fbcon_zfill_all(dev); |
367 | 367 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 26091d602b8..0d478932b1a 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -891,9 +891,9 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state) | |||
891 | pci_disable_device(dev->pdev); | 891 | pci_disable_device(dev->pdev); |
892 | pci_set_power_state(dev->pdev, PCI_D3hot); | 892 | pci_set_power_state(dev->pdev, PCI_D3hot); |
893 | } | 893 | } |
894 | acquire_console_sem(); | 894 | console_lock(); |
895 | radeon_fbdev_set_suspend(rdev, 1); | 895 | radeon_fbdev_set_suspend(rdev, 1); |
896 | release_console_sem(); | 896 | console_unlock(); |
897 | return 0; | 897 | return 0; |
898 | } | 898 | } |
899 | 899 | ||
@@ -905,11 +905,11 @@ int radeon_resume_kms(struct drm_device *dev) | |||
905 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) | 905 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) |
906 | return 0; | 906 | return 0; |
907 | 907 | ||
908 | acquire_console_sem(); | 908 | console_lock(); |
909 | pci_set_power_state(dev->pdev, PCI_D0); | 909 | pci_set_power_state(dev->pdev, PCI_D0); |
910 | pci_restore_state(dev->pdev); | 910 | pci_restore_state(dev->pdev); |
911 | if (pci_enable_device(dev->pdev)) { | 911 | if (pci_enable_device(dev->pdev)) { |
912 | release_console_sem(); | 912 | console_unlock(); |
913 | return -1; | 913 | return -1; |
914 | } | 914 | } |
915 | pci_set_master(dev->pdev); | 915 | pci_set_master(dev->pdev); |
@@ -920,7 +920,7 @@ int radeon_resume_kms(struct drm_device *dev) | |||
920 | radeon_restore_bios_scratch_regs(rdev); | 920 | radeon_restore_bios_scratch_regs(rdev); |
921 | 921 | ||
922 | radeon_fbdev_set_suspend(rdev, 0); | 922 | radeon_fbdev_set_suspend(rdev, 0); |
923 | release_console_sem(); | 923 | console_unlock(); |
924 | 924 | ||
925 | /* reset hpd state */ | 925 | /* reset hpd state */ |
926 | radeon_hpd_init(rdev); | 926 | radeon_hpd_init(rdev); |
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index ce0372f0615..4c0743660e9 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -1072,6 +1072,7 @@ static int applesmc_create_nodes(struct applesmc_node_group *groups, int num) | |||
1072 | node->sda.dev_attr.show = grp->show; | 1072 | node->sda.dev_attr.show = grp->show; |
1073 | node->sda.dev_attr.store = grp->store; | 1073 | node->sda.dev_attr.store = grp->store; |
1074 | attr = &node->sda.dev_attr.attr; | 1074 | attr = &node->sda.dev_attr.attr; |
1075 | sysfs_attr_init(attr); | ||
1075 | attr->name = node->name; | 1076 | attr->name = node->name; |
1076 | attr->mode = S_IRUGO | (grp->store ? S_IWUSR : 0); | 1077 | attr->mode = S_IRUGO | (grp->store ? S_IWUSR : 0); |
1077 | ret = sysfs_create_file(&pdev->dev.kobj, attr); | 1078 | ret = sysfs_create_file(&pdev->dev.kobj, attr); |
diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c index 2d68cf3c223..b5e892017e0 100644 --- a/drivers/hwmon/asus_atk0110.c +++ b/drivers/hwmon/asus_atk0110.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/list.h> | 13 | #include <linux/list.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/dmi.h> | ||
16 | 17 | ||
17 | #include <acpi/acpi.h> | 18 | #include <acpi/acpi.h> |
18 | #include <acpi/acpixf.h> | 19 | #include <acpi/acpixf.h> |
@@ -22,6 +23,21 @@ | |||
22 | 23 | ||
23 | #define ATK_HID "ATK0110" | 24 | #define ATK_HID "ATK0110" |
24 | 25 | ||
26 | static bool new_if; | ||
27 | module_param(new_if, bool, 0); | ||
28 | MODULE_PARM_DESC(new_if, "Override detection heuristic and force the use of the new ATK0110 interface"); | ||
29 | |||
30 | static const struct dmi_system_id __initconst atk_force_new_if[] = { | ||
31 | { | ||
32 | /* Old interface has broken MCH temp monitoring */ | ||
33 | .ident = "Asus Sabertooth X58", | ||
34 | .matches = { | ||
35 | DMI_MATCH(DMI_BOARD_NAME, "SABERTOOTH X58") | ||
36 | } | ||
37 | }, | ||
38 | { } | ||
39 | }; | ||
40 | |||
25 | /* Minimum time between readings, enforced in order to avoid | 41 | /* Minimum time between readings, enforced in order to avoid |
26 | * hogging the CPU. | 42 | * hogging the CPU. |
27 | */ | 43 | */ |
@@ -1302,7 +1318,9 @@ static int atk_probe_if(struct atk_data *data) | |||
1302 | * analysis of multiple DSDTs indicates that when both interfaces | 1318 | * analysis of multiple DSDTs indicates that when both interfaces |
1303 | * are present the new one (GGRP/GITM) is not functional. | 1319 | * are present the new one (GGRP/GITM) is not functional. |
1304 | */ | 1320 | */ |
1305 | if (data->rtmp_handle && data->rvlt_handle && data->rfan_handle) | 1321 | if (new_if) |
1322 | dev_info(dev, "Overriding interface detection\n"); | ||
1323 | if (data->rtmp_handle && data->rvlt_handle && data->rfan_handle && !new_if) | ||
1306 | data->old_interface = true; | 1324 | data->old_interface = true; |
1307 | else if (data->enumerate_handle && data->read_handle && | 1325 | else if (data->enumerate_handle && data->read_handle && |
1308 | data->write_handle) | 1326 | data->write_handle) |
@@ -1420,6 +1438,9 @@ static int __init atk0110_init(void) | |||
1420 | return -EBUSY; | 1438 | return -EBUSY; |
1421 | } | 1439 | } |
1422 | 1440 | ||
1441 | if (dmi_check_system(atk_force_new_if)) | ||
1442 | new_if = true; | ||
1443 | |||
1423 | ret = acpi_bus_register_driver(&atk_driver); | 1444 | ret = acpi_bus_register_driver(&atk_driver); |
1424 | if (ret) | 1445 | if (ret) |
1425 | pr_info("acpi_bus_register_driver failed: %d\n", ret); | 1446 | pr_info("acpi_bus_register_driver failed: %d\n", ret); |
diff --git a/drivers/hwmon/lis3lv02d.c b/drivers/hwmon/lis3lv02d.c index 1b674b7d458..d805e8e5796 100644 --- a/drivers/hwmon/lis3lv02d.c +++ b/drivers/hwmon/lis3lv02d.c | |||
@@ -957,7 +957,7 @@ int lis3lv02d_init_device(struct lis3lv02d *dev) | |||
957 | 957 | ||
958 | /* bail if we did not get an IRQ from the bus layer */ | 958 | /* bail if we did not get an IRQ from the bus layer */ |
959 | if (!dev->irq) { | 959 | if (!dev->irq) { |
960 | pr_err("No IRQ. Disabling /dev/freefall\n"); | 960 | pr_debug("No IRQ. Disabling /dev/freefall\n"); |
961 | goto out; | 961 | goto out; |
962 | } | 962 | } |
963 | 963 | ||
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 417507348ba..c7a92028f45 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -343,6 +343,16 @@ config KEYBOARD_NOMADIK | |||
343 | To compile this driver as a module, choose M here: the | 343 | To compile this driver as a module, choose M here: the |
344 | module will be called nmk-ske-keypad. | 344 | module will be called nmk-ske-keypad. |
345 | 345 | ||
346 | config KEYBOARD_TEGRA | ||
347 | tristate "NVIDIA Tegra internal matrix keyboard controller support" | ||
348 | depends on ARCH_TEGRA | ||
349 | help | ||
350 | Say Y here if you want to use a matrix keyboard connected directly | ||
351 | to the internal keyboard controller on Tegra SoCs. | ||
352 | |||
353 | To compile this driver as a module, choose M here: the | ||
354 | module will be called tegra-kbc. | ||
355 | |||
346 | config KEYBOARD_OPENCORES | 356 | config KEYBOARD_OPENCORES |
347 | tristate "OpenCores Keyboard Controller" | 357 | tristate "OpenCores Keyboard Controller" |
348 | help | 358 | help |
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index 4e5571b72cd..468c627a284 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile | |||
@@ -42,6 +42,7 @@ obj-$(CONFIG_KEYBOARD_STMPE) += stmpe-keypad.o | |||
42 | obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o | 42 | obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o |
43 | obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o | 43 | obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o |
44 | obj-$(CONFIG_KEYBOARD_TC3589X) += tc3589x-keypad.o | 44 | obj-$(CONFIG_KEYBOARD_TC3589X) += tc3589x-keypad.o |
45 | obj-$(CONFIG_KEYBOARD_TEGRA) += tegra-kbc.o | ||
45 | obj-$(CONFIG_KEYBOARD_TNETV107X) += tnetv107x-keypad.o | 46 | obj-$(CONFIG_KEYBOARD_TNETV107X) += tnetv107x-keypad.o |
46 | obj-$(CONFIG_KEYBOARD_TWL4030) += twl4030_keypad.o | 47 | obj-$(CONFIG_KEYBOARD_TWL4030) += twl4030_keypad.o |
47 | obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o | 48 | obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o |
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 6069abe31e4..eb3006361ee 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c | |||
@@ -322,7 +322,7 @@ static void gpio_keys_report_event(struct gpio_button_data *bdata) | |||
322 | struct gpio_keys_button *button = bdata->button; | 322 | struct gpio_keys_button *button = bdata->button; |
323 | struct input_dev *input = bdata->input; | 323 | struct input_dev *input = bdata->input; |
324 | unsigned int type = button->type ?: EV_KEY; | 324 | unsigned int type = button->type ?: EV_KEY; |
325 | int state = (gpio_get_value(button->gpio) ? 1 : 0) ^ button->active_low; | 325 | int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low; |
326 | 326 | ||
327 | input_event(input, type, button->code, !!state); | 327 | input_event(input, type, button->code, !!state); |
328 | input_sync(input); | 328 | input_sync(input); |
@@ -410,8 +410,8 @@ static int __devinit gpio_keys_setup_key(struct platform_device *pdev, | |||
410 | if (!button->can_disable) | 410 | if (!button->can_disable) |
411 | irqflags |= IRQF_SHARED; | 411 | irqflags |= IRQF_SHARED; |
412 | 412 | ||
413 | error = request_irq(irq, gpio_keys_isr, irqflags, desc, bdata); | 413 | error = request_any_context_irq(irq, gpio_keys_isr, irqflags, desc, bdata); |
414 | if (error) { | 414 | if (error < 0) { |
415 | dev_err(dev, "Unable to claim irq %d; error %d\n", | 415 | dev_err(dev, "Unable to claim irq %d; error %d\n", |
416 | irq, error); | 416 | irq, error); |
417 | goto fail3; | 417 | goto fail3; |
diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c new file mode 100644 index 00000000000..939476659ad --- /dev/null +++ b/drivers/input/keyboard/tegra-kbc.c | |||
@@ -0,0 +1,727 @@ | |||
1 | /* | ||
2 | * Keyboard class input driver for the NVIDIA Tegra SoC internal matrix | ||
3 | * keyboard controller | ||
4 | * | ||
5 | * Copyright (c) 2009-2011, NVIDIA Corporation. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
15 | * more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License along | ||
18 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
20 | */ | ||
21 | |||
22 | #include <linux/module.h> | ||
23 | #include <linux/input.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | #include <linux/delay.h> | ||
26 | #include <linux/io.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/clk.h> | ||
29 | #include <linux/slab.h> | ||
30 | #include <mach/clk.h> | ||
31 | #include <mach/kbc.h> | ||
32 | |||
33 | #define KBC_MAX_DEBOUNCE_CNT 0x3ffu | ||
34 | |||
35 | /* KBC row scan time and delay for beginning the row scan. */ | ||
36 | #define KBC_ROW_SCAN_TIME 16 | ||
37 | #define KBC_ROW_SCAN_DLY 5 | ||
38 | |||
39 | /* KBC uses a 32KHz clock so a cycle = 1/32Khz */ | ||
40 | #define KBC_CYCLE_USEC 32 | ||
41 | |||
42 | /* KBC Registers */ | ||
43 | |||
44 | /* KBC Control Register */ | ||
45 | #define KBC_CONTROL_0 0x0 | ||
46 | #define KBC_FIFO_TH_CNT_SHIFT(cnt) (cnt << 14) | ||
47 | #define KBC_DEBOUNCE_CNT_SHIFT(cnt) (cnt << 4) | ||
48 | #define KBC_CONTROL_FIFO_CNT_INT_EN (1 << 3) | ||
49 | #define KBC_CONTROL_KBC_EN (1 << 0) | ||
50 | |||
51 | /* KBC Interrupt Register */ | ||
52 | #define KBC_INT_0 0x4 | ||
53 | #define KBC_INT_FIFO_CNT_INT_STATUS (1 << 2) | ||
54 | |||
55 | #define KBC_ROW_CFG0_0 0x8 | ||
56 | #define KBC_COL_CFG0_0 0x18 | ||
57 | #define KBC_INIT_DLY_0 0x28 | ||
58 | #define KBC_RPT_DLY_0 0x2c | ||
59 | #define KBC_KP_ENT0_0 0x30 | ||
60 | #define KBC_KP_ENT1_0 0x34 | ||
61 | #define KBC_ROW0_MASK_0 0x38 | ||
62 | |||
63 | #define KBC_ROW_SHIFT 3 | ||
64 | |||
65 | struct tegra_kbc { | ||
66 | void __iomem *mmio; | ||
67 | struct input_dev *idev; | ||
68 | unsigned int irq; | ||
69 | unsigned int wake_enable_rows; | ||
70 | unsigned int wake_enable_cols; | ||
71 | spinlock_t lock; | ||
72 | unsigned int repoll_dly; | ||
73 | unsigned long cp_dly_jiffies; | ||
74 | const struct tegra_kbc_platform_data *pdata; | ||
75 | unsigned short keycode[KBC_MAX_KEY]; | ||
76 | unsigned short current_keys[KBC_MAX_KPENT]; | ||
77 | unsigned int num_pressed_keys; | ||
78 | struct timer_list timer; | ||
79 | struct clk *clk; | ||
80 | }; | ||
81 | |||
82 | static const u32 tegra_kbc_default_keymap[] = { | ||
83 | KEY(0, 2, KEY_W), | ||
84 | KEY(0, 3, KEY_S), | ||
85 | KEY(0, 4, KEY_A), | ||
86 | KEY(0, 5, KEY_Z), | ||
87 | KEY(0, 7, KEY_FN), | ||
88 | |||
89 | KEY(1, 7, KEY_MENU), | ||
90 | |||
91 | KEY(2, 6, KEY_RIGHTALT), | ||
92 | KEY(2, 7, KEY_LEFTALT), | ||
93 | |||
94 | KEY(3, 0, KEY_5), | ||
95 | KEY(3, 1, KEY_4), | ||
96 | KEY(3, 2, KEY_R), | ||
97 | KEY(3, 3, KEY_E), | ||
98 | KEY(3, 4, KEY_F), | ||
99 | KEY(3, 5, KEY_D), | ||
100 | KEY(3, 6, KEY_X), | ||
101 | |||
102 | KEY(4, 0, KEY_7), | ||
103 | KEY(4, 1, KEY_6), | ||
104 | KEY(4, 2, KEY_T), | ||
105 | KEY(4, 3, KEY_H), | ||
106 | KEY(4, 4, KEY_G), | ||
107 | KEY(4, 5, KEY_V), | ||
108 | KEY(4, 6, KEY_C), | ||
109 | KEY(4, 7, KEY_SPACE), | ||
110 | |||
111 | KEY(5, 0, KEY_9), | ||
112 | KEY(5, 1, KEY_8), | ||
113 | KEY(5, 2, KEY_U), | ||
114 | KEY(5, 3, KEY_Y), | ||
115 | KEY(5, 4, KEY_J), | ||
116 | KEY(5, 5, KEY_N), | ||
117 | KEY(5, 6, KEY_B), | ||
118 | KEY(5, 7, KEY_BACKSLASH), | ||
119 | |||
120 | KEY(6, 0, KEY_MINUS), | ||
121 | KEY(6, 1, KEY_0), | ||
122 | KEY(6, 2, KEY_O), | ||
123 | KEY(6, 3, KEY_I), | ||
124 | KEY(6, 4, KEY_L), | ||
125 | KEY(6, 5, KEY_K), | ||
126 | KEY(6, 6, KEY_COMMA), | ||
127 | KEY(6, 7, KEY_M), | ||
128 | |||
129 | KEY(7, 1, KEY_EQUAL), | ||
130 | KEY(7, 2, KEY_RIGHTBRACE), | ||
131 | KEY(7, 3, KEY_ENTER), | ||
132 | KEY(7, 7, KEY_MENU), | ||
133 | |||
134 | KEY(8, 4, KEY_RIGHTSHIFT), | ||
135 | KEY(8, 5, KEY_LEFTSHIFT), | ||
136 | |||
137 | KEY(9, 5, KEY_RIGHTCTRL), | ||
138 | KEY(9, 7, KEY_LEFTCTRL), | ||
139 | |||
140 | KEY(11, 0, KEY_LEFTBRACE), | ||
141 | KEY(11, 1, KEY_P), | ||
142 | KEY(11, 2, KEY_APOSTROPHE), | ||
143 | KEY(11, 3, KEY_SEMICOLON), | ||
144 | KEY(11, 4, KEY_SLASH), | ||
145 | KEY(11, 5, KEY_DOT), | ||
146 | |||
147 | KEY(12, 0, KEY_F10), | ||
148 | KEY(12, 1, KEY_F9), | ||
149 | KEY(12, 2, KEY_BACKSPACE), | ||
150 | KEY(12, 3, KEY_3), | ||
151 | KEY(12, 4, KEY_2), | ||
152 | KEY(12, 5, KEY_UP), | ||
153 | KEY(12, 6, KEY_PRINT), | ||
154 | KEY(12, 7, KEY_PAUSE), | ||
155 | |||
156 | KEY(13, 0, KEY_INSERT), | ||
157 | KEY(13, 1, KEY_DELETE), | ||
158 | KEY(13, 3, KEY_PAGEUP), | ||
159 | KEY(13, 4, KEY_PAGEDOWN), | ||
160 | KEY(13, 5, KEY_RIGHT), | ||
161 | KEY(13, 6, KEY_DOWN), | ||
162 | KEY(13, 7, KEY_LEFT), | ||
163 | |||
164 | KEY(14, 0, KEY_F11), | ||
165 | KEY(14, 1, KEY_F12), | ||
166 | KEY(14, 2, KEY_F8), | ||
167 | KEY(14, 3, KEY_Q), | ||
168 | KEY(14, 4, KEY_F4), | ||
169 | KEY(14, 5, KEY_F3), | ||
170 | KEY(14, 6, KEY_1), | ||
171 | KEY(14, 7, KEY_F7), | ||
172 | |||
173 | KEY(15, 0, KEY_ESC), | ||
174 | KEY(15, 1, KEY_GRAVE), | ||
175 | KEY(15, 2, KEY_F5), | ||
176 | KEY(15, 3, KEY_TAB), | ||
177 | KEY(15, 4, KEY_F1), | ||
178 | KEY(15, 5, KEY_F2), | ||
179 | KEY(15, 6, KEY_CAPSLOCK), | ||
180 | KEY(15, 7, KEY_F6), | ||
181 | }; | ||
182 | |||
183 | static const struct matrix_keymap_data tegra_kbc_default_keymap_data = { | ||
184 | .keymap = tegra_kbc_default_keymap, | ||
185 | .keymap_size = ARRAY_SIZE(tegra_kbc_default_keymap), | ||
186 | }; | ||
187 | |||
188 | static void tegra_kbc_report_released_keys(struct input_dev *input, | ||
189 | unsigned short old_keycodes[], | ||
190 | unsigned int old_num_keys, | ||
191 | unsigned short new_keycodes[], | ||
192 | unsigned int new_num_keys) | ||
193 | { | ||
194 | unsigned int i, j; | ||
195 | |||
196 | for (i = 0; i < old_num_keys; i++) { | ||
197 | for (j = 0; j < new_num_keys; j++) | ||
198 | if (old_keycodes[i] == new_keycodes[j]) | ||
199 | break; | ||
200 | |||
201 | if (j == new_num_keys) | ||
202 | input_report_key(input, old_keycodes[i], 0); | ||
203 | } | ||
204 | } | ||
205 | |||
206 | static void tegra_kbc_report_pressed_keys(struct input_dev *input, | ||
207 | unsigned char scancodes[], | ||
208 | unsigned short keycodes[], | ||
209 | unsigned int num_pressed_keys) | ||
210 | { | ||
211 | unsigned int i; | ||
212 | |||
213 | for (i = 0; i < num_pressed_keys; i++) { | ||
214 | input_event(input, EV_MSC, MSC_SCAN, scancodes[i]); | ||
215 | input_report_key(input, keycodes[i], 1); | ||
216 | } | ||
217 | } | ||
218 | |||
219 | static void tegra_kbc_report_keys(struct tegra_kbc *kbc) | ||
220 | { | ||
221 | unsigned char scancodes[KBC_MAX_KPENT]; | ||
222 | unsigned short keycodes[KBC_MAX_KPENT]; | ||
223 | u32 val = 0; | ||
224 | unsigned int i; | ||
225 | unsigned int num_down = 0; | ||
226 | unsigned long flags; | ||
227 | |||
228 | spin_lock_irqsave(&kbc->lock, flags); | ||
229 | for (i = 0; i < KBC_MAX_KPENT; i++) { | ||
230 | if ((i % 4) == 0) | ||
231 | val = readl(kbc->mmio + KBC_KP_ENT0_0 + i); | ||
232 | |||
233 | if (val & 0x80) { | ||
234 | unsigned int col = val & 0x07; | ||
235 | unsigned int row = (val >> 3) & 0x0f; | ||
236 | unsigned char scancode = | ||
237 | MATRIX_SCAN_CODE(row, col, KBC_ROW_SHIFT); | ||
238 | |||
239 | scancodes[num_down] = scancode; | ||
240 | keycodes[num_down++] = kbc->keycode[scancode]; | ||
241 | } | ||
242 | |||
243 | val >>= 8; | ||
244 | } | ||
245 | spin_unlock_irqrestore(&kbc->lock, flags); | ||
246 | |||
247 | tegra_kbc_report_released_keys(kbc->idev, | ||
248 | kbc->current_keys, kbc->num_pressed_keys, | ||
249 | keycodes, num_down); | ||
250 | tegra_kbc_report_pressed_keys(kbc->idev, scancodes, keycodes, num_down); | ||
251 | input_sync(kbc->idev); | ||
252 | |||
253 | memcpy(kbc->current_keys, keycodes, sizeof(kbc->current_keys)); | ||
254 | kbc->num_pressed_keys = num_down; | ||
255 | } | ||
256 | |||
257 | static void tegra_kbc_keypress_timer(unsigned long data) | ||
258 | { | ||
259 | struct tegra_kbc *kbc = (struct tegra_kbc *)data; | ||
260 | unsigned long flags; | ||
261 | u32 val; | ||
262 | unsigned int i; | ||
263 | |||
264 | val = (readl(kbc->mmio + KBC_INT_0) >> 4) & 0xf; | ||
265 | if (val) { | ||
266 | unsigned long dly; | ||
267 | |||
268 | tegra_kbc_report_keys(kbc); | ||
269 | |||
270 | /* | ||
271 | * If more than one keys are pressed we need not wait | ||
272 | * for the repoll delay. | ||
273 | */ | ||
274 | dly = (val == 1) ? kbc->repoll_dly : 1; | ||
275 | mod_timer(&kbc->timer, jiffies + msecs_to_jiffies(dly)); | ||
276 | } else { | ||
277 | /* Release any pressed keys and exit the polling loop */ | ||
278 | for (i = 0; i < kbc->num_pressed_keys; i++) | ||
279 | input_report_key(kbc->idev, kbc->current_keys[i], 0); | ||
280 | input_sync(kbc->idev); | ||
281 | |||
282 | kbc->num_pressed_keys = 0; | ||
283 | |||
284 | /* All keys are released so enable the keypress interrupt */ | ||
285 | spin_lock_irqsave(&kbc->lock, flags); | ||
286 | val = readl(kbc->mmio + KBC_CONTROL_0); | ||
287 | val |= KBC_CONTROL_FIFO_CNT_INT_EN; | ||
288 | writel(val, kbc->mmio + KBC_CONTROL_0); | ||
289 | spin_unlock_irqrestore(&kbc->lock, flags); | ||
290 | } | ||
291 | } | ||
292 | |||
293 | static irqreturn_t tegra_kbc_isr(int irq, void *args) | ||
294 | { | ||
295 | struct tegra_kbc *kbc = args; | ||
296 | u32 val, ctl; | ||
297 | |||
298 | /* | ||
299 | * Until all keys are released, defer further processing to | ||
300 | * the polling loop in tegra_kbc_keypress_timer | ||
301 | */ | ||
302 | ctl = readl(kbc->mmio + KBC_CONTROL_0); | ||
303 | ctl &= ~KBC_CONTROL_FIFO_CNT_INT_EN; | ||
304 | writel(ctl, kbc->mmio + KBC_CONTROL_0); | ||
305 | |||
306 | /* | ||
307 | * Quickly bail out & reenable interrupts if the fifo threshold | ||
308 | * count interrupt wasn't the interrupt source | ||
309 | */ | ||
310 | val = readl(kbc->mmio + KBC_INT_0); | ||
311 | writel(val, kbc->mmio + KBC_INT_0); | ||
312 | |||
313 | if (val & KBC_INT_FIFO_CNT_INT_STATUS) { | ||
314 | /* | ||
315 | * Schedule timer to run when hardware is in continuous | ||
316 | * polling mode. | ||
317 | */ | ||
318 | mod_timer(&kbc->timer, jiffies + kbc->cp_dly_jiffies); | ||
319 | } else { | ||
320 | ctl |= KBC_CONTROL_FIFO_CNT_INT_EN; | ||
321 | writel(ctl, kbc->mmio + KBC_CONTROL_0); | ||
322 | } | ||
323 | |||
324 | return IRQ_HANDLED; | ||
325 | } | ||
326 | |||
327 | static void tegra_kbc_setup_wakekeys(struct tegra_kbc *kbc, bool filter) | ||
328 | { | ||
329 | const struct tegra_kbc_platform_data *pdata = kbc->pdata; | ||
330 | int i; | ||
331 | unsigned int rst_val; | ||
332 | |||
333 | BUG_ON(pdata->wake_cnt > KBC_MAX_KEY); | ||
334 | rst_val = (filter && pdata->wake_cnt) ? ~0 : 0; | ||
335 | |||
336 | for (i = 0; i < KBC_MAX_ROW; i++) | ||
337 | writel(rst_val, kbc->mmio + KBC_ROW0_MASK_0 + i * 4); | ||
338 | |||
339 | if (filter) { | ||
340 | for (i = 0; i < pdata->wake_cnt; i++) { | ||
341 | u32 val, addr; | ||
342 | addr = pdata->wake_cfg[i].row * 4 + KBC_ROW0_MASK_0; | ||
343 | val = readl(kbc->mmio + addr); | ||
344 | val &= ~(1 << pdata->wake_cfg[i].col); | ||
345 | writel(val, kbc->mmio + addr); | ||
346 | } | ||
347 | } | ||
348 | } | ||
349 | |||
350 | static void tegra_kbc_config_pins(struct tegra_kbc *kbc) | ||
351 | { | ||
352 | const struct tegra_kbc_platform_data *pdata = kbc->pdata; | ||
353 | int i; | ||
354 | |||
355 | for (i = 0; i < KBC_MAX_GPIO; i++) { | ||
356 | u32 r_shft = 5 * (i % 6); | ||
357 | u32 c_shft = 4 * (i % 8); | ||
358 | u32 r_mask = 0x1f << r_shift; | ||
359 | u32 c_mask = 0x0f << c_shift; | ||
360 | u32 r_offs = (i / 6) * 4 + KBC_ROW_CFG0_0; | ||
361 | u32 c_offs = (i / 8) * 4 + KBC_COL_CFG0_0; | ||
362 | u32 row_cfg = readl(kbc->mmio + r_offs); | ||
363 | u32 col_cfg = readl(kbc->mmio + c_offs); | ||
364 | |||
365 | row_cfg &= ~r_mask; | ||
366 | col_cfg &= ~c_mask; | ||
367 | |||
368 | if (pdata->pin_cfg[i].is_row) | ||
369 | row_cfg |= ((pdata->pin_cfg[i].num << 1) | 1) << r_shft; | ||
370 | else | ||
371 | col_cfg |= ((pdata->pin_cfg[i].num << 1) | 1) << c_shft; | ||
372 | |||
373 | writel(row_cfg, kbc->mmio + r_offs); | ||
374 | writel(col_cfg, kbc->mmio + c_offs); | ||
375 | } | ||
376 | } | ||
377 | |||
378 | static int tegra_kbc_start(struct tegra_kbc *kbc) | ||
379 | { | ||
380 | const struct tegra_kbc_platform_data *pdata = kbc->pdata; | ||
381 | unsigned long flags; | ||
382 | unsigned int debounce_cnt; | ||
383 | u32 val = 0; | ||
384 | |||
385 | clk_enable(kbc->clk); | ||
386 | |||
387 | /* Reset the KBC controller to clear all previous status.*/ | ||
388 | tegra_periph_reset_assert(kbc->clk); | ||
389 | udelay(100); | ||
390 | tegra_periph_reset_deassert(kbc->clk); | ||
391 | udelay(100); | ||
392 | |||
393 | tegra_kbc_config_pins(kbc); | ||
394 | tegra_kbc_setup_wakekeys(kbc, false); | ||
395 | |||
396 | writel(pdata->repeat_cnt, kbc->mmio + KBC_RPT_DLY_0); | ||
397 | |||
398 | /* Keyboard debounce count is maximum of 12 bits. */ | ||
399 | debounce_cnt = min(pdata->debounce_cnt, KBC_MAX_DEBOUNCE_CNT); | ||
400 | val = KBC_DEBOUNCE_CNT_SHIFT(debounce_cnt); | ||
401 | val |= KBC_FIFO_TH_CNT_SHIFT(1); /* set fifo interrupt threshold to 1 */ | ||
402 | val |= KBC_CONTROL_FIFO_CNT_INT_EN; /* interrupt on FIFO threshold */ | ||
403 | val |= KBC_CONTROL_KBC_EN; /* enable */ | ||
404 | writel(val, kbc->mmio + KBC_CONTROL_0); | ||
405 | |||
406 | /* | ||
407 | * Compute the delay(ns) from interrupt mode to continuous polling | ||
408 | * mode so the timer routine is scheduled appropriately. | ||
409 | */ | ||
410 | val = readl(kbc->mmio + KBC_INIT_DLY_0); | ||
411 | kbc->cp_dly_jiffies = usecs_to_jiffies((val & 0xfffff) * 32); | ||
412 | |||
413 | kbc->num_pressed_keys = 0; | ||
414 | |||
415 | /* | ||
416 | * Atomically clear out any remaining entries in the key FIFO | ||
417 | * and enable keyboard interrupts. | ||
418 | */ | ||
419 | spin_lock_irqsave(&kbc->lock, flags); | ||
420 | while (1) { | ||
421 | val = readl(kbc->mmio + KBC_INT_0); | ||
422 | val >>= 4; | ||
423 | if (!val) | ||
424 | break; | ||
425 | |||
426 | val = readl(kbc->mmio + KBC_KP_ENT0_0); | ||
427 | val = readl(kbc->mmio + KBC_KP_ENT1_0); | ||
428 | } | ||
429 | writel(0x7, kbc->mmio + KBC_INT_0); | ||
430 | spin_unlock_irqrestore(&kbc->lock, flags); | ||
431 | |||
432 | enable_irq(kbc->irq); | ||
433 | |||
434 | return 0; | ||
435 | } | ||
436 | |||
437 | static void tegra_kbc_stop(struct tegra_kbc *kbc) | ||
438 | { | ||
439 | unsigned long flags; | ||
440 | u32 val; | ||
441 | |||
442 | spin_lock_irqsave(&kbc->lock, flags); | ||
443 | val = readl(kbc->mmio + KBC_CONTROL_0); | ||
444 | val &= ~1; | ||
445 | writel(val, kbc->mmio + KBC_CONTROL_0); | ||
446 | spin_unlock_irqrestore(&kbc->lock, flags); | ||
447 | |||
448 | disable_irq(kbc->irq); | ||
449 | del_timer_sync(&kbc->timer); | ||
450 | |||
451 | clk_disable(kbc->clk); | ||
452 | } | ||
453 | |||
454 | static int tegra_kbc_open(struct input_dev *dev) | ||
455 | { | ||
456 | struct tegra_kbc *kbc = input_get_drvdata(dev); | ||
457 | |||
458 | return tegra_kbc_start(kbc); | ||
459 | } | ||
460 | |||
461 | static void tegra_kbc_close(struct input_dev *dev) | ||
462 | { | ||
463 | struct tegra_kbc *kbc = input_get_drvdata(dev); | ||
464 | |||
465 | return tegra_kbc_stop(kbc); | ||
466 | } | ||
467 | |||
468 | static bool __devinit | ||
469 | tegra_kbc_check_pin_cfg(const struct tegra_kbc_platform_data *pdata, | ||
470 | struct device *dev, unsigned int *num_rows) | ||
471 | { | ||
472 | int i; | ||
473 | |||
474 | *num_rows = 0; | ||
475 | |||
476 | for (i = 0; i < KBC_MAX_GPIO; i++) { | ||
477 | const struct tegra_kbc_pin_cfg *pin_cfg = &pdata->pin_cfg[i]; | ||
478 | |||
479 | if (pin_cfg->is_row) { | ||
480 | if (pin_cfg->num >= KBC_MAX_ROW) { | ||
481 | dev_err(dev, | ||
482 | "pin_cfg[%d]: invalid row number %d\n", | ||
483 | i, pin_cfg->num); | ||
484 | return false; | ||
485 | } | ||
486 | (*num_rows)++; | ||
487 | } else { | ||
488 | if (pin_cfg->num >= KBC_MAX_COL) { | ||
489 | dev_err(dev, | ||
490 | "pin_cfg[%d]: invalid column number %d\n", | ||
491 | i, pin_cfg->num); | ||
492 | return false; | ||
493 | } | ||
494 | } | ||
495 | } | ||
496 | |||
497 | return true; | ||
498 | } | ||
499 | |||
500 | static int __devinit tegra_kbc_probe(struct platform_device *pdev) | ||
501 | { | ||
502 | const struct tegra_kbc_platform_data *pdata = pdev->dev.platform_data; | ||
503 | const struct matrix_keymap_data *keymap_data; | ||
504 | struct tegra_kbc *kbc; | ||
505 | struct input_dev *input_dev; | ||
506 | struct resource *res; | ||
507 | int irq; | ||
508 | int err; | ||
509 | int i; | ||
510 | int num_rows = 0; | ||
511 | unsigned int debounce_cnt; | ||
512 | unsigned int scan_time_rows; | ||
513 | |||
514 | if (!pdata) | ||
515 | return -EINVAL; | ||
516 | |||
517 | if (!tegra_kbc_check_pin_cfg(pdata, &pdev->dev, &num_rows)) | ||
518 | return -EINVAL; | ||
519 | |||
520 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
521 | if (!res) { | ||
522 | dev_err(&pdev->dev, "failed to get I/O memory\n"); | ||
523 | return -ENXIO; | ||
524 | } | ||
525 | |||
526 | irq = platform_get_irq(pdev, 0); | ||
527 | if (irq < 0) { | ||
528 | dev_err(&pdev->dev, "failed to get keyboard IRQ\n"); | ||
529 | return -ENXIO; | ||
530 | } | ||
531 | |||
532 | kbc = kzalloc(sizeof(*kbc), GFP_KERNEL); | ||
533 | input_dev = input_allocate_device(); | ||
534 | if (!kbc || !input_dev) { | ||
535 | err = -ENOMEM; | ||
536 | goto err_free_mem; | ||
537 | } | ||
538 | |||
539 | kbc->pdata = pdata; | ||
540 | kbc->idev = input_dev; | ||
541 | kbc->irq = irq; | ||
542 | spin_lock_init(&kbc->lock); | ||
543 | setup_timer(&kbc->timer, tegra_kbc_keypress_timer, (unsigned long)kbc); | ||
544 | |||
545 | res = request_mem_region(res->start, resource_size(res), pdev->name); | ||
546 | if (!res) { | ||
547 | dev_err(&pdev->dev, "failed to request I/O memory\n"); | ||
548 | err = -EBUSY; | ||
549 | goto err_free_mem; | ||
550 | } | ||
551 | |||
552 | kbc->mmio = ioremap(res->start, resource_size(res)); | ||
553 | if (!kbc->mmio) { | ||
554 | dev_err(&pdev->dev, "failed to remap I/O memory\n"); | ||
555 | err = -ENXIO; | ||
556 | goto err_free_mem_region; | ||
557 | } | ||
558 | |||
559 | kbc->clk = clk_get(&pdev->dev, NULL); | ||
560 | if (IS_ERR(kbc->clk)) { | ||
561 | dev_err(&pdev->dev, "failed to get keyboard clock\n"); | ||
562 | err = PTR_ERR(kbc->clk); | ||
563 | goto err_iounmap; | ||
564 | } | ||
565 | |||
566 | kbc->wake_enable_rows = 0; | ||
567 | kbc->wake_enable_cols = 0; | ||
568 | for (i = 0; i < pdata->wake_cnt; i++) { | ||
569 | kbc->wake_enable_rows |= (1 << pdata->wake_cfg[i].row); | ||
570 | kbc->wake_enable_cols |= (1 << pdata->wake_cfg[i].col); | ||
571 | } | ||
572 | |||
573 | /* | ||
574 | * The time delay between two consecutive reads of the FIFO is | ||
575 | * the sum of the repeat time and the time taken for scanning | ||
576 | * the rows. There is an additional delay before the row scanning | ||
577 | * starts. The repoll delay is computed in milliseconds. | ||
578 | */ | ||
579 | debounce_cnt = min(pdata->debounce_cnt, KBC_MAX_DEBOUNCE_CNT); | ||
580 | scan_time_rows = (KBC_ROW_SCAN_TIME + debounce_cnt) * num_rows; | ||
581 | kbc->repoll_dly = KBC_ROW_SCAN_DLY + scan_time_rows + pdata->repeat_cnt; | ||
582 | kbc->repoll_dly = ((kbc->repoll_dly * KBC_CYCLE_USEC) + 999) / 1000; | ||
583 | |||
584 | input_dev->name = pdev->name; | ||
585 | input_dev->id.bustype = BUS_HOST; | ||
586 | input_dev->dev.parent = &pdev->dev; | ||
587 | input_dev->open = tegra_kbc_open; | ||
588 | input_dev->close = tegra_kbc_close; | ||
589 | |||
590 | input_set_drvdata(input_dev, kbc); | ||
591 | |||
592 | input_dev->evbit[0] = BIT_MASK(EV_KEY); | ||
593 | input_set_capability(input_dev, EV_MSC, MSC_SCAN); | ||
594 | |||
595 | input_dev->keycode = kbc->keycode; | ||
596 | input_dev->keycodesize = sizeof(kbc->keycode[0]); | ||
597 | input_dev->keycodemax = ARRAY_SIZE(kbc->keycode); | ||
598 | |||
599 | keymap_data = pdata->keymap_data ?: &tegra_kbc_default_keymap_data; | ||
600 | matrix_keypad_build_keymap(keymap_data, KBC_ROW_SHIFT, | ||
601 | input_dev->keycode, input_dev->keybit); | ||
602 | |||
603 | err = request_irq(kbc->irq, tegra_kbc_isr, IRQF_TRIGGER_HIGH, | ||
604 | pdev->name, kbc); | ||
605 | if (err) { | ||
606 | dev_err(&pdev->dev, "failed to request keyboard IRQ\n"); | ||
607 | goto err_put_clk; | ||
608 | } | ||
609 | |||
610 | disable_irq(kbc->irq); | ||
611 | |||
612 | err = input_register_device(kbc->idev); | ||
613 | if (err) { | ||
614 | dev_err(&pdev->dev, "failed to register input device\n"); | ||
615 | goto err_free_irq; | ||
616 | } | ||
617 | |||
618 | platform_set_drvdata(pdev, kbc); | ||
619 | device_init_wakeup(&pdev->dev, pdata->wakeup); | ||
620 | |||
621 | return 0; | ||
622 | |||
623 | err_free_irq: | ||
624 | free_irq(kbc->irq, pdev); | ||
625 | err_put_clk: | ||
626 | clk_put(kbc->clk); | ||
627 | err_iounmap: | ||
628 | iounmap(kbc->mmio); | ||
629 | err_free_mem_region: | ||
630 | release_mem_region(res->start, resource_size(res)); | ||
631 | err_free_mem: | ||
632 | input_free_device(kbc->idev); | ||
633 | kfree(kbc); | ||
634 | |||
635 | return err; | ||
636 | } | ||
637 | |||
638 | static int __devexit tegra_kbc_remove(struct platform_device *pdev) | ||
639 | { | ||
640 | struct tegra_kbc *kbc = platform_get_drvdata(pdev); | ||
641 | struct resource *res; | ||
642 | |||
643 | free_irq(kbc->irq, pdev); | ||
644 | clk_put(kbc->clk); | ||
645 | |||
646 | input_unregister_device(kbc->idev); | ||
647 | iounmap(kbc->mmio); | ||
648 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
649 | release_mem_region(res->start, resource_size(res)); | ||
650 | |||
651 | kfree(kbc); | ||
652 | |||
653 | platform_set_drvdata(pdev, NULL); | ||
654 | |||
655 | return 0; | ||
656 | } | ||
657 | |||
658 | #ifdef CONFIG_PM_SLEEP | ||
659 | static int tegra_kbc_suspend(struct device *dev) | ||
660 | { | ||
661 | struct platform_device *pdev = to_platform_device(dev); | ||
662 | struct tegra_kbc *kbc = platform_get_drvdata(pdev); | ||
663 | |||
664 | if (device_may_wakeup(&pdev->dev)) { | ||
665 | tegra_kbc_setup_wakekeys(kbc, true); | ||
666 | enable_irq_wake(kbc->irq); | ||
667 | /* Forcefully clear the interrupt status */ | ||
668 | writel(0x7, kbc->mmio + KBC_INT_0); | ||
669 | msleep(30); | ||
670 | } else { | ||
671 | mutex_lock(&kbc->idev->mutex); | ||
672 | if (kbc->idev->users) | ||
673 | tegra_kbc_stop(kbc); | ||
674 | mutex_unlock(&kbc->idev->mutex); | ||
675 | } | ||
676 | |||
677 | return 0; | ||
678 | } | ||
679 | |||
680 | static int tegra_kbc_resume(struct device *dev) | ||
681 | { | ||
682 | struct platform_device *pdev = to_platform_device(dev); | ||
683 | struct tegra_kbc *kbc = platform_get_drvdata(pdev); | ||
684 | int err = 0; | ||
685 | |||
686 | if (device_may_wakeup(&pdev->dev)) { | ||
687 | disable_irq_wake(kbc->irq); | ||
688 | tegra_kbc_setup_wakekeys(kbc, false); | ||
689 | } else { | ||
690 | mutex_lock(&kbc->idev->mutex); | ||
691 | if (kbc->idev->users) | ||
692 | err = tegra_kbc_start(kbc); | ||
693 | mutex_unlock(&kbc->idev->mutex); | ||
694 | } | ||
695 | |||
696 | return err; | ||
697 | } | ||
698 | #endif | ||
699 | |||
700 | static SIMPLE_DEV_PM_OPS(tegra_kbc_pm_ops, tegra_kbc_suspend, tegra_kbc_resume); | ||
701 | |||
702 | static struct platform_driver tegra_kbc_driver = { | ||
703 | .probe = tegra_kbc_probe, | ||
704 | .remove = __devexit_p(tegra_kbc_remove), | ||
705 | .driver = { | ||
706 | .name = "tegra-kbc", | ||
707 | .owner = THIS_MODULE, | ||
708 | .pm = &tegra_kbc_pm_ops, | ||
709 | }, | ||
710 | }; | ||
711 | |||
712 | static void __exit tegra_kbc_exit(void) | ||
713 | { | ||
714 | platform_driver_unregister(&tegra_kbc_driver); | ||
715 | } | ||
716 | module_exit(tegra_kbc_exit); | ||
717 | |||
718 | static int __init tegra_kbc_init(void) | ||
719 | { | ||
720 | return platform_driver_register(&tegra_kbc_driver); | ||
721 | } | ||
722 | module_init(tegra_kbc_init); | ||
723 | |||
724 | MODULE_LICENSE("GPL"); | ||
725 | MODULE_AUTHOR("Rakesh Iyer <riyer@nvidia.com>"); | ||
726 | MODULE_DESCRIPTION("Tegra matrix keyboard controller driver"); | ||
727 | MODULE_ALIAS("platform:tegra-kbc"); | ||
diff --git a/drivers/input/keyboard/tnetv107x-keypad.c b/drivers/input/keyboard/tnetv107x-keypad.c index b4a81ebfab9..c8f097a15d8 100644 --- a/drivers/input/keyboard/tnetv107x-keypad.c +++ b/drivers/input/keyboard/tnetv107x-keypad.c | |||
@@ -14,6 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/err.h> | ||
17 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
18 | #include <linux/input.h> | 19 | #include <linux/input.h> |
19 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
@@ -219,9 +220,9 @@ static int __devinit keypad_probe(struct platform_device *pdev) | |||
219 | } | 220 | } |
220 | 221 | ||
221 | kp->clk = clk_get(dev, NULL); | 222 | kp->clk = clk_get(dev, NULL); |
222 | if (!kp->clk) { | 223 | if (IS_ERR(kp->clk)) { |
223 | dev_err(dev, "cannot claim device clock\n"); | 224 | dev_err(dev, "cannot claim device clock\n"); |
224 | error = -EINVAL; | 225 | error = PTR_ERR(kp->clk); |
225 | goto error_clk; | 226 | goto error_clk; |
226 | } | 227 | } |
227 | 228 | ||
diff --git a/drivers/input/serio/ct82c710.c b/drivers/input/serio/ct82c710.c index 448c7724beb..85281656724 100644 --- a/drivers/input/serio/ct82c710.c +++ b/drivers/input/serio/ct82c710.c | |||
@@ -111,9 +111,11 @@ static void ct82c710_close(struct serio *serio) | |||
111 | static int ct82c710_open(struct serio *serio) | 111 | static int ct82c710_open(struct serio *serio) |
112 | { | 112 | { |
113 | unsigned char status; | 113 | unsigned char status; |
114 | int err; | ||
114 | 115 | ||
115 | if (request_irq(CT82C710_IRQ, ct82c710_interrupt, 0, "ct82c710", NULL)) | 116 | err = request_irq(CT82C710_IRQ, ct82c710_interrupt, 0, "ct82c710", NULL); |
116 | return -1; | 117 | if (err) |
118 | return err; | ||
117 | 119 | ||
118 | status = inb_p(CT82C710_STATUS); | 120 | status = inb_p(CT82C710_STATUS); |
119 | 121 | ||
@@ -131,7 +133,7 @@ static int ct82c710_open(struct serio *serio) | |||
131 | status &= ~(CT82C710_ENABLE | CT82C710_INTS_ON); | 133 | status &= ~(CT82C710_ENABLE | CT82C710_INTS_ON); |
132 | outb_p(status, CT82C710_STATUS); | 134 | outb_p(status, CT82C710_STATUS); |
133 | free_irq(CT82C710_IRQ, NULL); | 135 | free_irq(CT82C710_IRQ, NULL); |
134 | return -1; | 136 | return -EBUSY; |
135 | } | 137 | } |
136 | 138 | ||
137 | return 0; | 139 | return 0; |
diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c index 6e362de3f41..8755f5f3ad3 100644 --- a/drivers/input/serio/serport.c +++ b/drivers/input/serio/serport.c | |||
@@ -116,14 +116,15 @@ static void serport_ldisc_close(struct tty_struct *tty) | |||
116 | 116 | ||
117 | /* | 117 | /* |
118 | * serport_ldisc_receive() is called by the low level tty driver when characters | 118 | * serport_ldisc_receive() is called by the low level tty driver when characters |
119 | * are ready for us. We forward the characters, one by one to the 'interrupt' | 119 | * are ready for us. We forward the characters and flags, one by one to the |
120 | * routine. | 120 | * 'interrupt' routine. |
121 | */ | 121 | */ |
122 | 122 | ||
123 | static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) | 123 | static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) |
124 | { | 124 | { |
125 | struct serport *serport = (struct serport*) tty->disc_data; | 125 | struct serport *serport = (struct serport*) tty->disc_data; |
126 | unsigned long flags; | 126 | unsigned long flags; |
127 | unsigned int ch_flags; | ||
127 | int i; | 128 | int i; |
128 | 129 | ||
129 | spin_lock_irqsave(&serport->lock, flags); | 130 | spin_lock_irqsave(&serport->lock, flags); |
@@ -131,8 +132,23 @@ static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *c | |||
131 | if (!test_bit(SERPORT_ACTIVE, &serport->flags)) | 132 | if (!test_bit(SERPORT_ACTIVE, &serport->flags)) |
132 | goto out; | 133 | goto out; |
133 | 134 | ||
134 | for (i = 0; i < count; i++) | 135 | for (i = 0; i < count; i++) { |
135 | serio_interrupt(serport->serio, cp[i], 0); | 136 | switch (fp[i]) { |
137 | case TTY_FRAME: | ||
138 | ch_flags = SERIO_FRAME; | ||
139 | break; | ||
140 | |||
141 | case TTY_PARITY: | ||
142 | ch_flags = SERIO_PARITY; | ||
143 | break; | ||
144 | |||
145 | default: | ||
146 | ch_flags = 0; | ||
147 | break; | ||
148 | } | ||
149 | |||
150 | serio_interrupt(serport->serio, cp[i], ch_flags); | ||
151 | } | ||
136 | 152 | ||
137 | out: | 153 | out: |
138 | spin_unlock_irqrestore(&serport->lock, flags); | 154 | spin_unlock_irqrestore(&serport->lock, flags); |
diff --git a/drivers/input/sparse-keymap.c b/drivers/input/sparse-keymap.c index a29a7812bd4..7729e547ba6 100644 --- a/drivers/input/sparse-keymap.c +++ b/drivers/input/sparse-keymap.c | |||
@@ -201,6 +201,7 @@ int sparse_keymap_setup(struct input_dev *dev, | |||
201 | break; | 201 | break; |
202 | 202 | ||
203 | case KE_SW: | 203 | case KE_SW: |
204 | case KE_VSW: | ||
204 | __set_bit(EV_SW, dev->evbit); | 205 | __set_bit(EV_SW, dev->evbit); |
205 | __set_bit(entry->sw.code, dev->swbit); | 206 | __set_bit(entry->sw.code, dev->swbit); |
206 | break; | 207 | break; |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 518782999fe..367fa82a607 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -1101,6 +1101,13 @@ void wacom_setup_device_quirks(struct wacom_features *features) | |||
1101 | } | 1101 | } |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | static unsigned int wacom_calculate_touch_res(unsigned int logical_max, | ||
1105 | unsigned int physical_max) | ||
1106 | { | ||
1107 | /* Touch physical dimensions are in 100th of mm */ | ||
1108 | return (logical_max * 100) / physical_max; | ||
1109 | } | ||
1110 | |||
1104 | void wacom_setup_input_capabilities(struct input_dev *input_dev, | 1111 | void wacom_setup_input_capabilities(struct input_dev *input_dev, |
1105 | struct wacom_wac *wacom_wac) | 1112 | struct wacom_wac *wacom_wac) |
1106 | { | 1113 | { |
@@ -1228,8 +1235,12 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1228 | case TABLETPC: | 1235 | case TABLETPC: |
1229 | if (features->device_type == BTN_TOOL_DOUBLETAP || | 1236 | if (features->device_type == BTN_TOOL_DOUBLETAP || |
1230 | features->device_type == BTN_TOOL_TRIPLETAP) { | 1237 | features->device_type == BTN_TOOL_TRIPLETAP) { |
1231 | input_set_abs_params(input_dev, ABS_RX, 0, features->x_phy, 0, 0); | 1238 | input_abs_set_res(input_dev, ABS_X, |
1232 | input_set_abs_params(input_dev, ABS_RY, 0, features->y_phy, 0, 0); | 1239 | wacom_calculate_touch_res(features->x_max, |
1240 | features->x_phy)); | ||
1241 | input_abs_set_res(input_dev, ABS_Y, | ||
1242 | wacom_calculate_touch_res(features->y_max, | ||
1243 | features->y_phy)); | ||
1233 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); | 1244 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); |
1234 | } | 1245 | } |
1235 | 1246 | ||
@@ -1272,6 +1283,12 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1272 | input_set_abs_params(input_dev, ABS_MT_PRESSURE, | 1283 | input_set_abs_params(input_dev, ABS_MT_PRESSURE, |
1273 | 0, features->pressure_max, | 1284 | 0, features->pressure_max, |
1274 | features->pressure_fuzz, 0); | 1285 | features->pressure_fuzz, 0); |
1286 | input_abs_set_res(input_dev, ABS_X, | ||
1287 | wacom_calculate_touch_res(features->x_max, | ||
1288 | features->x_phy)); | ||
1289 | input_abs_set_res(input_dev, ABS_Y, | ||
1290 | wacom_calculate_touch_res(features->y_max, | ||
1291 | features->y_phy)); | ||
1275 | } else if (features->device_type == BTN_TOOL_PEN) { | 1292 | } else if (features->device_type == BTN_TOOL_PEN) { |
1276 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); | 1293 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
1277 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); | 1294 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
@@ -1426,6 +1443,10 @@ static struct wacom_features wacom_features_0xD3 = | |||
1426 | { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; | 1443 | { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; |
1427 | static const struct wacom_features wacom_features_0xD4 = | 1444 | static const struct wacom_features wacom_features_0xD4 = |
1428 | { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 255, 63, BAMBOO_PT }; | 1445 | { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 255, 63, BAMBOO_PT }; |
1446 | static struct wacom_features wacom_features_0xD6 = | ||
1447 | { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; | ||
1448 | static struct wacom_features wacom_features_0xD7 = | ||
1449 | { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; | ||
1429 | static struct wacom_features wacom_features_0xD8 = | 1450 | static struct wacom_features wacom_features_0xD8 = |
1430 | { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; | 1451 | { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; |
1431 | static struct wacom_features wacom_features_0xDA = | 1452 | static struct wacom_features wacom_features_0xDA = |
@@ -1507,6 +1528,8 @@ const struct usb_device_id wacom_ids[] = { | |||
1507 | { USB_DEVICE_WACOM(0xD2) }, | 1528 | { USB_DEVICE_WACOM(0xD2) }, |
1508 | { USB_DEVICE_WACOM(0xD3) }, | 1529 | { USB_DEVICE_WACOM(0xD3) }, |
1509 | { USB_DEVICE_WACOM(0xD4) }, | 1530 | { USB_DEVICE_WACOM(0xD4) }, |
1531 | { USB_DEVICE_WACOM(0xD6) }, | ||
1532 | { USB_DEVICE_WACOM(0xD7) }, | ||
1510 | { USB_DEVICE_WACOM(0xD8) }, | 1533 | { USB_DEVICE_WACOM(0xD8) }, |
1511 | { USB_DEVICE_WACOM(0xDA) }, | 1534 | { USB_DEVICE_WACOM(0xDA) }, |
1512 | { USB_DEVICE_WACOM(0xDB) }, | 1535 | { USB_DEVICE_WACOM(0xDB) }, |
diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c index f7fa9ef4cd6..1507ce108d5 100644 --- a/drivers/input/touchscreen/bu21013_ts.c +++ b/drivers/input/touchscreen/bu21013_ts.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/input.h> | 12 | #include <linux/input.h> |
13 | #include <linux/input/bu21013.h> | 13 | #include <linux/input/bu21013.h> |
14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
15 | #include <linux/regulator/consumer.h> | ||
15 | 16 | ||
16 | #define PEN_DOWN_INTR 0 | 17 | #define PEN_DOWN_INTR 0 |
17 | #define MAX_FINGERS 2 | 18 | #define MAX_FINGERS 2 |
@@ -139,6 +140,7 @@ | |||
139 | * @chip: pointer to the touch panel controller | 140 | * @chip: pointer to the touch panel controller |
140 | * @in_dev: pointer to the input device structure | 141 | * @in_dev: pointer to the input device structure |
141 | * @intr_pin: interrupt pin value | 142 | * @intr_pin: interrupt pin value |
143 | * @regulator: pointer to the Regulator used for touch screen | ||
142 | * | 144 | * |
143 | * Touch panel device data structure | 145 | * Touch panel device data structure |
144 | */ | 146 | */ |
@@ -149,6 +151,7 @@ struct bu21013_ts_data { | |||
149 | const struct bu21013_platform_device *chip; | 151 | const struct bu21013_platform_device *chip; |
150 | struct input_dev *in_dev; | 152 | struct input_dev *in_dev; |
151 | unsigned int intr_pin; | 153 | unsigned int intr_pin; |
154 | struct regulator *regulator; | ||
152 | }; | 155 | }; |
153 | 156 | ||
154 | /** | 157 | /** |
@@ -456,6 +459,20 @@ static int __devinit bu21013_probe(struct i2c_client *client, | |||
456 | bu21013_data->in_dev = in_dev; | 459 | bu21013_data->in_dev = in_dev; |
457 | bu21013_data->chip = pdata; | 460 | bu21013_data->chip = pdata; |
458 | bu21013_data->client = client; | 461 | bu21013_data->client = client; |
462 | |||
463 | bu21013_data->regulator = regulator_get(&client->dev, "V-TOUCH"); | ||
464 | if (IS_ERR(bu21013_data->regulator)) { | ||
465 | dev_err(&client->dev, "regulator_get failed\n"); | ||
466 | error = PTR_ERR(bu21013_data->regulator); | ||
467 | goto err_free_mem; | ||
468 | } | ||
469 | |||
470 | error = regulator_enable(bu21013_data->regulator); | ||
471 | if (error < 0) { | ||
472 | dev_err(&client->dev, "regulator enable failed\n"); | ||
473 | goto err_put_regulator; | ||
474 | } | ||
475 | |||
459 | bu21013_data->touch_stopped = false; | 476 | bu21013_data->touch_stopped = false; |
460 | init_waitqueue_head(&bu21013_data->wait); | 477 | init_waitqueue_head(&bu21013_data->wait); |
461 | 478 | ||
@@ -464,7 +481,7 @@ static int __devinit bu21013_probe(struct i2c_client *client, | |||
464 | error = pdata->cs_en(pdata->cs_pin); | 481 | error = pdata->cs_en(pdata->cs_pin); |
465 | if (error < 0) { | 482 | if (error < 0) { |
466 | dev_err(&client->dev, "chip init failed\n"); | 483 | dev_err(&client->dev, "chip init failed\n"); |
467 | goto err_free_mem; | 484 | goto err_disable_regulator; |
468 | } | 485 | } |
469 | } | 486 | } |
470 | 487 | ||
@@ -485,9 +502,9 @@ static int __devinit bu21013_probe(struct i2c_client *client, | |||
485 | __set_bit(EV_ABS, in_dev->evbit); | 502 | __set_bit(EV_ABS, in_dev->evbit); |
486 | 503 | ||
487 | input_set_abs_params(in_dev, ABS_MT_POSITION_X, 0, | 504 | input_set_abs_params(in_dev, ABS_MT_POSITION_X, 0, |
488 | pdata->x_max_res, 0, 0); | 505 | pdata->touch_x_max, 0, 0); |
489 | input_set_abs_params(in_dev, ABS_MT_POSITION_Y, 0, | 506 | input_set_abs_params(in_dev, ABS_MT_POSITION_Y, 0, |
490 | pdata->y_max_res, 0, 0); | 507 | pdata->touch_y_max, 0, 0); |
491 | input_set_drvdata(in_dev, bu21013_data); | 508 | input_set_drvdata(in_dev, bu21013_data); |
492 | 509 | ||
493 | error = request_threaded_irq(pdata->irq, NULL, bu21013_gpio_irq, | 510 | error = request_threaded_irq(pdata->irq, NULL, bu21013_gpio_irq, |
@@ -513,6 +530,10 @@ err_free_irq: | |||
513 | bu21013_free_irq(bu21013_data); | 530 | bu21013_free_irq(bu21013_data); |
514 | err_cs_disable: | 531 | err_cs_disable: |
515 | pdata->cs_dis(pdata->cs_pin); | 532 | pdata->cs_dis(pdata->cs_pin); |
533 | err_disable_regulator: | ||
534 | regulator_disable(bu21013_data->regulator); | ||
535 | err_put_regulator: | ||
536 | regulator_put(bu21013_data->regulator); | ||
516 | err_free_mem: | 537 | err_free_mem: |
517 | input_free_device(in_dev); | 538 | input_free_device(in_dev); |
518 | kfree(bu21013_data); | 539 | kfree(bu21013_data); |
@@ -535,6 +556,10 @@ static int __devexit bu21013_remove(struct i2c_client *client) | |||
535 | bu21013_data->chip->cs_dis(bu21013_data->chip->cs_pin); | 556 | bu21013_data->chip->cs_dis(bu21013_data->chip->cs_pin); |
536 | 557 | ||
537 | input_unregister_device(bu21013_data->in_dev); | 558 | input_unregister_device(bu21013_data->in_dev); |
559 | |||
560 | regulator_disable(bu21013_data->regulator); | ||
561 | regulator_put(bu21013_data->regulator); | ||
562 | |||
538 | kfree(bu21013_data); | 563 | kfree(bu21013_data); |
539 | 564 | ||
540 | device_init_wakeup(&client->dev, false); | 565 | device_init_wakeup(&client->dev, false); |
@@ -561,6 +586,8 @@ static int bu21013_suspend(struct device *dev) | |||
561 | else | 586 | else |
562 | disable_irq(bu21013_data->chip->irq); | 587 | disable_irq(bu21013_data->chip->irq); |
563 | 588 | ||
589 | regulator_disable(bu21013_data->regulator); | ||
590 | |||
564 | return 0; | 591 | return 0; |
565 | } | 592 | } |
566 | 593 | ||
@@ -577,6 +604,12 @@ static int bu21013_resume(struct device *dev) | |||
577 | struct i2c_client *client = bu21013_data->client; | 604 | struct i2c_client *client = bu21013_data->client; |
578 | int retval; | 605 | int retval; |
579 | 606 | ||
607 | retval = regulator_enable(bu21013_data->regulator); | ||
608 | if (retval < 0) { | ||
609 | dev_err(&client->dev, "bu21013 regulator enable failed\n"); | ||
610 | return retval; | ||
611 | } | ||
612 | |||
580 | retval = bu21013_init_chip(bu21013_data); | 613 | retval = bu21013_init_chip(bu21013_data); |
581 | if (retval < 0) { | 614 | if (retval < 0) { |
582 | dev_err(&client->dev, "bu21013 controller config failed\n"); | 615 | dev_err(&client->dev, "bu21013 controller config failed\n"); |
diff --git a/drivers/input/touchscreen/tnetv107x-ts.c b/drivers/input/touchscreen/tnetv107x-ts.c index cf1dba2e267..22a3411e93c 100644 --- a/drivers/input/touchscreen/tnetv107x-ts.c +++ b/drivers/input/touchscreen/tnetv107x-ts.c | |||
@@ -14,6 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/err.h> | ||
17 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
18 | #include <linux/input.h> | 19 | #include <linux/input.h> |
19 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
@@ -289,9 +290,9 @@ static int __devinit tsc_probe(struct platform_device *pdev) | |||
289 | } | 290 | } |
290 | 291 | ||
291 | ts->clk = clk_get(dev, NULL); | 292 | ts->clk = clk_get(dev, NULL); |
292 | if (!ts->clk) { | 293 | if (IS_ERR(ts->clk)) { |
293 | dev_err(dev, "cannot claim device clock\n"); | 294 | dev_err(dev, "cannot claim device clock\n"); |
294 | error = -EINVAL; | 295 | error = PTR_ERR(ts->clk); |
295 | goto error_clk; | 296 | goto error_clk; |
296 | } | 297 | } |
297 | 298 | ||
diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c index da3fa8dcdf5..666daf77872 100644 --- a/drivers/leds/leds-pwm.c +++ b/drivers/leds/leds-pwm.c | |||
@@ -69,6 +69,7 @@ static int led_pwm_probe(struct platform_device *pdev) | |||
69 | led_dat->pwm = pwm_request(cur_led->pwm_id, | 69 | led_dat->pwm = pwm_request(cur_led->pwm_id, |
70 | cur_led->name); | 70 | cur_led->name); |
71 | if (IS_ERR(led_dat->pwm)) { | 71 | if (IS_ERR(led_dat->pwm)) { |
72 | ret = PTR_ERR(led_dat->pwm); | ||
72 | dev_err(&pdev->dev, "unable to request PWM %d\n", | 73 | dev_err(&pdev->dev, "unable to request PWM %d\n", |
73 | cur_led->pwm_id); | 74 | cur_led->pwm_id); |
74 | goto err; | 75 | goto err; |
diff --git a/drivers/mmc/host/bfin_sdh.c b/drivers/mmc/host/bfin_sdh.c index bac7d62866b..0371bf50224 100644 --- a/drivers/mmc/host/bfin_sdh.c +++ b/drivers/mmc/host/bfin_sdh.c | |||
@@ -462,7 +462,7 @@ static int __devinit sdh_probe(struct platform_device *pdev) | |||
462 | goto out; | 462 | goto out; |
463 | } | 463 | } |
464 | 464 | ||
465 | mmc = mmc_alloc_host(sizeof(*mmc), &pdev->dev); | 465 | mmc = mmc_alloc_host(sizeof(struct sdh_host), &pdev->dev); |
466 | if (!mmc) { | 466 | if (!mmc) { |
467 | ret = -ENOMEM; | 467 | ret = -ENOMEM; |
468 | goto out; | 468 | goto out; |
diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c index b3a0ab0e4c2..74218ad677e 100644 --- a/drivers/mmc/host/jz4740_mmc.c +++ b/drivers/mmc/host/jz4740_mmc.c | |||
@@ -14,6 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/mmc/host.h> | 16 | #include <linux/mmc/host.h> |
17 | #include <linux/err.h> | ||
17 | #include <linux/io.h> | 18 | #include <linux/io.h> |
18 | #include <linux/irq.h> | 19 | #include <linux/irq.h> |
19 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
@@ -827,8 +828,8 @@ static int __devinit jz4740_mmc_probe(struct platform_device* pdev) | |||
827 | } | 828 | } |
828 | 829 | ||
829 | host->clk = clk_get(&pdev->dev, "mmc"); | 830 | host->clk = clk_get(&pdev->dev, "mmc"); |
830 | if (!host->clk) { | 831 | if (IS_ERR(host->clk)) { |
831 | ret = -ENOENT; | 832 | ret = PTR_ERR(host->clk); |
832 | dev_err(&pdev->dev, "Failed to get mmc clock\n"); | 833 | dev_err(&pdev->dev, "Failed to get mmc clock\n"); |
833 | goto err_free_host; | 834 | goto err_free_host; |
834 | } | 835 | } |
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 2de12fe155d..4b8dcd5b2a0 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -342,15 +342,15 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, | |||
342 | 342 | ||
343 | host->cmd = NULL; | 343 | host->cmd = NULL; |
344 | 344 | ||
345 | cmd->resp[0] = readl(base + MMCIRESPONSE0); | ||
346 | cmd->resp[1] = readl(base + MMCIRESPONSE1); | ||
347 | cmd->resp[2] = readl(base + MMCIRESPONSE2); | ||
348 | cmd->resp[3] = readl(base + MMCIRESPONSE3); | ||
349 | |||
350 | if (status & MCI_CMDTIMEOUT) { | 345 | if (status & MCI_CMDTIMEOUT) { |
351 | cmd->error = -ETIMEDOUT; | 346 | cmd->error = -ETIMEDOUT; |
352 | } else if (status & MCI_CMDCRCFAIL && cmd->flags & MMC_RSP_CRC) { | 347 | } else if (status & MCI_CMDCRCFAIL && cmd->flags & MMC_RSP_CRC) { |
353 | cmd->error = -EILSEQ; | 348 | cmd->error = -EILSEQ; |
349 | } else { | ||
350 | cmd->resp[0] = readl(base + MMCIRESPONSE0); | ||
351 | cmd->resp[1] = readl(base + MMCIRESPONSE1); | ||
352 | cmd->resp[2] = readl(base + MMCIRESPONSE2); | ||
353 | cmd->resp[3] = readl(base + MMCIRESPONSE3); | ||
354 | } | 354 | } |
355 | 355 | ||
356 | if (!cmd->data || cmd->error) { | 356 | if (!cmd->data || cmd->error) { |
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index 17203586305..5309ab95aad 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c | |||
@@ -277,10 +277,43 @@ static void sdhci_cmu_set_clock(struct sdhci_host *host, unsigned int clock) | |||
277 | host->clock = clock; | 277 | host->clock = clock; |
278 | } | 278 | } |
279 | 279 | ||
280 | /** | ||
281 | * sdhci_s3c_platform_8bit_width - support 8bit buswidth | ||
282 | * @host: The SDHCI host being queried | ||
283 | * @width: MMC_BUS_WIDTH_ macro for the bus width being requested | ||
284 | * | ||
285 | * We have 8-bit width support but is not a v3 controller. | ||
286 | * So we add platform_8bit_width() and support 8bit width. | ||
287 | */ | ||
288 | static int sdhci_s3c_platform_8bit_width(struct sdhci_host *host, int width) | ||
289 | { | ||
290 | u8 ctrl; | ||
291 | |||
292 | ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL); | ||
293 | |||
294 | switch (width) { | ||
295 | case MMC_BUS_WIDTH_8: | ||
296 | ctrl |= SDHCI_CTRL_8BITBUS; | ||
297 | ctrl &= ~SDHCI_CTRL_4BITBUS; | ||
298 | break; | ||
299 | case MMC_BUS_WIDTH_4: | ||
300 | ctrl |= SDHCI_CTRL_4BITBUS; | ||
301 | ctrl &= ~SDHCI_CTRL_8BITBUS; | ||
302 | break; | ||
303 | default: | ||
304 | break; | ||
305 | } | ||
306 | |||
307 | sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL); | ||
308 | |||
309 | return 0; | ||
310 | } | ||
311 | |||
280 | static struct sdhci_ops sdhci_s3c_ops = { | 312 | static struct sdhci_ops sdhci_s3c_ops = { |
281 | .get_max_clock = sdhci_s3c_get_max_clk, | 313 | .get_max_clock = sdhci_s3c_get_max_clk, |
282 | .set_clock = sdhci_s3c_set_clock, | 314 | .set_clock = sdhci_s3c_set_clock, |
283 | .get_min_clock = sdhci_s3c_get_min_clock, | 315 | .get_min_clock = sdhci_s3c_get_min_clock, |
316 | .platform_8bit_width = sdhci_s3c_platform_8bit_width, | ||
284 | }; | 317 | }; |
285 | 318 | ||
286 | static void sdhci_s3c_notify_change(struct platform_device *dev, int state) | 319 | static void sdhci_s3c_notify_change(struct platform_device *dev, int state) |
@@ -473,6 +506,9 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) | |||
473 | if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT) | 506 | if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT) |
474 | host->mmc->caps = MMC_CAP_NONREMOVABLE; | 507 | host->mmc->caps = MMC_CAP_NONREMOVABLE; |
475 | 508 | ||
509 | if (pdata->host_caps) | ||
510 | host->mmc->caps |= pdata->host_caps; | ||
511 | |||
476 | host->quirks |= (SDHCI_QUIRK_32BIT_DMA_ADDR | | 512 | host->quirks |= (SDHCI_QUIRK_32BIT_DMA_ADDR | |
477 | SDHCI_QUIRK_32BIT_DMA_SIZE); | 513 | SDHCI_QUIRK_32BIT_DMA_SIZE); |
478 | 514 | ||
diff --git a/drivers/mmc/host/ushc.c b/drivers/mmc/host/ushc.c index f8f65df9b01..f08f944ac53 100644 --- a/drivers/mmc/host/ushc.c +++ b/drivers/mmc/host/ushc.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/usb.h> | 20 | #include <linux/usb.h> |
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/usb.h> | ||
23 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
24 | #include <linux/dma-mapping.h> | 23 | #include <linux/dma-mapping.h> |
25 | #include <linux/mmc/host.h> | 24 | #include <linux/mmc/host.h> |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index df99edf3464..0ba59d5aeb7 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -7553,6 +7553,10 @@ bnx2_set_flags(struct net_device *dev, u32 data) | |||
7553 | !(data & ETH_FLAG_RXVLAN)) | 7553 | !(data & ETH_FLAG_RXVLAN)) |
7554 | return -EINVAL; | 7554 | return -EINVAL; |
7555 | 7555 | ||
7556 | /* TSO with VLAN tag won't work with current firmware */ | ||
7557 | if (!(data & ETH_FLAG_TXVLAN)) | ||
7558 | return -EINVAL; | ||
7559 | |||
7556 | rc = ethtool_op_set_flags(dev, data, ETH_FLAG_RXHASH | ETH_FLAG_RXVLAN | | 7560 | rc = ethtool_op_set_flags(dev, data, ETH_FLAG_RXHASH | ETH_FLAG_RXVLAN | |
7557 | ETH_FLAG_TXVLAN); | 7561 | ETH_FLAG_TXVLAN); |
7558 | if (rc) | 7562 | if (rc) |
@@ -7962,11 +7966,8 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) | |||
7962 | 7966 | ||
7963 | /* AER (Advanced Error Reporting) hooks */ | 7967 | /* AER (Advanced Error Reporting) hooks */ |
7964 | err = pci_enable_pcie_error_reporting(pdev); | 7968 | err = pci_enable_pcie_error_reporting(pdev); |
7965 | if (err) { | 7969 | if (!err) |
7966 | dev_err(&pdev->dev, "pci_enable_pcie_error_reporting " | 7970 | bp->flags |= BNX2_FLAG_AER_ENABLED; |
7967 | "failed 0x%x\n", err); | ||
7968 | /* non-fatal, continue */ | ||
7969 | } | ||
7970 | 7971 | ||
7971 | } else { | 7972 | } else { |
7972 | bp->pcix_cap = pci_find_capability(pdev, PCI_CAP_ID_PCIX); | 7973 | bp->pcix_cap = pci_find_capability(pdev, PCI_CAP_ID_PCIX); |
@@ -8229,8 +8230,10 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) | |||
8229 | return 0; | 8230 | return 0; |
8230 | 8231 | ||
8231 | err_out_unmap: | 8232 | err_out_unmap: |
8232 | if (bp->flags & BNX2_FLAG_PCIE) | 8233 | if (bp->flags & BNX2_FLAG_AER_ENABLED) { |
8233 | pci_disable_pcie_error_reporting(pdev); | 8234 | pci_disable_pcie_error_reporting(pdev); |
8235 | bp->flags &= ~BNX2_FLAG_AER_ENABLED; | ||
8236 | } | ||
8234 | 8237 | ||
8235 | if (bp->regview) { | 8238 | if (bp->regview) { |
8236 | iounmap(bp->regview); | 8239 | iounmap(bp->regview); |
@@ -8418,8 +8421,10 @@ bnx2_remove_one(struct pci_dev *pdev) | |||
8418 | 8421 | ||
8419 | kfree(bp->temp_stats_blk); | 8422 | kfree(bp->temp_stats_blk); |
8420 | 8423 | ||
8421 | if (bp->flags & BNX2_FLAG_PCIE) | 8424 | if (bp->flags & BNX2_FLAG_AER_ENABLED) { |
8422 | pci_disable_pcie_error_reporting(pdev); | 8425 | pci_disable_pcie_error_reporting(pdev); |
8426 | bp->flags &= ~BNX2_FLAG_AER_ENABLED; | ||
8427 | } | ||
8423 | 8428 | ||
8424 | free_netdev(dev); | 8429 | free_netdev(dev); |
8425 | 8430 | ||
@@ -8535,7 +8540,7 @@ static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev) | |||
8535 | } | 8540 | } |
8536 | rtnl_unlock(); | 8541 | rtnl_unlock(); |
8537 | 8542 | ||
8538 | if (!(bp->flags & BNX2_FLAG_PCIE)) | 8543 | if (!(bp->flags & BNX2_FLAG_AER_ENABLED)) |
8539 | return result; | 8544 | return result; |
8540 | 8545 | ||
8541 | err = pci_cleanup_aer_uncorrect_error_status(pdev); | 8546 | err = pci_cleanup_aer_uncorrect_error_status(pdev); |
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index 5488a2e82fe..f459fb2f9ad 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h | |||
@@ -6741,6 +6741,7 @@ struct bnx2 { | |||
6741 | #define BNX2_FLAG_JUMBO_BROKEN 0x00000800 | 6741 | #define BNX2_FLAG_JUMBO_BROKEN 0x00000800 |
6742 | #define BNX2_FLAG_CAN_KEEP_VLAN 0x00001000 | 6742 | #define BNX2_FLAG_CAN_KEEP_VLAN 0x00001000 |
6743 | #define BNX2_FLAG_BROKEN_STATS 0x00002000 | 6743 | #define BNX2_FLAG_BROKEN_STATS 0x00002000 |
6744 | #define BNX2_FLAG_AER_ENABLED 0x00004000 | ||
6744 | 6745 | ||
6745 | struct bnx2_napi bnx2_napi[BNX2_MAX_MSIX_VEC]; | 6746 | struct bnx2_napi bnx2_napi[BNX2_MAX_MSIX_VEC]; |
6746 | 6747 | ||
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 171782e2bb3..1024ae15822 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -2470,6 +2470,10 @@ int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct pac | |||
2470 | if (!(dev->flags & IFF_MASTER)) | 2470 | if (!(dev->flags & IFF_MASTER)) |
2471 | goto out; | 2471 | goto out; |
2472 | 2472 | ||
2473 | skb = skb_share_check(skb, GFP_ATOMIC); | ||
2474 | if (!skb) | ||
2475 | goto out; | ||
2476 | |||
2473 | if (!pskb_may_pull(skb, sizeof(struct lacpdu))) | 2477 | if (!pskb_may_pull(skb, sizeof(struct lacpdu))) |
2474 | goto out; | 2478 | goto out; |
2475 | 2479 | ||
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index f4e638c6512..5c6fba802f2 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -326,6 +326,10 @@ static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct | |||
326 | goto out; | 326 | goto out; |
327 | } | 327 | } |
328 | 328 | ||
329 | skb = skb_share_check(skb, GFP_ATOMIC); | ||
330 | if (!skb) | ||
331 | goto out; | ||
332 | |||
329 | if (!pskb_may_pull(skb, arp_hdr_len(bond_dev))) | 333 | if (!pskb_may_pull(skb, arp_hdr_len(bond_dev))) |
330 | goto out; | 334 | goto out; |
331 | 335 | ||
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index b1025b85acf..163e0b06eaa 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -2733,6 +2733,10 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack | |||
2733 | if (!slave || !slave_do_arp_validate(bond, slave)) | 2733 | if (!slave || !slave_do_arp_validate(bond, slave)) |
2734 | goto out_unlock; | 2734 | goto out_unlock; |
2735 | 2735 | ||
2736 | skb = skb_share_check(skb, GFP_ATOMIC); | ||
2737 | if (!skb) | ||
2738 | goto out_unlock; | ||
2739 | |||
2736 | if (!pskb_may_pull(skb, arp_hdr_len(dev))) | 2740 | if (!pskb_may_pull(skb, arp_hdr_len(dev))) |
2737 | goto out_unlock; | 2741 | goto out_unlock; |
2738 | 2742 | ||
diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig index d5a9db60ade..986195eaa57 100644 --- a/drivers/net/can/Kconfig +++ b/drivers/net/can/Kconfig | |||
@@ -117,6 +117,8 @@ source "drivers/net/can/sja1000/Kconfig" | |||
117 | 117 | ||
118 | source "drivers/net/can/usb/Kconfig" | 118 | source "drivers/net/can/usb/Kconfig" |
119 | 119 | ||
120 | source "drivers/net/can/softing/Kconfig" | ||
121 | |||
120 | config CAN_DEBUG_DEVICES | 122 | config CAN_DEBUG_DEVICES |
121 | bool "CAN devices debugging messages" | 123 | bool "CAN devices debugging messages" |
122 | depends on CAN | 124 | depends on CAN |
diff --git a/drivers/net/can/Makefile b/drivers/net/can/Makefile index 07ca159ba3f..53c82a71778 100644 --- a/drivers/net/can/Makefile +++ b/drivers/net/can/Makefile | |||
@@ -9,6 +9,7 @@ obj-$(CONFIG_CAN_DEV) += can-dev.o | |||
9 | can-dev-y := dev.o | 9 | can-dev-y := dev.o |
10 | 10 | ||
11 | obj-y += usb/ | 11 | obj-y += usb/ |
12 | obj-y += softing/ | ||
12 | 13 | ||
13 | obj-$(CONFIG_CAN_SJA1000) += sja1000/ | 14 | obj-$(CONFIG_CAN_SJA1000) += sja1000/ |
14 | obj-$(CONFIG_CAN_MSCAN) += mscan/ | 15 | obj-$(CONFIG_CAN_MSCAN) += mscan/ |
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index 7ef83d06f7e..2532b963153 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * at91_can.c - CAN network driver for AT91 SoC CAN controller | 2 | * at91_can.c - CAN network driver for AT91 SoC CAN controller |
3 | * | 3 | * |
4 | * (C) 2007 by Hans J. Koch <hjk@hansjkoch.de> | 4 | * (C) 2007 by Hans J. Koch <hjk@hansjkoch.de> |
5 | * (C) 2008, 2009, 2010 by Marc Kleine-Budde <kernel@pengutronix.de> | 5 | * (C) 2008, 2009, 2010, 2011 by Marc Kleine-Budde <kernel@pengutronix.de> |
6 | * | 6 | * |
7 | * This software may be distributed under the terms of the GNU General | 7 | * This software may be distributed under the terms of the GNU General |
8 | * Public License ("GPL") version 2 as distributed in the 'COPYING' | 8 | * Public License ("GPL") version 2 as distributed in the 'COPYING' |
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/netdevice.h> | 31 | #include <linux/netdevice.h> |
32 | #include <linux/platform_device.h> | 32 | #include <linux/platform_device.h> |
33 | #include <linux/rtnetlink.h> | ||
33 | #include <linux/skbuff.h> | 34 | #include <linux/skbuff.h> |
34 | #include <linux/spinlock.h> | 35 | #include <linux/spinlock.h> |
35 | #include <linux/string.h> | 36 | #include <linux/string.h> |
@@ -40,22 +41,23 @@ | |||
40 | 41 | ||
41 | #include <mach/board.h> | 42 | #include <mach/board.h> |
42 | 43 | ||
43 | #define AT91_NAPI_WEIGHT 12 | 44 | #define AT91_NAPI_WEIGHT 11 |
44 | 45 | ||
45 | /* | 46 | /* |
46 | * RX/TX Mailbox split | 47 | * RX/TX Mailbox split |
47 | * don't dare to touch | 48 | * don't dare to touch |
48 | */ | 49 | */ |
49 | #define AT91_MB_RX_NUM 12 | 50 | #define AT91_MB_RX_NUM 11 |
50 | #define AT91_MB_TX_SHIFT 2 | 51 | #define AT91_MB_TX_SHIFT 2 |
51 | 52 | ||
52 | #define AT91_MB_RX_FIRST 0 | 53 | #define AT91_MB_RX_FIRST 1 |
53 | #define AT91_MB_RX_LAST (AT91_MB_RX_FIRST + AT91_MB_RX_NUM - 1) | 54 | #define AT91_MB_RX_LAST (AT91_MB_RX_FIRST + AT91_MB_RX_NUM - 1) |
54 | 55 | ||
55 | #define AT91_MB_RX_MASK(i) ((1 << (i)) - 1) | 56 | #define AT91_MB_RX_MASK(i) ((1 << (i)) - 1) |
56 | #define AT91_MB_RX_SPLIT 8 | 57 | #define AT91_MB_RX_SPLIT 8 |
57 | #define AT91_MB_RX_LOW_LAST (AT91_MB_RX_SPLIT - 1) | 58 | #define AT91_MB_RX_LOW_LAST (AT91_MB_RX_SPLIT - 1) |
58 | #define AT91_MB_RX_LOW_MASK (AT91_MB_RX_MASK(AT91_MB_RX_SPLIT)) | 59 | #define AT91_MB_RX_LOW_MASK (AT91_MB_RX_MASK(AT91_MB_RX_SPLIT) & \ |
60 | ~AT91_MB_RX_MASK(AT91_MB_RX_FIRST)) | ||
59 | 61 | ||
60 | #define AT91_MB_TX_NUM (1 << AT91_MB_TX_SHIFT) | 62 | #define AT91_MB_TX_NUM (1 << AT91_MB_TX_SHIFT) |
61 | #define AT91_MB_TX_FIRST (AT91_MB_RX_LAST + 1) | 63 | #define AT91_MB_TX_FIRST (AT91_MB_RX_LAST + 1) |
@@ -168,6 +170,8 @@ struct at91_priv { | |||
168 | 170 | ||
169 | struct clk *clk; | 171 | struct clk *clk; |
170 | struct at91_can_data *pdata; | 172 | struct at91_can_data *pdata; |
173 | |||
174 | canid_t mb0_id; | ||
171 | }; | 175 | }; |
172 | 176 | ||
173 | static struct can_bittiming_const at91_bittiming_const = { | 177 | static struct can_bittiming_const at91_bittiming_const = { |
@@ -220,6 +224,18 @@ static inline void set_mb_mode(const struct at91_priv *priv, unsigned int mb, | |||
220 | set_mb_mode_prio(priv, mb, mode, 0); | 224 | set_mb_mode_prio(priv, mb, mode, 0); |
221 | } | 225 | } |
222 | 226 | ||
227 | static inline u32 at91_can_id_to_reg_mid(canid_t can_id) | ||
228 | { | ||
229 | u32 reg_mid; | ||
230 | |||
231 | if (can_id & CAN_EFF_FLAG) | ||
232 | reg_mid = (can_id & CAN_EFF_MASK) | AT91_MID_MIDE; | ||
233 | else | ||
234 | reg_mid = (can_id & CAN_SFF_MASK) << 18; | ||
235 | |||
236 | return reg_mid; | ||
237 | } | ||
238 | |||
223 | /* | 239 | /* |
224 | * Swtich transceiver on or off | 240 | * Swtich transceiver on or off |
225 | */ | 241 | */ |
@@ -233,12 +249,22 @@ static void at91_setup_mailboxes(struct net_device *dev) | |||
233 | { | 249 | { |
234 | struct at91_priv *priv = netdev_priv(dev); | 250 | struct at91_priv *priv = netdev_priv(dev); |
235 | unsigned int i; | 251 | unsigned int i; |
252 | u32 reg_mid; | ||
236 | 253 | ||
237 | /* | 254 | /* |
238 | * The first 12 mailboxes are used as a reception FIFO. The | 255 | * Due to a chip bug (errata 50.2.6.3 & 50.3.5.3) the first |
239 | * last mailbox is configured with overwrite option. The | 256 | * mailbox is disabled. The next 11 mailboxes are used as a |
240 | * overwrite flag indicates a FIFO overflow. | 257 | * reception FIFO. The last mailbox is configured with |
258 | * overwrite option. The overwrite flag indicates a FIFO | ||
259 | * overflow. | ||
241 | */ | 260 | */ |
261 | reg_mid = at91_can_id_to_reg_mid(priv->mb0_id); | ||
262 | for (i = 0; i < AT91_MB_RX_FIRST; i++) { | ||
263 | set_mb_mode(priv, i, AT91_MB_MODE_DISABLED); | ||
264 | at91_write(priv, AT91_MID(i), reg_mid); | ||
265 | at91_write(priv, AT91_MCR(i), 0x0); /* clear dlc */ | ||
266 | } | ||
267 | |||
242 | for (i = AT91_MB_RX_FIRST; i < AT91_MB_RX_LAST; i++) | 268 | for (i = AT91_MB_RX_FIRST; i < AT91_MB_RX_LAST; i++) |
243 | set_mb_mode(priv, i, AT91_MB_MODE_RX); | 269 | set_mb_mode(priv, i, AT91_MB_MODE_RX); |
244 | set_mb_mode(priv, AT91_MB_RX_LAST, AT91_MB_MODE_RX_OVRWR); | 270 | set_mb_mode(priv, AT91_MB_RX_LAST, AT91_MB_MODE_RX_OVRWR); |
@@ -254,7 +280,8 @@ static void at91_setup_mailboxes(struct net_device *dev) | |||
254 | set_mb_mode_prio(priv, i, AT91_MB_MODE_TX, 0); | 280 | set_mb_mode_prio(priv, i, AT91_MB_MODE_TX, 0); |
255 | 281 | ||
256 | /* Reset tx and rx helper pointers */ | 282 | /* Reset tx and rx helper pointers */ |
257 | priv->tx_next = priv->tx_echo = priv->rx_next = 0; | 283 | priv->tx_next = priv->tx_echo = 0; |
284 | priv->rx_next = AT91_MB_RX_FIRST; | ||
258 | } | 285 | } |
259 | 286 | ||
260 | static int at91_set_bittiming(struct net_device *dev) | 287 | static int at91_set_bittiming(struct net_device *dev) |
@@ -372,12 +399,7 @@ static netdev_tx_t at91_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
372 | netdev_err(dev, "BUG! TX buffer full when queue awake!\n"); | 399 | netdev_err(dev, "BUG! TX buffer full when queue awake!\n"); |
373 | return NETDEV_TX_BUSY; | 400 | return NETDEV_TX_BUSY; |
374 | } | 401 | } |
375 | 402 | reg_mid = at91_can_id_to_reg_mid(cf->can_id); | |
376 | if (cf->can_id & CAN_EFF_FLAG) | ||
377 | reg_mid = (cf->can_id & CAN_EFF_MASK) | AT91_MID_MIDE; | ||
378 | else | ||
379 | reg_mid = (cf->can_id & CAN_SFF_MASK) << 18; | ||
380 | |||
381 | reg_mcr = ((cf->can_id & CAN_RTR_FLAG) ? AT91_MCR_MRTR : 0) | | 403 | reg_mcr = ((cf->can_id & CAN_RTR_FLAG) ? AT91_MCR_MRTR : 0) | |
382 | (cf->can_dlc << 16) | AT91_MCR_MTCR; | 404 | (cf->can_dlc << 16) | AT91_MCR_MTCR; |
383 | 405 | ||
@@ -539,27 +561,31 @@ static void at91_read_msg(struct net_device *dev, unsigned int mb) | |||
539 | * | 561 | * |
540 | * Theory of Operation: | 562 | * Theory of Operation: |
541 | * | 563 | * |
542 | * 12 of the 16 mailboxes on the chip are reserved for RX. we split | 564 | * 11 of the 16 mailboxes on the chip are reserved for RX. we split |
543 | * them into 2 groups. The lower group holds 8 and upper 4 mailboxes. | 565 | * them into 2 groups. The lower group holds 7 and upper 4 mailboxes. |
544 | * | 566 | * |
545 | * Like it or not, but the chip always saves a received CAN message | 567 | * Like it or not, but the chip always saves a received CAN message |
546 | * into the first free mailbox it finds (starting with the | 568 | * into the first free mailbox it finds (starting with the |
547 | * lowest). This makes it very difficult to read the messages in the | 569 | * lowest). This makes it very difficult to read the messages in the |
548 | * right order from the chip. This is how we work around that problem: | 570 | * right order from the chip. This is how we work around that problem: |
549 | * | 571 | * |
550 | * The first message goes into mb nr. 0 and issues an interrupt. All | 572 | * The first message goes into mb nr. 1 and issues an interrupt. All |
551 | * rx ints are disabled in the interrupt handler and a napi poll is | 573 | * rx ints are disabled in the interrupt handler and a napi poll is |
552 | * scheduled. We read the mailbox, but do _not_ reenable the mb (to | 574 | * scheduled. We read the mailbox, but do _not_ reenable the mb (to |
553 | * receive another message). | 575 | * receive another message). |
554 | * | 576 | * |
555 | * lower mbxs upper | 577 | * lower mbxs upper |
556 | * ______^______ __^__ | 578 | * ____^______ __^__ |
557 | * / \ / \ | 579 | * / \ / \ |
558 | * +-+-+-+-+-+-+-+-++-+-+-+-+ | 580 | * +-+-+-+-+-+-+-+-++-+-+-+-+ |
559 | * |x|x|x|x|x|x|x|x|| | | | | | 581 | * | |x|x|x|x|x|x|x|| | | | | |
560 | * +-+-+-+-+-+-+-+-++-+-+-+-+ | 582 | * +-+-+-+-+-+-+-+-++-+-+-+-+ |
561 | * 0 0 0 0 0 0 0 0 0 0 1 1 \ mail | 583 | * 0 0 0 0 0 0 0 0 0 0 1 1 \ mail |
562 | * 0 1 2 3 4 5 6 7 8 9 0 1 / box | 584 | * 0 1 2 3 4 5 6 7 8 9 0 1 / box |
585 | * ^ | ||
586 | * | | ||
587 | * \ | ||
588 | * unused, due to chip bug | ||
563 | * | 589 | * |
564 | * The variable priv->rx_next points to the next mailbox to read a | 590 | * The variable priv->rx_next points to the next mailbox to read a |
565 | * message from. As long we're in the lower mailboxes we just read the | 591 | * message from. As long we're in the lower mailboxes we just read the |
@@ -590,10 +616,10 @@ static int at91_poll_rx(struct net_device *dev, int quota) | |||
590 | "order of incoming frames cannot be guaranteed\n"); | 616 | "order of incoming frames cannot be guaranteed\n"); |
591 | 617 | ||
592 | again: | 618 | again: |
593 | for (mb = find_next_bit(addr, AT91_MB_RX_NUM, priv->rx_next); | 619 | for (mb = find_next_bit(addr, AT91_MB_RX_LAST + 1, priv->rx_next); |
594 | mb < AT91_MB_RX_NUM && quota > 0; | 620 | mb < AT91_MB_RX_LAST + 1 && quota > 0; |
595 | reg_sr = at91_read(priv, AT91_SR), | 621 | reg_sr = at91_read(priv, AT91_SR), |
596 | mb = find_next_bit(addr, AT91_MB_RX_NUM, ++priv->rx_next)) { | 622 | mb = find_next_bit(addr, AT91_MB_RX_LAST + 1, ++priv->rx_next)) { |
597 | at91_read_msg(dev, mb); | 623 | at91_read_msg(dev, mb); |
598 | 624 | ||
599 | /* reactivate mailboxes */ | 625 | /* reactivate mailboxes */ |
@@ -610,8 +636,8 @@ static int at91_poll_rx(struct net_device *dev, int quota) | |||
610 | 636 | ||
611 | /* upper group completed, look again in lower */ | 637 | /* upper group completed, look again in lower */ |
612 | if (priv->rx_next > AT91_MB_RX_LOW_LAST && | 638 | if (priv->rx_next > AT91_MB_RX_LOW_LAST && |
613 | quota > 0 && mb >= AT91_MB_RX_NUM) { | 639 | quota > 0 && mb > AT91_MB_RX_LAST) { |
614 | priv->rx_next = 0; | 640 | priv->rx_next = AT91_MB_RX_FIRST; |
615 | goto again; | 641 | goto again; |
616 | } | 642 | } |
617 | 643 | ||
@@ -1037,6 +1063,64 @@ static const struct net_device_ops at91_netdev_ops = { | |||
1037 | .ndo_start_xmit = at91_start_xmit, | 1063 | .ndo_start_xmit = at91_start_xmit, |
1038 | }; | 1064 | }; |
1039 | 1065 | ||
1066 | static ssize_t at91_sysfs_show_mb0_id(struct device *dev, | ||
1067 | struct device_attribute *attr, char *buf) | ||
1068 | { | ||
1069 | struct at91_priv *priv = netdev_priv(to_net_dev(dev)); | ||
1070 | |||
1071 | if (priv->mb0_id & CAN_EFF_FLAG) | ||
1072 | return snprintf(buf, PAGE_SIZE, "0x%08x\n", priv->mb0_id); | ||
1073 | else | ||
1074 | return snprintf(buf, PAGE_SIZE, "0x%03x\n", priv->mb0_id); | ||
1075 | } | ||
1076 | |||
1077 | static ssize_t at91_sysfs_set_mb0_id(struct device *dev, | ||
1078 | struct device_attribute *attr, const char *buf, size_t count) | ||
1079 | { | ||
1080 | struct net_device *ndev = to_net_dev(dev); | ||
1081 | struct at91_priv *priv = netdev_priv(ndev); | ||
1082 | unsigned long can_id; | ||
1083 | ssize_t ret; | ||
1084 | int err; | ||
1085 | |||
1086 | rtnl_lock(); | ||
1087 | |||
1088 | if (ndev->flags & IFF_UP) { | ||
1089 | ret = -EBUSY; | ||
1090 | goto out; | ||
1091 | } | ||
1092 | |||
1093 | err = strict_strtoul(buf, 0, &can_id); | ||
1094 | if (err) { | ||
1095 | ret = err; | ||
1096 | goto out; | ||
1097 | } | ||
1098 | |||
1099 | if (can_id & CAN_EFF_FLAG) | ||
1100 | can_id &= CAN_EFF_MASK | CAN_EFF_FLAG; | ||
1101 | else | ||
1102 | can_id &= CAN_SFF_MASK; | ||
1103 | |||
1104 | priv->mb0_id = can_id; | ||
1105 | ret = count; | ||
1106 | |||
1107 | out: | ||
1108 | rtnl_unlock(); | ||
1109 | return ret; | ||
1110 | } | ||
1111 | |||
1112 | static DEVICE_ATTR(mb0_id, S_IWUGO | S_IRUGO, | ||
1113 | at91_sysfs_show_mb0_id, at91_sysfs_set_mb0_id); | ||
1114 | |||
1115 | static struct attribute *at91_sysfs_attrs[] = { | ||
1116 | &dev_attr_mb0_id.attr, | ||
1117 | NULL, | ||
1118 | }; | ||
1119 | |||
1120 | static struct attribute_group at91_sysfs_attr_group = { | ||
1121 | .attrs = at91_sysfs_attrs, | ||
1122 | }; | ||
1123 | |||
1040 | static int __devinit at91_can_probe(struct platform_device *pdev) | 1124 | static int __devinit at91_can_probe(struct platform_device *pdev) |
1041 | { | 1125 | { |
1042 | struct net_device *dev; | 1126 | struct net_device *dev; |
@@ -1082,6 +1166,7 @@ static int __devinit at91_can_probe(struct platform_device *pdev) | |||
1082 | dev->netdev_ops = &at91_netdev_ops; | 1166 | dev->netdev_ops = &at91_netdev_ops; |
1083 | dev->irq = irq; | 1167 | dev->irq = irq; |
1084 | dev->flags |= IFF_ECHO; | 1168 | dev->flags |= IFF_ECHO; |
1169 | dev->sysfs_groups[0] = &at91_sysfs_attr_group; | ||
1085 | 1170 | ||
1086 | priv = netdev_priv(dev); | 1171 | priv = netdev_priv(dev); |
1087 | priv->can.clock.freq = clk_get_rate(clk); | 1172 | priv->can.clock.freq = clk_get_rate(clk); |
@@ -1093,6 +1178,7 @@ static int __devinit at91_can_probe(struct platform_device *pdev) | |||
1093 | priv->dev = dev; | 1178 | priv->dev = dev; |
1094 | priv->clk = clk; | 1179 | priv->clk = clk; |
1095 | priv->pdata = pdev->dev.platform_data; | 1180 | priv->pdata = pdev->dev.platform_data; |
1181 | priv->mb0_id = 0x7ff; | ||
1096 | 1182 | ||
1097 | netif_napi_add(dev, &priv->napi, at91_poll, AT91_NAPI_WEIGHT); | 1183 | netif_napi_add(dev, &priv->napi, at91_poll, AT91_NAPI_WEIGHT); |
1098 | 1184 | ||
diff --git a/drivers/net/can/softing/Kconfig b/drivers/net/can/softing/Kconfig new file mode 100644 index 00000000000..92bd6bdde5e --- /dev/null +++ b/drivers/net/can/softing/Kconfig | |||
@@ -0,0 +1,30 @@ | |||
1 | config CAN_SOFTING | ||
2 | tristate "Softing Gmbh CAN generic support" | ||
3 | depends on CAN_DEV | ||
4 | ---help--- | ||
5 | Support for CAN cards from Softing Gmbh & some cards | ||
6 | from Vector Gmbh. | ||
7 | Softing Gmbh CAN cards come with 1 or 2 physical busses. | ||
8 | Those cards typically use Dual Port RAM to communicate | ||
9 | with the host CPU. The interface is then identical for PCI | ||
10 | and PCMCIA cards. This driver operates on a platform device, | ||
11 | which has been created by softing_cs or softing_pci driver. | ||
12 | Warning: | ||
13 | The API of the card does not allow fine control per bus, but | ||
14 | controls the 2 busses on the card together. | ||
15 | As such, some actions (start/stop/busoff recovery) on 1 bus | ||
16 | must bring down the other bus too temporarily. | ||
17 | |||
18 | config CAN_SOFTING_CS | ||
19 | tristate "Softing Gmbh CAN pcmcia cards" | ||
20 | depends on PCMCIA | ||
21 | select CAN_SOFTING | ||
22 | ---help--- | ||
23 | Support for PCMCIA cards from Softing Gmbh & some cards | ||
24 | from Vector Gmbh. | ||
25 | You need firmware for these, which you can get at | ||
26 | http://developer.berlios.de/projects/socketcan/ | ||
27 | This version of the driver is written against | ||
28 | firmware version 4.6 (softing-fw-4.6-binaries.tar.gz) | ||
29 | In order to use the card as CAN device, you need the Softing generic | ||
30 | support too. | ||
diff --git a/drivers/net/can/softing/Makefile b/drivers/net/can/softing/Makefile new file mode 100644 index 00000000000..c5e5016c742 --- /dev/null +++ b/drivers/net/can/softing/Makefile | |||
@@ -0,0 +1,6 @@ | |||
1 | |||
2 | softing-y := softing_main.o softing_fw.o | ||
3 | obj-$(CONFIG_CAN_SOFTING) += softing.o | ||
4 | obj-$(CONFIG_CAN_SOFTING_CS) += softing_cs.o | ||
5 | |||
6 | ccflags-$(CONFIG_CAN_DEBUG_DEVICES) := -DDEBUG | ||
diff --git a/drivers/net/can/softing/softing.h b/drivers/net/can/softing/softing.h new file mode 100644 index 00000000000..7ec9f4db3d5 --- /dev/null +++ b/drivers/net/can/softing/softing.h | |||
@@ -0,0 +1,167 @@ | |||
1 | /* | ||
2 | * softing common interfaces | ||
3 | * | ||
4 | * by Kurt Van Dijck, 2008-2010 | ||
5 | */ | ||
6 | |||
7 | #include <linux/atomic.h> | ||
8 | #include <linux/netdevice.h> | ||
9 | #include <linux/ktime.h> | ||
10 | #include <linux/mutex.h> | ||
11 | #include <linux/spinlock.h> | ||
12 | #include <linux/can.h> | ||
13 | #include <linux/can/dev.h> | ||
14 | |||
15 | #include "softing_platform.h" | ||
16 | |||
17 | struct softing; | ||
18 | |||
19 | struct softing_priv { | ||
20 | struct can_priv can; /* must be the first member! */ | ||
21 | struct net_device *netdev; | ||
22 | struct softing *card; | ||
23 | struct { | ||
24 | int pending; | ||
25 | /* variables wich hold the circular buffer */ | ||
26 | int echo_put; | ||
27 | int echo_get; | ||
28 | } tx; | ||
29 | struct can_bittiming_const btr_const; | ||
30 | int index; | ||
31 | uint8_t output; | ||
32 | uint16_t chip; | ||
33 | }; | ||
34 | #define netdev2softing(netdev) ((struct softing_priv *)netdev_priv(netdev)) | ||
35 | |||
36 | struct softing { | ||
37 | const struct softing_platform_data *pdat; | ||
38 | struct platform_device *pdev; | ||
39 | struct net_device *net[2]; | ||
40 | spinlock_t spin; /* protect this structure & DPRAM access */ | ||
41 | ktime_t ts_ref; | ||
42 | ktime_t ts_overflow; /* timestamp overflow value, in ktime */ | ||
43 | |||
44 | struct { | ||
45 | /* indication of firmware status */ | ||
46 | int up; | ||
47 | /* protection of the 'up' variable */ | ||
48 | struct mutex lock; | ||
49 | } fw; | ||
50 | struct { | ||
51 | int nr; | ||
52 | int requested; | ||
53 | int svc_count; | ||
54 | unsigned int dpram_position; | ||
55 | } irq; | ||
56 | struct { | ||
57 | int pending; | ||
58 | int last_bus; | ||
59 | /* | ||
60 | * keep the bus that last tx'd a message, | ||
61 | * in order to let every netdev queue resume | ||
62 | */ | ||
63 | } tx; | ||
64 | __iomem uint8_t *dpram; | ||
65 | unsigned long dpram_phys; | ||
66 | unsigned long dpram_size; | ||
67 | struct { | ||
68 | uint16_t fw_version, hw_version, license, serial; | ||
69 | uint16_t chip[2]; | ||
70 | unsigned int freq; /* remote cpu's operating frequency */ | ||
71 | } id; | ||
72 | }; | ||
73 | |||
74 | extern int softing_default_output(struct net_device *netdev); | ||
75 | |||
76 | extern ktime_t softing_raw2ktime(struct softing *card, u32 raw); | ||
77 | |||
78 | extern int softing_chip_poweron(struct softing *card); | ||
79 | |||
80 | extern int softing_bootloader_command(struct softing *card, int16_t cmd, | ||
81 | const char *msg); | ||
82 | |||
83 | /* Load firmware after reset */ | ||
84 | extern int softing_load_fw(const char *file, struct softing *card, | ||
85 | __iomem uint8_t *virt, unsigned int size, int offset); | ||
86 | |||
87 | /* Load final application firmware after bootloader */ | ||
88 | extern int softing_load_app_fw(const char *file, struct softing *card); | ||
89 | |||
90 | /* | ||
91 | * enable or disable irq | ||
92 | * only called with fw.lock locked | ||
93 | */ | ||
94 | extern int softing_enable_irq(struct softing *card, int enable); | ||
95 | |||
96 | /* start/stop 1 bus on card */ | ||
97 | extern int softing_startstop(struct net_device *netdev, int up); | ||
98 | |||
99 | /* netif_rx() */ | ||
100 | extern int softing_netdev_rx(struct net_device *netdev, | ||
101 | const struct can_frame *msg, ktime_t ktime); | ||
102 | |||
103 | /* SOFTING DPRAM mappings */ | ||
104 | #define DPRAM_RX 0x0000 | ||
105 | #define DPRAM_RX_SIZE 32 | ||
106 | #define DPRAM_RX_CNT 16 | ||
107 | #define DPRAM_RX_RD 0x0201 /* uint8_t */ | ||
108 | #define DPRAM_RX_WR 0x0205 /* uint8_t */ | ||
109 | #define DPRAM_RX_LOST 0x0207 /* uint8_t */ | ||
110 | |||
111 | #define DPRAM_FCT_PARAM 0x0300 /* int16_t [20] */ | ||
112 | #define DPRAM_FCT_RESULT 0x0328 /* int16_t */ | ||
113 | #define DPRAM_FCT_HOST 0x032b /* uint16_t */ | ||
114 | |||
115 | #define DPRAM_INFO_BUSSTATE 0x0331 /* uint16_t */ | ||
116 | #define DPRAM_INFO_BUSSTATE2 0x0335 /* uint16_t */ | ||
117 | #define DPRAM_INFO_ERRSTATE 0x0339 /* uint16_t */ | ||
118 | #define DPRAM_INFO_ERRSTATE2 0x033d /* uint16_t */ | ||
119 | #define DPRAM_RESET 0x0341 /* uint16_t */ | ||
120 | #define DPRAM_CLR_RECV_FIFO 0x0345 /* uint16_t */ | ||
121 | #define DPRAM_RESET_TIME 0x034d /* uint16_t */ | ||
122 | #define DPRAM_TIME 0x0350 /* uint64_t */ | ||
123 | #define DPRAM_WR_START 0x0358 /* uint8_t */ | ||
124 | #define DPRAM_WR_END 0x0359 /* uint8_t */ | ||
125 | #define DPRAM_RESET_RX_FIFO 0x0361 /* uint16_t */ | ||
126 | #define DPRAM_RESET_TX_FIFO 0x0364 /* uint8_t */ | ||
127 | #define DPRAM_READ_FIFO_LEVEL 0x0365 /* uint8_t */ | ||
128 | #define DPRAM_RX_FIFO_LEVEL 0x0366 /* uint16_t */ | ||
129 | #define DPRAM_TX_FIFO_LEVEL 0x0366 /* uint16_t */ | ||
130 | |||
131 | #define DPRAM_TX 0x0400 /* uint16_t */ | ||
132 | #define DPRAM_TX_SIZE 16 | ||
133 | #define DPRAM_TX_CNT 32 | ||
134 | #define DPRAM_TX_RD 0x0601 /* uint8_t */ | ||
135 | #define DPRAM_TX_WR 0x0605 /* uint8_t */ | ||
136 | |||
137 | #define DPRAM_COMMAND 0x07e0 /* uint16_t */ | ||
138 | #define DPRAM_RECEIPT 0x07f0 /* uint16_t */ | ||
139 | #define DPRAM_IRQ_TOHOST 0x07fe /* uint8_t */ | ||
140 | #define DPRAM_IRQ_TOCARD 0x07ff /* uint8_t */ | ||
141 | |||
142 | #define DPRAM_V2_RESET 0x0e00 /* uint8_t */ | ||
143 | #define DPRAM_V2_IRQ_TOHOST 0x0e02 /* uint8_t */ | ||
144 | |||
145 | #define TXMAX (DPRAM_TX_CNT - 1) | ||
146 | |||
147 | /* DPRAM return codes */ | ||
148 | #define RES_NONE 0 | ||
149 | #define RES_OK 1 | ||
150 | #define RES_NOK 2 | ||
151 | #define RES_UNKNOWN 3 | ||
152 | /* DPRAM flags */ | ||
153 | #define CMD_TX 0x01 | ||
154 | #define CMD_ACK 0x02 | ||
155 | #define CMD_XTD 0x04 | ||
156 | #define CMD_RTR 0x08 | ||
157 | #define CMD_ERR 0x10 | ||
158 | #define CMD_BUS2 0x80 | ||
159 | |||
160 | /* returned fifo entry bus state masks */ | ||
161 | #define SF_MASK_BUSOFF 0x80 | ||
162 | #define SF_MASK_EPASSIVE 0x60 | ||
163 | |||
164 | /* bus states */ | ||
165 | #define STATE_BUSOFF 2 | ||
166 | #define STATE_EPASSIVE 1 | ||
167 | #define STATE_EACTIVE 0 | ||
diff --git a/drivers/net/can/softing/softing_cs.c b/drivers/net/can/softing/softing_cs.c new file mode 100644 index 00000000000..300fe75dd1a --- /dev/null +++ b/drivers/net/can/softing/softing_cs.c | |||
@@ -0,0 +1,359 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2008-2010 | ||
3 | * | ||
4 | * - Kurt Van Dijck, EIA Electronics | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the version 2 of the GNU General Public License | ||
8 | * as published by the Free Software Foundation | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #include <linux/module.h> | ||
21 | #include <linux/kernel.h> | ||
22 | |||
23 | #include <pcmcia/cistpl.h> | ||
24 | #include <pcmcia/ds.h> | ||
25 | |||
26 | #include "softing_platform.h" | ||
27 | |||
28 | static int softingcs_index; | ||
29 | static spinlock_t softingcs_index_lock; | ||
30 | |||
31 | static int softingcs_reset(struct platform_device *pdev, int v); | ||
32 | static int softingcs_enable_irq(struct platform_device *pdev, int v); | ||
33 | |||
34 | /* | ||
35 | * platform_data descriptions | ||
36 | */ | ||
37 | #define MHZ (1000*1000) | ||
38 | static const struct softing_platform_data softingcs_platform_data[] = { | ||
39 | { | ||
40 | .name = "CANcard", | ||
41 | .manf = 0x0168, .prod = 0x001, | ||
42 | .generation = 1, | ||
43 | .nbus = 2, | ||
44 | .freq = 16 * MHZ, .max_brp = 32, .max_sjw = 4, | ||
45 | .dpram_size = 0x0800, | ||
46 | .boot = {0x0000, 0x000000, fw_dir "bcard.bin",}, | ||
47 | .load = {0x0120, 0x00f600, fw_dir "ldcard.bin",}, | ||
48 | .app = {0x0010, 0x0d0000, fw_dir "cancard.bin",}, | ||
49 | .reset = softingcs_reset, | ||
50 | .enable_irq = softingcs_enable_irq, | ||
51 | }, { | ||
52 | .name = "CANcard-NEC", | ||
53 | .manf = 0x0168, .prod = 0x002, | ||
54 | .generation = 1, | ||
55 | .nbus = 2, | ||
56 | .freq = 16 * MHZ, .max_brp = 32, .max_sjw = 4, | ||
57 | .dpram_size = 0x0800, | ||
58 | .boot = {0x0000, 0x000000, fw_dir "bcard.bin",}, | ||
59 | .load = {0x0120, 0x00f600, fw_dir "ldcard.bin",}, | ||
60 | .app = {0x0010, 0x0d0000, fw_dir "cancard.bin",}, | ||
61 | .reset = softingcs_reset, | ||
62 | .enable_irq = softingcs_enable_irq, | ||
63 | }, { | ||
64 | .name = "CANcard-SJA", | ||
65 | .manf = 0x0168, .prod = 0x004, | ||
66 | .generation = 1, | ||
67 | .nbus = 2, | ||
68 | .freq = 20 * MHZ, .max_brp = 32, .max_sjw = 4, | ||
69 | .dpram_size = 0x0800, | ||
70 | .boot = {0x0000, 0x000000, fw_dir "bcard.bin",}, | ||
71 | .load = {0x0120, 0x00f600, fw_dir "ldcard.bin",}, | ||
72 | .app = {0x0010, 0x0d0000, fw_dir "cansja.bin",}, | ||
73 | .reset = softingcs_reset, | ||
74 | .enable_irq = softingcs_enable_irq, | ||
75 | }, { | ||
76 | .name = "CANcard-2", | ||
77 | .manf = 0x0168, .prod = 0x005, | ||
78 | .generation = 2, | ||
79 | .nbus = 2, | ||
80 | .freq = 24 * MHZ, .max_brp = 64, .max_sjw = 4, | ||
81 | .dpram_size = 0x1000, | ||
82 | .boot = {0x0000, 0x000000, fw_dir "bcard2.bin",}, | ||
83 | .load = {0x0120, 0x00f600, fw_dir "ldcard2.bin",}, | ||
84 | .app = {0x0010, 0x0d0000, fw_dir "cancrd2.bin",}, | ||
85 | .reset = softingcs_reset, | ||
86 | .enable_irq = NULL, | ||
87 | }, { | ||
88 | .name = "Vector-CANcard", | ||
89 | .manf = 0x0168, .prod = 0x081, | ||
90 | .generation = 1, | ||
91 | .nbus = 2, | ||
92 | .freq = 16 * MHZ, .max_brp = 64, .max_sjw = 4, | ||
93 | .dpram_size = 0x0800, | ||
94 | .boot = {0x0000, 0x000000, fw_dir "bcard.bin",}, | ||
95 | .load = {0x0120, 0x00f600, fw_dir "ldcard.bin",}, | ||
96 | .app = {0x0010, 0x0d0000, fw_dir "cancard.bin",}, | ||
97 | .reset = softingcs_reset, | ||
98 | .enable_irq = softingcs_enable_irq, | ||
99 | }, { | ||
100 | .name = "Vector-CANcard-SJA", | ||
101 | .manf = 0x0168, .prod = 0x084, | ||
102 | .generation = 1, | ||
103 | .nbus = 2, | ||
104 | .freq = 20 * MHZ, .max_brp = 32, .max_sjw = 4, | ||
105 | .dpram_size = 0x0800, | ||
106 | .boot = {0x0000, 0x000000, fw_dir "bcard.bin",}, | ||
107 | .load = {0x0120, 0x00f600, fw_dir "ldcard.bin",}, | ||
108 | .app = {0x0010, 0x0d0000, fw_dir "cansja.bin",}, | ||
109 | .reset = softingcs_reset, | ||
110 | .enable_irq = softingcs_enable_irq, | ||
111 | }, { | ||
112 | .name = "Vector-CANcard-2", | ||
113 | .manf = 0x0168, .prod = 0x085, | ||
114 | .generation = 2, | ||
115 | .nbus = 2, | ||
116 | .freq = 24 * MHZ, .max_brp = 64, .max_sjw = 4, | ||
117 | .dpram_size = 0x1000, | ||
118 | .boot = {0x0000, 0x000000, fw_dir "bcard2.bin",}, | ||
119 | .load = {0x0120, 0x00f600, fw_dir "ldcard2.bin",}, | ||
120 | .app = {0x0010, 0x0d0000, fw_dir "cancrd2.bin",}, | ||
121 | .reset = softingcs_reset, | ||
122 | .enable_irq = NULL, | ||
123 | }, { | ||
124 | .name = "EDICcard-NEC", | ||
125 | .manf = 0x0168, .prod = 0x102, | ||
126 | .generation = 1, | ||
127 | .nbus = 2, | ||
128 | .freq = 16 * MHZ, .max_brp = 64, .max_sjw = 4, | ||
129 | .dpram_size = 0x0800, | ||
130 | .boot = {0x0000, 0x000000, fw_dir "bcard.bin",}, | ||
131 | .load = {0x0120, 0x00f600, fw_dir "ldcard.bin",}, | ||
132 | .app = {0x0010, 0x0d0000, fw_dir "cancard.bin",}, | ||
133 | .reset = softingcs_reset, | ||
134 | .enable_irq = softingcs_enable_irq, | ||
135 | }, { | ||
136 | .name = "EDICcard-2", | ||
137 | .manf = 0x0168, .prod = 0x105, | ||
138 | .generation = 2, | ||
139 | .nbus = 2, | ||
140 | .freq = 24 * MHZ, .max_brp = 64, .max_sjw = 4, | ||
141 | .dpram_size = 0x1000, | ||
142 | .boot = {0x0000, 0x000000, fw_dir "bcard2.bin",}, | ||
143 | .load = {0x0120, 0x00f600, fw_dir "ldcard2.bin",}, | ||
144 | .app = {0x0010, 0x0d0000, fw_dir "cancrd2.bin",}, | ||
145 | .reset = softingcs_reset, | ||
146 | .enable_irq = NULL, | ||
147 | }, { | ||
148 | 0, 0, | ||
149 | }, | ||
150 | }; | ||
151 | |||
152 | MODULE_FIRMWARE(fw_dir "bcard.bin"); | ||
153 | MODULE_FIRMWARE(fw_dir "ldcard.bin"); | ||
154 | MODULE_FIRMWARE(fw_dir "cancard.bin"); | ||
155 | MODULE_FIRMWARE(fw_dir "cansja.bin"); | ||
156 | |||
157 | MODULE_FIRMWARE(fw_dir "bcard2.bin"); | ||
158 | MODULE_FIRMWARE(fw_dir "ldcard2.bin"); | ||
159 | MODULE_FIRMWARE(fw_dir "cancrd2.bin"); | ||
160 | |||
161 | static __devinit const struct softing_platform_data | ||
162 | *softingcs_find_platform_data(unsigned int manf, unsigned int prod) | ||
163 | { | ||
164 | const struct softing_platform_data *lp; | ||
165 | |||
166 | for (lp = softingcs_platform_data; lp->manf; ++lp) { | ||
167 | if ((lp->manf == manf) && (lp->prod == prod)) | ||
168 | return lp; | ||
169 | } | ||
170 | return NULL; | ||
171 | } | ||
172 | |||
173 | /* | ||
174 | * platformdata callbacks | ||
175 | */ | ||
176 | static int softingcs_reset(struct platform_device *pdev, int v) | ||
177 | { | ||
178 | struct pcmcia_device *pcmcia = to_pcmcia_dev(pdev->dev.parent); | ||
179 | |||
180 | dev_dbg(&pdev->dev, "pcmcia config [2] %02x\n", v ? 0 : 0x20); | ||
181 | return pcmcia_write_config_byte(pcmcia, 2, v ? 0 : 0x20); | ||
182 | } | ||
183 | |||
184 | static int softingcs_enable_irq(struct platform_device *pdev, int v) | ||
185 | { | ||
186 | struct pcmcia_device *pcmcia = to_pcmcia_dev(pdev->dev.parent); | ||
187 | |||
188 | dev_dbg(&pdev->dev, "pcmcia config [0] %02x\n", v ? 0x60 : 0); | ||
189 | return pcmcia_write_config_byte(pcmcia, 0, v ? 0x60 : 0); | ||
190 | } | ||
191 | |||
192 | /* | ||
193 | * pcmcia check | ||
194 | */ | ||
195 | static __devinit int softingcs_probe_config(struct pcmcia_device *pcmcia, | ||
196 | void *priv_data) | ||
197 | { | ||
198 | struct softing_platform_data *pdat = priv_data; | ||
199 | struct resource *pres; | ||
200 | int memspeed = 0; | ||
201 | |||
202 | WARN_ON(!pdat); | ||
203 | pres = pcmcia->resource[PCMCIA_IOMEM_0]; | ||
204 | if (resource_size(pres) < 0x1000) | ||
205 | return -ERANGE; | ||
206 | |||
207 | pres->flags |= WIN_MEMORY_TYPE_CM | WIN_ENABLE; | ||
208 | if (pdat->generation < 2) { | ||
209 | pres->flags |= WIN_USE_WAIT | WIN_DATA_WIDTH_8; | ||
210 | memspeed = 3; | ||
211 | } else { | ||
212 | pres->flags |= WIN_DATA_WIDTH_16; | ||
213 | } | ||
214 | return pcmcia_request_window(pcmcia, pres, memspeed); | ||
215 | } | ||
216 | |||
217 | static __devexit void softingcs_remove(struct pcmcia_device *pcmcia) | ||
218 | { | ||
219 | struct platform_device *pdev = pcmcia->priv; | ||
220 | |||
221 | /* free bits */ | ||
222 | platform_device_unregister(pdev); | ||
223 | /* release pcmcia stuff */ | ||
224 | pcmcia_disable_device(pcmcia); | ||
225 | } | ||
226 | |||
227 | /* | ||
228 | * platform_device wrapper | ||
229 | * pdev->resource has 2 entries: io & irq | ||
230 | */ | ||
231 | static void softingcs_pdev_release(struct device *dev) | ||
232 | { | ||
233 | struct platform_device *pdev = to_platform_device(dev); | ||
234 | kfree(pdev); | ||
235 | } | ||
236 | |||
237 | static __devinit int softingcs_probe(struct pcmcia_device *pcmcia) | ||
238 | { | ||
239 | int ret; | ||
240 | struct platform_device *pdev; | ||
241 | const struct softing_platform_data *pdat; | ||
242 | struct resource *pres; | ||
243 | struct dev { | ||
244 | struct platform_device pdev; | ||
245 | struct resource res[2]; | ||
246 | } *dev; | ||
247 | |||
248 | /* find matching platform_data */ | ||
249 | pdat = softingcs_find_platform_data(pcmcia->manf_id, pcmcia->card_id); | ||
250 | if (!pdat) | ||
251 | return -ENOTTY; | ||
252 | |||
253 | /* setup pcmcia device */ | ||
254 | pcmcia->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IOMEM | | ||
255 | CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; | ||
256 | ret = pcmcia_loop_config(pcmcia, softingcs_probe_config, (void *)pdat); | ||
257 | if (ret) | ||
258 | goto pcmcia_failed; | ||
259 | |||
260 | ret = pcmcia_enable_device(pcmcia); | ||
261 | if (ret < 0) | ||
262 | goto pcmcia_failed; | ||
263 | |||
264 | pres = pcmcia->resource[PCMCIA_IOMEM_0]; | ||
265 | if (!pres) { | ||
266 | ret = -EBADF; | ||
267 | goto pcmcia_bad; | ||
268 | } | ||
269 | |||
270 | /* create softing platform device */ | ||
271 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
272 | if (!dev) { | ||
273 | ret = -ENOMEM; | ||
274 | goto mem_failed; | ||
275 | } | ||
276 | dev->pdev.resource = dev->res; | ||
277 | dev->pdev.num_resources = ARRAY_SIZE(dev->res); | ||
278 | dev->pdev.dev.release = softingcs_pdev_release; | ||
279 | |||
280 | pdev = &dev->pdev; | ||
281 | pdev->dev.platform_data = (void *)pdat; | ||
282 | pdev->dev.parent = &pcmcia->dev; | ||
283 | pcmcia->priv = pdev; | ||
284 | |||
285 | /* platform device resources */ | ||
286 | pdev->resource[0].flags = IORESOURCE_MEM; | ||
287 | pdev->resource[0].start = pres->start; | ||
288 | pdev->resource[0].end = pres->end; | ||
289 | |||
290 | pdev->resource[1].flags = IORESOURCE_IRQ; | ||
291 | pdev->resource[1].start = pcmcia->irq; | ||
292 | pdev->resource[1].end = pdev->resource[1].start; | ||
293 | |||
294 | /* platform device setup */ | ||
295 | spin_lock(&softingcs_index_lock); | ||
296 | pdev->id = softingcs_index++; | ||
297 | spin_unlock(&softingcs_index_lock); | ||
298 | pdev->name = "softing"; | ||
299 | dev_set_name(&pdev->dev, "softingcs.%i", pdev->id); | ||
300 | ret = platform_device_register(pdev); | ||
301 | if (ret < 0) | ||
302 | goto platform_failed; | ||
303 | |||
304 | dev_info(&pcmcia->dev, "created %s\n", dev_name(&pdev->dev)); | ||
305 | return 0; | ||
306 | |||
307 | platform_failed: | ||
308 | kfree(dev); | ||
309 | mem_failed: | ||
310 | pcmcia_bad: | ||
311 | pcmcia_failed: | ||
312 | pcmcia_disable_device(pcmcia); | ||
313 | pcmcia->priv = NULL; | ||
314 | return ret ?: -ENODEV; | ||
315 | } | ||
316 | |||
317 | static /*const*/ struct pcmcia_device_id softingcs_ids[] = { | ||
318 | /* softing */ | ||
319 | PCMCIA_DEVICE_MANF_CARD(0x0168, 0x0001), | ||
320 | PCMCIA_DEVICE_MANF_CARD(0x0168, 0x0002), | ||
321 | PCMCIA_DEVICE_MANF_CARD(0x0168, 0x0004), | ||
322 | PCMCIA_DEVICE_MANF_CARD(0x0168, 0x0005), | ||
323 | /* vector, manufacturer? */ | ||
324 | PCMCIA_DEVICE_MANF_CARD(0x0168, 0x0081), | ||
325 | PCMCIA_DEVICE_MANF_CARD(0x0168, 0x0084), | ||
326 | PCMCIA_DEVICE_MANF_CARD(0x0168, 0x0085), | ||
327 | /* EDIC */ | ||
328 | PCMCIA_DEVICE_MANF_CARD(0x0168, 0x0102), | ||
329 | PCMCIA_DEVICE_MANF_CARD(0x0168, 0x0105), | ||
330 | PCMCIA_DEVICE_NULL, | ||
331 | }; | ||
332 | |||
333 | MODULE_DEVICE_TABLE(pcmcia, softingcs_ids); | ||
334 | |||
335 | static struct pcmcia_driver softingcs_driver = { | ||
336 | .owner = THIS_MODULE, | ||
337 | .name = "softingcs", | ||
338 | .id_table = softingcs_ids, | ||
339 | .probe = softingcs_probe, | ||
340 | .remove = __devexit_p(softingcs_remove), | ||
341 | }; | ||
342 | |||
343 | static int __init softingcs_start(void) | ||
344 | { | ||
345 | spin_lock_init(&softingcs_index_lock); | ||
346 | return pcmcia_register_driver(&softingcs_driver); | ||
347 | } | ||
348 | |||
349 | static void __exit softingcs_stop(void) | ||
350 | { | ||
351 | pcmcia_unregister_driver(&softingcs_driver); | ||
352 | } | ||
353 | |||
354 | module_init(softingcs_start); | ||
355 | module_exit(softingcs_stop); | ||
356 | |||
357 | MODULE_DESCRIPTION("softing CANcard driver" | ||
358 | ", links PCMCIA card to softing driver"); | ||
359 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/net/can/softing/softing_fw.c b/drivers/net/can/softing/softing_fw.c new file mode 100644 index 00000000000..b520784fb19 --- /dev/null +++ b/drivers/net/can/softing/softing_fw.c | |||
@@ -0,0 +1,691 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2008-2010 | ||
3 | * | ||
4 | * - Kurt Van Dijck, EIA Electronics | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the version 2 of the GNU General Public License | ||
8 | * as published by the Free Software Foundation | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #include <linux/firmware.h> | ||
21 | #include <linux/sched.h> | ||
22 | #include <asm/div64.h> | ||
23 | |||
24 | #include "softing.h" | ||
25 | |||
26 | /* | ||
27 | * low level DPRAM command. | ||
28 | * Make sure that card->dpram[DPRAM_FCT_HOST] is preset | ||
29 | */ | ||
30 | static int _softing_fct_cmd(struct softing *card, int16_t cmd, uint16_t vector, | ||
31 | const char *msg) | ||
32 | { | ||
33 | int ret; | ||
34 | unsigned long stamp; | ||
35 | |||
36 | iowrite16(cmd, &card->dpram[DPRAM_FCT_PARAM]); | ||
37 | iowrite8(vector >> 8, &card->dpram[DPRAM_FCT_HOST + 1]); | ||
38 | iowrite8(vector, &card->dpram[DPRAM_FCT_HOST]); | ||
39 | /* be sure to flush this to the card */ | ||
40 | wmb(); | ||
41 | stamp = jiffies + 1 * HZ; | ||
42 | /* wait for card */ | ||
43 | do { | ||
44 | /* DPRAM_FCT_HOST is _not_ aligned */ | ||
45 | ret = ioread8(&card->dpram[DPRAM_FCT_HOST]) + | ||
46 | (ioread8(&card->dpram[DPRAM_FCT_HOST + 1]) << 8); | ||
47 | /* don't have any cached variables */ | ||
48 | rmb(); | ||
49 | if (ret == RES_OK) | ||
50 | /* read return-value now */ | ||
51 | return ioread16(&card->dpram[DPRAM_FCT_RESULT]); | ||
52 | |||
53 | if ((ret != vector) || time_after(jiffies, stamp)) | ||
54 | break; | ||
55 | /* process context => relax */ | ||
56 | usleep_range(500, 10000); | ||
57 | } while (1); | ||
58 | |||
59 | ret = (ret == RES_NONE) ? -ETIMEDOUT : -ECANCELED; | ||
60 | dev_alert(&card->pdev->dev, "firmware %s failed (%i)\n", msg, ret); | ||
61 | return ret; | ||
62 | } | ||
63 | |||
64 | static int softing_fct_cmd(struct softing *card, int16_t cmd, const char *msg) | ||
65 | { | ||
66 | int ret; | ||
67 | |||
68 | ret = _softing_fct_cmd(card, cmd, 0, msg); | ||
69 | if (ret > 0) { | ||
70 | dev_alert(&card->pdev->dev, "%s returned %u\n", msg, ret); | ||
71 | ret = -EIO; | ||
72 | } | ||
73 | return ret; | ||
74 | } | ||
75 | |||
76 | int softing_bootloader_command(struct softing *card, int16_t cmd, | ||
77 | const char *msg) | ||
78 | { | ||
79 | int ret; | ||
80 | unsigned long stamp; | ||
81 | |||
82 | iowrite16(RES_NONE, &card->dpram[DPRAM_RECEIPT]); | ||
83 | iowrite16(cmd, &card->dpram[DPRAM_COMMAND]); | ||
84 | /* be sure to flush this to the card */ | ||
85 | wmb(); | ||
86 | stamp = jiffies + 3 * HZ; | ||
87 | /* wait for card */ | ||
88 | do { | ||
89 | ret = ioread16(&card->dpram[DPRAM_RECEIPT]); | ||
90 | /* don't have any cached variables */ | ||
91 | rmb(); | ||
92 | if (ret == RES_OK) | ||
93 | return 0; | ||
94 | if (time_after(jiffies, stamp)) | ||
95 | break; | ||
96 | /* process context => relax */ | ||
97 | usleep_range(500, 10000); | ||
98 | } while (!signal_pending(current)); | ||
99 | |||
100 | ret = (ret == RES_NONE) ? -ETIMEDOUT : -ECANCELED; | ||
101 | dev_alert(&card->pdev->dev, "bootloader %s failed (%i)\n", msg, ret); | ||
102 | return ret; | ||
103 | } | ||
104 | |||
105 | static int fw_parse(const uint8_t **pmem, uint16_t *ptype, uint32_t *paddr, | ||
106 | uint16_t *plen, const uint8_t **pdat) | ||
107 | { | ||
108 | uint16_t checksum[2]; | ||
109 | const uint8_t *mem; | ||
110 | const uint8_t *end; | ||
111 | |||
112 | /* | ||
113 | * firmware records are a binary, unaligned stream composed of: | ||
114 | * uint16_t type; | ||
115 | * uint32_t addr; | ||
116 | * uint16_t len; | ||
117 | * uint8_t dat[len]; | ||
118 | * uint16_t checksum; | ||
119 | * all values in little endian. | ||
120 | * We could define a struct for this, with __attribute__((packed)), | ||
121 | * but would that solve the alignment in _all_ cases (cfr. the | ||
122 | * struct itself may be an odd address)? | ||
123 | * | ||
124 | * I chose to use leXX_to_cpup() since this solves both | ||
125 | * endianness & alignment. | ||
126 | */ | ||
127 | mem = *pmem; | ||
128 | *ptype = le16_to_cpup((void *)&mem[0]); | ||
129 | *paddr = le32_to_cpup((void *)&mem[2]); | ||
130 | *plen = le16_to_cpup((void *)&mem[6]); | ||
131 | *pdat = &mem[8]; | ||
132 | /* verify checksum */ | ||
133 | end = &mem[8 + *plen]; | ||
134 | checksum[0] = le16_to_cpup((void *)end); | ||
135 | for (checksum[1] = 0; mem < end; ++mem) | ||
136 | checksum[1] += *mem; | ||
137 | if (checksum[0] != checksum[1]) | ||
138 | return -EINVAL; | ||
139 | /* increment */ | ||
140 | *pmem += 10 + *plen; | ||
141 | return 0; | ||
142 | } | ||
143 | |||
144 | int softing_load_fw(const char *file, struct softing *card, | ||
145 | __iomem uint8_t *dpram, unsigned int size, int offset) | ||
146 | { | ||
147 | const struct firmware *fw; | ||
148 | int ret; | ||
149 | const uint8_t *mem, *end, *dat; | ||
150 | uint16_t type, len; | ||
151 | uint32_t addr; | ||
152 | uint8_t *buf = NULL; | ||
153 | int buflen = 0; | ||
154 | int8_t type_end = 0; | ||
155 | |||
156 | ret = request_firmware(&fw, file, &card->pdev->dev); | ||
157 | if (ret < 0) | ||
158 | return ret; | ||
159 | dev_dbg(&card->pdev->dev, "%s, firmware(%s) got %u bytes" | ||
160 | ", offset %c0x%04x\n", | ||
161 | card->pdat->name, file, (unsigned int)fw->size, | ||
162 | (offset >= 0) ? '+' : '-', (unsigned int)abs(offset)); | ||
163 | /* parse the firmware */ | ||
164 | mem = fw->data; | ||
165 | end = &mem[fw->size]; | ||
166 | /* look for header record */ | ||
167 | ret = fw_parse(&mem, &type, &addr, &len, &dat); | ||
168 | if (ret < 0) | ||
169 | goto failed; | ||
170 | if (type != 0xffff) | ||
171 | goto failed; | ||
172 | if (strncmp("Structured Binary Format, Softing GmbH" , dat, len)) { | ||
173 | ret = -EINVAL; | ||
174 | goto failed; | ||
175 | } | ||
176 | /* ok, we had a header */ | ||
177 | while (mem < end) { | ||
178 | ret = fw_parse(&mem, &type, &addr, &len, &dat); | ||
179 | if (ret < 0) | ||
180 | goto failed; | ||
181 | if (type == 3) { | ||
182 | /* start address, not used here */ | ||
183 | continue; | ||
184 | } else if (type == 1) { | ||
185 | /* eof */ | ||
186 | type_end = 1; | ||
187 | break; | ||
188 | } else if (type != 0) { | ||
189 | ret = -EINVAL; | ||
190 | goto failed; | ||
191 | } | ||
192 | |||
193 | if ((addr + len + offset) > size) | ||
194 | goto failed; | ||
195 | memcpy_toio(&dpram[addr + offset], dat, len); | ||
196 | /* be sure to flush caches from IO space */ | ||
197 | mb(); | ||
198 | if (len > buflen) { | ||
199 | /* align buflen */ | ||
200 | buflen = (len + (1024-1)) & ~(1024-1); | ||
201 | buf = krealloc(buf, buflen, GFP_KERNEL); | ||
202 | if (!buf) { | ||
203 | ret = -ENOMEM; | ||
204 | goto failed; | ||
205 | } | ||
206 | } | ||
207 | /* verify record data */ | ||
208 | memcpy_fromio(buf, &dpram[addr + offset], len); | ||
209 | if (memcmp(buf, dat, len)) { | ||
210 | /* is not ok */ | ||
211 | dev_alert(&card->pdev->dev, "DPRAM readback failed\n"); | ||
212 | ret = -EIO; | ||
213 | goto failed; | ||
214 | } | ||
215 | } | ||
216 | if (!type_end) | ||
217 | /* no end record seen */ | ||
218 | goto failed; | ||
219 | ret = 0; | ||
220 | failed: | ||
221 | kfree(buf); | ||
222 | release_firmware(fw); | ||
223 | if (ret < 0) | ||
224 | dev_info(&card->pdev->dev, "firmware %s failed\n", file); | ||
225 | return ret; | ||
226 | } | ||
227 | |||
228 | int softing_load_app_fw(const char *file, struct softing *card) | ||
229 | { | ||
230 | const struct firmware *fw; | ||
231 | const uint8_t *mem, *end, *dat; | ||
232 | int ret, j; | ||
233 | uint16_t type, len; | ||
234 | uint32_t addr, start_addr = 0; | ||
235 | unsigned int sum, rx_sum; | ||
236 | int8_t type_end = 0, type_entrypoint = 0; | ||
237 | |||
238 | ret = request_firmware(&fw, file, &card->pdev->dev); | ||
239 | if (ret) { | ||
240 | dev_alert(&card->pdev->dev, "request_firmware(%s) got %i\n", | ||
241 | file, ret); | ||
242 | return ret; | ||
243 | } | ||
244 | dev_dbg(&card->pdev->dev, "firmware(%s) got %lu bytes\n", | ||
245 | file, (unsigned long)fw->size); | ||
246 | /* parse the firmware */ | ||
247 | mem = fw->data; | ||
248 | end = &mem[fw->size]; | ||
249 | /* look for header record */ | ||
250 | ret = fw_parse(&mem, &type, &addr, &len, &dat); | ||
251 | if (ret) | ||
252 | goto failed; | ||
253 | ret = -EINVAL; | ||
254 | if (type != 0xffff) { | ||
255 | dev_alert(&card->pdev->dev, "firmware starts with type 0x%x\n", | ||
256 | type); | ||
257 | goto failed; | ||
258 | } | ||
259 | if (strncmp("Structured Binary Format, Softing GmbH", dat, len)) { | ||
260 | dev_alert(&card->pdev->dev, "firmware string '%.*s' fault\n", | ||
261 | len, dat); | ||
262 | goto failed; | ||
263 | } | ||
264 | /* ok, we had a header */ | ||
265 | while (mem < end) { | ||
266 | ret = fw_parse(&mem, &type, &addr, &len, &dat); | ||
267 | if (ret) | ||
268 | goto failed; | ||
269 | |||
270 | if (type == 3) { | ||
271 | /* start address */ | ||
272 | start_addr = addr; | ||
273 | type_entrypoint = 1; | ||
274 | continue; | ||
275 | } else if (type == 1) { | ||
276 | /* eof */ | ||
277 | type_end = 1; | ||
278 | break; | ||
279 | } else if (type != 0) { | ||
280 | dev_alert(&card->pdev->dev, | ||
281 | "unknown record type 0x%04x\n", type); | ||
282 | ret = -EINVAL; | ||
283 | goto failed; | ||
284 | } | ||
285 | |||
286 | /* regualar data */ | ||
287 | for (sum = 0, j = 0; j < len; ++j) | ||
288 | sum += dat[j]; | ||
289 | /* work in 16bit (target) */ | ||
290 | sum &= 0xffff; | ||
291 | |||
292 | memcpy_toio(&card->dpram[card->pdat->app.offs], dat, len); | ||
293 | iowrite32(card->pdat->app.offs + card->pdat->app.addr, | ||
294 | &card->dpram[DPRAM_COMMAND + 2]); | ||
295 | iowrite32(addr, &card->dpram[DPRAM_COMMAND + 6]); | ||
296 | iowrite16(len, &card->dpram[DPRAM_COMMAND + 10]); | ||
297 | iowrite8(1, &card->dpram[DPRAM_COMMAND + 12]); | ||
298 | ret = softing_bootloader_command(card, 1, "loading app."); | ||
299 | if (ret < 0) | ||
300 | goto failed; | ||
301 | /* verify checksum */ | ||
302 | rx_sum = ioread16(&card->dpram[DPRAM_RECEIPT + 2]); | ||
303 | if (rx_sum != sum) { | ||
304 | dev_alert(&card->pdev->dev, "SRAM seems to be damaged" | ||
305 | ", wanted 0x%04x, got 0x%04x\n", sum, rx_sum); | ||
306 | ret = -EIO; | ||
307 | goto failed; | ||
308 | } | ||
309 | } | ||
310 | if (!type_end || !type_entrypoint) | ||
311 | goto failed; | ||
312 | /* start application in card */ | ||
313 | iowrite32(start_addr, &card->dpram[DPRAM_COMMAND + 2]); | ||
314 | iowrite8(1, &card->dpram[DPRAM_COMMAND + 6]); | ||
315 | ret = softing_bootloader_command(card, 3, "start app."); | ||
316 | if (ret < 0) | ||
317 | goto failed; | ||
318 | ret = 0; | ||
319 | failed: | ||
320 | release_firmware(fw); | ||
321 | if (ret < 0) | ||
322 | dev_info(&card->pdev->dev, "firmware %s failed\n", file); | ||
323 | return ret; | ||
324 | } | ||
325 | |||
326 | static int softing_reset_chip(struct softing *card) | ||
327 | { | ||
328 | int ret; | ||
329 | |||
330 | do { | ||
331 | /* reset chip */ | ||
332 | iowrite8(0, &card->dpram[DPRAM_RESET_RX_FIFO]); | ||
333 | iowrite8(0, &card->dpram[DPRAM_RESET_RX_FIFO+1]); | ||
334 | iowrite8(1, &card->dpram[DPRAM_RESET]); | ||
335 | iowrite8(0, &card->dpram[DPRAM_RESET+1]); | ||
336 | |||
337 | ret = softing_fct_cmd(card, 0, "reset_can"); | ||
338 | if (!ret) | ||
339 | break; | ||
340 | if (signal_pending(current)) | ||
341 | /* don't wait any longer */ | ||
342 | break; | ||
343 | } while (1); | ||
344 | card->tx.pending = 0; | ||
345 | return ret; | ||
346 | } | ||
347 | |||
348 | int softing_chip_poweron(struct softing *card) | ||
349 | { | ||
350 | int ret; | ||
351 | /* sync */ | ||
352 | ret = _softing_fct_cmd(card, 99, 0x55, "sync-a"); | ||
353 | if (ret < 0) | ||
354 | goto failed; | ||
355 | |||
356 | ret = _softing_fct_cmd(card, 99, 0xaa, "sync-b"); | ||
357 | if (ret < 0) | ||
358 | goto failed; | ||
359 | |||
360 | ret = softing_reset_chip(card); | ||
361 | if (ret < 0) | ||
362 | goto failed; | ||
363 | /* get_serial */ | ||
364 | ret = softing_fct_cmd(card, 43, "get_serial_number"); | ||
365 | if (ret < 0) | ||
366 | goto failed; | ||
367 | card->id.serial = ioread32(&card->dpram[DPRAM_FCT_PARAM]); | ||
368 | /* get_version */ | ||
369 | ret = softing_fct_cmd(card, 12, "get_version"); | ||
370 | if (ret < 0) | ||
371 | goto failed; | ||
372 | card->id.fw_version = ioread16(&card->dpram[DPRAM_FCT_PARAM + 2]); | ||
373 | card->id.hw_version = ioread16(&card->dpram[DPRAM_FCT_PARAM + 4]); | ||
374 | card->id.license = ioread16(&card->dpram[DPRAM_FCT_PARAM + 6]); | ||
375 | card->id.chip[0] = ioread16(&card->dpram[DPRAM_FCT_PARAM + 8]); | ||
376 | card->id.chip[1] = ioread16(&card->dpram[DPRAM_FCT_PARAM + 10]); | ||
377 | return 0; | ||
378 | failed: | ||
379 | return ret; | ||
380 | } | ||
381 | |||
382 | static void softing_initialize_timestamp(struct softing *card) | ||
383 | { | ||
384 | uint64_t ovf; | ||
385 | |||
386 | card->ts_ref = ktime_get(); | ||
387 | |||
388 | /* 16MHz is the reference */ | ||
389 | ovf = 0x100000000ULL * 16; | ||
390 | do_div(ovf, card->pdat->freq ?: 16); | ||
391 | |||
392 | card->ts_overflow = ktime_add_us(ktime_set(0, 0), ovf); | ||
393 | } | ||
394 | |||
395 | ktime_t softing_raw2ktime(struct softing *card, u32 raw) | ||
396 | { | ||
397 | uint64_t rawl; | ||
398 | ktime_t now, real_offset; | ||
399 | ktime_t target; | ||
400 | ktime_t tmp; | ||
401 | |||
402 | now = ktime_get(); | ||
403 | real_offset = ktime_sub(ktime_get_real(), now); | ||
404 | |||
405 | /* find nsec from card */ | ||
406 | rawl = raw * 16; | ||
407 | do_div(rawl, card->pdat->freq ?: 16); | ||
408 | target = ktime_add_us(card->ts_ref, rawl); | ||
409 | /* test for overflows */ | ||
410 | tmp = ktime_add(target, card->ts_overflow); | ||
411 | while (unlikely(ktime_to_ns(tmp) > ktime_to_ns(now))) { | ||
412 | card->ts_ref = ktime_add(card->ts_ref, card->ts_overflow); | ||
413 | target = tmp; | ||
414 | tmp = ktime_add(target, card->ts_overflow); | ||
415 | } | ||
416 | return ktime_add(target, real_offset); | ||
417 | } | ||
418 | |||
419 | static inline int softing_error_reporting(struct net_device *netdev) | ||
420 | { | ||
421 | struct softing_priv *priv = netdev_priv(netdev); | ||
422 | |||
423 | return (priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING) | ||
424 | ? 1 : 0; | ||
425 | } | ||
426 | |||
427 | int softing_startstop(struct net_device *dev, int up) | ||
428 | { | ||
429 | int ret; | ||
430 | struct softing *card; | ||
431 | struct softing_priv *priv; | ||
432 | struct net_device *netdev; | ||
433 | int bus_bitmask_start; | ||
434 | int j, error_reporting; | ||
435 | struct can_frame msg; | ||
436 | const struct can_bittiming *bt; | ||
437 | |||
438 | priv = netdev_priv(dev); | ||
439 | card = priv->card; | ||
440 | |||
441 | if (!card->fw.up) | ||
442 | return -EIO; | ||
443 | |||
444 | ret = mutex_lock_interruptible(&card->fw.lock); | ||
445 | if (ret) | ||
446 | return ret; | ||
447 | |||
448 | bus_bitmask_start = 0; | ||
449 | if (dev && up) | ||
450 | /* prepare to start this bus as well */ | ||
451 | bus_bitmask_start |= (1 << priv->index); | ||
452 | /* bring netdevs down */ | ||
453 | for (j = 0; j < ARRAY_SIZE(card->net); ++j) { | ||
454 | netdev = card->net[j]; | ||
455 | if (!netdev) | ||
456 | continue; | ||
457 | priv = netdev_priv(netdev); | ||
458 | |||
459 | if (dev != netdev) | ||
460 | netif_stop_queue(netdev); | ||
461 | |||
462 | if (netif_running(netdev)) { | ||
463 | if (dev != netdev) | ||
464 | bus_bitmask_start |= (1 << j); | ||
465 | priv->tx.pending = 0; | ||
466 | priv->tx.echo_put = 0; | ||
467 | priv->tx.echo_get = 0; | ||
468 | /* | ||
469 | * this bus' may just have called open_candev() | ||
470 | * which is rather stupid to call close_candev() | ||
471 | * already | ||
472 | * but we may come here from busoff recovery too | ||
473 | * in which case the echo_skb _needs_ flushing too. | ||
474 | * just be sure to call open_candev() again | ||
475 | */ | ||
476 | close_candev(netdev); | ||
477 | } | ||
478 | priv->can.state = CAN_STATE_STOPPED; | ||
479 | } | ||
480 | card->tx.pending = 0; | ||
481 | |||
482 | softing_enable_irq(card, 0); | ||
483 | ret = softing_reset_chip(card); | ||
484 | if (ret) | ||
485 | goto failed; | ||
486 | if (!bus_bitmask_start) | ||
487 | /* no busses to be brought up */ | ||
488 | goto card_done; | ||
489 | |||
490 | if ((bus_bitmask_start & 1) && (bus_bitmask_start & 2) | ||
491 | && (softing_error_reporting(card->net[0]) | ||
492 | != softing_error_reporting(card->net[1]))) { | ||
493 | dev_alert(&card->pdev->dev, | ||
494 | "err_reporting flag differs for busses\n"); | ||
495 | goto invalid; | ||
496 | } | ||
497 | error_reporting = 0; | ||
498 | if (bus_bitmask_start & 1) { | ||
499 | netdev = card->net[0]; | ||
500 | priv = netdev_priv(netdev); | ||
501 | error_reporting += softing_error_reporting(netdev); | ||
502 | /* init chip 1 */ | ||
503 | bt = &priv->can.bittiming; | ||
504 | iowrite16(bt->brp, &card->dpram[DPRAM_FCT_PARAM + 2]); | ||
505 | iowrite16(bt->sjw, &card->dpram[DPRAM_FCT_PARAM + 4]); | ||
506 | iowrite16(bt->phase_seg1 + bt->prop_seg, | ||
507 | &card->dpram[DPRAM_FCT_PARAM + 6]); | ||
508 | iowrite16(bt->phase_seg2, &card->dpram[DPRAM_FCT_PARAM + 8]); | ||
509 | iowrite16((priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) ? 1 : 0, | ||
510 | &card->dpram[DPRAM_FCT_PARAM + 10]); | ||
511 | ret = softing_fct_cmd(card, 1, "initialize_chip[0]"); | ||
512 | if (ret < 0) | ||
513 | goto failed; | ||
514 | /* set mode */ | ||
515 | iowrite16(0, &card->dpram[DPRAM_FCT_PARAM + 2]); | ||
516 | iowrite16(0, &card->dpram[DPRAM_FCT_PARAM + 4]); | ||
517 | ret = softing_fct_cmd(card, 3, "set_mode[0]"); | ||
518 | if (ret < 0) | ||
519 | goto failed; | ||
520 | /* set filter */ | ||
521 | /* 11bit id & mask */ | ||
522 | iowrite16(0x0000, &card->dpram[DPRAM_FCT_PARAM + 2]); | ||
523 | iowrite16(0x07ff, &card->dpram[DPRAM_FCT_PARAM + 4]); | ||
524 | /* 29bit id.lo & mask.lo & id.hi & mask.hi */ | ||
525 | iowrite16(0x0000, &card->dpram[DPRAM_FCT_PARAM + 6]); | ||
526 | iowrite16(0xffff, &card->dpram[DPRAM_FCT_PARAM + 8]); | ||
527 | iowrite16(0x0000, &card->dpram[DPRAM_FCT_PARAM + 10]); | ||
528 | iowrite16(0x1fff, &card->dpram[DPRAM_FCT_PARAM + 12]); | ||
529 | ret = softing_fct_cmd(card, 7, "set_filter[0]"); | ||
530 | if (ret < 0) | ||
531 | goto failed; | ||
532 | /* set output control */ | ||
533 | iowrite16(priv->output, &card->dpram[DPRAM_FCT_PARAM + 2]); | ||
534 | ret = softing_fct_cmd(card, 5, "set_output[0]"); | ||
535 | if (ret < 0) | ||
536 | goto failed; | ||
537 | } | ||
538 | if (bus_bitmask_start & 2) { | ||
539 | netdev = card->net[1]; | ||
540 | priv = netdev_priv(netdev); | ||
541 | error_reporting += softing_error_reporting(netdev); | ||
542 | /* init chip2 */ | ||
543 | bt = &priv->can.bittiming; | ||
544 | iowrite16(bt->brp, &card->dpram[DPRAM_FCT_PARAM + 2]); | ||
545 | iowrite16(bt->sjw, &card->dpram[DPRAM_FCT_PARAM + 4]); | ||
546 | iowrite16(bt->phase_seg1 + bt->prop_seg, | ||
547 | &card->dpram[DPRAM_FCT_PARAM + 6]); | ||
548 | iowrite16(bt->phase_seg2, &card->dpram[DPRAM_FCT_PARAM + 8]); | ||
549 | iowrite16((priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) ? 1 : 0, | ||
550 | &card->dpram[DPRAM_FCT_PARAM + 10]); | ||
551 | ret = softing_fct_cmd(card, 2, "initialize_chip[1]"); | ||
552 | if (ret < 0) | ||
553 | goto failed; | ||
554 | /* set mode2 */ | ||
555 | iowrite16(0, &card->dpram[DPRAM_FCT_PARAM + 2]); | ||
556 | iowrite16(0, &card->dpram[DPRAM_FCT_PARAM + 4]); | ||
557 | ret = softing_fct_cmd(card, 4, "set_mode[1]"); | ||
558 | if (ret < 0) | ||
559 | goto failed; | ||
560 | /* set filter2 */ | ||
561 | /* 11bit id & mask */ | ||
562 | iowrite16(0x0000, &card->dpram[DPRAM_FCT_PARAM + 2]); | ||
563 | iowrite16(0x07ff, &card->dpram[DPRAM_FCT_PARAM + 4]); | ||
564 | /* 29bit id.lo & mask.lo & id.hi & mask.hi */ | ||
565 | iowrite16(0x0000, &card->dpram[DPRAM_FCT_PARAM + 6]); | ||
566 | iowrite16(0xffff, &card->dpram[DPRAM_FCT_PARAM + 8]); | ||
567 | iowrite16(0x0000, &card->dpram[DPRAM_FCT_PARAM + 10]); | ||
568 | iowrite16(0x1fff, &card->dpram[DPRAM_FCT_PARAM + 12]); | ||
569 | ret = softing_fct_cmd(card, 8, "set_filter[1]"); | ||
570 | if (ret < 0) | ||
571 | goto failed; | ||
572 | /* set output control2 */ | ||
573 | iowrite16(priv->output, &card->dpram[DPRAM_FCT_PARAM + 2]); | ||
574 | ret = softing_fct_cmd(card, 6, "set_output[1]"); | ||
575 | if (ret < 0) | ||
576 | goto failed; | ||
577 | } | ||
578 | /* enable_error_frame */ | ||
579 | /* | ||
580 | * Error reporting is switched off at the moment since | ||
581 | * the receiving of them is not yet 100% verified | ||
582 | * This should be enabled sooner or later | ||
583 | * | ||
584 | if (error_reporting) { | ||
585 | ret = softing_fct_cmd(card, 51, "enable_error_frame"); | ||
586 | if (ret < 0) | ||
587 | goto failed; | ||
588 | } | ||
589 | */ | ||
590 | /* initialize interface */ | ||
591 | iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 2]); | ||
592 | iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 4]); | ||
593 | iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 6]); | ||
594 | iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 8]); | ||
595 | iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 10]); | ||
596 | iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 12]); | ||
597 | iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 14]); | ||
598 | iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 16]); | ||
599 | iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 18]); | ||
600 | iowrite16(1, &card->dpram[DPRAM_FCT_PARAM + 20]); | ||
601 | ret = softing_fct_cmd(card, 17, "initialize_interface"); | ||
602 | if (ret < 0) | ||
603 | goto failed; | ||
604 | /* enable_fifo */ | ||
605 | ret = softing_fct_cmd(card, 36, "enable_fifo"); | ||
606 | if (ret < 0) | ||
607 | goto failed; | ||
608 | /* enable fifo tx ack */ | ||
609 | ret = softing_fct_cmd(card, 13, "fifo_tx_ack[0]"); | ||
610 | if (ret < 0) | ||
611 | goto failed; | ||
612 | /* enable fifo tx ack2 */ | ||
613 | ret = softing_fct_cmd(card, 14, "fifo_tx_ack[1]"); | ||
614 | if (ret < 0) | ||
615 | goto failed; | ||
616 | /* start_chip */ | ||
617 | ret = softing_fct_cmd(card, 11, "start_chip"); | ||
618 | if (ret < 0) | ||
619 | goto failed; | ||
620 | iowrite8(0, &card->dpram[DPRAM_INFO_BUSSTATE]); | ||
621 | iowrite8(0, &card->dpram[DPRAM_INFO_BUSSTATE2]); | ||
622 | if (card->pdat->generation < 2) { | ||
623 | iowrite8(0, &card->dpram[DPRAM_V2_IRQ_TOHOST]); | ||
624 | /* flush the DPRAM caches */ | ||
625 | wmb(); | ||
626 | } | ||
627 | |||
628 | softing_initialize_timestamp(card); | ||
629 | |||
630 | /* | ||
631 | * do socketcan notifications/status changes | ||
632 | * from here, no errors should occur, or the failed: part | ||
633 | * must be reviewed | ||
634 | */ | ||
635 | memset(&msg, 0, sizeof(msg)); | ||
636 | msg.can_id = CAN_ERR_FLAG | CAN_ERR_RESTARTED; | ||
637 | msg.can_dlc = CAN_ERR_DLC; | ||
638 | for (j = 0; j < ARRAY_SIZE(card->net); ++j) { | ||
639 | if (!(bus_bitmask_start & (1 << j))) | ||
640 | continue; | ||
641 | netdev = card->net[j]; | ||
642 | if (!netdev) | ||
643 | continue; | ||
644 | priv = netdev_priv(netdev); | ||
645 | priv->can.state = CAN_STATE_ERROR_ACTIVE; | ||
646 | open_candev(netdev); | ||
647 | if (dev != netdev) { | ||
648 | /* notify other busses on the restart */ | ||
649 | softing_netdev_rx(netdev, &msg, ktime_set(0, 0)); | ||
650 | ++priv->can.can_stats.restarts; | ||
651 | } | ||
652 | netif_wake_queue(netdev); | ||
653 | } | ||
654 | |||
655 | /* enable interrupts */ | ||
656 | ret = softing_enable_irq(card, 1); | ||
657 | if (ret) | ||
658 | goto failed; | ||
659 | card_done: | ||
660 | mutex_unlock(&card->fw.lock); | ||
661 | return 0; | ||
662 | invalid: | ||
663 | ret = -EINVAL; | ||
664 | failed: | ||
665 | softing_enable_irq(card, 0); | ||
666 | softing_reset_chip(card); | ||
667 | mutex_unlock(&card->fw.lock); | ||
668 | /* bring all other interfaces down */ | ||
669 | for (j = 0; j < ARRAY_SIZE(card->net); ++j) { | ||
670 | netdev = card->net[j]; | ||
671 | if (!netdev) | ||
672 | continue; | ||
673 | dev_close(netdev); | ||
674 | } | ||
675 | return ret; | ||
676 | } | ||
677 | |||
678 | int softing_default_output(struct net_device *netdev) | ||
679 | { | ||
680 | struct softing_priv *priv = netdev_priv(netdev); | ||
681 | struct softing *card = priv->card; | ||
682 | |||
683 | switch (priv->chip) { | ||
684 | case 1000: | ||
685 | return (card->pdat->generation < 2) ? 0xfb : 0xfa; | ||
686 | case 5: | ||
687 | return 0x60; | ||
688 | default: | ||
689 | return 0x40; | ||
690 | } | ||
691 | } | ||
diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c new file mode 100644 index 00000000000..5157e15e96e --- /dev/null +++ b/drivers/net/can/softing/softing_main.c | |||
@@ -0,0 +1,893 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2008-2010 | ||
3 | * | ||
4 | * - Kurt Van Dijck, EIA Electronics | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the version 2 of the GNU General Public License | ||
8 | * as published by the Free Software Foundation | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #include <linux/version.h> | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | |||
25 | #include "softing.h" | ||
26 | |||
27 | #define TX_ECHO_SKB_MAX (((TXMAX+1)/2)-1) | ||
28 | |||
29 | /* | ||
30 | * test is a specific CAN netdev | ||
31 | * is online (ie. up 'n running, not sleeping, not busoff | ||
32 | */ | ||
33 | static inline int canif_is_active(struct net_device *netdev) | ||
34 | { | ||
35 | struct can_priv *can = netdev_priv(netdev); | ||
36 | |||
37 | if (!netif_running(netdev)) | ||
38 | return 0; | ||
39 | return (can->state <= CAN_STATE_ERROR_PASSIVE); | ||
40 | } | ||
41 | |||
42 | /* reset DPRAM */ | ||
43 | static inline void softing_set_reset_dpram(struct softing *card) | ||
44 | { | ||
45 | if (card->pdat->generation >= 2) { | ||
46 | spin_lock_bh(&card->spin); | ||
47 | iowrite8(ioread8(&card->dpram[DPRAM_V2_RESET]) & ~1, | ||
48 | &card->dpram[DPRAM_V2_RESET]); | ||
49 | spin_unlock_bh(&card->spin); | ||
50 | } | ||
51 | } | ||
52 | |||
53 | static inline void softing_clr_reset_dpram(struct softing *card) | ||
54 | { | ||
55 | if (card->pdat->generation >= 2) { | ||
56 | spin_lock_bh(&card->spin); | ||
57 | iowrite8(ioread8(&card->dpram[DPRAM_V2_RESET]) | 1, | ||
58 | &card->dpram[DPRAM_V2_RESET]); | ||
59 | spin_unlock_bh(&card->spin); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | /* trigger the tx queue-ing */ | ||
64 | static netdev_tx_t softing_netdev_start_xmit(struct sk_buff *skb, | ||
65 | struct net_device *dev) | ||
66 | { | ||
67 | struct softing_priv *priv = netdev_priv(dev); | ||
68 | struct softing *card = priv->card; | ||
69 | int ret; | ||
70 | uint8_t *ptr; | ||
71 | uint8_t fifo_wr, fifo_rd; | ||
72 | struct can_frame *cf = (struct can_frame *)skb->data; | ||
73 | uint8_t buf[DPRAM_TX_SIZE]; | ||
74 | |||
75 | if (can_dropped_invalid_skb(dev, skb)) | ||
76 | return NETDEV_TX_OK; | ||
77 | |||
78 | spin_lock(&card->spin); | ||
79 | |||
80 | ret = NETDEV_TX_BUSY; | ||
81 | if (!card->fw.up || | ||
82 | (card->tx.pending >= TXMAX) || | ||
83 | (priv->tx.pending >= TX_ECHO_SKB_MAX)) | ||
84 | goto xmit_done; | ||
85 | fifo_wr = ioread8(&card->dpram[DPRAM_TX_WR]); | ||
86 | fifo_rd = ioread8(&card->dpram[DPRAM_TX_RD]); | ||
87 | if (fifo_wr == fifo_rd) | ||
88 | /* fifo full */ | ||
89 | goto xmit_done; | ||
90 | memset(buf, 0, sizeof(buf)); | ||
91 | ptr = buf; | ||
92 | *ptr = CMD_TX; | ||
93 | if (cf->can_id & CAN_RTR_FLAG) | ||
94 | *ptr |= CMD_RTR; | ||
95 | if (cf->can_id & CAN_EFF_FLAG) | ||
96 | *ptr |= CMD_XTD; | ||
97 | if (priv->index) | ||
98 | *ptr |= CMD_BUS2; | ||
99 | ++ptr; | ||
100 | *ptr++ = cf->can_dlc; | ||
101 | *ptr++ = (cf->can_id >> 0); | ||
102 | *ptr++ = (cf->can_id >> 8); | ||
103 | if (cf->can_id & CAN_EFF_FLAG) { | ||
104 | *ptr++ = (cf->can_id >> 16); | ||
105 | *ptr++ = (cf->can_id >> 24); | ||
106 | } else { | ||
107 | /* increment 1, not 2 as you might think */ | ||
108 | ptr += 1; | ||
109 | } | ||
110 | if (!(cf->can_id & CAN_RTR_FLAG)) | ||
111 | memcpy(ptr, &cf->data[0], cf->can_dlc); | ||
112 | memcpy_toio(&card->dpram[DPRAM_TX + DPRAM_TX_SIZE * fifo_wr], | ||
113 | buf, DPRAM_TX_SIZE); | ||
114 | if (++fifo_wr >= DPRAM_TX_CNT) | ||
115 | fifo_wr = 0; | ||
116 | iowrite8(fifo_wr, &card->dpram[DPRAM_TX_WR]); | ||
117 | card->tx.last_bus = priv->index; | ||
118 | ++card->tx.pending; | ||
119 | ++priv->tx.pending; | ||
120 | can_put_echo_skb(skb, dev, priv->tx.echo_put); | ||
121 | ++priv->tx.echo_put; | ||
122 | if (priv->tx.echo_put >= TX_ECHO_SKB_MAX) | ||
123 | priv->tx.echo_put = 0; | ||
124 | /* can_put_echo_skb() saves the skb, safe to return TX_OK */ | ||
125 | ret = NETDEV_TX_OK; | ||
126 | xmit_done: | ||
127 | spin_unlock(&card->spin); | ||
128 | if (card->tx.pending >= TXMAX) { | ||
129 | int j; | ||
130 | for (j = 0; j < ARRAY_SIZE(card->net); ++j) { | ||
131 | if (card->net[j]) | ||
132 | netif_stop_queue(card->net[j]); | ||
133 | } | ||
134 | } | ||
135 | if (ret != NETDEV_TX_OK) | ||
136 | netif_stop_queue(dev); | ||
137 | |||
138 | return ret; | ||
139 | } | ||
140 | |||
141 | /* | ||
142 | * shortcut for skb delivery | ||
143 | */ | ||
144 | int softing_netdev_rx(struct net_device *netdev, const struct can_frame *msg, | ||
145 | ktime_t ktime) | ||
146 | { | ||
147 | struct sk_buff *skb; | ||
148 | struct can_frame *cf; | ||
149 | |||
150 | skb = alloc_can_skb(netdev, &cf); | ||
151 | if (!skb) | ||
152 | return -ENOMEM; | ||
153 | memcpy(cf, msg, sizeof(*msg)); | ||
154 | skb->tstamp = ktime; | ||
155 | return netif_rx(skb); | ||
156 | } | ||
157 | |||
158 | /* | ||
159 | * softing_handle_1 | ||
160 | * pop 1 entry from the DPRAM queue, and process | ||
161 | */ | ||
162 | static int softing_handle_1(struct softing *card) | ||
163 | { | ||
164 | struct net_device *netdev; | ||
165 | struct softing_priv *priv; | ||
166 | ktime_t ktime; | ||
167 | struct can_frame msg; | ||
168 | int cnt = 0, lost_msg; | ||
169 | uint8_t fifo_rd, fifo_wr, cmd; | ||
170 | uint8_t *ptr; | ||
171 | uint32_t tmp_u32; | ||
172 | uint8_t buf[DPRAM_RX_SIZE]; | ||
173 | |||
174 | memset(&msg, 0, sizeof(msg)); | ||
175 | /* test for lost msgs */ | ||
176 | lost_msg = ioread8(&card->dpram[DPRAM_RX_LOST]); | ||
177 | if (lost_msg) { | ||
178 | int j; | ||
179 | /* reset condition */ | ||
180 | iowrite8(0, &card->dpram[DPRAM_RX_LOST]); | ||
181 | /* prepare msg */ | ||
182 | msg.can_id = CAN_ERR_FLAG | CAN_ERR_CRTL; | ||
183 | msg.can_dlc = CAN_ERR_DLC; | ||
184 | msg.data[1] = CAN_ERR_CRTL_RX_OVERFLOW; | ||
185 | /* | ||
186 | * service to all busses, we don't know which it was applicable | ||
187 | * but only service busses that are online | ||
188 | */ | ||
189 | for (j = 0; j < ARRAY_SIZE(card->net); ++j) { | ||
190 | netdev = card->net[j]; | ||
191 | if (!netdev) | ||
192 | continue; | ||
193 | if (!canif_is_active(netdev)) | ||
194 | /* a dead bus has no overflows */ | ||
195 | continue; | ||
196 | ++netdev->stats.rx_over_errors; | ||
197 | softing_netdev_rx(netdev, &msg, ktime_set(0, 0)); | ||
198 | } | ||
199 | /* prepare for other use */ | ||
200 | memset(&msg, 0, sizeof(msg)); | ||
201 | ++cnt; | ||
202 | } | ||
203 | |||
204 | fifo_rd = ioread8(&card->dpram[DPRAM_RX_RD]); | ||
205 | fifo_wr = ioread8(&card->dpram[DPRAM_RX_WR]); | ||
206 | |||
207 | if (++fifo_rd >= DPRAM_RX_CNT) | ||
208 | fifo_rd = 0; | ||
209 | if (fifo_wr == fifo_rd) | ||
210 | return cnt; | ||
211 | |||
212 | memcpy_fromio(buf, &card->dpram[DPRAM_RX + DPRAM_RX_SIZE*fifo_rd], | ||
213 | DPRAM_RX_SIZE); | ||
214 | mb(); | ||
215 | /* trigger dual port RAM */ | ||
216 | iowrite8(fifo_rd, &card->dpram[DPRAM_RX_RD]); | ||
217 | |||
218 | ptr = buf; | ||
219 | cmd = *ptr++; | ||
220 | if (cmd == 0xff) | ||
221 | /* not quite usefull, probably the card has got out */ | ||
222 | return 0; | ||
223 | netdev = card->net[0]; | ||
224 | if (cmd & CMD_BUS2) | ||
225 | netdev = card->net[1]; | ||
226 | priv = netdev_priv(netdev); | ||
227 | |||
228 | if (cmd & CMD_ERR) { | ||
229 | uint8_t can_state, state; | ||
230 | |||
231 | state = *ptr++; | ||
232 | |||
233 | msg.can_id = CAN_ERR_FLAG; | ||
234 | msg.can_dlc = CAN_ERR_DLC; | ||
235 | |||
236 | if (state & SF_MASK_BUSOFF) { | ||
237 | can_state = CAN_STATE_BUS_OFF; | ||
238 | msg.can_id |= CAN_ERR_BUSOFF; | ||
239 | state = STATE_BUSOFF; | ||
240 | } else if (state & SF_MASK_EPASSIVE) { | ||
241 | can_state = CAN_STATE_ERROR_PASSIVE; | ||
242 | msg.can_id |= CAN_ERR_CRTL; | ||
243 | msg.data[1] = CAN_ERR_CRTL_TX_PASSIVE; | ||
244 | state = STATE_EPASSIVE; | ||
245 | } else { | ||
246 | can_state = CAN_STATE_ERROR_ACTIVE; | ||
247 | msg.can_id |= CAN_ERR_CRTL; | ||
248 | state = STATE_EACTIVE; | ||
249 | } | ||
250 | /* update DPRAM */ | ||
251 | iowrite8(state, &card->dpram[priv->index ? | ||
252 | DPRAM_INFO_BUSSTATE2 : DPRAM_INFO_BUSSTATE]); | ||
253 | /* timestamp */ | ||
254 | tmp_u32 = le32_to_cpup((void *)ptr); | ||
255 | ptr += 4; | ||
256 | ktime = softing_raw2ktime(card, tmp_u32); | ||
257 | |||
258 | ++netdev->stats.rx_errors; | ||
259 | /* update internal status */ | ||
260 | if (can_state != priv->can.state) { | ||
261 | priv->can.state = can_state; | ||
262 | if (can_state == CAN_STATE_ERROR_PASSIVE) | ||
263 | ++priv->can.can_stats.error_passive; | ||
264 | else if (can_state == CAN_STATE_BUS_OFF) { | ||
265 | /* this calls can_close_cleanup() */ | ||
266 | can_bus_off(netdev); | ||
267 | netif_stop_queue(netdev); | ||
268 | } | ||
269 | /* trigger socketcan */ | ||
270 | softing_netdev_rx(netdev, &msg, ktime); | ||
271 | } | ||
272 | |||
273 | } else { | ||
274 | if (cmd & CMD_RTR) | ||
275 | msg.can_id |= CAN_RTR_FLAG; | ||
276 | msg.can_dlc = get_can_dlc(*ptr++); | ||
277 | if (cmd & CMD_XTD) { | ||
278 | msg.can_id |= CAN_EFF_FLAG; | ||
279 | msg.can_id |= le32_to_cpup((void *)ptr); | ||
280 | ptr += 4; | ||
281 | } else { | ||
282 | msg.can_id |= le16_to_cpup((void *)ptr); | ||
283 | ptr += 2; | ||
284 | } | ||
285 | /* timestamp */ | ||
286 | tmp_u32 = le32_to_cpup((void *)ptr); | ||
287 | ptr += 4; | ||
288 | ktime = softing_raw2ktime(card, tmp_u32); | ||
289 | if (!(msg.can_id & CAN_RTR_FLAG)) | ||
290 | memcpy(&msg.data[0], ptr, 8); | ||
291 | ptr += 8; | ||
292 | /* update socket */ | ||
293 | if (cmd & CMD_ACK) { | ||
294 | /* acknowledge, was tx msg */ | ||
295 | struct sk_buff *skb; | ||
296 | skb = priv->can.echo_skb[priv->tx.echo_get]; | ||
297 | if (skb) | ||
298 | skb->tstamp = ktime; | ||
299 | can_get_echo_skb(netdev, priv->tx.echo_get); | ||
300 | ++priv->tx.echo_get; | ||
301 | if (priv->tx.echo_get >= TX_ECHO_SKB_MAX) | ||
302 | priv->tx.echo_get = 0; | ||
303 | if (priv->tx.pending) | ||
304 | --priv->tx.pending; | ||
305 | if (card->tx.pending) | ||
306 | --card->tx.pending; | ||
307 | ++netdev->stats.tx_packets; | ||
308 | if (!(msg.can_id & CAN_RTR_FLAG)) | ||
309 | netdev->stats.tx_bytes += msg.can_dlc; | ||
310 | } else { | ||
311 | int ret; | ||
312 | |||
313 | ret = softing_netdev_rx(netdev, &msg, ktime); | ||
314 | if (ret == NET_RX_SUCCESS) { | ||
315 | ++netdev->stats.rx_packets; | ||
316 | if (!(msg.can_id & CAN_RTR_FLAG)) | ||
317 | netdev->stats.rx_bytes += msg.can_dlc; | ||
318 | } else { | ||
319 | ++netdev->stats.rx_dropped; | ||
320 | } | ||
321 | } | ||
322 | } | ||
323 | ++cnt; | ||
324 | return cnt; | ||
325 | } | ||
326 | |||
327 | /* | ||
328 | * real interrupt handler | ||
329 | */ | ||
330 | static irqreturn_t softing_irq_thread(int irq, void *dev_id) | ||
331 | { | ||
332 | struct softing *card = (struct softing *)dev_id; | ||
333 | struct net_device *netdev; | ||
334 | struct softing_priv *priv; | ||
335 | int j, offset, work_done; | ||
336 | |||
337 | work_done = 0; | ||
338 | spin_lock_bh(&card->spin); | ||
339 | while (softing_handle_1(card) > 0) { | ||
340 | ++card->irq.svc_count; | ||
341 | ++work_done; | ||
342 | } | ||
343 | spin_unlock_bh(&card->spin); | ||
344 | /* resume tx queue's */ | ||
345 | offset = card->tx.last_bus; | ||
346 | for (j = 0; j < ARRAY_SIZE(card->net); ++j) { | ||
347 | if (card->tx.pending >= TXMAX) | ||
348 | break; | ||
349 | netdev = card->net[(j + offset + 1) % card->pdat->nbus]; | ||
350 | if (!netdev) | ||
351 | continue; | ||
352 | priv = netdev_priv(netdev); | ||
353 | if (!canif_is_active(netdev)) | ||
354 | /* it makes no sense to wake dead busses */ | ||
355 | continue; | ||
356 | if (priv->tx.pending >= TX_ECHO_SKB_MAX) | ||
357 | continue; | ||
358 | ++work_done; | ||
359 | netif_wake_queue(netdev); | ||
360 | } | ||
361 | return work_done ? IRQ_HANDLED : IRQ_NONE; | ||
362 | } | ||
363 | |||
364 | /* | ||
365 | * interrupt routines: | ||
366 | * schedule the 'real interrupt handler' | ||
367 | */ | ||
368 | static irqreturn_t softing_irq_v2(int irq, void *dev_id) | ||
369 | { | ||
370 | struct softing *card = (struct softing *)dev_id; | ||
371 | uint8_t ir; | ||
372 | |||
373 | ir = ioread8(&card->dpram[DPRAM_V2_IRQ_TOHOST]); | ||
374 | iowrite8(0, &card->dpram[DPRAM_V2_IRQ_TOHOST]); | ||
375 | return (1 == ir) ? IRQ_WAKE_THREAD : IRQ_NONE; | ||
376 | } | ||
377 | |||
378 | static irqreturn_t softing_irq_v1(int irq, void *dev_id) | ||
379 | { | ||
380 | struct softing *card = (struct softing *)dev_id; | ||
381 | uint8_t ir; | ||
382 | |||
383 | ir = ioread8(&card->dpram[DPRAM_IRQ_TOHOST]); | ||
384 | iowrite8(0, &card->dpram[DPRAM_IRQ_TOHOST]); | ||
385 | return ir ? IRQ_WAKE_THREAD : IRQ_NONE; | ||
386 | } | ||
387 | |||
388 | /* | ||
389 | * netdev/candev inter-operability | ||
390 | */ | ||
391 | static int softing_netdev_open(struct net_device *ndev) | ||
392 | { | ||
393 | int ret; | ||
394 | |||
395 | /* check or determine and set bittime */ | ||
396 | ret = open_candev(ndev); | ||
397 | if (!ret) | ||
398 | ret = softing_startstop(ndev, 1); | ||
399 | return ret; | ||
400 | } | ||
401 | |||
402 | static int softing_netdev_stop(struct net_device *ndev) | ||
403 | { | ||
404 | int ret; | ||
405 | |||
406 | netif_stop_queue(ndev); | ||
407 | |||
408 | /* softing cycle does close_candev() */ | ||
409 | ret = softing_startstop(ndev, 0); | ||
410 | return ret; | ||
411 | } | ||
412 | |||
413 | static int softing_candev_set_mode(struct net_device *ndev, enum can_mode mode) | ||
414 | { | ||
415 | int ret; | ||
416 | |||
417 | switch (mode) { | ||
418 | case CAN_MODE_START: | ||
419 | /* softing_startstop does close_candev() */ | ||
420 | ret = softing_startstop(ndev, 1); | ||
421 | return ret; | ||
422 | case CAN_MODE_STOP: | ||
423 | case CAN_MODE_SLEEP: | ||
424 | return -EOPNOTSUPP; | ||
425 | } | ||
426 | return 0; | ||
427 | } | ||
428 | |||
429 | /* | ||
430 | * Softing device management helpers | ||
431 | */ | ||
432 | int softing_enable_irq(struct softing *card, int enable) | ||
433 | { | ||
434 | int ret; | ||
435 | |||
436 | if (!card->irq.nr) { | ||
437 | return 0; | ||
438 | } else if (card->irq.requested && !enable) { | ||
439 | free_irq(card->irq.nr, card); | ||
440 | card->irq.requested = 0; | ||
441 | } else if (!card->irq.requested && enable) { | ||
442 | ret = request_threaded_irq(card->irq.nr, | ||
443 | (card->pdat->generation >= 2) ? | ||
444 | softing_irq_v2 : softing_irq_v1, | ||
445 | softing_irq_thread, IRQF_SHARED, | ||
446 | dev_name(&card->pdev->dev), card); | ||
447 | if (ret) { | ||
448 | dev_alert(&card->pdev->dev, | ||
449 | "request_threaded_irq(%u) failed\n", | ||
450 | card->irq.nr); | ||
451 | return ret; | ||
452 | } | ||
453 | card->irq.requested = 1; | ||
454 | } | ||
455 | return 0; | ||
456 | } | ||
457 | |||
458 | static void softing_card_shutdown(struct softing *card) | ||
459 | { | ||
460 | int fw_up = 0; | ||
461 | |||
462 | if (mutex_lock_interruptible(&card->fw.lock)) | ||
463 | /* return -ERESTARTSYS */; | ||
464 | fw_up = card->fw.up; | ||
465 | card->fw.up = 0; | ||
466 | |||
467 | if (card->irq.requested && card->irq.nr) { | ||
468 | free_irq(card->irq.nr, card); | ||
469 | card->irq.requested = 0; | ||
470 | } | ||
471 | if (fw_up) { | ||
472 | if (card->pdat->enable_irq) | ||
473 | card->pdat->enable_irq(card->pdev, 0); | ||
474 | softing_set_reset_dpram(card); | ||
475 | if (card->pdat->reset) | ||
476 | card->pdat->reset(card->pdev, 1); | ||
477 | } | ||
478 | mutex_unlock(&card->fw.lock); | ||
479 | } | ||
480 | |||
481 | static __devinit int softing_card_boot(struct softing *card) | ||
482 | { | ||
483 | int ret, j; | ||
484 | static const uint8_t stream[] = { | ||
485 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, }; | ||
486 | unsigned char back[sizeof(stream)]; | ||
487 | |||
488 | if (mutex_lock_interruptible(&card->fw.lock)) | ||
489 | return -ERESTARTSYS; | ||
490 | if (card->fw.up) { | ||
491 | mutex_unlock(&card->fw.lock); | ||
492 | return 0; | ||
493 | } | ||
494 | /* reset board */ | ||
495 | if (card->pdat->enable_irq) | ||
496 | card->pdat->enable_irq(card->pdev, 1); | ||
497 | /* boot card */ | ||
498 | softing_set_reset_dpram(card); | ||
499 | if (card->pdat->reset) | ||
500 | card->pdat->reset(card->pdev, 1); | ||
501 | for (j = 0; (j + sizeof(stream)) < card->dpram_size; | ||
502 | j += sizeof(stream)) { | ||
503 | |||
504 | memcpy_toio(&card->dpram[j], stream, sizeof(stream)); | ||
505 | /* flush IO cache */ | ||
506 | mb(); | ||
507 | memcpy_fromio(back, &card->dpram[j], sizeof(stream)); | ||
508 | |||
509 | if (!memcmp(back, stream, sizeof(stream))) | ||
510 | continue; | ||
511 | /* memory is not equal */ | ||
512 | dev_alert(&card->pdev->dev, "dpram failed at 0x%04x\n", j); | ||
513 | ret = -EIO; | ||
514 | goto failed; | ||
515 | } | ||
516 | wmb(); | ||
517 | /* load boot firmware */ | ||
518 | ret = softing_load_fw(card->pdat->boot.fw, card, card->dpram, | ||
519 | card->dpram_size, | ||
520 | card->pdat->boot.offs - card->pdat->boot.addr); | ||
521 | if (ret < 0) | ||
522 | goto failed; | ||
523 | /* load loader firmware */ | ||
524 | ret = softing_load_fw(card->pdat->load.fw, card, card->dpram, | ||
525 | card->dpram_size, | ||
526 | card->pdat->load.offs - card->pdat->load.addr); | ||
527 | if (ret < 0) | ||
528 | goto failed; | ||
529 | |||
530 | if (card->pdat->reset) | ||
531 | card->pdat->reset(card->pdev, 0); | ||
532 | softing_clr_reset_dpram(card); | ||
533 | ret = softing_bootloader_command(card, 0, "card boot"); | ||
534 | if (ret < 0) | ||
535 | goto failed; | ||
536 | ret = softing_load_app_fw(card->pdat->app.fw, card); | ||
537 | if (ret < 0) | ||
538 | goto failed; | ||
539 | |||
540 | ret = softing_chip_poweron(card); | ||
541 | if (ret < 0) | ||
542 | goto failed; | ||
543 | |||
544 | card->fw.up = 1; | ||
545 | mutex_unlock(&card->fw.lock); | ||
546 | return 0; | ||
547 | failed: | ||
548 | card->fw.up = 0; | ||
549 | if (card->pdat->enable_irq) | ||
550 | card->pdat->enable_irq(card->pdev, 0); | ||
551 | softing_set_reset_dpram(card); | ||
552 | if (card->pdat->reset) | ||
553 | card->pdat->reset(card->pdev, 1); | ||
554 | mutex_unlock(&card->fw.lock); | ||
555 | return ret; | ||
556 | } | ||
557 | |||
558 | /* | ||
559 | * netdev sysfs | ||
560 | */ | ||
561 | static ssize_t show_channel(struct device *dev, struct device_attribute *attr, | ||
562 | char *buf) | ||
563 | { | ||
564 | struct net_device *ndev = to_net_dev(dev); | ||
565 | struct softing_priv *priv = netdev2softing(ndev); | ||
566 | |||
567 | return sprintf(buf, "%i\n", priv->index); | ||
568 | } | ||
569 | |||
570 | static ssize_t show_chip(struct device *dev, struct device_attribute *attr, | ||
571 | char *buf) | ||
572 | { | ||
573 | struct net_device *ndev = to_net_dev(dev); | ||
574 | struct softing_priv *priv = netdev2softing(ndev); | ||
575 | |||
576 | return sprintf(buf, "%i\n", priv->chip); | ||
577 | } | ||
578 | |||
579 | static ssize_t show_output(struct device *dev, struct device_attribute *attr, | ||
580 | char *buf) | ||
581 | { | ||
582 | struct net_device *ndev = to_net_dev(dev); | ||
583 | struct softing_priv *priv = netdev2softing(ndev); | ||
584 | |||
585 | return sprintf(buf, "0x%02x\n", priv->output); | ||
586 | } | ||
587 | |||
588 | static ssize_t store_output(struct device *dev, struct device_attribute *attr, | ||
589 | const char *buf, size_t count) | ||
590 | { | ||
591 | struct net_device *ndev = to_net_dev(dev); | ||
592 | struct softing_priv *priv = netdev2softing(ndev); | ||
593 | struct softing *card = priv->card; | ||
594 | unsigned long val; | ||
595 | int ret; | ||
596 | |||
597 | ret = strict_strtoul(buf, 0, &val); | ||
598 | if (ret < 0) | ||
599 | return ret; | ||
600 | val &= 0xFF; | ||
601 | |||
602 | ret = mutex_lock_interruptible(&card->fw.lock); | ||
603 | if (ret) | ||
604 | return -ERESTARTSYS; | ||
605 | if (netif_running(ndev)) { | ||
606 | mutex_unlock(&card->fw.lock); | ||
607 | return -EBUSY; | ||
608 | } | ||
609 | priv->output = val; | ||
610 | mutex_unlock(&card->fw.lock); | ||
611 | return count; | ||
612 | } | ||
613 | |||
614 | static const DEVICE_ATTR(channel, S_IRUGO, show_channel, NULL); | ||
615 | static const DEVICE_ATTR(chip, S_IRUGO, show_chip, NULL); | ||
616 | static const DEVICE_ATTR(output, S_IRUGO | S_IWUSR, show_output, store_output); | ||
617 | |||
618 | static const struct attribute *const netdev_sysfs_attrs[] = { | ||
619 | &dev_attr_channel.attr, | ||
620 | &dev_attr_chip.attr, | ||
621 | &dev_attr_output.attr, | ||
622 | NULL, | ||
623 | }; | ||
624 | static const struct attribute_group netdev_sysfs_group = { | ||
625 | .name = NULL, | ||
626 | .attrs = (struct attribute **)netdev_sysfs_attrs, | ||
627 | }; | ||
628 | |||
629 | static const struct net_device_ops softing_netdev_ops = { | ||
630 | .ndo_open = softing_netdev_open, | ||
631 | .ndo_stop = softing_netdev_stop, | ||
632 | .ndo_start_xmit = softing_netdev_start_xmit, | ||
633 | }; | ||
634 | |||
635 | static const struct can_bittiming_const softing_btr_const = { | ||
636 | .tseg1_min = 1, | ||
637 | .tseg1_max = 16, | ||
638 | .tseg2_min = 1, | ||
639 | .tseg2_max = 8, | ||
640 | .sjw_max = 4, /* overruled */ | ||
641 | .brp_min = 1, | ||
642 | .brp_max = 32, /* overruled */ | ||
643 | .brp_inc = 1, | ||
644 | }; | ||
645 | |||
646 | |||
647 | static __devinit struct net_device *softing_netdev_create(struct softing *card, | ||
648 | uint16_t chip_id) | ||
649 | { | ||
650 | struct net_device *netdev; | ||
651 | struct softing_priv *priv; | ||
652 | |||
653 | netdev = alloc_candev(sizeof(*priv), TX_ECHO_SKB_MAX); | ||
654 | if (!netdev) { | ||
655 | dev_alert(&card->pdev->dev, "alloc_candev failed\n"); | ||
656 | return NULL; | ||
657 | } | ||
658 | priv = netdev_priv(netdev); | ||
659 | priv->netdev = netdev; | ||
660 | priv->card = card; | ||
661 | memcpy(&priv->btr_const, &softing_btr_const, sizeof(priv->btr_const)); | ||
662 | priv->btr_const.brp_max = card->pdat->max_brp; | ||
663 | priv->btr_const.sjw_max = card->pdat->max_sjw; | ||
664 | priv->can.bittiming_const = &priv->btr_const; | ||
665 | priv->can.clock.freq = 8000000; | ||
666 | priv->chip = chip_id; | ||
667 | priv->output = softing_default_output(netdev); | ||
668 | SET_NETDEV_DEV(netdev, &card->pdev->dev); | ||
669 | |||
670 | netdev->flags |= IFF_ECHO; | ||
671 | netdev->netdev_ops = &softing_netdev_ops; | ||
672 | priv->can.do_set_mode = softing_candev_set_mode; | ||
673 | priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES; | ||
674 | |||
675 | return netdev; | ||
676 | } | ||
677 | |||
678 | static __devinit int softing_netdev_register(struct net_device *netdev) | ||
679 | { | ||
680 | int ret; | ||
681 | |||
682 | netdev->sysfs_groups[0] = &netdev_sysfs_group; | ||
683 | ret = register_candev(netdev); | ||
684 | if (ret) { | ||
685 | dev_alert(&netdev->dev, "register failed\n"); | ||
686 | return ret; | ||
687 | } | ||
688 | return 0; | ||
689 | } | ||
690 | |||
691 | static void softing_netdev_cleanup(struct net_device *netdev) | ||
692 | { | ||
693 | unregister_candev(netdev); | ||
694 | free_candev(netdev); | ||
695 | } | ||
696 | |||
697 | /* | ||
698 | * sysfs for Platform device | ||
699 | */ | ||
700 | #define DEV_ATTR_RO(name, member) \ | ||
701 | static ssize_t show_##name(struct device *dev, \ | ||
702 | struct device_attribute *attr, char *buf) \ | ||
703 | { \ | ||
704 | struct softing *card = platform_get_drvdata(to_platform_device(dev)); \ | ||
705 | return sprintf(buf, "%u\n", card->member); \ | ||
706 | } \ | ||
707 | static DEVICE_ATTR(name, 0444, show_##name, NULL) | ||
708 | |||
709 | #define DEV_ATTR_RO_STR(name, member) \ | ||
710 | static ssize_t show_##name(struct device *dev, \ | ||
711 | struct device_attribute *attr, char *buf) \ | ||
712 | { \ | ||
713 | struct softing *card = platform_get_drvdata(to_platform_device(dev)); \ | ||
714 | return sprintf(buf, "%s\n", card->member); \ | ||
715 | } \ | ||
716 | static DEVICE_ATTR(name, 0444, show_##name, NULL) | ||
717 | |||
718 | DEV_ATTR_RO(serial, id.serial); | ||
719 | DEV_ATTR_RO_STR(firmware, pdat->app.fw); | ||
720 | DEV_ATTR_RO(firmware_version, id.fw_version); | ||
721 | DEV_ATTR_RO_STR(hardware, pdat->name); | ||
722 | DEV_ATTR_RO(hardware_version, id.hw_version); | ||
723 | DEV_ATTR_RO(license, id.license); | ||
724 | DEV_ATTR_RO(frequency, id.freq); | ||
725 | DEV_ATTR_RO(txpending, tx.pending); | ||
726 | |||
727 | static struct attribute *softing_pdev_attrs[] = { | ||
728 | &dev_attr_serial.attr, | ||
729 | &dev_attr_firmware.attr, | ||
730 | &dev_attr_firmware_version.attr, | ||
731 | &dev_attr_hardware.attr, | ||
732 | &dev_attr_hardware_version.attr, | ||
733 | &dev_attr_license.attr, | ||
734 | &dev_attr_frequency.attr, | ||
735 | &dev_attr_txpending.attr, | ||
736 | NULL, | ||
737 | }; | ||
738 | |||
739 | static const struct attribute_group softing_pdev_group = { | ||
740 | .name = NULL, | ||
741 | .attrs = softing_pdev_attrs, | ||
742 | }; | ||
743 | |||
744 | /* | ||
745 | * platform driver | ||
746 | */ | ||
747 | static __devexit int softing_pdev_remove(struct platform_device *pdev) | ||
748 | { | ||
749 | struct softing *card = platform_get_drvdata(pdev); | ||
750 | int j; | ||
751 | |||
752 | /* first, disable card*/ | ||
753 | softing_card_shutdown(card); | ||
754 | |||
755 | for (j = 0; j < ARRAY_SIZE(card->net); ++j) { | ||
756 | if (!card->net[j]) | ||
757 | continue; | ||
758 | softing_netdev_cleanup(card->net[j]); | ||
759 | card->net[j] = NULL; | ||
760 | } | ||
761 | sysfs_remove_group(&pdev->dev.kobj, &softing_pdev_group); | ||
762 | |||
763 | iounmap(card->dpram); | ||
764 | kfree(card); | ||
765 | return 0; | ||
766 | } | ||
767 | |||
768 | static __devinit int softing_pdev_probe(struct platform_device *pdev) | ||
769 | { | ||
770 | const struct softing_platform_data *pdat = pdev->dev.platform_data; | ||
771 | struct softing *card; | ||
772 | struct net_device *netdev; | ||
773 | struct softing_priv *priv; | ||
774 | struct resource *pres; | ||
775 | int ret; | ||
776 | int j; | ||
777 | |||
778 | if (!pdat) { | ||
779 | dev_warn(&pdev->dev, "no platform data\n"); | ||
780 | return -EINVAL; | ||
781 | } | ||
782 | if (pdat->nbus > ARRAY_SIZE(card->net)) { | ||
783 | dev_warn(&pdev->dev, "%u nets??\n", pdat->nbus); | ||
784 | return -EINVAL; | ||
785 | } | ||
786 | |||
787 | card = kzalloc(sizeof(*card), GFP_KERNEL); | ||
788 | if (!card) | ||
789 | return -ENOMEM; | ||
790 | card->pdat = pdat; | ||
791 | card->pdev = pdev; | ||
792 | platform_set_drvdata(pdev, card); | ||
793 | mutex_init(&card->fw.lock); | ||
794 | spin_lock_init(&card->spin); | ||
795 | |||
796 | ret = -EINVAL; | ||
797 | pres = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
798 | if (!pres) | ||
799 | goto platform_resource_failed;; | ||
800 | card->dpram_phys = pres->start; | ||
801 | card->dpram_size = pres->end - pres->start + 1; | ||
802 | card->dpram = ioremap_nocache(card->dpram_phys, card->dpram_size); | ||
803 | if (!card->dpram) { | ||
804 | dev_alert(&card->pdev->dev, "dpram ioremap failed\n"); | ||
805 | goto ioremap_failed; | ||
806 | } | ||
807 | |||
808 | pres = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | ||
809 | if (pres) | ||
810 | card->irq.nr = pres->start; | ||
811 | |||
812 | /* reset card */ | ||
813 | ret = softing_card_boot(card); | ||
814 | if (ret < 0) { | ||
815 | dev_alert(&pdev->dev, "failed to boot\n"); | ||
816 | goto boot_failed; | ||
817 | } | ||
818 | |||
819 | /* only now, the chip's are known */ | ||
820 | card->id.freq = card->pdat->freq; | ||
821 | |||
822 | ret = sysfs_create_group(&pdev->dev.kobj, &softing_pdev_group); | ||
823 | if (ret < 0) { | ||
824 | dev_alert(&card->pdev->dev, "sysfs failed\n"); | ||
825 | goto sysfs_failed; | ||
826 | } | ||
827 | |||
828 | ret = -ENOMEM; | ||
829 | for (j = 0; j < ARRAY_SIZE(card->net); ++j) { | ||
830 | card->net[j] = netdev = | ||
831 | softing_netdev_create(card, card->id.chip[j]); | ||
832 | if (!netdev) { | ||
833 | dev_alert(&pdev->dev, "failed to make can[%i]", j); | ||
834 | goto netdev_failed; | ||
835 | } | ||
836 | priv = netdev_priv(card->net[j]); | ||
837 | priv->index = j; | ||
838 | ret = softing_netdev_register(netdev); | ||
839 | if (ret) { | ||
840 | free_candev(netdev); | ||
841 | card->net[j] = NULL; | ||
842 | dev_alert(&card->pdev->dev, | ||
843 | "failed to register can[%i]\n", j); | ||
844 | goto netdev_failed; | ||
845 | } | ||
846 | } | ||
847 | dev_info(&card->pdev->dev, "%s ready.\n", card->pdat->name); | ||
848 | return 0; | ||
849 | |||
850 | netdev_failed: | ||
851 | for (j = 0; j < ARRAY_SIZE(card->net); ++j) { | ||
852 | if (!card->net[j]) | ||
853 | continue; | ||
854 | softing_netdev_cleanup(card->net[j]); | ||
855 | } | ||
856 | sysfs_remove_group(&pdev->dev.kobj, &softing_pdev_group); | ||
857 | sysfs_failed: | ||
858 | softing_card_shutdown(card); | ||
859 | boot_failed: | ||
860 | iounmap(card->dpram); | ||
861 | ioremap_failed: | ||
862 | platform_resource_failed: | ||
863 | kfree(card); | ||
864 | return ret; | ||
865 | } | ||
866 | |||
867 | static struct platform_driver softing_driver = { | ||
868 | .driver = { | ||
869 | .name = "softing", | ||
870 | .owner = THIS_MODULE, | ||
871 | }, | ||
872 | .probe = softing_pdev_probe, | ||
873 | .remove = __devexit_p(softing_pdev_remove), | ||
874 | }; | ||
875 | |||
876 | MODULE_ALIAS("platform:softing"); | ||
877 | |||
878 | static int __init softing_start(void) | ||
879 | { | ||
880 | return platform_driver_register(&softing_driver); | ||
881 | } | ||
882 | |||
883 | static void __exit softing_stop(void) | ||
884 | { | ||
885 | platform_driver_unregister(&softing_driver); | ||
886 | } | ||
887 | |||
888 | module_init(softing_start); | ||
889 | module_exit(softing_stop); | ||
890 | |||
891 | MODULE_DESCRIPTION("Softing DPRAM CAN driver"); | ||
892 | MODULE_AUTHOR("Kurt Van Dijck <kurt.van.dijck@eia.be>"); | ||
893 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/net/can/softing/softing_platform.h b/drivers/net/can/softing/softing_platform.h new file mode 100644 index 00000000000..ebbf6981562 --- /dev/null +++ b/drivers/net/can/softing/softing_platform.h | |||
@@ -0,0 +1,40 @@ | |||
1 | |||
2 | #include <linux/platform_device.h> | ||
3 | |||
4 | #ifndef _SOFTING_DEVICE_H_ | ||
5 | #define _SOFTING_DEVICE_H_ | ||
6 | |||
7 | /* softing firmware directory prefix */ | ||
8 | #define fw_dir "softing-4.6/" | ||
9 | |||
10 | struct softing_platform_data { | ||
11 | unsigned int manf; | ||
12 | unsigned int prod; | ||
13 | /* | ||
14 | * generation | ||
15 | * 1st with NEC or SJA1000 | ||
16 | * 8bit, exclusive interrupt, ... | ||
17 | * 2nd only SJA1000 | ||
18 | * 16bit, shared interrupt | ||
19 | */ | ||
20 | int generation; | ||
21 | int nbus; /* # busses on device */ | ||
22 | unsigned int freq; /* operating frequency in Hz */ | ||
23 | unsigned int max_brp; | ||
24 | unsigned int max_sjw; | ||
25 | unsigned long dpram_size; | ||
26 | const char *name; | ||
27 | struct { | ||
28 | unsigned long offs; | ||
29 | unsigned long addr; | ||
30 | const char *fw; | ||
31 | } boot, load, app; | ||
32 | /* | ||
33 | * reset() function | ||
34 | * bring pdev in or out of reset, depending on value | ||
35 | */ | ||
36 | int (*reset)(struct platform_device *pdev, int value); | ||
37 | int (*enable_irq)(struct platform_device *pdev, int value); | ||
38 | }; | ||
39 | |||
40 | #endif | ||
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c index 263a2944566..7ff170cbc7d 100644 --- a/drivers/net/cnic.c +++ b/drivers/net/cnic.c | |||
@@ -699,13 +699,13 @@ static void cnic_free_dma(struct cnic_dev *dev, struct cnic_dma *dma) | |||
699 | static void cnic_setup_page_tbl(struct cnic_dev *dev, struct cnic_dma *dma) | 699 | static void cnic_setup_page_tbl(struct cnic_dev *dev, struct cnic_dma *dma) |
700 | { | 700 | { |
701 | int i; | 701 | int i; |
702 | u32 *page_table = dma->pgtbl; | 702 | __le32 *page_table = (__le32 *) dma->pgtbl; |
703 | 703 | ||
704 | for (i = 0; i < dma->num_pages; i++) { | 704 | for (i = 0; i < dma->num_pages; i++) { |
705 | /* Each entry needs to be in big endian format. */ | 705 | /* Each entry needs to be in big endian format. */ |
706 | *page_table = (u32) ((u64) dma->pg_map_arr[i] >> 32); | 706 | *page_table = cpu_to_le32((u64) dma->pg_map_arr[i] >> 32); |
707 | page_table++; | 707 | page_table++; |
708 | *page_table = (u32) dma->pg_map_arr[i]; | 708 | *page_table = cpu_to_le32(dma->pg_map_arr[i] & 0xffffffff); |
709 | page_table++; | 709 | page_table++; |
710 | } | 710 | } |
711 | } | 711 | } |
@@ -713,13 +713,13 @@ static void cnic_setup_page_tbl(struct cnic_dev *dev, struct cnic_dma *dma) | |||
713 | static void cnic_setup_page_tbl_le(struct cnic_dev *dev, struct cnic_dma *dma) | 713 | static void cnic_setup_page_tbl_le(struct cnic_dev *dev, struct cnic_dma *dma) |
714 | { | 714 | { |
715 | int i; | 715 | int i; |
716 | u32 *page_table = dma->pgtbl; | 716 | __le32 *page_table = (__le32 *) dma->pgtbl; |
717 | 717 | ||
718 | for (i = 0; i < dma->num_pages; i++) { | 718 | for (i = 0; i < dma->num_pages; i++) { |
719 | /* Each entry needs to be in little endian format. */ | 719 | /* Each entry needs to be in little endian format. */ |
720 | *page_table = dma->pg_map_arr[i] & 0xffffffff; | 720 | *page_table = cpu_to_le32(dma->pg_map_arr[i] & 0xffffffff); |
721 | page_table++; | 721 | page_table++; |
722 | *page_table = (u32) ((u64) dma->pg_map_arr[i] >> 32); | 722 | *page_table = cpu_to_le32((u64) dma->pg_map_arr[i] >> 32); |
723 | page_table++; | 723 | page_table++; |
724 | } | 724 | } |
725 | } | 725 | } |
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c index 059c1eec8c3..ec35d458102 100644 --- a/drivers/net/cxgb4/cxgb4_main.c +++ b/drivers/net/cxgb4/cxgb4_main.c | |||
@@ -2710,6 +2710,8 @@ static int cxgb_open(struct net_device *dev) | |||
2710 | struct port_info *pi = netdev_priv(dev); | 2710 | struct port_info *pi = netdev_priv(dev); |
2711 | struct adapter *adapter = pi->adapter; | 2711 | struct adapter *adapter = pi->adapter; |
2712 | 2712 | ||
2713 | netif_carrier_off(dev); | ||
2714 | |||
2713 | if (!(adapter->flags & FULL_INIT_DONE)) { | 2715 | if (!(adapter->flags & FULL_INIT_DONE)) { |
2714 | err = cxgb_up(adapter); | 2716 | err = cxgb_up(adapter); |
2715 | if (err < 0) | 2717 | if (err < 0) |
@@ -3661,7 +3663,6 @@ static int __devinit init_one(struct pci_dev *pdev, | |||
3661 | pi->xact_addr_filt = -1; | 3663 | pi->xact_addr_filt = -1; |
3662 | pi->rx_offload = RX_CSO; | 3664 | pi->rx_offload = RX_CSO; |
3663 | pi->port_id = i; | 3665 | pi->port_id = i; |
3664 | netif_carrier_off(netdev); | ||
3665 | netdev->irq = pdev->irq; | 3666 | netdev->irq = pdev->irq; |
3666 | 3667 | ||
3667 | netdev->features |= NETIF_F_SG | TSO_FLAGS; | 3668 | netdev->features |= NETIF_F_SG | TSO_FLAGS; |
diff --git a/drivers/net/pch_gbe/pch_gbe_main.c b/drivers/net/pch_gbe/pch_gbe_main.c index d7355306a73..1bf12339441 100644 --- a/drivers/net/pch_gbe/pch_gbe_main.c +++ b/drivers/net/pch_gbe/pch_gbe_main.c | |||
@@ -2247,7 +2247,7 @@ static void pch_gbe_remove(struct pci_dev *pdev) | |||
2247 | struct net_device *netdev = pci_get_drvdata(pdev); | 2247 | struct net_device *netdev = pci_get_drvdata(pdev); |
2248 | struct pch_gbe_adapter *adapter = netdev_priv(netdev); | 2248 | struct pch_gbe_adapter *adapter = netdev_priv(netdev); |
2249 | 2249 | ||
2250 | flush_scheduled_work(); | 2250 | cancel_work_sync(&adapter->reset_task); |
2251 | unregister_netdev(netdev); | 2251 | unregister_netdev(netdev); |
2252 | 2252 | ||
2253 | pch_gbe_hal_phy_hw_reset(&adapter->hw); | 2253 | pch_gbe_hal_phy_hw_reset(&adapter->hw); |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 7841a8f6999..93b32d36661 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -60,12 +60,6 @@ | |||
60 | #define BAR_0 0 | 60 | #define BAR_0 0 |
61 | #define BAR_2 2 | 61 | #define BAR_2 2 |
62 | 62 | ||
63 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | ||
64 | #define TG3_VLAN_TAG_USED 1 | ||
65 | #else | ||
66 | #define TG3_VLAN_TAG_USED 0 | ||
67 | #endif | ||
68 | |||
69 | #include "tg3.h" | 63 | #include "tg3.h" |
70 | 64 | ||
71 | #define DRV_MODULE_NAME "tg3" | 65 | #define DRV_MODULE_NAME "tg3" |
@@ -134,9 +128,6 @@ | |||
134 | TG3_TX_RING_SIZE) | 128 | TG3_TX_RING_SIZE) |
135 | #define NEXT_TX(N) (((N) + 1) & (TG3_TX_RING_SIZE - 1)) | 129 | #define NEXT_TX(N) (((N) + 1) & (TG3_TX_RING_SIZE - 1)) |
136 | 130 | ||
137 | #define TG3_RX_DMA_ALIGN 16 | ||
138 | #define TG3_RX_HEADROOM ALIGN(VLAN_HLEN, TG3_RX_DMA_ALIGN) | ||
139 | |||
140 | #define TG3_DMA_BYTE_ENAB 64 | 131 | #define TG3_DMA_BYTE_ENAB 64 |
141 | 132 | ||
142 | #define TG3_RX_STD_DMA_SZ 1536 | 133 | #define TG3_RX_STD_DMA_SZ 1536 |
@@ -4722,8 +4713,6 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) | |||
4722 | struct sk_buff *skb; | 4713 | struct sk_buff *skb; |
4723 | dma_addr_t dma_addr; | 4714 | dma_addr_t dma_addr; |
4724 | u32 opaque_key, desc_idx, *post_ptr; | 4715 | u32 opaque_key, desc_idx, *post_ptr; |
4725 | bool hw_vlan __maybe_unused = false; | ||
4726 | u16 vtag __maybe_unused = 0; | ||
4727 | 4716 | ||
4728 | desc_idx = desc->opaque & RXD_OPAQUE_INDEX_MASK; | 4717 | desc_idx = desc->opaque & RXD_OPAQUE_INDEX_MASK; |
4729 | opaque_key = desc->opaque & RXD_OPAQUE_RING_MASK; | 4718 | opaque_key = desc->opaque & RXD_OPAQUE_RING_MASK; |
@@ -4782,12 +4771,12 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) | |||
4782 | tg3_recycle_rx(tnapi, tpr, opaque_key, | 4771 | tg3_recycle_rx(tnapi, tpr, opaque_key, |
4783 | desc_idx, *post_ptr); | 4772 | desc_idx, *post_ptr); |
4784 | 4773 | ||
4785 | copy_skb = netdev_alloc_skb(tp->dev, len + VLAN_HLEN + | 4774 | copy_skb = netdev_alloc_skb(tp->dev, len + |
4786 | TG3_RAW_IP_ALIGN); | 4775 | TG3_RAW_IP_ALIGN); |
4787 | if (copy_skb == NULL) | 4776 | if (copy_skb == NULL) |
4788 | goto drop_it_no_recycle; | 4777 | goto drop_it_no_recycle; |
4789 | 4778 | ||
4790 | skb_reserve(copy_skb, TG3_RAW_IP_ALIGN + VLAN_HLEN); | 4779 | skb_reserve(copy_skb, TG3_RAW_IP_ALIGN); |
4791 | skb_put(copy_skb, len); | 4780 | skb_put(copy_skb, len); |
4792 | pci_dma_sync_single_for_cpu(tp->pdev, dma_addr, len, PCI_DMA_FROMDEVICE); | 4781 | pci_dma_sync_single_for_cpu(tp->pdev, dma_addr, len, PCI_DMA_FROMDEVICE); |
4793 | skb_copy_from_linear_data(skb, copy_skb->data, len); | 4782 | skb_copy_from_linear_data(skb, copy_skb->data, len); |
@@ -4814,30 +4803,11 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) | |||
4814 | } | 4803 | } |
4815 | 4804 | ||
4816 | if (desc->type_flags & RXD_FLAG_VLAN && | 4805 | if (desc->type_flags & RXD_FLAG_VLAN && |
4817 | !(tp->rx_mode & RX_MODE_KEEP_VLAN_TAG)) { | 4806 | !(tp->rx_mode & RX_MODE_KEEP_VLAN_TAG)) |
4818 | vtag = desc->err_vlan & RXD_VLAN_MASK; | 4807 | __vlan_hwaccel_put_tag(skb, |
4819 | #if TG3_VLAN_TAG_USED | 4808 | desc->err_vlan & RXD_VLAN_MASK); |
4820 | if (tp->vlgrp) | ||
4821 | hw_vlan = true; | ||
4822 | else | ||
4823 | #endif | ||
4824 | { | ||
4825 | struct vlan_ethhdr *ve = (struct vlan_ethhdr *) | ||
4826 | __skb_push(skb, VLAN_HLEN); | ||
4827 | |||
4828 | memmove(ve, skb->data + VLAN_HLEN, | ||
4829 | ETH_ALEN * 2); | ||
4830 | ve->h_vlan_proto = htons(ETH_P_8021Q); | ||
4831 | ve->h_vlan_TCI = htons(vtag); | ||
4832 | } | ||
4833 | } | ||
4834 | 4809 | ||
4835 | #if TG3_VLAN_TAG_USED | 4810 | napi_gro_receive(&tnapi->napi, skb); |
4836 | if (hw_vlan) | ||
4837 | vlan_gro_receive(&tnapi->napi, tp->vlgrp, vtag, skb); | ||
4838 | else | ||
4839 | #endif | ||
4840 | napi_gro_receive(&tnapi->napi, skb); | ||
4841 | 4811 | ||
4842 | received++; | 4812 | received++; |
4843 | budget--; | 4813 | budget--; |
@@ -5740,11 +5710,9 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, | |||
5740 | base_flags |= TXD_FLAG_TCPUDP_CSUM; | 5710 | base_flags |= TXD_FLAG_TCPUDP_CSUM; |
5741 | } | 5711 | } |
5742 | 5712 | ||
5743 | #if TG3_VLAN_TAG_USED | ||
5744 | if (vlan_tx_tag_present(skb)) | 5713 | if (vlan_tx_tag_present(skb)) |
5745 | base_flags |= (TXD_FLAG_VLAN | | 5714 | base_flags |= (TXD_FLAG_VLAN | |
5746 | (vlan_tx_tag_get(skb) << 16)); | 5715 | (vlan_tx_tag_get(skb) << 16)); |
5747 | #endif | ||
5748 | 5716 | ||
5749 | len = skb_headlen(skb); | 5717 | len = skb_headlen(skb); |
5750 | 5718 | ||
@@ -5986,11 +5954,10 @@ static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb, | |||
5986 | } | 5954 | } |
5987 | } | 5955 | } |
5988 | } | 5956 | } |
5989 | #if TG3_VLAN_TAG_USED | 5957 | |
5990 | if (vlan_tx_tag_present(skb)) | 5958 | if (vlan_tx_tag_present(skb)) |
5991 | base_flags |= (TXD_FLAG_VLAN | | 5959 | base_flags |= (TXD_FLAG_VLAN | |
5992 | (vlan_tx_tag_get(skb) << 16)); | 5960 | (vlan_tx_tag_get(skb) << 16)); |
5993 | #endif | ||
5994 | 5961 | ||
5995 | if ((tp->tg3_flags3 & TG3_FLG3_USE_JUMBO_BDFLAG) && | 5962 | if ((tp->tg3_flags3 & TG3_FLG3_USE_JUMBO_BDFLAG) && |
5996 | !mss && skb->len > VLAN_ETH_FRAME_LEN) | 5963 | !mss && skb->len > VLAN_ETH_FRAME_LEN) |
@@ -9532,17 +9499,10 @@ static void __tg3_set_rx_mode(struct net_device *dev) | |||
9532 | rx_mode = tp->rx_mode & ~(RX_MODE_PROMISC | | 9499 | rx_mode = tp->rx_mode & ~(RX_MODE_PROMISC | |
9533 | RX_MODE_KEEP_VLAN_TAG); | 9500 | RX_MODE_KEEP_VLAN_TAG); |
9534 | 9501 | ||
9502 | #if !defined(CONFIG_VLAN_8021Q) && !defined(CONFIG_VLAN_8021Q_MODULE) | ||
9535 | /* When ASF is in use, we always keep the RX_MODE_KEEP_VLAN_TAG | 9503 | /* When ASF is in use, we always keep the RX_MODE_KEEP_VLAN_TAG |
9536 | * flag clear. | 9504 | * flag clear. |
9537 | */ | 9505 | */ |
9538 | #if TG3_VLAN_TAG_USED | ||
9539 | if (!tp->vlgrp && | ||
9540 | !(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) | ||
9541 | rx_mode |= RX_MODE_KEEP_VLAN_TAG; | ||
9542 | #else | ||
9543 | /* By definition, VLAN is disabled always in this | ||
9544 | * case. | ||
9545 | */ | ||
9546 | if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) | 9506 | if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF)) |
9547 | rx_mode |= RX_MODE_KEEP_VLAN_TAG; | 9507 | rx_mode |= RX_MODE_KEEP_VLAN_TAG; |
9548 | #endif | 9508 | #endif |
@@ -11230,31 +11190,6 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
11230 | return -EOPNOTSUPP; | 11190 | return -EOPNOTSUPP; |
11231 | } | 11191 | } |
11232 | 11192 | ||
11233 | #if TG3_VLAN_TAG_USED | ||
11234 | static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) | ||
11235 | { | ||
11236 | struct tg3 *tp = netdev_priv(dev); | ||
11237 | |||
11238 | if (!netif_running(dev)) { | ||
11239 | tp->vlgrp = grp; | ||
11240 | return; | ||
11241 | } | ||
11242 | |||
11243 | tg3_netif_stop(tp); | ||
11244 | |||
11245 | tg3_full_lock(tp, 0); | ||
11246 | |||
11247 | tp->vlgrp = grp; | ||
11248 | |||
11249 | /* Update RX_MODE_KEEP_VLAN_TAG bit in RX_MODE register. */ | ||
11250 | __tg3_set_rx_mode(dev); | ||
11251 | |||
11252 | tg3_netif_start(tp); | ||
11253 | |||
11254 | tg3_full_unlock(tp); | ||
11255 | } | ||
11256 | #endif | ||
11257 | |||
11258 | static int tg3_get_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) | 11193 | static int tg3_get_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) |
11259 | { | 11194 | { |
11260 | struct tg3 *tp = netdev_priv(dev); | 11195 | struct tg3 *tp = netdev_priv(dev); |
@@ -13066,9 +13001,7 @@ static struct pci_dev * __devinit tg3_find_peer(struct tg3 *); | |||
13066 | 13001 | ||
13067 | static void inline vlan_features_add(struct net_device *dev, unsigned long flags) | 13002 | static void inline vlan_features_add(struct net_device *dev, unsigned long flags) |
13068 | { | 13003 | { |
13069 | #if TG3_VLAN_TAG_USED | ||
13070 | dev->vlan_features |= flags; | 13004 | dev->vlan_features |= flags; |
13071 | #endif | ||
13072 | } | 13005 | } |
13073 | 13006 | ||
13074 | static inline u32 tg3_rx_ret_ring_size(struct tg3 *tp) | 13007 | static inline u32 tg3_rx_ret_ring_size(struct tg3 *tp) |
@@ -13861,11 +13794,11 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
13861 | else | 13794 | else |
13862 | tp->tg3_flags &= ~TG3_FLAG_POLL_SERDES; | 13795 | tp->tg3_flags &= ~TG3_FLAG_POLL_SERDES; |
13863 | 13796 | ||
13864 | tp->rx_offset = NET_IP_ALIGN + TG3_RX_HEADROOM; | 13797 | tp->rx_offset = NET_IP_ALIGN; |
13865 | tp->rx_copy_thresh = TG3_RX_COPY_THRESHOLD; | 13798 | tp->rx_copy_thresh = TG3_RX_COPY_THRESHOLD; |
13866 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 && | 13799 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 && |
13867 | (tp->tg3_flags & TG3_FLAG_PCIX_MODE) != 0) { | 13800 | (tp->tg3_flags & TG3_FLAG_PCIX_MODE) != 0) { |
13868 | tp->rx_offset -= NET_IP_ALIGN; | 13801 | tp->rx_offset = 0; |
13869 | #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS | 13802 | #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS |
13870 | tp->rx_copy_thresh = ~(u16)0; | 13803 | tp->rx_copy_thresh = ~(u16)0; |
13871 | #endif | 13804 | #endif |
@@ -14629,9 +14562,6 @@ static const struct net_device_ops tg3_netdev_ops = { | |||
14629 | .ndo_do_ioctl = tg3_ioctl, | 14562 | .ndo_do_ioctl = tg3_ioctl, |
14630 | .ndo_tx_timeout = tg3_tx_timeout, | 14563 | .ndo_tx_timeout = tg3_tx_timeout, |
14631 | .ndo_change_mtu = tg3_change_mtu, | 14564 | .ndo_change_mtu = tg3_change_mtu, |
14632 | #if TG3_VLAN_TAG_USED | ||
14633 | .ndo_vlan_rx_register = tg3_vlan_rx_register, | ||
14634 | #endif | ||
14635 | #ifdef CONFIG_NET_POLL_CONTROLLER | 14565 | #ifdef CONFIG_NET_POLL_CONTROLLER |
14636 | .ndo_poll_controller = tg3_poll_controller, | 14566 | .ndo_poll_controller = tg3_poll_controller, |
14637 | #endif | 14567 | #endif |
@@ -14648,9 +14578,6 @@ static const struct net_device_ops tg3_netdev_ops_dma_bug = { | |||
14648 | .ndo_do_ioctl = tg3_ioctl, | 14578 | .ndo_do_ioctl = tg3_ioctl, |
14649 | .ndo_tx_timeout = tg3_tx_timeout, | 14579 | .ndo_tx_timeout = tg3_tx_timeout, |
14650 | .ndo_change_mtu = tg3_change_mtu, | 14580 | .ndo_change_mtu = tg3_change_mtu, |
14651 | #if TG3_VLAN_TAG_USED | ||
14652 | .ndo_vlan_rx_register = tg3_vlan_rx_register, | ||
14653 | #endif | ||
14654 | #ifdef CONFIG_NET_POLL_CONTROLLER | 14581 | #ifdef CONFIG_NET_POLL_CONTROLLER |
14655 | .ndo_poll_controller = tg3_poll_controller, | 14582 | .ndo_poll_controller = tg3_poll_controller, |
14656 | #endif | 14583 | #endif |
@@ -14700,9 +14627,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
14700 | 14627 | ||
14701 | SET_NETDEV_DEV(dev, &pdev->dev); | 14628 | SET_NETDEV_DEV(dev, &pdev->dev); |
14702 | 14629 | ||
14703 | #if TG3_VLAN_TAG_USED | ||
14704 | dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; | 14630 | dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; |
14705 | #endif | ||
14706 | 14631 | ||
14707 | tp = netdev_priv(dev); | 14632 | tp = netdev_priv(dev); |
14708 | tp->pdev = pdev; | 14633 | tp->pdev = pdev; |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index d62c8d937c8..f528243e1a4 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -2808,9 +2808,6 @@ struct tg3 { | |||
2808 | u32 rx_std_max_post; | 2808 | u32 rx_std_max_post; |
2809 | u32 rx_offset; | 2809 | u32 rx_offset; |
2810 | u32 rx_pkt_map_sz; | 2810 | u32 rx_pkt_map_sz; |
2811 | #if TG3_VLAN_TAG_USED | ||
2812 | struct vlan_group *vlgrp; | ||
2813 | #endif | ||
2814 | 2811 | ||
2815 | 2812 | ||
2816 | /* begin "everything else" cacheline(s) section */ | 2813 | /* begin "everything else" cacheline(s) section */ |
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c index 5e98643a4a2..7dc84971f26 100644 --- a/drivers/net/usb/kaweth.c +++ b/drivers/net/usb/kaweth.c | |||
@@ -406,6 +406,7 @@ static int kaweth_download_firmware(struct kaweth_device *kaweth, | |||
406 | 406 | ||
407 | if (fw->size > KAWETH_FIRMWARE_BUF_SIZE) { | 407 | if (fw->size > KAWETH_FIRMWARE_BUF_SIZE) { |
408 | err("Firmware too big: %zu", fw->size); | 408 | err("Firmware too big: %zu", fw->size); |
409 | release_firmware(fw); | ||
409 | return -ENOSPC; | 410 | return -ENOSPC; |
410 | } | 411 | } |
411 | data_len = fw->size; | 412 | data_len = fw->size; |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 1afb8bb8575..9f01e50d5cd 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -369,6 +369,9 @@ static void ath9k_hw_init_config(struct ath_hw *ah) | |||
369 | else | 369 | else |
370 | ah->config.ht_enable = 0; | 370 | ah->config.ht_enable = 0; |
371 | 371 | ||
372 | /* PAPRD needs some more work to be enabled */ | ||
373 | ah->config.paprd_disable = 1; | ||
374 | |||
372 | ah->config.rx_intr_mitigation = true; | 375 | ah->config.rx_intr_mitigation = true; |
373 | ah->config.pcieSerDesWrite = true; | 376 | ah->config.pcieSerDesWrite = true; |
374 | 377 | ||
@@ -1933,7 +1936,8 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
1933 | pCap->rx_status_len = sizeof(struct ar9003_rxs); | 1936 | pCap->rx_status_len = sizeof(struct ar9003_rxs); |
1934 | pCap->tx_desc_len = sizeof(struct ar9003_txc); | 1937 | pCap->tx_desc_len = sizeof(struct ar9003_txc); |
1935 | pCap->txs_len = sizeof(struct ar9003_txs); | 1938 | pCap->txs_len = sizeof(struct ar9003_txs); |
1936 | if (ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) | 1939 | if (!ah->config.paprd_disable && |
1940 | ah->eep_ops->get_eeprom(ah, EEP_PAPRD)) | ||
1937 | pCap->hw_caps |= ATH9K_HW_CAP_PAPRD; | 1941 | pCap->hw_caps |= ATH9K_HW_CAP_PAPRD; |
1938 | } else { | 1942 | } else { |
1939 | pCap->tx_desc_len = sizeof(struct ath_desc); | 1943 | pCap->tx_desc_len = sizeof(struct ath_desc); |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 5a3dfec45e9..ea9fde67064 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -225,6 +225,7 @@ struct ath9k_ops_config { | |||
225 | u32 pcie_waen; | 225 | u32 pcie_waen; |
226 | u8 analog_shiftreg; | 226 | u8 analog_shiftreg; |
227 | u8 ht_enable; | 227 | u8 ht_enable; |
228 | u8 paprd_disable; | ||
228 | u32 ofdm_trig_low; | 229 | u32 ofdm_trig_low; |
229 | u32 ofdm_trig_high; | 230 | u32 ofdm_trig_high; |
230 | u32 cck_trig_high; | 231 | u32 cck_trig_high; |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index f90a6ca94a7..c79c97be6cd 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -592,14 +592,12 @@ void ath9k_tasklet(unsigned long data) | |||
592 | u32 status = sc->intrstatus; | 592 | u32 status = sc->intrstatus; |
593 | u32 rxmask; | 593 | u32 rxmask; |
594 | 594 | ||
595 | ath9k_ps_wakeup(sc); | ||
596 | |||
597 | if (status & ATH9K_INT_FATAL) { | 595 | if (status & ATH9K_INT_FATAL) { |
598 | ath_reset(sc, true); | 596 | ath_reset(sc, true); |
599 | ath9k_ps_restore(sc); | ||
600 | return; | 597 | return; |
601 | } | 598 | } |
602 | 599 | ||
600 | ath9k_ps_wakeup(sc); | ||
603 | spin_lock(&sc->sc_pcu_lock); | 601 | spin_lock(&sc->sc_pcu_lock); |
604 | 602 | ||
605 | if (!ath9k_hw_check_alive(ah)) | 603 | if (!ath9k_hw_check_alive(ah)) |
@@ -969,6 +967,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) | |||
969 | /* Stop ANI */ | 967 | /* Stop ANI */ |
970 | del_timer_sync(&common->ani.timer); | 968 | del_timer_sync(&common->ani.timer); |
971 | 969 | ||
970 | ath9k_ps_wakeup(sc); | ||
972 | spin_lock_bh(&sc->sc_pcu_lock); | 971 | spin_lock_bh(&sc->sc_pcu_lock); |
973 | 972 | ||
974 | ieee80211_stop_queues(hw); | 973 | ieee80211_stop_queues(hw); |
@@ -1015,6 +1014,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) | |||
1015 | 1014 | ||
1016 | /* Start ANI */ | 1015 | /* Start ANI */ |
1017 | ath_start_ani(common); | 1016 | ath_start_ani(common); |
1017 | ath9k_ps_restore(sc); | ||
1018 | 1018 | ||
1019 | return r; | 1019 | return r; |
1020 | } | 1020 | } |
@@ -1701,7 +1701,9 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
1701 | skip_chan_change: | 1701 | skip_chan_change: |
1702 | if (changed & IEEE80211_CONF_CHANGE_POWER) { | 1702 | if (changed & IEEE80211_CONF_CHANGE_POWER) { |
1703 | sc->config.txpowlimit = 2 * conf->power_level; | 1703 | sc->config.txpowlimit = 2 * conf->power_level; |
1704 | ath9k_ps_wakeup(sc); | ||
1704 | ath_update_txpow(sc); | 1705 | ath_update_txpow(sc); |
1706 | ath9k_ps_restore(sc); | ||
1705 | } | 1707 | } |
1706 | 1708 | ||
1707 | spin_lock_bh(&sc->wiphy_lock); | 1709 | spin_lock_bh(&sc->wiphy_lock); |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 332d1feb5c1..33a37edbaf7 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -2113,9 +2113,7 @@ static void ath_tx_complete_poll_work(struct work_struct *work) | |||
2113 | if (needreset) { | 2113 | if (needreset) { |
2114 | ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_RESET, | 2114 | ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_RESET, |
2115 | "tx hung, resetting the chip\n"); | 2115 | "tx hung, resetting the chip\n"); |
2116 | ath9k_ps_wakeup(sc); | ||
2117 | ath_reset(sc, true); | 2116 | ath_reset(sc, true); |
2118 | ath9k_ps_restore(sc); | ||
2119 | } | 2117 | } |
2120 | 2118 | ||
2121 | ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, | 2119 | ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 3f1e5f1bf84..91a9f525346 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -2624,6 +2624,7 @@ struct iwl_cfg iwl4965_agn_cfg = { | |||
2624 | .fw_name_pre = IWL4965_FW_PRE, | 2624 | .fw_name_pre = IWL4965_FW_PRE, |
2625 | .ucode_api_max = IWL4965_UCODE_API_MAX, | 2625 | .ucode_api_max = IWL4965_UCODE_API_MAX, |
2626 | .ucode_api_min = IWL4965_UCODE_API_MIN, | 2626 | .ucode_api_min = IWL4965_UCODE_API_MIN, |
2627 | .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, | ||
2627 | .valid_tx_ant = ANT_AB, | 2628 | .valid_tx_ant = ANT_AB, |
2628 | .valid_rx_ant = ANT_ABC, | 2629 | .valid_rx_ant = ANT_ABC, |
2629 | .eeprom_ver = EEPROM_4965_EEPROM_VERSION, | 2630 | .eeprom_ver = EEPROM_4965_EEPROM_VERSION, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c index 14ceb4df72f..27b5a3eec9d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c | |||
@@ -152,11 +152,14 @@ int iwl_eeprom_check_sku(struct iwl_priv *priv) | |||
152 | 152 | ||
153 | eeprom_sku = iwl_eeprom_query16(priv, EEPROM_SKU_CAP); | 153 | eeprom_sku = iwl_eeprom_query16(priv, EEPROM_SKU_CAP); |
154 | 154 | ||
155 | priv->cfg->sku = ((eeprom_sku & EEPROM_SKU_CAP_BAND_SELECTION) >> | 155 | if (!priv->cfg->sku) { |
156 | /* not using sku overwrite */ | ||
157 | priv->cfg->sku = | ||
158 | ((eeprom_sku & EEPROM_SKU_CAP_BAND_SELECTION) >> | ||
156 | EEPROM_SKU_CAP_BAND_POS); | 159 | EEPROM_SKU_CAP_BAND_POS); |
157 | if (eeprom_sku & EEPROM_SKU_CAP_11N_ENABLE) | 160 | if (eeprom_sku & EEPROM_SKU_CAP_11N_ENABLE) |
158 | priv->cfg->sku |= IWL_SKU_N; | 161 | priv->cfg->sku |= IWL_SKU_N; |
159 | 162 | } | |
160 | if (!priv->cfg->sku) { | 163 | if (!priv->cfg->sku) { |
161 | IWL_ERR(priv, "Invalid device sku\n"); | 164 | IWL_ERR(priv, "Invalid device sku\n"); |
162 | return -EINVAL; | 165 | return -EINVAL; |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 0b4e8590cbb..029be3c6c03 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -2446,6 +2446,7 @@ static struct usb_device_id rt73usb_device_table[] = { | |||
2446 | { USB_DEVICE(0x04bb, 0x093d), USB_DEVICE_DATA(&rt73usb_ops) }, | 2446 | { USB_DEVICE(0x04bb, 0x093d), USB_DEVICE_DATA(&rt73usb_ops) }, |
2447 | { USB_DEVICE(0x148f, 0x2573), USB_DEVICE_DATA(&rt73usb_ops) }, | 2447 | { USB_DEVICE(0x148f, 0x2573), USB_DEVICE_DATA(&rt73usb_ops) }, |
2448 | { USB_DEVICE(0x148f, 0x2671), USB_DEVICE_DATA(&rt73usb_ops) }, | 2448 | { USB_DEVICE(0x148f, 0x2671), USB_DEVICE_DATA(&rt73usb_ops) }, |
2449 | { USB_DEVICE(0x0812, 0x3101), USB_DEVICE_DATA(&rt73usb_ops) }, | ||
2449 | /* Qcom */ | 2450 | /* Qcom */ |
2450 | { USB_DEVICE(0x18e8, 0x6196), USB_DEVICE_DATA(&rt73usb_ops) }, | 2451 | { USB_DEVICE(0x18e8, 0x6196), USB_DEVICE_DATA(&rt73usb_ops) }, |
2451 | { USB_DEVICE(0x18e8, 0x6229), USB_DEVICE_DATA(&rt73usb_ops) }, | 2452 | { USB_DEVICE(0x18e8, 0x6229), USB_DEVICE_DATA(&rt73usb_ops) }, |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 0fa36aa6701..1758d446324 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -619,6 +619,13 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) | |||
619 | struct sk_buff *uskb = NULL; | 619 | struct sk_buff *uskb = NULL; |
620 | u8 *pdata; | 620 | u8 *pdata; |
621 | uskb = dev_alloc_skb(skb->len + 128); | 621 | uskb = dev_alloc_skb(skb->len + 128); |
622 | if (!uskb) { | ||
623 | RT_TRACE(rtlpriv, | ||
624 | (COMP_INTR | COMP_RECV), | ||
625 | DBG_EMERG, | ||
626 | ("can't alloc rx skb\n")); | ||
627 | goto done; | ||
628 | } | ||
622 | memcpy(IEEE80211_SKB_RXCB(uskb), | 629 | memcpy(IEEE80211_SKB_RXCB(uskb), |
623 | &rx_status, | 630 | &rx_status, |
624 | sizeof(rx_status)); | 631 | sizeof(rx_status)); |
@@ -641,7 +648,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) | |||
641 | new_skb = dev_alloc_skb(rtlpci->rxbuffersize); | 648 | new_skb = dev_alloc_skb(rtlpci->rxbuffersize); |
642 | if (unlikely(!new_skb)) { | 649 | if (unlikely(!new_skb)) { |
643 | RT_TRACE(rtlpriv, (COMP_INTR | COMP_RECV), | 650 | RT_TRACE(rtlpriv, (COMP_INTR | COMP_RECV), |
644 | DBG_DMESG, | 651 | DBG_EMERG, |
645 | ("can't alloc skb for rx\n")); | 652 | ("can't alloc skb for rx\n")); |
646 | goto done; | 653 | goto done; |
647 | } | 654 | } |
@@ -1066,9 +1073,9 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw) | |||
1066 | struct sk_buff *skb = | 1073 | struct sk_buff *skb = |
1067 | dev_alloc_skb(rtlpci->rxbuffersize); | 1074 | dev_alloc_skb(rtlpci->rxbuffersize); |
1068 | u32 bufferaddress; | 1075 | u32 bufferaddress; |
1069 | entry = &rtlpci->rx_ring[rx_queue_idx].desc[i]; | ||
1070 | if (!skb) | 1076 | if (!skb) |
1071 | return 0; | 1077 | return 0; |
1078 | entry = &rtlpci->rx_ring[rx_queue_idx].desc[i]; | ||
1072 | 1079 | ||
1073 | /*skb->dev = dev; */ | 1080 | /*skb->dev = dev; */ |
1074 | 1081 | ||
diff --git a/drivers/parport/share.c b/drivers/parport/share.c index a2d9d1e5926..a848e02e6be 100644 --- a/drivers/parport/share.c +++ b/drivers/parport/share.c | |||
@@ -678,7 +678,7 @@ void parport_unregister_device(struct pardevice *dev) | |||
678 | 678 | ||
679 | /* Make sure we haven't left any pointers around in the wait | 679 | /* Make sure we haven't left any pointers around in the wait |
680 | * list. */ | 680 | * list. */ |
681 | spin_lock (&port->waitlist_lock); | 681 | spin_lock_irq(&port->waitlist_lock); |
682 | if (dev->waitprev || dev->waitnext || port->waithead == dev) { | 682 | if (dev->waitprev || dev->waitnext || port->waithead == dev) { |
683 | if (dev->waitprev) | 683 | if (dev->waitprev) |
684 | dev->waitprev->waitnext = dev->waitnext; | 684 | dev->waitprev->waitnext = dev->waitnext; |
@@ -689,7 +689,7 @@ void parport_unregister_device(struct pardevice *dev) | |||
689 | else | 689 | else |
690 | port->waittail = dev->waitprev; | 690 | port->waittail = dev->waitprev; |
691 | } | 691 | } |
692 | spin_unlock (&port->waitlist_lock); | 692 | spin_unlock_irq(&port->waitlist_lock); |
693 | 693 | ||
694 | kfree(dev->state); | 694 | kfree(dev->state); |
695 | kfree(dev); | 695 | kfree(dev); |
diff --git a/drivers/pps/clients/pps-ktimer.c b/drivers/pps/clients/pps-ktimer.c index 2728469d388..82583b0ff82 100644 --- a/drivers/pps/clients/pps-ktimer.c +++ b/drivers/pps/clients/pps-ktimer.c | |||
@@ -46,8 +46,6 @@ static void pps_ktimer_event(unsigned long ptr) | |||
46 | /* First of all we get the time stamp... */ | 46 | /* First of all we get the time stamp... */ |
47 | pps_get_ts(&ts); | 47 | pps_get_ts(&ts); |
48 | 48 | ||
49 | dev_info(pps->dev, "PPS event at %lu\n", jiffies); | ||
50 | |||
51 | pps_event(pps, &ts, PPS_CAPTUREASSERT, NULL); | 49 | pps_event(pps, &ts, PPS_CAPTUREASSERT, NULL); |
52 | 50 | ||
53 | mod_timer(&ktimer, jiffies + HZ); | 51 | mod_timer(&ktimer, jiffies + HZ); |
diff --git a/drivers/pps/clients/pps_parport.c b/drivers/pps/clients/pps_parport.c index 32221efd9ca..c571d6dd8f6 100644 --- a/drivers/pps/clients/pps_parport.c +++ b/drivers/pps/clients/pps_parport.c | |||
@@ -163,7 +163,7 @@ static void parport_attach(struct parport *port) | |||
163 | } | 163 | } |
164 | 164 | ||
165 | device->pardev = parport_register_device(port, KBUILD_MODNAME, | 165 | device->pardev = parport_register_device(port, KBUILD_MODNAME, |
166 | NULL, NULL, parport_irq, 0, device); | 166 | NULL, NULL, parport_irq, PARPORT_FLAG_EXCL, device); |
167 | if (!device->pardev) { | 167 | if (!device->pardev) { |
168 | pr_err("couldn't register with %s\n", port->name); | 168 | pr_err("couldn't register with %s\n", port->name); |
169 | goto err_free; | 169 | goto err_free; |
diff --git a/drivers/pps/generators/pps_gen_parport.c b/drivers/pps/generators/pps_gen_parport.c index 5c32f8dacf5..b93af3ebb5b 100644 --- a/drivers/pps/generators/pps_gen_parport.c +++ b/drivers/pps/generators/pps_gen_parport.c | |||
@@ -198,7 +198,7 @@ static void parport_attach(struct parport *port) | |||
198 | } | 198 | } |
199 | 199 | ||
200 | device.pardev = parport_register_device(port, KBUILD_MODNAME, | 200 | device.pardev = parport_register_device(port, KBUILD_MODNAME, |
201 | NULL, NULL, NULL, 0, &device); | 201 | NULL, NULL, NULL, PARPORT_FLAG_EXCL, &device); |
202 | if (!device.pardev) { | 202 | if (!device.pardev) { |
203 | pr_err("couldn't register with %s\n", port->name); | 203 | pr_err("couldn't register with %s\n", port->name); |
204 | return; | 204 | return; |
diff --git a/drivers/staging/msm/msm_fb.c b/drivers/staging/msm/msm_fb.c index 23fa049b51f..a2f29d46405 100644 --- a/drivers/staging/msm/msm_fb.c +++ b/drivers/staging/msm/msm_fb.c | |||
@@ -347,7 +347,7 @@ static int msm_fb_suspend(struct platform_device *pdev, pm_message_t state) | |||
347 | if ((!mfd) || (mfd->key != MFD_KEY)) | 347 | if ((!mfd) || (mfd->key != MFD_KEY)) |
348 | return 0; | 348 | return 0; |
349 | 349 | ||
350 | acquire_console_sem(); | 350 | console_lock(); |
351 | fb_set_suspend(mfd->fbi, 1); | 351 | fb_set_suspend(mfd->fbi, 1); |
352 | 352 | ||
353 | ret = msm_fb_suspend_sub(mfd); | 353 | ret = msm_fb_suspend_sub(mfd); |
@@ -358,7 +358,7 @@ static int msm_fb_suspend(struct platform_device *pdev, pm_message_t state) | |||
358 | pdev->dev.power.power_state = state; | 358 | pdev->dev.power.power_state = state; |
359 | } | 359 | } |
360 | 360 | ||
361 | release_console_sem(); | 361 | console_unlock(); |
362 | return ret; | 362 | return ret; |
363 | } | 363 | } |
364 | #else | 364 | #else |
@@ -431,11 +431,11 @@ static int msm_fb_resume(struct platform_device *pdev) | |||
431 | if ((!mfd) || (mfd->key != MFD_KEY)) | 431 | if ((!mfd) || (mfd->key != MFD_KEY)) |
432 | return 0; | 432 | return 0; |
433 | 433 | ||
434 | acquire_console_sem(); | 434 | console_lock(); |
435 | ret = msm_fb_resume_sub(mfd); | 435 | ret = msm_fb_resume_sub(mfd); |
436 | pdev->dev.power.power_state = PMSG_ON; | 436 | pdev->dev.power.power_state = PMSG_ON; |
437 | fb_set_suspend(mfd->fbi, 1); | 437 | fb_set_suspend(mfd->fbi, 1); |
438 | release_console_sem(); | 438 | console_unlock(); |
439 | 439 | ||
440 | return ret; | 440 | return ret; |
441 | } | 441 | } |
diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c index 9f26dc9408b..56a283d1a74 100644 --- a/drivers/staging/olpc_dcon/olpc_dcon.c +++ b/drivers/staging/olpc_dcon/olpc_dcon.c | |||
@@ -373,17 +373,17 @@ static void dcon_source_switch(struct work_struct *work) | |||
373 | * | 373 | * |
374 | * For now, we just hope.. | 374 | * For now, we just hope.. |
375 | */ | 375 | */ |
376 | acquire_console_sem(); | 376 | console_lock(); |
377 | ignore_fb_events = 1; | 377 | ignore_fb_events = 1; |
378 | if (fb_blank(fbinfo, FB_BLANK_UNBLANK)) { | 378 | if (fb_blank(fbinfo, FB_BLANK_UNBLANK)) { |
379 | ignore_fb_events = 0; | 379 | ignore_fb_events = 0; |
380 | release_console_sem(); | 380 | console_unlock(); |
381 | printk(KERN_ERR "olpc-dcon: Failed to enter CPU mode\n"); | 381 | printk(KERN_ERR "olpc-dcon: Failed to enter CPU mode\n"); |
382 | dcon_pending = DCON_SOURCE_DCON; | 382 | dcon_pending = DCON_SOURCE_DCON; |
383 | return; | 383 | return; |
384 | } | 384 | } |
385 | ignore_fb_events = 0; | 385 | ignore_fb_events = 0; |
386 | release_console_sem(); | 386 | console_unlock(); |
387 | 387 | ||
388 | /* And turn off the DCON */ | 388 | /* And turn off the DCON */ |
389 | pdata->set_dconload(1); | 389 | pdata->set_dconload(1); |
@@ -435,12 +435,12 @@ static void dcon_source_switch(struct work_struct *work) | |||
435 | } | 435 | } |
436 | } | 436 | } |
437 | 437 | ||
438 | acquire_console_sem(); | 438 | console_lock(); |
439 | ignore_fb_events = 1; | 439 | ignore_fb_events = 1; |
440 | if (fb_blank(fbinfo, FB_BLANK_POWERDOWN)) | 440 | if (fb_blank(fbinfo, FB_BLANK_POWERDOWN)) |
441 | printk(KERN_ERR "olpc-dcon: couldn't blank fb!\n"); | 441 | printk(KERN_ERR "olpc-dcon: couldn't blank fb!\n"); |
442 | ignore_fb_events = 0; | 442 | ignore_fb_events = 0; |
443 | release_console_sem(); | 443 | console_unlock(); |
444 | 444 | ||
445 | printk(KERN_INFO "olpc-dcon: The DCON has control\n"); | 445 | printk(KERN_INFO "olpc-dcon: The DCON has control\n"); |
446 | break; | 446 | break; |
diff --git a/drivers/staging/sm7xx/smtcfb.c b/drivers/staging/sm7xx/smtcfb.c index 0bc113c44d3..d007e4a12c1 100644 --- a/drivers/staging/sm7xx/smtcfb.c +++ b/drivers/staging/sm7xx/smtcfb.c | |||
@@ -1044,9 +1044,9 @@ static int __maybe_unused smtcfb_suspend(struct pci_dev *pdev, pm_message_t msg) | |||
1044 | 1044 | ||
1045 | /* when doing suspend, call fb apis and pci apis */ | 1045 | /* when doing suspend, call fb apis and pci apis */ |
1046 | if (msg.event == PM_EVENT_SUSPEND) { | 1046 | if (msg.event == PM_EVENT_SUSPEND) { |
1047 | acquire_console_sem(); | 1047 | console_lock(); |
1048 | fb_set_suspend(&sfb->fb, 1); | 1048 | fb_set_suspend(&sfb->fb, 1); |
1049 | release_console_sem(); | 1049 | console_unlock(); |
1050 | retv = pci_save_state(pdev); | 1050 | retv = pci_save_state(pdev); |
1051 | pci_disable_device(pdev); | 1051 | pci_disable_device(pdev); |
1052 | retv = pci_choose_state(pdev, msg); | 1052 | retv = pci_choose_state(pdev, msg); |
@@ -1105,9 +1105,9 @@ static int __maybe_unused smtcfb_resume(struct pci_dev *pdev) | |||
1105 | 1105 | ||
1106 | smtcfb_setmode(sfb); | 1106 | smtcfb_setmode(sfb); |
1107 | 1107 | ||
1108 | acquire_console_sem(); | 1108 | console_lock(); |
1109 | fb_set_suspend(&sfb->fb, 0); | 1109 | fb_set_suspend(&sfb->fb, 0); |
1110 | release_console_sem(); | 1110 | console_unlock(); |
1111 | 1111 | ||
1112 | return 0; | 1112 | return 0; |
1113 | } | 1113 | } |
diff --git a/drivers/tty/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-duart.c index a2f2b325449..602d9845c52 100644 --- a/drivers/tty/serial/sb1250-duart.c +++ b/drivers/tty/serial/sb1250-duart.c | |||
@@ -829,7 +829,7 @@ static void __init sbd_probe_duarts(void) | |||
829 | #ifdef CONFIG_SERIAL_SB1250_DUART_CONSOLE | 829 | #ifdef CONFIG_SERIAL_SB1250_DUART_CONSOLE |
830 | /* | 830 | /* |
831 | * Serial console stuff. Very basic, polling driver for doing serial | 831 | * Serial console stuff. Very basic, polling driver for doing serial |
832 | * console output. The console_sem is held by the caller, so we | 832 | * console output. The console_lock is held by the caller, so we |
833 | * shouldn't be interrupted for more console activity. | 833 | * shouldn't be interrupted for more console activity. |
834 | */ | 834 | */ |
835 | static void sbd_console_putchar(struct uart_port *uport, int ch) | 835 | static void sbd_console_putchar(struct uart_port *uport, int ch) |
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c index c556ed9db13..8e0dd254eb1 100644 --- a/drivers/tty/sysrq.c +++ b/drivers/tty/sysrq.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include <asm/irq_regs.h> | 46 | #include <asm/irq_regs.h> |
47 | 47 | ||
48 | /* Whether we react on sysrq keys or just ignore them */ | 48 | /* Whether we react on sysrq keys or just ignore them */ |
49 | static int __read_mostly sysrq_enabled = 1; | 49 | static int __read_mostly sysrq_enabled = SYSRQ_DEFAULT_ENABLE; |
50 | static bool __read_mostly sysrq_always_enabled; | 50 | static bool __read_mostly sysrq_always_enabled; |
51 | 51 | ||
52 | static bool sysrq_on(void) | 52 | static bool sysrq_on(void) |
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 464d09d9787..6158eae0f64 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -3256,7 +3256,7 @@ static ssize_t show_cons_active(struct device *dev, | |||
3256 | struct console *c; | 3256 | struct console *c; |
3257 | ssize_t count = 0; | 3257 | ssize_t count = 0; |
3258 | 3258 | ||
3259 | acquire_console_sem(); | 3259 | console_lock(); |
3260 | for (c = console_drivers; c; c = c->next) { | 3260 | for (c = console_drivers; c; c = c->next) { |
3261 | if (!c->device) | 3261 | if (!c->device) |
3262 | continue; | 3262 | continue; |
@@ -3271,7 +3271,7 @@ static ssize_t show_cons_active(struct device *dev, | |||
3271 | while (i--) | 3271 | while (i--) |
3272 | count += sprintf(buf + count, "%s%d%c", | 3272 | count += sprintf(buf + count, "%s%d%c", |
3273 | cs[i]->name, cs[i]->index, i ? ' ':'\n'); | 3273 | cs[i]->name, cs[i]->index, i ? ' ':'\n'); |
3274 | release_console_sem(); | 3274 | console_unlock(); |
3275 | 3275 | ||
3276 | return count; | 3276 | return count; |
3277 | } | 3277 | } |
diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c index ebae344ce91..c956ed6c83a 100644 --- a/drivers/tty/vt/selection.c +++ b/drivers/tty/vt/selection.c | |||
@@ -316,9 +316,9 @@ int paste_selection(struct tty_struct *tty) | |||
316 | /* always called with BTM from vt_ioctl */ | 316 | /* always called with BTM from vt_ioctl */ |
317 | WARN_ON(!tty_locked()); | 317 | WARN_ON(!tty_locked()); |
318 | 318 | ||
319 | acquire_console_sem(); | 319 | console_lock(); |
320 | poke_blanked_console(); | 320 | poke_blanked_console(); |
321 | release_console_sem(); | 321 | console_unlock(); |
322 | 322 | ||
323 | ld = tty_ldisc_ref(tty); | 323 | ld = tty_ldisc_ref(tty); |
324 | if (!ld) { | 324 | if (!ld) { |
diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c index eab3a1ff99e..a672ed192d3 100644 --- a/drivers/tty/vt/vc_screen.c +++ b/drivers/tty/vt/vc_screen.c | |||
@@ -202,7 +202,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
202 | /* Select the proper current console and verify | 202 | /* Select the proper current console and verify |
203 | * sanity of the situation under the console lock. | 203 | * sanity of the situation under the console lock. |
204 | */ | 204 | */ |
205 | acquire_console_sem(); | 205 | console_lock(); |
206 | 206 | ||
207 | attr = (currcons & 128); | 207 | attr = (currcons & 128); |
208 | currcons = (currcons & 127); | 208 | currcons = (currcons & 127); |
@@ -336,9 +336,9 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
336 | * the pagefault handling code may want to call printk(). | 336 | * the pagefault handling code may want to call printk(). |
337 | */ | 337 | */ |
338 | 338 | ||
339 | release_console_sem(); | 339 | console_unlock(); |
340 | ret = copy_to_user(buf, con_buf_start, orig_count); | 340 | ret = copy_to_user(buf, con_buf_start, orig_count); |
341 | acquire_console_sem(); | 341 | console_lock(); |
342 | 342 | ||
343 | if (ret) { | 343 | if (ret) { |
344 | read += (orig_count - ret); | 344 | read += (orig_count - ret); |
@@ -354,7 +354,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
354 | if (read) | 354 | if (read) |
355 | ret = read; | 355 | ret = read; |
356 | unlock_out: | 356 | unlock_out: |
357 | release_console_sem(); | 357 | console_unlock(); |
358 | mutex_unlock(&con_buf_mtx); | 358 | mutex_unlock(&con_buf_mtx); |
359 | return ret; | 359 | return ret; |
360 | } | 360 | } |
@@ -379,7 +379,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | |||
379 | /* Select the proper current console and verify | 379 | /* Select the proper current console and verify |
380 | * sanity of the situation under the console lock. | 380 | * sanity of the situation under the console lock. |
381 | */ | 381 | */ |
382 | acquire_console_sem(); | 382 | console_lock(); |
383 | 383 | ||
384 | attr = (currcons & 128); | 384 | attr = (currcons & 128); |
385 | currcons = (currcons & 127); | 385 | currcons = (currcons & 127); |
@@ -414,9 +414,9 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | |||
414 | /* Temporarily drop the console lock so that we can read | 414 | /* Temporarily drop the console lock so that we can read |
415 | * in the write data from userspace safely. | 415 | * in the write data from userspace safely. |
416 | */ | 416 | */ |
417 | release_console_sem(); | 417 | console_unlock(); |
418 | ret = copy_from_user(con_buf, buf, this_round); | 418 | ret = copy_from_user(con_buf, buf, this_round); |
419 | acquire_console_sem(); | 419 | console_lock(); |
420 | 420 | ||
421 | if (ret) { | 421 | if (ret) { |
422 | this_round -= ret; | 422 | this_round -= ret; |
@@ -542,7 +542,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | |||
542 | vcs_scr_updated(vc); | 542 | vcs_scr_updated(vc); |
543 | 543 | ||
544 | unlock_out: | 544 | unlock_out: |
545 | release_console_sem(); | 545 | console_unlock(); |
546 | 546 | ||
547 | mutex_unlock(&con_buf_mtx); | 547 | mutex_unlock(&con_buf_mtx); |
548 | 548 | ||
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 76407eca9ab..b230bd3f056 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c | |||
@@ -1003,9 +1003,9 @@ static int vt_resize(struct tty_struct *tty, struct winsize *ws) | |||
1003 | struct vc_data *vc = tty->driver_data; | 1003 | struct vc_data *vc = tty->driver_data; |
1004 | int ret; | 1004 | int ret; |
1005 | 1005 | ||
1006 | acquire_console_sem(); | 1006 | console_lock(); |
1007 | ret = vc_do_resize(tty, vc, ws->ws_col, ws->ws_row); | 1007 | ret = vc_do_resize(tty, vc, ws->ws_col, ws->ws_row); |
1008 | release_console_sem(); | 1008 | console_unlock(); |
1009 | return ret; | 1009 | return ret; |
1010 | } | 1010 | } |
1011 | 1011 | ||
@@ -1271,7 +1271,7 @@ static void default_attr(struct vc_data *vc) | |||
1271 | vc->vc_color = vc->vc_def_color; | 1271 | vc->vc_color = vc->vc_def_color; |
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | /* console_sem is held */ | 1274 | /* console_lock is held */ |
1275 | static void csi_m(struct vc_data *vc) | 1275 | static void csi_m(struct vc_data *vc) |
1276 | { | 1276 | { |
1277 | int i; | 1277 | int i; |
@@ -1415,7 +1415,7 @@ int mouse_reporting(void) | |||
1415 | return vc_cons[fg_console].d->vc_report_mouse; | 1415 | return vc_cons[fg_console].d->vc_report_mouse; |
1416 | } | 1416 | } |
1417 | 1417 | ||
1418 | /* console_sem is held */ | 1418 | /* console_lock is held */ |
1419 | static void set_mode(struct vc_data *vc, int on_off) | 1419 | static void set_mode(struct vc_data *vc, int on_off) |
1420 | { | 1420 | { |
1421 | int i; | 1421 | int i; |
@@ -1485,7 +1485,7 @@ static void set_mode(struct vc_data *vc, int on_off) | |||
1485 | } | 1485 | } |
1486 | } | 1486 | } |
1487 | 1487 | ||
1488 | /* console_sem is held */ | 1488 | /* console_lock is held */ |
1489 | static void setterm_command(struct vc_data *vc) | 1489 | static void setterm_command(struct vc_data *vc) |
1490 | { | 1490 | { |
1491 | switch(vc->vc_par[0]) { | 1491 | switch(vc->vc_par[0]) { |
@@ -1545,7 +1545,7 @@ static void setterm_command(struct vc_data *vc) | |||
1545 | } | 1545 | } |
1546 | } | 1546 | } |
1547 | 1547 | ||
1548 | /* console_sem is held */ | 1548 | /* console_lock is held */ |
1549 | static void csi_at(struct vc_data *vc, unsigned int nr) | 1549 | static void csi_at(struct vc_data *vc, unsigned int nr) |
1550 | { | 1550 | { |
1551 | if (nr > vc->vc_cols - vc->vc_x) | 1551 | if (nr > vc->vc_cols - vc->vc_x) |
@@ -1555,7 +1555,7 @@ static void csi_at(struct vc_data *vc, unsigned int nr) | |||
1555 | insert_char(vc, nr); | 1555 | insert_char(vc, nr); |
1556 | } | 1556 | } |
1557 | 1557 | ||
1558 | /* console_sem is held */ | 1558 | /* console_lock is held */ |
1559 | static void csi_L(struct vc_data *vc, unsigned int nr) | 1559 | static void csi_L(struct vc_data *vc, unsigned int nr) |
1560 | { | 1560 | { |
1561 | if (nr > vc->vc_rows - vc->vc_y) | 1561 | if (nr > vc->vc_rows - vc->vc_y) |
@@ -1566,7 +1566,7 @@ static void csi_L(struct vc_data *vc, unsigned int nr) | |||
1566 | vc->vc_need_wrap = 0; | 1566 | vc->vc_need_wrap = 0; |
1567 | } | 1567 | } |
1568 | 1568 | ||
1569 | /* console_sem is held */ | 1569 | /* console_lock is held */ |
1570 | static void csi_P(struct vc_data *vc, unsigned int nr) | 1570 | static void csi_P(struct vc_data *vc, unsigned int nr) |
1571 | { | 1571 | { |
1572 | if (nr > vc->vc_cols - vc->vc_x) | 1572 | if (nr > vc->vc_cols - vc->vc_x) |
@@ -1576,7 +1576,7 @@ static void csi_P(struct vc_data *vc, unsigned int nr) | |||
1576 | delete_char(vc, nr); | 1576 | delete_char(vc, nr); |
1577 | } | 1577 | } |
1578 | 1578 | ||
1579 | /* console_sem is held */ | 1579 | /* console_lock is held */ |
1580 | static void csi_M(struct vc_data *vc, unsigned int nr) | 1580 | static void csi_M(struct vc_data *vc, unsigned int nr) |
1581 | { | 1581 | { |
1582 | if (nr > vc->vc_rows - vc->vc_y) | 1582 | if (nr > vc->vc_rows - vc->vc_y) |
@@ -1587,7 +1587,7 @@ static void csi_M(struct vc_data *vc, unsigned int nr) | |||
1587 | vc->vc_need_wrap = 0; | 1587 | vc->vc_need_wrap = 0; |
1588 | } | 1588 | } |
1589 | 1589 | ||
1590 | /* console_sem is held (except via vc_init->reset_terminal */ | 1590 | /* console_lock is held (except via vc_init->reset_terminal */ |
1591 | static void save_cur(struct vc_data *vc) | 1591 | static void save_cur(struct vc_data *vc) |
1592 | { | 1592 | { |
1593 | vc->vc_saved_x = vc->vc_x; | 1593 | vc->vc_saved_x = vc->vc_x; |
@@ -1603,7 +1603,7 @@ static void save_cur(struct vc_data *vc) | |||
1603 | vc->vc_saved_G1 = vc->vc_G1_charset; | 1603 | vc->vc_saved_G1 = vc->vc_G1_charset; |
1604 | } | 1604 | } |
1605 | 1605 | ||
1606 | /* console_sem is held */ | 1606 | /* console_lock is held */ |
1607 | static void restore_cur(struct vc_data *vc) | 1607 | static void restore_cur(struct vc_data *vc) |
1608 | { | 1608 | { |
1609 | gotoxy(vc, vc->vc_saved_x, vc->vc_saved_y); | 1609 | gotoxy(vc, vc->vc_saved_x, vc->vc_saved_y); |
@@ -1625,7 +1625,7 @@ enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey, | |||
1625 | EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd, | 1625 | EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd, |
1626 | ESpalette }; | 1626 | ESpalette }; |
1627 | 1627 | ||
1628 | /* console_sem is held (except via vc_init()) */ | 1628 | /* console_lock is held (except via vc_init()) */ |
1629 | static void reset_terminal(struct vc_data *vc, int do_clear) | 1629 | static void reset_terminal(struct vc_data *vc, int do_clear) |
1630 | { | 1630 | { |
1631 | vc->vc_top = 0; | 1631 | vc->vc_top = 0; |
@@ -1685,7 +1685,7 @@ static void reset_terminal(struct vc_data *vc, int do_clear) | |||
1685 | csi_J(vc, 2); | 1685 | csi_J(vc, 2); |
1686 | } | 1686 | } |
1687 | 1687 | ||
1688 | /* console_sem is held */ | 1688 | /* console_lock is held */ |
1689 | static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) | 1689 | static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) |
1690 | { | 1690 | { |
1691 | /* | 1691 | /* |
@@ -2119,7 +2119,7 @@ static int is_double_width(uint32_t ucs) | |||
2119 | return bisearch(ucs, double_width, ARRAY_SIZE(double_width) - 1); | 2119 | return bisearch(ucs, double_width, ARRAY_SIZE(double_width) - 1); |
2120 | } | 2120 | } |
2121 | 2121 | ||
2122 | /* acquires console_sem */ | 2122 | /* acquires console_lock */ |
2123 | static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int count) | 2123 | static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int count) |
2124 | { | 2124 | { |
2125 | #ifdef VT_BUF_VRAM_ONLY | 2125 | #ifdef VT_BUF_VRAM_ONLY |
@@ -2147,11 +2147,11 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co | |||
2147 | 2147 | ||
2148 | might_sleep(); | 2148 | might_sleep(); |
2149 | 2149 | ||
2150 | acquire_console_sem(); | 2150 | console_lock(); |
2151 | vc = tty->driver_data; | 2151 | vc = tty->driver_data; |
2152 | if (vc == NULL) { | 2152 | if (vc == NULL) { |
2153 | printk(KERN_ERR "vt: argh, driver_data is NULL !\n"); | 2153 | printk(KERN_ERR "vt: argh, driver_data is NULL !\n"); |
2154 | release_console_sem(); | 2154 | console_unlock(); |
2155 | return 0; | 2155 | return 0; |
2156 | } | 2156 | } |
2157 | 2157 | ||
@@ -2159,7 +2159,7 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co | |||
2159 | if (!vc_cons_allocated(currcons)) { | 2159 | if (!vc_cons_allocated(currcons)) { |
2160 | /* could this happen? */ | 2160 | /* could this happen? */ |
2161 | printk_once("con_write: tty %d not allocated\n", currcons+1); | 2161 | printk_once("con_write: tty %d not allocated\n", currcons+1); |
2162 | release_console_sem(); | 2162 | console_unlock(); |
2163 | return 0; | 2163 | return 0; |
2164 | } | 2164 | } |
2165 | 2165 | ||
@@ -2375,7 +2375,7 @@ rescan_last_byte: | |||
2375 | } | 2375 | } |
2376 | FLUSH | 2376 | FLUSH |
2377 | console_conditional_schedule(); | 2377 | console_conditional_schedule(); |
2378 | release_console_sem(); | 2378 | console_unlock(); |
2379 | notify_update(vc); | 2379 | notify_update(vc); |
2380 | return n; | 2380 | return n; |
2381 | #undef FLUSH | 2381 | #undef FLUSH |
@@ -2388,11 +2388,11 @@ rescan_last_byte: | |||
2388 | * us to do the switches asynchronously (needed when we want | 2388 | * us to do the switches asynchronously (needed when we want |
2389 | * to switch due to a keyboard interrupt). Synchronization | 2389 | * to switch due to a keyboard interrupt). Synchronization |
2390 | * with other console code and prevention of re-entrancy is | 2390 | * with other console code and prevention of re-entrancy is |
2391 | * ensured with console_sem. | 2391 | * ensured with console_lock. |
2392 | */ | 2392 | */ |
2393 | static void console_callback(struct work_struct *ignored) | 2393 | static void console_callback(struct work_struct *ignored) |
2394 | { | 2394 | { |
2395 | acquire_console_sem(); | 2395 | console_lock(); |
2396 | 2396 | ||
2397 | if (want_console >= 0) { | 2397 | if (want_console >= 0) { |
2398 | if (want_console != fg_console && | 2398 | if (want_console != fg_console && |
@@ -2422,7 +2422,7 @@ static void console_callback(struct work_struct *ignored) | |||
2422 | } | 2422 | } |
2423 | notify_update(vc_cons[fg_console].d); | 2423 | notify_update(vc_cons[fg_console].d); |
2424 | 2424 | ||
2425 | release_console_sem(); | 2425 | console_unlock(); |
2426 | } | 2426 | } |
2427 | 2427 | ||
2428 | int set_console(int nr) | 2428 | int set_console(int nr) |
@@ -2603,7 +2603,7 @@ static struct console vt_console_driver = { | |||
2603 | */ | 2603 | */ |
2604 | 2604 | ||
2605 | /* | 2605 | /* |
2606 | * Generally a bit racy with respect to console_sem(). | 2606 | * Generally a bit racy with respect to console_lock();. |
2607 | * | 2607 | * |
2608 | * There are some functions which don't need it. | 2608 | * There are some functions which don't need it. |
2609 | * | 2609 | * |
@@ -2629,17 +2629,17 @@ int tioclinux(struct tty_struct *tty, unsigned long arg) | |||
2629 | switch (type) | 2629 | switch (type) |
2630 | { | 2630 | { |
2631 | case TIOCL_SETSEL: | 2631 | case TIOCL_SETSEL: |
2632 | acquire_console_sem(); | 2632 | console_lock(); |
2633 | ret = set_selection((struct tiocl_selection __user *)(p+1), tty); | 2633 | ret = set_selection((struct tiocl_selection __user *)(p+1), tty); |
2634 | release_console_sem(); | 2634 | console_unlock(); |
2635 | break; | 2635 | break; |
2636 | case TIOCL_PASTESEL: | 2636 | case TIOCL_PASTESEL: |
2637 | ret = paste_selection(tty); | 2637 | ret = paste_selection(tty); |
2638 | break; | 2638 | break; |
2639 | case TIOCL_UNBLANKSCREEN: | 2639 | case TIOCL_UNBLANKSCREEN: |
2640 | acquire_console_sem(); | 2640 | console_lock(); |
2641 | unblank_screen(); | 2641 | unblank_screen(); |
2642 | release_console_sem(); | 2642 | console_unlock(); |
2643 | break; | 2643 | break; |
2644 | case TIOCL_SELLOADLUT: | 2644 | case TIOCL_SELLOADLUT: |
2645 | ret = sel_loadlut(p); | 2645 | ret = sel_loadlut(p); |
@@ -2688,10 +2688,10 @@ int tioclinux(struct tty_struct *tty, unsigned long arg) | |||
2688 | } | 2688 | } |
2689 | break; | 2689 | break; |
2690 | case TIOCL_BLANKSCREEN: /* until explicitly unblanked, not only poked */ | 2690 | case TIOCL_BLANKSCREEN: /* until explicitly unblanked, not only poked */ |
2691 | acquire_console_sem(); | 2691 | console_lock(); |
2692 | ignore_poke = 1; | 2692 | ignore_poke = 1; |
2693 | do_blank_screen(0); | 2693 | do_blank_screen(0); |
2694 | release_console_sem(); | 2694 | console_unlock(); |
2695 | break; | 2695 | break; |
2696 | case TIOCL_BLANKEDSCREEN: | 2696 | case TIOCL_BLANKEDSCREEN: |
2697 | ret = console_blanked; | 2697 | ret = console_blanked; |
@@ -2790,11 +2790,11 @@ static void con_flush_chars(struct tty_struct *tty) | |||
2790 | return; | 2790 | return; |
2791 | 2791 | ||
2792 | /* if we race with con_close(), vt may be null */ | 2792 | /* if we race with con_close(), vt may be null */ |
2793 | acquire_console_sem(); | 2793 | console_lock(); |
2794 | vc = tty->driver_data; | 2794 | vc = tty->driver_data; |
2795 | if (vc) | 2795 | if (vc) |
2796 | set_cursor(vc); | 2796 | set_cursor(vc); |
2797 | release_console_sem(); | 2797 | console_unlock(); |
2798 | } | 2798 | } |
2799 | 2799 | ||
2800 | /* | 2800 | /* |
@@ -2805,7 +2805,7 @@ static int con_open(struct tty_struct *tty, struct file *filp) | |||
2805 | unsigned int currcons = tty->index; | 2805 | unsigned int currcons = tty->index; |
2806 | int ret = 0; | 2806 | int ret = 0; |
2807 | 2807 | ||
2808 | acquire_console_sem(); | 2808 | console_lock(); |
2809 | if (tty->driver_data == NULL) { | 2809 | if (tty->driver_data == NULL) { |
2810 | ret = vc_allocate(currcons); | 2810 | ret = vc_allocate(currcons); |
2811 | if (ret == 0) { | 2811 | if (ret == 0) { |
@@ -2813,7 +2813,7 @@ static int con_open(struct tty_struct *tty, struct file *filp) | |||
2813 | 2813 | ||
2814 | /* Still being freed */ | 2814 | /* Still being freed */ |
2815 | if (vc->port.tty) { | 2815 | if (vc->port.tty) { |
2816 | release_console_sem(); | 2816 | console_unlock(); |
2817 | return -ERESTARTSYS; | 2817 | return -ERESTARTSYS; |
2818 | } | 2818 | } |
2819 | tty->driver_data = vc; | 2819 | tty->driver_data = vc; |
@@ -2827,11 +2827,11 @@ static int con_open(struct tty_struct *tty, struct file *filp) | |||
2827 | tty->termios->c_iflag |= IUTF8; | 2827 | tty->termios->c_iflag |= IUTF8; |
2828 | else | 2828 | else |
2829 | tty->termios->c_iflag &= ~IUTF8; | 2829 | tty->termios->c_iflag &= ~IUTF8; |
2830 | release_console_sem(); | 2830 | console_unlock(); |
2831 | return ret; | 2831 | return ret; |
2832 | } | 2832 | } |
2833 | } | 2833 | } |
2834 | release_console_sem(); | 2834 | console_unlock(); |
2835 | return ret; | 2835 | return ret; |
2836 | } | 2836 | } |
2837 | 2837 | ||
@@ -2844,9 +2844,9 @@ static void con_shutdown(struct tty_struct *tty) | |||
2844 | { | 2844 | { |
2845 | struct vc_data *vc = tty->driver_data; | 2845 | struct vc_data *vc = tty->driver_data; |
2846 | BUG_ON(vc == NULL); | 2846 | BUG_ON(vc == NULL); |
2847 | acquire_console_sem(); | 2847 | console_lock(); |
2848 | vc->port.tty = NULL; | 2848 | vc->port.tty = NULL; |
2849 | release_console_sem(); | 2849 | console_unlock(); |
2850 | tty_shutdown(tty); | 2850 | tty_shutdown(tty); |
2851 | } | 2851 | } |
2852 | 2852 | ||
@@ -2893,13 +2893,13 @@ static int __init con_init(void) | |||
2893 | struct vc_data *vc; | 2893 | struct vc_data *vc; |
2894 | unsigned int currcons = 0, i; | 2894 | unsigned int currcons = 0, i; |
2895 | 2895 | ||
2896 | acquire_console_sem(); | 2896 | console_lock(); |
2897 | 2897 | ||
2898 | if (conswitchp) | 2898 | if (conswitchp) |
2899 | display_desc = conswitchp->con_startup(); | 2899 | display_desc = conswitchp->con_startup(); |
2900 | if (!display_desc) { | 2900 | if (!display_desc) { |
2901 | fg_console = 0; | 2901 | fg_console = 0; |
2902 | release_console_sem(); | 2902 | console_unlock(); |
2903 | return 0; | 2903 | return 0; |
2904 | } | 2904 | } |
2905 | 2905 | ||
@@ -2946,7 +2946,7 @@ static int __init con_init(void) | |||
2946 | printable = 1; | 2946 | printable = 1; |
2947 | printk("\n"); | 2947 | printk("\n"); |
2948 | 2948 | ||
2949 | release_console_sem(); | 2949 | console_unlock(); |
2950 | 2950 | ||
2951 | #ifdef CONFIG_VT_CONSOLE | 2951 | #ifdef CONFIG_VT_CONSOLE |
2952 | register_console(&vt_console_driver); | 2952 | register_console(&vt_console_driver); |
@@ -3037,7 +3037,7 @@ static int bind_con_driver(const struct consw *csw, int first, int last, | |||
3037 | if (!try_module_get(owner)) | 3037 | if (!try_module_get(owner)) |
3038 | return -ENODEV; | 3038 | return -ENODEV; |
3039 | 3039 | ||
3040 | acquire_console_sem(); | 3040 | console_lock(); |
3041 | 3041 | ||
3042 | /* check if driver is registered */ | 3042 | /* check if driver is registered */ |
3043 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { | 3043 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { |
@@ -3122,7 +3122,7 @@ static int bind_con_driver(const struct consw *csw, int first, int last, | |||
3122 | 3122 | ||
3123 | retval = 0; | 3123 | retval = 0; |
3124 | err: | 3124 | err: |
3125 | release_console_sem(); | 3125 | console_unlock(); |
3126 | module_put(owner); | 3126 | module_put(owner); |
3127 | return retval; | 3127 | return retval; |
3128 | }; | 3128 | }; |
@@ -3171,7 +3171,7 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt) | |||
3171 | if (!try_module_get(owner)) | 3171 | if (!try_module_get(owner)) |
3172 | return -ENODEV; | 3172 | return -ENODEV; |
3173 | 3173 | ||
3174 | acquire_console_sem(); | 3174 | console_lock(); |
3175 | 3175 | ||
3176 | /* check if driver is registered and if it is unbindable */ | 3176 | /* check if driver is registered and if it is unbindable */ |
3177 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { | 3177 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { |
@@ -3185,7 +3185,7 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt) | |||
3185 | } | 3185 | } |
3186 | 3186 | ||
3187 | if (retval) { | 3187 | if (retval) { |
3188 | release_console_sem(); | 3188 | console_unlock(); |
3189 | goto err; | 3189 | goto err; |
3190 | } | 3190 | } |
3191 | 3191 | ||
@@ -3204,12 +3204,12 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt) | |||
3204 | } | 3204 | } |
3205 | 3205 | ||
3206 | if (retval) { | 3206 | if (retval) { |
3207 | release_console_sem(); | 3207 | console_unlock(); |
3208 | goto err; | 3208 | goto err; |
3209 | } | 3209 | } |
3210 | 3210 | ||
3211 | if (!con_is_bound(csw)) { | 3211 | if (!con_is_bound(csw)) { |
3212 | release_console_sem(); | 3212 | console_unlock(); |
3213 | goto err; | 3213 | goto err; |
3214 | } | 3214 | } |
3215 | 3215 | ||
@@ -3238,7 +3238,7 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt) | |||
3238 | if (!con_is_bound(csw)) | 3238 | if (!con_is_bound(csw)) |
3239 | con_driver->flag &= ~CON_DRIVER_FLAG_INIT; | 3239 | con_driver->flag &= ~CON_DRIVER_FLAG_INIT; |
3240 | 3240 | ||
3241 | release_console_sem(); | 3241 | console_unlock(); |
3242 | /* ignore return value, binding should not fail */ | 3242 | /* ignore return value, binding should not fail */ |
3243 | bind_con_driver(defcsw, first, last, deflt); | 3243 | bind_con_driver(defcsw, first, last, deflt); |
3244 | err: | 3244 | err: |
@@ -3538,7 +3538,7 @@ int register_con_driver(const struct consw *csw, int first, int last) | |||
3538 | if (!try_module_get(owner)) | 3538 | if (!try_module_get(owner)) |
3539 | return -ENODEV; | 3539 | return -ENODEV; |
3540 | 3540 | ||
3541 | acquire_console_sem(); | 3541 | console_lock(); |
3542 | 3542 | ||
3543 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { | 3543 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { |
3544 | con_driver = ®istered_con_driver[i]; | 3544 | con_driver = ®istered_con_driver[i]; |
@@ -3592,7 +3592,7 @@ int register_con_driver(const struct consw *csw, int first, int last) | |||
3592 | } | 3592 | } |
3593 | 3593 | ||
3594 | err: | 3594 | err: |
3595 | release_console_sem(); | 3595 | console_unlock(); |
3596 | module_put(owner); | 3596 | module_put(owner); |
3597 | return retval; | 3597 | return retval; |
3598 | } | 3598 | } |
@@ -3613,7 +3613,7 @@ int unregister_con_driver(const struct consw *csw) | |||
3613 | { | 3613 | { |
3614 | int i, retval = -ENODEV; | 3614 | int i, retval = -ENODEV; |
3615 | 3615 | ||
3616 | acquire_console_sem(); | 3616 | console_lock(); |
3617 | 3617 | ||
3618 | /* cannot unregister a bound driver */ | 3618 | /* cannot unregister a bound driver */ |
3619 | if (con_is_bound(csw)) | 3619 | if (con_is_bound(csw)) |
@@ -3639,7 +3639,7 @@ int unregister_con_driver(const struct consw *csw) | |||
3639 | } | 3639 | } |
3640 | } | 3640 | } |
3641 | err: | 3641 | err: |
3642 | release_console_sem(); | 3642 | console_unlock(); |
3643 | return retval; | 3643 | return retval; |
3644 | } | 3644 | } |
3645 | EXPORT_SYMBOL(unregister_con_driver); | 3645 | EXPORT_SYMBOL(unregister_con_driver); |
@@ -3934,9 +3934,9 @@ int con_set_cmap(unsigned char __user *arg) | |||
3934 | { | 3934 | { |
3935 | int rc; | 3935 | int rc; |
3936 | 3936 | ||
3937 | acquire_console_sem(); | 3937 | console_lock(); |
3938 | rc = set_get_cmap (arg,1); | 3938 | rc = set_get_cmap (arg,1); |
3939 | release_console_sem(); | 3939 | console_unlock(); |
3940 | 3940 | ||
3941 | return rc; | 3941 | return rc; |
3942 | } | 3942 | } |
@@ -3945,9 +3945,9 @@ int con_get_cmap(unsigned char __user *arg) | |||
3945 | { | 3945 | { |
3946 | int rc; | 3946 | int rc; |
3947 | 3947 | ||
3948 | acquire_console_sem(); | 3948 | console_lock(); |
3949 | rc = set_get_cmap (arg,0); | 3949 | rc = set_get_cmap (arg,0); |
3950 | release_console_sem(); | 3950 | console_unlock(); |
3951 | 3951 | ||
3952 | return rc; | 3952 | return rc; |
3953 | } | 3953 | } |
@@ -3994,12 +3994,12 @@ static int con_font_get(struct vc_data *vc, struct console_font_op *op) | |||
3994 | } else | 3994 | } else |
3995 | font.data = NULL; | 3995 | font.data = NULL; |
3996 | 3996 | ||
3997 | acquire_console_sem(); | 3997 | console_lock(); |
3998 | if (vc->vc_sw->con_font_get) | 3998 | if (vc->vc_sw->con_font_get) |
3999 | rc = vc->vc_sw->con_font_get(vc, &font); | 3999 | rc = vc->vc_sw->con_font_get(vc, &font); |
4000 | else | 4000 | else |
4001 | rc = -ENOSYS; | 4001 | rc = -ENOSYS; |
4002 | release_console_sem(); | 4002 | console_unlock(); |
4003 | 4003 | ||
4004 | if (rc) | 4004 | if (rc) |
4005 | goto out; | 4005 | goto out; |
@@ -4076,12 +4076,12 @@ static int con_font_set(struct vc_data *vc, struct console_font_op *op) | |||
4076 | font.data = memdup_user(op->data, size); | 4076 | font.data = memdup_user(op->data, size); |
4077 | if (IS_ERR(font.data)) | 4077 | if (IS_ERR(font.data)) |
4078 | return PTR_ERR(font.data); | 4078 | return PTR_ERR(font.data); |
4079 | acquire_console_sem(); | 4079 | console_lock(); |
4080 | if (vc->vc_sw->con_font_set) | 4080 | if (vc->vc_sw->con_font_set) |
4081 | rc = vc->vc_sw->con_font_set(vc, &font, op->flags); | 4081 | rc = vc->vc_sw->con_font_set(vc, &font, op->flags); |
4082 | else | 4082 | else |
4083 | rc = -ENOSYS; | 4083 | rc = -ENOSYS; |
4084 | release_console_sem(); | 4084 | console_unlock(); |
4085 | kfree(font.data); | 4085 | kfree(font.data); |
4086 | return rc; | 4086 | return rc; |
4087 | } | 4087 | } |
@@ -4103,12 +4103,12 @@ static int con_font_default(struct vc_data *vc, struct console_font_op *op) | |||
4103 | else | 4103 | else |
4104 | name[MAX_FONT_NAME - 1] = 0; | 4104 | name[MAX_FONT_NAME - 1] = 0; |
4105 | 4105 | ||
4106 | acquire_console_sem(); | 4106 | console_lock(); |
4107 | if (vc->vc_sw->con_font_default) | 4107 | if (vc->vc_sw->con_font_default) |
4108 | rc = vc->vc_sw->con_font_default(vc, &font, s); | 4108 | rc = vc->vc_sw->con_font_default(vc, &font, s); |
4109 | else | 4109 | else |
4110 | rc = -ENOSYS; | 4110 | rc = -ENOSYS; |
4111 | release_console_sem(); | 4111 | console_unlock(); |
4112 | if (!rc) { | 4112 | if (!rc) { |
4113 | op->width = font.width; | 4113 | op->width = font.width; |
4114 | op->height = font.height; | 4114 | op->height = font.height; |
@@ -4124,7 +4124,7 @@ static int con_font_copy(struct vc_data *vc, struct console_font_op *op) | |||
4124 | if (vc->vc_mode != KD_TEXT) | 4124 | if (vc->vc_mode != KD_TEXT) |
4125 | return -EINVAL; | 4125 | return -EINVAL; |
4126 | 4126 | ||
4127 | acquire_console_sem(); | 4127 | console_lock(); |
4128 | if (!vc->vc_sw->con_font_copy) | 4128 | if (!vc->vc_sw->con_font_copy) |
4129 | rc = -ENOSYS; | 4129 | rc = -ENOSYS; |
4130 | else if (con < 0 || !vc_cons_allocated(con)) | 4130 | else if (con < 0 || !vc_cons_allocated(con)) |
@@ -4133,7 +4133,7 @@ static int con_font_copy(struct vc_data *vc, struct console_font_op *op) | |||
4133 | rc = 0; | 4133 | rc = 0; |
4134 | else | 4134 | else |
4135 | rc = vc->vc_sw->con_font_copy(vc, con); | 4135 | rc = vc->vc_sw->con_font_copy(vc, con); |
4136 | release_console_sem(); | 4136 | console_unlock(); |
4137 | return rc; | 4137 | return rc; |
4138 | } | 4138 | } |
4139 | 4139 | ||
diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c index 6b68a0fb461..1235ebda6e1 100644 --- a/drivers/tty/vt/vt_ioctl.c +++ b/drivers/tty/vt/vt_ioctl.c | |||
@@ -649,12 +649,12 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
649 | /* | 649 | /* |
650 | * explicitly blank/unblank the screen if switching modes | 650 | * explicitly blank/unblank the screen if switching modes |
651 | */ | 651 | */ |
652 | acquire_console_sem(); | 652 | console_lock(); |
653 | if (arg == KD_TEXT) | 653 | if (arg == KD_TEXT) |
654 | do_unblank_screen(1); | 654 | do_unblank_screen(1); |
655 | else | 655 | else |
656 | do_blank_screen(1); | 656 | do_blank_screen(1); |
657 | release_console_sem(); | 657 | console_unlock(); |
658 | break; | 658 | break; |
659 | 659 | ||
660 | case KDGETMODE: | 660 | case KDGETMODE: |
@@ -893,7 +893,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
893 | ret = -EINVAL; | 893 | ret = -EINVAL; |
894 | goto out; | 894 | goto out; |
895 | } | 895 | } |
896 | acquire_console_sem(); | 896 | console_lock(); |
897 | vc->vt_mode = tmp; | 897 | vc->vt_mode = tmp; |
898 | /* the frsig is ignored, so we set it to 0 */ | 898 | /* the frsig is ignored, so we set it to 0 */ |
899 | vc->vt_mode.frsig = 0; | 899 | vc->vt_mode.frsig = 0; |
@@ -901,7 +901,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
901 | vc->vt_pid = get_pid(task_pid(current)); | 901 | vc->vt_pid = get_pid(task_pid(current)); |
902 | /* no switch is required -- saw@shade.msu.ru */ | 902 | /* no switch is required -- saw@shade.msu.ru */ |
903 | vc->vt_newvt = -1; | 903 | vc->vt_newvt = -1; |
904 | release_console_sem(); | 904 | console_unlock(); |
905 | break; | 905 | break; |
906 | } | 906 | } |
907 | 907 | ||
@@ -910,9 +910,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
910 | struct vt_mode tmp; | 910 | struct vt_mode tmp; |
911 | int rc; | 911 | int rc; |
912 | 912 | ||
913 | acquire_console_sem(); | 913 | console_lock(); |
914 | memcpy(&tmp, &vc->vt_mode, sizeof(struct vt_mode)); | 914 | memcpy(&tmp, &vc->vt_mode, sizeof(struct vt_mode)); |
915 | release_console_sem(); | 915 | console_unlock(); |
916 | 916 | ||
917 | rc = copy_to_user(up, &tmp, sizeof(struct vt_mode)); | 917 | rc = copy_to_user(up, &tmp, sizeof(struct vt_mode)); |
918 | if (rc) | 918 | if (rc) |
@@ -965,9 +965,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
965 | ret = -ENXIO; | 965 | ret = -ENXIO; |
966 | else { | 966 | else { |
967 | arg--; | 967 | arg--; |
968 | acquire_console_sem(); | 968 | console_lock(); |
969 | ret = vc_allocate(arg); | 969 | ret = vc_allocate(arg); |
970 | release_console_sem(); | 970 | console_unlock(); |
971 | if (ret) | 971 | if (ret) |
972 | break; | 972 | break; |
973 | set_console(arg); | 973 | set_console(arg); |
@@ -990,7 +990,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
990 | ret = -ENXIO; | 990 | ret = -ENXIO; |
991 | else { | 991 | else { |
992 | vsa.console--; | 992 | vsa.console--; |
993 | acquire_console_sem(); | 993 | console_lock(); |
994 | ret = vc_allocate(vsa.console); | 994 | ret = vc_allocate(vsa.console); |
995 | if (ret == 0) { | 995 | if (ret == 0) { |
996 | struct vc_data *nvc; | 996 | struct vc_data *nvc; |
@@ -1003,7 +1003,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
1003 | put_pid(nvc->vt_pid); | 1003 | put_pid(nvc->vt_pid); |
1004 | nvc->vt_pid = get_pid(task_pid(current)); | 1004 | nvc->vt_pid = get_pid(task_pid(current)); |
1005 | } | 1005 | } |
1006 | release_console_sem(); | 1006 | console_unlock(); |
1007 | if (ret) | 1007 | if (ret) |
1008 | break; | 1008 | break; |
1009 | /* Commence switch and lock */ | 1009 | /* Commence switch and lock */ |
@@ -1044,7 +1044,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
1044 | /* | 1044 | /* |
1045 | * Switching-from response | 1045 | * Switching-from response |
1046 | */ | 1046 | */ |
1047 | acquire_console_sem(); | 1047 | console_lock(); |
1048 | if (vc->vt_newvt >= 0) { | 1048 | if (vc->vt_newvt >= 0) { |
1049 | if (arg == 0) | 1049 | if (arg == 0) |
1050 | /* | 1050 | /* |
@@ -1063,7 +1063,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
1063 | vc->vt_newvt = -1; | 1063 | vc->vt_newvt = -1; |
1064 | ret = vc_allocate(newvt); | 1064 | ret = vc_allocate(newvt); |
1065 | if (ret) { | 1065 | if (ret) { |
1066 | release_console_sem(); | 1066 | console_unlock(); |
1067 | break; | 1067 | break; |
1068 | } | 1068 | } |
1069 | /* | 1069 | /* |
@@ -1083,7 +1083,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
1083 | if (arg != VT_ACKACQ) | 1083 | if (arg != VT_ACKACQ) |
1084 | ret = -EINVAL; | 1084 | ret = -EINVAL; |
1085 | } | 1085 | } |
1086 | release_console_sem(); | 1086 | console_unlock(); |
1087 | break; | 1087 | break; |
1088 | 1088 | ||
1089 | /* | 1089 | /* |
@@ -1096,20 +1096,20 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
1096 | } | 1096 | } |
1097 | if (arg == 0) { | 1097 | if (arg == 0) { |
1098 | /* deallocate all unused consoles, but leave 0 */ | 1098 | /* deallocate all unused consoles, but leave 0 */ |
1099 | acquire_console_sem(); | 1099 | console_lock(); |
1100 | for (i=1; i<MAX_NR_CONSOLES; i++) | 1100 | for (i=1; i<MAX_NR_CONSOLES; i++) |
1101 | if (! VT_BUSY(i)) | 1101 | if (! VT_BUSY(i)) |
1102 | vc_deallocate(i); | 1102 | vc_deallocate(i); |
1103 | release_console_sem(); | 1103 | console_unlock(); |
1104 | } else { | 1104 | } else { |
1105 | /* deallocate a single console, if possible */ | 1105 | /* deallocate a single console, if possible */ |
1106 | arg--; | 1106 | arg--; |
1107 | if (VT_BUSY(arg)) | 1107 | if (VT_BUSY(arg)) |
1108 | ret = -EBUSY; | 1108 | ret = -EBUSY; |
1109 | else if (arg) { /* leave 0 */ | 1109 | else if (arg) { /* leave 0 */ |
1110 | acquire_console_sem(); | 1110 | console_lock(); |
1111 | vc_deallocate(arg); | 1111 | vc_deallocate(arg); |
1112 | release_console_sem(); | 1112 | console_unlock(); |
1113 | } | 1113 | } |
1114 | } | 1114 | } |
1115 | break; | 1115 | break; |
@@ -1126,7 +1126,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
1126 | get_user(cc, &vtsizes->v_cols)) | 1126 | get_user(cc, &vtsizes->v_cols)) |
1127 | ret = -EFAULT; | 1127 | ret = -EFAULT; |
1128 | else { | 1128 | else { |
1129 | acquire_console_sem(); | 1129 | console_lock(); |
1130 | for (i = 0; i < MAX_NR_CONSOLES; i++) { | 1130 | for (i = 0; i < MAX_NR_CONSOLES; i++) { |
1131 | vc = vc_cons[i].d; | 1131 | vc = vc_cons[i].d; |
1132 | 1132 | ||
@@ -1135,7 +1135,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
1135 | vc_resize(vc_cons[i].d, cc, ll); | 1135 | vc_resize(vc_cons[i].d, cc, ll); |
1136 | } | 1136 | } |
1137 | } | 1137 | } |
1138 | release_console_sem(); | 1138 | console_unlock(); |
1139 | } | 1139 | } |
1140 | break; | 1140 | break; |
1141 | } | 1141 | } |
@@ -1187,14 +1187,14 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
1187 | for (i = 0; i < MAX_NR_CONSOLES; i++) { | 1187 | for (i = 0; i < MAX_NR_CONSOLES; i++) { |
1188 | if (!vc_cons[i].d) | 1188 | if (!vc_cons[i].d) |
1189 | continue; | 1189 | continue; |
1190 | acquire_console_sem(); | 1190 | console_lock(); |
1191 | if (vlin) | 1191 | if (vlin) |
1192 | vc_cons[i].d->vc_scan_lines = vlin; | 1192 | vc_cons[i].d->vc_scan_lines = vlin; |
1193 | if (clin) | 1193 | if (clin) |
1194 | vc_cons[i].d->vc_font.height = clin; | 1194 | vc_cons[i].d->vc_font.height = clin; |
1195 | vc_cons[i].d->vc_resize_user = 1; | 1195 | vc_cons[i].d->vc_resize_user = 1; |
1196 | vc_resize(vc_cons[i].d, cc, ll); | 1196 | vc_resize(vc_cons[i].d, cc, ll); |
1197 | release_console_sem(); | 1197 | console_unlock(); |
1198 | } | 1198 | } |
1199 | break; | 1199 | break; |
1200 | } | 1200 | } |
@@ -1367,7 +1367,7 @@ void vc_SAK(struct work_struct *work) | |||
1367 | struct vc_data *vc; | 1367 | struct vc_data *vc; |
1368 | struct tty_struct *tty; | 1368 | struct tty_struct *tty; |
1369 | 1369 | ||
1370 | acquire_console_sem(); | 1370 | console_lock(); |
1371 | vc = vc_con->d; | 1371 | vc = vc_con->d; |
1372 | if (vc) { | 1372 | if (vc) { |
1373 | tty = vc->port.tty; | 1373 | tty = vc->port.tty; |
@@ -1379,7 +1379,7 @@ void vc_SAK(struct work_struct *work) | |||
1379 | __do_SAK(tty); | 1379 | __do_SAK(tty); |
1380 | reset_vc(vc); | 1380 | reset_vc(vc); |
1381 | } | 1381 | } |
1382 | release_console_sem(); | 1382 | console_unlock(); |
1383 | } | 1383 | } |
1384 | 1384 | ||
1385 | #ifdef CONFIG_COMPAT | 1385 | #ifdef CONFIG_COMPAT |
@@ -1737,10 +1737,10 @@ int vt_move_to_console(unsigned int vt, int alloc) | |||
1737 | { | 1737 | { |
1738 | int prev; | 1738 | int prev; |
1739 | 1739 | ||
1740 | acquire_console_sem(); | 1740 | console_lock(); |
1741 | /* Graphics mode - up to X */ | 1741 | /* Graphics mode - up to X */ |
1742 | if (disable_vt_switch) { | 1742 | if (disable_vt_switch) { |
1743 | release_console_sem(); | 1743 | console_unlock(); |
1744 | return 0; | 1744 | return 0; |
1745 | } | 1745 | } |
1746 | prev = fg_console; | 1746 | prev = fg_console; |
@@ -1748,7 +1748,7 @@ int vt_move_to_console(unsigned int vt, int alloc) | |||
1748 | if (alloc && vc_allocate(vt)) { | 1748 | if (alloc && vc_allocate(vt)) { |
1749 | /* we can't have a free VC for now. Too bad, | 1749 | /* we can't have a free VC for now. Too bad, |
1750 | * we don't want to mess the screen for now. */ | 1750 | * we don't want to mess the screen for now. */ |
1751 | release_console_sem(); | 1751 | console_unlock(); |
1752 | return -ENOSPC; | 1752 | return -ENOSPC; |
1753 | } | 1753 | } |
1754 | 1754 | ||
@@ -1758,10 +1758,10 @@ int vt_move_to_console(unsigned int vt, int alloc) | |||
1758 | * Let the calling function know so it can decide | 1758 | * Let the calling function know so it can decide |
1759 | * what to do. | 1759 | * what to do. |
1760 | */ | 1760 | */ |
1761 | release_console_sem(); | 1761 | console_unlock(); |
1762 | return -EIO; | 1762 | return -EIO; |
1763 | } | 1763 | } |
1764 | release_console_sem(); | 1764 | console_unlock(); |
1765 | tty_lock(); | 1765 | tty_lock(); |
1766 | if (vt_waitactive(vt + 1)) { | 1766 | if (vt_waitactive(vt + 1)) { |
1767 | pr_debug("Suspend: Can't switch VCs."); | 1767 | pr_debug("Suspend: Can't switch VCs."); |
@@ -1781,8 +1781,8 @@ int vt_move_to_console(unsigned int vt, int alloc) | |||
1781 | */ | 1781 | */ |
1782 | void pm_set_vt_switch(int do_switch) | 1782 | void pm_set_vt_switch(int do_switch) |
1783 | { | 1783 | { |
1784 | acquire_console_sem(); | 1784 | console_lock(); |
1785 | disable_vt_switch = !do_switch; | 1785 | disable_vt_switch = !do_switch; |
1786 | release_console_sem(); | 1786 | console_unlock(); |
1787 | } | 1787 | } |
1788 | EXPORT_SYMBOL(pm_set_vt_switch); | 1788 | EXPORT_SYMBOL(pm_set_vt_switch); |
diff --git a/drivers/video/arkfb.c b/drivers/video/arkfb.c index d583bea608f..391ac939f01 100644 --- a/drivers/video/arkfb.c +++ b/drivers/video/arkfb.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <linux/svga.h> | 23 | #include <linux/svga.h> |
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <linux/console.h> /* Why should fb driver call console functions? because acquire_console_sem() */ | 26 | #include <linux/console.h> /* Why should fb driver call console functions? because console_lock() */ |
27 | #include <video/vga.h> | 27 | #include <video/vga.h> |
28 | 28 | ||
29 | #ifdef CONFIG_MTRR | 29 | #ifdef CONFIG_MTRR |
@@ -1091,12 +1091,12 @@ static int ark_pci_suspend (struct pci_dev* dev, pm_message_t state) | |||
1091 | 1091 | ||
1092 | dev_info(info->device, "suspend\n"); | 1092 | dev_info(info->device, "suspend\n"); |
1093 | 1093 | ||
1094 | acquire_console_sem(); | 1094 | console_lock(); |
1095 | mutex_lock(&(par->open_lock)); | 1095 | mutex_lock(&(par->open_lock)); |
1096 | 1096 | ||
1097 | if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) { | 1097 | if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) { |
1098 | mutex_unlock(&(par->open_lock)); | 1098 | mutex_unlock(&(par->open_lock)); |
1099 | release_console_sem(); | 1099 | console_unlock(); |
1100 | return 0; | 1100 | return 0; |
1101 | } | 1101 | } |
1102 | 1102 | ||
@@ -1107,7 +1107,7 @@ static int ark_pci_suspend (struct pci_dev* dev, pm_message_t state) | |||
1107 | pci_set_power_state(dev, pci_choose_state(dev, state)); | 1107 | pci_set_power_state(dev, pci_choose_state(dev, state)); |
1108 | 1108 | ||
1109 | mutex_unlock(&(par->open_lock)); | 1109 | mutex_unlock(&(par->open_lock)); |
1110 | release_console_sem(); | 1110 | console_unlock(); |
1111 | 1111 | ||
1112 | return 0; | 1112 | return 0; |
1113 | } | 1113 | } |
@@ -1122,7 +1122,7 @@ static int ark_pci_resume (struct pci_dev* dev) | |||
1122 | 1122 | ||
1123 | dev_info(info->device, "resume\n"); | 1123 | dev_info(info->device, "resume\n"); |
1124 | 1124 | ||
1125 | acquire_console_sem(); | 1125 | console_lock(); |
1126 | mutex_lock(&(par->open_lock)); | 1126 | mutex_lock(&(par->open_lock)); |
1127 | 1127 | ||
1128 | if (par->ref_count == 0) | 1128 | if (par->ref_count == 0) |
@@ -1141,7 +1141,7 @@ static int ark_pci_resume (struct pci_dev* dev) | |||
1141 | 1141 | ||
1142 | fail: | 1142 | fail: |
1143 | mutex_unlock(&(par->open_lock)); | 1143 | mutex_unlock(&(par->open_lock)); |
1144 | release_console_sem(); | 1144 | console_unlock(); |
1145 | return 0; | 1145 | return 0; |
1146 | } | 1146 | } |
1147 | #else | 1147 | #else |
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index dd9de2e8058..4cb6a576c56 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c | |||
@@ -1860,11 +1860,11 @@ static void aty128_early_resume(void *data) | |||
1860 | { | 1860 | { |
1861 | struct aty128fb_par *par = data; | 1861 | struct aty128fb_par *par = data; |
1862 | 1862 | ||
1863 | if (try_acquire_console_sem()) | 1863 | if (!console_trylock()) |
1864 | return; | 1864 | return; |
1865 | pci_restore_state(par->pdev); | 1865 | pci_restore_state(par->pdev); |
1866 | aty128_do_resume(par->pdev); | 1866 | aty128_do_resume(par->pdev); |
1867 | release_console_sem(); | 1867 | console_unlock(); |
1868 | } | 1868 | } |
1869 | #endif /* CONFIG_PPC_PMAC */ | 1869 | #endif /* CONFIG_PPC_PMAC */ |
1870 | 1870 | ||
@@ -2438,7 +2438,7 @@ static int aty128_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2438 | 2438 | ||
2439 | printk(KERN_DEBUG "aty128fb: suspending...\n"); | 2439 | printk(KERN_DEBUG "aty128fb: suspending...\n"); |
2440 | 2440 | ||
2441 | acquire_console_sem(); | 2441 | console_lock(); |
2442 | 2442 | ||
2443 | fb_set_suspend(info, 1); | 2443 | fb_set_suspend(info, 1); |
2444 | 2444 | ||
@@ -2470,7 +2470,7 @@ static int aty128_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2470 | if (state.event != PM_EVENT_ON) | 2470 | if (state.event != PM_EVENT_ON) |
2471 | aty128_set_suspend(par, 1); | 2471 | aty128_set_suspend(par, 1); |
2472 | 2472 | ||
2473 | release_console_sem(); | 2473 | console_unlock(); |
2474 | 2474 | ||
2475 | pdev->dev.power.power_state = state; | 2475 | pdev->dev.power.power_state = state; |
2476 | 2476 | ||
@@ -2527,9 +2527,9 @@ static int aty128_pci_resume(struct pci_dev *pdev) | |||
2527 | { | 2527 | { |
2528 | int rc; | 2528 | int rc; |
2529 | 2529 | ||
2530 | acquire_console_sem(); | 2530 | console_lock(); |
2531 | rc = aty128_do_resume(pdev); | 2531 | rc = aty128_do_resume(pdev); |
2532 | release_console_sem(); | 2532 | console_unlock(); |
2533 | 2533 | ||
2534 | return rc; | 2534 | return rc; |
2535 | } | 2535 | } |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index 767ab4fb1a0..94e293fce1d 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -2069,7 +2069,7 @@ static int atyfb_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2069 | if (state.event == pdev->dev.power.power_state.event) | 2069 | if (state.event == pdev->dev.power.power_state.event) |
2070 | return 0; | 2070 | return 0; |
2071 | 2071 | ||
2072 | acquire_console_sem(); | 2072 | console_lock(); |
2073 | 2073 | ||
2074 | fb_set_suspend(info, 1); | 2074 | fb_set_suspend(info, 1); |
2075 | 2075 | ||
@@ -2097,14 +2097,14 @@ static int atyfb_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2097 | par->lock_blank = 0; | 2097 | par->lock_blank = 0; |
2098 | atyfb_blank(FB_BLANK_UNBLANK, info); | 2098 | atyfb_blank(FB_BLANK_UNBLANK, info); |
2099 | fb_set_suspend(info, 0); | 2099 | fb_set_suspend(info, 0); |
2100 | release_console_sem(); | 2100 | console_unlock(); |
2101 | return -EIO; | 2101 | return -EIO; |
2102 | } | 2102 | } |
2103 | #else | 2103 | #else |
2104 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | 2104 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); |
2105 | #endif | 2105 | #endif |
2106 | 2106 | ||
2107 | release_console_sem(); | 2107 | console_unlock(); |
2108 | 2108 | ||
2109 | pdev->dev.power.power_state = state; | 2109 | pdev->dev.power.power_state = state; |
2110 | 2110 | ||
@@ -2133,7 +2133,7 @@ static int atyfb_pci_resume(struct pci_dev *pdev) | |||
2133 | if (pdev->dev.power.power_state.event == PM_EVENT_ON) | 2133 | if (pdev->dev.power.power_state.event == PM_EVENT_ON) |
2134 | return 0; | 2134 | return 0; |
2135 | 2135 | ||
2136 | acquire_console_sem(); | 2136 | console_lock(); |
2137 | 2137 | ||
2138 | /* | 2138 | /* |
2139 | * PCI state will have been restored by the core, so | 2139 | * PCI state will have been restored by the core, so |
@@ -2161,7 +2161,7 @@ static int atyfb_pci_resume(struct pci_dev *pdev) | |||
2161 | par->lock_blank = 0; | 2161 | par->lock_blank = 0; |
2162 | atyfb_blank(FB_BLANK_UNBLANK, info); | 2162 | atyfb_blank(FB_BLANK_UNBLANK, info); |
2163 | 2163 | ||
2164 | release_console_sem(); | 2164 | console_unlock(); |
2165 | 2165 | ||
2166 | pdev->dev.power.power_state = PMSG_ON; | 2166 | pdev->dev.power.power_state = PMSG_ON; |
2167 | 2167 | ||
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c index c4e17642d9c..92bda584851 100644 --- a/drivers/video/aty/radeon_pm.c +++ b/drivers/video/aty/radeon_pm.c | |||
@@ -2626,7 +2626,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg) | |||
2626 | goto done; | 2626 | goto done; |
2627 | } | 2627 | } |
2628 | 2628 | ||
2629 | acquire_console_sem(); | 2629 | console_lock(); |
2630 | 2630 | ||
2631 | fb_set_suspend(info, 1); | 2631 | fb_set_suspend(info, 1); |
2632 | 2632 | ||
@@ -2690,7 +2690,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg) | |||
2690 | if (rinfo->pm_mode & radeon_pm_d2) | 2690 | if (rinfo->pm_mode & radeon_pm_d2) |
2691 | radeon_set_suspend(rinfo, 1); | 2691 | radeon_set_suspend(rinfo, 1); |
2692 | 2692 | ||
2693 | release_console_sem(); | 2693 | console_unlock(); |
2694 | 2694 | ||
2695 | done: | 2695 | done: |
2696 | pdev->dev.power.power_state = mesg; | 2696 | pdev->dev.power.power_state = mesg; |
@@ -2715,10 +2715,10 @@ int radeonfb_pci_resume(struct pci_dev *pdev) | |||
2715 | return 0; | 2715 | return 0; |
2716 | 2716 | ||
2717 | if (rinfo->no_schedule) { | 2717 | if (rinfo->no_schedule) { |
2718 | if (try_acquire_console_sem()) | 2718 | if (!console_trylock()) |
2719 | return 0; | 2719 | return 0; |
2720 | } else | 2720 | } else |
2721 | acquire_console_sem(); | 2721 | console_lock(); |
2722 | 2722 | ||
2723 | printk(KERN_DEBUG "radeonfb (%s): resuming from state: %d...\n", | 2723 | printk(KERN_DEBUG "radeonfb (%s): resuming from state: %d...\n", |
2724 | pci_name(pdev), pdev->dev.power.power_state.event); | 2724 | pci_name(pdev), pdev->dev.power.power_state.event); |
@@ -2783,7 +2783,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev) | |||
2783 | pdev->dev.power.power_state = PMSG_ON; | 2783 | pdev->dev.power.power_state = PMSG_ON; |
2784 | 2784 | ||
2785 | bail: | 2785 | bail: |
2786 | release_console_sem(); | 2786 | console_unlock(); |
2787 | 2787 | ||
2788 | return rc; | 2788 | return rc; |
2789 | } | 2789 | } |
diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c index d637e1f5317..cff742abdc5 100644 --- a/drivers/video/chipsfb.c +++ b/drivers/video/chipsfb.c | |||
@@ -460,10 +460,10 @@ static int chipsfb_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
460 | if (!(state.event & PM_EVENT_SLEEP)) | 460 | if (!(state.event & PM_EVENT_SLEEP)) |
461 | goto done; | 461 | goto done; |
462 | 462 | ||
463 | acquire_console_sem(); | 463 | console_lock(); |
464 | chipsfb_blank(1, p); | 464 | chipsfb_blank(1, p); |
465 | fb_set_suspend(p, 1); | 465 | fb_set_suspend(p, 1); |
466 | release_console_sem(); | 466 | console_unlock(); |
467 | done: | 467 | done: |
468 | pdev->dev.power.power_state = state; | 468 | pdev->dev.power.power_state = state; |
469 | return 0; | 469 | return 0; |
@@ -473,10 +473,10 @@ static int chipsfb_pci_resume(struct pci_dev *pdev) | |||
473 | { | 473 | { |
474 | struct fb_info *p = pci_get_drvdata(pdev); | 474 | struct fb_info *p = pci_get_drvdata(pdev); |
475 | 475 | ||
476 | acquire_console_sem(); | 476 | console_lock(); |
477 | fb_set_suspend(p, 0); | 477 | fb_set_suspend(p, 0); |
478 | chipsfb_blank(0, p); | 478 | chipsfb_blank(0, p); |
479 | release_console_sem(); | 479 | console_unlock(); |
480 | 480 | ||
481 | pdev->dev.power.power_state = PMSG_ON; | 481 | pdev->dev.power.power_state = PMSG_ON; |
482 | return 0; | 482 | return 0; |
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 7ccc967831f..9c092b8d64e 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
@@ -375,14 +375,14 @@ static void fb_flashcursor(struct work_struct *work) | |||
375 | int c; | 375 | int c; |
376 | int mode; | 376 | int mode; |
377 | 377 | ||
378 | acquire_console_sem(); | 378 | console_lock(); |
379 | if (ops && ops->currcon != -1) | 379 | if (ops && ops->currcon != -1) |
380 | vc = vc_cons[ops->currcon].d; | 380 | vc = vc_cons[ops->currcon].d; |
381 | 381 | ||
382 | if (!vc || !CON_IS_VISIBLE(vc) || | 382 | if (!vc || !CON_IS_VISIBLE(vc) || |
383 | registered_fb[con2fb_map[vc->vc_num]] != info || | 383 | registered_fb[con2fb_map[vc->vc_num]] != info || |
384 | vc->vc_deccm != 1) { | 384 | vc->vc_deccm != 1) { |
385 | release_console_sem(); | 385 | console_unlock(); |
386 | return; | 386 | return; |
387 | } | 387 | } |
388 | 388 | ||
@@ -392,7 +392,7 @@ static void fb_flashcursor(struct work_struct *work) | |||
392 | CM_ERASE : CM_DRAW; | 392 | CM_ERASE : CM_DRAW; |
393 | ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1), | 393 | ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1), |
394 | get_color(vc, info, c, 0)); | 394 | get_color(vc, info, c, 0)); |
395 | release_console_sem(); | 395 | console_unlock(); |
396 | } | 396 | } |
397 | 397 | ||
398 | static void cursor_timer_handler(unsigned long dev_addr) | 398 | static void cursor_timer_handler(unsigned long dev_addr) |
@@ -836,7 +836,7 @@ static int set_con2fb_map(int unit, int newidx, int user) | |||
836 | 836 | ||
837 | found = search_fb_in_map(newidx); | 837 | found = search_fb_in_map(newidx); |
838 | 838 | ||
839 | acquire_console_sem(); | 839 | console_lock(); |
840 | con2fb_map[unit] = newidx; | 840 | con2fb_map[unit] = newidx; |
841 | if (!err && !found) | 841 | if (!err && !found) |
842 | err = con2fb_acquire_newinfo(vc, info, unit, oldidx); | 842 | err = con2fb_acquire_newinfo(vc, info, unit, oldidx); |
@@ -863,7 +863,7 @@ static int set_con2fb_map(int unit, int newidx, int user) | |||
863 | if (!search_fb_in_map(info_idx)) | 863 | if (!search_fb_in_map(info_idx)) |
864 | info_idx = newidx; | 864 | info_idx = newidx; |
865 | 865 | ||
866 | release_console_sem(); | 866 | console_unlock(); |
867 | return err; | 867 | return err; |
868 | } | 868 | } |
869 | 869 | ||
@@ -3321,7 +3321,7 @@ static ssize_t store_rotate(struct device *device, | |||
3321 | if (fbcon_has_exited) | 3321 | if (fbcon_has_exited) |
3322 | return count; | 3322 | return count; |
3323 | 3323 | ||
3324 | acquire_console_sem(); | 3324 | console_lock(); |
3325 | idx = con2fb_map[fg_console]; | 3325 | idx = con2fb_map[fg_console]; |
3326 | 3326 | ||
3327 | if (idx == -1 || registered_fb[idx] == NULL) | 3327 | if (idx == -1 || registered_fb[idx] == NULL) |
@@ -3331,7 +3331,7 @@ static ssize_t store_rotate(struct device *device, | |||
3331 | rotate = simple_strtoul(buf, last, 0); | 3331 | rotate = simple_strtoul(buf, last, 0); |
3332 | fbcon_rotate(info, rotate); | 3332 | fbcon_rotate(info, rotate); |
3333 | err: | 3333 | err: |
3334 | release_console_sem(); | 3334 | console_unlock(); |
3335 | return count; | 3335 | return count; |
3336 | } | 3336 | } |
3337 | 3337 | ||
@@ -3346,7 +3346,7 @@ static ssize_t store_rotate_all(struct device *device, | |||
3346 | if (fbcon_has_exited) | 3346 | if (fbcon_has_exited) |
3347 | return count; | 3347 | return count; |
3348 | 3348 | ||
3349 | acquire_console_sem(); | 3349 | console_lock(); |
3350 | idx = con2fb_map[fg_console]; | 3350 | idx = con2fb_map[fg_console]; |
3351 | 3351 | ||
3352 | if (idx == -1 || registered_fb[idx] == NULL) | 3352 | if (idx == -1 || registered_fb[idx] == NULL) |
@@ -3356,7 +3356,7 @@ static ssize_t store_rotate_all(struct device *device, | |||
3356 | rotate = simple_strtoul(buf, last, 0); | 3356 | rotate = simple_strtoul(buf, last, 0); |
3357 | fbcon_rotate_all(info, rotate); | 3357 | fbcon_rotate_all(info, rotate); |
3358 | err: | 3358 | err: |
3359 | release_console_sem(); | 3359 | console_unlock(); |
3360 | return count; | 3360 | return count; |
3361 | } | 3361 | } |
3362 | 3362 | ||
@@ -3369,7 +3369,7 @@ static ssize_t show_rotate(struct device *device, | |||
3369 | if (fbcon_has_exited) | 3369 | if (fbcon_has_exited) |
3370 | return 0; | 3370 | return 0; |
3371 | 3371 | ||
3372 | acquire_console_sem(); | 3372 | console_lock(); |
3373 | idx = con2fb_map[fg_console]; | 3373 | idx = con2fb_map[fg_console]; |
3374 | 3374 | ||
3375 | if (idx == -1 || registered_fb[idx] == NULL) | 3375 | if (idx == -1 || registered_fb[idx] == NULL) |
@@ -3378,7 +3378,7 @@ static ssize_t show_rotate(struct device *device, | |||
3378 | info = registered_fb[idx]; | 3378 | info = registered_fb[idx]; |
3379 | rotate = fbcon_get_rotate(info); | 3379 | rotate = fbcon_get_rotate(info); |
3380 | err: | 3380 | err: |
3381 | release_console_sem(); | 3381 | console_unlock(); |
3382 | return snprintf(buf, PAGE_SIZE, "%d\n", rotate); | 3382 | return snprintf(buf, PAGE_SIZE, "%d\n", rotate); |
3383 | } | 3383 | } |
3384 | 3384 | ||
@@ -3392,7 +3392,7 @@ static ssize_t show_cursor_blink(struct device *device, | |||
3392 | if (fbcon_has_exited) | 3392 | if (fbcon_has_exited) |
3393 | return 0; | 3393 | return 0; |
3394 | 3394 | ||
3395 | acquire_console_sem(); | 3395 | console_lock(); |
3396 | idx = con2fb_map[fg_console]; | 3396 | idx = con2fb_map[fg_console]; |
3397 | 3397 | ||
3398 | if (idx == -1 || registered_fb[idx] == NULL) | 3398 | if (idx == -1 || registered_fb[idx] == NULL) |
@@ -3406,7 +3406,7 @@ static ssize_t show_cursor_blink(struct device *device, | |||
3406 | 3406 | ||
3407 | blink = (ops->flags & FBCON_FLAGS_CURSOR_TIMER) ? 1 : 0; | 3407 | blink = (ops->flags & FBCON_FLAGS_CURSOR_TIMER) ? 1 : 0; |
3408 | err: | 3408 | err: |
3409 | release_console_sem(); | 3409 | console_unlock(); |
3410 | return snprintf(buf, PAGE_SIZE, "%d\n", blink); | 3410 | return snprintf(buf, PAGE_SIZE, "%d\n", blink); |
3411 | } | 3411 | } |
3412 | 3412 | ||
@@ -3421,7 +3421,7 @@ static ssize_t store_cursor_blink(struct device *device, | |||
3421 | if (fbcon_has_exited) | 3421 | if (fbcon_has_exited) |
3422 | return count; | 3422 | return count; |
3423 | 3423 | ||
3424 | acquire_console_sem(); | 3424 | console_lock(); |
3425 | idx = con2fb_map[fg_console]; | 3425 | idx = con2fb_map[fg_console]; |
3426 | 3426 | ||
3427 | if (idx == -1 || registered_fb[idx] == NULL) | 3427 | if (idx == -1 || registered_fb[idx] == NULL) |
@@ -3443,7 +3443,7 @@ static ssize_t store_cursor_blink(struct device *device, | |||
3443 | } | 3443 | } |
3444 | 3444 | ||
3445 | err: | 3445 | err: |
3446 | release_console_sem(); | 3446 | console_unlock(); |
3447 | return count; | 3447 | return count; |
3448 | } | 3448 | } |
3449 | 3449 | ||
@@ -3482,7 +3482,7 @@ static void fbcon_start(void) | |||
3482 | if (num_registered_fb) { | 3482 | if (num_registered_fb) { |
3483 | int i; | 3483 | int i; |
3484 | 3484 | ||
3485 | acquire_console_sem(); | 3485 | console_lock(); |
3486 | 3486 | ||
3487 | for (i = 0; i < FB_MAX; i++) { | 3487 | for (i = 0; i < FB_MAX; i++) { |
3488 | if (registered_fb[i] != NULL) { | 3488 | if (registered_fb[i] != NULL) { |
@@ -3491,7 +3491,7 @@ static void fbcon_start(void) | |||
3491 | } | 3491 | } |
3492 | } | 3492 | } |
3493 | 3493 | ||
3494 | release_console_sem(); | 3494 | console_unlock(); |
3495 | fbcon_takeover(0); | 3495 | fbcon_takeover(0); |
3496 | } | 3496 | } |
3497 | } | 3497 | } |
@@ -3552,7 +3552,7 @@ static int __init fb_console_init(void) | |||
3552 | { | 3552 | { |
3553 | int i; | 3553 | int i; |
3554 | 3554 | ||
3555 | acquire_console_sem(); | 3555 | console_lock(); |
3556 | fb_register_client(&fbcon_event_notifier); | 3556 | fb_register_client(&fbcon_event_notifier); |
3557 | fbcon_device = device_create(fb_class, NULL, MKDEV(0, 0), NULL, | 3557 | fbcon_device = device_create(fb_class, NULL, MKDEV(0, 0), NULL, |
3558 | "fbcon"); | 3558 | "fbcon"); |
@@ -3568,7 +3568,7 @@ static int __init fb_console_init(void) | |||
3568 | for (i = 0; i < MAX_NR_CONSOLES; i++) | 3568 | for (i = 0; i < MAX_NR_CONSOLES; i++) |
3569 | con2fb_map[i] = -1; | 3569 | con2fb_map[i] = -1; |
3570 | 3570 | ||
3571 | release_console_sem(); | 3571 | console_unlock(); |
3572 | fbcon_start(); | 3572 | fbcon_start(); |
3573 | return 0; | 3573 | return 0; |
3574 | } | 3574 | } |
@@ -3591,12 +3591,12 @@ static void __exit fbcon_deinit_device(void) | |||
3591 | 3591 | ||
3592 | static void __exit fb_console_exit(void) | 3592 | static void __exit fb_console_exit(void) |
3593 | { | 3593 | { |
3594 | acquire_console_sem(); | 3594 | console_lock(); |
3595 | fb_unregister_client(&fbcon_event_notifier); | 3595 | fb_unregister_client(&fbcon_event_notifier); |
3596 | fbcon_deinit_device(); | 3596 | fbcon_deinit_device(); |
3597 | device_destroy(fb_class, MKDEV(0, 0)); | 3597 | device_destroy(fb_class, MKDEV(0, 0)); |
3598 | fbcon_exit(); | 3598 | fbcon_exit(); |
3599 | release_console_sem(); | 3599 | console_unlock(); |
3600 | unregister_con_driver(&fb_con); | 3600 | unregister_con_driver(&fb_con); |
3601 | } | 3601 | } |
3602 | 3602 | ||
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c index 520047ac6e3..8d61ef96eed 100644 --- a/drivers/video/da8xx-fb.c +++ b/drivers/video/da8xx-fb.c | |||
@@ -1131,14 +1131,14 @@ static int fb_suspend(struct platform_device *dev, pm_message_t state) | |||
1131 | struct fb_info *info = platform_get_drvdata(dev); | 1131 | struct fb_info *info = platform_get_drvdata(dev); |
1132 | struct da8xx_fb_par *par = info->par; | 1132 | struct da8xx_fb_par *par = info->par; |
1133 | 1133 | ||
1134 | acquire_console_sem(); | 1134 | console_lock(); |
1135 | if (par->panel_power_ctrl) | 1135 | if (par->panel_power_ctrl) |
1136 | par->panel_power_ctrl(0); | 1136 | par->panel_power_ctrl(0); |
1137 | 1137 | ||
1138 | fb_set_suspend(info, 1); | 1138 | fb_set_suspend(info, 1); |
1139 | lcd_disable_raster(); | 1139 | lcd_disable_raster(); |
1140 | clk_disable(par->lcdc_clk); | 1140 | clk_disable(par->lcdc_clk); |
1141 | release_console_sem(); | 1141 | console_unlock(); |
1142 | 1142 | ||
1143 | return 0; | 1143 | return 0; |
1144 | } | 1144 | } |
@@ -1147,14 +1147,14 @@ static int fb_resume(struct platform_device *dev) | |||
1147 | struct fb_info *info = platform_get_drvdata(dev); | 1147 | struct fb_info *info = platform_get_drvdata(dev); |
1148 | struct da8xx_fb_par *par = info->par; | 1148 | struct da8xx_fb_par *par = info->par; |
1149 | 1149 | ||
1150 | acquire_console_sem(); | 1150 | console_lock(); |
1151 | if (par->panel_power_ctrl) | 1151 | if (par->panel_power_ctrl) |
1152 | par->panel_power_ctrl(1); | 1152 | par->panel_power_ctrl(1); |
1153 | 1153 | ||
1154 | clk_enable(par->lcdc_clk); | 1154 | clk_enable(par->lcdc_clk); |
1155 | lcd_enable_raster(); | 1155 | lcd_enable_raster(); |
1156 | fb_set_suspend(info, 0); | 1156 | fb_set_suspend(info, 0); |
1157 | release_console_sem(); | 1157 | console_unlock(); |
1158 | 1158 | ||
1159 | return 0; | 1159 | return 0; |
1160 | } | 1160 | } |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 4ac1201ad6c..e2bf95370e4 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -1036,11 +1036,11 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
1036 | return -EFAULT; | 1036 | return -EFAULT; |
1037 | if (!lock_fb_info(info)) | 1037 | if (!lock_fb_info(info)) |
1038 | return -ENODEV; | 1038 | return -ENODEV; |
1039 | acquire_console_sem(); | 1039 | console_lock(); |
1040 | info->flags |= FBINFO_MISC_USEREVENT; | 1040 | info->flags |= FBINFO_MISC_USEREVENT; |
1041 | ret = fb_set_var(info, &var); | 1041 | ret = fb_set_var(info, &var); |
1042 | info->flags &= ~FBINFO_MISC_USEREVENT; | 1042 | info->flags &= ~FBINFO_MISC_USEREVENT; |
1043 | release_console_sem(); | 1043 | console_unlock(); |
1044 | unlock_fb_info(info); | 1044 | unlock_fb_info(info); |
1045 | if (!ret && copy_to_user(argp, &var, sizeof(var))) | 1045 | if (!ret && copy_to_user(argp, &var, sizeof(var))) |
1046 | ret = -EFAULT; | 1046 | ret = -EFAULT; |
@@ -1072,9 +1072,9 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
1072 | return -EFAULT; | 1072 | return -EFAULT; |
1073 | if (!lock_fb_info(info)) | 1073 | if (!lock_fb_info(info)) |
1074 | return -ENODEV; | 1074 | return -ENODEV; |
1075 | acquire_console_sem(); | 1075 | console_lock(); |
1076 | ret = fb_pan_display(info, &var); | 1076 | ret = fb_pan_display(info, &var); |
1077 | release_console_sem(); | 1077 | console_unlock(); |
1078 | unlock_fb_info(info); | 1078 | unlock_fb_info(info); |
1079 | if (ret == 0 && copy_to_user(argp, &var, sizeof(var))) | 1079 | if (ret == 0 && copy_to_user(argp, &var, sizeof(var))) |
1080 | return -EFAULT; | 1080 | return -EFAULT; |
@@ -1119,11 +1119,11 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
1119 | case FBIOBLANK: | 1119 | case FBIOBLANK: |
1120 | if (!lock_fb_info(info)) | 1120 | if (!lock_fb_info(info)) |
1121 | return -ENODEV; | 1121 | return -ENODEV; |
1122 | acquire_console_sem(); | 1122 | console_lock(); |
1123 | info->flags |= FBINFO_MISC_USEREVENT; | 1123 | info->flags |= FBINFO_MISC_USEREVENT; |
1124 | ret = fb_blank(info, arg); | 1124 | ret = fb_blank(info, arg); |
1125 | info->flags &= ~FBINFO_MISC_USEREVENT; | 1125 | info->flags &= ~FBINFO_MISC_USEREVENT; |
1126 | release_console_sem(); | 1126 | console_unlock(); |
1127 | unlock_fb_info(info); | 1127 | unlock_fb_info(info); |
1128 | break; | 1128 | break; |
1129 | default: | 1129 | default: |
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c index 0a08f134122..f4a32779168 100644 --- a/drivers/video/fbsysfs.c +++ b/drivers/video/fbsysfs.c | |||
@@ -90,11 +90,11 @@ static int activate(struct fb_info *fb_info, struct fb_var_screeninfo *var) | |||
90 | int err; | 90 | int err; |
91 | 91 | ||
92 | var->activate |= FB_ACTIVATE_FORCE; | 92 | var->activate |= FB_ACTIVATE_FORCE; |
93 | acquire_console_sem(); | 93 | console_lock(); |
94 | fb_info->flags |= FBINFO_MISC_USEREVENT; | 94 | fb_info->flags |= FBINFO_MISC_USEREVENT; |
95 | err = fb_set_var(fb_info, var); | 95 | err = fb_set_var(fb_info, var); |
96 | fb_info->flags &= ~FBINFO_MISC_USEREVENT; | 96 | fb_info->flags &= ~FBINFO_MISC_USEREVENT; |
97 | release_console_sem(); | 97 | console_unlock(); |
98 | if (err) | 98 | if (err) |
99 | return err; | 99 | return err; |
100 | return 0; | 100 | return 0; |
@@ -175,7 +175,7 @@ static ssize_t store_modes(struct device *device, | |||
175 | if (i * sizeof(struct fb_videomode) != count) | 175 | if (i * sizeof(struct fb_videomode) != count) |
176 | return -EINVAL; | 176 | return -EINVAL; |
177 | 177 | ||
178 | acquire_console_sem(); | 178 | console_lock(); |
179 | list_splice(&fb_info->modelist, &old_list); | 179 | list_splice(&fb_info->modelist, &old_list); |
180 | fb_videomode_to_modelist((const struct fb_videomode *)buf, i, | 180 | fb_videomode_to_modelist((const struct fb_videomode *)buf, i, |
181 | &fb_info->modelist); | 181 | &fb_info->modelist); |
@@ -185,7 +185,7 @@ static ssize_t store_modes(struct device *device, | |||
185 | } else | 185 | } else |
186 | fb_destroy_modelist(&old_list); | 186 | fb_destroy_modelist(&old_list); |
187 | 187 | ||
188 | release_console_sem(); | 188 | console_unlock(); |
189 | 189 | ||
190 | return 0; | 190 | return 0; |
191 | } | 191 | } |
@@ -301,11 +301,11 @@ static ssize_t store_blank(struct device *device, | |||
301 | char *last = NULL; | 301 | char *last = NULL; |
302 | int err; | 302 | int err; |
303 | 303 | ||
304 | acquire_console_sem(); | 304 | console_lock(); |
305 | fb_info->flags |= FBINFO_MISC_USEREVENT; | 305 | fb_info->flags |= FBINFO_MISC_USEREVENT; |
306 | err = fb_blank(fb_info, simple_strtoul(buf, &last, 0)); | 306 | err = fb_blank(fb_info, simple_strtoul(buf, &last, 0)); |
307 | fb_info->flags &= ~FBINFO_MISC_USEREVENT; | 307 | fb_info->flags &= ~FBINFO_MISC_USEREVENT; |
308 | release_console_sem(); | 308 | console_unlock(); |
309 | if (err < 0) | 309 | if (err < 0) |
310 | return err; | 310 | return err; |
311 | return count; | 311 | return count; |
@@ -364,9 +364,9 @@ static ssize_t store_pan(struct device *device, | |||
364 | return -EINVAL; | 364 | return -EINVAL; |
365 | var.yoffset = simple_strtoul(last, &last, 0); | 365 | var.yoffset = simple_strtoul(last, &last, 0); |
366 | 366 | ||
367 | acquire_console_sem(); | 367 | console_lock(); |
368 | err = fb_pan_display(fb_info, &var); | 368 | err = fb_pan_display(fb_info, &var); |
369 | release_console_sem(); | 369 | console_unlock(); |
370 | 370 | ||
371 | if (err < 0) | 371 | if (err < 0) |
372 | return err; | 372 | return err; |
@@ -399,9 +399,9 @@ static ssize_t store_fbstate(struct device *device, | |||
399 | 399 | ||
400 | state = simple_strtoul(buf, &last, 0); | 400 | state = simple_strtoul(buf, &last, 0); |
401 | 401 | ||
402 | acquire_console_sem(); | 402 | console_lock(); |
403 | fb_set_suspend(fb_info, (int)state); | 403 | fb_set_suspend(fb_info, (int)state); |
404 | release_console_sem(); | 404 | console_unlock(); |
405 | 405 | ||
406 | return count; | 406 | return count; |
407 | } | 407 | } |
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c index 70b1d9d51c9..b4f19db9bb5 100644 --- a/drivers/video/geode/gxfb_core.c +++ b/drivers/video/geode/gxfb_core.c | |||
@@ -344,10 +344,10 @@ static int gxfb_suspend(struct pci_dev *pdev, pm_message_t state) | |||
344 | struct fb_info *info = pci_get_drvdata(pdev); | 344 | struct fb_info *info = pci_get_drvdata(pdev); |
345 | 345 | ||
346 | if (state.event == PM_EVENT_SUSPEND) { | 346 | if (state.event == PM_EVENT_SUSPEND) { |
347 | acquire_console_sem(); | 347 | console_lock(); |
348 | gx_powerdown(info); | 348 | gx_powerdown(info); |
349 | fb_set_suspend(info, 1); | 349 | fb_set_suspend(info, 1); |
350 | release_console_sem(); | 350 | console_unlock(); |
351 | } | 351 | } |
352 | 352 | ||
353 | /* there's no point in setting PCI states; we emulate PCI, so | 353 | /* there's no point in setting PCI states; we emulate PCI, so |
@@ -361,7 +361,7 @@ static int gxfb_resume(struct pci_dev *pdev) | |||
361 | struct fb_info *info = pci_get_drvdata(pdev); | 361 | struct fb_info *info = pci_get_drvdata(pdev); |
362 | int ret; | 362 | int ret; |
363 | 363 | ||
364 | acquire_console_sem(); | 364 | console_lock(); |
365 | ret = gx_powerup(info); | 365 | ret = gx_powerup(info); |
366 | if (ret) { | 366 | if (ret) { |
367 | printk(KERN_ERR "gxfb: power up failed!\n"); | 367 | printk(KERN_ERR "gxfb: power up failed!\n"); |
@@ -369,7 +369,7 @@ static int gxfb_resume(struct pci_dev *pdev) | |||
369 | } | 369 | } |
370 | 370 | ||
371 | fb_set_suspend(info, 0); | 371 | fb_set_suspend(info, 0); |
372 | release_console_sem(); | 372 | console_unlock(); |
373 | return 0; | 373 | return 0; |
374 | } | 374 | } |
375 | #endif | 375 | #endif |
diff --git a/drivers/video/geode/lxfb_core.c b/drivers/video/geode/lxfb_core.c index 39bdbedf43b..416851ca875 100644 --- a/drivers/video/geode/lxfb_core.c +++ b/drivers/video/geode/lxfb_core.c | |||
@@ -465,10 +465,10 @@ static int lxfb_suspend(struct pci_dev *pdev, pm_message_t state) | |||
465 | struct fb_info *info = pci_get_drvdata(pdev); | 465 | struct fb_info *info = pci_get_drvdata(pdev); |
466 | 466 | ||
467 | if (state.event == PM_EVENT_SUSPEND) { | 467 | if (state.event == PM_EVENT_SUSPEND) { |
468 | acquire_console_sem(); | 468 | console_lock(); |
469 | lx_powerdown(info); | 469 | lx_powerdown(info); |
470 | fb_set_suspend(info, 1); | 470 | fb_set_suspend(info, 1); |
471 | release_console_sem(); | 471 | console_unlock(); |
472 | } | 472 | } |
473 | 473 | ||
474 | /* there's no point in setting PCI states; we emulate PCI, so | 474 | /* there's no point in setting PCI states; we emulate PCI, so |
@@ -482,7 +482,7 @@ static int lxfb_resume(struct pci_dev *pdev) | |||
482 | struct fb_info *info = pci_get_drvdata(pdev); | 482 | struct fb_info *info = pci_get_drvdata(pdev); |
483 | int ret; | 483 | int ret; |
484 | 484 | ||
485 | acquire_console_sem(); | 485 | console_lock(); |
486 | ret = lx_powerup(info); | 486 | ret = lx_powerup(info); |
487 | if (ret) { | 487 | if (ret) { |
488 | printk(KERN_ERR "lxfb: power up failed!\n"); | 488 | printk(KERN_ERR "lxfb: power up failed!\n"); |
@@ -490,7 +490,7 @@ static int lxfb_resume(struct pci_dev *pdev) | |||
490 | } | 490 | } |
491 | 491 | ||
492 | fb_set_suspend(info, 0); | 492 | fb_set_suspend(info, 0); |
493 | release_console_sem(); | 493 | console_unlock(); |
494 | return 0; | 494 | return 0; |
495 | } | 495 | } |
496 | #else | 496 | #else |
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c index 5743ea25e81..318f6fb895b 100644 --- a/drivers/video/i810/i810_main.c +++ b/drivers/video/i810/i810_main.c | |||
@@ -1574,7 +1574,7 @@ static int i810fb_suspend(struct pci_dev *dev, pm_message_t mesg) | |||
1574 | return 0; | 1574 | return 0; |
1575 | } | 1575 | } |
1576 | 1576 | ||
1577 | acquire_console_sem(); | 1577 | console_lock(); |
1578 | fb_set_suspend(info, 1); | 1578 | fb_set_suspend(info, 1); |
1579 | 1579 | ||
1580 | if (info->fbops->fb_sync) | 1580 | if (info->fbops->fb_sync) |
@@ -1587,7 +1587,7 @@ static int i810fb_suspend(struct pci_dev *dev, pm_message_t mesg) | |||
1587 | pci_save_state(dev); | 1587 | pci_save_state(dev); |
1588 | pci_disable_device(dev); | 1588 | pci_disable_device(dev); |
1589 | pci_set_power_state(dev, pci_choose_state(dev, mesg)); | 1589 | pci_set_power_state(dev, pci_choose_state(dev, mesg)); |
1590 | release_console_sem(); | 1590 | console_unlock(); |
1591 | 1591 | ||
1592 | return 0; | 1592 | return 0; |
1593 | } | 1593 | } |
@@ -1605,7 +1605,7 @@ static int i810fb_resume(struct pci_dev *dev) | |||
1605 | return 0; | 1605 | return 0; |
1606 | } | 1606 | } |
1607 | 1607 | ||
1608 | acquire_console_sem(); | 1608 | console_lock(); |
1609 | pci_set_power_state(dev, PCI_D0); | 1609 | pci_set_power_state(dev, PCI_D0); |
1610 | pci_restore_state(dev); | 1610 | pci_restore_state(dev); |
1611 | 1611 | ||
@@ -1621,7 +1621,7 @@ static int i810fb_resume(struct pci_dev *dev) | |||
1621 | fb_set_suspend (info, 0); | 1621 | fb_set_suspend (info, 0); |
1622 | info->fbops->fb_blank(VESA_NO_BLANKING, info); | 1622 | info->fbops->fb_blank(VESA_NO_BLANKING, info); |
1623 | fail: | 1623 | fail: |
1624 | release_console_sem(); | 1624 | console_unlock(); |
1625 | return 0; | 1625 | return 0; |
1626 | } | 1626 | } |
1627 | /*********************************************************************** | 1627 | /*********************************************************************** |
diff --git a/drivers/video/jz4740_fb.c b/drivers/video/jz4740_fb.c index 670ecaa0385..de366937c93 100644 --- a/drivers/video/jz4740_fb.c +++ b/drivers/video/jz4740_fb.c | |||
@@ -778,9 +778,9 @@ static int jzfb_suspend(struct device *dev) | |||
778 | { | 778 | { |
779 | struct jzfb *jzfb = dev_get_drvdata(dev); | 779 | struct jzfb *jzfb = dev_get_drvdata(dev); |
780 | 780 | ||
781 | acquire_console_sem(); | 781 | console_lock(); |
782 | fb_set_suspend(jzfb->fb, 1); | 782 | fb_set_suspend(jzfb->fb, 1); |
783 | release_console_sem(); | 783 | console_unlock(); |
784 | 784 | ||
785 | mutex_lock(&jzfb->lock); | 785 | mutex_lock(&jzfb->lock); |
786 | if (jzfb->is_enabled) | 786 | if (jzfb->is_enabled) |
@@ -800,9 +800,9 @@ static int jzfb_resume(struct device *dev) | |||
800 | jzfb_enable(jzfb); | 800 | jzfb_enable(jzfb); |
801 | mutex_unlock(&jzfb->lock); | 801 | mutex_unlock(&jzfb->lock); |
802 | 802 | ||
803 | acquire_console_sem(); | 803 | console_lock(); |
804 | fb_set_suspend(jzfb->fb, 0); | 804 | fb_set_suspend(jzfb->fb, 0); |
805 | release_console_sem(); | 805 | console_unlock(); |
806 | 806 | ||
807 | return 0; | 807 | return 0; |
808 | } | 808 | } |
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c index cb013919e9c..7e3a490e8d7 100644 --- a/drivers/video/mx3fb.c +++ b/drivers/video/mx3fb.c | |||
@@ -1177,9 +1177,9 @@ static int mx3fb_suspend(struct platform_device *pdev, pm_message_t state) | |||
1177 | struct mx3fb_data *mx3fb = platform_get_drvdata(pdev); | 1177 | struct mx3fb_data *mx3fb = platform_get_drvdata(pdev); |
1178 | struct mx3fb_info *mx3_fbi = mx3fb->fbi->par; | 1178 | struct mx3fb_info *mx3_fbi = mx3fb->fbi->par; |
1179 | 1179 | ||
1180 | acquire_console_sem(); | 1180 | console_lock(); |
1181 | fb_set_suspend(mx3fb->fbi, 1); | 1181 | fb_set_suspend(mx3fb->fbi, 1); |
1182 | release_console_sem(); | 1182 | console_unlock(); |
1183 | 1183 | ||
1184 | if (mx3_fbi->blank == FB_BLANK_UNBLANK) { | 1184 | if (mx3_fbi->blank == FB_BLANK_UNBLANK) { |
1185 | sdc_disable_channel(mx3_fbi); | 1185 | sdc_disable_channel(mx3_fbi); |
@@ -1202,9 +1202,9 @@ static int mx3fb_resume(struct platform_device *pdev) | |||
1202 | sdc_set_brightness(mx3fb, mx3fb->backlight_level); | 1202 | sdc_set_brightness(mx3fb, mx3fb->backlight_level); |
1203 | } | 1203 | } |
1204 | 1204 | ||
1205 | acquire_console_sem(); | 1205 | console_lock(); |
1206 | fb_set_suspend(mx3fb->fbi, 0); | 1206 | fb_set_suspend(mx3fb->fbi, 0); |
1207 | release_console_sem(); | 1207 | console_unlock(); |
1208 | 1208 | ||
1209 | return 0; | 1209 | return 0; |
1210 | } | 1210 | } |
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c index efe10ff86d6..081dc474527 100644 --- a/drivers/video/nvidia/nvidia.c +++ b/drivers/video/nvidia/nvidia.c | |||
@@ -1057,7 +1057,7 @@ static int nvidiafb_suspend(struct pci_dev *dev, pm_message_t mesg) | |||
1057 | 1057 | ||
1058 | if (mesg.event == PM_EVENT_PRETHAW) | 1058 | if (mesg.event == PM_EVENT_PRETHAW) |
1059 | mesg.event = PM_EVENT_FREEZE; | 1059 | mesg.event = PM_EVENT_FREEZE; |
1060 | acquire_console_sem(); | 1060 | console_lock(); |
1061 | par->pm_state = mesg.event; | 1061 | par->pm_state = mesg.event; |
1062 | 1062 | ||
1063 | if (mesg.event & PM_EVENT_SLEEP) { | 1063 | if (mesg.event & PM_EVENT_SLEEP) { |
@@ -1070,7 +1070,7 @@ static int nvidiafb_suspend(struct pci_dev *dev, pm_message_t mesg) | |||
1070 | } | 1070 | } |
1071 | dev->dev.power.power_state = mesg; | 1071 | dev->dev.power.power_state = mesg; |
1072 | 1072 | ||
1073 | release_console_sem(); | 1073 | console_unlock(); |
1074 | return 0; | 1074 | return 0; |
1075 | } | 1075 | } |
1076 | 1076 | ||
@@ -1079,7 +1079,7 @@ static int nvidiafb_resume(struct pci_dev *dev) | |||
1079 | struct fb_info *info = pci_get_drvdata(dev); | 1079 | struct fb_info *info = pci_get_drvdata(dev); |
1080 | struct nvidia_par *par = info->par; | 1080 | struct nvidia_par *par = info->par; |
1081 | 1081 | ||
1082 | acquire_console_sem(); | 1082 | console_lock(); |
1083 | pci_set_power_state(dev, PCI_D0); | 1083 | pci_set_power_state(dev, PCI_D0); |
1084 | 1084 | ||
1085 | if (par->pm_state != PM_EVENT_FREEZE) { | 1085 | if (par->pm_state != PM_EVENT_FREEZE) { |
@@ -1097,7 +1097,7 @@ static int nvidiafb_resume(struct pci_dev *dev) | |||
1097 | nvidiafb_blank(FB_BLANK_UNBLANK, info); | 1097 | nvidiafb_blank(FB_BLANK_UNBLANK, info); |
1098 | 1098 | ||
1099 | fail: | 1099 | fail: |
1100 | release_console_sem(); | 1100 | console_unlock(); |
1101 | return 0; | 1101 | return 0; |
1102 | } | 1102 | } |
1103 | #else | 1103 | #else |
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c index 9c0144ee7ae..65560a1a043 100644 --- a/drivers/video/ps3fb.c +++ b/drivers/video/ps3fb.c | |||
@@ -513,9 +513,9 @@ static int ps3fb_release(struct fb_info *info, int user) | |||
513 | if (atomic_dec_and_test(&ps3fb.f_count)) { | 513 | if (atomic_dec_and_test(&ps3fb.f_count)) { |
514 | if (atomic_read(&ps3fb.ext_flip)) { | 514 | if (atomic_read(&ps3fb.ext_flip)) { |
515 | atomic_set(&ps3fb.ext_flip, 0); | 515 | atomic_set(&ps3fb.ext_flip, 0); |
516 | if (!try_acquire_console_sem()) { | 516 | if (console_trylock()) { |
517 | ps3fb_sync(info, 0); /* single buffer */ | 517 | ps3fb_sync(info, 0); /* single buffer */ |
518 | release_console_sem(); | 518 | console_unlock(); |
519 | } | 519 | } |
520 | } | 520 | } |
521 | } | 521 | } |
@@ -830,14 +830,14 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
830 | if (vmode) { | 830 | if (vmode) { |
831 | var = info->var; | 831 | var = info->var; |
832 | fb_videomode_to_var(&var, vmode); | 832 | fb_videomode_to_var(&var, vmode); |
833 | acquire_console_sem(); | 833 | console_lock(); |
834 | info->flags |= FBINFO_MISC_USEREVENT; | 834 | info->flags |= FBINFO_MISC_USEREVENT; |
835 | /* Force, in case only special bits changed */ | 835 | /* Force, in case only special bits changed */ |
836 | var.activate |= FB_ACTIVATE_FORCE; | 836 | var.activate |= FB_ACTIVATE_FORCE; |
837 | par->new_mode_id = val; | 837 | par->new_mode_id = val; |
838 | retval = fb_set_var(info, &var); | 838 | retval = fb_set_var(info, &var); |
839 | info->flags &= ~FBINFO_MISC_USEREVENT; | 839 | info->flags &= ~FBINFO_MISC_USEREVENT; |
840 | release_console_sem(); | 840 | console_unlock(); |
841 | } | 841 | } |
842 | break; | 842 | break; |
843 | } | 843 | } |
@@ -881,9 +881,9 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd, | |||
881 | break; | 881 | break; |
882 | 882 | ||
883 | dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val); | 883 | dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val); |
884 | acquire_console_sem(); | 884 | console_lock(); |
885 | retval = ps3fb_sync(info, val); | 885 | retval = ps3fb_sync(info, val); |
886 | release_console_sem(); | 886 | console_unlock(); |
887 | break; | 887 | break; |
888 | 888 | ||
889 | default: | 889 | default: |
@@ -903,9 +903,9 @@ static int ps3fbd(void *arg) | |||
903 | set_current_state(TASK_INTERRUPTIBLE); | 903 | set_current_state(TASK_INTERRUPTIBLE); |
904 | if (ps3fb.is_kicked) { | 904 | if (ps3fb.is_kicked) { |
905 | ps3fb.is_kicked = 0; | 905 | ps3fb.is_kicked = 0; |
906 | acquire_console_sem(); | 906 | console_lock(); |
907 | ps3fb_sync(info, 0); /* single buffer */ | 907 | ps3fb_sync(info, 0); /* single buffer */ |
908 | release_console_sem(); | 908 | console_unlock(); |
909 | } | 909 | } |
910 | schedule(); | 910 | schedule(); |
911 | } | 911 | } |
diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c index dce8c97b433..75738a92861 100644 --- a/drivers/video/s3fb.c +++ b/drivers/video/s3fb.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/svga.h> | 22 | #include <linux/svga.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
25 | #include <linux/console.h> /* Why should fb driver call console functions? because acquire_console_sem() */ | 25 | #include <linux/console.h> /* Why should fb driver call console functions? because console_lock() */ |
26 | #include <video/vga.h> | 26 | #include <video/vga.h> |
27 | 27 | ||
28 | #ifdef CONFIG_MTRR | 28 | #ifdef CONFIG_MTRR |
@@ -1113,12 +1113,12 @@ static int s3_pci_suspend(struct pci_dev* dev, pm_message_t state) | |||
1113 | 1113 | ||
1114 | dev_info(info->device, "suspend\n"); | 1114 | dev_info(info->device, "suspend\n"); |
1115 | 1115 | ||
1116 | acquire_console_sem(); | 1116 | console_lock(); |
1117 | mutex_lock(&(par->open_lock)); | 1117 | mutex_lock(&(par->open_lock)); |
1118 | 1118 | ||
1119 | if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) { | 1119 | if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) { |
1120 | mutex_unlock(&(par->open_lock)); | 1120 | mutex_unlock(&(par->open_lock)); |
1121 | release_console_sem(); | 1121 | console_unlock(); |
1122 | return 0; | 1122 | return 0; |
1123 | } | 1123 | } |
1124 | 1124 | ||
@@ -1129,7 +1129,7 @@ static int s3_pci_suspend(struct pci_dev* dev, pm_message_t state) | |||
1129 | pci_set_power_state(dev, pci_choose_state(dev, state)); | 1129 | pci_set_power_state(dev, pci_choose_state(dev, state)); |
1130 | 1130 | ||
1131 | mutex_unlock(&(par->open_lock)); | 1131 | mutex_unlock(&(par->open_lock)); |
1132 | release_console_sem(); | 1132 | console_unlock(); |
1133 | 1133 | ||
1134 | return 0; | 1134 | return 0; |
1135 | } | 1135 | } |
@@ -1145,12 +1145,12 @@ static int s3_pci_resume(struct pci_dev* dev) | |||
1145 | 1145 | ||
1146 | dev_info(info->device, "resume\n"); | 1146 | dev_info(info->device, "resume\n"); |
1147 | 1147 | ||
1148 | acquire_console_sem(); | 1148 | console_lock(); |
1149 | mutex_lock(&(par->open_lock)); | 1149 | mutex_lock(&(par->open_lock)); |
1150 | 1150 | ||
1151 | if (par->ref_count == 0) { | 1151 | if (par->ref_count == 0) { |
1152 | mutex_unlock(&(par->open_lock)); | 1152 | mutex_unlock(&(par->open_lock)); |
1153 | release_console_sem(); | 1153 | console_unlock(); |
1154 | return 0; | 1154 | return 0; |
1155 | } | 1155 | } |
1156 | 1156 | ||
@@ -1159,7 +1159,7 @@ static int s3_pci_resume(struct pci_dev* dev) | |||
1159 | err = pci_enable_device(dev); | 1159 | err = pci_enable_device(dev); |
1160 | if (err) { | 1160 | if (err) { |
1161 | mutex_unlock(&(par->open_lock)); | 1161 | mutex_unlock(&(par->open_lock)); |
1162 | release_console_sem(); | 1162 | console_unlock(); |
1163 | dev_err(info->device, "error %d enabling device for resume\n", err); | 1163 | dev_err(info->device, "error %d enabling device for resume\n", err); |
1164 | return err; | 1164 | return err; |
1165 | } | 1165 | } |
@@ -1169,7 +1169,7 @@ static int s3_pci_resume(struct pci_dev* dev) | |||
1169 | fb_set_suspend(info, 0); | 1169 | fb_set_suspend(info, 0); |
1170 | 1170 | ||
1171 | mutex_unlock(&(par->open_lock)); | 1171 | mutex_unlock(&(par->open_lock)); |
1172 | release_console_sem(); | 1172 | console_unlock(); |
1173 | 1173 | ||
1174 | return 0; | 1174 | return 0; |
1175 | } | 1175 | } |
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c index 842d157e102..487911e2926 100644 --- a/drivers/video/savage/savagefb_driver.c +++ b/drivers/video/savage/savagefb_driver.c | |||
@@ -2373,7 +2373,7 @@ static int savagefb_suspend(struct pci_dev *dev, pm_message_t mesg) | |||
2373 | if (mesg.event == PM_EVENT_FREEZE) | 2373 | if (mesg.event == PM_EVENT_FREEZE) |
2374 | return 0; | 2374 | return 0; |
2375 | 2375 | ||
2376 | acquire_console_sem(); | 2376 | console_lock(); |
2377 | fb_set_suspend(info, 1); | 2377 | fb_set_suspend(info, 1); |
2378 | 2378 | ||
2379 | if (info->fbops->fb_sync) | 2379 | if (info->fbops->fb_sync) |
@@ -2385,7 +2385,7 @@ static int savagefb_suspend(struct pci_dev *dev, pm_message_t mesg) | |||
2385 | pci_save_state(dev); | 2385 | pci_save_state(dev); |
2386 | pci_disable_device(dev); | 2386 | pci_disable_device(dev); |
2387 | pci_set_power_state(dev, pci_choose_state(dev, mesg)); | 2387 | pci_set_power_state(dev, pci_choose_state(dev, mesg)); |
2388 | release_console_sem(); | 2388 | console_unlock(); |
2389 | 2389 | ||
2390 | return 0; | 2390 | return 0; |
2391 | } | 2391 | } |
@@ -2409,7 +2409,7 @@ static int savagefb_resume(struct pci_dev* dev) | |||
2409 | return 0; | 2409 | return 0; |
2410 | } | 2410 | } |
2411 | 2411 | ||
2412 | acquire_console_sem(); | 2412 | console_lock(); |
2413 | 2413 | ||
2414 | pci_set_power_state(dev, PCI_D0); | 2414 | pci_set_power_state(dev, PCI_D0); |
2415 | pci_restore_state(dev); | 2415 | pci_restore_state(dev); |
@@ -2423,7 +2423,7 @@ static int savagefb_resume(struct pci_dev* dev) | |||
2423 | savagefb_set_par(info); | 2423 | savagefb_set_par(info); |
2424 | fb_set_suspend(info, 0); | 2424 | fb_set_suspend(info, 0); |
2425 | savagefb_blank(FB_BLANK_UNBLANK, info); | 2425 | savagefb_blank(FB_BLANK_UNBLANK, info); |
2426 | release_console_sem(); | 2426 | console_unlock(); |
2427 | 2427 | ||
2428 | return 0; | 2428 | return 0; |
2429 | } | 2429 | } |
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c index 74d9f546a2e..2b9e56a6bde 100644 --- a/drivers/video/sh_mobile_hdmi.c +++ b/drivers/video/sh_mobile_hdmi.c | |||
@@ -1151,7 +1151,7 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work) | |||
1151 | 1151 | ||
1152 | ch = info->par; | 1152 | ch = info->par; |
1153 | 1153 | ||
1154 | acquire_console_sem(); | 1154 | console_lock(); |
1155 | 1155 | ||
1156 | /* HDMI plug in */ | 1156 | /* HDMI plug in */ |
1157 | if (!sh_hdmi_must_reconfigure(hdmi) && | 1157 | if (!sh_hdmi_must_reconfigure(hdmi) && |
@@ -1171,7 +1171,7 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work) | |||
1171 | fb_set_suspend(info, 0); | 1171 | fb_set_suspend(info, 0); |
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | release_console_sem(); | 1174 | console_unlock(); |
1175 | } else { | 1175 | } else { |
1176 | ret = 0; | 1176 | ret = 0; |
1177 | if (!hdmi->info) | 1177 | if (!hdmi->info) |
@@ -1181,12 +1181,12 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work) | |||
1181 | fb_destroy_modedb(hdmi->monspec.modedb); | 1181 | fb_destroy_modedb(hdmi->monspec.modedb); |
1182 | hdmi->monspec.modedb = NULL; | 1182 | hdmi->monspec.modedb = NULL; |
1183 | 1183 | ||
1184 | acquire_console_sem(); | 1184 | console_lock(); |
1185 | 1185 | ||
1186 | /* HDMI disconnect */ | 1186 | /* HDMI disconnect */ |
1187 | fb_set_suspend(hdmi->info, 1); | 1187 | fb_set_suspend(hdmi->info, 1); |
1188 | 1188 | ||
1189 | release_console_sem(); | 1189 | console_unlock(); |
1190 | pm_runtime_put(hdmi->dev); | 1190 | pm_runtime_put(hdmi->dev); |
1191 | } | 1191 | } |
1192 | 1192 | ||
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index bd4840a8a6b..bf12e53aed5 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
@@ -912,9 +912,9 @@ static int sh_mobile_release(struct fb_info *info, int user) | |||
912 | 912 | ||
913 | /* Nothing to reconfigure, when called from fbcon */ | 913 | /* Nothing to reconfigure, when called from fbcon */ |
914 | if (user) { | 914 | if (user) { |
915 | acquire_console_sem(); | 915 | console_lock(); |
916 | sh_mobile_fb_reconfig(info); | 916 | sh_mobile_fb_reconfig(info); |
917 | release_console_sem(); | 917 | console_unlock(); |
918 | } | 918 | } |
919 | 919 | ||
920 | mutex_unlock(&ch->open_lock); | 920 | mutex_unlock(&ch->open_lock); |
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c index b7dc1800efa..bcb44a594eb 100644 --- a/drivers/video/sm501fb.c +++ b/drivers/video/sm501fb.c | |||
@@ -2010,9 +2010,9 @@ static int sm501fb_suspend_fb(struct sm501fb_info *info, | |||
2010 | 2010 | ||
2011 | /* tell console/fb driver we are suspending */ | 2011 | /* tell console/fb driver we are suspending */ |
2012 | 2012 | ||
2013 | acquire_console_sem(); | 2013 | console_lock(); |
2014 | fb_set_suspend(fbi, 1); | 2014 | fb_set_suspend(fbi, 1); |
2015 | release_console_sem(); | 2015 | console_unlock(); |
2016 | 2016 | ||
2017 | /* backup copies in case chip is powered down over suspend */ | 2017 | /* backup copies in case chip is powered down over suspend */ |
2018 | 2018 | ||
@@ -2069,9 +2069,9 @@ static void sm501fb_resume_fb(struct sm501fb_info *info, | |||
2069 | memcpy_toio(par->cursor.k_addr, par->store_cursor, | 2069 | memcpy_toio(par->cursor.k_addr, par->store_cursor, |
2070 | par->cursor.size); | 2070 | par->cursor.size); |
2071 | 2071 | ||
2072 | acquire_console_sem(); | 2072 | console_lock(); |
2073 | fb_set_suspend(fbi, 0); | 2073 | fb_set_suspend(fbi, 0); |
2074 | release_console_sem(); | 2074 | console_unlock(); |
2075 | 2075 | ||
2076 | vfree(par->store_fb); | 2076 | vfree(par->store_fb); |
2077 | vfree(par->store_cursor); | 2077 | vfree(par->store_cursor); |
diff --git a/drivers/video/tmiofb.c b/drivers/video/tmiofb.c index 6913fe168c2..dfef88c803d 100644 --- a/drivers/video/tmiofb.c +++ b/drivers/video/tmiofb.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/fb.h> | 25 | #include <linux/fb.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | /* Why should fb driver call console functions? because acquire_console_sem() */ | 28 | /* Why should fb driver call console functions? because console_lock() */ |
29 | #include <linux/console.h> | 29 | #include <linux/console.h> |
30 | #include <linux/mfd/core.h> | 30 | #include <linux/mfd/core.h> |
31 | #include <linux/mfd/tmio.h> | 31 | #include <linux/mfd/tmio.h> |
@@ -944,7 +944,7 @@ static int tmiofb_suspend(struct platform_device *dev, pm_message_t state) | |||
944 | struct mfd_cell *cell = dev->dev.platform_data; | 944 | struct mfd_cell *cell = dev->dev.platform_data; |
945 | int retval = 0; | 945 | int retval = 0; |
946 | 946 | ||
947 | acquire_console_sem(); | 947 | console_lock(); |
948 | 948 | ||
949 | fb_set_suspend(info, 1); | 949 | fb_set_suspend(info, 1); |
950 | 950 | ||
@@ -965,7 +965,7 @@ static int tmiofb_suspend(struct platform_device *dev, pm_message_t state) | |||
965 | if (cell->suspend) | 965 | if (cell->suspend) |
966 | retval = cell->suspend(dev); | 966 | retval = cell->suspend(dev); |
967 | 967 | ||
968 | release_console_sem(); | 968 | console_unlock(); |
969 | 969 | ||
970 | return retval; | 970 | return retval; |
971 | } | 971 | } |
@@ -976,7 +976,7 @@ static int tmiofb_resume(struct platform_device *dev) | |||
976 | struct mfd_cell *cell = dev->dev.platform_data; | 976 | struct mfd_cell *cell = dev->dev.platform_data; |
977 | int retval = 0; | 977 | int retval = 0; |
978 | 978 | ||
979 | acquire_console_sem(); | 979 | console_lock(); |
980 | 980 | ||
981 | if (cell->resume) { | 981 | if (cell->resume) { |
982 | retval = cell->resume(dev); | 982 | retval = cell->resume(dev); |
@@ -992,7 +992,7 @@ static int tmiofb_resume(struct platform_device *dev) | |||
992 | 992 | ||
993 | fb_set_suspend(info, 0); | 993 | fb_set_suspend(info, 0); |
994 | out: | 994 | out: |
995 | release_console_sem(); | 995 | console_unlock(); |
996 | return retval; | 996 | return retval; |
997 | } | 997 | } |
998 | #else | 998 | #else |
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index 289edd51952..4e66349e436 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c | |||
@@ -1674,17 +1674,17 @@ static int parse_mode(const char *str, u32 *xres, u32 *yres) | |||
1674 | #ifdef CONFIG_PM | 1674 | #ifdef CONFIG_PM |
1675 | static int viafb_suspend(void *unused) | 1675 | static int viafb_suspend(void *unused) |
1676 | { | 1676 | { |
1677 | acquire_console_sem(); | 1677 | console_lock(); |
1678 | fb_set_suspend(viafbinfo, 1); | 1678 | fb_set_suspend(viafbinfo, 1); |
1679 | viafb_sync(viafbinfo); | 1679 | viafb_sync(viafbinfo); |
1680 | release_console_sem(); | 1680 | console_unlock(); |
1681 | 1681 | ||
1682 | return 0; | 1682 | return 0; |
1683 | } | 1683 | } |
1684 | 1684 | ||
1685 | static int viafb_resume(void *unused) | 1685 | static int viafb_resume(void *unused) |
1686 | { | 1686 | { |
1687 | acquire_console_sem(); | 1687 | console_lock(); |
1688 | if (viaparinfo->shared->vdev->engine_mmio) | 1688 | if (viaparinfo->shared->vdev->engine_mmio) |
1689 | viafb_reset_engine(viaparinfo); | 1689 | viafb_reset_engine(viaparinfo); |
1690 | viafb_set_par(viafbinfo); | 1690 | viafb_set_par(viafbinfo); |
@@ -1692,7 +1692,7 @@ static int viafb_resume(void *unused) | |||
1692 | viafb_set_par(viafbinfo1); | 1692 | viafb_set_par(viafbinfo1); |
1693 | fb_set_suspend(viafbinfo, 0); | 1693 | fb_set_suspend(viafbinfo, 0); |
1694 | 1694 | ||
1695 | release_console_sem(); | 1695 | console_unlock(); |
1696 | return 0; | 1696 | return 0; |
1697 | } | 1697 | } |
1698 | 1698 | ||
diff --git a/drivers/video/vt8623fb.c b/drivers/video/vt8623fb.c index 85d76ec4c63..a2965ab92cf 100644 --- a/drivers/video/vt8623fb.c +++ b/drivers/video/vt8623fb.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <linux/svga.h> | 23 | #include <linux/svga.h> |
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <linux/console.h> /* Why should fb driver call console functions? because acquire_console_sem() */ | 26 | #include <linux/console.h> /* Why should fb driver call console functions? because console_lock() */ |
27 | #include <video/vga.h> | 27 | #include <video/vga.h> |
28 | 28 | ||
29 | #ifdef CONFIG_MTRR | 29 | #ifdef CONFIG_MTRR |
@@ -819,12 +819,12 @@ static int vt8623_pci_suspend(struct pci_dev* dev, pm_message_t state) | |||
819 | 819 | ||
820 | dev_info(info->device, "suspend\n"); | 820 | dev_info(info->device, "suspend\n"); |
821 | 821 | ||
822 | acquire_console_sem(); | 822 | console_lock(); |
823 | mutex_lock(&(par->open_lock)); | 823 | mutex_lock(&(par->open_lock)); |
824 | 824 | ||
825 | if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) { | 825 | if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) { |
826 | mutex_unlock(&(par->open_lock)); | 826 | mutex_unlock(&(par->open_lock)); |
827 | release_console_sem(); | 827 | console_unlock(); |
828 | return 0; | 828 | return 0; |
829 | } | 829 | } |
830 | 830 | ||
@@ -835,7 +835,7 @@ static int vt8623_pci_suspend(struct pci_dev* dev, pm_message_t state) | |||
835 | pci_set_power_state(dev, pci_choose_state(dev, state)); | 835 | pci_set_power_state(dev, pci_choose_state(dev, state)); |
836 | 836 | ||
837 | mutex_unlock(&(par->open_lock)); | 837 | mutex_unlock(&(par->open_lock)); |
838 | release_console_sem(); | 838 | console_unlock(); |
839 | 839 | ||
840 | return 0; | 840 | return 0; |
841 | } | 841 | } |
@@ -850,7 +850,7 @@ static int vt8623_pci_resume(struct pci_dev* dev) | |||
850 | 850 | ||
851 | dev_info(info->device, "resume\n"); | 851 | dev_info(info->device, "resume\n"); |
852 | 852 | ||
853 | acquire_console_sem(); | 853 | console_lock(); |
854 | mutex_lock(&(par->open_lock)); | 854 | mutex_lock(&(par->open_lock)); |
855 | 855 | ||
856 | if (par->ref_count == 0) | 856 | if (par->ref_count == 0) |
@@ -869,7 +869,7 @@ static int vt8623_pci_resume(struct pci_dev* dev) | |||
869 | 869 | ||
870 | fail: | 870 | fail: |
871 | mutex_unlock(&(par->open_lock)); | 871 | mutex_unlock(&(par->open_lock)); |
872 | release_console_sem(); | 872 | console_unlock(); |
873 | 873 | ||
874 | return 0; | 874 | return 0; |
875 | } | 875 | } |
diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c index 3e6934d4bea..a20218c2fda 100644 --- a/drivers/video/xen-fbfront.c +++ b/drivers/video/xen-fbfront.c | |||
@@ -491,12 +491,12 @@ xenfb_make_preferred_console(void) | |||
491 | if (console_set_on_cmdline) | 491 | if (console_set_on_cmdline) |
492 | return; | 492 | return; |
493 | 493 | ||
494 | acquire_console_sem(); | 494 | console_lock(); |
495 | for_each_console(c) { | 495 | for_each_console(c) { |
496 | if (!strcmp(c->name, "tty") && c->index == 0) | 496 | if (!strcmp(c->name, "tty") && c->index == 0) |
497 | break; | 497 | break; |
498 | } | 498 | } |
499 | release_console_sem(); | 499 | console_unlock(); |
500 | if (c) { | 500 | if (c) { |
501 | unregister_console(c); | 501 | unregister_console(c); |
502 | c->flags |= CON_CONSDEV; | 502 | c->flags |= CON_CONSDEV; |
diff --git a/fs/proc/consoles.c b/fs/proc/consoles.c index eafc22ab1fd..b701eaa482b 100644 --- a/fs/proc/consoles.c +++ b/fs/proc/consoles.c | |||
@@ -67,7 +67,7 @@ static void *c_start(struct seq_file *m, loff_t *pos) | |||
67 | struct console *con; | 67 | struct console *con; |
68 | loff_t off = 0; | 68 | loff_t off = 0; |
69 | 69 | ||
70 | acquire_console_sem(); | 70 | console_lock(); |
71 | for_each_console(con) | 71 | for_each_console(con) |
72 | if (off++ == *pos) | 72 | if (off++ == *pos) |
73 | break; | 73 | break; |
@@ -84,7 +84,7 @@ static void *c_next(struct seq_file *m, void *v, loff_t *pos) | |||
84 | 84 | ||
85 | static void c_stop(struct seq_file *m, void *v) | 85 | static void c_stop(struct seq_file *m, void *v) |
86 | { | 86 | { |
87 | release_console_sem(); | 87 | console_unlock(); |
88 | } | 88 | } |
89 | 89 | ||
90 | static const struct seq_operations consoles_op = { | 90 | static const struct seq_operations consoles_op = { |
diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c index 2fb2882f0fa..8ab48bc2fa7 100644 --- a/fs/squashfs/block.c +++ b/fs/squashfs/block.c | |||
@@ -63,6 +63,14 @@ static struct buffer_head *get_block_length(struct super_block *sb, | |||
63 | *length = (unsigned char) bh->b_data[*offset] | | 63 | *length = (unsigned char) bh->b_data[*offset] | |
64 | (unsigned char) bh->b_data[*offset + 1] << 8; | 64 | (unsigned char) bh->b_data[*offset + 1] << 8; |
65 | *offset += 2; | 65 | *offset += 2; |
66 | |||
67 | if (*offset == msblk->devblksize) { | ||
68 | put_bh(bh); | ||
69 | bh = sb_bread(sb, ++(*cur_index)); | ||
70 | if (bh == NULL) | ||
71 | return NULL; | ||
72 | *offset = 0; | ||
73 | } | ||
66 | } | 74 | } |
67 | 75 | ||
68 | return bh; | 76 | return bh; |
diff --git a/fs/squashfs/xz_wrapper.c b/fs/squashfs/xz_wrapper.c index 856756ca5ee..c4eb4001825 100644 --- a/fs/squashfs/xz_wrapper.c +++ b/fs/squashfs/xz_wrapper.c | |||
@@ -95,12 +95,6 @@ static int squashfs_xz_uncompress(struct squashfs_sb_info *msblk, void **buffer, | |||
95 | if (!buffer_uptodate(bh[k])) | 95 | if (!buffer_uptodate(bh[k])) |
96 | goto release_mutex; | 96 | goto release_mutex; |
97 | 97 | ||
98 | if (avail == 0) { | ||
99 | offset = 0; | ||
100 | put_bh(bh[k++]); | ||
101 | continue; | ||
102 | } | ||
103 | |||
104 | stream->buf.in = bh[k]->b_data + offset; | 98 | stream->buf.in = bh[k]->b_data + offset; |
105 | stream->buf.in_size = avail; | 99 | stream->buf.in_size = avail; |
106 | stream->buf.in_pos = 0; | 100 | stream->buf.in_pos = 0; |
diff --git a/fs/squashfs/zlib_wrapper.c b/fs/squashfs/zlib_wrapper.c index 818a5e063fa..4661ae2b1ce 100644 --- a/fs/squashfs/zlib_wrapper.c +++ b/fs/squashfs/zlib_wrapper.c | |||
@@ -82,12 +82,6 @@ static int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, | |||
82 | if (!buffer_uptodate(bh[k])) | 82 | if (!buffer_uptodate(bh[k])) |
83 | goto release_mutex; | 83 | goto release_mutex; |
84 | 84 | ||
85 | if (avail == 0) { | ||
86 | offset = 0; | ||
87 | put_bh(bh[k++]); | ||
88 | continue; | ||
89 | } | ||
90 | |||
91 | stream->next_in = bh[k]->b_data + offset; | 85 | stream->next_in = bh[k]->b_data + offset; |
92 | stream->avail_in = avail; | 86 | stream->avail_in = avail; |
93 | offset = 0; | 87 | offset = 0; |
diff --git a/include/linux/console.h b/include/linux/console.h index 9774fe6a1a9..7453cfd593c 100644 --- a/include/linux/console.h +++ b/include/linux/console.h | |||
@@ -139,9 +139,9 @@ extern int update_console_cmdline(char *name, int idx, char *name_new, int idx_n | |||
139 | extern void register_console(struct console *); | 139 | extern void register_console(struct console *); |
140 | extern int unregister_console(struct console *); | 140 | extern int unregister_console(struct console *); |
141 | extern struct console *console_drivers; | 141 | extern struct console *console_drivers; |
142 | extern void acquire_console_sem(void); | 142 | extern void console_lock(void); |
143 | extern int try_acquire_console_sem(void); | 143 | extern int console_trylock(void); |
144 | extern void release_console_sem(void); | 144 | extern void console_unlock(void); |
145 | extern void console_conditional_schedule(void); | 145 | extern void console_conditional_schedule(void); |
146 | extern void console_unblank(void); | 146 | extern void console_unblank(void); |
147 | extern struct tty_driver *console_device(int *); | 147 | extern struct tty_driver *console_device(int *); |
diff --git a/include/linux/input/bu21013.h b/include/linux/input/bu21013.h index e470d387dd4..05e03284b92 100644 --- a/include/linux/input/bu21013.h +++ b/include/linux/input/bu21013.h | |||
@@ -12,8 +12,6 @@ | |||
12 | * @cs_en: pointer to the cs enable function | 12 | * @cs_en: pointer to the cs enable function |
13 | * @cs_dis: pointer to the cs disable function | 13 | * @cs_dis: pointer to the cs disable function |
14 | * @irq_read_val: pointer to read the pen irq value function | 14 | * @irq_read_val: pointer to read the pen irq value function |
15 | * @x_max_res: xmax resolution | ||
16 | * @y_max_res: ymax resolution | ||
17 | * @touch_x_max: touch x max | 15 | * @touch_x_max: touch x max |
18 | * @touch_y_max: touch y max | 16 | * @touch_y_max: touch y max |
19 | * @cs_pin: chip select pin | 17 | * @cs_pin: chip select pin |
@@ -29,8 +27,6 @@ struct bu21013_platform_device { | |||
29 | int (*cs_en)(int reset_pin); | 27 | int (*cs_en)(int reset_pin); |
30 | int (*cs_dis)(int reset_pin); | 28 | int (*cs_dis)(int reset_pin); |
31 | int (*irq_read_val)(void); | 29 | int (*irq_read_val)(void); |
32 | int x_max_res; | ||
33 | int y_max_res; | ||
34 | int touch_x_max; | 30 | int touch_x_max; |
35 | int touch_y_max; | 31 | int touch_y_max; |
36 | unsigned int cs_pin; | 32 | unsigned int cs_pin; |
diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h index 387fa7d05c9..7faf933cced 100644 --- a/include/linux/sysrq.h +++ b/include/linux/sysrq.h | |||
@@ -17,6 +17,9 @@ | |||
17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
18 | #include <linux/types.h> | 18 | #include <linux/types.h> |
19 | 19 | ||
20 | /* Enable/disable SYSRQ support by default (0==no, 1==yes). */ | ||
21 | #define SYSRQ_DEFAULT_ENABLE 1 | ||
22 | |||
20 | /* Possible values of bitmask for enabling sysrq functions */ | 23 | /* Possible values of bitmask for enabling sysrq functions */ |
21 | /* 0x0001 is reserved for enable everything */ | 24 | /* 0x0001 is reserved for enable everything */ |
22 | #define SYSRQ_ENABLE_LOG 0x0002 | 25 | #define SYSRQ_ENABLE_LOG 0x0002 |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index a29feb01854..d2cf8840769 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -184,6 +184,7 @@ struct hci_conn { | |||
184 | __u32 link_mode; | 184 | __u32 link_mode; |
185 | __u8 auth_type; | 185 | __u8 auth_type; |
186 | __u8 sec_level; | 186 | __u8 sec_level; |
187 | __u8 pending_sec_level; | ||
187 | __u8 power_save; | 188 | __u8 power_save; |
188 | __u16 disc_timeout; | 189 | __u16 disc_timeout; |
189 | unsigned long pend; | 190 | unsigned long pend; |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index e9eee99d8b1..160a407c196 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -445,7 +445,6 @@ static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, | |||
445 | { | 445 | { |
446 | __skb_queue_tail(list, skb); | 446 | __skb_queue_tail(list, skb); |
447 | sch->qstats.backlog += qdisc_pkt_len(skb); | 447 | sch->qstats.backlog += qdisc_pkt_len(skb); |
448 | qdisc_bstats_update(sch, skb); | ||
449 | 448 | ||
450 | return NET_XMIT_SUCCESS; | 449 | return NET_XMIT_SUCCESS; |
451 | } | 450 | } |
@@ -460,8 +459,10 @@ static inline struct sk_buff *__qdisc_dequeue_head(struct Qdisc *sch, | |||
460 | { | 459 | { |
461 | struct sk_buff *skb = __skb_dequeue(list); | 460 | struct sk_buff *skb = __skb_dequeue(list); |
462 | 461 | ||
463 | if (likely(skb != NULL)) | 462 | if (likely(skb != NULL)) { |
464 | sch->qstats.backlog -= qdisc_pkt_len(skb); | 463 | sch->qstats.backlog -= qdisc_pkt_len(skb); |
464 | qdisc_bstats_update(sch, skb); | ||
465 | } | ||
465 | 466 | ||
466 | return skb; | 467 | return skb; |
467 | } | 468 | } |
@@ -474,10 +475,11 @@ static inline struct sk_buff *qdisc_dequeue_head(struct Qdisc *sch) | |||
474 | static inline unsigned int __qdisc_queue_drop_head(struct Qdisc *sch, | 475 | static inline unsigned int __qdisc_queue_drop_head(struct Qdisc *sch, |
475 | struct sk_buff_head *list) | 476 | struct sk_buff_head *list) |
476 | { | 477 | { |
477 | struct sk_buff *skb = __qdisc_dequeue_head(sch, list); | 478 | struct sk_buff *skb = __skb_dequeue(list); |
478 | 479 | ||
479 | if (likely(skb != NULL)) { | 480 | if (likely(skb != NULL)) { |
480 | unsigned int len = qdisc_pkt_len(skb); | 481 | unsigned int len = qdisc_pkt_len(skb); |
482 | sch->qstats.backlog -= len; | ||
481 | kfree_skb(skb); | 483 | kfree_skb(skb); |
482 | return len; | 484 | return len; |
483 | } | 485 | } |
diff --git a/kernel/printk.c b/kernel/printk.c index 53d9a9ec88e..2ddbdc73aad 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -97,7 +97,7 @@ static int console_locked, console_suspended; | |||
97 | /* | 97 | /* |
98 | * logbuf_lock protects log_buf, log_start, log_end, con_start and logged_chars | 98 | * logbuf_lock protects log_buf, log_start, log_end, con_start and logged_chars |
99 | * It is also used in interesting ways to provide interlocking in | 99 | * It is also used in interesting ways to provide interlocking in |
100 | * release_console_sem(). | 100 | * console_unlock();. |
101 | */ | 101 | */ |
102 | static DEFINE_SPINLOCK(logbuf_lock); | 102 | static DEFINE_SPINLOCK(logbuf_lock); |
103 | 103 | ||
@@ -501,7 +501,7 @@ static void _call_console_drivers(unsigned start, | |||
501 | /* | 501 | /* |
502 | * Call the console drivers, asking them to write out | 502 | * Call the console drivers, asking them to write out |
503 | * log_buf[start] to log_buf[end - 1]. | 503 | * log_buf[start] to log_buf[end - 1]. |
504 | * The console_sem must be held. | 504 | * The console_lock must be held. |
505 | */ | 505 | */ |
506 | static void call_console_drivers(unsigned start, unsigned end) | 506 | static void call_console_drivers(unsigned start, unsigned end) |
507 | { | 507 | { |
@@ -604,11 +604,11 @@ static int have_callable_console(void) | |||
604 | * | 604 | * |
605 | * This is printk(). It can be called from any context. We want it to work. | 605 | * This is printk(). It can be called from any context. We want it to work. |
606 | * | 606 | * |
607 | * We try to grab the console_sem. If we succeed, it's easy - we log the output and | 607 | * We try to grab the console_lock. If we succeed, it's easy - we log the output and |
608 | * call the console drivers. If we fail to get the semaphore we place the output | 608 | * call the console drivers. If we fail to get the semaphore we place the output |
609 | * into the log buffer and return. The current holder of the console_sem will | 609 | * into the log buffer and return. The current holder of the console_sem will |
610 | * notice the new output in release_console_sem() and will send it to the | 610 | * notice the new output in console_unlock(); and will send it to the |
611 | * consoles before releasing the semaphore. | 611 | * consoles before releasing the lock. |
612 | * | 612 | * |
613 | * One effect of this deferred printing is that code which calls printk() and | 613 | * One effect of this deferred printing is that code which calls printk() and |
614 | * then changes console_loglevel may break. This is because console_loglevel | 614 | * then changes console_loglevel may break. This is because console_loglevel |
@@ -659,19 +659,19 @@ static inline int can_use_console(unsigned int cpu) | |||
659 | /* | 659 | /* |
660 | * Try to get console ownership to actually show the kernel | 660 | * Try to get console ownership to actually show the kernel |
661 | * messages from a 'printk'. Return true (and with the | 661 | * messages from a 'printk'. Return true (and with the |
662 | * console_semaphore held, and 'console_locked' set) if it | 662 | * console_lock held, and 'console_locked' set) if it |
663 | * is successful, false otherwise. | 663 | * is successful, false otherwise. |
664 | * | 664 | * |
665 | * This gets called with the 'logbuf_lock' spinlock held and | 665 | * This gets called with the 'logbuf_lock' spinlock held and |
666 | * interrupts disabled. It should return with 'lockbuf_lock' | 666 | * interrupts disabled. It should return with 'lockbuf_lock' |
667 | * released but interrupts still disabled. | 667 | * released but interrupts still disabled. |
668 | */ | 668 | */ |
669 | static int acquire_console_semaphore_for_printk(unsigned int cpu) | 669 | static int console_trylock_for_printk(unsigned int cpu) |
670 | __releases(&logbuf_lock) | 670 | __releases(&logbuf_lock) |
671 | { | 671 | { |
672 | int retval = 0; | 672 | int retval = 0; |
673 | 673 | ||
674 | if (!try_acquire_console_sem()) { | 674 | if (console_trylock()) { |
675 | retval = 1; | 675 | retval = 1; |
676 | 676 | ||
677 | /* | 677 | /* |
@@ -827,12 +827,12 @@ asmlinkage int vprintk(const char *fmt, va_list args) | |||
827 | * actual magic (print out buffers, wake up klogd, | 827 | * actual magic (print out buffers, wake up klogd, |
828 | * etc). | 828 | * etc). |
829 | * | 829 | * |
830 | * The acquire_console_semaphore_for_printk() function | 830 | * The console_trylock_for_printk() function |
831 | * will release 'logbuf_lock' regardless of whether it | 831 | * will release 'logbuf_lock' regardless of whether it |
832 | * actually gets the semaphore or not. | 832 | * actually gets the semaphore or not. |
833 | */ | 833 | */ |
834 | if (acquire_console_semaphore_for_printk(this_cpu)) | 834 | if (console_trylock_for_printk(this_cpu)) |
835 | release_console_sem(); | 835 | console_unlock(); |
836 | 836 | ||
837 | lockdep_on(); | 837 | lockdep_on(); |
838 | out_restore_irqs: | 838 | out_restore_irqs: |
@@ -993,7 +993,7 @@ void suspend_console(void) | |||
993 | if (!console_suspend_enabled) | 993 | if (!console_suspend_enabled) |
994 | return; | 994 | return; |
995 | printk("Suspending console(s) (use no_console_suspend to debug)\n"); | 995 | printk("Suspending console(s) (use no_console_suspend to debug)\n"); |
996 | acquire_console_sem(); | 996 | console_lock(); |
997 | console_suspended = 1; | 997 | console_suspended = 1; |
998 | up(&console_sem); | 998 | up(&console_sem); |
999 | } | 999 | } |
@@ -1004,7 +1004,7 @@ void resume_console(void) | |||
1004 | return; | 1004 | return; |
1005 | down(&console_sem); | 1005 | down(&console_sem); |
1006 | console_suspended = 0; | 1006 | console_suspended = 0; |
1007 | release_console_sem(); | 1007 | console_unlock(); |
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | /** | 1010 | /** |
@@ -1027,21 +1027,21 @@ static int __cpuinit console_cpu_notify(struct notifier_block *self, | |||
1027 | case CPU_DYING: | 1027 | case CPU_DYING: |
1028 | case CPU_DOWN_FAILED: | 1028 | case CPU_DOWN_FAILED: |
1029 | case CPU_UP_CANCELED: | 1029 | case CPU_UP_CANCELED: |
1030 | acquire_console_sem(); | 1030 | console_lock(); |
1031 | release_console_sem(); | 1031 | console_unlock(); |
1032 | } | 1032 | } |
1033 | return NOTIFY_OK; | 1033 | return NOTIFY_OK; |
1034 | } | 1034 | } |
1035 | 1035 | ||
1036 | /** | 1036 | /** |
1037 | * acquire_console_sem - lock the console system for exclusive use. | 1037 | * console_lock - lock the console system for exclusive use. |
1038 | * | 1038 | * |
1039 | * Acquires a semaphore which guarantees that the caller has | 1039 | * Acquires a lock which guarantees that the caller has |
1040 | * exclusive access to the console system and the console_drivers list. | 1040 | * exclusive access to the console system and the console_drivers list. |
1041 | * | 1041 | * |
1042 | * Can sleep, returns nothing. | 1042 | * Can sleep, returns nothing. |
1043 | */ | 1043 | */ |
1044 | void acquire_console_sem(void) | 1044 | void console_lock(void) |
1045 | { | 1045 | { |
1046 | BUG_ON(in_interrupt()); | 1046 | BUG_ON(in_interrupt()); |
1047 | down(&console_sem); | 1047 | down(&console_sem); |
@@ -1050,21 +1050,29 @@ void acquire_console_sem(void) | |||
1050 | console_locked = 1; | 1050 | console_locked = 1; |
1051 | console_may_schedule = 1; | 1051 | console_may_schedule = 1; |
1052 | } | 1052 | } |
1053 | EXPORT_SYMBOL(acquire_console_sem); | 1053 | EXPORT_SYMBOL(console_lock); |
1054 | 1054 | ||
1055 | int try_acquire_console_sem(void) | 1055 | /** |
1056 | * console_trylock - try to lock the console system for exclusive use. | ||
1057 | * | ||
1058 | * Tried to acquire a lock which guarantees that the caller has | ||
1059 | * exclusive access to the console system and the console_drivers list. | ||
1060 | * | ||
1061 | * returns 1 on success, and 0 on failure to acquire the lock. | ||
1062 | */ | ||
1063 | int console_trylock(void) | ||
1056 | { | 1064 | { |
1057 | if (down_trylock(&console_sem)) | 1065 | if (down_trylock(&console_sem)) |
1058 | return -1; | 1066 | return 0; |
1059 | if (console_suspended) { | 1067 | if (console_suspended) { |
1060 | up(&console_sem); | 1068 | up(&console_sem); |
1061 | return -1; | 1069 | return 0; |
1062 | } | 1070 | } |
1063 | console_locked = 1; | 1071 | console_locked = 1; |
1064 | console_may_schedule = 0; | 1072 | console_may_schedule = 0; |
1065 | return 0; | 1073 | return 1; |
1066 | } | 1074 | } |
1067 | EXPORT_SYMBOL(try_acquire_console_sem); | 1075 | EXPORT_SYMBOL(console_trylock); |
1068 | 1076 | ||
1069 | int is_console_locked(void) | 1077 | int is_console_locked(void) |
1070 | { | 1078 | { |
@@ -1095,20 +1103,20 @@ void wake_up_klogd(void) | |||
1095 | } | 1103 | } |
1096 | 1104 | ||
1097 | /** | 1105 | /** |
1098 | * release_console_sem - unlock the console system | 1106 | * console_unlock - unlock the console system |
1099 | * | 1107 | * |
1100 | * Releases the semaphore which the caller holds on the console system | 1108 | * Releases the console_lock which the caller holds on the console system |
1101 | * and the console driver list. | 1109 | * and the console driver list. |
1102 | * | 1110 | * |
1103 | * While the semaphore was held, console output may have been buffered | 1111 | * While the console_lock was held, console output may have been buffered |
1104 | * by printk(). If this is the case, release_console_sem() emits | 1112 | * by printk(). If this is the case, console_unlock(); emits |
1105 | * the output prior to releasing the semaphore. | 1113 | * the output prior to releasing the lock. |
1106 | * | 1114 | * |
1107 | * If there is output waiting for klogd, we wake it up. | 1115 | * If there is output waiting for klogd, we wake it up. |
1108 | * | 1116 | * |
1109 | * release_console_sem() may be called from any context. | 1117 | * console_unlock(); may be called from any context. |
1110 | */ | 1118 | */ |
1111 | void release_console_sem(void) | 1119 | void console_unlock(void) |
1112 | { | 1120 | { |
1113 | unsigned long flags; | 1121 | unsigned long flags; |
1114 | unsigned _con_start, _log_end; | 1122 | unsigned _con_start, _log_end; |
@@ -1141,7 +1149,7 @@ void release_console_sem(void) | |||
1141 | if (wake_klogd) | 1149 | if (wake_klogd) |
1142 | wake_up_klogd(); | 1150 | wake_up_klogd(); |
1143 | } | 1151 | } |
1144 | EXPORT_SYMBOL(release_console_sem); | 1152 | EXPORT_SYMBOL(console_unlock); |
1145 | 1153 | ||
1146 | /** | 1154 | /** |
1147 | * console_conditional_schedule - yield the CPU if required | 1155 | * console_conditional_schedule - yield the CPU if required |
@@ -1150,7 +1158,7 @@ EXPORT_SYMBOL(release_console_sem); | |||
1150 | * if this CPU should yield the CPU to another task, do | 1158 | * if this CPU should yield the CPU to another task, do |
1151 | * so here. | 1159 | * so here. |
1152 | * | 1160 | * |
1153 | * Must be called within acquire_console_sem(). | 1161 | * Must be called within console_lock();. |
1154 | */ | 1162 | */ |
1155 | void __sched console_conditional_schedule(void) | 1163 | void __sched console_conditional_schedule(void) |
1156 | { | 1164 | { |
@@ -1171,14 +1179,14 @@ void console_unblank(void) | |||
1171 | if (down_trylock(&console_sem) != 0) | 1179 | if (down_trylock(&console_sem) != 0) |
1172 | return; | 1180 | return; |
1173 | } else | 1181 | } else |
1174 | acquire_console_sem(); | 1182 | console_lock(); |
1175 | 1183 | ||
1176 | console_locked = 1; | 1184 | console_locked = 1; |
1177 | console_may_schedule = 0; | 1185 | console_may_schedule = 0; |
1178 | for_each_console(c) | 1186 | for_each_console(c) |
1179 | if ((c->flags & CON_ENABLED) && c->unblank) | 1187 | if ((c->flags & CON_ENABLED) && c->unblank) |
1180 | c->unblank(); | 1188 | c->unblank(); |
1181 | release_console_sem(); | 1189 | console_unlock(); |
1182 | } | 1190 | } |
1183 | 1191 | ||
1184 | /* | 1192 | /* |
@@ -1189,7 +1197,7 @@ struct tty_driver *console_device(int *index) | |||
1189 | struct console *c; | 1197 | struct console *c; |
1190 | struct tty_driver *driver = NULL; | 1198 | struct tty_driver *driver = NULL; |
1191 | 1199 | ||
1192 | acquire_console_sem(); | 1200 | console_lock(); |
1193 | for_each_console(c) { | 1201 | for_each_console(c) { |
1194 | if (!c->device) | 1202 | if (!c->device) |
1195 | continue; | 1203 | continue; |
@@ -1197,7 +1205,7 @@ struct tty_driver *console_device(int *index) | |||
1197 | if (driver) | 1205 | if (driver) |
1198 | break; | 1206 | break; |
1199 | } | 1207 | } |
1200 | release_console_sem(); | 1208 | console_unlock(); |
1201 | return driver; | 1209 | return driver; |
1202 | } | 1210 | } |
1203 | 1211 | ||
@@ -1208,17 +1216,17 @@ struct tty_driver *console_device(int *index) | |||
1208 | */ | 1216 | */ |
1209 | void console_stop(struct console *console) | 1217 | void console_stop(struct console *console) |
1210 | { | 1218 | { |
1211 | acquire_console_sem(); | 1219 | console_lock(); |
1212 | console->flags &= ~CON_ENABLED; | 1220 | console->flags &= ~CON_ENABLED; |
1213 | release_console_sem(); | 1221 | console_unlock(); |
1214 | } | 1222 | } |
1215 | EXPORT_SYMBOL(console_stop); | 1223 | EXPORT_SYMBOL(console_stop); |
1216 | 1224 | ||
1217 | void console_start(struct console *console) | 1225 | void console_start(struct console *console) |
1218 | { | 1226 | { |
1219 | acquire_console_sem(); | 1227 | console_lock(); |
1220 | console->flags |= CON_ENABLED; | 1228 | console->flags |= CON_ENABLED; |
1221 | release_console_sem(); | 1229 | console_unlock(); |
1222 | } | 1230 | } |
1223 | EXPORT_SYMBOL(console_start); | 1231 | EXPORT_SYMBOL(console_start); |
1224 | 1232 | ||
@@ -1340,7 +1348,7 @@ void register_console(struct console *newcon) | |||
1340 | * Put this console in the list - keep the | 1348 | * Put this console in the list - keep the |
1341 | * preferred driver at the head of the list. | 1349 | * preferred driver at the head of the list. |
1342 | */ | 1350 | */ |
1343 | acquire_console_sem(); | 1351 | console_lock(); |
1344 | if ((newcon->flags & CON_CONSDEV) || console_drivers == NULL) { | 1352 | if ((newcon->flags & CON_CONSDEV) || console_drivers == NULL) { |
1345 | newcon->next = console_drivers; | 1353 | newcon->next = console_drivers; |
1346 | console_drivers = newcon; | 1354 | console_drivers = newcon; |
@@ -1352,14 +1360,14 @@ void register_console(struct console *newcon) | |||
1352 | } | 1360 | } |
1353 | if (newcon->flags & CON_PRINTBUFFER) { | 1361 | if (newcon->flags & CON_PRINTBUFFER) { |
1354 | /* | 1362 | /* |
1355 | * release_console_sem() will print out the buffered messages | 1363 | * console_unlock(); will print out the buffered messages |
1356 | * for us. | 1364 | * for us. |
1357 | */ | 1365 | */ |
1358 | spin_lock_irqsave(&logbuf_lock, flags); | 1366 | spin_lock_irqsave(&logbuf_lock, flags); |
1359 | con_start = log_start; | 1367 | con_start = log_start; |
1360 | spin_unlock_irqrestore(&logbuf_lock, flags); | 1368 | spin_unlock_irqrestore(&logbuf_lock, flags); |
1361 | } | 1369 | } |
1362 | release_console_sem(); | 1370 | console_unlock(); |
1363 | console_sysfs_notify(); | 1371 | console_sysfs_notify(); |
1364 | 1372 | ||
1365 | /* | 1373 | /* |
@@ -1396,7 +1404,7 @@ int unregister_console(struct console *console) | |||
1396 | return braille_unregister_console(console); | 1404 | return braille_unregister_console(console); |
1397 | #endif | 1405 | #endif |
1398 | 1406 | ||
1399 | acquire_console_sem(); | 1407 | console_lock(); |
1400 | if (console_drivers == console) { | 1408 | if (console_drivers == console) { |
1401 | console_drivers=console->next; | 1409 | console_drivers=console->next; |
1402 | res = 0; | 1410 | res = 0; |
@@ -1418,7 +1426,7 @@ int unregister_console(struct console *console) | |||
1418 | if (console_drivers != NULL && console->flags & CON_CONSDEV) | 1426 | if (console_drivers != NULL && console->flags & CON_CONSDEV) |
1419 | console_drivers->flags |= CON_CONSDEV; | 1427 | console_drivers->flags |= CON_CONSDEV; |
1420 | 1428 | ||
1421 | release_console_sem(); | 1429 | console_unlock(); |
1422 | console_sysfs_notify(); | 1430 | console_sysfs_notify(); |
1423 | return res; | 1431 | return res; |
1424 | } | 1432 | } |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index bc86bb32e12..0f1bd83db98 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -170,7 +170,8 @@ static int proc_taint(struct ctl_table *table, int write, | |||
170 | #endif | 170 | #endif |
171 | 171 | ||
172 | #ifdef CONFIG_MAGIC_SYSRQ | 172 | #ifdef CONFIG_MAGIC_SYSRQ |
173 | static int __sysrq_enabled; /* Note: sysrq code ises it's own private copy */ | 173 | /* Note: sysrq code uses it's own private copy */ |
174 | static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE; | ||
174 | 175 | ||
175 | static int sysrq_sysctl_handler(ctl_table *table, int write, | 176 | static int sysrq_sysctl_handler(ctl_table *table, int write, |
176 | void __user *buffer, size_t *lenp, | 177 | void __user *buffer, size_t *lenp, |
diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 5086bb962b4..7ea2e033d71 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c | |||
@@ -736,10 +736,11 @@ next: | |||
736 | } | 736 | } |
737 | } | 737 | } |
738 | /* | 738 | /* |
739 | * The iftag must have been set somewhere because otherwise | 739 | * We need not to tag the root tag if there is no tag which is set with |
740 | * we would return immediated at the beginning of the function | 740 | * settag within the range from *first_indexp to last_index. |
741 | */ | 741 | */ |
742 | root_tag_set(root, settag); | 742 | if (tagged > 0) |
743 | root_tag_set(root, settag); | ||
743 | *first_indexp = index; | 744 | *first_indexp = index; |
744 | 745 | ||
745 | return tagged; | 746 | return tagged; |
diff --git a/lib/textsearch.c b/lib/textsearch.c index d608331b3e4..e0cc0146ae6 100644 --- a/lib/textsearch.c +++ b/lib/textsearch.c | |||
@@ -13,7 +13,7 @@ | |||
13 | * | 13 | * |
14 | * INTRODUCTION | 14 | * INTRODUCTION |
15 | * | 15 | * |
16 | * The textsearch infrastructure provides text searching facitilies for | 16 | * The textsearch infrastructure provides text searching facilities for |
17 | * both linear and non-linear data. Individual search algorithms are | 17 | * both linear and non-linear data. Individual search algorithms are |
18 | * implemented in modules and chosen by the user. | 18 | * implemented in modules and chosen by the user. |
19 | * | 19 | * |
@@ -43,7 +43,7 @@ | |||
43 | * to the algorithm to store persistent variables. | 43 | * to the algorithm to store persistent variables. |
44 | * (4) Core eventually resets the search offset and forwards the find() | 44 | * (4) Core eventually resets the search offset and forwards the find() |
45 | * request to the algorithm. | 45 | * request to the algorithm. |
46 | * (5) Algorithm calls get_next_block() provided by the user continously | 46 | * (5) Algorithm calls get_next_block() provided by the user continuously |
47 | * to fetch the data to be searched in block by block. | 47 | * to fetch the data to be searched in block by block. |
48 | * (6) Algorithm invokes finish() after the last call to get_next_block | 48 | * (6) Algorithm invokes finish() after the last call to get_next_block |
49 | * to clean up any leftovers from get_next_block. (Optional) | 49 | * to clean up any leftovers from get_next_block. (Optional) |
@@ -58,15 +58,15 @@ | |||
58 | * the pattern to look for and flags. As a flag, you can set TS_IGNORECASE | 58 | * the pattern to look for and flags. As a flag, you can set TS_IGNORECASE |
59 | * to perform case insensitive matching. But it might slow down | 59 | * to perform case insensitive matching. But it might slow down |
60 | * performance of algorithm, so you should use it at own your risk. | 60 | * performance of algorithm, so you should use it at own your risk. |
61 | * The returned configuration may then be used for an arbitary | 61 | * The returned configuration may then be used for an arbitrary |
62 | * amount of times and even in parallel as long as a separate struct | 62 | * amount of times and even in parallel as long as a separate struct |
63 | * ts_state variable is provided to every instance. | 63 | * ts_state variable is provided to every instance. |
64 | * | 64 | * |
65 | * The actual search is performed by either calling textsearch_find_- | 65 | * The actual search is performed by either calling textsearch_find_- |
66 | * continuous() for linear data or by providing an own get_next_block() | 66 | * continuous() for linear data or by providing an own get_next_block() |
67 | * implementation and calling textsearch_find(). Both functions return | 67 | * implementation and calling textsearch_find(). Both functions return |
68 | * the position of the first occurrence of the patern or UINT_MAX if | 68 | * the position of the first occurrence of the pattern or UINT_MAX if |
69 | * no match was found. Subsequent occurences can be found by calling | 69 | * no match was found. Subsequent occurrences can be found by calling |
70 | * textsearch_next() regardless of the linearity of the data. | 70 | * textsearch_next() regardless of the linearity of the data. |
71 | * | 71 | * |
72 | * Once you're done using a configuration it must be given back via | 72 | * Once you're done using a configuration it must be given back via |
diff --git a/mm/Kconfig b/mm/Kconfig index 3ad483bdf50..e9c0c61f2dd 100644 --- a/mm/Kconfig +++ b/mm/Kconfig | |||
@@ -179,7 +179,7 @@ config SPLIT_PTLOCK_CPUS | |||
179 | config COMPACTION | 179 | config COMPACTION |
180 | bool "Allow for memory compaction" | 180 | bool "Allow for memory compaction" |
181 | select MIGRATION | 181 | select MIGRATION |
182 | depends on EXPERIMENTAL && HUGETLB_PAGE && MMU | 182 | depends on MMU |
183 | help | 183 | help |
184 | Allows the compaction of memory for the allocation of huge pages. | 184 | Allows the compaction of memory for the allocation of huge pages. |
185 | 185 | ||
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index db76ef72629..3878cfe399d 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1832,6 +1832,7 @@ static int __mem_cgroup_do_charge(struct mem_cgroup *mem, gfp_t gfp_mask, | |||
1832 | if (likely(!ret)) | 1832 | if (likely(!ret)) |
1833 | return CHARGE_OK; | 1833 | return CHARGE_OK; |
1834 | 1834 | ||
1835 | res_counter_uncharge(&mem->res, csize); | ||
1835 | mem_over_limit = mem_cgroup_from_res_counter(fail_res, memsw); | 1836 | mem_over_limit = mem_cgroup_from_res_counter(fail_res, memsw); |
1836 | flags |= MEM_CGROUP_RECLAIM_NOSWAP; | 1837 | flags |= MEM_CGROUP_RECLAIM_NOSWAP; |
1837 | } else | 1838 | } else |
@@ -2144,6 +2145,8 @@ void mem_cgroup_split_huge_fixup(struct page *head, struct page *tail) | |||
2144 | struct page_cgroup *tail_pc = lookup_page_cgroup(tail); | 2145 | struct page_cgroup *tail_pc = lookup_page_cgroup(tail); |
2145 | unsigned long flags; | 2146 | unsigned long flags; |
2146 | 2147 | ||
2148 | if (mem_cgroup_disabled()) | ||
2149 | return; | ||
2147 | /* | 2150 | /* |
2148 | * We have no races with charge/uncharge but will have races with | 2151 | * We have no races with charge/uncharge but will have races with |
2149 | * page state accounting. | 2152 | * page state accounting. |
@@ -2233,7 +2236,12 @@ static int mem_cgroup_move_account(struct page_cgroup *pc, | |||
2233 | { | 2236 | { |
2234 | int ret = -EINVAL; | 2237 | int ret = -EINVAL; |
2235 | unsigned long flags; | 2238 | unsigned long flags; |
2236 | 2239 | /* | |
2240 | * The page is isolated from LRU. So, collapse function | ||
2241 | * will not handle this page. But page splitting can happen. | ||
2242 | * Do this check under compound_page_lock(). The caller should | ||
2243 | * hold it. | ||
2244 | */ | ||
2237 | if ((charge_size > PAGE_SIZE) && !PageTransHuge(pc->page)) | 2245 | if ((charge_size > PAGE_SIZE) && !PageTransHuge(pc->page)) |
2238 | return -EBUSY; | 2246 | return -EBUSY; |
2239 | 2247 | ||
@@ -2265,7 +2273,7 @@ static int mem_cgroup_move_parent(struct page_cgroup *pc, | |||
2265 | struct cgroup *cg = child->css.cgroup; | 2273 | struct cgroup *cg = child->css.cgroup; |
2266 | struct cgroup *pcg = cg->parent; | 2274 | struct cgroup *pcg = cg->parent; |
2267 | struct mem_cgroup *parent; | 2275 | struct mem_cgroup *parent; |
2268 | int charge = PAGE_SIZE; | 2276 | int page_size = PAGE_SIZE; |
2269 | unsigned long flags; | 2277 | unsigned long flags; |
2270 | int ret; | 2278 | int ret; |
2271 | 2279 | ||
@@ -2278,23 +2286,26 @@ static int mem_cgroup_move_parent(struct page_cgroup *pc, | |||
2278 | goto out; | 2286 | goto out; |
2279 | if (isolate_lru_page(page)) | 2287 | if (isolate_lru_page(page)) |
2280 | goto put; | 2288 | goto put; |
2281 | /* The page is isolated from LRU and we have no race with splitting */ | 2289 | |
2282 | charge = PAGE_SIZE << compound_order(page); | 2290 | if (PageTransHuge(page)) |
2291 | page_size = HPAGE_SIZE; | ||
2283 | 2292 | ||
2284 | parent = mem_cgroup_from_cont(pcg); | 2293 | parent = mem_cgroup_from_cont(pcg); |
2285 | ret = __mem_cgroup_try_charge(NULL, gfp_mask, &parent, false, charge); | 2294 | ret = __mem_cgroup_try_charge(NULL, gfp_mask, |
2295 | &parent, false, page_size); | ||
2286 | if (ret || !parent) | 2296 | if (ret || !parent) |
2287 | goto put_back; | 2297 | goto put_back; |
2288 | 2298 | ||
2289 | if (charge > PAGE_SIZE) | 2299 | if (page_size > PAGE_SIZE) |
2290 | flags = compound_lock_irqsave(page); | 2300 | flags = compound_lock_irqsave(page); |
2291 | 2301 | ||
2292 | ret = mem_cgroup_move_account(pc, child, parent, true, charge); | 2302 | ret = mem_cgroup_move_account(pc, child, parent, true, page_size); |
2293 | if (ret) | 2303 | if (ret) |
2294 | mem_cgroup_cancel_charge(parent, charge); | 2304 | mem_cgroup_cancel_charge(parent, page_size); |
2295 | put_back: | 2305 | |
2296 | if (charge > PAGE_SIZE) | 2306 | if (page_size > PAGE_SIZE) |
2297 | compound_unlock_irqrestore(page, flags); | 2307 | compound_unlock_irqrestore(page, flags); |
2308 | put_back: | ||
2298 | putback_lru_page(page); | 2309 | putback_lru_page(page); |
2299 | put: | 2310 | put: |
2300 | put_page(page); | 2311 | put_page(page); |
diff --git a/mm/migrate.c b/mm/migrate.c index 46fe8cc13d6..9f29a3b7aac 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -888,7 +888,7 @@ out: | |||
888 | * are movable anymore because to has become empty | 888 | * are movable anymore because to has become empty |
889 | * or no retryable pages exist anymore. | 889 | * or no retryable pages exist anymore. |
890 | * Caller should call putback_lru_pages to return pages to the LRU | 890 | * Caller should call putback_lru_pages to return pages to the LRU |
891 | * or free list. | 891 | * or free list only if ret != 0. |
892 | * | 892 | * |
893 | * Return: Number of pages not migrated or error code. | 893 | * Return: Number of pages not migrated or error code. |
894 | */ | 894 | */ |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 90c1439549f..a873e61e312 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1088,8 +1088,10 @@ static void drain_pages(unsigned int cpu) | |||
1088 | pset = per_cpu_ptr(zone->pageset, cpu); | 1088 | pset = per_cpu_ptr(zone->pageset, cpu); |
1089 | 1089 | ||
1090 | pcp = &pset->pcp; | 1090 | pcp = &pset->pcp; |
1091 | free_pcppages_bulk(zone, pcp->count, pcp); | 1091 | if (pcp->count) { |
1092 | pcp->count = 0; | 1092 | free_pcppages_bulk(zone, pcp->count, pcp); |
1093 | pcp->count = 0; | ||
1094 | } | ||
1093 | local_irq_restore(flags); | 1095 | local_irq_restore(flags); |
1094 | } | 1096 | } |
1095 | } | 1097 | } |
@@ -2034,6 +2036,14 @@ restart: | |||
2034 | */ | 2036 | */ |
2035 | alloc_flags = gfp_to_alloc_flags(gfp_mask); | 2037 | alloc_flags = gfp_to_alloc_flags(gfp_mask); |
2036 | 2038 | ||
2039 | /* | ||
2040 | * Find the true preferred zone if the allocation is unconstrained by | ||
2041 | * cpusets. | ||
2042 | */ | ||
2043 | if (!(alloc_flags & ALLOC_CPUSET) && !nodemask) | ||
2044 | first_zones_zonelist(zonelist, high_zoneidx, NULL, | ||
2045 | &preferred_zone); | ||
2046 | |||
2037 | /* This is the last chance, in general, before the goto nopage. */ | 2047 | /* This is the last chance, in general, before the goto nopage. */ |
2038 | page = get_page_from_freelist(gfp_mask, nodemask, order, zonelist, | 2048 | page = get_page_from_freelist(gfp_mask, nodemask, order, zonelist, |
2039 | high_zoneidx, alloc_flags & ~ALLOC_NO_WATERMARKS, | 2049 | high_zoneidx, alloc_flags & ~ALLOC_NO_WATERMARKS, |
@@ -2192,7 +2202,9 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, | |||
2192 | 2202 | ||
2193 | get_mems_allowed(); | 2203 | get_mems_allowed(); |
2194 | /* The preferred zone is used for statistics later */ | 2204 | /* The preferred zone is used for statistics later */ |
2195 | first_zones_zonelist(zonelist, high_zoneidx, nodemask, &preferred_zone); | 2205 | first_zones_zonelist(zonelist, high_zoneidx, |
2206 | nodemask ? : &cpuset_current_mems_allowed, | ||
2207 | &preferred_zone); | ||
2196 | if (!preferred_zone) { | 2208 | if (!preferred_zone) { |
2197 | put_mems_allowed(); | 2209 | put_mems_allowed(); |
2198 | return NULL; | 2210 | return NULL; |
diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c index 0369f5b3ba1..eb663fb533e 100644 --- a/mm/pgtable-generic.c +++ b/mm/pgtable-generic.c | |||
@@ -6,6 +6,7 @@ | |||
6 | * Copyright (C) 2010 Linus Torvalds | 6 | * Copyright (C) 2010 Linus Torvalds |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/pagemap.h> | ||
9 | #include <asm/tlb.h> | 10 | #include <asm/tlb.h> |
10 | #include <asm-generic/pgtable.h> | 11 | #include <asm-generic/pgtable.h> |
11 | 12 | ||
diff --git a/mm/vmscan.c b/mm/vmscan.c index f5d90dedebb..148c6e630df 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -2083,7 +2083,8 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist, | |||
2083 | struct zone *preferred_zone; | 2083 | struct zone *preferred_zone; |
2084 | 2084 | ||
2085 | first_zones_zonelist(zonelist, gfp_zone(sc->gfp_mask), | 2085 | first_zones_zonelist(zonelist, gfp_zone(sc->gfp_mask), |
2086 | NULL, &preferred_zone); | 2086 | &cpuset_current_mems_allowed, |
2087 | &preferred_zone); | ||
2087 | wait_iff_congested(preferred_zone, BLK_RW_ASYNC, HZ/10); | 2088 | wait_iff_congested(preferred_zone, BLK_RW_ASYNC, HZ/10); |
2088 | } | 2089 | } |
2089 | } | 2090 | } |
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 6b90a419173..99cd8d9d891 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -379,14 +379,10 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 | |||
379 | hci_conn_hold(acl); | 379 | hci_conn_hold(acl); |
380 | 380 | ||
381 | if (acl->state == BT_OPEN || acl->state == BT_CLOSED) { | 381 | if (acl->state == BT_OPEN || acl->state == BT_CLOSED) { |
382 | acl->sec_level = sec_level; | 382 | acl->sec_level = BT_SECURITY_LOW; |
383 | acl->pending_sec_level = sec_level; | ||
383 | acl->auth_type = auth_type; | 384 | acl->auth_type = auth_type; |
384 | hci_acl_connect(acl); | 385 | hci_acl_connect(acl); |
385 | } else { | ||
386 | if (acl->sec_level < sec_level) | ||
387 | acl->sec_level = sec_level; | ||
388 | if (acl->auth_type < auth_type) | ||
389 | acl->auth_type = auth_type; | ||
390 | } | 386 | } |
391 | 387 | ||
392 | if (type == ACL_LINK) | 388 | if (type == ACL_LINK) |
@@ -442,11 +438,17 @@ static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type) | |||
442 | { | 438 | { |
443 | BT_DBG("conn %p", conn); | 439 | BT_DBG("conn %p", conn); |
444 | 440 | ||
441 | if (conn->pending_sec_level > sec_level) | ||
442 | sec_level = conn->pending_sec_level; | ||
443 | |||
445 | if (sec_level > conn->sec_level) | 444 | if (sec_level > conn->sec_level) |
446 | conn->sec_level = sec_level; | 445 | conn->pending_sec_level = sec_level; |
447 | else if (conn->link_mode & HCI_LM_AUTH) | 446 | else if (conn->link_mode & HCI_LM_AUTH) |
448 | return 1; | 447 | return 1; |
449 | 448 | ||
449 | /* Make sure we preserve an existing MITM requirement*/ | ||
450 | auth_type |= (conn->auth_type & 0x01); | ||
451 | |||
450 | conn->auth_type = auth_type; | 452 | conn->auth_type = auth_type; |
451 | 453 | ||
452 | if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) { | 454 | if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) { |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8b602d881fd..9c4541bc488 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -1011,6 +1011,10 @@ int hci_unregister_dev(struct hci_dev *hdev) | |||
1011 | 1011 | ||
1012 | destroy_workqueue(hdev->workqueue); | 1012 | destroy_workqueue(hdev->workqueue); |
1013 | 1013 | ||
1014 | hci_dev_lock_bh(hdev); | ||
1015 | hci_blacklist_clear(hdev); | ||
1016 | hci_dev_unlock_bh(hdev); | ||
1017 | |||
1014 | __hci_dev_put(hdev); | 1018 | __hci_dev_put(hdev); |
1015 | 1019 | ||
1016 | return 0; | 1020 | return 0; |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 38100170d38..a290854fdaa 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -692,13 +692,13 @@ static int hci_outgoing_auth_needed(struct hci_dev *hdev, | |||
692 | if (conn->state != BT_CONFIG || !conn->out) | 692 | if (conn->state != BT_CONFIG || !conn->out) |
693 | return 0; | 693 | return 0; |
694 | 694 | ||
695 | if (conn->sec_level == BT_SECURITY_SDP) | 695 | if (conn->pending_sec_level == BT_SECURITY_SDP) |
696 | return 0; | 696 | return 0; |
697 | 697 | ||
698 | /* Only request authentication for SSP connections or non-SSP | 698 | /* Only request authentication for SSP connections or non-SSP |
699 | * devices with sec_level HIGH */ | 699 | * devices with sec_level HIGH */ |
700 | if (!(hdev->ssp_mode > 0 && conn->ssp_mode > 0) && | 700 | if (!(hdev->ssp_mode > 0 && conn->ssp_mode > 0) && |
701 | conn->sec_level != BT_SECURITY_HIGH) | 701 | conn->pending_sec_level != BT_SECURITY_HIGH) |
702 | return 0; | 702 | return 0; |
703 | 703 | ||
704 | return 1; | 704 | return 1; |
@@ -1095,9 +1095,10 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s | |||
1095 | 1095 | ||
1096 | conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); | 1096 | conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); |
1097 | if (conn) { | 1097 | if (conn) { |
1098 | if (!ev->status) | 1098 | if (!ev->status) { |
1099 | conn->link_mode |= HCI_LM_AUTH; | 1099 | conn->link_mode |= HCI_LM_AUTH; |
1100 | else | 1100 | conn->sec_level = conn->pending_sec_level; |
1101 | } else | ||
1101 | conn->sec_level = BT_SECURITY_LOW; | 1102 | conn->sec_level = BT_SECURITY_LOW; |
1102 | 1103 | ||
1103 | clear_bit(HCI_CONN_AUTH_PEND, &conn->pend); | 1104 | clear_bit(HCI_CONN_AUTH_PEND, &conn->pend); |
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index c791fcda7b2..7550abb0c96 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -305,33 +305,44 @@ static void l2cap_chan_del(struct sock *sk, int err) | |||
305 | } | 305 | } |
306 | } | 306 | } |
307 | 307 | ||
308 | /* Service level security */ | 308 | static inline u8 l2cap_get_auth_type(struct sock *sk) |
309 | static inline int l2cap_check_security(struct sock *sk) | ||
310 | { | 309 | { |
311 | struct l2cap_conn *conn = l2cap_pi(sk)->conn; | 310 | if (sk->sk_type == SOCK_RAW) { |
312 | __u8 auth_type; | 311 | switch (l2cap_pi(sk)->sec_level) { |
312 | case BT_SECURITY_HIGH: | ||
313 | return HCI_AT_DEDICATED_BONDING_MITM; | ||
314 | case BT_SECURITY_MEDIUM: | ||
315 | return HCI_AT_DEDICATED_BONDING; | ||
316 | default: | ||
317 | return HCI_AT_NO_BONDING; | ||
318 | } | ||
319 | } else if (l2cap_pi(sk)->psm == cpu_to_le16(0x0001)) { | ||
320 | if (l2cap_pi(sk)->sec_level == BT_SECURITY_LOW) | ||
321 | l2cap_pi(sk)->sec_level = BT_SECURITY_SDP; | ||
313 | 322 | ||
314 | if (l2cap_pi(sk)->psm == cpu_to_le16(0x0001)) { | ||
315 | if (l2cap_pi(sk)->sec_level == BT_SECURITY_HIGH) | 323 | if (l2cap_pi(sk)->sec_level == BT_SECURITY_HIGH) |
316 | auth_type = HCI_AT_NO_BONDING_MITM; | 324 | return HCI_AT_NO_BONDING_MITM; |
317 | else | 325 | else |
318 | auth_type = HCI_AT_NO_BONDING; | 326 | return HCI_AT_NO_BONDING; |
319 | |||
320 | if (l2cap_pi(sk)->sec_level == BT_SECURITY_LOW) | ||
321 | l2cap_pi(sk)->sec_level = BT_SECURITY_SDP; | ||
322 | } else { | 327 | } else { |
323 | switch (l2cap_pi(sk)->sec_level) { | 328 | switch (l2cap_pi(sk)->sec_level) { |
324 | case BT_SECURITY_HIGH: | 329 | case BT_SECURITY_HIGH: |
325 | auth_type = HCI_AT_GENERAL_BONDING_MITM; | 330 | return HCI_AT_GENERAL_BONDING_MITM; |
326 | break; | ||
327 | case BT_SECURITY_MEDIUM: | 331 | case BT_SECURITY_MEDIUM: |
328 | auth_type = HCI_AT_GENERAL_BONDING; | 332 | return HCI_AT_GENERAL_BONDING; |
329 | break; | ||
330 | default: | 333 | default: |
331 | auth_type = HCI_AT_NO_BONDING; | 334 | return HCI_AT_NO_BONDING; |
332 | break; | ||
333 | } | 335 | } |
334 | } | 336 | } |
337 | } | ||
338 | |||
339 | /* Service level security */ | ||
340 | static inline int l2cap_check_security(struct sock *sk) | ||
341 | { | ||
342 | struct l2cap_conn *conn = l2cap_pi(sk)->conn; | ||
343 | __u8 auth_type; | ||
344 | |||
345 | auth_type = l2cap_get_auth_type(sk); | ||
335 | 346 | ||
336 | return hci_conn_security(conn->hcon, l2cap_pi(sk)->sec_level, | 347 | return hci_conn_security(conn->hcon, l2cap_pi(sk)->sec_level, |
337 | auth_type); | 348 | auth_type); |
@@ -1068,39 +1079,7 @@ static int l2cap_do_connect(struct sock *sk) | |||
1068 | 1079 | ||
1069 | err = -ENOMEM; | 1080 | err = -ENOMEM; |
1070 | 1081 | ||
1071 | if (sk->sk_type == SOCK_RAW) { | 1082 | auth_type = l2cap_get_auth_type(sk); |
1072 | switch (l2cap_pi(sk)->sec_level) { | ||
1073 | case BT_SECURITY_HIGH: | ||
1074 | auth_type = HCI_AT_DEDICATED_BONDING_MITM; | ||
1075 | break; | ||
1076 | case BT_SECURITY_MEDIUM: | ||
1077 | auth_type = HCI_AT_DEDICATED_BONDING; | ||
1078 | break; | ||
1079 | default: | ||
1080 | auth_type = HCI_AT_NO_BONDING; | ||
1081 | break; | ||
1082 | } | ||
1083 | } else if (l2cap_pi(sk)->psm == cpu_to_le16(0x0001)) { | ||
1084 | if (l2cap_pi(sk)->sec_level == BT_SECURITY_HIGH) | ||
1085 | auth_type = HCI_AT_NO_BONDING_MITM; | ||
1086 | else | ||
1087 | auth_type = HCI_AT_NO_BONDING; | ||
1088 | |||
1089 | if (l2cap_pi(sk)->sec_level == BT_SECURITY_LOW) | ||
1090 | l2cap_pi(sk)->sec_level = BT_SECURITY_SDP; | ||
1091 | } else { | ||
1092 | switch (l2cap_pi(sk)->sec_level) { | ||
1093 | case BT_SECURITY_HIGH: | ||
1094 | auth_type = HCI_AT_GENERAL_BONDING_MITM; | ||
1095 | break; | ||
1096 | case BT_SECURITY_MEDIUM: | ||
1097 | auth_type = HCI_AT_GENERAL_BONDING; | ||
1098 | break; | ||
1099 | default: | ||
1100 | auth_type = HCI_AT_NO_BONDING; | ||
1101 | break; | ||
1102 | } | ||
1103 | } | ||
1104 | 1083 | ||
1105 | hcon = hci_connect(hdev, ACL_LINK, dst, | 1084 | hcon = hci_connect(hdev, ACL_LINK, dst, |
1106 | l2cap_pi(sk)->sec_level, auth_type); | 1085 | l2cap_pi(sk)->sec_level, auth_type); |
@@ -1127,7 +1106,8 @@ static int l2cap_do_connect(struct sock *sk) | |||
1127 | if (sk->sk_type != SOCK_SEQPACKET && | 1106 | if (sk->sk_type != SOCK_SEQPACKET && |
1128 | sk->sk_type != SOCK_STREAM) { | 1107 | sk->sk_type != SOCK_STREAM) { |
1129 | l2cap_sock_clear_timer(sk); | 1108 | l2cap_sock_clear_timer(sk); |
1130 | sk->sk_state = BT_CONNECTED; | 1109 | if (l2cap_check_security(sk)) |
1110 | sk->sk_state = BT_CONNECTED; | ||
1131 | } else | 1111 | } else |
1132 | l2cap_do_start(sk); | 1112 | l2cap_do_start(sk); |
1133 | } | 1113 | } |
@@ -1893,8 +1873,8 @@ static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct ms | |||
1893 | if (pi->mode == L2CAP_MODE_STREAMING) { | 1873 | if (pi->mode == L2CAP_MODE_STREAMING) { |
1894 | l2cap_streaming_send(sk); | 1874 | l2cap_streaming_send(sk); |
1895 | } else { | 1875 | } else { |
1896 | if (pi->conn_state & L2CAP_CONN_REMOTE_BUSY && | 1876 | if ((pi->conn_state & L2CAP_CONN_REMOTE_BUSY) && |
1897 | pi->conn_state && L2CAP_CONN_WAIT_F) { | 1877 | (pi->conn_state & L2CAP_CONN_WAIT_F)) { |
1898 | err = len; | 1878 | err = len; |
1899 | break; | 1879 | break; |
1900 | } | 1880 | } |
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index ff8aaa73665..6b83776534f 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
@@ -1164,7 +1164,8 @@ static int rfcomm_recv_ua(struct rfcomm_session *s, u8 dlci) | |||
1164 | * initiator rfcomm_process_rx already calls | 1164 | * initiator rfcomm_process_rx already calls |
1165 | * rfcomm_session_put() */ | 1165 | * rfcomm_session_put() */ |
1166 | if (s->sock->sk->sk_state != BT_CLOSED) | 1166 | if (s->sock->sk->sk_state != BT_CLOSED) |
1167 | rfcomm_session_put(s); | 1167 | if (list_empty(&s->dlcs)) |
1168 | rfcomm_session_put(s); | ||
1168 | break; | 1169 | break; |
1169 | } | 1170 | } |
1170 | } | 1171 | } |
diff --git a/net/core/dev.c b/net/core/dev.c index 7c6a46f8037..24ea2d71e7e 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -749,7 +749,8 @@ EXPORT_SYMBOL(dev_get_by_index); | |||
749 | * @ha: hardware address | 749 | * @ha: hardware address |
750 | * | 750 | * |
751 | * Search for an interface by MAC address. Returns NULL if the device | 751 | * Search for an interface by MAC address. Returns NULL if the device |
752 | * is not found or a pointer to the device. The caller must hold RCU | 752 | * is not found or a pointer to the device. |
753 | * The caller must hold RCU or RTNL. | ||
753 | * The returned device has not had its ref count increased | 754 | * The returned device has not had its ref count increased |
754 | * and the caller must therefore be careful about locking | 755 | * and the caller must therefore be careful about locking |
755 | * | 756 | * |
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 17741782a34..ff2302910b5 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -817,7 +817,7 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr) | |||
817 | if (regs.len > reglen) | 817 | if (regs.len > reglen) |
818 | regs.len = reglen; | 818 | regs.len = reglen; |
819 | 819 | ||
820 | regbuf = vmalloc(reglen); | 820 | regbuf = vzalloc(reglen); |
821 | if (!regbuf) | 821 | if (!regbuf) |
822 | return -ENOMEM; | 822 | return -ENOMEM; |
823 | 823 | ||
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index d31bb36ae0d..7cd1bc86d59 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -2744,8 +2744,12 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) | |||
2744 | 2744 | ||
2745 | merge: | 2745 | merge: |
2746 | if (offset > headlen) { | 2746 | if (offset > headlen) { |
2747 | skbinfo->frags[0].page_offset += offset - headlen; | 2747 | unsigned int eat = offset - headlen; |
2748 | skbinfo->frags[0].size -= offset - headlen; | 2748 | |
2749 | skbinfo->frags[0].page_offset += eat; | ||
2750 | skbinfo->frags[0].size -= eat; | ||
2751 | skb->data_len -= eat; | ||
2752 | skb->len -= eat; | ||
2749 | offset = headlen; | 2753 | offset = headlen; |
2750 | } | 2754 | } |
2751 | 2755 | ||
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c index d900ab99814..6b03f561cae 100644 --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c | |||
@@ -583,7 +583,7 @@ static int dcbnl_getapp(struct net_device *netdev, struct nlattr **tb, | |||
583 | u8 up, idtype; | 583 | u8 up, idtype; |
584 | int ret = -EINVAL; | 584 | int ret = -EINVAL; |
585 | 585 | ||
586 | if (!tb[DCB_ATTR_APP] || !netdev->dcbnl_ops->getapp) | 586 | if (!tb[DCB_ATTR_APP]) |
587 | goto out; | 587 | goto out; |
588 | 588 | ||
589 | ret = nla_parse_nested(app_tb, DCB_APP_ATTR_MAX, tb[DCB_ATTR_APP], | 589 | ret = nla_parse_nested(app_tb, DCB_APP_ATTR_MAX, tb[DCB_ATTR_APP], |
@@ -604,7 +604,16 @@ static int dcbnl_getapp(struct net_device *netdev, struct nlattr **tb, | |||
604 | goto out; | 604 | goto out; |
605 | 605 | ||
606 | id = nla_get_u16(app_tb[DCB_APP_ATTR_ID]); | 606 | id = nla_get_u16(app_tb[DCB_APP_ATTR_ID]); |
607 | up = netdev->dcbnl_ops->getapp(netdev, idtype, id); | 607 | |
608 | if (netdev->dcbnl_ops->getapp) { | ||
609 | up = netdev->dcbnl_ops->getapp(netdev, idtype, id); | ||
610 | } else { | ||
611 | struct dcb_app app = { | ||
612 | .selector = idtype, | ||
613 | .protocol = id, | ||
614 | }; | ||
615 | up = dcb_getapp(netdev, &app); | ||
616 | } | ||
608 | 617 | ||
609 | /* send this back */ | 618 | /* send this back */ |
610 | dcbnl_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); | 619 | dcbnl_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); |
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 04c8b69fd42..7927589813b 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -1017,14 +1017,13 @@ static int arp_req_set_proxy(struct net *net, struct net_device *dev, int on) | |||
1017 | IPV4_DEVCONF_ALL(net, PROXY_ARP) = on; | 1017 | IPV4_DEVCONF_ALL(net, PROXY_ARP) = on; |
1018 | return 0; | 1018 | return 0; |
1019 | } | 1019 | } |
1020 | if (__in_dev_get_rcu(dev)) { | 1020 | if (__in_dev_get_rtnl(dev)) { |
1021 | IN_DEV_CONF_SET(__in_dev_get_rcu(dev), PROXY_ARP, on); | 1021 | IN_DEV_CONF_SET(__in_dev_get_rtnl(dev), PROXY_ARP, on); |
1022 | return 0; | 1022 | return 0; |
1023 | } | 1023 | } |
1024 | return -ENXIO; | 1024 | return -ENXIO; |
1025 | } | 1025 | } |
1026 | 1026 | ||
1027 | /* must be called with rcu_read_lock() */ | ||
1028 | static int arp_req_set_public(struct net *net, struct arpreq *r, | 1027 | static int arp_req_set_public(struct net *net, struct arpreq *r, |
1029 | struct net_device *dev) | 1028 | struct net_device *dev) |
1030 | { | 1029 | { |
@@ -1233,10 +1232,10 @@ int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg) | |||
1233 | if (!(r.arp_flags & ATF_NETMASK)) | 1232 | if (!(r.arp_flags & ATF_NETMASK)) |
1234 | ((struct sockaddr_in *)&r.arp_netmask)->sin_addr.s_addr = | 1233 | ((struct sockaddr_in *)&r.arp_netmask)->sin_addr.s_addr = |
1235 | htonl(0xFFFFFFFFUL); | 1234 | htonl(0xFFFFFFFFUL); |
1236 | rcu_read_lock(); | 1235 | rtnl_lock(); |
1237 | if (r.arp_dev[0]) { | 1236 | if (r.arp_dev[0]) { |
1238 | err = -ENODEV; | 1237 | err = -ENODEV; |
1239 | dev = dev_get_by_name_rcu(net, r.arp_dev); | 1238 | dev = __dev_get_by_name(net, r.arp_dev); |
1240 | if (dev == NULL) | 1239 | if (dev == NULL) |
1241 | goto out; | 1240 | goto out; |
1242 | 1241 | ||
@@ -1263,7 +1262,7 @@ int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg) | |||
1263 | break; | 1262 | break; |
1264 | } | 1263 | } |
1265 | out: | 1264 | out: |
1266 | rcu_read_unlock(); | 1265 | rtnl_unlock(); |
1267 | if (cmd == SIOCGARP && !err && copy_to_user(arg, &r, sizeof(r))) | 1266 | if (cmd == SIOCGARP && !err && copy_to_user(arg, &r, sizeof(r))) |
1268 | err = -EFAULT; | 1267 | err = -EFAULT; |
1269 | return err; | 1268 | return err; |
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index d9bc85751c7..a96e65674ac 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c | |||
@@ -475,7 +475,7 @@ static int cleanup_once(unsigned long ttl) | |||
475 | struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create) | 475 | struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create) |
476 | { | 476 | { |
477 | struct inet_peer __rcu **stack[PEER_MAXDEPTH], ***stackptr; | 477 | struct inet_peer __rcu **stack[PEER_MAXDEPTH], ***stackptr; |
478 | struct inet_peer_base *base = family_to_base(AF_INET); | 478 | struct inet_peer_base *base = family_to_base(daddr->family); |
479 | struct inet_peer *p; | 479 | struct inet_peer *p; |
480 | 480 | ||
481 | /* Look up for the address quickly, lockless. | 481 | /* Look up for the address quickly, lockless. |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 2549b29b062..eb7f82ebf4a 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -4399,7 +4399,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb) | |||
4399 | if (!skb_copy_datagram_iovec(skb, 0, tp->ucopy.iov, chunk)) { | 4399 | if (!skb_copy_datagram_iovec(skb, 0, tp->ucopy.iov, chunk)) { |
4400 | tp->ucopy.len -= chunk; | 4400 | tp->ucopy.len -= chunk; |
4401 | tp->copied_seq += chunk; | 4401 | tp->copied_seq += chunk; |
4402 | eaten = (chunk == skb->len && !th->fin); | 4402 | eaten = (chunk == skb->len); |
4403 | tcp_rcv_space_adjust(sk); | 4403 | tcp_rcv_space_adjust(sk); |
4404 | } | 4404 | } |
4405 | local_bh_disable(); | 4405 | local_bh_disable(); |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 856f68466d4..02f583b3744 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1994,7 +1994,6 @@ static void *listening_get_next(struct seq_file *seq, void *cur) | |||
1994 | } | 1994 | } |
1995 | req = req->dl_next; | 1995 | req = req->dl_next; |
1996 | } | 1996 | } |
1997 | st->offset = 0; | ||
1998 | if (++st->sbucket >= icsk->icsk_accept_queue.listen_opt->nr_table_entries) | 1997 | if (++st->sbucket >= icsk->icsk_accept_queue.listen_opt->nr_table_entries) |
1999 | break; | 1998 | break; |
2000 | get_req: | 1999 | get_req: |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 24a1cf110d8..fd6782e3a03 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -2661,14 +2661,12 @@ static int addrconf_ifdown(struct net_device *dev, int how) | |||
2661 | struct net *net = dev_net(dev); | 2661 | struct net *net = dev_net(dev); |
2662 | struct inet6_dev *idev; | 2662 | struct inet6_dev *idev; |
2663 | struct inet6_ifaddr *ifa; | 2663 | struct inet6_ifaddr *ifa; |
2664 | LIST_HEAD(keep_list); | 2664 | int state, i; |
2665 | int state; | ||
2666 | 2665 | ||
2667 | ASSERT_RTNL(); | 2666 | ASSERT_RTNL(); |
2668 | 2667 | ||
2669 | /* Flush routes if device is being removed or it is not loopback */ | 2668 | rt6_ifdown(net, dev); |
2670 | if (how || !(dev->flags & IFF_LOOPBACK)) | 2669 | neigh_ifdown(&nd_tbl, dev); |
2671 | rt6_ifdown(net, dev); | ||
2672 | 2670 | ||
2673 | idev = __in6_dev_get(dev); | 2671 | idev = __in6_dev_get(dev); |
2674 | if (idev == NULL) | 2672 | if (idev == NULL) |
@@ -2689,6 +2687,23 @@ static int addrconf_ifdown(struct net_device *dev, int how) | |||
2689 | 2687 | ||
2690 | } | 2688 | } |
2691 | 2689 | ||
2690 | /* Step 2: clear hash table */ | ||
2691 | for (i = 0; i < IN6_ADDR_HSIZE; i++) { | ||
2692 | struct hlist_head *h = &inet6_addr_lst[i]; | ||
2693 | struct hlist_node *n; | ||
2694 | |||
2695 | spin_lock_bh(&addrconf_hash_lock); | ||
2696 | restart: | ||
2697 | hlist_for_each_entry_rcu(ifa, n, h, addr_lst) { | ||
2698 | if (ifa->idev == idev) { | ||
2699 | hlist_del_init_rcu(&ifa->addr_lst); | ||
2700 | addrconf_del_timer(ifa); | ||
2701 | goto restart; | ||
2702 | } | ||
2703 | } | ||
2704 | spin_unlock_bh(&addrconf_hash_lock); | ||
2705 | } | ||
2706 | |||
2692 | write_lock_bh(&idev->lock); | 2707 | write_lock_bh(&idev->lock); |
2693 | 2708 | ||
2694 | /* Step 2: clear flags for stateless addrconf */ | 2709 | /* Step 2: clear flags for stateless addrconf */ |
@@ -2722,52 +2737,23 @@ static int addrconf_ifdown(struct net_device *dev, int how) | |||
2722 | struct inet6_ifaddr, if_list); | 2737 | struct inet6_ifaddr, if_list); |
2723 | addrconf_del_timer(ifa); | 2738 | addrconf_del_timer(ifa); |
2724 | 2739 | ||
2725 | /* If just doing link down, and address is permanent | 2740 | list_del(&ifa->if_list); |
2726 | and not link-local, then retain it. */ | ||
2727 | if (!how && | ||
2728 | (ifa->flags&IFA_F_PERMANENT) && | ||
2729 | !(ipv6_addr_type(&ifa->addr) & IPV6_ADDR_LINKLOCAL)) { | ||
2730 | list_move_tail(&ifa->if_list, &keep_list); | ||
2731 | |||
2732 | /* If not doing DAD on this address, just keep it. */ | ||
2733 | if ((dev->flags&(IFF_NOARP|IFF_LOOPBACK)) || | ||
2734 | idev->cnf.accept_dad <= 0 || | ||
2735 | (ifa->flags & IFA_F_NODAD)) | ||
2736 | continue; | ||
2737 | 2741 | ||
2738 | /* If it was tentative already, no need to notify */ | 2742 | write_unlock_bh(&idev->lock); |
2739 | if (ifa->flags & IFA_F_TENTATIVE) | ||
2740 | continue; | ||
2741 | 2743 | ||
2742 | /* Flag it for later restoration when link comes up */ | 2744 | spin_lock_bh(&ifa->state_lock); |
2743 | ifa->flags |= IFA_F_TENTATIVE; | 2745 | state = ifa->state; |
2744 | ifa->state = INET6_IFADDR_STATE_DAD; | 2746 | ifa->state = INET6_IFADDR_STATE_DEAD; |
2745 | } else { | 2747 | spin_unlock_bh(&ifa->state_lock); |
2746 | list_del(&ifa->if_list); | ||
2747 | |||
2748 | /* clear hash table */ | ||
2749 | spin_lock_bh(&addrconf_hash_lock); | ||
2750 | hlist_del_init_rcu(&ifa->addr_lst); | ||
2751 | spin_unlock_bh(&addrconf_hash_lock); | ||
2752 | |||
2753 | write_unlock_bh(&idev->lock); | ||
2754 | spin_lock_bh(&ifa->state_lock); | ||
2755 | state = ifa->state; | ||
2756 | ifa->state = INET6_IFADDR_STATE_DEAD; | ||
2757 | spin_unlock_bh(&ifa->state_lock); | ||
2758 | |||
2759 | if (state != INET6_IFADDR_STATE_DEAD) { | ||
2760 | __ipv6_ifa_notify(RTM_DELADDR, ifa); | ||
2761 | atomic_notifier_call_chain(&inet6addr_chain, | ||
2762 | NETDEV_DOWN, ifa); | ||
2763 | } | ||
2764 | 2748 | ||
2765 | in6_ifa_put(ifa); | 2749 | if (state != INET6_IFADDR_STATE_DEAD) { |
2766 | write_lock_bh(&idev->lock); | 2750 | __ipv6_ifa_notify(RTM_DELADDR, ifa); |
2751 | atomic_notifier_call_chain(&inet6addr_chain, NETDEV_DOWN, ifa); | ||
2767 | } | 2752 | } |
2768 | } | 2753 | in6_ifa_put(ifa); |
2769 | 2754 | ||
2770 | list_splice(&keep_list, &idev->addr_list); | 2755 | write_lock_bh(&idev->lock); |
2756 | } | ||
2771 | 2757 | ||
2772 | write_unlock_bh(&idev->lock); | 2758 | write_unlock_bh(&idev->lock); |
2773 | 2759 | ||
@@ -4156,8 +4142,7 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) | |||
4156 | addrconf_leave_solict(ifp->idev, &ifp->addr); | 4142 | addrconf_leave_solict(ifp->idev, &ifp->addr); |
4157 | dst_hold(&ifp->rt->dst); | 4143 | dst_hold(&ifp->rt->dst); |
4158 | 4144 | ||
4159 | if (ifp->state == INET6_IFADDR_STATE_DEAD && | 4145 | if (ip6_del_rt(ifp->rt)) |
4160 | ip6_del_rt(ifp->rt)) | ||
4161 | dst_free(&ifp->rt->dst); | 4146 | dst_free(&ifp->rt->dst); |
4162 | break; | 4147 | break; |
4163 | } | 4148 | } |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 373bd0416f6..1534508f6c6 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -72,8 +72,6 @@ | |||
72 | #define RT6_TRACE(x...) do { ; } while (0) | 72 | #define RT6_TRACE(x...) do { ; } while (0) |
73 | #endif | 73 | #endif |
74 | 74 | ||
75 | #define CLONE_OFFLINK_ROUTE 0 | ||
76 | |||
77 | static struct rt6_info * ip6_rt_copy(struct rt6_info *ort); | 75 | static struct rt6_info * ip6_rt_copy(struct rt6_info *ort); |
78 | static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); | 76 | static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); |
79 | static unsigned int ip6_default_advmss(const struct dst_entry *dst); | 77 | static unsigned int ip6_default_advmss(const struct dst_entry *dst); |
@@ -738,13 +736,8 @@ restart: | |||
738 | 736 | ||
739 | if (!rt->rt6i_nexthop && !(rt->rt6i_flags & RTF_NONEXTHOP)) | 737 | if (!rt->rt6i_nexthop && !(rt->rt6i_flags & RTF_NONEXTHOP)) |
740 | nrt = rt6_alloc_cow(rt, &fl->fl6_dst, &fl->fl6_src); | 738 | nrt = rt6_alloc_cow(rt, &fl->fl6_dst, &fl->fl6_src); |
741 | else { | 739 | else |
742 | #if CLONE_OFFLINK_ROUTE | ||
743 | nrt = rt6_alloc_clone(rt, &fl->fl6_dst); | 740 | nrt = rt6_alloc_clone(rt, &fl->fl6_dst); |
744 | #else | ||
745 | goto out2; | ||
746 | #endif | ||
747 | } | ||
748 | 741 | ||
749 | dst_release(&rt->dst); | 742 | dst_release(&rt->dst); |
750 | rt = nrt ? : net->ipv6.ip6_null_entry; | 743 | rt = nrt ? : net->ipv6.ip6_null_entry; |
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 7e74023ea6e..da87428681c 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -98,6 +98,10 @@ static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, | |||
98 | if (!xdst->u.rt6.rt6i_idev) | 98 | if (!xdst->u.rt6.rt6i_idev) |
99 | return -ENODEV; | 99 | return -ENODEV; |
100 | 100 | ||
101 | xdst->u.rt6.rt6i_peer = rt->rt6i_peer; | ||
102 | if (rt->rt6i_peer) | ||
103 | atomic_inc(&rt->rt6i_peer->refcnt); | ||
104 | |||
101 | /* Sheit... I remember I did this right. Apparently, | 105 | /* Sheit... I remember I did this right. Apparently, |
102 | * it was magically lost, so this code needs audit */ | 106 | * it was magically lost, so this code needs audit */ |
103 | xdst->u.rt6.rt6i_flags = rt->rt6i_flags & (RTF_ANYCAST | | 107 | xdst->u.rt6.rt6i_flags = rt->rt6i_flags & (RTF_ANYCAST | |
@@ -216,6 +220,8 @@ static void xfrm6_dst_destroy(struct dst_entry *dst) | |||
216 | 220 | ||
217 | if (likely(xdst->u.rt6.rt6i_idev)) | 221 | if (likely(xdst->u.rt6.rt6i_idev)) |
218 | in6_dev_put(xdst->u.rt6.rt6i_idev); | 222 | in6_dev_put(xdst->u.rt6.rt6i_idev); |
223 | if (likely(xdst->u.rt6.rt6i_peer)) | ||
224 | inet_putpeer(xdst->u.rt6.rt6i_peer); | ||
219 | xfrm_dst_destroy(xdst); | 225 | xfrm_dst_destroy(xdst); |
220 | } | 226 | } |
221 | 227 | ||
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 5950e3abead..b64b42bc774 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -2230,6 +2230,9 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, | |||
2230 | 2230 | ||
2231 | sdata = vif_to_sdata(vif); | 2231 | sdata = vif_to_sdata(vif); |
2232 | 2232 | ||
2233 | if (!ieee80211_sdata_running(sdata)) | ||
2234 | goto out; | ||
2235 | |||
2233 | if (tim_offset) | 2236 | if (tim_offset) |
2234 | *tim_offset = 0; | 2237 | *tim_offset = 0; |
2235 | if (tim_length) | 2238 | if (tim_length) |
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index c80d1c210c5..5f63ec58942 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -390,7 +390,6 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
390 | ret = qdisc_enqueue(skb, cl->q); | 390 | ret = qdisc_enqueue(skb, cl->q); |
391 | if (ret == NET_XMIT_SUCCESS) { | 391 | if (ret == NET_XMIT_SUCCESS) { |
392 | sch->q.qlen++; | 392 | sch->q.qlen++; |
393 | qdisc_bstats_update(sch, skb); | ||
394 | cbq_mark_toplevel(q, cl); | 393 | cbq_mark_toplevel(q, cl); |
395 | if (!cl->next_alive) | 394 | if (!cl->next_alive) |
396 | cbq_activate_class(cl); | 395 | cbq_activate_class(cl); |
@@ -649,7 +648,6 @@ static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child) | |||
649 | ret = qdisc_enqueue(skb, cl->q); | 648 | ret = qdisc_enqueue(skb, cl->q); |
650 | if (ret == NET_XMIT_SUCCESS) { | 649 | if (ret == NET_XMIT_SUCCESS) { |
651 | sch->q.qlen++; | 650 | sch->q.qlen++; |
652 | qdisc_bstats_update(sch, skb); | ||
653 | if (!cl->next_alive) | 651 | if (!cl->next_alive) |
654 | cbq_activate_class(cl); | 652 | cbq_activate_class(cl); |
655 | return 0; | 653 | return 0; |
@@ -971,6 +969,7 @@ cbq_dequeue(struct Qdisc *sch) | |||
971 | 969 | ||
972 | skb = cbq_dequeue_1(sch); | 970 | skb = cbq_dequeue_1(sch); |
973 | if (skb) { | 971 | if (skb) { |
972 | qdisc_bstats_update(sch, skb); | ||
974 | sch->q.qlen--; | 973 | sch->q.qlen--; |
975 | sch->flags &= ~TCQ_F_THROTTLED; | 974 | sch->flags &= ~TCQ_F_THROTTLED; |
976 | return skb; | 975 | return skb; |
diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c index de55e642eaf..6b7fe4a84f1 100644 --- a/net/sched/sch_drr.c +++ b/net/sched/sch_drr.c | |||
@@ -376,7 +376,6 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
376 | } | 376 | } |
377 | 377 | ||
378 | bstats_update(&cl->bstats, skb); | 378 | bstats_update(&cl->bstats, skb); |
379 | qdisc_bstats_update(sch, skb); | ||
380 | 379 | ||
381 | sch->q.qlen++; | 380 | sch->q.qlen++; |
382 | return err; | 381 | return err; |
@@ -403,6 +402,7 @@ static struct sk_buff *drr_dequeue(struct Qdisc *sch) | |||
403 | skb = qdisc_dequeue_peeked(cl->qdisc); | 402 | skb = qdisc_dequeue_peeked(cl->qdisc); |
404 | if (cl->qdisc->q.qlen == 0) | 403 | if (cl->qdisc->q.qlen == 0) |
405 | list_del(&cl->alist); | 404 | list_del(&cl->alist); |
405 | qdisc_bstats_update(sch, skb); | ||
406 | sch->q.qlen--; | 406 | sch->q.qlen--; |
407 | return skb; | 407 | return skb; |
408 | } | 408 | } |
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c index 60f4bdd4408..0f7bf3fdfea 100644 --- a/net/sched/sch_dsmark.c +++ b/net/sched/sch_dsmark.c | |||
@@ -260,7 +260,6 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
260 | return err; | 260 | return err; |
261 | } | 261 | } |
262 | 262 | ||
263 | qdisc_bstats_update(sch, skb); | ||
264 | sch->q.qlen++; | 263 | sch->q.qlen++; |
265 | 264 | ||
266 | return NET_XMIT_SUCCESS; | 265 | return NET_XMIT_SUCCESS; |
@@ -283,6 +282,7 @@ static struct sk_buff *dsmark_dequeue(struct Qdisc *sch) | |||
283 | if (skb == NULL) | 282 | if (skb == NULL) |
284 | return NULL; | 283 | return NULL; |
285 | 284 | ||
285 | qdisc_bstats_update(sch, skb); | ||
286 | sch->q.qlen--; | 286 | sch->q.qlen--; |
287 | 287 | ||
288 | index = skb->tc_index & (p->indices - 1); | 288 | index = skb->tc_index & (p->indices - 1); |
diff --git a/net/sched/sch_fifo.c b/net/sched/sch_fifo.c index aa4d6337e43..d468b479aa9 100644 --- a/net/sched/sch_fifo.c +++ b/net/sched/sch_fifo.c | |||
@@ -46,17 +46,14 @@ static int pfifo_enqueue(struct sk_buff *skb, struct Qdisc* sch) | |||
46 | 46 | ||
47 | static int pfifo_tail_enqueue(struct sk_buff *skb, struct Qdisc* sch) | 47 | static int pfifo_tail_enqueue(struct sk_buff *skb, struct Qdisc* sch) |
48 | { | 48 | { |
49 | struct sk_buff *skb_head; | ||
50 | struct fifo_sched_data *q = qdisc_priv(sch); | 49 | struct fifo_sched_data *q = qdisc_priv(sch); |
51 | 50 | ||
52 | if (likely(skb_queue_len(&sch->q) < q->limit)) | 51 | if (likely(skb_queue_len(&sch->q) < q->limit)) |
53 | return qdisc_enqueue_tail(skb, sch); | 52 | return qdisc_enqueue_tail(skb, sch); |
54 | 53 | ||
55 | /* queue full, remove one skb to fulfill the limit */ | 54 | /* queue full, remove one skb to fulfill the limit */ |
56 | skb_head = qdisc_dequeue_head(sch); | 55 | __qdisc_queue_drop_head(sch, &sch->q); |
57 | sch->qstats.drops++; | 56 | sch->qstats.drops++; |
58 | kfree_skb(skb_head); | ||
59 | |||
60 | qdisc_enqueue_tail(skb, sch); | 57 | qdisc_enqueue_tail(skb, sch); |
61 | 58 | ||
62 | return NET_XMIT_CN; | 59 | return NET_XMIT_CN; |
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 2e45791d4f6..14a799de1c3 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c | |||
@@ -1600,7 +1600,6 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
1600 | set_active(cl, qdisc_pkt_len(skb)); | 1600 | set_active(cl, qdisc_pkt_len(skb)); |
1601 | 1601 | ||
1602 | bstats_update(&cl->bstats, skb); | 1602 | bstats_update(&cl->bstats, skb); |
1603 | qdisc_bstats_update(sch, skb); | ||
1604 | sch->q.qlen++; | 1603 | sch->q.qlen++; |
1605 | 1604 | ||
1606 | return NET_XMIT_SUCCESS; | 1605 | return NET_XMIT_SUCCESS; |
@@ -1666,6 +1665,7 @@ hfsc_dequeue(struct Qdisc *sch) | |||
1666 | } | 1665 | } |
1667 | 1666 | ||
1668 | sch->flags &= ~TCQ_F_THROTTLED; | 1667 | sch->flags &= ~TCQ_F_THROTTLED; |
1668 | qdisc_bstats_update(sch, skb); | ||
1669 | sch->q.qlen--; | 1669 | sch->q.qlen--; |
1670 | 1670 | ||
1671 | return skb; | 1671 | return skb; |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 984c1b0c683..fc12fe6f559 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -574,7 +574,6 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
574 | } | 574 | } |
575 | 575 | ||
576 | sch->q.qlen++; | 576 | sch->q.qlen++; |
577 | qdisc_bstats_update(sch, skb); | ||
578 | return NET_XMIT_SUCCESS; | 577 | return NET_XMIT_SUCCESS; |
579 | } | 578 | } |
580 | 579 | ||
@@ -842,7 +841,7 @@ next: | |||
842 | 841 | ||
843 | static struct sk_buff *htb_dequeue(struct Qdisc *sch) | 842 | static struct sk_buff *htb_dequeue(struct Qdisc *sch) |
844 | { | 843 | { |
845 | struct sk_buff *skb = NULL; | 844 | struct sk_buff *skb; |
846 | struct htb_sched *q = qdisc_priv(sch); | 845 | struct htb_sched *q = qdisc_priv(sch); |
847 | int level; | 846 | int level; |
848 | psched_time_t next_event; | 847 | psched_time_t next_event; |
@@ -851,6 +850,8 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch) | |||
851 | /* try to dequeue direct packets as high prio (!) to minimize cpu work */ | 850 | /* try to dequeue direct packets as high prio (!) to minimize cpu work */ |
852 | skb = __skb_dequeue(&q->direct_queue); | 851 | skb = __skb_dequeue(&q->direct_queue); |
853 | if (skb != NULL) { | 852 | if (skb != NULL) { |
853 | ok: | ||
854 | qdisc_bstats_update(sch, skb); | ||
854 | sch->flags &= ~TCQ_F_THROTTLED; | 855 | sch->flags &= ~TCQ_F_THROTTLED; |
855 | sch->q.qlen--; | 856 | sch->q.qlen--; |
856 | return skb; | 857 | return skb; |
@@ -884,11 +885,8 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch) | |||
884 | int prio = ffz(m); | 885 | int prio = ffz(m); |
885 | m |= 1 << prio; | 886 | m |= 1 << prio; |
886 | skb = htb_dequeue_tree(q, prio, level); | 887 | skb = htb_dequeue_tree(q, prio, level); |
887 | if (likely(skb != NULL)) { | 888 | if (likely(skb != NULL)) |
888 | sch->q.qlen--; | 889 | goto ok; |
889 | sch->flags &= ~TCQ_F_THROTTLED; | ||
890 | goto fin; | ||
891 | } | ||
892 | } | 890 | } |
893 | } | 891 | } |
894 | sch->qstats.overlimits++; | 892 | sch->qstats.overlimits++; |
diff --git a/net/sched/sch_multiq.c b/net/sched/sch_multiq.c index 21f13da2476..436a2e75b32 100644 --- a/net/sched/sch_multiq.c +++ b/net/sched/sch_multiq.c | |||
@@ -83,7 +83,6 @@ multiq_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
83 | 83 | ||
84 | ret = qdisc_enqueue(skb, qdisc); | 84 | ret = qdisc_enqueue(skb, qdisc); |
85 | if (ret == NET_XMIT_SUCCESS) { | 85 | if (ret == NET_XMIT_SUCCESS) { |
86 | qdisc_bstats_update(sch, skb); | ||
87 | sch->q.qlen++; | 86 | sch->q.qlen++; |
88 | return NET_XMIT_SUCCESS; | 87 | return NET_XMIT_SUCCESS; |
89 | } | 88 | } |
@@ -112,6 +111,7 @@ static struct sk_buff *multiq_dequeue(struct Qdisc *sch) | |||
112 | qdisc = q->queues[q->curband]; | 111 | qdisc = q->queues[q->curband]; |
113 | skb = qdisc->dequeue(qdisc); | 112 | skb = qdisc->dequeue(qdisc); |
114 | if (skb) { | 113 | if (skb) { |
114 | qdisc_bstats_update(sch, skb); | ||
115 | sch->q.qlen--; | 115 | sch->q.qlen--; |
116 | return skb; | 116 | return skb; |
117 | } | 117 | } |
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 1c4bce86347..6a3006b38dc 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -240,7 +240,6 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
240 | 240 | ||
241 | if (likely(ret == NET_XMIT_SUCCESS)) { | 241 | if (likely(ret == NET_XMIT_SUCCESS)) { |
242 | sch->q.qlen++; | 242 | sch->q.qlen++; |
243 | qdisc_bstats_update(sch, skb); | ||
244 | } else if (net_xmit_drop_count(ret)) { | 243 | } else if (net_xmit_drop_count(ret)) { |
245 | sch->qstats.drops++; | 244 | sch->qstats.drops++; |
246 | } | 245 | } |
@@ -289,6 +288,7 @@ static struct sk_buff *netem_dequeue(struct Qdisc *sch) | |||
289 | skb->tstamp.tv64 = 0; | 288 | skb->tstamp.tv64 = 0; |
290 | #endif | 289 | #endif |
291 | pr_debug("netem_dequeue: return skb=%p\n", skb); | 290 | pr_debug("netem_dequeue: return skb=%p\n", skb); |
291 | qdisc_bstats_update(sch, skb); | ||
292 | sch->q.qlen--; | 292 | sch->q.qlen--; |
293 | return skb; | 293 | return skb; |
294 | } | 294 | } |
@@ -476,7 +476,6 @@ static int tfifo_enqueue(struct sk_buff *nskb, struct Qdisc *sch) | |||
476 | __skb_queue_after(list, skb, nskb); | 476 | __skb_queue_after(list, skb, nskb); |
477 | 477 | ||
478 | sch->qstats.backlog += qdisc_pkt_len(nskb); | 478 | sch->qstats.backlog += qdisc_pkt_len(nskb); |
479 | qdisc_bstats_update(sch, nskb); | ||
480 | 479 | ||
481 | return NET_XMIT_SUCCESS; | 480 | return NET_XMIT_SUCCESS; |
482 | } | 481 | } |
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c index 966158d49dd..fbd710d619b 100644 --- a/net/sched/sch_prio.c +++ b/net/sched/sch_prio.c | |||
@@ -84,7 +84,6 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
84 | 84 | ||
85 | ret = qdisc_enqueue(skb, qdisc); | 85 | ret = qdisc_enqueue(skb, qdisc); |
86 | if (ret == NET_XMIT_SUCCESS) { | 86 | if (ret == NET_XMIT_SUCCESS) { |
87 | qdisc_bstats_update(sch, skb); | ||
88 | sch->q.qlen++; | 87 | sch->q.qlen++; |
89 | return NET_XMIT_SUCCESS; | 88 | return NET_XMIT_SUCCESS; |
90 | } | 89 | } |
@@ -116,6 +115,7 @@ static struct sk_buff *prio_dequeue(struct Qdisc* sch) | |||
116 | struct Qdisc *qdisc = q->queues[prio]; | 115 | struct Qdisc *qdisc = q->queues[prio]; |
117 | struct sk_buff *skb = qdisc->dequeue(qdisc); | 116 | struct sk_buff *skb = qdisc->dequeue(qdisc); |
118 | if (skb) { | 117 | if (skb) { |
118 | qdisc_bstats_update(sch, skb); | ||
119 | sch->q.qlen--; | 119 | sch->q.qlen--; |
120 | return skb; | 120 | return skb; |
121 | } | 121 | } |
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c index a6009c5a2c9..9f98dbd32d4 100644 --- a/net/sched/sch_red.c +++ b/net/sched/sch_red.c | |||
@@ -94,7 +94,6 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc* sch) | |||
94 | 94 | ||
95 | ret = qdisc_enqueue(skb, child); | 95 | ret = qdisc_enqueue(skb, child); |
96 | if (likely(ret == NET_XMIT_SUCCESS)) { | 96 | if (likely(ret == NET_XMIT_SUCCESS)) { |
97 | qdisc_bstats_update(sch, skb); | ||
98 | sch->q.qlen++; | 97 | sch->q.qlen++; |
99 | } else if (net_xmit_drop_count(ret)) { | 98 | } else if (net_xmit_drop_count(ret)) { |
100 | q->stats.pdrop++; | 99 | q->stats.pdrop++; |
@@ -114,11 +113,13 @@ static struct sk_buff * red_dequeue(struct Qdisc* sch) | |||
114 | struct Qdisc *child = q->qdisc; | 113 | struct Qdisc *child = q->qdisc; |
115 | 114 | ||
116 | skb = child->dequeue(child); | 115 | skb = child->dequeue(child); |
117 | if (skb) | 116 | if (skb) { |
117 | qdisc_bstats_update(sch, skb); | ||
118 | sch->q.qlen--; | 118 | sch->q.qlen--; |
119 | else if (!red_is_idling(&q->parms)) | 119 | } else { |
120 | red_start_of_idle_period(&q->parms); | 120 | if (!red_is_idling(&q->parms)) |
121 | 121 | red_start_of_idle_period(&q->parms); | |
122 | } | ||
122 | return skb; | 123 | return skb; |
123 | } | 124 | } |
124 | 125 | ||
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c index 239ec53a634..edea8cefec6 100644 --- a/net/sched/sch_sfq.c +++ b/net/sched/sch_sfq.c | |||
@@ -402,10 +402,8 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
402 | q->tail = slot; | 402 | q->tail = slot; |
403 | slot->allot = q->scaled_quantum; | 403 | slot->allot = q->scaled_quantum; |
404 | } | 404 | } |
405 | if (++sch->q.qlen <= q->limit) { | 405 | if (++sch->q.qlen <= q->limit) |
406 | qdisc_bstats_update(sch, skb); | ||
407 | return NET_XMIT_SUCCESS; | 406 | return NET_XMIT_SUCCESS; |
408 | } | ||
409 | 407 | ||
410 | sfq_drop(sch); | 408 | sfq_drop(sch); |
411 | return NET_XMIT_CN; | 409 | return NET_XMIT_CN; |
@@ -445,6 +443,7 @@ next_slot: | |||
445 | } | 443 | } |
446 | skb = slot_dequeue_head(slot); | 444 | skb = slot_dequeue_head(slot); |
447 | sfq_dec(q, a); | 445 | sfq_dec(q, a); |
446 | qdisc_bstats_update(sch, skb); | ||
448 | sch->q.qlen--; | 447 | sch->q.qlen--; |
449 | sch->qstats.backlog -= qdisc_pkt_len(skb); | 448 | sch->qstats.backlog -= qdisc_pkt_len(skb); |
450 | 449 | ||
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index 77565e72181..e93165820c3 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c | |||
@@ -134,7 +134,6 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch) | |||
134 | } | 134 | } |
135 | 135 | ||
136 | sch->q.qlen++; | 136 | sch->q.qlen++; |
137 | qdisc_bstats_update(sch, skb); | ||
138 | return NET_XMIT_SUCCESS; | 137 | return NET_XMIT_SUCCESS; |
139 | } | 138 | } |
140 | 139 | ||
@@ -187,6 +186,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch) | |||
187 | q->ptokens = ptoks; | 186 | q->ptokens = ptoks; |
188 | sch->q.qlen--; | 187 | sch->q.qlen--; |
189 | sch->flags &= ~TCQ_F_THROTTLED; | 188 | sch->flags &= ~TCQ_F_THROTTLED; |
189 | qdisc_bstats_update(sch, skb); | ||
190 | return skb; | 190 | return skb; |
191 | } | 191 | } |
192 | 192 | ||
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c index 84ce48eadff..d84e7329660 100644 --- a/net/sched/sch_teql.c +++ b/net/sched/sch_teql.c | |||
@@ -87,7 +87,6 @@ teql_enqueue(struct sk_buff *skb, struct Qdisc* sch) | |||
87 | 87 | ||
88 | if (q->q.qlen < dev->tx_queue_len) { | 88 | if (q->q.qlen < dev->tx_queue_len) { |
89 | __skb_queue_tail(&q->q, skb); | 89 | __skb_queue_tail(&q->q, skb); |
90 | qdisc_bstats_update(sch, skb); | ||
91 | return NET_XMIT_SUCCESS; | 90 | return NET_XMIT_SUCCESS; |
92 | } | 91 | } |
93 | 92 | ||
@@ -111,6 +110,8 @@ teql_dequeue(struct Qdisc* sch) | |||
111 | dat->m->slaves = sch; | 110 | dat->m->slaves = sch; |
112 | netif_wake_queue(m); | 111 | netif_wake_queue(m); |
113 | } | 112 | } |
113 | } else { | ||
114 | qdisc_bstats_update(sch, skb); | ||
114 | } | 115 | } |
115 | sch->q.qlen = dat->q.qlen + dat_queue->qdisc->q.qlen; | 116 | sch->q.qlen = dat->q.qlen + dat_queue->qdisc->q.qlen; |
116 | return skb; | 117 | return skb; |