diff options
276 files changed, 4925 insertions, 1379 deletions
| @@ -23,6 +23,7 @@ Andy Adamson <andros@citi.umich.edu> | |||
| 23 | Arnaud Patard <arnaud.patard@rtp-net.org> | 23 | Arnaud Patard <arnaud.patard@rtp-net.org> |
| 24 | Arnd Bergmann <arnd@arndb.de> | 24 | Arnd Bergmann <arnd@arndb.de> |
| 25 | Axel Dyks <xl@xlsigned.net> | 25 | Axel Dyks <xl@xlsigned.net> |
| 26 | Axel Lin <axel.lin@gmail.com> | ||
| 26 | Ben Gardner <bgardner@wabtec.com> | 27 | Ben Gardner <bgardner@wabtec.com> |
| 27 | Ben M Cahill <ben.m.cahill@intel.com> | 28 | Ben M Cahill <ben.m.cahill@intel.com> |
| 28 | Björn Steinbrink <B.Steinbrink@gmx.de> | 29 | Björn Steinbrink <B.Steinbrink@gmx.de> |
diff --git a/Documentation/ABI/testing/sysfs-platform-at91 b/Documentation/ABI/testing/sysfs-platform-at91 new file mode 100644 index 000000000000..4cc6a865ae66 --- /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/filesystems/ntfs.txt b/Documentation/filesystems/ntfs.txt index 6ef8cf3bc9a3..933bc66ccff1 100644 --- a/Documentation/filesystems/ntfs.txt +++ b/Documentation/filesystems/ntfs.txt | |||
| @@ -460,6 +460,8 @@ Note, a technical ChangeLog aimed at kernel hackers is in fs/ntfs/ChangeLog. | |||
| 460 | 2.1.30: | 460 | 2.1.30: |
| 461 | - Fix writev() (it kept writing the first segment over and over again | 461 | - Fix writev() (it kept writing the first segment over and over again |
| 462 | instead of moving onto subsequent segments). | 462 | instead of moving onto subsequent segments). |
| 463 | - Fix crash in ntfs_mft_record_alloc() when mapping the new extent mft | ||
| 464 | record failed. | ||
| 463 | 2.1.29: | 465 | 2.1.29: |
| 464 | - Fix a deadlock when mounting read-write. | 466 | - Fix a deadlock when mounting read-write. |
| 465 | 2.1.28: | 467 | 2.1.28: |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index b72e071a3e5b..89835a4766a6 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
| @@ -43,11 +43,11 @@ parameter is applicable: | |||
| 43 | AVR32 AVR32 architecture is enabled. | 43 | AVR32 AVR32 architecture is enabled. |
| 44 | AX25 Appropriate AX.25 support is enabled. | 44 | AX25 Appropriate AX.25 support is enabled. |
| 45 | BLACKFIN Blackfin architecture is enabled. | 45 | BLACKFIN Blackfin architecture is enabled. |
| 46 | DRM Direct Rendering Management support is enabled. | ||
| 47 | DYNAMIC_DEBUG Build in debug messages and enable them at runtime | ||
| 46 | EDD BIOS Enhanced Disk Drive Services (EDD) is enabled | 48 | EDD BIOS Enhanced Disk Drive Services (EDD) is enabled |
| 47 | EFI EFI Partitioning (GPT) is enabled | 49 | EFI EFI Partitioning (GPT) is enabled |
| 48 | EIDE EIDE/ATAPI support is enabled. | 50 | EIDE EIDE/ATAPI support is enabled. |
| 49 | DRM Direct Rendering Management support is enabled. | ||
| 50 | DYNAMIC_DEBUG Build in debug messages and enable them at runtime | ||
| 51 | FB The frame buffer device is enabled. | 51 | FB The frame buffer device is enabled. |
| 52 | GCOV GCOV profiling is enabled. | 52 | GCOV GCOV profiling is enabled. |
| 53 | HW Appropriate hardware is enabled. | 53 | HW Appropriate hardware is enabled. |
diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt index 5dc638791d97..25d2f4141d27 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 cf0f3a5c09cc..9d12977b6baf 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/include/asm/hardware/sp810.h b/arch/arm/include/asm/hardware/sp810.h index a101f10bb5b1..721847dc68ab 100644 --- a/arch/arm/include/asm/hardware/sp810.h +++ b/arch/arm/include/asm/hardware/sp810.h | |||
| @@ -50,6 +50,12 @@ | |||
| 50 | #define SCPCELLID2 0xFF8 | 50 | #define SCPCELLID2 0xFF8 |
| 51 | #define SCPCELLID3 0xFFC | 51 | #define SCPCELLID3 0xFFC |
| 52 | 52 | ||
| 53 | #define SCCTRL_TIMEREN0SEL_REFCLK (0 << 15) | ||
| 54 | #define SCCTRL_TIMEREN0SEL_TIMCLK (1 << 15) | ||
| 55 | |||
| 56 | #define SCCTRL_TIMEREN1SEL_REFCLK (0 << 17) | ||
| 57 | #define SCCTRL_TIMEREN1SEL_TIMCLK (1 << 17) | ||
| 58 | |||
| 53 | static inline void sysctl_soft_reset(void __iomem *base) | 59 | static inline void sysctl_soft_reset(void __iomem *base) |
| 54 | { | 60 | { |
| 55 | /* writing any value to SCSYSSTAT reg will reset system */ | 61 | /* writing any value to SCSYSSTAT reg will reset system */ |
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index 23c2e8e5c0fa..d0ee74b7cf86 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h | |||
| @@ -188,7 +188,7 @@ | |||
| 188 | * translation for translating DMA addresses. Use the driver | 188 | * translation for translating DMA addresses. Use the driver |
| 189 | * DMA support - see dma-mapping.h. | 189 | * DMA support - see dma-mapping.h. |
| 190 | */ | 190 | */ |
| 191 | static inline unsigned long virt_to_phys(void *x) | 191 | static inline unsigned long virt_to_phys(const volatile void *x) |
| 192 | { | 192 | { |
| 193 | return __virt_to_phys((unsigned long)(x)); | 193 | return __virt_to_phys((unsigned long)(x)); |
| 194 | } | 194 | } |
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index fd9156698ab9..60636f499cb3 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c | |||
| @@ -36,6 +36,7 @@ static void twd_set_mode(enum clock_event_mode mode, | |||
| 36 | /* timer load already set up */ | 36 | /* timer load already set up */ |
| 37 | ctrl = TWD_TIMER_CONTROL_ENABLE | TWD_TIMER_CONTROL_IT_ENABLE | 37 | ctrl = TWD_TIMER_CONTROL_ENABLE | TWD_TIMER_CONTROL_IT_ENABLE |
| 38 | | TWD_TIMER_CONTROL_PERIODIC; | 38 | | TWD_TIMER_CONTROL_PERIODIC; |
| 39 | __raw_writel(twd_timer_rate / HZ, twd_base + TWD_TIMER_LOAD); | ||
| 39 | break; | 40 | break; |
| 40 | case CLOCK_EVT_MODE_ONESHOT: | 41 | case CLOCK_EVT_MODE_ONESHOT: |
| 41 | /* period set, and timer enabled in 'next_event' hook */ | 42 | /* period set, and timer enabled in 'next_event' hook */ |
| @@ -81,7 +82,7 @@ int twd_timer_ack(void) | |||
| 81 | 82 | ||
| 82 | static void __cpuinit twd_calibrate_rate(void) | 83 | static void __cpuinit twd_calibrate_rate(void) |
| 83 | { | 84 | { |
| 84 | unsigned long load, count; | 85 | unsigned long count; |
| 85 | u64 waitjiffies; | 86 | u64 waitjiffies; |
| 86 | 87 | ||
| 87 | /* | 88 | /* |
| @@ -116,10 +117,6 @@ static void __cpuinit twd_calibrate_rate(void) | |||
| 116 | printk("%lu.%02luMHz.\n", twd_timer_rate / 1000000, | 117 | printk("%lu.%02luMHz.\n", twd_timer_rate / 1000000, |
| 117 | (twd_timer_rate / 1000000) % 100); | 118 | (twd_timer_rate / 1000000) % 100); |
| 118 | } | 119 | } |
| 119 | |||
| 120 | load = twd_timer_rate / HZ; | ||
| 121 | |||
| 122 | __raw_writel(load, twd_base + TWD_TIMER_LOAD); | ||
| 123 | } | 120 | } |
| 124 | 121 | ||
| 125 | /* | 122 | /* |
diff --git a/arch/arm/mach-ep93xx/gpio.c b/arch/arm/mach-ep93xx/gpio.c index f3dc76fdcea8..bec34b834958 100644 --- a/arch/arm/mach-ep93xx/gpio.c +++ b/arch/arm/mach-ep93xx/gpio.c | |||
| @@ -427,6 +427,13 @@ void __init ep93xx_gpio_init(void) | |||
| 427 | { | 427 | { |
| 428 | int i; | 428 | int i; |
| 429 | 429 | ||
| 430 | /* Set Ports C, D, E, G, and H for GPIO use */ | ||
| 431 | ep93xx_devcfg_set_bits(EP93XX_SYSCON_DEVCFG_KEYS | | ||
| 432 | EP93XX_SYSCON_DEVCFG_GONK | | ||
| 433 | EP93XX_SYSCON_DEVCFG_EONIDE | | ||
| 434 | EP93XX_SYSCON_DEVCFG_GONIDE | | ||
| 435 | EP93XX_SYSCON_DEVCFG_HONIDE); | ||
| 436 | |||
| 430 | for (i = 0; i < ARRAY_SIZE(ep93xx_gpio_banks); i++) | 437 | for (i = 0; i < ARRAY_SIZE(ep93xx_gpio_banks); i++) |
| 431 | gpiochip_add(&ep93xx_gpio_banks[i].chip); | 438 | gpiochip_add(&ep93xx_gpio_banks[i].chip); |
| 432 | } | 439 | } |
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c index 9e5dc8ed51e9..97feb3ab6a69 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 8cbbeade4b8a..a4aa1920a75c 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 302da7403a10..32e91a9c8b6b 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-realview/Kconfig b/arch/arm/mach-realview/Kconfig index b4575ae9648e..7ca138a943a9 100644 --- a/arch/arm/mach-realview/Kconfig +++ b/arch/arm/mach-realview/Kconfig | |||
| @@ -2,52 +2,56 @@ menu "RealView platform type" | |||
| 2 | depends on ARCH_REALVIEW | 2 | depends on ARCH_REALVIEW |
| 3 | 3 | ||
| 4 | config MACH_REALVIEW_EB | 4 | config MACH_REALVIEW_EB |
| 5 | bool "Support RealView/EB platform" | 5 | bool "Support RealView(R) Emulation Baseboard" |
| 6 | select ARM_GIC | 6 | select ARM_GIC |
| 7 | help | 7 | help |
| 8 | Include support for the ARM(R) RealView Emulation Baseboard platform. | 8 | Include support for the ARM(R) RealView(R) Emulation Baseboard |
| 9 | platform. | ||
| 9 | 10 | ||
| 10 | config REALVIEW_EB_A9MP | 11 | config REALVIEW_EB_A9MP |
| 11 | bool "Support Multicore Cortex-A9" | 12 | bool "Support Multicore Cortex-A9 Tile" |
| 12 | depends on MACH_REALVIEW_EB | 13 | depends on MACH_REALVIEW_EB |
| 13 | select CPU_V7 | 14 | select CPU_V7 |
| 14 | help | 15 | help |
| 15 | Enable support for the Cortex-A9MPCore tile on the Realview platform. | 16 | Enable support for the Cortex-A9MPCore tile fitted to the |
| 17 | Realview(R) Emulation Baseboard platform. | ||
| 16 | 18 | ||
| 17 | config REALVIEW_EB_ARM11MP | 19 | config REALVIEW_EB_ARM11MP |
| 18 | bool "Support ARM11MPCore tile" | 20 | bool "Support ARM11MPCore Tile" |
| 19 | depends on MACH_REALVIEW_EB | 21 | depends on MACH_REALVIEW_EB |
| 20 | select CPU_V6 | 22 | select CPU_V6 |
| 21 | select ARCH_HAS_BARRIERS if SMP | 23 | select ARCH_HAS_BARRIERS if SMP |
| 22 | help | 24 | help |
| 23 | Enable support for the ARM11MPCore tile on the Realview platform. | 25 | Enable support for the ARM11MPCore tile fitted to the Realview(R) |
| 26 | Emulation Baseboard platform. | ||
| 24 | 27 | ||
| 25 | config REALVIEW_EB_ARM11MP_REVB | 28 | config REALVIEW_EB_ARM11MP_REVB |
| 26 | bool "Support ARM11MPCore RevB tile" | 29 | bool "Support ARM11MPCore RevB Tile" |
| 27 | depends on REALVIEW_EB_ARM11MP | 30 | depends on REALVIEW_EB_ARM11MP |
| 28 | help | 31 | help |
| 29 | Enable support for the ARM11MPCore RevB tile on the Realview | 32 | Enable support for the ARM11MPCore Revision B tile on the |
| 30 | platform. Since there are device address differences, a | 33 | Realview(R) Emulation Baseboard platform. Since there are device |
| 31 | kernel built with this option enabled is not compatible with | 34 | address differences, a kernel built with this option enabled is |
| 32 | other revisions of the ARM11MPCore tile. | 35 | not compatible with other revisions of the ARM11MPCore tile. |
| 33 | 36 | ||
| 34 | config MACH_REALVIEW_PB11MP | 37 | config MACH_REALVIEW_PB11MP |
| 35 | bool "Support RealView/PB11MPCore platform" | 38 | bool "Support RealView(R) Platform Baseboard for ARM11MPCore" |
| 36 | select CPU_V6 | 39 | select CPU_V6 |
| 37 | select ARM_GIC | 40 | select ARM_GIC |
| 38 | select HAVE_PATA_PLATFORM | 41 | select HAVE_PATA_PLATFORM |
| 39 | select ARCH_HAS_BARRIERS if SMP | 42 | select ARCH_HAS_BARRIERS if SMP |
| 40 | help | 43 | help |
| 41 | Include support for the ARM(R) RealView MPCore Platform Baseboard. | 44 | Include support for the ARM(R) RealView(R) Platform Baseboard for |
| 42 | PB11MPCore is a platform with an on-board ARM11MPCore and has | 45 | the ARM11MPCore. This platform has an on-board ARM11MPCore and has |
| 43 | support for PCI-E and Compact Flash. | 46 | support for PCI-E and Compact Flash. |
| 44 | 47 | ||
| 45 | config MACH_REALVIEW_PB1176 | 48 | config MACH_REALVIEW_PB1176 |
| 46 | bool "Support RealView/PB1176 platform" | 49 | bool "Support RealView(R) Platform Baseboard for ARM1176JZF-S" |
| 47 | select CPU_V6 | 50 | select CPU_V6 |
| 48 | select ARM_GIC | 51 | select ARM_GIC |
| 49 | help | 52 | help |
| 50 | Include support for the ARM(R) RealView ARM1176 Platform Baseboard. | 53 | Include support for the ARM(R) RealView(R) Platform Baseboard for |
| 54 | ARM1176JZF-S. | ||
| 51 | 55 | ||
| 52 | config REALVIEW_PB1176_SECURE_FLASH | 56 | config REALVIEW_PB1176_SECURE_FLASH |
| 53 | bool "Allow access to the secure flash memory block" | 57 | bool "Allow access to the secure flash memory block" |
| @@ -59,23 +63,24 @@ config REALVIEW_PB1176_SECURE_FLASH | |||
| 59 | block (64MB @ 0x3c000000) is required. | 63 | block (64MB @ 0x3c000000) is required. |
| 60 | 64 | ||
| 61 | config MACH_REALVIEW_PBA8 | 65 | config MACH_REALVIEW_PBA8 |
| 62 | bool "Support RealView/PB-A8 platform" | 66 | bool "Support RealView(R) Platform Baseboard for Cortex(tm)-A8 platform" |
| 63 | select CPU_V7 | 67 | select CPU_V7 |
| 64 | select ARM_GIC | 68 | select ARM_GIC |
| 65 | select HAVE_PATA_PLATFORM | 69 | select HAVE_PATA_PLATFORM |
| 66 | help | 70 | help |
| 67 | Include support for the ARM(R) RealView Cortex-A8 Platform Baseboard. | 71 | Include support for the ARM(R) RealView Platform Baseboard for |
| 68 | PB-A8 is a platform with an on-board Cortex-A8 and has support for | 72 | Cortex(tm)-A8. This platform has an on-board Cortex-A8 and has |
| 69 | PCI-E and Compact Flash. | 73 | support for PCI-E and Compact Flash. |
| 70 | 74 | ||
| 71 | config MACH_REALVIEW_PBX | 75 | config MACH_REALVIEW_PBX |
| 72 | bool "Support RealView/PBX platform" | 76 | bool "Support RealView(R) Platform Baseboard Explore" |
| 73 | select ARM_GIC | 77 | select ARM_GIC |
| 74 | select HAVE_PATA_PLATFORM | 78 | select HAVE_PATA_PLATFORM |
| 75 | select ARCH_SPARSEMEM_ENABLE if CPU_V7 && !REALVIEW_HIGH_PHYS_OFFSET | 79 | select ARCH_SPARSEMEM_ENABLE if CPU_V7 && !REALVIEW_HIGH_PHYS_OFFSET |
| 76 | select ZONE_DMA if SPARSEMEM | 80 | select ZONE_DMA if SPARSEMEM |
| 77 | help | 81 | help |
| 78 | Include support for the ARM(R) RealView PBX platform. | 82 | Include support for the ARM(R) RealView(R) Platform Baseboard |
| 83 | Explore. | ||
| 79 | 84 | ||
| 80 | config REALVIEW_HIGH_PHYS_OFFSET | 85 | config REALVIEW_HIGH_PHYS_OFFSET |
| 81 | bool "High physical base address for the RealView platform" | 86 | bool "High physical base address for the RealView platform" |
diff --git a/arch/arm/mach-realview/platsmp.c b/arch/arm/mach-realview/platsmp.c index a22bf67f2f78..6959d13d908a 100644 --- a/arch/arm/mach-realview/platsmp.c +++ b/arch/arm/mach-realview/platsmp.c | |||
| @@ -41,7 +41,7 @@ volatile int __cpuinitdata pen_release = -1; | |||
| 41 | * observers, irrespective of whether they're taking part in coherency | 41 | * observers, irrespective of whether they're taking part in coherency |
| 42 | * or not. This is necessary for the hotplug code to work reliably. | 42 | * or not. This is necessary for the hotplug code to work reliably. |
| 43 | */ | 43 | */ |
| 44 | static void write_pen_release(int val) | 44 | static void __cpuinit write_pen_release(int val) |
| 45 | { | 45 | { |
| 46 | pen_release = val; | 46 | pen_release = val; |
| 47 | smp_wmb(); | 47 | smp_wmb(); |
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index 4d1b4c5c9389..0c8f6cf3e948 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig | |||
| @@ -60,6 +60,8 @@ endchoice | |||
| 60 | 60 | ||
| 61 | config MACH_AG5EVM | 61 | config MACH_AG5EVM |
| 62 | bool "AG5EVM board" | 62 | bool "AG5EVM board" |
| 63 | select ARCH_REQUIRE_GPIOLIB | ||
| 64 | select SH_LCD_MIPI_DSI | ||
| 63 | depends on ARCH_SH73A0 | 65 | depends on ARCH_SH73A0 |
| 64 | 66 | ||
| 65 | config MACH_MACKEREL | 67 | config MACH_MACKEREL |
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c index c18a740a4159..2123b96b5638 100644 --- a/arch/arm/mach-shmobile/board-ag5evm.c +++ b/arch/arm/mach-shmobile/board-ag5evm.c | |||
| @@ -34,9 +34,10 @@ | |||
| 34 | #include <linux/input/sh_keysc.h> | 34 | #include <linux/input/sh_keysc.h> |
| 35 | #include <linux/mmc/host.h> | 35 | #include <linux/mmc/host.h> |
| 36 | #include <linux/mmc/sh_mmcif.h> | 36 | #include <linux/mmc/sh_mmcif.h> |
| 37 | 37 | #include <linux/sh_clk.h> | |
| 38 | #include <video/sh_mobile_lcdc.h> | ||
| 39 | #include <video/sh_mipi_dsi.h> | ||
| 38 | #include <sound/sh_fsi.h> | 40 | #include <sound/sh_fsi.h> |
| 39 | |||
| 40 | #include <mach/hardware.h> | 41 | #include <mach/hardware.h> |
| 41 | #include <mach/sh73a0.h> | 42 | #include <mach/sh73a0.h> |
| 42 | #include <mach/common.h> | 43 | #include <mach/common.h> |
| @@ -183,11 +184,165 @@ static struct platform_device mmc_device = { | |||
| 183 | .resource = sh_mmcif_resources, | 184 | .resource = sh_mmcif_resources, |
| 184 | }; | 185 | }; |
| 185 | 186 | ||
| 187 | /* IrDA */ | ||
| 188 | static struct resource irda_resources[] = { | ||
| 189 | [0] = { | ||
| 190 | .start = 0xE6D00000, | ||
| 191 | .end = 0xE6D01FD4 - 1, | ||
| 192 | .flags = IORESOURCE_MEM, | ||
| 193 | }, | ||
| 194 | [1] = { | ||
| 195 | .start = gic_spi(95), | ||
| 196 | .flags = IORESOURCE_IRQ, | ||
| 197 | }, | ||
| 198 | }; | ||
| 199 | |||
| 200 | static struct platform_device irda_device = { | ||
| 201 | .name = "sh_irda", | ||
| 202 | .id = 0, | ||
| 203 | .resource = irda_resources, | ||
| 204 | .num_resources = ARRAY_SIZE(irda_resources), | ||
| 205 | }; | ||
| 206 | |||
| 207 | static unsigned char lcd_backlight_seq[3][2] = { | ||
| 208 | { 0x04, 0x07 }, | ||
| 209 | { 0x23, 0x80 }, | ||
| 210 | { 0x03, 0x01 }, | ||
| 211 | }; | ||
| 212 | |||
| 213 | static void lcd_backlight_on(void) | ||
| 214 | { | ||
| 215 | struct i2c_adapter *a; | ||
| 216 | struct i2c_msg msg; | ||
| 217 | int k; | ||
| 218 | |||
| 219 | a = i2c_get_adapter(1); | ||
| 220 | for (k = 0; a && k < 3; k++) { | ||
| 221 | msg.addr = 0x6d; | ||
| 222 | msg.buf = &lcd_backlight_seq[k][0]; | ||
| 223 | msg.len = 2; | ||
| 224 | msg.flags = 0; | ||
| 225 | if (i2c_transfer(a, &msg, 1) != 1) | ||
| 226 | break; | ||
| 227 | } | ||
| 228 | } | ||
| 229 | |||
| 230 | static void lcd_backlight_reset(void) | ||
| 231 | { | ||
| 232 | gpio_set_value(GPIO_PORT235, 0); | ||
| 233 | mdelay(24); | ||
| 234 | gpio_set_value(GPIO_PORT235, 1); | ||
| 235 | } | ||
| 236 | |||
| 237 | static void lcd_on(void *board_data, struct fb_info *info) | ||
| 238 | { | ||
| 239 | lcd_backlight_on(); | ||
| 240 | } | ||
| 241 | |||
| 242 | static void lcd_off(void *board_data) | ||
| 243 | { | ||
| 244 | lcd_backlight_reset(); | ||
| 245 | } | ||
| 246 | |||
| 247 | /* LCDC0 */ | ||
| 248 | static const struct fb_videomode lcdc0_modes[] = { | ||
| 249 | { | ||
| 250 | .name = "R63302(QHD)", | ||
| 251 | .xres = 544, | ||
| 252 | .yres = 961, | ||
| 253 | .left_margin = 72, | ||
| 254 | .right_margin = 600, | ||
| 255 | .hsync_len = 16, | ||
| 256 | .upper_margin = 8, | ||
| 257 | .lower_margin = 8, | ||
| 258 | .vsync_len = 2, | ||
| 259 | .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT, | ||
| 260 | }, | ||
| 261 | }; | ||
| 262 | |||
| 263 | static struct sh_mobile_lcdc_info lcdc0_info = { | ||
| 264 | .clock_source = LCDC_CLK_PERIPHERAL, | ||
| 265 | .ch[0] = { | ||
| 266 | .chan = LCDC_CHAN_MAINLCD, | ||
| 267 | .interface_type = RGB24, | ||
| 268 | .clock_divider = 1, | ||
| 269 | .flags = LCDC_FLAGS_DWPOL, | ||
| 270 | .lcd_size_cfg.width = 44, | ||
| 271 | .lcd_size_cfg.height = 79, | ||
| 272 | .bpp = 16, | ||
| 273 | .lcd_cfg = lcdc0_modes, | ||
| 274 | .num_cfg = ARRAY_SIZE(lcdc0_modes), | ||
| 275 | .board_cfg = { | ||
| 276 | .display_on = lcd_on, | ||
| 277 | .display_off = lcd_off, | ||
| 278 | }, | ||
| 279 | } | ||
| 280 | }; | ||
| 281 | |||
| 282 | static struct resource lcdc0_resources[] = { | ||
| 283 | [0] = { | ||
| 284 | .name = "LCDC0", | ||
| 285 | .start = 0xfe940000, /* P4-only space */ | ||
| 286 | .end = 0xfe943fff, | ||
| 287 | .flags = IORESOURCE_MEM, | ||
| 288 | }, | ||
| 289 | [1] = { | ||
| 290 | .start = intcs_evt2irq(0x580), | ||
| 291 | .flags = IORESOURCE_IRQ, | ||
| 292 | }, | ||
| 293 | }; | ||
| 294 | |||
| 295 | static struct platform_device lcdc0_device = { | ||
| 296 | .name = "sh_mobile_lcdc_fb", | ||
| 297 | .num_resources = ARRAY_SIZE(lcdc0_resources), | ||
| 298 | .resource = lcdc0_resources, | ||
| 299 | .id = 0, | ||
| 300 | .dev = { | ||
| 301 | .platform_data = &lcdc0_info, | ||
| 302 | .coherent_dma_mask = ~0, | ||
| 303 | }, | ||
| 304 | }; | ||
| 305 | |||
| 306 | /* MIPI-DSI */ | ||
| 307 | static struct resource mipidsi0_resources[] = { | ||
| 308 | [0] = { | ||
| 309 | .start = 0xfeab0000, | ||
| 310 | .end = 0xfeab3fff, | ||
| 311 | .flags = IORESOURCE_MEM, | ||
| 312 | }, | ||
| 313 | [1] = { | ||
| 314 | .start = 0xfeab4000, | ||
| 315 | .end = 0xfeab7fff, | ||
| 316 | .flags = IORESOURCE_MEM, | ||
| 317 | }, | ||
| 318 | }; | ||
| 319 | |||
| 320 | static struct sh_mipi_dsi_info mipidsi0_info = { | ||
| 321 | .data_format = MIPI_RGB888, | ||
| 322 | .lcd_chan = &lcdc0_info.ch[0], | ||
| 323 | .vsynw_offset = 20, | ||
| 324 | .clksrc = 1, | ||
| 325 | .flags = SH_MIPI_DSI_HSABM, | ||
| 326 | }; | ||
| 327 | |||
| 328 | static struct platform_device mipidsi0_device = { | ||
| 329 | .name = "sh-mipi-dsi", | ||
| 330 | .num_resources = ARRAY_SIZE(mipidsi0_resources), | ||
| 331 | .resource = mipidsi0_resources, | ||
| 332 | .id = 0, | ||
| 333 | .dev = { | ||
| 334 | .platform_data = &mipidsi0_info, | ||
| 335 | }, | ||
| 336 | }; | ||
| 337 | |||
| 186 | static struct platform_device *ag5evm_devices[] __initdata = { | 338 | static struct platform_device *ag5evm_devices[] __initdata = { |
| 187 | ð_device, | 339 | ð_device, |
| 188 | &keysc_device, | 340 | &keysc_device, |
| 189 | &fsi_device, | 341 | &fsi_device, |
| 190 | &mmc_device, | 342 | &mmc_device, |
| 343 | &irda_device, | ||
| 344 | &lcdc0_device, | ||
| 345 | &mipidsi0_device, | ||
| 191 | }; | 346 | }; |
| 192 | 347 | ||
| 193 | static struct map_desc ag5evm_io_desc[] __initdata = { | 348 | static struct map_desc ag5evm_io_desc[] __initdata = { |
| @@ -224,6 +379,8 @@ void __init ag5evm_init_irq(void) | |||
| 224 | __raw_writew(__raw_readw(PINTCR0A) | (2<<10), PINTCR0A); | 379 | __raw_writew(__raw_readw(PINTCR0A) | (2<<10), PINTCR0A); |
| 225 | } | 380 | } |
| 226 | 381 | ||
| 382 | #define DSI0PHYCR 0xe615006c | ||
| 383 | |||
| 227 | static void __init ag5evm_init(void) | 384 | static void __init ag5evm_init(void) |
| 228 | { | 385 | { |
| 229 | sh73a0_pinmux_init(); | 386 | sh73a0_pinmux_init(); |
| @@ -287,6 +444,25 @@ static void __init ag5evm_init(void) | |||
| 287 | gpio_request(GPIO_FN_FSIAISLD, NULL); | 444 | gpio_request(GPIO_FN_FSIAISLD, NULL); |
| 288 | gpio_request(GPIO_FN_FSIAOSLD, NULL); | 445 | gpio_request(GPIO_FN_FSIAOSLD, NULL); |
| 289 | 446 | ||
| 447 | /* IrDA */ | ||
| 448 | gpio_request(GPIO_FN_PORT241_IRDA_OUT, NULL); | ||
| 449 | gpio_request(GPIO_FN_PORT242_IRDA_IN, NULL); | ||
| 450 | gpio_request(GPIO_FN_PORT243_IRDA_FIRSEL, NULL); | ||
| 451 | |||
| 452 | /* LCD panel */ | ||
| 453 | gpio_request(GPIO_PORT217, NULL); /* RESET */ | ||
| 454 | gpio_direction_output(GPIO_PORT217, 0); | ||
| 455 | mdelay(1); | ||
| 456 | gpio_set_value(GPIO_PORT217, 1); | ||
| 457 | |||
| 458 | /* LCD backlight controller */ | ||
| 459 | gpio_request(GPIO_PORT235, NULL); /* RESET */ | ||
| 460 | gpio_direction_output(GPIO_PORT235, 0); | ||
| 461 | lcd_backlight_reset(); | ||
| 462 | |||
| 463 | /* MIPI-DSI clock setup */ | ||
| 464 | __raw_writel(0x2a809010, DSI0PHYCR); | ||
| 465 | |||
| 290 | #ifdef CONFIG_CACHE_L2X0 | 466 | #ifdef CONFIG_CACHE_L2X0 |
| 291 | /* Shared attribute override enable, 64K*8way */ | 467 | /* Shared attribute override enable, 64K*8way */ |
| 292 | l2x0_init(__io(0xf0100000), 0x00460000, 0xc2000fff); | 468 | l2x0_init(__io(0xf0100000), 0x00460000, 0xc2000fff); |
diff --git a/arch/arm/mach-shmobile/board-g3evm.c b/arch/arm/mach-shmobile/board-g3evm.c index 686b304a7708..ef4613b993a2 100644 --- a/arch/arm/mach-shmobile/board-g3evm.c +++ b/arch/arm/mach-shmobile/board-g3evm.c | |||
| @@ -347,7 +347,6 @@ static void __init g3evm_init(void) | |||
| 347 | gpio_request(GPIO_FN_IRDA_OUT, NULL); | 347 | gpio_request(GPIO_FN_IRDA_OUT, NULL); |
| 348 | gpio_request(GPIO_FN_IRDA_IN, NULL); | 348 | gpio_request(GPIO_FN_IRDA_IN, NULL); |
| 349 | gpio_request(GPIO_FN_IRDA_FIRSEL, NULL); | 349 | gpio_request(GPIO_FN_IRDA_FIRSEL, NULL); |
| 350 | set_irq_type(evt2irq(0x480), IRQ_TYPE_LEVEL_LOW); | ||
| 351 | 350 | ||
| 352 | sh7367_add_standard_devices(); | 351 | sh7367_add_standard_devices(); |
| 353 | 352 | ||
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 7b15d21f0f68..fb4213a4e15a 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c | |||
| @@ -169,9 +169,8 @@ | |||
| 169 | * SW1 | SW33 | 169 | * SW1 | SW33 |
| 170 | * | bit1 | bit2 | bit3 | bit4 | 170 | * | bit1 | bit2 | bit3 | bit4 |
| 171 | * -------------+------+------+------+------- | 171 | * -------------+------+------+------+------- |
| 172 | * MMC0 OFF | OFF | ON | ON | X | 172 | * MMC0 OFF | OFF | X | ON | X (Use MMCIF) |
| 173 | * MMC1 ON | OFF | ON | X | ON | 173 | * SDHI1 OFF | ON | X | OFF | X (Use MFD_SH_MOBILE_SDHI) |
| 174 | * SDHI1 OFF | ON | X | OFF | ON | ||
| 175 | * | 174 | * |
| 176 | */ | 175 | */ |
| 177 | 176 | ||
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c index 9aa8d68d1a9c..e9731b5a73ed 100644 --- a/arch/arm/mach-shmobile/clock-sh7372.c +++ b/arch/arm/mach-shmobile/clock-sh7372.c | |||
| @@ -234,7 +234,9 @@ static int pllc2_set_rate(struct clk *clk, unsigned long rate) | |||
| 234 | 234 | ||
| 235 | value = __raw_readl(PLLC2CR) & ~(0x3f << 24); | 235 | value = __raw_readl(PLLC2CR) & ~(0x3f << 24); |
| 236 | 236 | ||
| 237 | __raw_writel((value & ~0x80000000) | ((idx + 19) << 24), PLLC2CR); | 237 | __raw_writel(value | ((idx + 19) << 24), PLLC2CR); |
| 238 | |||
| 239 | clk->rate = clk->freq_table[idx].frequency; | ||
| 238 | 240 | ||
| 239 | return 0; | 241 | return 0; |
| 240 | } | 242 | } |
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c index 720a71433be6..ddd4a1b775f0 100644 --- a/arch/arm/mach-shmobile/clock-sh73a0.c +++ b/arch/arm/mach-shmobile/clock-sh73a0.c | |||
| @@ -118,8 +118,16 @@ static unsigned long pll_recalc(struct clk *clk) | |||
| 118 | { | 118 | { |
| 119 | unsigned long mult = 1; | 119 | unsigned long mult = 1; |
| 120 | 120 | ||
| 121 | if (__raw_readl(PLLECR) & (1 << clk->enable_bit)) | 121 | if (__raw_readl(PLLECR) & (1 << clk->enable_bit)) { |
| 122 | mult = (((__raw_readl(clk->enable_reg) >> 24) & 0x3f) + 1); | 122 | mult = (((__raw_readl(clk->enable_reg) >> 24) & 0x3f) + 1); |
| 123 | /* handle CFG bit for PLL1 and PLL2 */ | ||
| 124 | switch (clk->enable_bit) { | ||
| 125 | case 1: | ||
| 126 | case 2: | ||
| 127 | if (__raw_readl(clk->enable_reg) & (1 << 20)) | ||
| 128 | mult *= 2; | ||
| 129 | } | ||
| 130 | } | ||
| 123 | 131 | ||
| 124 | return clk->parent->rate * mult; | 132 | return clk->parent->rate * mult; |
| 125 | } | 133 | } |
| @@ -212,7 +220,7 @@ enum { DIV4_I, DIV4_ZG, DIV4_M3, DIV4_B, DIV4_M1, DIV4_M2, | |||
| 212 | static struct clk div4_clks[DIV4_NR] = { | 220 | static struct clk div4_clks[DIV4_NR] = { |
| 213 | [DIV4_I] = DIV4(FRQCRA, 20, 0xfff, CLK_ENABLE_ON_INIT), | 221 | [DIV4_I] = DIV4(FRQCRA, 20, 0xfff, CLK_ENABLE_ON_INIT), |
| 214 | [DIV4_ZG] = DIV4(FRQCRA, 16, 0xbff, CLK_ENABLE_ON_INIT), | 222 | [DIV4_ZG] = DIV4(FRQCRA, 16, 0xbff, CLK_ENABLE_ON_INIT), |
| 215 | [DIV4_M3] = DIV4(FRQCRA, 8, 0xfff, CLK_ENABLE_ON_INIT), | 223 | [DIV4_M3] = DIV4(FRQCRA, 12, 0xfff, CLK_ENABLE_ON_INIT), |
| 216 | [DIV4_B] = DIV4(FRQCRA, 8, 0xfff, CLK_ENABLE_ON_INIT), | 224 | [DIV4_B] = DIV4(FRQCRA, 8, 0xfff, CLK_ENABLE_ON_INIT), |
| 217 | [DIV4_M1] = DIV4(FRQCRA, 4, 0xfff, 0), | 225 | [DIV4_M1] = DIV4(FRQCRA, 4, 0xfff, 0), |
| 218 | [DIV4_M2] = DIV4(FRQCRA, 0, 0xfff, 0), | 226 | [DIV4_M2] = DIV4(FRQCRA, 0, 0xfff, 0), |
| @@ -255,10 +263,10 @@ static struct clk div6_clks[DIV6_NR] = { | |||
| 255 | }; | 263 | }; |
| 256 | 264 | ||
| 257 | enum { MSTP001, | 265 | enum { MSTP001, |
| 258 | MSTP125, MSTP116, | 266 | MSTP125, MSTP118, MSTP116, MSTP100, |
| 259 | MSTP219, | 267 | MSTP219, |
| 260 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, | 268 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, |
| 261 | MSTP331, MSTP329, MSTP323, MSTP312, | 269 | MSTP331, MSTP329, MSTP325, MSTP323, MSTP312, |
| 262 | MSTP411, MSTP410, MSTP403, | 270 | MSTP411, MSTP410, MSTP403, |
| 263 | MSTP_NR }; | 271 | MSTP_NR }; |
| 264 | 272 | ||
| @@ -268,7 +276,9 @@ enum { MSTP001, | |||
| 268 | static struct clk mstp_clks[MSTP_NR] = { | 276 | static struct clk mstp_clks[MSTP_NR] = { |
| 269 | [MSTP001] = MSTP(&div4_clks[DIV4_HP], SMSTPCR0, 1, 0), /* IIC2 */ | 277 | [MSTP001] = MSTP(&div4_clks[DIV4_HP], SMSTPCR0, 1, 0), /* IIC2 */ |
| 270 | [MSTP125] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */ | 278 | [MSTP125] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */ |
| 279 | [MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, 0), /* DSITX0 */ | ||
| 271 | [MSTP116] = MSTP(&div4_clks[DIV4_HP], SMSTPCR1, 16, 0), /* IIC0 */ | 280 | [MSTP116] = MSTP(&div4_clks[DIV4_HP], SMSTPCR1, 16, 0), /* IIC0 */ |
| 281 | [MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */ | ||
| 272 | [MSTP219] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 19, 0), /* SCIFA7 */ | 282 | [MSTP219] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 19, 0), /* SCIFA7 */ |
| 273 | [MSTP207] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */ | 283 | [MSTP207] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */ |
| 274 | [MSTP206] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */ | 284 | [MSTP206] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */ |
| @@ -279,6 +289,7 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
| 279 | [MSTP200] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 0, 0), /* SCIFA4 */ | 289 | [MSTP200] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 0, 0), /* SCIFA4 */ |
| 280 | [MSTP331] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 31, 0), /* SCIFA6 */ | 290 | [MSTP331] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 31, 0), /* SCIFA6 */ |
| 281 | [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */ | 291 | [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */ |
| 292 | [MSTP325] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 25, 0), /* IrDA */ | ||
| 282 | [MSTP323] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 23, 0), /* IIC1 */ | 293 | [MSTP323] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 23, 0), /* IIC1 */ |
| 283 | [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMCIF0 */ | 294 | [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMCIF0 */ |
| 284 | [MSTP411] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 11, 0), /* IIC3 */ | 295 | [MSTP411] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 11, 0), /* IIC3 */ |
| @@ -288,16 +299,25 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
| 288 | 299 | ||
| 289 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } | 300 | #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } |
| 290 | #define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk } | 301 | #define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk } |
| 302 | #define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk } | ||
| 291 | 303 | ||
| 292 | static struct clk_lookup lookups[] = { | 304 | static struct clk_lookup lookups[] = { |
| 293 | /* main clocks */ | 305 | /* main clocks */ |
| 294 | CLKDEV_CON_ID("r_clk", &r_clk), | 306 | CLKDEV_CON_ID("r_clk", &r_clk), |
| 295 | 307 | ||
| 308 | /* DIV6 clocks */ | ||
| 309 | CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]), | ||
| 310 | CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]), | ||
| 311 | CLKDEV_ICK_ID("dsi0p_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]), | ||
| 312 | CLKDEV_ICK_ID("dsi1p_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]), | ||
| 313 | |||
| 296 | /* MSTP32 clocks */ | 314 | /* MSTP32 clocks */ |
| 297 | CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */ | 315 | CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */ |
| 316 | CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */ | ||
| 298 | CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]), /* TMU00 */ | 317 | CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]), /* TMU00 */ |
| 299 | CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP125]), /* TMU01 */ | 318 | CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP125]), /* TMU01 */ |
| 300 | CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* I2C0 */ | 319 | CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* I2C0 */ |
| 320 | CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX */ | ||
| 301 | CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */ | 321 | CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */ |
| 302 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */ | 322 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */ |
| 303 | CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */ | 323 | CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */ |
| @@ -308,6 +328,7 @@ static struct clk_lookup lookups[] = { | |||
| 308 | CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */ | 328 | CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */ |
| 309 | CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */ | 329 | CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */ |
| 310 | CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */ | 330 | CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */ |
| 331 | CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */ | ||
| 311 | CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */ | 332 | CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */ |
| 312 | CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */ | 333 | CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */ |
| 313 | CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* I2C3 */ | 334 | CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* I2C3 */ |
diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c index f78a1ead71a5..ca5f9d17b39a 100644 --- a/arch/arm/mach-shmobile/intc-sh7372.c +++ b/arch/arm/mach-shmobile/intc-sh7372.c | |||
| @@ -365,6 +365,7 @@ static struct intc_desc intca_desc __initdata = { | |||
| 365 | 365 | ||
| 366 | enum { | 366 | enum { |
| 367 | UNUSED_INTCS = 0, | 367 | UNUSED_INTCS = 0, |
| 368 | ENABLED_INTCS, | ||
| 368 | 369 | ||
| 369 | INTCS, | 370 | INTCS, |
| 370 | 371 | ||
| @@ -413,7 +414,7 @@ enum { | |||
| 413 | CMT4, | 414 | CMT4, |
| 414 | DSITX1_DSITX1_0, | 415 | DSITX1_DSITX1_0, |
| 415 | DSITX1_DSITX1_1, | 416 | DSITX1_DSITX1_1, |
| 416 | /* MFIS2 */ | 417 | MFIS2_INTCS, /* Priority always enabled using ENABLED_INTCS */ |
| 417 | CPORTS2R, | 418 | CPORTS2R, |
| 418 | /* CEC */ | 419 | /* CEC */ |
| 419 | JPU6E, | 420 | JPU6E, |
| @@ -477,7 +478,7 @@ static struct intc_vect intcs_vectors[] = { | |||
| 477 | INTCS_VECT(CMT4, 0x1980), | 478 | INTCS_VECT(CMT4, 0x1980), |
| 478 | INTCS_VECT(DSITX1_DSITX1_0, 0x19a0), | 479 | INTCS_VECT(DSITX1_DSITX1_0, 0x19a0), |
| 479 | INTCS_VECT(DSITX1_DSITX1_1, 0x19c0), | 480 | INTCS_VECT(DSITX1_DSITX1_1, 0x19c0), |
| 480 | /* MFIS2 */ | 481 | INTCS_VECT(MFIS2_INTCS, 0x1a00), |
| 481 | INTCS_VECT(CPORTS2R, 0x1a20), | 482 | INTCS_VECT(CPORTS2R, 0x1a20), |
| 482 | /* CEC */ | 483 | /* CEC */ |
| 483 | INTCS_VECT(JPU6E, 0x1a80), | 484 | INTCS_VECT(JPU6E, 0x1a80), |
| @@ -543,7 +544,7 @@ static struct intc_mask_reg intcs_mask_registers[] = { | |||
| 543 | { 0, TMU1_TUNI2, TMU1_TUNI1, TMU1_TUNI0, | 544 | { 0, TMU1_TUNI2, TMU1_TUNI1, TMU1_TUNI0, |
| 544 | CMT4, DSITX1_DSITX1_0, DSITX1_DSITX1_1, 0 } }, | 545 | CMT4, DSITX1_DSITX1_0, DSITX1_DSITX1_1, 0 } }, |
| 545 | { 0xffd5019c, 0xffd501dc, 8, /* IMR7SA3 / IMCR7SA3 */ | 546 | { 0xffd5019c, 0xffd501dc, 8, /* IMR7SA3 / IMCR7SA3 */ |
| 546 | { 0, CPORTS2R, 0, 0, | 547 | { MFIS2_INTCS, CPORTS2R, 0, 0, |
| 547 | JPU6E, 0, 0, 0 } }, | 548 | JPU6E, 0, 0, 0 } }, |
| 548 | { 0xffd20104, 0, 16, /* INTAMASK */ | 549 | { 0xffd20104, 0, 16, /* INTAMASK */ |
| 549 | { 0, 0, 0, 0, 0, 0, 0, 0, | 550 | { 0, 0, 0, 0, 0, 0, 0, 0, |
| @@ -571,7 +572,8 @@ static struct intc_prio_reg intcs_prio_registers[] = { | |||
| 571 | { 0xffd50030, 0, 16, 4, /* IPRMS3 */ { TMU1, 0, 0, 0 } }, | 572 | { 0xffd50030, 0, 16, 4, /* IPRMS3 */ { TMU1, 0, 0, 0 } }, |
| 572 | { 0xffd50034, 0, 16, 4, /* IPRNS3 */ { CMT4, DSITX1_DSITX1_0, | 573 | { 0xffd50034, 0, 16, 4, /* IPRNS3 */ { CMT4, DSITX1_DSITX1_0, |
| 573 | DSITX1_DSITX1_1, 0 } }, | 574 | DSITX1_DSITX1_1, 0 } }, |
| 574 | { 0xffd50038, 0, 16, 4, /* IPROS3 */ { 0, CPORTS2R, 0, 0 } }, | 575 | { 0xffd50038, 0, 16, 4, /* IPROS3 */ { ENABLED_INTCS, CPORTS2R, |
| 576 | 0, 0 } }, | ||
| 575 | { 0xffd5003c, 0, 16, 4, /* IPRPS3 */ { JPU6E, 0, 0, 0 } }, | 577 | { 0xffd5003c, 0, 16, 4, /* IPRPS3 */ { JPU6E, 0, 0, 0 } }, |
| 576 | }; | 578 | }; |
| 577 | 579 | ||
| @@ -590,6 +592,7 @@ static struct resource intcs_resources[] __initdata = { | |||
| 590 | 592 | ||
| 591 | static struct intc_desc intcs_desc __initdata = { | 593 | static struct intc_desc intcs_desc __initdata = { |
| 592 | .name = "sh7372-intcs", | 594 | .name = "sh7372-intcs", |
| 595 | .force_enable = ENABLED_INTCS, | ||
| 593 | .resource = intcs_resources, | 596 | .resource = intcs_resources, |
| 594 | .num_resources = ARRAY_SIZE(intcs_resources), | 597 | .num_resources = ARRAY_SIZE(intcs_resources), |
| 595 | .hw = INTC_HW_DESC(intcs_vectors, intcs_groups, intcs_mask_registers, | 598 | .hw = INTC_HW_DESC(intcs_vectors, intcs_groups, intcs_mask_registers, |
diff --git a/arch/arm/mach-shmobile/intc-sh73a0.c b/arch/arm/mach-shmobile/intc-sh73a0.c index 322d8d57cbcf..5d0e1503ece6 100644 --- a/arch/arm/mach-shmobile/intc-sh73a0.c +++ b/arch/arm/mach-shmobile/intc-sh73a0.c | |||
| @@ -252,10 +252,11 @@ static irqreturn_t sh73a0_intcs_demux(int irq, void *dev_id) | |||
| 252 | 252 | ||
| 253 | void __init sh73a0_init_irq(void) | 253 | void __init sh73a0_init_irq(void) |
| 254 | { | 254 | { |
| 255 | void __iomem *gic_base = __io(0xf0001000); | 255 | void __iomem *gic_dist_base = __io(0xf0001000); |
| 256 | void __iomem *gic_cpu_base = __io(0xf0000100); | ||
| 256 | void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE); | 257 | void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE); |
| 257 | 258 | ||
| 258 | gic_init(0, 29, gic_base, gic_base); | 259 | gic_init(0, 29, gic_dist_base, gic_cpu_base); |
| 259 | 260 | ||
| 260 | register_intc_controller(&intcs_desc); | 261 | register_intc_controller(&intcs_desc); |
| 261 | 262 | ||
diff --git a/arch/arm/mach-tegra/gpio.c b/arch/arm/mach-tegra/gpio.c index bd066206e110..ad8048801513 100644 --- a/arch/arm/mach-tegra/gpio.c +++ b/arch/arm/mach-tegra/gpio.c | |||
| @@ -207,9 +207,9 @@ static int tegra_gpio_irq_set_type(struct irq_data *d, unsigned int type) | |||
| 207 | spin_unlock_irqrestore(&bank->lvl_lock[port], flags); | 207 | spin_unlock_irqrestore(&bank->lvl_lock[port], flags); |
| 208 | 208 | ||
| 209 | if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) | 209 | if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) |
| 210 | __set_irq_handler_unlocked(irq, handle_level_irq); | 210 | __set_irq_handler_unlocked(d->irq, handle_level_irq); |
| 211 | else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) | 211 | else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) |
| 212 | __set_irq_handler_unlocked(irq, handle_edge_irq); | 212 | __set_irq_handler_unlocked(d->irq, handle_edge_irq); |
| 213 | 213 | ||
| 214 | return 0; | 214 | return 0; |
| 215 | } | 215 | } |
diff --git a/arch/arm/mach-tegra/include/mach/clk.h b/arch/arm/mach-tegra/include/mach/clk.h index d7723955dac7..a217f68ba57c 100644 --- a/arch/arm/mach-tegra/include/mach/clk.h +++ b/arch/arm/mach-tegra/include/mach/clk.h | |||
| @@ -20,6 +20,8 @@ | |||
| 20 | #ifndef __MACH_CLK_H | 20 | #ifndef __MACH_CLK_H |
| 21 | #define __MACH_CLK_H | 21 | #define __MACH_CLK_H |
| 22 | 22 | ||
| 23 | struct clk; | ||
| 24 | |||
| 23 | void tegra_periph_reset_deassert(struct clk *c); | 25 | void tegra_periph_reset_deassert(struct clk *c); |
| 24 | void tegra_periph_reset_assert(struct clk *c); | 26 | void tegra_periph_reset_assert(struct clk *c); |
| 25 | 27 | ||
diff --git a/arch/arm/mach-tegra/include/mach/clkdev.h b/arch/arm/mach-tegra/include/mach/clkdev.h index 412f5c63e65a..66cd3f4fc896 100644 --- a/arch/arm/mach-tegra/include/mach/clkdev.h +++ b/arch/arm/mach-tegra/include/mach/clkdev.h | |||
| @@ -20,6 +20,8 @@ | |||
| 20 | #ifndef __MACH_CLKDEV_H | 20 | #ifndef __MACH_CLKDEV_H |
| 21 | #define __MACH_CLKDEV_H | 21 | #define __MACH_CLKDEV_H |
| 22 | 22 | ||
| 23 | struct clk; | ||
| 24 | |||
| 23 | static inline int __clk_get(struct clk *clk) | 25 | static inline int __clk_get(struct clk *clk) |
| 24 | { | 26 | { |
| 25 | return 1; | 27 | return 1; |
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 000000000000..66ad2760c621 --- /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/arm/mach-tegra/irq.c b/arch/arm/mach-tegra/irq.c index de7dfad6f769..17c74d21077c 100644 --- a/arch/arm/mach-tegra/irq.c +++ b/arch/arm/mach-tegra/irq.c | |||
| @@ -46,24 +46,24 @@ | |||
| 46 | #define ICTLR_COP_IER_CLR 0x38 | 46 | #define ICTLR_COP_IER_CLR 0x38 |
| 47 | #define ICTLR_COP_IEP_CLASS 0x3c | 47 | #define ICTLR_COP_IEP_CLASS 0x3c |
| 48 | 48 | ||
| 49 | static void (*gic_mask_irq)(struct irq_data *d); | 49 | static void (*tegra_gic_mask_irq)(struct irq_data *d); |
| 50 | static void (*gic_unmask_irq)(struct irq_data *d); | 50 | static void (*tegra_gic_unmask_irq)(struct irq_data *d); |
| 51 | 51 | ||
| 52 | #define irq_to_ictlr(irq) (((irq)-32) >> 5) | 52 | #define irq_to_ictlr(irq) (((irq) - 32) >> 5) |
| 53 | static void __iomem *tegra_ictlr_base = IO_ADDRESS(TEGRA_PRIMARY_ICTLR_BASE); | 53 | static void __iomem *tegra_ictlr_base = IO_ADDRESS(TEGRA_PRIMARY_ICTLR_BASE); |
| 54 | #define ictlr_to_virt(ictlr) (tegra_ictlr_base + (ictlr)*0x100) | 54 | #define ictlr_to_virt(ictlr) (tegra_ictlr_base + (ictlr) * 0x100) |
| 55 | 55 | ||
| 56 | static void tegra_mask(struct irq_data *d) | 56 | static void tegra_mask(struct irq_data *d) |
| 57 | { | 57 | { |
| 58 | void __iomem *addr = ictlr_to_virt(irq_to_ictlr(d->irq)); | 58 | void __iomem *addr = ictlr_to_virt(irq_to_ictlr(d->irq)); |
| 59 | gic_mask_irq(d); | 59 | tegra_gic_mask_irq(d); |
| 60 | writel(1<<(d->irq&31), addr+ICTLR_CPU_IER_CLR); | 60 | writel(1 << (d->irq & 31), addr+ICTLR_CPU_IER_CLR); |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | static void tegra_unmask(struct irq_data *d) | 63 | static void tegra_unmask(struct irq_data *d) |
| 64 | { | 64 | { |
| 65 | void __iomem *addr = ictlr_to_virt(irq_to_ictlr(d->irq)); | 65 | void __iomem *addr = ictlr_to_virt(irq_to_ictlr(d->irq)); |
| 66 | gic_unmask_irq(d); | 66 | tegra_gic_unmask_irq(d); |
| 67 | writel(1<<(d->irq&31), addr+ICTLR_CPU_IER_SET); | 67 | writel(1<<(d->irq&31), addr+ICTLR_CPU_IER_SET); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| @@ -98,8 +98,8 @@ void __init tegra_init_irq(void) | |||
| 98 | IO_ADDRESS(TEGRA_ARM_PERIF_BASE + 0x100)); | 98 | IO_ADDRESS(TEGRA_ARM_PERIF_BASE + 0x100)); |
| 99 | 99 | ||
| 100 | gic = get_irq_chip(29); | 100 | gic = get_irq_chip(29); |
| 101 | gic_unmask_irq = gic->irq_unmask; | 101 | tegra_gic_unmask_irq = gic->irq_unmask; |
| 102 | gic_mask_irq = gic->irq_mask; | 102 | tegra_gic_mask_irq = gic->irq_mask; |
| 103 | tegra_irq.irq_ack = gic->irq_ack; | 103 | tegra_irq.irq_ack = gic->irq_ack; |
| 104 | #ifdef CONFIG_SMP | 104 | #ifdef CONFIG_SMP |
| 105 | tegra_irq.irq_set_affinity = gic->irq_set_affinity; | 105 | tegra_irq.irq_set_affinity = gic->irq_set_affinity; |
diff --git a/arch/arm/mach-versatile/Kconfig b/arch/arm/mach-versatile/Kconfig index 3f7b5e9d83c5..9cdec5aa04a0 100644 --- a/arch/arm/mach-versatile/Kconfig +++ b/arch/arm/mach-versatile/Kconfig | |||
| @@ -2,17 +2,19 @@ menu "Versatile platform type" | |||
| 2 | depends on ARCH_VERSATILE | 2 | depends on ARCH_VERSATILE |
| 3 | 3 | ||
| 4 | config ARCH_VERSATILE_PB | 4 | config ARCH_VERSATILE_PB |
| 5 | bool "Support Versatile/PB platform" | 5 | bool "Support Versatile Platform Baseboard for ARM926EJ-S" |
| 6 | select CPU_ARM926T | 6 | select CPU_ARM926T |
| 7 | select MIGHT_HAVE_PCI | 7 | select MIGHT_HAVE_PCI |
| 8 | default y | 8 | default y |
| 9 | help | 9 | help |
| 10 | Include support for the ARM(R) Versatile/PB platform. | 10 | Include support for the ARM(R) Versatile Platform Baseboard |
| 11 | for the ARM926EJ-S. | ||
| 11 | 12 | ||
| 12 | config MACH_VERSATILE_AB | 13 | config MACH_VERSATILE_AB |
| 13 | bool "Support Versatile/AB platform" | 14 | bool "Support Versatile Application Baseboard for ARM926EJ-S" |
| 14 | select CPU_ARM926T | 15 | select CPU_ARM926T |
| 15 | help | 16 | help |
| 16 | Include support for the ARM(R) Versatile/AP platform. | 17 | Include support for the ARM(R) Versatile Application Baseboard |
| 18 | for the ARM926EJ-S. | ||
| 17 | 19 | ||
| 18 | endmenu | 20 | endmenu |
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c index b1687b6abe63..634bf1d3a311 100644 --- a/arch/arm/mach-vexpress/platsmp.c +++ b/arch/arm/mach-vexpress/platsmp.c | |||
| @@ -39,7 +39,7 @@ volatile int __cpuinitdata pen_release = -1; | |||
| 39 | * observers, irrespective of whether they're taking part in coherency | 39 | * observers, irrespective of whether they're taking part in coherency |
| 40 | * or not. This is necessary for the hotplug code to work reliably. | 40 | * or not. This is necessary for the hotplug code to work reliably. |
| 41 | */ | 41 | */ |
| 42 | static void write_pen_release(int val) | 42 | static void __cpuinit write_pen_release(int val) |
| 43 | { | 43 | { |
| 44 | pen_release = val; | 44 | pen_release = val; |
| 45 | smp_wmb(); | 45 | smp_wmb(); |
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c index a9ed3428a2fa..1edae65a0e72 100644 --- a/arch/arm/mach-vexpress/v2m.c +++ b/arch/arm/mach-vexpress/v2m.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <asm/mach/time.h> | 19 | #include <asm/mach/time.h> |
| 20 | #include <asm/hardware/arm_timer.h> | 20 | #include <asm/hardware/arm_timer.h> |
| 21 | #include <asm/hardware/timer-sp.h> | 21 | #include <asm/hardware/timer-sp.h> |
| 22 | #include <asm/hardware/sp810.h> | ||
| 22 | 23 | ||
| 23 | #include <mach/motherboard.h> | 24 | #include <mach/motherboard.h> |
| 24 | 25 | ||
| @@ -50,8 +51,16 @@ void __init v2m_map_io(struct map_desc *tile, size_t num) | |||
| 50 | 51 | ||
| 51 | static void __init v2m_timer_init(void) | 52 | static void __init v2m_timer_init(void) |
| 52 | { | 53 | { |
| 54 | u32 scctrl; | ||
| 55 | |||
| 53 | versatile_sched_clock_init(MMIO_P2V(V2M_SYS_24MHZ), 24000000); | 56 | versatile_sched_clock_init(MMIO_P2V(V2M_SYS_24MHZ), 24000000); |
| 54 | 57 | ||
| 58 | /* Select 1MHz TIMCLK as the reference clock for SP804 timers */ | ||
| 59 | scctrl = readl(MMIO_P2V(V2M_SYSCTL + SCCTRL)); | ||
| 60 | scctrl |= SCCTRL_TIMEREN0SEL_TIMCLK; | ||
| 61 | scctrl |= SCCTRL_TIMEREN1SEL_TIMCLK; | ||
| 62 | writel(scctrl, MMIO_P2V(V2M_SYSCTL + SCCTRL)); | ||
| 63 | |||
| 55 | writel(0, MMIO_P2V(V2M_TIMER0) + TIMER_CTRL); | 64 | writel(0, MMIO_P2V(V2M_TIMER0) + TIMER_CTRL); |
| 56 | writel(0, MMIO_P2V(V2M_TIMER1) + TIMER_CTRL); | 65 | writel(0, MMIO_P2V(V2M_TIMER1) + TIMER_CTRL); |
| 57 | 66 | ||
diff --git a/arch/avr32/include/asm/pgalloc.h b/arch/avr32/include/asm/pgalloc.h index 92ecd8446ef8..bc7e8ae479ee 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/m68k/amiga/config.c b/arch/m68k/amiga/config.c index b1577f741fa8..82a4bb51d5d8 100644 --- a/arch/m68k/amiga/config.c +++ b/arch/m68k/amiga/config.c | |||
| @@ -610,17 +610,17 @@ static void amiga_mem_console_write(struct console *co, const char *s, | |||
| 610 | 610 | ||
| 611 | static int __init amiga_savekmsg_setup(char *arg) | 611 | static int __init amiga_savekmsg_setup(char *arg) |
| 612 | { | 612 | { |
| 613 | static struct resource debug_res = { .name = "Debug" }; | ||
| 614 | |||
| 615 | if (!MACH_IS_AMIGA || strcmp(arg, "mem")) | 613 | if (!MACH_IS_AMIGA || strcmp(arg, "mem")) |
| 616 | goto done; | 614 | return 0; |
| 617 | 615 | ||
| 618 | if (!AMIGAHW_PRESENT(CHIP_RAM)) { | 616 | if (amiga_chip_size < SAVEKMSG_MAXMEM) { |
| 619 | printk("Warning: no chipram present for debugging\n"); | 617 | pr_err("Not enough chipram for debugging\n"); |
| 620 | goto done; | 618 | return -ENOMEM; |
| 621 | } | 619 | } |
| 622 | 620 | ||
| 623 | savekmsg = amiga_chip_alloc_res(SAVEKMSG_MAXMEM, &debug_res); | 621 | /* Just steal the block, the chipram allocator isn't functional yet */ |
| 622 | amiga_chip_size -= SAVEKMSG_MAXMEM; | ||
| 623 | savekmsg = (void *)ZTWO_VADDR(CHIP_PHYSADDR + amiga_chip_size); | ||
| 624 | savekmsg->magic1 = SAVEKMSG_MAGIC1; | 624 | savekmsg->magic1 = SAVEKMSG_MAGIC1; |
| 625 | savekmsg->magic2 = SAVEKMSG_MAGIC2; | 625 | savekmsg->magic2 = SAVEKMSG_MAGIC2; |
| 626 | savekmsg->magicptr = ZTWO_PADDR(savekmsg); | 626 | savekmsg->magicptr = ZTWO_PADDR(savekmsg); |
| @@ -628,8 +628,6 @@ static int __init amiga_savekmsg_setup(char *arg) | |||
| 628 | 628 | ||
| 629 | amiga_console_driver.write = amiga_mem_console_write; | 629 | amiga_console_driver.write = amiga_mem_console_write; |
| 630 | register_console(&amiga_console_driver); | 630 | register_console(&amiga_console_driver); |
| 631 | |||
| 632 | done: | ||
| 633 | return 0; | 631 | return 0; |
| 634 | } | 632 | } |
| 635 | 633 | ||
diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c index 39478dd08e67..26a804e67bce 100644 --- a/arch/m68k/atari/ataints.c +++ b/arch/m68k/atari/ataints.c | |||
| @@ -388,9 +388,9 @@ void __init atari_init_IRQ(void) | |||
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | if (ATARIHW_PRESENT(SCC) && !atari_SCC_reset_done) { | 390 | if (ATARIHW_PRESENT(SCC) && !atari_SCC_reset_done) { |
| 391 | scc.cha_a_ctrl = 9; | 391 | atari_scc.cha_a_ctrl = 9; |
| 392 | MFPDELAY(); | 392 | MFPDELAY(); |
| 393 | scc.cha_a_ctrl = (char) 0xc0; /* hardware reset */ | 393 | atari_scc.cha_a_ctrl = (char) 0xc0; /* hardware reset */ |
| 394 | } | 394 | } |
| 395 | 395 | ||
| 396 | if (ATARIHW_PRESENT(SCU)) { | 396 | if (ATARIHW_PRESENT(SCU)) { |
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c index ae2d96e5d618..4203d101363c 100644 --- a/arch/m68k/atari/config.c +++ b/arch/m68k/atari/config.c | |||
| @@ -315,7 +315,7 @@ void __init config_atari(void) | |||
| 315 | ATARIHW_SET(SCC_DMA); | 315 | ATARIHW_SET(SCC_DMA); |
| 316 | printk("SCC_DMA "); | 316 | printk("SCC_DMA "); |
| 317 | } | 317 | } |
| 318 | if (scc_test(&scc.cha_a_ctrl)) { | 318 | if (scc_test(&atari_scc.cha_a_ctrl)) { |
| 319 | ATARIHW_SET(SCC); | 319 | ATARIHW_SET(SCC); |
| 320 | printk("SCC "); | 320 | printk("SCC "); |
| 321 | } | 321 | } |
diff --git a/arch/m68k/atari/debug.c b/arch/m68k/atari/debug.c index 28efdc33c1ae..5a484247e493 100644 --- a/arch/m68k/atari/debug.c +++ b/arch/m68k/atari/debug.c | |||
| @@ -53,9 +53,9 @@ static inline void ata_scc_out(char c) | |||
| 53 | { | 53 | { |
| 54 | do { | 54 | do { |
| 55 | MFPDELAY(); | 55 | MFPDELAY(); |
| 56 | } while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */ | 56 | } while (!(atari_scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */ |
| 57 | MFPDELAY(); | 57 | MFPDELAY(); |
| 58 | scc.cha_b_data = c; | 58 | atari_scc.cha_b_data = c; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | static void atari_scc_console_write(struct console *co, const char *str, | 61 | static void atari_scc_console_write(struct console *co, const char *str, |
| @@ -140,9 +140,9 @@ int atari_scc_console_wait_key(struct console *co) | |||
| 140 | { | 140 | { |
| 141 | do { | 141 | do { |
| 142 | MFPDELAY(); | 142 | MFPDELAY(); |
| 143 | } while (!(scc.cha_b_ctrl & 0x01)); /* wait for rx buf filled */ | 143 | } while (!(atari_scc.cha_b_ctrl & 0x01)); /* wait for rx buf filled */ |
| 144 | MFPDELAY(); | 144 | MFPDELAY(); |
| 145 | return scc.cha_b_data; | 145 | return atari_scc.cha_b_data; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | int atari_midi_console_wait_key(struct console *co) | 148 | int atari_midi_console_wait_key(struct console *co) |
| @@ -185,9 +185,9 @@ static void __init atari_init_mfp_port(int cflag) | |||
| 185 | 185 | ||
| 186 | #define SCC_WRITE(reg, val) \ | 186 | #define SCC_WRITE(reg, val) \ |
| 187 | do { \ | 187 | do { \ |
| 188 | scc.cha_b_ctrl = (reg); \ | 188 | atari_scc.cha_b_ctrl = (reg); \ |
| 189 | MFPDELAY(); \ | 189 | MFPDELAY(); \ |
| 190 | scc.cha_b_ctrl = (val); \ | 190 | atari_scc.cha_b_ctrl = (val); \ |
| 191 | MFPDELAY(); \ | 191 | MFPDELAY(); \ |
| 192 | } while (0) | 192 | } while (0) |
| 193 | 193 | ||
| @@ -240,7 +240,7 @@ static void __init atari_init_scc_port(int cflag) | |||
| 240 | reg3 = (cflag & CSIZE) == CS8 ? 0xc0 : 0x40; | 240 | reg3 = (cflag & CSIZE) == CS8 ? 0xc0 : 0x40; |
| 241 | reg5 = (cflag & CSIZE) == CS8 ? 0x60 : 0x20 | 0x82 /* assert DTR/RTS */; | 241 | reg5 = (cflag & CSIZE) == CS8 ? 0x60 : 0x20 | 0x82 /* assert DTR/RTS */; |
| 242 | 242 | ||
| 243 | (void)scc.cha_b_ctrl; /* reset reg pointer */ | 243 | (void)atari_scc.cha_b_ctrl; /* reset reg pointer */ |
| 244 | SCC_WRITE(9, 0xc0); /* reset */ | 244 | SCC_WRITE(9, 0xc0); /* reset */ |
| 245 | LONG_DELAY(); /* extra delay after WR9 access */ | 245 | LONG_DELAY(); /* extra delay after WR9 access */ |
| 246 | SCC_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) | 246 | SCC_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) |
diff --git a/arch/m68k/include/asm/atarihw.h b/arch/m68k/include/asm/atarihw.h index a714e1aa072a..f51f709bbf30 100644 --- a/arch/m68k/include/asm/atarihw.h +++ b/arch/m68k/include/asm/atarihw.h | |||
| @@ -449,7 +449,7 @@ struct SCC | |||
| 449 | u_char char_dummy3; | 449 | u_char char_dummy3; |
| 450 | u_char cha_b_data; | 450 | u_char cha_b_data; |
| 451 | }; | 451 | }; |
| 452 | # define scc ((*(volatile struct SCC*)SCC_BAS)) | 452 | # define atari_scc ((*(volatile struct SCC*)SCC_BAS)) |
| 453 | 453 | ||
| 454 | /* The ESCC (Z85230) in an Atari ST. The channels are reversed! */ | 454 | /* The ESCC (Z85230) in an Atari ST. The channels are reversed! */ |
| 455 | # define st_escc ((*(volatile struct SCC*)0xfffffa31)) | 455 | # define st_escc ((*(volatile struct SCC*)0xfffffa31)) |
diff --git a/arch/m68k/include/asm/string.h b/arch/m68k/include/asm/string.h index 2936dda938d7..65b131282837 100644 --- a/arch/m68k/include/asm/string.h +++ b/arch/m68k/include/asm/string.h | |||
| @@ -81,18 +81,6 @@ static inline char *strncpy(char *dest, const char *src, size_t n) | |||
| 81 | strcpy(__d + strlen(__d), (s)); \ | 81 | strcpy(__d + strlen(__d), (s)); \ |
| 82 | }) | 82 | }) |
| 83 | 83 | ||
| 84 | #define __HAVE_ARCH_STRCHR | ||
| 85 | static inline char *strchr(const char *s, int c) | ||
| 86 | { | ||
| 87 | char sc, ch = c; | ||
| 88 | |||
| 89 | for (; (sc = *s++) != ch; ) { | ||
| 90 | if (!sc) | ||
| 91 | return NULL; | ||
| 92 | } | ||
| 93 | return (char *)s - 1; | ||
| 94 | } | ||
| 95 | |||
| 96 | #ifndef CONFIG_COLDFIRE | 84 | #ifndef CONFIG_COLDFIRE |
| 97 | #define __HAVE_ARCH_STRCMP | 85 | #define __HAVE_ARCH_STRCMP |
| 98 | static inline int strcmp(const char *cs, const char *ct) | 86 | static inline int strcmp(const char *cs, const char *ct) |
diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c index 11bdd68e5762..fc770be465ff 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/sh/Kconfig b/arch/sh/Kconfig index ae555569823b..8a9011dced14 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
| @@ -15,6 +15,7 @@ config SUPERH | |||
| 15 | select HAVE_KERNEL_GZIP | 15 | select HAVE_KERNEL_GZIP |
| 16 | select HAVE_KERNEL_BZIP2 | 16 | select HAVE_KERNEL_BZIP2 |
| 17 | select HAVE_KERNEL_LZMA | 17 | select HAVE_KERNEL_LZMA |
| 18 | select HAVE_KERNEL_XZ | ||
| 18 | select HAVE_KERNEL_LZO | 19 | select HAVE_KERNEL_LZO |
| 19 | select HAVE_SYSCALL_TRACEPOINTS | 20 | select HAVE_SYSCALL_TRACEPOINTS |
| 20 | select HAVE_REGS_AND_STACK_ACCESS_API | 21 | select HAVE_REGS_AND_STACK_ACCESS_API |
diff --git a/arch/sh/Makefile b/arch/sh/Makefile index 9c8c6e1a2a15..e3d8170ad00b 100644 --- a/arch/sh/Makefile +++ b/arch/sh/Makefile | |||
| @@ -200,7 +200,7 @@ endif | |||
| 200 | libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y) | 200 | libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y) |
| 201 | libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y) | 201 | libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y) |
| 202 | 202 | ||
| 203 | BOOT_TARGETS = uImage uImage.bz2 uImage.gz uImage.lzma uImage.lzo \ | 203 | BOOT_TARGETS = uImage uImage.bz2 uImage.gz uImage.lzma uImage.xz uImage.lzo \ |
| 204 | uImage.srec uImage.bin zImage vmlinux.bin vmlinux.srec \ | 204 | uImage.srec uImage.bin zImage vmlinux.bin vmlinux.srec \ |
| 205 | romImage | 205 | romImage |
| 206 | PHONY += $(BOOT_TARGETS) | 206 | PHONY += $(BOOT_TARGETS) |
| @@ -230,5 +230,6 @@ define archhelp | |||
| 230 | @echo '* uImage.gz - Kernel-only image for U-Boot (gzip)' | 230 | @echo '* uImage.gz - Kernel-only image for U-Boot (gzip)' |
| 231 | @echo ' uImage.bz2 - Kernel-only image for U-Boot (bzip2)' | 231 | @echo ' uImage.bz2 - Kernel-only image for U-Boot (bzip2)' |
| 232 | @echo ' uImage.lzma - Kernel-only image for U-Boot (lzma)' | 232 | @echo ' uImage.lzma - Kernel-only image for U-Boot (lzma)' |
| 233 | @echo ' uImage.xz - Kernel-only image for U-Boot (xz)' | ||
| 233 | @echo ' uImage.lzo - Kernel-only image for U-Boot (lzo)' | 234 | @echo ' uImage.lzo - Kernel-only image for U-Boot (lzo)' |
| 234 | endef | 235 | endef |
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index 33b662999fc6..701667acfd89 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c | |||
| @@ -1294,6 +1294,7 @@ static int __init arch_setup(void) | |||
| 1294 | i2c_register_board_info(1, i2c1_devices, | 1294 | i2c_register_board_info(1, i2c1_devices, |
| 1295 | ARRAY_SIZE(i2c1_devices)); | 1295 | ARRAY_SIZE(i2c1_devices)); |
| 1296 | 1296 | ||
| 1297 | #if defined(CONFIG_VIDEO_SH_VOU) || defined(CONFIG_VIDEO_SH_VOU_MODULE) | ||
| 1297 | /* VOU */ | 1298 | /* VOU */ |
| 1298 | gpio_request(GPIO_FN_DV_D15, NULL); | 1299 | gpio_request(GPIO_FN_DV_D15, NULL); |
| 1299 | gpio_request(GPIO_FN_DV_D14, NULL); | 1300 | gpio_request(GPIO_FN_DV_D14, NULL); |
| @@ -1325,6 +1326,7 @@ static int __init arch_setup(void) | |||
| 1325 | 1326 | ||
| 1326 | /* Remove reset */ | 1327 | /* Remove reset */ |
| 1327 | gpio_set_value(GPIO_PTG4, 1); | 1328 | gpio_set_value(GPIO_PTG4, 1); |
| 1329 | #endif | ||
| 1328 | 1330 | ||
| 1329 | return platform_add_devices(ecovec_devices, | 1331 | return platform_add_devices(ecovec_devices, |
| 1330 | ARRAY_SIZE(ecovec_devices)); | 1332 | ARRAY_SIZE(ecovec_devices)); |
diff --git a/arch/sh/boot/Makefile b/arch/sh/boot/Makefile index 1ce63624c9b9..ba515d800245 100644 --- a/arch/sh/boot/Makefile +++ b/arch/sh/boot/Makefile | |||
| @@ -24,12 +24,13 @@ suffix-y := bin | |||
| 24 | suffix-$(CONFIG_KERNEL_GZIP) := gz | 24 | suffix-$(CONFIG_KERNEL_GZIP) := gz |
| 25 | suffix-$(CONFIG_KERNEL_BZIP2) := bz2 | 25 | suffix-$(CONFIG_KERNEL_BZIP2) := bz2 |
| 26 | suffix-$(CONFIG_KERNEL_LZMA) := lzma | 26 | suffix-$(CONFIG_KERNEL_LZMA) := lzma |
| 27 | suffix-$(CONFIG_KERNEL_XZ) := xz | ||
| 27 | suffix-$(CONFIG_KERNEL_LZO) := lzo | 28 | suffix-$(CONFIG_KERNEL_LZO) := lzo |
| 28 | 29 | ||
| 29 | targets := zImage vmlinux.srec romImage uImage uImage.srec uImage.gz \ | 30 | targets := zImage vmlinux.srec romImage uImage uImage.srec uImage.gz \ |
| 30 | uImage.bz2 uImage.lzma uImage.lzo uImage.bin | 31 | uImage.bz2 uImage.lzma uImage.xz uImage.lzo uImage.bin |
| 31 | extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \ | 32 | extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \ |
| 32 | vmlinux.bin.lzo | 33 | vmlinux.bin.xz vmlinux.bin.lzo |
| 33 | subdir- := compressed romimage | 34 | subdir- := compressed romimage |
| 34 | 35 | ||
| 35 | $(obj)/zImage: $(obj)/compressed/vmlinux FORCE | 36 | $(obj)/zImage: $(obj)/compressed/vmlinux FORCE |
| @@ -76,6 +77,9 @@ $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE | |||
| 76 | $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE | 77 | $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE |
| 77 | $(call if_changed,lzma) | 78 | $(call if_changed,lzma) |
| 78 | 79 | ||
| 80 | $(obj)/vmlinux.bin.xz: $(obj)/vmlinux.bin FORCE | ||
| 81 | $(call if_changed,xzkern) | ||
| 82 | |||
| 79 | $(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE | 83 | $(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE |
| 80 | $(call if_changed,lzo) | 84 | $(call if_changed,lzo) |
| 81 | 85 | ||
| @@ -88,6 +92,9 @@ $(obj)/uImage.gz: $(obj)/vmlinux.bin.gz | |||
| 88 | $(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma | 92 | $(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma |
| 89 | $(call if_changed,uimage,lzma) | 93 | $(call if_changed,uimage,lzma) |
| 90 | 94 | ||
| 95 | $(obj)/uImage.xz: $(obj)/vmlinux.bin.xz | ||
| 96 | $(call if_changed,uimage,xz) | ||
| 97 | |||
| 91 | $(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo | 98 | $(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo |
| 92 | $(call if_changed,uimage,lzo) | 99 | $(call if_changed,uimage,lzo) |
| 93 | 100 | ||
diff --git a/arch/sh/boot/compressed/Makefile b/arch/sh/boot/compressed/Makefile index cfa5a087a886..e0b0293bae63 100644 --- a/arch/sh/boot/compressed/Makefile +++ b/arch/sh/boot/compressed/Makefile | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | targets := vmlinux vmlinux.bin vmlinux.bin.gz \ | 7 | targets := vmlinux vmlinux.bin vmlinux.bin.gz \ |
| 8 | vmlinux.bin.bz2 vmlinux.bin.lzma \ | 8 | vmlinux.bin.bz2 vmlinux.bin.lzma \ |
| 9 | vmlinux.bin.lzo \ | 9 | vmlinux.bin.xz vmlinux.bin.lzo \ |
| 10 | head_$(BITS).o misc.o piggy.o | 10 | head_$(BITS).o misc.o piggy.o |
| 11 | 11 | ||
| 12 | OBJECTS = $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/cache.o | 12 | OBJECTS = $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/cache.o |
| @@ -50,6 +50,8 @@ $(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE | |||
| 50 | $(call if_changed,bzip2) | 50 | $(call if_changed,bzip2) |
| 51 | $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE | 51 | $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE |
| 52 | $(call if_changed,lzma) | 52 | $(call if_changed,lzma) |
| 53 | $(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE | ||
| 54 | $(call if_changed,xzkern) | ||
| 53 | $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE | 55 | $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE |
| 54 | $(call if_changed,lzo) | 56 | $(call if_changed,lzo) |
| 55 | 57 | ||
diff --git a/arch/sh/boot/compressed/misc.c b/arch/sh/boot/compressed/misc.c index 27140a6b365d..95470a472d2c 100644 --- a/arch/sh/boot/compressed/misc.c +++ b/arch/sh/boot/compressed/misc.c | |||
| @@ -61,6 +61,10 @@ static unsigned long free_mem_end_ptr; | |||
| 61 | #include "../../../../lib/decompress_unlzma.c" | 61 | #include "../../../../lib/decompress_unlzma.c" |
| 62 | #endif | 62 | #endif |
| 63 | 63 | ||
| 64 | #ifdef CONFIG_KERNEL_XZ | ||
| 65 | #include "../../../../lib/decompress_unxz.c" | ||
| 66 | #endif | ||
| 67 | |||
| 64 | #ifdef CONFIG_KERNEL_LZO | 68 | #ifdef CONFIG_KERNEL_LZO |
| 65 | #include "../../../../lib/decompress_unlzo.c" | 69 | #include "../../../../lib/decompress_unlzo.c" |
| 66 | #endif | 70 | #endif |
diff --git a/arch/sh/include/asm/pgtable.h b/arch/sh/include/asm/pgtable.h index 083ea068e819..db85916b9e95 100644 --- a/arch/sh/include/asm/pgtable.h +++ b/arch/sh/include/asm/pgtable.h | |||
| @@ -134,6 +134,7 @@ typedef pte_t *pte_addr_t; | |||
| 134 | extern void pgtable_cache_init(void); | 134 | extern void pgtable_cache_init(void); |
| 135 | 135 | ||
| 136 | struct vm_area_struct; | 136 | struct vm_area_struct; |
| 137 | struct mm_struct; | ||
| 137 | 138 | ||
| 138 | extern void __update_cache(struct vm_area_struct *vma, | 139 | extern void __update_cache(struct vm_area_struct *vma, |
| 139 | unsigned long address, pte_t pte); | 140 | unsigned long address, pte_t pte); |
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7750.c b/arch/sh/kernel/cpu/sh4/setup-sh7750.c index c2b0aaaedcae..672944f5b19c 100644 --- a/arch/sh/kernel/cpu/sh4/setup-sh7750.c +++ b/arch/sh/kernel/cpu/sh4/setup-sh7750.c | |||
| @@ -230,10 +230,10 @@ static struct platform_device *sh7750_devices[] __initdata = { | |||
| 230 | static int __init sh7750_devices_setup(void) | 230 | static int __init sh7750_devices_setup(void) |
| 231 | { | 231 | { |
| 232 | if (mach_is_rts7751r2d()) { | 232 | if (mach_is_rts7751r2d()) { |
| 233 | platform_register_device(&scif_device); | 233 | platform_device_register(&scif_device); |
| 234 | } else { | 234 | } else { |
| 235 | platform_register_device(&sci_device); | 235 | platform_device_register(&sci_device); |
| 236 | platform_register_device(&scif_device); | 236 | platform_device_register(&scif_device); |
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | return platform_add_devices(sh7750_devices, | 239 | return platform_add_devices(sh7750_devices, |
diff --git a/arch/sh/kernel/topology.c b/arch/sh/kernel/topology.c index 948fdb656933..38e862852dd0 100644 --- a/arch/sh/kernel/topology.c +++ b/arch/sh/kernel/topology.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | static DEFINE_PER_CPU(struct cpu, cpu_devices); | 17 | static DEFINE_PER_CPU(struct cpu, cpu_devices); |
| 18 | 18 | ||
| 19 | cpumask_t cpu_core_map[NR_CPUS]; | 19 | cpumask_t cpu_core_map[NR_CPUS]; |
| 20 | EXPORT_SYMBOL(cpu_core_map); | ||
| 20 | 21 | ||
| 21 | static cpumask_t cpu_coregroup_map(unsigned int cpu) | 22 | static cpumask_t cpu_coregroup_map(unsigned int cpu) |
| 22 | { | 23 | { |
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index 2071a8b2b32f..ebbc4d8ab170 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 3788f4649db4..7e172955ee57 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 1159e091ad09..000000000000 --- 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 64101335de19..a6b6fcf7f0ae 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/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index ddc81a06edb9..fd12d7ce7ff9 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c | |||
| @@ -241,21 +241,15 @@ void __init xen_build_dynamic_phys_to_machine(void) | |||
| 241 | * As long as the mfn_list has enough entries to completely | 241 | * As long as the mfn_list has enough entries to completely |
| 242 | * fill a p2m page, pointing into the array is ok. But if | 242 | * fill a p2m page, pointing into the array is ok. But if |
| 243 | * not the entries beyond the last pfn will be undefined. | 243 | * not the entries beyond the last pfn will be undefined. |
| 244 | * And guessing that the 'what-ever-there-is' does not take it | ||
| 245 | * too kindly when changing it to invalid markers, a new page | ||
| 246 | * is allocated, initialized and filled with the valid part. | ||
| 247 | */ | 244 | */ |
| 248 | if (unlikely(pfn + P2M_PER_PAGE > max_pfn)) { | 245 | if (unlikely(pfn + P2M_PER_PAGE > max_pfn)) { |
| 249 | unsigned long p2midx; | 246 | unsigned long p2midx; |
| 250 | unsigned long *p2m = extend_brk(PAGE_SIZE, PAGE_SIZE); | 247 | |
| 251 | p2m_init(p2m); | 248 | p2midx = max_pfn % P2M_PER_PAGE; |
| 252 | 249 | for ( ; p2midx < P2M_PER_PAGE; p2midx++) | |
| 253 | for (p2midx = 0; pfn + p2midx < max_pfn; p2midx++) { | 250 | mfn_list[pfn + p2midx] = INVALID_P2M_ENTRY; |
| 254 | p2m[p2midx] = mfn_list[pfn + p2midx]; | 251 | } |
| 255 | } | 252 | p2m_top[topidx][mididx] = &mfn_list[pfn]; |
| 256 | p2m_top[topidx][mididx] = p2m; | ||
| 257 | } else | ||
| 258 | p2m_top[topidx][mididx] = &mfn_list[pfn]; | ||
| 259 | } | 253 | } |
| 260 | 254 | ||
| 261 | m2p_override_init(); | 255 | m2p_override_init(); |
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index b5a7f928234b..a8a66a50d446 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
| @@ -179,8 +179,13 @@ char * __init xen_memory_setup(void) | |||
| 179 | e820.nr_map = 0; | 179 | e820.nr_map = 0; |
| 180 | xen_extra_mem_start = mem_end; | 180 | xen_extra_mem_start = mem_end; |
| 181 | for (i = 0; i < memmap.nr_entries; i++) { | 181 | for (i = 0; i < memmap.nr_entries; i++) { |
| 182 | unsigned long long end = map[i].addr + map[i].size; | 182 | unsigned long long end; |
| 183 | 183 | ||
| 184 | /* Guard against non-page aligned E820 entries. */ | ||
| 185 | if (map[i].type == E820_RAM) | ||
| 186 | map[i].size -= (map[i].size + map[i].addr) % PAGE_SIZE; | ||
| 187 | |||
| 188 | end = map[i].addr + map[i].size; | ||
| 184 | if (map[i].type == E820_RAM && end > mem_end) { | 189 | if (map[i].type == E820_RAM && end > mem_end) { |
| 185 | /* RAM off the end - may be partially included */ | 190 | /* RAM off the end - may be partially included */ |
| 186 | u64 delta = min(map[i].size, end - mem_end); | 191 | u64 delta = min(map[i].size, end - mem_end); |
| @@ -350,6 +355,7 @@ void __init xen_arch_setup(void) | |||
| 350 | boot_cpu_data.hlt_works_ok = 1; | 355 | boot_cpu_data.hlt_works_ok = 1; |
| 351 | #endif | 356 | #endif |
| 352 | pm_idle = default_idle; | 357 | pm_idle = default_idle; |
| 358 | boot_option_idle_override = IDLE_HALT; | ||
| 353 | 359 | ||
| 354 | fiddle_vdso(); | 360 | fiddle_vdso(); |
| 355 | } | 361 | } |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 328826381a2d..b8d96ce37fc9 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
| @@ -260,6 +260,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
| 260 | { PCI_VDEVICE(INTEL, 0x1d02), board_ahci }, /* PBG AHCI */ | 260 | { PCI_VDEVICE(INTEL, 0x1d02), board_ahci }, /* PBG AHCI */ |
| 261 | { PCI_VDEVICE(INTEL, 0x1d04), board_ahci }, /* PBG RAID */ | 261 | { PCI_VDEVICE(INTEL, 0x1d04), board_ahci }, /* PBG RAID */ |
| 262 | { PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID */ | 262 | { PCI_VDEVICE(INTEL, 0x1d06), board_ahci }, /* PBG RAID */ |
| 263 | { PCI_VDEVICE(INTEL, 0x2323), board_ahci }, /* DH89xxCC AHCI */ | ||
| 263 | 264 | ||
| 264 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ | 265 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ |
| 265 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 266 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
| @@ -379,6 +380,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
| 379 | { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ | 380 | { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ |
| 380 | { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */ | 381 | { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */ |
| 381 | { PCI_DEVICE(0x1b4b, 0x9123), | 382 | { PCI_DEVICE(0x1b4b, 0x9123), |
| 383 | .class = PCI_CLASS_STORAGE_SATA_AHCI, | ||
| 384 | .class_mask = 0xffffff, | ||
| 382 | .driver_data = board_ahci_yes_fbs }, /* 88se9128 */ | 385 | .driver_data = board_ahci_yes_fbs }, /* 88se9128 */ |
| 383 | 386 | ||
| 384 | /* Promise */ | 387 | /* Promise */ |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index a31fe96f7de6..d4e52e214859 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -4138,6 +4138,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
| 4138 | * device and controller are SATA. | 4138 | * device and controller are SATA. |
| 4139 | */ | 4139 | */ |
| 4140 | { "PIONEER DVD-RW DVRTD08", "1.00", ATA_HORKAGE_NOSETXFER }, | 4140 | { "PIONEER DVD-RW DVRTD08", "1.00", ATA_HORKAGE_NOSETXFER }, |
| 4141 | { "PIONEER DVD-RW DVR-212D", "1.28", ATA_HORKAGE_NOSETXFER }, | ||
| 4141 | 4142 | ||
| 4142 | /* End Marker */ | 4143 | /* End Marker */ |
| 4143 | { } | 4144 | { } |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 5defc74973d7..600f6353ecf8 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
| @@ -1099,9 +1099,9 @@ static int ata_scsi_dev_config(struct scsi_device *sdev, | |||
| 1099 | struct request_queue *q = sdev->request_queue; | 1099 | struct request_queue *q = sdev->request_queue; |
| 1100 | void *buf; | 1100 | void *buf; |
| 1101 | 1101 | ||
| 1102 | /* set the min alignment and padding */ | 1102 | sdev->sector_size = ATA_SECT_SIZE; |
| 1103 | blk_queue_update_dma_alignment(sdev->request_queue, | 1103 | |
| 1104 | ATA_DMA_PAD_SZ - 1); | 1104 | /* set DMA padding */ |
| 1105 | blk_queue_update_dma_pad(sdev->request_queue, | 1105 | blk_queue_update_dma_pad(sdev->request_queue, |
| 1106 | ATA_DMA_PAD_SZ - 1); | 1106 | ATA_DMA_PAD_SZ - 1); |
| 1107 | 1107 | ||
| @@ -1115,13 +1115,25 @@ static int ata_scsi_dev_config(struct scsi_device *sdev, | |||
| 1115 | 1115 | ||
| 1116 | blk_queue_dma_drain(q, atapi_drain_needed, buf, ATAPI_MAX_DRAIN); | 1116 | blk_queue_dma_drain(q, atapi_drain_needed, buf, ATAPI_MAX_DRAIN); |
| 1117 | } else { | 1117 | } else { |
| 1118 | /* ATA devices must be sector aligned */ | ||
| 1119 | sdev->sector_size = ata_id_logical_sector_size(dev->id); | 1118 | sdev->sector_size = ata_id_logical_sector_size(dev->id); |
| 1120 | blk_queue_update_dma_alignment(sdev->request_queue, | ||
| 1121 | sdev->sector_size - 1); | ||
| 1122 | sdev->manage_start_stop = 1; | 1119 | sdev->manage_start_stop = 1; |
| 1123 | } | 1120 | } |
| 1124 | 1121 | ||
| 1122 | /* | ||
| 1123 | * ata_pio_sectors() expects buffer for each sector to not cross | ||
| 1124 | * page boundary. Enforce it by requiring buffers to be sector | ||
| 1125 | * aligned, which works iff sector_size is not larger than | ||
| 1126 | * PAGE_SIZE. ATAPI devices also need the alignment as | ||
| 1127 | * IDENTIFY_PACKET is executed as ATA_PROT_PIO. | ||
| 1128 | */ | ||
| 1129 | if (sdev->sector_size > PAGE_SIZE) | ||
| 1130 | ata_dev_printk(dev, KERN_WARNING, | ||
| 1131 | "sector_size=%u > PAGE_SIZE, PIO may malfunction\n", | ||
| 1132 | sdev->sector_size); | ||
| 1133 | |||
| 1134 | blk_queue_update_dma_alignment(sdev->request_queue, | ||
| 1135 | sdev->sector_size - 1); | ||
| 1136 | |||
| 1125 | if (dev->flags & ATA_DFLAG_AN) | 1137 | if (dev->flags & ATA_DFLAG_AN) |
| 1126 | set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events); | 1138 | set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events); |
| 1127 | 1139 | ||
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c index d7e57db36bc8..538ec38ba995 100644 --- a/drivers/ata/pata_hpt366.c +++ b/drivers/ata/pata_hpt366.c | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | #include <linux/libata.h> | 25 | #include <linux/libata.h> |
| 26 | 26 | ||
| 27 | #define DRV_NAME "pata_hpt366" | 27 | #define DRV_NAME "pata_hpt366" |
| 28 | #define DRV_VERSION "0.6.9" | 28 | #define DRV_VERSION "0.6.10" |
| 29 | 29 | ||
| 30 | struct hpt_clock { | 30 | struct hpt_clock { |
| 31 | u8 xfer_mode; | 31 | u8 xfer_mode; |
| @@ -160,8 +160,8 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, | |||
| 160 | 160 | ||
| 161 | while (list[i] != NULL) { | 161 | while (list[i] != NULL) { |
| 162 | if (!strcmp(list[i], model_num)) { | 162 | if (!strcmp(list[i], model_num)) { |
| 163 | printk(KERN_WARNING DRV_NAME ": %s is not supported for %s.\n", | 163 | pr_warning(DRV_NAME ": %s is not supported for %s.\n", |
| 164 | modestr, list[i]); | 164 | modestr, list[i]); |
| 165 | return 1; | 165 | return 1; |
| 166 | } | 166 | } |
| 167 | i++; | 167 | i++; |
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c index efdd18bc8663..4c5b5183225e 100644 --- a/drivers/ata/pata_hpt37x.c +++ b/drivers/ata/pata_hpt37x.c | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | #include <linux/libata.h> | 24 | #include <linux/libata.h> |
| 25 | 25 | ||
| 26 | #define DRV_NAME "pata_hpt37x" | 26 | #define DRV_NAME "pata_hpt37x" |
| 27 | #define DRV_VERSION "0.6.18" | 27 | #define DRV_VERSION "0.6.22" |
| 28 | 28 | ||
| 29 | struct hpt_clock { | 29 | struct hpt_clock { |
| 30 | u8 xfer_speed; | 30 | u8 xfer_speed; |
| @@ -229,8 +229,8 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, | |||
| 229 | 229 | ||
| 230 | while (list[i] != NULL) { | 230 | while (list[i] != NULL) { |
| 231 | if (!strcmp(list[i], model_num)) { | 231 | if (!strcmp(list[i], model_num)) { |
| 232 | printk(KERN_WARNING DRV_NAME ": %s is not supported for %s.\n", | 232 | pr_warning(DRV_NAME ": %s is not supported for %s.\n", |
| 233 | modestr, list[i]); | 233 | modestr, list[i]); |
| 234 | return 1; | 234 | return 1; |
| 235 | } | 235 | } |
| 236 | i++; | 236 | i++; |
| @@ -642,7 +642,6 @@ static struct ata_port_operations hpt372_port_ops = { | |||
| 642 | static struct ata_port_operations hpt374_fn1_port_ops = { | 642 | static struct ata_port_operations hpt374_fn1_port_ops = { |
| 643 | .inherits = &hpt372_port_ops, | 643 | .inherits = &hpt372_port_ops, |
| 644 | .cable_detect = hpt374_fn1_cable_detect, | 644 | .cable_detect = hpt374_fn1_cable_detect, |
| 645 | .prereset = hpt37x_pre_reset, | ||
| 646 | }; | 645 | }; |
| 647 | 646 | ||
| 648 | /** | 647 | /** |
| @@ -803,7 +802,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
| 803 | .udma_mask = ATA_UDMA6, | 802 | .udma_mask = ATA_UDMA6, |
| 804 | .port_ops = &hpt302_port_ops | 803 | .port_ops = &hpt302_port_ops |
| 805 | }; | 804 | }; |
| 806 | /* HPT374 - UDMA100, function 1 uses different prereset method */ | 805 | /* HPT374 - UDMA100, function 1 uses different cable_detect method */ |
| 807 | static const struct ata_port_info info_hpt374_fn0 = { | 806 | static const struct ata_port_info info_hpt374_fn0 = { |
| 808 | .flags = ATA_FLAG_SLAVE_POSS, | 807 | .flags = ATA_FLAG_SLAVE_POSS, |
| 809 | .pio_mask = ATA_PIO4, | 808 | .pio_mask = ATA_PIO4, |
| @@ -838,7 +837,8 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
| 838 | if (rc) | 837 | if (rc) |
| 839 | return rc; | 838 | return rc; |
| 840 | 839 | ||
| 841 | if (dev->device == PCI_DEVICE_ID_TTI_HPT366) { | 840 | switch (dev->device) { |
| 841 | case PCI_DEVICE_ID_TTI_HPT366: | ||
| 842 | /* May be a later chip in disguise. Check */ | 842 | /* May be a later chip in disguise. Check */ |
| 843 | /* Older chips are in the HPT366 driver. Ignore them */ | 843 | /* Older chips are in the HPT366 driver. Ignore them */ |
| 844 | if (rev < 3) | 844 | if (rev < 3) |
| @@ -863,54 +863,50 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
| 863 | chip_table = &hpt372; | 863 | chip_table = &hpt372; |
| 864 | break; | 864 | break; |
| 865 | default: | 865 | default: |
| 866 | printk(KERN_ERR "pata_hpt37x: Unknown HPT366 subtype, " | 866 | pr_err(DRV_NAME ": Unknown HPT366 subtype, " |
| 867 | "please report (%d).\n", rev); | 867 | "please report (%d).\n", rev); |
| 868 | return -ENODEV; | 868 | return -ENODEV; |
| 869 | } | 869 | } |
| 870 | } else { | 870 | break; |
| 871 | switch (dev->device) { | 871 | case PCI_DEVICE_ID_TTI_HPT372: |
| 872 | case PCI_DEVICE_ID_TTI_HPT372: | 872 | /* 372N if rev >= 2 */ |
| 873 | /* 372N if rev >= 2 */ | 873 | if (rev >= 2) |
| 874 | if (rev >= 2) | 874 | return -ENODEV; |
| 875 | return -ENODEV; | 875 | ppi[0] = &info_hpt372; |
| 876 | ppi[0] = &info_hpt372; | 876 | chip_table = &hpt372a; |
| 877 | chip_table = &hpt372a; | 877 | break; |
| 878 | break; | 878 | case PCI_DEVICE_ID_TTI_HPT302: |
| 879 | case PCI_DEVICE_ID_TTI_HPT302: | 879 | /* 302N if rev > 1 */ |
| 880 | /* 302N if rev > 1 */ | 880 | if (rev > 1) |
| 881 | if (rev > 1) | 881 | return -ENODEV; |
| 882 | return -ENODEV; | 882 | ppi[0] = &info_hpt302; |
| 883 | ppi[0] = &info_hpt302; | 883 | /* Check this */ |
| 884 | /* Check this */ | 884 | chip_table = &hpt302; |
| 885 | chip_table = &hpt302; | 885 | break; |
| 886 | break; | 886 | case PCI_DEVICE_ID_TTI_HPT371: |
| 887 | case PCI_DEVICE_ID_TTI_HPT371: | 887 | if (rev > 1) |
| 888 | if (rev > 1) | 888 | return -ENODEV; |
| 889 | return -ENODEV; | 889 | ppi[0] = &info_hpt302; |
| 890 | ppi[0] = &info_hpt302; | 890 | chip_table = &hpt371; |
| 891 | chip_table = &hpt371; | 891 | /* |
| 892 | /* | 892 | * Single channel device, master is not present but the BIOS |
| 893 | * Single channel device, master is not present | 893 | * (or us for non x86) must mark it absent |
| 894 | * but the BIOS (or us for non x86) must mark it | 894 | */ |
| 895 | * absent | 895 | pci_read_config_byte(dev, 0x50, &mcr1); |
| 896 | */ | 896 | mcr1 &= ~0x04; |
| 897 | pci_read_config_byte(dev, 0x50, &mcr1); | 897 | pci_write_config_byte(dev, 0x50, mcr1); |
| 898 | mcr1 &= ~0x04; | 898 | break; |
| 899 | pci_write_config_byte(dev, 0x50, mcr1); | 899 | case PCI_DEVICE_ID_TTI_HPT374: |
| 900 | break; | 900 | chip_table = &hpt374; |
| 901 | case PCI_DEVICE_ID_TTI_HPT374: | 901 | if (!(PCI_FUNC(dev->devfn) & 1)) |
| 902 | chip_table = &hpt374; | 902 | *ppi = &info_hpt374_fn0; |
| 903 | if (!(PCI_FUNC(dev->devfn) & 1)) | 903 | else |
| 904 | *ppi = &info_hpt374_fn0; | 904 | *ppi = &info_hpt374_fn1; |
| 905 | else | 905 | break; |
| 906 | *ppi = &info_hpt374_fn1; | 906 | default: |
| 907 | break; | 907 | pr_err(DRV_NAME ": PCI table is bogus, please report (%d).\n", |
| 908 | default: | 908 | dev->device); |
| 909 | printk(KERN_ERR | 909 | return -ENODEV; |
| 910 | "pata_hpt37x: PCI table is bogus, please report (%d).\n", | ||
| 911 | dev->device); | ||
| 912 | return -ENODEV; | ||
| 913 | } | ||
| 914 | } | 910 | } |
| 915 | /* Ok so this is a chip we support */ | 911 | /* Ok so this is a chip we support */ |
| 916 | 912 | ||
| @@ -957,8 +953,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
| 957 | u8 sr; | 953 | u8 sr; |
| 958 | u32 total = 0; | 954 | u32 total = 0; |
| 959 | 955 | ||
| 960 | printk(KERN_WARNING | 956 | pr_warning(DRV_NAME ": BIOS has not set timing clocks.\n"); |
| 961 | "pata_hpt37x: BIOS has not set timing clocks.\n"); | ||
| 962 | 957 | ||
| 963 | /* This is the process the HPT371 BIOS is reported to use */ | 958 | /* This is the process the HPT371 BIOS is reported to use */ |
| 964 | for (i = 0; i < 128; i++) { | 959 | for (i = 0; i < 128; i++) { |
| @@ -1014,7 +1009,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
| 1014 | (f_high << 16) | f_low | 0x100); | 1009 | (f_high << 16) | f_low | 0x100); |
| 1015 | } | 1010 | } |
| 1016 | if (adjust == 8) { | 1011 | if (adjust == 8) { |
| 1017 | printk(KERN_ERR "pata_hpt37x: DPLL did not stabilize!\n"); | 1012 | pr_err(DRV_NAME ": DPLL did not stabilize!\n"); |
| 1018 | return -ENODEV; | 1013 | return -ENODEV; |
| 1019 | } | 1014 | } |
| 1020 | if (dpll == 3) | 1015 | if (dpll == 3) |
| @@ -1022,8 +1017,8 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
| 1022 | else | 1017 | else |
| 1023 | private_data = (void *)hpt37x_timings_50; | 1018 | private_data = (void *)hpt37x_timings_50; |
| 1024 | 1019 | ||
| 1025 | printk(KERN_INFO "pata_hpt37x: bus clock %dMHz, using %dMHz DPLL.\n", | 1020 | pr_info(DRV_NAME ": bus clock %dMHz, using %dMHz DPLL.\n", |
| 1026 | MHz[clock_slot], MHz[dpll]); | 1021 | MHz[clock_slot], MHz[dpll]); |
| 1027 | } else { | 1022 | } else { |
| 1028 | private_data = (void *)chip_table->clocks[clock_slot]; | 1023 | private_data = (void *)chip_table->clocks[clock_slot]; |
| 1029 | /* | 1024 | /* |
| @@ -1036,8 +1031,9 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
| 1036 | ppi[0] = &info_hpt370_33; | 1031 | ppi[0] = &info_hpt370_33; |
| 1037 | if (clock_slot < 2 && ppi[0] == &info_hpt370a) | 1032 | if (clock_slot < 2 && ppi[0] == &info_hpt370a) |
| 1038 | ppi[0] = &info_hpt370a_33; | 1033 | ppi[0] = &info_hpt370a_33; |
| 1039 | printk(KERN_INFO "pata_hpt37x: %s using %dMHz bus clock.\n", | 1034 | |
| 1040 | chip_table->name, MHz[clock_slot]); | 1035 | pr_info(DRV_NAME ": %s using %dMHz bus clock.\n", |
| 1036 | chip_table->name, MHz[clock_slot]); | ||
| 1041 | } | 1037 | } |
| 1042 | 1038 | ||
| 1043 | /* Now kick off ATA set up */ | 1039 | /* Now kick off ATA set up */ |
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c index d2239bbdb798..eca68caf5f46 100644 --- a/drivers/ata/pata_hpt3x2n.c +++ b/drivers/ata/pata_hpt3x2n.c | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | #include <linux/libata.h> | 25 | #include <linux/libata.h> |
| 26 | 26 | ||
| 27 | #define DRV_NAME "pata_hpt3x2n" | 27 | #define DRV_NAME "pata_hpt3x2n" |
| 28 | #define DRV_VERSION "0.3.13" | 28 | #define DRV_VERSION "0.3.14" |
| 29 | 29 | ||
| 30 | enum { | 30 | enum { |
| 31 | HPT_PCI_FAST = (1 << 31), | 31 | HPT_PCI_FAST = (1 << 31), |
| @@ -418,7 +418,7 @@ static int hpt3x2n_pci_clock(struct pci_dev *pdev) | |||
| 418 | u16 sr; | 418 | u16 sr; |
| 419 | u32 total = 0; | 419 | u32 total = 0; |
| 420 | 420 | ||
| 421 | printk(KERN_WARNING "pata_hpt3x2n: BIOS clock data not set.\n"); | 421 | pr_warning(DRV_NAME ": BIOS clock data not set.\n"); |
| 422 | 422 | ||
| 423 | /* This is the process the HPT371 BIOS is reported to use */ | 423 | /* This is the process the HPT371 BIOS is reported to use */ |
| 424 | for (i = 0; i < 128; i++) { | 424 | for (i = 0; i < 128; i++) { |
| @@ -528,8 +528,7 @@ hpt372n: | |||
| 528 | ppi[0] = &info_hpt372n; | 528 | ppi[0] = &info_hpt372n; |
| 529 | break; | 529 | break; |
| 530 | default: | 530 | default: |
| 531 | printk(KERN_ERR | 531 | pr_err(DRV_NAME ": PCI table is bogus, please report (%d).\n", |
| 532 | "pata_hpt3x2n: PCI table is bogus please report (%d).\n", | ||
| 533 | dev->device); | 532 | dev->device); |
| 534 | return -ENODEV; | 533 | return -ENODEV; |
| 535 | } | 534 | } |
| @@ -579,12 +578,11 @@ hpt372n: | |||
| 579 | pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low); | 578 | pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low); |
| 580 | } | 579 | } |
| 581 | if (adjust == 8) { | 580 | if (adjust == 8) { |
| 582 | printk(KERN_ERR "pata_hpt3x2n: DPLL did not stabilize!\n"); | 581 | pr_err(DRV_NAME ": DPLL did not stabilize!\n"); |
| 583 | return -ENODEV; | 582 | return -ENODEV; |
| 584 | } | 583 | } |
| 585 | 584 | ||
| 586 | printk(KERN_INFO "pata_hpt37x: bus clock %dMHz, using 66MHz DPLL.\n", | 585 | pr_info(DRV_NAME ": bus clock %dMHz, using 66MHz DPLL.\n", pci_mhz); |
| 587 | pci_mhz); | ||
| 588 | 586 | ||
| 589 | /* | 587 | /* |
| 590 | * Set our private data up. We only need a few flags | 588 | * Set our private data up. We only need a few flags |
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c index 8cc536e49a0a..d7d8026cde99 100644 --- a/drivers/ata/pata_mpc52xx.c +++ b/drivers/ata/pata_mpc52xx.c | |||
| @@ -610,7 +610,7 @@ static struct scsi_host_template mpc52xx_ata_sht = { | |||
| 610 | }; | 610 | }; |
| 611 | 611 | ||
| 612 | static struct ata_port_operations mpc52xx_ata_port_ops = { | 612 | static struct ata_port_operations mpc52xx_ata_port_ops = { |
| 613 | .inherits = &ata_sff_port_ops, | 613 | .inherits = &ata_bmdma_port_ops, |
| 614 | .sff_dev_select = mpc52xx_ata_dev_select, | 614 | .sff_dev_select = mpc52xx_ata_dev_select, |
| 615 | .set_piomode = mpc52xx_ata_set_piomode, | 615 | .set_piomode = mpc52xx_ata_set_piomode, |
| 616 | .set_dmamode = mpc52xx_ata_set_dmamode, | 616 | .set_dmamode = mpc52xx_ata_set_dmamode, |
diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c index bca9cb89a118..487a54739854 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 656493a5e073..42615b419dfb 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 949ed09c6361..a126e614601f 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 e397df3ad98e..16402445f2b2 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 01b886e68822..79c47e88d5d1 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 d81cc748e77f..54d70a47afc1 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_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 2aef5cd3acf5..49e5e99917e2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
| @@ -6310,6 +6310,9 @@ void merge_like_dcb_entries(struct drm_device *dev, struct dcb_table *dcb) | |||
| 6310 | static bool | 6310 | static bool |
| 6311 | apply_dcb_encoder_quirks(struct drm_device *dev, int idx, u32 *conn, u32 *conf) | 6311 | apply_dcb_encoder_quirks(struct drm_device *dev, int idx, u32 *conn, u32 *conf) |
| 6312 | { | 6312 | { |
| 6313 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
| 6314 | struct dcb_table *dcb = &dev_priv->vbios.dcb; | ||
| 6315 | |||
| 6313 | /* Dell Precision M6300 | 6316 | /* Dell Precision M6300 |
| 6314 | * DCB entry 2: 02025312 00000010 | 6317 | * DCB entry 2: 02025312 00000010 |
| 6315 | * DCB entry 3: 02026312 00000020 | 6318 | * DCB entry 3: 02026312 00000020 |
| @@ -6327,6 +6330,18 @@ apply_dcb_encoder_quirks(struct drm_device *dev, int idx, u32 *conn, u32 *conf) | |||
| 6327 | return false; | 6330 | return false; |
| 6328 | } | 6331 | } |
| 6329 | 6332 | ||
| 6333 | /* GeForce3 Ti 200 | ||
| 6334 | * | ||
| 6335 | * DCB reports an LVDS output that should be TMDS: | ||
| 6336 | * DCB entry 1: f2005014 ffffffff | ||
| 6337 | */ | ||
| 6338 | if (nv_match_device(dev, 0x0201, 0x1462, 0x8851)) { | ||
| 6339 | if (*conn == 0xf2005014 && *conf == 0xffffffff) { | ||
| 6340 | fabricate_dcb_output(dcb, OUTPUT_TMDS, 1, 1, 1); | ||
| 6341 | return false; | ||
| 6342 | } | ||
| 6343 | } | ||
| 6344 | |||
| 6330 | return true; | 6345 | return true; |
| 6331 | } | 6346 | } |
| 6332 | 6347 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c index 13bb672a16f4..f658a04eecf9 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/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 01bffc4412d2..9821fcacc3d2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
| @@ -848,9 +848,6 @@ extern void nv10_mem_put_tile_region(struct drm_device *dev, | |||
| 848 | struct nouveau_fence *fence); | 848 | struct nouveau_fence *fence); |
| 849 | extern const struct ttm_mem_type_manager_func nouveau_vram_manager; | 849 | extern const struct ttm_mem_type_manager_func nouveau_vram_manager; |
| 850 | 850 | ||
| 851 | /* nvc0_vram.c */ | ||
| 852 | extern const struct ttm_mem_type_manager_func nvc0_vram_manager; | ||
| 853 | |||
| 854 | /* nouveau_notifier.c */ | 851 | /* nouveau_notifier.c */ |
| 855 | extern int nouveau_notifier_init_channel(struct nouveau_channel *); | 852 | extern int nouveau_notifier_init_channel(struct nouveau_channel *); |
| 856 | extern void nouveau_notifier_takedown_channel(struct nouveau_channel *); | 853 | extern void nouveau_notifier_takedown_channel(struct nouveau_channel *); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_temp.c b/drivers/gpu/drm/nouveau/nouveau_temp.c index 7ecc4adc1e45..8d9968e1cba8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_temp.c +++ b/drivers/gpu/drm/nouveau/nouveau_temp.c | |||
| @@ -265,8 +265,8 @@ nouveau_temp_probe_i2c(struct drm_device *dev) | |||
| 265 | struct i2c_board_info info[] = { | 265 | struct i2c_board_info info[] = { |
| 266 | { I2C_BOARD_INFO("w83l785ts", 0x2d) }, | 266 | { I2C_BOARD_INFO("w83l785ts", 0x2d) }, |
| 267 | { I2C_BOARD_INFO("w83781d", 0x2d) }, | 267 | { I2C_BOARD_INFO("w83781d", 0x2d) }, |
| 268 | { I2C_BOARD_INFO("f75375", 0x2e) }, | ||
| 269 | { I2C_BOARD_INFO("adt7473", 0x2e) }, | 268 | { I2C_BOARD_INFO("adt7473", 0x2e) }, |
| 269 | { I2C_BOARD_INFO("f75375", 0x2e) }, | ||
| 270 | { I2C_BOARD_INFO("lm99", 0x4c) }, | 270 | { I2C_BOARD_INFO("lm99", 0x4c) }, |
| 271 | { } | 271 | { } |
| 272 | }; | 272 | }; |
diff --git a/drivers/gpu/drm/nouveau/nv50_graph.c b/drivers/gpu/drm/nouveau/nv50_graph.c index 2d7ea75a09d4..37e21d2be95b 100644 --- a/drivers/gpu/drm/nouveau/nv50_graph.c +++ b/drivers/gpu/drm/nouveau/nv50_graph.c | |||
| @@ -256,6 +256,7 @@ nv50_graph_destroy_context(struct nouveau_channel *chan) | |||
| 256 | struct drm_device *dev = chan->dev; | 256 | struct drm_device *dev = chan->dev; |
| 257 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 257 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 258 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | 258 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; |
| 259 | struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo; | ||
| 259 | int i, hdr = (dev_priv->chipset == 0x50) ? 0x200 : 0x20; | 260 | int i, hdr = (dev_priv->chipset == 0x50) ? 0x200 : 0x20; |
| 260 | unsigned long flags; | 261 | unsigned long flags; |
| 261 | 262 | ||
| @@ -265,6 +266,7 @@ nv50_graph_destroy_context(struct nouveau_channel *chan) | |||
| 265 | return; | 266 | return; |
| 266 | 267 | ||
| 267 | spin_lock_irqsave(&dev_priv->context_switch_lock, flags); | 268 | spin_lock_irqsave(&dev_priv->context_switch_lock, flags); |
| 269 | pfifo->reassign(dev, false); | ||
| 268 | pgraph->fifo_access(dev, false); | 270 | pgraph->fifo_access(dev, false); |
| 269 | 271 | ||
| 270 | if (pgraph->channel(dev) == chan) | 272 | if (pgraph->channel(dev) == chan) |
| @@ -275,6 +277,7 @@ nv50_graph_destroy_context(struct nouveau_channel *chan) | |||
| 275 | dev_priv->engine.instmem.flush(dev); | 277 | dev_priv->engine.instmem.flush(dev); |
| 276 | 278 | ||
| 277 | pgraph->fifo_access(dev, true); | 279 | pgraph->fifo_access(dev, true); |
| 280 | pfifo->reassign(dev, true); | ||
| 278 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); | 281 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); |
| 279 | 282 | ||
| 280 | nouveau_gpuobj_ref(NULL, &chan->ramin_grctx); | 283 | nouveau_gpuobj_ref(NULL, &chan->ramin_grctx); |
diff --git a/drivers/gpu/drm/nouveau/nv50_vm.c b/drivers/gpu/drm/nouveau/nv50_vm.c index 38e523e10995..459ff08241e5 100644 --- a/drivers/gpu/drm/nouveau/nv50_vm.c +++ b/drivers/gpu/drm/nouveau/nv50_vm.c | |||
| @@ -45,11 +45,6 @@ nv50_vm_map_pgt(struct nouveau_gpuobj *pgd, u32 pde, | |||
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | if (phys & 1) { | 47 | if (phys & 1) { |
| 48 | if (dev_priv->vram_sys_base) { | ||
| 49 | phys += dev_priv->vram_sys_base; | ||
| 50 | phys |= 0x30; | ||
| 51 | } | ||
| 52 | |||
| 53 | if (coverage <= 32 * 1024 * 1024) | 48 | if (coverage <= 32 * 1024 * 1024) |
| 54 | phys |= 0x60; | 49 | phys |= 0x60; |
| 55 | else if (coverage <= 64 * 1024 * 1024) | 50 | else if (coverage <= 64 * 1024 * 1024) |
diff --git a/drivers/gpu/drm/nouveau/nvc0_graph.c b/drivers/gpu/drm/nouveau/nvc0_graph.c index e6ea7d83187f..eb18a7e89f5b 100644 --- a/drivers/gpu/drm/nouveau/nvc0_graph.c +++ b/drivers/gpu/drm/nouveau/nvc0_graph.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include "nvc0_graph.h" | 31 | #include "nvc0_graph.h" |
| 32 | 32 | ||
| 33 | static void nvc0_graph_isr(struct drm_device *); | 33 | static void nvc0_graph_isr(struct drm_device *); |
| 34 | static void nvc0_runk140_isr(struct drm_device *); | ||
| 34 | static int nvc0_graph_unload_context_to(struct drm_device *dev, u64 chan); | 35 | static int nvc0_graph_unload_context_to(struct drm_device *dev, u64 chan); |
| 35 | 36 | ||
| 36 | void | 37 | void |
| @@ -281,6 +282,7 @@ nvc0_graph_destroy(struct drm_device *dev) | |||
| 281 | return; | 282 | return; |
| 282 | 283 | ||
| 283 | nouveau_irq_unregister(dev, 12); | 284 | nouveau_irq_unregister(dev, 12); |
| 285 | nouveau_irq_unregister(dev, 25); | ||
| 284 | 286 | ||
| 285 | nouveau_gpuobj_ref(NULL, &priv->unk4188b8); | 287 | nouveau_gpuobj_ref(NULL, &priv->unk4188b8); |
| 286 | nouveau_gpuobj_ref(NULL, &priv->unk4188b4); | 288 | nouveau_gpuobj_ref(NULL, &priv->unk4188b4); |
| @@ -390,6 +392,7 @@ nvc0_graph_create(struct drm_device *dev) | |||
| 390 | } | 392 | } |
| 391 | 393 | ||
| 392 | nouveau_irq_register(dev, 12, nvc0_graph_isr); | 394 | nouveau_irq_register(dev, 12, nvc0_graph_isr); |
| 395 | nouveau_irq_register(dev, 25, nvc0_runk140_isr); | ||
| 393 | NVOBJ_CLASS(dev, 0x902d, GR); /* 2D */ | 396 | NVOBJ_CLASS(dev, 0x902d, GR); /* 2D */ |
| 394 | NVOBJ_CLASS(dev, 0x9039, GR); /* M2MF */ | 397 | NVOBJ_CLASS(dev, 0x9039, GR); /* M2MF */ |
| 395 | NVOBJ_CLASS(dev, 0x9097, GR); /* 3D */ | 398 | NVOBJ_CLASS(dev, 0x9097, GR); /* 3D */ |
| @@ -512,8 +515,8 @@ nvc0_graph_init_gpc_1(struct drm_device *dev) | |||
| 512 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x224), 0xc0000000); | 515 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x224), 0xc0000000); |
| 513 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x48c), 0xc0000000); | 516 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x48c), 0xc0000000); |
| 514 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x084), 0xc0000000); | 517 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x084), 0xc0000000); |
| 515 | nv_wr32(dev, TP_UNIT(gpc, tp, 0xe44), 0x001ffffe); | 518 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x644), 0x001ffffe); |
| 516 | nv_wr32(dev, TP_UNIT(gpc, tp, 0xe4c), 0x0000000f); | 519 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x64c), 0x0000000f); |
| 517 | } | 520 | } |
| 518 | nv_wr32(dev, GPC_UNIT(gpc, 0x2c90), 0xffffffff); | 521 | nv_wr32(dev, GPC_UNIT(gpc, 0x2c90), 0xffffffff); |
| 519 | nv_wr32(dev, GPC_UNIT(gpc, 0x2c94), 0xffffffff); | 522 | nv_wr32(dev, GPC_UNIT(gpc, 0x2c94), 0xffffffff); |
| @@ -777,3 +780,19 @@ nvc0_graph_isr(struct drm_device *dev) | |||
| 777 | 780 | ||
| 778 | nv_wr32(dev, 0x400500, 0x00010001); | 781 | nv_wr32(dev, 0x400500, 0x00010001); |
| 779 | } | 782 | } |
| 783 | |||
| 784 | static void | ||
| 785 | nvc0_runk140_isr(struct drm_device *dev) | ||
| 786 | { | ||
| 787 | u32 units = nv_rd32(dev, 0x00017c) & 0x1f; | ||
| 788 | |||
| 789 | while (units) { | ||
| 790 | u32 unit = ffs(units) - 1; | ||
| 791 | u32 reg = 0x140000 + unit * 0x2000; | ||
| 792 | u32 st0 = nv_mask(dev, reg + 0x1020, 0, 0); | ||
| 793 | u32 st1 = nv_mask(dev, reg + 0x1420, 0, 0); | ||
| 794 | |||
| 795 | NV_INFO(dev, "PRUNK140: %d 0x%08x 0x%08x\n", unit, st0, st1); | ||
| 796 | units &= ~(1 << unit); | ||
| 797 | } | ||
| 798 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nvc0_grctx.c b/drivers/gpu/drm/nouveau/nvc0_grctx.c index b9e68b2d30aa..f880ff776db8 100644 --- a/drivers/gpu/drm/nouveau/nvc0_grctx.c +++ b/drivers/gpu/drm/nouveau/nvc0_grctx.c | |||
| @@ -1830,7 +1830,7 @@ nvc0_grctx_generate(struct nouveau_channel *chan) | |||
| 1830 | 1830 | ||
| 1831 | for (tp = 0, id = 0; tp < 4; tp++) { | 1831 | for (tp = 0, id = 0; tp < 4; tp++) { |
| 1832 | for (gpc = 0; gpc < priv->gpc_nr; gpc++) { | 1832 | for (gpc = 0; gpc < priv->gpc_nr; gpc++) { |
| 1833 | if (tp <= priv->tp_nr[gpc]) { | 1833 | if (tp < priv->tp_nr[gpc]) { |
| 1834 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x698), id); | 1834 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x698), id); |
| 1835 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x4e8), id); | 1835 | nv_wr32(dev, TP_UNIT(gpc, tp, 0x4e8), id); |
| 1836 | nv_wr32(dev, GPC_UNIT(gpc, 0x0c10 + tp * 4), id); | 1836 | nv_wr32(dev, GPC_UNIT(gpc, 0x0c10 + tp * 4), id); |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index d3ca17080df7..842954fe74c5 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
| @@ -994,6 +994,7 @@ static int evergreen_crtc_do_set_base(struct drm_crtc *crtc, | |||
| 994 | struct radeon_bo *rbo; | 994 | struct radeon_bo *rbo; |
| 995 | uint64_t fb_location; | 995 | uint64_t fb_location; |
| 996 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; | 996 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; |
| 997 | u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE); | ||
| 997 | int r; | 998 | int r; |
| 998 | 999 | ||
| 999 | /* no fb bound */ | 1000 | /* no fb bound */ |
| @@ -1045,11 +1046,17 @@ static int evergreen_crtc_do_set_base(struct drm_crtc *crtc, | |||
| 1045 | case 16: | 1046 | case 16: |
| 1046 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | | 1047 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | |
| 1047 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB565)); | 1048 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB565)); |
| 1049 | #ifdef __BIG_ENDIAN | ||
| 1050 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN16); | ||
| 1051 | #endif | ||
| 1048 | break; | 1052 | break; |
| 1049 | case 24: | 1053 | case 24: |
| 1050 | case 32: | 1054 | case 32: |
| 1051 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_32BPP) | | 1055 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_32BPP) | |
| 1052 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB8888)); | 1056 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB8888)); |
| 1057 | #ifdef __BIG_ENDIAN | ||
| 1058 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN32); | ||
| 1059 | #endif | ||
| 1053 | break; | 1060 | break; |
| 1054 | default: | 1061 | default: |
| 1055 | DRM_ERROR("Unsupported screen depth %d\n", | 1062 | DRM_ERROR("Unsupported screen depth %d\n", |
| @@ -1094,6 +1101,7 @@ static int evergreen_crtc_do_set_base(struct drm_crtc *crtc, | |||
| 1094 | WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS + radeon_crtc->crtc_offset, | 1101 | WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS + radeon_crtc->crtc_offset, |
| 1095 | (u32) fb_location & EVERGREEN_GRPH_SURFACE_ADDRESS_MASK); | 1102 | (u32) fb_location & EVERGREEN_GRPH_SURFACE_ADDRESS_MASK); |
| 1096 | WREG32(EVERGREEN_GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format); | 1103 | WREG32(EVERGREEN_GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format); |
| 1104 | WREG32(EVERGREEN_GRPH_SWAP_CONTROL + radeon_crtc->crtc_offset, fb_swap); | ||
| 1097 | 1105 | ||
| 1098 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); | 1106 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); |
| 1099 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); | 1107 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); |
| @@ -1150,6 +1158,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
| 1150 | struct drm_framebuffer *target_fb; | 1158 | struct drm_framebuffer *target_fb; |
| 1151 | uint64_t fb_location; | 1159 | uint64_t fb_location; |
| 1152 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; | 1160 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; |
| 1161 | u32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE; | ||
| 1153 | int r; | 1162 | int r; |
| 1154 | 1163 | ||
| 1155 | /* no fb bound */ | 1164 | /* no fb bound */ |
| @@ -1203,12 +1212,18 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
| 1203 | fb_format = | 1212 | fb_format = |
| 1204 | AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | | 1213 | AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | |
| 1205 | AVIVO_D1GRPH_CONTROL_16BPP_RGB565; | 1214 | AVIVO_D1GRPH_CONTROL_16BPP_RGB565; |
| 1215 | #ifdef __BIG_ENDIAN | ||
| 1216 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_16BIT; | ||
| 1217 | #endif | ||
| 1206 | break; | 1218 | break; |
| 1207 | case 24: | 1219 | case 24: |
| 1208 | case 32: | 1220 | case 32: |
| 1209 | fb_format = | 1221 | fb_format = |
| 1210 | AVIVO_D1GRPH_CONTROL_DEPTH_32BPP | | 1222 | AVIVO_D1GRPH_CONTROL_DEPTH_32BPP | |
| 1211 | AVIVO_D1GRPH_CONTROL_32BPP_ARGB8888; | 1223 | AVIVO_D1GRPH_CONTROL_32BPP_ARGB8888; |
| 1224 | #ifdef __BIG_ENDIAN | ||
| 1225 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_32BIT; | ||
| 1226 | #endif | ||
| 1212 | break; | 1227 | break; |
| 1213 | default: | 1228 | default: |
| 1214 | DRM_ERROR("Unsupported screen depth %d\n", | 1229 | DRM_ERROR("Unsupported screen depth %d\n", |
| @@ -1248,6 +1263,8 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
| 1248 | WREG32(AVIVO_D1GRPH_SECONDARY_SURFACE_ADDRESS + | 1263 | WREG32(AVIVO_D1GRPH_SECONDARY_SURFACE_ADDRESS + |
| 1249 | radeon_crtc->crtc_offset, (u32) fb_location); | 1264 | radeon_crtc->crtc_offset, (u32) fb_location); |
| 1250 | WREG32(AVIVO_D1GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format); | 1265 | WREG32(AVIVO_D1GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format); |
| 1266 | if (rdev->family >= CHIP_R600) | ||
| 1267 | WREG32(R600_D1GRPH_SWAP_CONTROL + radeon_crtc->crtc_offset, fb_swap); | ||
| 1251 | 1268 | ||
| 1252 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); | 1269 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); |
| 1253 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); | 1270 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); |
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index 4e7778d44b8d..695de9a38506 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
| @@ -187,9 +187,9 @@ static int dp_link_clock_for_mode_clock(u8 dpcd[DP_DPCD_SIZE], int mode_clock) | |||
| 187 | int dp_mode_valid(u8 dpcd[DP_DPCD_SIZE], int mode_clock) | 187 | int dp_mode_valid(u8 dpcd[DP_DPCD_SIZE], int mode_clock) |
| 188 | { | 188 | { |
| 189 | int lanes = dp_lanes_for_mode_clock(dpcd, mode_clock); | 189 | int lanes = dp_lanes_for_mode_clock(dpcd, mode_clock); |
| 190 | int bw = dp_lanes_for_mode_clock(dpcd, mode_clock); | 190 | int dp_clock = dp_link_clock_for_mode_clock(dpcd, mode_clock); |
| 191 | 191 | ||
| 192 | if ((lanes == 0) || (bw == 0)) | 192 | if ((lanes == 0) || (dp_clock == 0)) |
| 193 | return MODE_CLOCK_HIGH; | 193 | return MODE_CLOCK_HIGH; |
| 194 | 194 | ||
| 195 | return MODE_OK; | 195 | return MODE_OK; |
diff --git a/drivers/gpu/drm/radeon/evergreen_blit_kms.c b/drivers/gpu/drm/radeon/evergreen_blit_kms.c index b758dc7f2f2c..d4d4db49a8b8 100644 --- a/drivers/gpu/drm/radeon/evergreen_blit_kms.c +++ b/drivers/gpu/drm/radeon/evergreen_blit_kms.c | |||
| @@ -232,7 +232,7 @@ draw_auto(struct radeon_device *rdev) | |||
| 232 | 232 | ||
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | /* emits 30 */ | 235 | /* emits 34 */ |
| 236 | static void | 236 | static void |
| 237 | set_default_state(struct radeon_device *rdev) | 237 | set_default_state(struct radeon_device *rdev) |
| 238 | { | 238 | { |
| @@ -245,6 +245,8 @@ set_default_state(struct radeon_device *rdev) | |||
| 245 | int num_hs_threads, num_ls_threads; | 245 | int num_hs_threads, num_ls_threads; |
| 246 | int num_ps_stack_entries, num_vs_stack_entries, num_gs_stack_entries, num_es_stack_entries; | 246 | int num_ps_stack_entries, num_vs_stack_entries, num_gs_stack_entries, num_es_stack_entries; |
| 247 | int num_hs_stack_entries, num_ls_stack_entries; | 247 | int num_hs_stack_entries, num_ls_stack_entries; |
| 248 | u64 gpu_addr; | ||
| 249 | int dwords; | ||
| 248 | 250 | ||
| 249 | switch (rdev->family) { | 251 | switch (rdev->family) { |
| 250 | case CHIP_CEDAR: | 252 | case CHIP_CEDAR: |
| @@ -497,6 +499,14 @@ set_default_state(struct radeon_device *rdev) | |||
| 497 | radeon_ring_write(rdev, 0x00000000); | 499 | radeon_ring_write(rdev, 0x00000000); |
| 498 | radeon_ring_write(rdev, 0x00000000); | 500 | radeon_ring_write(rdev, 0x00000000); |
| 499 | 501 | ||
| 502 | /* emit an IB pointing at default state */ | ||
| 503 | dwords = ALIGN(rdev->r600_blit.state_len, 0x10); | ||
| 504 | gpu_addr = rdev->r600_blit.shader_gpu_addr + rdev->r600_blit.state_offset; | ||
| 505 | radeon_ring_write(rdev, PACKET3(PACKET3_INDIRECT_BUFFER, 2)); | ||
| 506 | radeon_ring_write(rdev, gpu_addr & 0xFFFFFFFC); | ||
| 507 | radeon_ring_write(rdev, upper_32_bits(gpu_addr) & 0xFF); | ||
| 508 | radeon_ring_write(rdev, dwords); | ||
| 509 | |||
| 500 | } | 510 | } |
| 501 | 511 | ||
| 502 | static inline uint32_t i2f(uint32_t input) | 512 | static inline uint32_t i2f(uint32_t input) |
| @@ -527,8 +537,10 @@ static inline uint32_t i2f(uint32_t input) | |||
| 527 | int evergreen_blit_init(struct radeon_device *rdev) | 537 | int evergreen_blit_init(struct radeon_device *rdev) |
| 528 | { | 538 | { |
| 529 | u32 obj_size; | 539 | u32 obj_size; |
| 530 | int r; | 540 | int r, dwords; |
| 531 | void *ptr; | 541 | void *ptr; |
| 542 | u32 packet2s[16]; | ||
| 543 | int num_packet2s = 0; | ||
| 532 | 544 | ||
| 533 | /* pin copy shader into vram if already initialized */ | 545 | /* pin copy shader into vram if already initialized */ |
| 534 | if (rdev->r600_blit.shader_obj) | 546 | if (rdev->r600_blit.shader_obj) |
| @@ -536,8 +548,17 @@ int evergreen_blit_init(struct radeon_device *rdev) | |||
| 536 | 548 | ||
| 537 | mutex_init(&rdev->r600_blit.mutex); | 549 | mutex_init(&rdev->r600_blit.mutex); |
| 538 | rdev->r600_blit.state_offset = 0; | 550 | rdev->r600_blit.state_offset = 0; |
| 539 | rdev->r600_blit.state_len = 0; | 551 | |
| 540 | obj_size = 0; | 552 | rdev->r600_blit.state_len = evergreen_default_size; |
| 553 | |||
| 554 | dwords = rdev->r600_blit.state_len; | ||
| 555 | while (dwords & 0xf) { | ||
| 556 | packet2s[num_packet2s++] = PACKET2(0); | ||
| 557 | dwords++; | ||
| 558 | } | ||
| 559 | |||
| 560 | obj_size = dwords * 4; | ||
| 561 | obj_size = ALIGN(obj_size, 256); | ||
| 541 | 562 | ||
| 542 | rdev->r600_blit.vs_offset = obj_size; | 563 | rdev->r600_blit.vs_offset = obj_size; |
| 543 | obj_size += evergreen_vs_size * 4; | 564 | obj_size += evergreen_vs_size * 4; |
| @@ -567,6 +588,12 @@ int evergreen_blit_init(struct radeon_device *rdev) | |||
| 567 | return r; | 588 | return r; |
| 568 | } | 589 | } |
| 569 | 590 | ||
| 591 | memcpy_toio(ptr + rdev->r600_blit.state_offset, | ||
| 592 | evergreen_default_state, rdev->r600_blit.state_len * 4); | ||
| 593 | |||
| 594 | if (num_packet2s) | ||
| 595 | memcpy_toio(ptr + rdev->r600_blit.state_offset + (rdev->r600_blit.state_len * 4), | ||
| 596 | packet2s, num_packet2s * 4); | ||
| 570 | memcpy(ptr + rdev->r600_blit.vs_offset, evergreen_vs, evergreen_vs_size * 4); | 597 | memcpy(ptr + rdev->r600_blit.vs_offset, evergreen_vs, evergreen_vs_size * 4); |
| 571 | memcpy(ptr + rdev->r600_blit.ps_offset, evergreen_ps, evergreen_ps_size * 4); | 598 | memcpy(ptr + rdev->r600_blit.ps_offset, evergreen_ps, evergreen_ps_size * 4); |
| 572 | radeon_bo_kunmap(rdev->r600_blit.shader_obj); | 599 | radeon_bo_kunmap(rdev->r600_blit.shader_obj); |
| @@ -652,7 +679,7 @@ int evergreen_blit_prepare_copy(struct radeon_device *rdev, int size_bytes) | |||
| 652 | /* calculate number of loops correctly */ | 679 | /* calculate number of loops correctly */ |
| 653 | ring_size = num_loops * dwords_per_loop; | 680 | ring_size = num_loops * dwords_per_loop; |
| 654 | /* set default + shaders */ | 681 | /* set default + shaders */ |
| 655 | ring_size += 46; /* shaders + def state */ | 682 | ring_size += 50; /* shaders + def state */ |
| 656 | ring_size += 10; /* fence emit for VB IB */ | 683 | ring_size += 10; /* fence emit for VB IB */ |
| 657 | ring_size += 5; /* done copy */ | 684 | ring_size += 5; /* done copy */ |
| 658 | ring_size += 10; /* fence emit for done copy */ | 685 | ring_size += 10; /* fence emit for done copy */ |
| @@ -660,7 +687,7 @@ int evergreen_blit_prepare_copy(struct radeon_device *rdev, int size_bytes) | |||
| 660 | if (r) | 687 | if (r) |
| 661 | return r; | 688 | return r; |
| 662 | 689 | ||
| 663 | set_default_state(rdev); /* 30 */ | 690 | set_default_state(rdev); /* 34 */ |
| 664 | set_shaders(rdev); /* 16 */ | 691 | set_shaders(rdev); /* 16 */ |
| 665 | return 0; | 692 | return 0; |
| 666 | } | 693 | } |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 5968dde243e9..5f15820efe12 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
| @@ -1031,8 +1031,8 @@ int r100_cp_init(struct radeon_device *rdev, unsigned ring_size) | |||
| 1031 | WREG32(RADEON_CP_CSQ_MODE, | 1031 | WREG32(RADEON_CP_CSQ_MODE, |
| 1032 | REG_SET(RADEON_INDIRECT2_START, indirect2_start) | | 1032 | REG_SET(RADEON_INDIRECT2_START, indirect2_start) | |
| 1033 | REG_SET(RADEON_INDIRECT1_START, indirect1_start)); | 1033 | REG_SET(RADEON_INDIRECT1_START, indirect1_start)); |
| 1034 | WREG32(0x718, 0); | 1034 | WREG32(RADEON_CP_RB_WPTR_DELAY, 0); |
| 1035 | WREG32(0x744, 0x00004D4D); | 1035 | WREG32(RADEON_CP_CSQ_MODE, 0x00004D4D); |
| 1036 | WREG32(RADEON_CP_CSQ_CNTL, RADEON_CSQ_PRIBM_INDBM); | 1036 | WREG32(RADEON_CP_CSQ_CNTL, RADEON_CSQ_PRIBM_INDBM); |
| 1037 | radeon_ring_start(rdev); | 1037 | radeon_ring_start(rdev); |
| 1038 | r = radeon_ring_test(rdev); | 1038 | r = radeon_ring_test(rdev); |
| @@ -2347,10 +2347,10 @@ void r100_vga_set_state(struct radeon_device *rdev, bool state) | |||
| 2347 | 2347 | ||
| 2348 | temp = RREG32(RADEON_CONFIG_CNTL); | 2348 | temp = RREG32(RADEON_CONFIG_CNTL); |
| 2349 | if (state == false) { | 2349 | if (state == false) { |
| 2350 | temp &= ~(1<<8); | 2350 | temp &= ~RADEON_CFG_VGA_RAM_EN; |
| 2351 | temp |= (1<<9); | 2351 | temp |= RADEON_CFG_VGA_IO_DIS; |
| 2352 | } else { | 2352 | } else { |
| 2353 | temp &= ~(1<<9); | 2353 | temp &= ~RADEON_CFG_VGA_IO_DIS; |
| 2354 | } | 2354 | } |
| 2355 | WREG32(RADEON_CONFIG_CNTL, temp); | 2355 | WREG32(RADEON_CONFIG_CNTL, temp); |
| 2356 | } | 2356 | } |
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c index cf862ca580bf..55fe5ba7def3 100644 --- a/drivers/gpu/drm/radeon/r300.c +++ b/drivers/gpu/drm/radeon/r300.c | |||
| @@ -69,6 +69,9 @@ void rv370_pcie_gart_tlb_flush(struct radeon_device *rdev) | |||
| 69 | mb(); | 69 | mb(); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | #define R300_PTE_WRITEABLE (1 << 2) | ||
| 73 | #define R300_PTE_READABLE (1 << 3) | ||
| 74 | |||
| 72 | int rv370_pcie_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr) | 75 | int rv370_pcie_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr) |
| 73 | { | 76 | { |
| 74 | void __iomem *ptr = (void *)rdev->gart.table.vram.ptr; | 77 | void __iomem *ptr = (void *)rdev->gart.table.vram.ptr; |
| @@ -78,7 +81,7 @@ int rv370_pcie_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr) | |||
| 78 | } | 81 | } |
| 79 | addr = (lower_32_bits(addr) >> 8) | | 82 | addr = (lower_32_bits(addr) >> 8) | |
| 80 | ((upper_32_bits(addr) & 0xff) << 24) | | 83 | ((upper_32_bits(addr) & 0xff) << 24) | |
| 81 | 0xc; | 84 | R300_PTE_WRITEABLE | R300_PTE_READABLE; |
| 82 | /* on x86 we want this to be CPU endian, on powerpc | 85 | /* on x86 we want this to be CPU endian, on powerpc |
| 83 | * on powerpc without HW swappers, it'll get swapped on way | 86 | * on powerpc without HW swappers, it'll get swapped on way |
| 84 | * into VRAM - so no need for cpu_to_le32 on VRAM tables */ | 87 | * into VRAM - so no need for cpu_to_le32 on VRAM tables */ |
| @@ -135,7 +138,7 @@ int rv370_pcie_gart_enable(struct radeon_device *rdev) | |||
| 135 | WREG32_PCIE(RADEON_PCIE_TX_DISCARD_RD_ADDR_LO, rdev->mc.vram_start); | 138 | WREG32_PCIE(RADEON_PCIE_TX_DISCARD_RD_ADDR_LO, rdev->mc.vram_start); |
| 136 | WREG32_PCIE(RADEON_PCIE_TX_DISCARD_RD_ADDR_HI, 0); | 139 | WREG32_PCIE(RADEON_PCIE_TX_DISCARD_RD_ADDR_HI, 0); |
| 137 | /* Clear error */ | 140 | /* Clear error */ |
| 138 | WREG32_PCIE(0x18, 0); | 141 | WREG32_PCIE(RADEON_PCIE_TX_GART_ERROR, 0); |
| 139 | tmp = RREG32_PCIE(RADEON_PCIE_TX_GART_CNTL); | 142 | tmp = RREG32_PCIE(RADEON_PCIE_TX_GART_CNTL); |
| 140 | tmp |= RADEON_PCIE_TX_GART_EN; | 143 | tmp |= RADEON_PCIE_TX_GART_EN; |
| 141 | tmp |= RADEON_PCIE_TX_GART_UNMAPPED_ACCESS_DISCARD; | 144 | tmp |= RADEON_PCIE_TX_GART_UNMAPPED_ACCESS_DISCARD; |
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c index c387346f93a9..0b59ed7c7d2c 100644 --- a/drivers/gpu/drm/radeon/r420.c +++ b/drivers/gpu/drm/radeon/r420.c | |||
| @@ -96,7 +96,7 @@ void r420_pipes_init(struct radeon_device *rdev) | |||
| 96 | "programming pipes. Bad things might happen.\n"); | 96 | "programming pipes. Bad things might happen.\n"); |
| 97 | } | 97 | } |
| 98 | /* get max number of pipes */ | 98 | /* get max number of pipes */ |
| 99 | gb_pipe_select = RREG32(0x402C); | 99 | gb_pipe_select = RREG32(R400_GB_PIPE_SELECT); |
| 100 | num_pipes = ((gb_pipe_select >> 12) & 3) + 1; | 100 | num_pipes = ((gb_pipe_select >> 12) & 3) + 1; |
| 101 | 101 | ||
| 102 | /* SE chips have 1 pipe */ | 102 | /* SE chips have 1 pipe */ |
diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c index 3c8677f9e385..2ce80d976568 100644 --- a/drivers/gpu/drm/radeon/r520.c +++ b/drivers/gpu/drm/radeon/r520.c | |||
| @@ -79,8 +79,8 @@ static void r520_gpu_init(struct radeon_device *rdev) | |||
| 79 | WREG32(0x4128, 0xFF); | 79 | WREG32(0x4128, 0xFF); |
| 80 | } | 80 | } |
| 81 | r420_pipes_init(rdev); | 81 | r420_pipes_init(rdev); |
| 82 | gb_pipe_select = RREG32(0x402C); | 82 | gb_pipe_select = RREG32(R400_GB_PIPE_SELECT); |
| 83 | tmp = RREG32(0x170C); | 83 | tmp = RREG32(R300_DST_PIPE_CONFIG); |
| 84 | pipe_select_current = (tmp >> 2) & 3; | 84 | pipe_select_current = (tmp >> 2) & 3; |
| 85 | tmp = (1 << pipe_select_current) | | 85 | tmp = (1 << pipe_select_current) | |
| 86 | (((gb_pipe_select >> 8) & 0xF) << 4); | 86 | (((gb_pipe_select >> 8) & 0xF) << 4); |
diff --git a/drivers/gpu/drm/radeon/r600_reg.h b/drivers/gpu/drm/radeon/r600_reg.h index 33cda016b083..f869897c7456 100644 --- a/drivers/gpu/drm/radeon/r600_reg.h +++ b/drivers/gpu/drm/radeon/r600_reg.h | |||
| @@ -81,7 +81,11 @@ | |||
| 81 | #define R600_MEDIUM_VID_LOWER_GPIO_CNTL 0x720 | 81 | #define R600_MEDIUM_VID_LOWER_GPIO_CNTL 0x720 |
| 82 | #define R600_LOW_VID_LOWER_GPIO_CNTL 0x724 | 82 | #define R600_LOW_VID_LOWER_GPIO_CNTL 0x724 |
| 83 | 83 | ||
| 84 | 84 | #define R600_D1GRPH_SWAP_CONTROL 0x610C | |
| 85 | # define R600_D1GRPH_SWAP_ENDIAN_NONE (0 << 0) | ||
| 86 | # define R600_D1GRPH_SWAP_ENDIAN_16BIT (1 << 0) | ||
| 87 | # define R600_D1GRPH_SWAP_ENDIAN_32BIT (2 << 0) | ||
| 88 | # define R600_D1GRPH_SWAP_ENDIAN_64BIT (3 << 0) | ||
| 85 | 89 | ||
| 86 | #define R600_HDP_NONSURFACE_BASE 0x2c04 | 90 | #define R600_HDP_NONSURFACE_BASE 0x2c04 |
| 87 | 91 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 26091d602b84..0d478932b1a9 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/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 8fd184286c0b..5e90984d5ad2 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
| @@ -641,7 +641,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
| 641 | switch (connector->connector_type) { | 641 | switch (connector->connector_type) { |
| 642 | case DRM_MODE_CONNECTOR_DVII: | 642 | case DRM_MODE_CONNECTOR_DVII: |
| 643 | case DRM_MODE_CONNECTOR_HDMIB: /* HDMI-B is basically DL-DVI; analog works fine */ | 643 | case DRM_MODE_CONNECTOR_HDMIB: /* HDMI-B is basically DL-DVI; analog works fine */ |
| 644 | if (drm_detect_monitor_audio(radeon_connector->edid)) { | 644 | if (drm_detect_monitor_audio(radeon_connector->edid) && radeon_audio) { |
| 645 | /* fix me */ | 645 | /* fix me */ |
| 646 | if (ASIC_IS_DCE4(rdev)) | 646 | if (ASIC_IS_DCE4(rdev)) |
| 647 | return ATOM_ENCODER_MODE_DVI; | 647 | return ATOM_ENCODER_MODE_DVI; |
| @@ -655,7 +655,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
| 655 | case DRM_MODE_CONNECTOR_DVID: | 655 | case DRM_MODE_CONNECTOR_DVID: |
| 656 | case DRM_MODE_CONNECTOR_HDMIA: | 656 | case DRM_MODE_CONNECTOR_HDMIA: |
| 657 | default: | 657 | default: |
| 658 | if (drm_detect_monitor_audio(radeon_connector->edid)) { | 658 | if (drm_detect_monitor_audio(radeon_connector->edid) && radeon_audio) { |
| 659 | /* fix me */ | 659 | /* fix me */ |
| 660 | if (ASIC_IS_DCE4(rdev)) | 660 | if (ASIC_IS_DCE4(rdev)) |
| 661 | return ATOM_ENCODER_MODE_DVI; | 661 | return ATOM_ENCODER_MODE_DVI; |
| @@ -673,7 +673,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
| 673 | if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || | 673 | if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || |
| 674 | (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) | 674 | (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) |
| 675 | return ATOM_ENCODER_MODE_DP; | 675 | return ATOM_ENCODER_MODE_DP; |
| 676 | else if (drm_detect_monitor_audio(radeon_connector->edid)) { | 676 | else if (drm_detect_monitor_audio(radeon_connector->edid) && radeon_audio) { |
| 677 | /* fix me */ | 677 | /* fix me */ |
| 678 | if (ASIC_IS_DCE4(rdev)) | 678 | if (ASIC_IS_DCE4(rdev)) |
| 679 | return ATOM_ENCODER_MODE_DVI; | 679 | return ATOM_ENCODER_MODE_DVI; |
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 98321298cffd..8387d32caaa7 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c | |||
| @@ -247,6 +247,8 @@ void radeon_driver_preclose_kms(struct drm_device *dev, | |||
| 247 | struct radeon_device *rdev = dev->dev_private; | 247 | struct radeon_device *rdev = dev->dev_private; |
| 248 | if (rdev->hyperz_filp == file_priv) | 248 | if (rdev->hyperz_filp == file_priv) |
| 249 | rdev->hyperz_filp = NULL; | 249 | rdev->hyperz_filp = NULL; |
| 250 | if (rdev->cmask_filp == file_priv) | ||
| 251 | rdev->cmask_filp = NULL; | ||
| 250 | } | 252 | } |
| 251 | 253 | ||
| 252 | /* | 254 | /* |
diff --git a/drivers/gpu/drm/radeon/radeon_reg.h b/drivers/gpu/drm/radeon/radeon_reg.h index 3cd4dace57c7..ec93a75369e6 100644 --- a/drivers/gpu/drm/radeon/radeon_reg.h +++ b/drivers/gpu/drm/radeon/radeon_reg.h | |||
| @@ -375,6 +375,8 @@ | |||
| 375 | #define RADEON_CONFIG_APER_SIZE 0x0108 | 375 | #define RADEON_CONFIG_APER_SIZE 0x0108 |
| 376 | #define RADEON_CONFIG_BONDS 0x00e8 | 376 | #define RADEON_CONFIG_BONDS 0x00e8 |
| 377 | #define RADEON_CONFIG_CNTL 0x00e0 | 377 | #define RADEON_CONFIG_CNTL 0x00e0 |
| 378 | # define RADEON_CFG_VGA_RAM_EN (1 << 8) | ||
| 379 | # define RADEON_CFG_VGA_IO_DIS (1 << 9) | ||
| 378 | # define RADEON_CFG_ATI_REV_A11 (0 << 16) | 380 | # define RADEON_CFG_ATI_REV_A11 (0 << 16) |
| 379 | # define RADEON_CFG_ATI_REV_A12 (1 << 16) | 381 | # define RADEON_CFG_ATI_REV_A12 (1 << 16) |
| 380 | # define RADEON_CFG_ATI_REV_A13 (2 << 16) | 382 | # define RADEON_CFG_ATI_REV_A13 (2 << 16) |
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c index 5512e4e5e636..c76283d9eb3d 100644 --- a/drivers/gpu/drm/radeon/rs400.c +++ b/drivers/gpu/drm/radeon/rs400.c | |||
| @@ -203,6 +203,9 @@ void rs400_gart_fini(struct radeon_device *rdev) | |||
| 203 | radeon_gart_table_ram_free(rdev); | 203 | radeon_gart_table_ram_free(rdev); |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | #define RS400_PTE_WRITEABLE (1 << 2) | ||
| 207 | #define RS400_PTE_READABLE (1 << 3) | ||
| 208 | |||
| 206 | int rs400_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr) | 209 | int rs400_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr) |
| 207 | { | 210 | { |
| 208 | uint32_t entry; | 211 | uint32_t entry; |
| @@ -213,7 +216,7 @@ int rs400_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr) | |||
| 213 | 216 | ||
| 214 | entry = (lower_32_bits(addr) & PAGE_MASK) | | 217 | entry = (lower_32_bits(addr) & PAGE_MASK) | |
| 215 | ((upper_32_bits(addr) & 0xff) << 4) | | 218 | ((upper_32_bits(addr) & 0xff) << 4) | |
| 216 | 0xc; | 219 | RS400_PTE_WRITEABLE | RS400_PTE_READABLE; |
| 217 | entry = cpu_to_le32(entry); | 220 | entry = cpu_to_le32(entry); |
| 218 | rdev->gart.table.ram.ptr[i] = entry; | 221 | rdev->gart.table.ram.ptr[i] = entry; |
| 219 | return 0; | 222 | return 0; |
| @@ -226,8 +229,8 @@ int rs400_mc_wait_for_idle(struct radeon_device *rdev) | |||
| 226 | 229 | ||
| 227 | for (i = 0; i < rdev->usec_timeout; i++) { | 230 | for (i = 0; i < rdev->usec_timeout; i++) { |
| 228 | /* read MC_STATUS */ | 231 | /* read MC_STATUS */ |
| 229 | tmp = RREG32(0x0150); | 232 | tmp = RREG32(RADEON_MC_STATUS); |
| 230 | if (tmp & (1 << 2)) { | 233 | if (tmp & RADEON_MC_IDLE) { |
| 231 | return 0; | 234 | return 0; |
| 232 | } | 235 | } |
| 233 | DRM_UDELAY(1); | 236 | DRM_UDELAY(1); |
| @@ -241,7 +244,7 @@ void rs400_gpu_init(struct radeon_device *rdev) | |||
| 241 | r420_pipes_init(rdev); | 244 | r420_pipes_init(rdev); |
| 242 | if (rs400_mc_wait_for_idle(rdev)) { | 245 | if (rs400_mc_wait_for_idle(rdev)) { |
| 243 | printk(KERN_WARNING "rs400: Failed to wait MC idle while " | 246 | printk(KERN_WARNING "rs400: Failed to wait MC idle while " |
| 244 | "programming pipes. Bad things might happen. %08x\n", RREG32(0x150)); | 247 | "programming pipes. Bad things might happen. %08x\n", RREG32(RADEON_MC_STATUS)); |
| 245 | } | 248 | } |
| 246 | } | 249 | } |
| 247 | 250 | ||
| @@ -300,9 +303,9 @@ static int rs400_debugfs_gart_info(struct seq_file *m, void *data) | |||
| 300 | seq_printf(m, "MCCFG_AGP_BASE_2 0x%08x\n", tmp); | 303 | seq_printf(m, "MCCFG_AGP_BASE_2 0x%08x\n", tmp); |
| 301 | tmp = RREG32_MC(RS690_MCCFG_AGP_LOCATION); | 304 | tmp = RREG32_MC(RS690_MCCFG_AGP_LOCATION); |
| 302 | seq_printf(m, "MCCFG_AGP_LOCATION 0x%08x\n", tmp); | 305 | seq_printf(m, "MCCFG_AGP_LOCATION 0x%08x\n", tmp); |
| 303 | tmp = RREG32_MC(0x100); | 306 | tmp = RREG32_MC(RS690_MCCFG_FB_LOCATION); |
| 304 | seq_printf(m, "MCCFG_FB_LOCATION 0x%08x\n", tmp); | 307 | seq_printf(m, "MCCFG_FB_LOCATION 0x%08x\n", tmp); |
| 305 | tmp = RREG32(0x134); | 308 | tmp = RREG32(RS690_HDP_FB_LOCATION); |
| 306 | seq_printf(m, "HDP_FB_LOCATION 0x%08x\n", tmp); | 309 | seq_printf(m, "HDP_FB_LOCATION 0x%08x\n", tmp); |
| 307 | } else { | 310 | } else { |
| 308 | tmp = RREG32(RADEON_AGP_BASE); | 311 | tmp = RREG32(RADEON_AGP_BASE); |
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c index 5d569f41f4ae..64b57af93714 100644 --- a/drivers/gpu/drm/radeon/rv515.c +++ b/drivers/gpu/drm/radeon/rv515.c | |||
| @@ -69,13 +69,13 @@ void rv515_ring_start(struct radeon_device *rdev) | |||
| 69 | ISYNC_CPSCRATCH_IDLEGUI); | 69 | ISYNC_CPSCRATCH_IDLEGUI); |
| 70 | radeon_ring_write(rdev, PACKET0(WAIT_UNTIL, 0)); | 70 | radeon_ring_write(rdev, PACKET0(WAIT_UNTIL, 0)); |
| 71 | radeon_ring_write(rdev, WAIT_2D_IDLECLEAN | WAIT_3D_IDLECLEAN); | 71 | radeon_ring_write(rdev, WAIT_2D_IDLECLEAN | WAIT_3D_IDLECLEAN); |
| 72 | radeon_ring_write(rdev, PACKET0(0x170C, 0)); | 72 | radeon_ring_write(rdev, PACKET0(R300_DST_PIPE_CONFIG, 0)); |
| 73 | radeon_ring_write(rdev, 1 << 31); | 73 | radeon_ring_write(rdev, R300_PIPE_AUTO_CONFIG); |
| 74 | radeon_ring_write(rdev, PACKET0(GB_SELECT, 0)); | 74 | radeon_ring_write(rdev, PACKET0(GB_SELECT, 0)); |
| 75 | radeon_ring_write(rdev, 0); | 75 | radeon_ring_write(rdev, 0); |
| 76 | radeon_ring_write(rdev, PACKET0(GB_ENABLE, 0)); | 76 | radeon_ring_write(rdev, PACKET0(GB_ENABLE, 0)); |
| 77 | radeon_ring_write(rdev, 0); | 77 | radeon_ring_write(rdev, 0); |
| 78 | radeon_ring_write(rdev, PACKET0(0x42C8, 0)); | 78 | radeon_ring_write(rdev, PACKET0(R500_SU_REG_DEST, 0)); |
| 79 | radeon_ring_write(rdev, (1 << rdev->num_gb_pipes) - 1); | 79 | radeon_ring_write(rdev, (1 << rdev->num_gb_pipes) - 1); |
| 80 | radeon_ring_write(rdev, PACKET0(VAP_INDEX_OFFSET, 0)); | 80 | radeon_ring_write(rdev, PACKET0(VAP_INDEX_OFFSET, 0)); |
| 81 | radeon_ring_write(rdev, 0); | 81 | radeon_ring_write(rdev, 0); |
| @@ -153,8 +153,8 @@ void rv515_gpu_init(struct radeon_device *rdev) | |||
| 153 | } | 153 | } |
| 154 | rv515_vga_render_disable(rdev); | 154 | rv515_vga_render_disable(rdev); |
| 155 | r420_pipes_init(rdev); | 155 | r420_pipes_init(rdev); |
| 156 | gb_pipe_select = RREG32(0x402C); | 156 | gb_pipe_select = RREG32(R400_GB_PIPE_SELECT); |
| 157 | tmp = RREG32(0x170C); | 157 | tmp = RREG32(R300_DST_PIPE_CONFIG); |
| 158 | pipe_select_current = (tmp >> 2) & 3; | 158 | pipe_select_current = (tmp >> 2) & 3; |
| 159 | tmp = (1 << pipe_select_current) | | 159 | tmp = (1 << pipe_select_current) | |
| 160 | (((gb_pipe_select >> 8) & 0xF) << 4); | 160 | (((gb_pipe_select >> 8) & 0xF) << 4); |
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index ce0372f0615e..4c0743660e9c 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 2d68cf3c223b..b5e892017e0c 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 1b674b7d4584..d805e8e57967 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 417507348bab..c7a92028f450 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 4e5571b72cda..468c627a2844 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 6069abe31e42..eb3006361ee4 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 000000000000..ac471b77c18e --- /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_LEFTMETA), | ||
| 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_shft; | ||
| 359 | u32 c_mask = 0x0f << c_shft; | ||
| 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 b4a81ebfab92..c8f097a15d89 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/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index da392c22fc6c..aa186cf6c514 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
| @@ -755,23 +755,26 @@ static int synaptics_reconnect(struct psmouse *psmouse) | |||
| 755 | { | 755 | { |
| 756 | struct synaptics_data *priv = psmouse->private; | 756 | struct synaptics_data *priv = psmouse->private; |
| 757 | struct synaptics_data old_priv = *priv; | 757 | struct synaptics_data old_priv = *priv; |
| 758 | int retry = 0; | ||
| 759 | int error; | ||
| 758 | 760 | ||
| 759 | psmouse_reset(psmouse); | 761 | do { |
| 762 | psmouse_reset(psmouse); | ||
| 763 | error = synaptics_detect(psmouse, 0); | ||
| 764 | } while (error && ++retry < 3); | ||
| 760 | 765 | ||
| 761 | if (synaptics_detect(psmouse, 0)) | 766 | if (error) |
| 762 | return -1; | 767 | return -1; |
| 763 | 768 | ||
| 769 | if (retry > 1) | ||
| 770 | printk(KERN_DEBUG "Synaptics reconnected after %d tries\n", | ||
| 771 | retry); | ||
| 772 | |||
| 764 | if (synaptics_query_hardware(psmouse)) { | 773 | if (synaptics_query_hardware(psmouse)) { |
| 765 | printk(KERN_ERR "Unable to query Synaptics hardware.\n"); | 774 | printk(KERN_ERR "Unable to query Synaptics hardware.\n"); |
| 766 | return -1; | 775 | return -1; |
| 767 | } | 776 | } |
| 768 | 777 | ||
| 769 | if (old_priv.identity != priv->identity || | ||
| 770 | old_priv.model_id != priv->model_id || | ||
| 771 | old_priv.capabilities != priv->capabilities || | ||
| 772 | old_priv.ext_cap != priv->ext_cap) | ||
| 773 | return -1; | ||
| 774 | |||
| 775 | if (synaptics_set_absolute_mode(psmouse)) { | 778 | if (synaptics_set_absolute_mode(psmouse)) { |
| 776 | printk(KERN_ERR "Unable to initialize Synaptics hardware.\n"); | 779 | printk(KERN_ERR "Unable to initialize Synaptics hardware.\n"); |
| 777 | return -1; | 780 | return -1; |
| @@ -782,6 +785,19 @@ static int synaptics_reconnect(struct psmouse *psmouse) | |||
| 782 | return -1; | 785 | return -1; |
| 783 | } | 786 | } |
| 784 | 787 | ||
| 788 | if (old_priv.identity != priv->identity || | ||
| 789 | old_priv.model_id != priv->model_id || | ||
| 790 | old_priv.capabilities != priv->capabilities || | ||
| 791 | old_priv.ext_cap != priv->ext_cap) { | ||
| 792 | printk(KERN_ERR "Synaptics hardware appears to be different: " | ||
| 793 | "id(%ld-%ld), model(%ld-%ld), caps(%lx-%lx), ext(%lx-%lx).\n", | ||
| 794 | old_priv.identity, priv->identity, | ||
| 795 | old_priv.model_id, priv->model_id, | ||
| 796 | old_priv.capabilities, priv->capabilities, | ||
| 797 | old_priv.ext_cap, priv->ext_cap); | ||
| 798 | return -1; | ||
| 799 | } | ||
| 800 | |||
| 785 | return 0; | 801 | return 0; |
| 786 | } | 802 | } |
| 787 | 803 | ||
diff --git a/drivers/input/serio/ct82c710.c b/drivers/input/serio/ct82c710.c index 448c7724beb9..852816567241 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 6e362de3f412..8755f5f3ad37 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 a29a7812bd46..7729e547ba65 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 518782999fea..367fa82a607e 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 f7fa9ef4cd65..1507ce108d5b 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 cf1dba2e267c..22a3411e93c5 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 da3fa8dcdf5b..666daf77872e 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/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 72be8a02118c..512a2f4ada0e 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c | |||
| @@ -458,21 +458,27 @@ static int ir_getkeycode(struct input_dev *idev, | |||
| 458 | index = ir_lookup_by_scancode(rc_map, scancode); | 458 | index = ir_lookup_by_scancode(rc_map, scancode); |
| 459 | } | 459 | } |
| 460 | 460 | ||
| 461 | if (index >= rc_map->len) { | 461 | if (index < rc_map->len) { |
| 462 | if (!(ke->flags & INPUT_KEYMAP_BY_INDEX)) | 462 | entry = &rc_map->scan[index]; |
| 463 | IR_dprintk(1, "unknown key for scancode 0x%04x\n", | 463 | |
| 464 | scancode); | 464 | ke->index = index; |
| 465 | ke->keycode = entry->keycode; | ||
| 466 | ke->len = sizeof(entry->scancode); | ||
| 467 | memcpy(ke->scancode, &entry->scancode, sizeof(entry->scancode)); | ||
| 468 | |||
| 469 | } else if (!(ke->flags & INPUT_KEYMAP_BY_INDEX)) { | ||
| 470 | /* | ||
| 471 | * We do not really know the valid range of scancodes | ||
| 472 | * so let's respond with KEY_RESERVED to anything we | ||
| 473 | * do not have mapping for [yet]. | ||
| 474 | */ | ||
| 475 | ke->index = index; | ||
| 476 | ke->keycode = KEY_RESERVED; | ||
| 477 | } else { | ||
| 465 | retval = -EINVAL; | 478 | retval = -EINVAL; |
| 466 | goto out; | 479 | goto out; |
| 467 | } | 480 | } |
| 468 | 481 | ||
| 469 | entry = &rc_map->scan[index]; | ||
| 470 | |||
| 471 | ke->index = index; | ||
| 472 | ke->keycode = entry->keycode; | ||
| 473 | ke->len = sizeof(entry->scancode); | ||
| 474 | memcpy(ke->scancode, &entry->scancode, sizeof(entry->scancode)); | ||
| 475 | |||
| 476 | retval = 0; | 482 | retval = 0; |
| 477 | 483 | ||
| 478 | out: | 484 | out: |
diff --git a/drivers/mmc/host/bfin_sdh.c b/drivers/mmc/host/bfin_sdh.c index bac7d62866b7..0371bf502249 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 b3a0ab0e4c2b..74218ad677e4 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 563022825667..4b8dcd5b2a01 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
| @@ -46,10 +46,6 @@ static unsigned int fmax = 515633; | |||
| 46 | * is asserted (likewise for RX) | 46 | * is asserted (likewise for RX) |
| 47 | * @fifohalfsize: number of bytes that can be written when MCI_TXFIFOHALFEMPTY | 47 | * @fifohalfsize: number of bytes that can be written when MCI_TXFIFOHALFEMPTY |
| 48 | * is asserted (likewise for RX) | 48 | * is asserted (likewise for RX) |
| 49 | * @broken_blockend: the MCI_DATABLOCKEND is broken on the hardware | ||
| 50 | * and will not work at all. | ||
| 51 | * @broken_blockend_dma: the MCI_DATABLOCKEND is broken on the hardware when | ||
| 52 | * using DMA. | ||
| 53 | * @sdio: variant supports SDIO | 49 | * @sdio: variant supports SDIO |
| 54 | * @st_clkdiv: true if using a ST-specific clock divider algorithm | 50 | * @st_clkdiv: true if using a ST-specific clock divider algorithm |
| 55 | */ | 51 | */ |
| @@ -59,8 +55,6 @@ struct variant_data { | |||
| 59 | unsigned int datalength_bits; | 55 | unsigned int datalength_bits; |
| 60 | unsigned int fifosize; | 56 | unsigned int fifosize; |
| 61 | unsigned int fifohalfsize; | 57 | unsigned int fifohalfsize; |
| 62 | bool broken_blockend; | ||
| 63 | bool broken_blockend_dma; | ||
| 64 | bool sdio; | 58 | bool sdio; |
| 65 | bool st_clkdiv; | 59 | bool st_clkdiv; |
| 66 | }; | 60 | }; |
| @@ -76,7 +70,6 @@ static struct variant_data variant_u300 = { | |||
| 76 | .fifohalfsize = 8 * 4, | 70 | .fifohalfsize = 8 * 4, |
| 77 | .clkreg_enable = 1 << 13, /* HWFCEN */ | 71 | .clkreg_enable = 1 << 13, /* HWFCEN */ |
| 78 | .datalength_bits = 16, | 72 | .datalength_bits = 16, |
| 79 | .broken_blockend_dma = true, | ||
| 80 | .sdio = true, | 73 | .sdio = true, |
| 81 | }; | 74 | }; |
| 82 | 75 | ||
| @@ -86,7 +79,6 @@ static struct variant_data variant_ux500 = { | |||
| 86 | .clkreg = MCI_CLK_ENABLE, | 79 | .clkreg = MCI_CLK_ENABLE, |
| 87 | .clkreg_enable = 1 << 14, /* HWFCEN */ | 80 | .clkreg_enable = 1 << 14, /* HWFCEN */ |
| 88 | .datalength_bits = 24, | 81 | .datalength_bits = 24, |
| 89 | .broken_blockend = true, | ||
| 90 | .sdio = true, | 82 | .sdio = true, |
| 91 | .st_clkdiv = true, | 83 | .st_clkdiv = true, |
| 92 | }; | 84 | }; |
| @@ -210,8 +202,6 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) | |||
| 210 | host->data = data; | 202 | host->data = data; |
| 211 | host->size = data->blksz * data->blocks; | 203 | host->size = data->blksz * data->blocks; |
| 212 | host->data_xfered = 0; | 204 | host->data_xfered = 0; |
| 213 | host->blockend = false; | ||
| 214 | host->dataend = false; | ||
| 215 | 205 | ||
| 216 | mmci_init_sg(host, data); | 206 | mmci_init_sg(host, data); |
| 217 | 207 | ||
| @@ -288,21 +278,26 @@ static void | |||
| 288 | mmci_data_irq(struct mmci_host *host, struct mmc_data *data, | 278 | mmci_data_irq(struct mmci_host *host, struct mmc_data *data, |
| 289 | unsigned int status) | 279 | unsigned int status) |
| 290 | { | 280 | { |
| 291 | struct variant_data *variant = host->variant; | ||
| 292 | |||
| 293 | /* First check for errors */ | 281 | /* First check for errors */ |
| 294 | if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_TXUNDERRUN|MCI_RXOVERRUN)) { | 282 | if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_TXUNDERRUN|MCI_RXOVERRUN)) { |
| 283 | u32 remain, success; | ||
| 284 | |||
| 285 | /* Calculate how far we are into the transfer */ | ||
| 286 | remain = readl(host->base + MMCIDATACNT) << 2; | ||
| 287 | success = data->blksz * data->blocks - remain; | ||
| 288 | |||
| 295 | dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status); | 289 | dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status); |
| 296 | if (status & MCI_DATACRCFAIL) | 290 | if (status & MCI_DATACRCFAIL) { |
| 291 | /* Last block was not successful */ | ||
| 292 | host->data_xfered = ((success / data->blksz) - 1 * data->blksz); | ||
| 297 | data->error = -EILSEQ; | 293 | data->error = -EILSEQ; |
| 298 | else if (status & MCI_DATATIMEOUT) | 294 | } else if (status & MCI_DATATIMEOUT) { |
| 295 | host->data_xfered = success; | ||
| 299 | data->error = -ETIMEDOUT; | 296 | data->error = -ETIMEDOUT; |
| 300 | else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) | 297 | } else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) { |
| 298 | host->data_xfered = success; | ||
| 301 | data->error = -EIO; | 299 | data->error = -EIO; |
| 302 | 300 | } | |
| 303 | /* Force-complete the transaction */ | ||
| 304 | host->blockend = true; | ||
| 305 | host->dataend = true; | ||
| 306 | 301 | ||
| 307 | /* | 302 | /* |
| 308 | * We hit an error condition. Ensure that any data | 303 | * We hit an error condition. Ensure that any data |
| @@ -321,61 +316,14 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data, | |||
| 321 | } | 316 | } |
| 322 | } | 317 | } |
| 323 | 318 | ||
| 324 | /* | 319 | if (status & MCI_DATABLOCKEND) |
| 325 | * On ARM variants in PIO mode, MCI_DATABLOCKEND | 320 | dev_err(mmc_dev(host->mmc), "stray MCI_DATABLOCKEND interrupt\n"); |
| 326 | * is always sent first, and we increase the | ||
| 327 | * transfered number of bytes for that IRQ. Then | ||
| 328 | * MCI_DATAEND follows and we conclude the transaction. | ||
| 329 | * | ||
| 330 | * On the Ux500 single-IRQ variant MCI_DATABLOCKEND | ||
| 331 | * doesn't seem to immediately clear from the status, | ||
| 332 | * so we can't use it keep count when only one irq is | ||
| 333 | * used because the irq will hit for other reasons, and | ||
| 334 | * then the flag is still up. So we use the MCI_DATAEND | ||
| 335 | * IRQ at the end of the entire transfer because | ||
| 336 | * MCI_DATABLOCKEND is broken. | ||
| 337 | * | ||
| 338 | * In the U300, the IRQs can arrive out-of-order, | ||
| 339 | * e.g. MCI_DATABLOCKEND sometimes arrives after MCI_DATAEND, | ||
| 340 | * so for this case we use the flags "blockend" and | ||
| 341 | * "dataend" to make sure both IRQs have arrived before | ||
| 342 | * concluding the transaction. (This does not apply | ||
| 343 | * to the Ux500 which doesn't fire MCI_DATABLOCKEND | ||
| 344 | * at all.) In DMA mode it suffers from the same problem | ||
| 345 | * as the Ux500. | ||
| 346 | */ | ||
| 347 | if (status & MCI_DATABLOCKEND) { | ||
| 348 | /* | ||
| 349 | * Just being a little over-cautious, we do not | ||
| 350 | * use this progressive update if the hardware blockend | ||
| 351 | * flag is unreliable: since it can stay high between | ||
| 352 | * IRQs it will corrupt the transfer counter. | ||
| 353 | */ | ||
| 354 | if (!variant->broken_blockend) | ||
| 355 | host->data_xfered += data->blksz; | ||
| 356 | host->blockend = true; | ||
| 357 | } | ||
| 358 | |||
| 359 | if (status & MCI_DATAEND) | ||
| 360 | host->dataend = true; | ||
| 361 | 321 | ||
| 362 | /* | 322 | if (status & MCI_DATAEND) { |
| 363 | * On variants with broken blockend we shall only wait for dataend, | ||
| 364 | * on others we must sync with the blockend signal since they can | ||
| 365 | * appear out-of-order. | ||
| 366 | */ | ||
| 367 | if (host->dataend && (host->blockend || variant->broken_blockend)) { | ||
| 368 | mmci_stop_data(host); | 323 | mmci_stop_data(host); |
| 369 | 324 | ||
| 370 | /* Reset these flags */ | 325 | if (!data->error) |
| 371 | host->blockend = false; | 326 | /* The error clause is handled above, success! */ |
| 372 | host->dataend = false; | ||
| 373 | |||
| 374 | /* | ||
| 375 | * Variants with broken blockend flags need to handle the | ||
| 376 | * end of the entire transfer here. | ||
| 377 | */ | ||
| 378 | if (variant->broken_blockend && !data->error) | ||
| 379 | host->data_xfered += data->blksz * data->blocks; | 327 | host->data_xfered += data->blksz * data->blocks; |
| 380 | 328 | ||
| 381 | if (!data->stop) { | 329 | if (!data->stop) { |
| @@ -394,15 +342,15 @@ mmci_cmd_irq(struct mmci_host *host, struct mmc_command *cmd, | |||
| 394 | 342 | ||
| 395 | host->cmd = NULL; | 343 | host->cmd = NULL; |
| 396 | 344 | ||
| 397 | cmd->resp[0] = readl(base + MMCIRESPONSE0); | ||
| 398 | cmd->resp[1] = readl(base + MMCIRESPONSE1); | ||
| 399 | cmd->resp[2] = readl(base + MMCIRESPONSE2); | ||
| 400 | cmd->resp[3] = readl(base + MMCIRESPONSE3); | ||
| 401 | |||
| 402 | if (status & MCI_CMDTIMEOUT) { | 345 | if (status & MCI_CMDTIMEOUT) { |
| 403 | cmd->error = -ETIMEDOUT; | 346 | cmd->error = -ETIMEDOUT; |
| 404 | } else if (status & MCI_CMDCRCFAIL && cmd->flags & MMC_RSP_CRC) { | 347 | } else if (status & MCI_CMDCRCFAIL && cmd->flags & MMC_RSP_CRC) { |
| 405 | 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); | ||
| 406 | } | 354 | } |
| 407 | 355 | ||
| 408 | if (!cmd->data || cmd->error) { | 356 | if (!cmd->data || cmd->error) { |
| @@ -770,7 +718,6 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) | |||
| 770 | struct variant_data *variant = id->data; | 718 | struct variant_data *variant = id->data; |
| 771 | struct mmci_host *host; | 719 | struct mmci_host *host; |
| 772 | struct mmc_host *mmc; | 720 | struct mmc_host *mmc; |
| 773 | unsigned int mask; | ||
| 774 | int ret; | 721 | int ret; |
| 775 | 722 | ||
| 776 | /* must have platform data */ | 723 | /* must have platform data */ |
| @@ -951,12 +898,7 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) | |||
| 951 | goto irq0_free; | 898 | goto irq0_free; |
| 952 | } | 899 | } |
| 953 | 900 | ||
| 954 | mask = MCI_IRQENABLE; | 901 | writel(MCI_IRQENABLE, host->base + MMCIMASK0); |
| 955 | /* Don't use the datablockend flag if it's broken */ | ||
| 956 | if (variant->broken_blockend) | ||
| 957 | mask &= ~MCI_DATABLOCKEND; | ||
| 958 | |||
| 959 | writel(mask, host->base + MMCIMASK0); | ||
| 960 | 902 | ||
| 961 | amba_set_drvdata(dev, mmc); | 903 | amba_set_drvdata(dev, mmc); |
| 962 | 904 | ||
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h index df06f01aac89..c1df7b82d36c 100644 --- a/drivers/mmc/host/mmci.h +++ b/drivers/mmc/host/mmci.h | |||
| @@ -137,7 +137,7 @@ | |||
| 137 | #define MCI_IRQENABLE \ | 137 | #define MCI_IRQENABLE \ |
| 138 | (MCI_CMDCRCFAILMASK|MCI_DATACRCFAILMASK|MCI_CMDTIMEOUTMASK| \ | 138 | (MCI_CMDCRCFAILMASK|MCI_DATACRCFAILMASK|MCI_CMDTIMEOUTMASK| \ |
| 139 | MCI_DATATIMEOUTMASK|MCI_TXUNDERRUNMASK|MCI_RXOVERRUNMASK| \ | 139 | MCI_DATATIMEOUTMASK|MCI_TXUNDERRUNMASK|MCI_RXOVERRUNMASK| \ |
| 140 | MCI_CMDRESPENDMASK|MCI_CMDSENTMASK|MCI_DATABLOCKENDMASK) | 140 | MCI_CMDRESPENDMASK|MCI_CMDSENTMASK) |
| 141 | 141 | ||
| 142 | /* These interrupts are directed to IRQ1 when two IRQ lines are available */ | 142 | /* These interrupts are directed to IRQ1 when two IRQ lines are available */ |
| 143 | #define MCI_IRQ1MASK \ | 143 | #define MCI_IRQ1MASK \ |
| @@ -177,9 +177,6 @@ struct mmci_host { | |||
| 177 | struct timer_list timer; | 177 | struct timer_list timer; |
| 178 | unsigned int oldstat; | 178 | unsigned int oldstat; |
| 179 | 179 | ||
| 180 | bool blockend; | ||
| 181 | bool dataend; | ||
| 182 | |||
| 183 | /* pio stuff */ | 180 | /* pio stuff */ |
| 184 | struct sg_mapping_iter sg_miter; | 181 | struct sg_mapping_iter sg_miter; |
| 185 | unsigned int size; | 182 | unsigned int size; |
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index 17203586305c..5309ab95aada 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 f8f65df9b017..f08f944ac53c 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/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index f49e49dc5928..5ebe280225d6 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c | |||
| @@ -672,33 +672,7 @@ static int io_init(struct ubi_device *ubi) | |||
| 672 | ubi->nor_flash = 1; | 672 | ubi->nor_flash = 1; |
| 673 | } | 673 | } |
| 674 | 674 | ||
| 675 | /* | 675 | ubi->min_io_size = ubi->mtd->writesize; |
| 676 | * Set UBI min. I/O size (@ubi->min_io_size). We use @mtd->writebufsize | ||
| 677 | * for these purposes, not @mtd->writesize. At the moment this does not | ||
| 678 | * matter for NAND, because currently @mtd->writebufsize is equivalent to | ||
| 679 | * @mtd->writesize for all NANDs. However, some CFI NOR flashes may | ||
| 680 | * have @mtd->writebufsize which is multiple of @mtd->writesize. | ||
| 681 | * | ||
| 682 | * The reason we use @mtd->writebufsize for @ubi->min_io_size is that | ||
| 683 | * UBI and UBIFS recovery algorithms rely on the fact that if there was | ||
| 684 | * an unclean power cut, then we can find offset of the last corrupted | ||
| 685 | * node, align the offset to @ubi->min_io_size, read the rest of the | ||
| 686 | * eraseblock starting from this offset, and check whether there are | ||
| 687 | * only 0xFF bytes. If yes, then we are probably dealing with a | ||
| 688 | * corruption caused by a power cut, if not, then this is probably some | ||
| 689 | * severe corruption. | ||
| 690 | * | ||
| 691 | * Thus, we have to use the maximum write unit size of the flash, which | ||
| 692 | * is @mtd->writebufsize, because @mtd->writesize is the minimum write | ||
| 693 | * size, not the maximum. | ||
| 694 | */ | ||
| 695 | if (ubi->mtd->type == MTD_NANDFLASH) | ||
| 696 | ubi_assert(ubi->mtd->writebufsize == ubi->mtd->writesize); | ||
| 697 | else if (ubi->mtd->type == MTD_NORFLASH) | ||
| 698 | ubi_assert(ubi->mtd->writebufsize % ubi->mtd->writesize == 0); | ||
| 699 | |||
| 700 | ubi->min_io_size = ubi->mtd->writebufsize; | ||
| 701 | |||
| 702 | ubi->hdrs_min_io_size = ubi->mtd->writesize >> ubi->mtd->subpage_sft; | 676 | ubi->hdrs_min_io_size = ubi->mtd->writesize >> ubi->mtd->subpage_sft; |
| 703 | 677 | ||
| 704 | /* | 678 | /* |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index df99edf3464a..0ba59d5aeb7f 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 5488a2e82fe9..f459fb2f9add 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 171782e2bb39..1024ae158227 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 f4e638c65129..5c6fba802f2b 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 b1025b85acf1..163e0b06eaa5 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 d5a9db60ade9..986195eaa57c 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 07ca159ba3f9..53c82a71778e 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 7ef83d06f7ed..2532b9631538 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 000000000000..92bd6bdde5e3 --- /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 000000000000..c5e5016c742e --- /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 000000000000..7ec9f4db3d52 --- /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 000000000000..300fe75dd1a7 --- /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 000000000000..b520784fb197 --- /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 000000000000..5157e15e96eb --- /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 000000000000..ebbf69815623 --- /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 263a2944566f..7ff170cbc7dc 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 059c1eec8c3f..ec35d458102c 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 d7355306a738..1bf12339441b 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 7841a8f69998..93b32d366611 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 d62c8d937c82..f528243e1a4f 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 5e98643a4a21..7dc84971f26f 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 1afb8bb85756..9f01e50d5cda 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 5a3dfec45e96..ea9fde670646 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 f90a6ca94a76..c79c97be6cd4 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 332d1feb5c18..33a37edbaf79 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 3f1e5f1bf847..91a9f5253469 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 14ceb4df72f6..27b5a3eec9dc 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 0b4e8590cbb7..029be3c6c030 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 0fa36aa6701a..1758d4463247 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 a2d9d1e59260..a848e02e6be3 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/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c index 1752ef006d26..a91d510a798b 100644 --- a/drivers/platform/x86/intel_scu_ipc.c +++ b/drivers/platform/x86/intel_scu_ipc.c | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | #include <linux/sfi.h> | 26 | #include <linux/sfi.h> |
| 27 | #include <asm/mrst.h> | 27 | #include <asm/mrst.h> |
| 28 | #include <asm/intel_scu_ipc.h> | 28 | #include <asm/intel_scu_ipc.h> |
| 29 | #include <asm/mrst.h> | ||
| 30 | 29 | ||
| 31 | /* IPC defines the following message types */ | 30 | /* IPC defines the following message types */ |
| 32 | #define IPCMSG_WATCHDOG_TIMER 0xF8 /* Set Kernel Watchdog Threshold */ | 31 | #define IPCMSG_WATCHDOG_TIMER 0xF8 /* Set Kernel Watchdog Threshold */ |
| @@ -161,7 +160,7 @@ static int pwr_reg_rdwr(u16 *addr, u8 *data, u32 count, u32 op, u32 id) | |||
| 161 | { | 160 | { |
| 162 | int i, nc, bytes, d; | 161 | int i, nc, bytes, d; |
| 163 | u32 offset = 0; | 162 | u32 offset = 0; |
| 164 | u32 err = 0; | 163 | int err; |
| 165 | u8 cbuf[IPC_WWBUF_SIZE] = { }; | 164 | u8 cbuf[IPC_WWBUF_SIZE] = { }; |
| 166 | u32 *wbuf = (u32 *)&cbuf; | 165 | u32 *wbuf = (u32 *)&cbuf; |
| 167 | 166 | ||
| @@ -404,7 +403,7 @@ EXPORT_SYMBOL(intel_scu_ipc_update_register); | |||
| 404 | */ | 403 | */ |
| 405 | int intel_scu_ipc_simple_command(int cmd, int sub) | 404 | int intel_scu_ipc_simple_command(int cmd, int sub) |
| 406 | { | 405 | { |
| 407 | u32 err = 0; | 406 | int err; |
| 408 | 407 | ||
| 409 | mutex_lock(&ipclock); | 408 | mutex_lock(&ipclock); |
| 410 | if (ipcdev.pdev == NULL) { | 409 | if (ipcdev.pdev == NULL) { |
| @@ -434,8 +433,7 @@ EXPORT_SYMBOL(intel_scu_ipc_simple_command); | |||
| 434 | int intel_scu_ipc_command(int cmd, int sub, u32 *in, int inlen, | 433 | int intel_scu_ipc_command(int cmd, int sub, u32 *in, int inlen, |
| 435 | u32 *out, int outlen) | 434 | u32 *out, int outlen) |
| 436 | { | 435 | { |
| 437 | u32 err = 0; | 436 | int i, err; |
| 438 | int i = 0; | ||
| 439 | 437 | ||
| 440 | mutex_lock(&ipclock); | 438 | mutex_lock(&ipclock); |
| 441 | if (ipcdev.pdev == NULL) { | 439 | if (ipcdev.pdev == NULL) { |
diff --git a/drivers/platform/x86/intel_scu_ipcutil.c b/drivers/platform/x86/intel_scu_ipcutil.c index ba3231d0819e..b93a03259c16 100644 --- a/drivers/platform/x86/intel_scu_ipcutil.c +++ b/drivers/platform/x86/intel_scu_ipcutil.c | |||
| @@ -128,6 +128,6 @@ static void __exit ipc_module_exit(void) | |||
| 128 | module_init(ipc_module_init); | 128 | module_init(ipc_module_init); |
| 129 | module_exit(ipc_module_exit); | 129 | module_exit(ipc_module_exit); |
| 130 | 130 | ||
| 131 | MODULE_LICENSE("GPL V2"); | 131 | MODULE_LICENSE("GPL v2"); |
| 132 | MODULE_DESCRIPTION("Utility driver for intel scu ipc"); | 132 | MODULE_DESCRIPTION("Utility driver for intel scu ipc"); |
| 133 | MODULE_AUTHOR("Sreedhara <sreedhara.ds@intel.com>"); | 133 | MODULE_AUTHOR("Sreedhara <sreedhara.ds@intel.com>"); |
diff --git a/drivers/pps/clients/pps-ktimer.c b/drivers/pps/clients/pps-ktimer.c index 2728469d3884..82583b0ff82d 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 32221efd9ca9..c571d6dd8f61 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 5c32f8dacf56..b93af3ebb5ba 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/sh/intc/chip.c b/drivers/sh/intc/chip.c index de885a0f917a..f33e2dd97934 100644 --- a/drivers/sh/intc/chip.c +++ b/drivers/sh/intc/chip.c | |||
| @@ -173,7 +173,8 @@ int intc_set_priority(unsigned int irq, unsigned int prio) | |||
| 173 | return 0; | 173 | return 0; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | #define VALID(x) (x | 0x80) | 176 | #define SENSE_VALID_FLAG 0x80 |
| 177 | #define VALID(x) (x | SENSE_VALID_FLAG) | ||
| 177 | 178 | ||
| 178 | static unsigned char intc_irq_sense_table[IRQ_TYPE_SENSE_MASK + 1] = { | 179 | static unsigned char intc_irq_sense_table[IRQ_TYPE_SENSE_MASK + 1] = { |
| 179 | [IRQ_TYPE_EDGE_FALLING] = VALID(0), | 180 | [IRQ_TYPE_EDGE_FALLING] = VALID(0), |
| @@ -201,7 +202,8 @@ static int intc_set_type(struct irq_data *data, unsigned int type) | |||
| 201 | ihp = intc_find_irq(d->sense, d->nr_sense, irq); | 202 | ihp = intc_find_irq(d->sense, d->nr_sense, irq); |
| 202 | if (ihp) { | 203 | if (ihp) { |
| 203 | addr = INTC_REG(d, _INTC_ADDR_E(ihp->handle), 0); | 204 | addr = INTC_REG(d, _INTC_ADDR_E(ihp->handle), 0); |
| 204 | intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle, value); | 205 | intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle, |
| 206 | value & ~SENSE_VALID_FLAG); | ||
| 205 | } | 207 | } |
| 206 | 208 | ||
| 207 | return 0; | 209 | return 0; |
diff --git a/drivers/staging/msm/msm_fb.c b/drivers/staging/msm/msm_fb.c index 23fa049b51f2..a2f29d464051 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 9f26dc9408bb..56a283d1a74d 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 0bc113c44d39..d007e4a12c14 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/staging/vme/bridges/Module.symvers b/drivers/staging/vme/bridges/Module.symvers deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/drivers/staging/vme/bridges/Module.symvers +++ /dev/null | |||
diff --git a/drivers/tty/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-duart.c index a2f2b3254499..602d9845c52f 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 c556ed9db13d..8e0dd254eb11 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 464d09d97873..6158eae0f64a 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 ebae344ce910..c956ed6c83a3 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 eab3a1ff99e4..a672ed192d33 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 76407eca9ab0..b230bd3f056f 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 6b68a0fb4611..1235ebda6e1c 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 d583bea608fd..391ac939f011 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 dd9de2e80580..4cb6a576c567 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 767ab4fb1a05..94e293fce1d2 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 c4e17642d9c5..92bda5848516 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/bf537-lq035.c b/drivers/video/bf537-lq035.c index 18c507874ff1..47c21fb2c82f 100644 --- a/drivers/video/bf537-lq035.c +++ b/drivers/video/bf537-lq035.c | |||
| @@ -696,6 +696,7 @@ static int __devinit bfin_lq035_probe(struct platform_device *pdev) | |||
| 696 | { | 696 | { |
| 697 | struct backlight_properties props; | 697 | struct backlight_properties props; |
| 698 | dma_addr_t dma_handle; | 698 | dma_addr_t dma_handle; |
| 699 | int ret; | ||
| 699 | 700 | ||
| 700 | if (request_dma(CH_PPI, KBUILD_MODNAME)) { | 701 | if (request_dma(CH_PPI, KBUILD_MODNAME)) { |
| 701 | pr_err("couldn't request PPI DMA\n"); | 702 | pr_err("couldn't request PPI DMA\n"); |
| @@ -704,17 +705,16 @@ static int __devinit bfin_lq035_probe(struct platform_device *pdev) | |||
| 704 | 705 | ||
| 705 | if (request_ports()) { | 706 | if (request_ports()) { |
| 706 | pr_err("couldn't request gpio port\n"); | 707 | pr_err("couldn't request gpio port\n"); |
| 707 | free_dma(CH_PPI); | 708 | ret = -EFAULT; |
| 708 | return -EFAULT; | 709 | goto out_ports; |
| 709 | } | 710 | } |
| 710 | 711 | ||
| 711 | fb_buffer = dma_alloc_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, | 712 | fb_buffer = dma_alloc_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, |
| 712 | &dma_handle, GFP_KERNEL); | 713 | &dma_handle, GFP_KERNEL); |
| 713 | if (fb_buffer == NULL) { | 714 | if (fb_buffer == NULL) { |
| 714 | pr_err("couldn't allocate dma buffer\n"); | 715 | pr_err("couldn't allocate dma buffer\n"); |
| 715 | free_dma(CH_PPI); | 716 | ret = -ENOMEM; |
| 716 | free_ports(); | 717 | goto out_dma_coherent; |
| 717 | return -ENOMEM; | ||
| 718 | } | 718 | } |
| 719 | 719 | ||
| 720 | if (L1_DATA_A_LENGTH) | 720 | if (L1_DATA_A_LENGTH) |
| @@ -725,10 +725,8 @@ static int __devinit bfin_lq035_probe(struct platform_device *pdev) | |||
| 725 | 725 | ||
| 726 | if (dma_desc_table == NULL) { | 726 | if (dma_desc_table == NULL) { |
| 727 | pr_err("couldn't allocate dma descriptor\n"); | 727 | pr_err("couldn't allocate dma descriptor\n"); |
| 728 | free_dma(CH_PPI); | 728 | ret = -ENOMEM; |
| 729 | free_ports(); | 729 | goto out_table; |
| 730 | dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); | ||
| 731 | return -ENOMEM; | ||
| 732 | } | 730 | } |
| 733 | 731 | ||
| 734 | bfin_lq035_fb.screen_base = (void *)fb_buffer; | 732 | bfin_lq035_fb.screen_base = (void *)fb_buffer; |
| @@ -771,31 +769,21 @@ static int __devinit bfin_lq035_probe(struct platform_device *pdev) | |||
| 771 | bfin_lq035_fb.pseudo_palette = kzalloc(sizeof(u32) * 16, GFP_KERNEL); | 769 | bfin_lq035_fb.pseudo_palette = kzalloc(sizeof(u32) * 16, GFP_KERNEL); |
| 772 | if (bfin_lq035_fb.pseudo_palette == NULL) { | 770 | if (bfin_lq035_fb.pseudo_palette == NULL) { |
| 773 | pr_err("failed to allocate pseudo_palette\n"); | 771 | pr_err("failed to allocate pseudo_palette\n"); |
| 774 | free_dma(CH_PPI); | 772 | ret = -ENOMEM; |
| 775 | free_ports(); | 773 | goto out_palette; |
| 776 | dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); | ||
| 777 | return -ENOMEM; | ||
| 778 | } | 774 | } |
| 779 | 775 | ||
| 780 | if (fb_alloc_cmap(&bfin_lq035_fb.cmap, NBR_PALETTE, 0) < 0) { | 776 | if (fb_alloc_cmap(&bfin_lq035_fb.cmap, NBR_PALETTE, 0) < 0) { |
| 781 | pr_err("failed to allocate colormap (%d entries)\n", | 777 | pr_err("failed to allocate colormap (%d entries)\n", |
| 782 | NBR_PALETTE); | 778 | NBR_PALETTE); |
| 783 | free_dma(CH_PPI); | 779 | ret = -EFAULT; |
| 784 | free_ports(); | 780 | goto out_cmap; |
| 785 | dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); | ||
| 786 | kfree(bfin_lq035_fb.pseudo_palette); | ||
| 787 | return -EFAULT; | ||
| 788 | } | 781 | } |
| 789 | 782 | ||
| 790 | if (register_framebuffer(&bfin_lq035_fb) < 0) { | 783 | if (register_framebuffer(&bfin_lq035_fb) < 0) { |
| 791 | pr_err("unable to register framebuffer\n"); | 784 | pr_err("unable to register framebuffer\n"); |
| 792 | free_dma(CH_PPI); | 785 | ret = -EINVAL; |
| 793 | free_ports(); | 786 | goto out_reg; |
| 794 | dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); | ||
| 795 | fb_buffer = NULL; | ||
| 796 | kfree(bfin_lq035_fb.pseudo_palette); | ||
| 797 | fb_dealloc_cmap(&bfin_lq035_fb.cmap); | ||
| 798 | return -EINVAL; | ||
| 799 | } | 787 | } |
| 800 | 788 | ||
| 801 | i2c_add_driver(&ad5280_driver); | 789 | i2c_add_driver(&ad5280_driver); |
| @@ -807,11 +795,31 @@ static int __devinit bfin_lq035_probe(struct platform_device *pdev) | |||
| 807 | 795 | ||
| 808 | lcd_dev = lcd_device_register(KBUILD_MODNAME, &pdev->dev, NULL, | 796 | lcd_dev = lcd_device_register(KBUILD_MODNAME, &pdev->dev, NULL, |
| 809 | &bfin_lcd_ops); | 797 | &bfin_lcd_ops); |
| 798 | if (IS_ERR(lcd_dev)) { | ||
| 799 | pr_err("unable to register lcd\n"); | ||
| 800 | ret = PTR_ERR(lcd_dev); | ||
| 801 | goto out_lcd; | ||
| 802 | } | ||
| 810 | lcd_dev->props.max_contrast = 255, | 803 | lcd_dev->props.max_contrast = 255, |
| 811 | 804 | ||
| 812 | pr_info("initialized"); | 805 | pr_info("initialized"); |
| 813 | 806 | ||
| 814 | return 0; | 807 | return 0; |
| 808 | out_lcd: | ||
| 809 | unregister_framebuffer(&bfin_lq035_fb); | ||
| 810 | out_reg: | ||
| 811 | fb_dealloc_cmap(&bfin_lq035_fb.cmap); | ||
| 812 | out_cmap: | ||
| 813 | kfree(bfin_lq035_fb.pseudo_palette); | ||
| 814 | out_palette: | ||
| 815 | out_table: | ||
| 816 | dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); | ||
| 817 | fb_buffer = NULL; | ||
| 818 | out_dma_coherent: | ||
| 819 | free_ports(); | ||
| 820 | out_ports: | ||
| 821 | free_dma(CH_PPI); | ||
| 822 | return ret; | ||
| 815 | } | 823 | } |
| 816 | 824 | ||
| 817 | static int __devexit bfin_lq035_remove(struct platform_device *pdev) | 825 | static int __devexit bfin_lq035_remove(struct platform_device *pdev) |
diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c index d637e1f53172..cff742abdc5d 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 7ccc967831f0..9c092b8d64e6 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/console/vgacon.c b/drivers/video/console/vgacon.c index c97491b8b39b..915fd74da7a2 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
| @@ -202,11 +202,7 @@ static void vgacon_scrollback_init(int pitch) | |||
| 202 | } | 202 | } |
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | /* | 205 | static void vgacon_scrollback_startup(void) |
| 206 | * Called only duing init so call of alloc_bootmen is ok. | ||
| 207 | * Marked __init_refok to silence modpost. | ||
| 208 | */ | ||
| 209 | static void __init_refok vgacon_scrollback_startup(void) | ||
| 210 | { | 206 | { |
| 211 | vgacon_scrollback = kcalloc(CONFIG_VGACON_SOFT_SCROLLBACK_SIZE, 1024, GFP_NOWAIT); | 207 | vgacon_scrollback = kcalloc(CONFIG_VGACON_SOFT_SCROLLBACK_SIZE, 1024, GFP_NOWAIT); |
| 212 | vgacon_scrollback_init(vga_video_num_columns * 2); | 208 | vgacon_scrollback_init(vga_video_num_columns * 2); |
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c index c265aed09e04..8d61ef96eedd 100644 --- a/drivers/video/da8xx-fb.c +++ b/drivers/video/da8xx-fb.c | |||
| @@ -1092,9 +1092,10 @@ static int __init fb_probe(struct platform_device *device) | |||
| 1092 | 1092 | ||
| 1093 | irq_freq: | 1093 | irq_freq: |
| 1094 | #ifdef CONFIG_CPU_FREQ | 1094 | #ifdef CONFIG_CPU_FREQ |
| 1095 | lcd_da8xx_cpufreq_deregister(par); | ||
| 1096 | #endif | ||
| 1095 | err_cpu_freq: | 1097 | err_cpu_freq: |
| 1096 | unregister_framebuffer(da8xx_fb_info); | 1098 | unregister_framebuffer(da8xx_fb_info); |
| 1097 | #endif | ||
| 1098 | 1099 | ||
| 1099 | err_dealloc_cmap: | 1100 | err_dealloc_cmap: |
| 1100 | fb_dealloc_cmap(&da8xx_fb_info->cmap); | 1101 | fb_dealloc_cmap(&da8xx_fb_info->cmap); |
| @@ -1130,14 +1131,14 @@ static int fb_suspend(struct platform_device *dev, pm_message_t state) | |||
| 1130 | struct fb_info *info = platform_get_drvdata(dev); | 1131 | struct fb_info *info = platform_get_drvdata(dev); |
| 1131 | struct da8xx_fb_par *par = info->par; | 1132 | struct da8xx_fb_par *par = info->par; |
| 1132 | 1133 | ||
| 1133 | acquire_console_sem(); | 1134 | console_lock(); |
| 1134 | if (par->panel_power_ctrl) | 1135 | if (par->panel_power_ctrl) |
| 1135 | par->panel_power_ctrl(0); | 1136 | par->panel_power_ctrl(0); |
| 1136 | 1137 | ||
| 1137 | fb_set_suspend(info, 1); | 1138 | fb_set_suspend(info, 1); |
| 1138 | lcd_disable_raster(); | 1139 | lcd_disable_raster(); |
| 1139 | clk_disable(par->lcdc_clk); | 1140 | clk_disable(par->lcdc_clk); |
| 1140 | release_console_sem(); | 1141 | console_unlock(); |
| 1141 | 1142 | ||
| 1142 | return 0; | 1143 | return 0; |
| 1143 | } | 1144 | } |
| @@ -1146,14 +1147,14 @@ static int fb_resume(struct platform_device *dev) | |||
| 1146 | struct fb_info *info = platform_get_drvdata(dev); | 1147 | struct fb_info *info = platform_get_drvdata(dev); |
| 1147 | struct da8xx_fb_par *par = info->par; | 1148 | struct da8xx_fb_par *par = info->par; |
| 1148 | 1149 | ||
| 1149 | acquire_console_sem(); | 1150 | console_lock(); |
| 1150 | if (par->panel_power_ctrl) | 1151 | if (par->panel_power_ctrl) |
| 1151 | par->panel_power_ctrl(1); | 1152 | par->panel_power_ctrl(1); |
| 1152 | 1153 | ||
| 1153 | clk_enable(par->lcdc_clk); | 1154 | clk_enable(par->lcdc_clk); |
| 1154 | lcd_enable_raster(); | 1155 | lcd_enable_raster(); |
| 1155 | fb_set_suspend(info, 0); | 1156 | fb_set_suspend(info, 0); |
| 1156 | release_console_sem(); | 1157 | console_unlock(); |
| 1157 | 1158 | ||
| 1158 | return 0; | 1159 | return 0; |
| 1159 | } | 1160 | } |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 4ac1201ad6c2..e2bf95370e40 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 0a08f1341227..f4a32779168b 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 70b1d9d51c96..b4f19db9bb54 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 39bdbedf43b4..416851ca8754 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 5743ea25e818..318f6fb895b2 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 670ecaa0385a..de366937c933 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 cb013919e9ce..7e3a490e8d76 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/nuc900fb.c b/drivers/video/nuc900fb.c index 62498bd662fc..f838d9e277f0 100644 --- a/drivers/video/nuc900fb.c +++ b/drivers/video/nuc900fb.c | |||
| @@ -696,6 +696,8 @@ static int nuc900fb_remove(struct platform_device *pdev) | |||
| 696 | nuc900fb_stop_lcd(fbinfo); | 696 | nuc900fb_stop_lcd(fbinfo); |
| 697 | msleep(1); | 697 | msleep(1); |
| 698 | 698 | ||
| 699 | unregister_framebuffer(fbinfo); | ||
| 700 | nuc900fb_cpufreq_deregister(fbi); | ||
| 699 | nuc900fb_unmap_video_memory(fbinfo); | 701 | nuc900fb_unmap_video_memory(fbinfo); |
| 700 | 702 | ||
| 701 | iounmap(fbi->io); | 703 | iounmap(fbi->io); |
| @@ -723,7 +725,7 @@ static int nuc900fb_suspend(struct platform_device *dev, pm_message_t state) | |||
| 723 | struct fb_info *fbinfo = platform_get_drvdata(dev); | 725 | struct fb_info *fbinfo = platform_get_drvdata(dev); |
| 724 | struct nuc900fb_info *info = fbinfo->par; | 726 | struct nuc900fb_info *info = fbinfo->par; |
| 725 | 727 | ||
| 726 | nuc900fb_stop_lcd(); | 728 | nuc900fb_stop_lcd(fbinfo); |
| 727 | msleep(1); | 729 | msleep(1); |
| 728 | clk_disable(info->clk); | 730 | clk_disable(info->clk); |
| 729 | return 0; | 731 | return 0; |
| @@ -740,7 +742,7 @@ static int nuc900fb_resume(struct platform_device *dev) | |||
| 740 | msleep(1); | 742 | msleep(1); |
| 741 | 743 | ||
| 742 | nuc900fb_init_registers(fbinfo); | 744 | nuc900fb_init_registers(fbinfo); |
| 743 | nuc900fb_activate_var(bfinfo); | 745 | nuc900fb_activate_var(fbinfo); |
| 744 | 746 | ||
| 745 | return 0; | 747 | return 0; |
| 746 | } | 748 | } |
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c index efe10ff86d63..081dc4745274 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 9c0144ee7ae5..65560a1a0439 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/pxa168fb.c b/drivers/video/pxa168fb.c index cea6403ae71c..35f61dd0cb3a 100644 --- a/drivers/video/pxa168fb.c +++ b/drivers/video/pxa168fb.c | |||
| @@ -701,16 +701,12 @@ static int __devinit pxa168fb_probe(struct platform_device *pdev) | |||
| 701 | */ | 701 | */ |
| 702 | pxa168fb_init_mode(info, mi); | 702 | pxa168fb_init_mode(info, mi); |
| 703 | 703 | ||
| 704 | ret = pxa168fb_check_var(&info->var, info); | ||
| 705 | if (ret) | ||
| 706 | goto failed_free_fbmem; | ||
| 707 | |||
| 708 | /* | 704 | /* |
| 709 | * Fill in sane defaults. | 705 | * Fill in sane defaults. |
| 710 | */ | 706 | */ |
| 711 | ret = pxa168fb_check_var(&info->var, info); | 707 | ret = pxa168fb_check_var(&info->var, info); |
| 712 | if (ret) | 708 | if (ret) |
| 713 | goto failed; | 709 | goto failed_free_fbmem; |
| 714 | 710 | ||
| 715 | /* | 711 | /* |
| 716 | * enable controller clock | 712 | * enable controller clock |
diff --git a/drivers/video/pxa3xx-gcu.c b/drivers/video/pxa3xx-gcu.c index b81168df253d..cf4beb9dc9bb 100644 --- a/drivers/video/pxa3xx-gcu.c +++ b/drivers/video/pxa3xx-gcu.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * pxa3xx-gc.c - Linux kernel module for PXA3xx graphics controllers | 2 | * pxa3xx-gcu.c - Linux kernel module for PXA3xx graphics controllers |
| 3 | * | 3 | * |
| 4 | * This driver needs a DirectFB counterpart in user space, communication | 4 | * This driver needs a DirectFB counterpart in user space, communication |
| 5 | * is handled via mmap()ed memory areas and an ioctl. | 5 | * is handled via mmap()ed memory areas and an ioctl. |
| @@ -421,7 +421,7 @@ pxa3xx_gcu_misc_write(struct file *filp, const char *buff, | |||
| 421 | buffer->next = priv->free; | 421 | buffer->next = priv->free; |
| 422 | priv->free = buffer; | 422 | priv->free = buffer; |
| 423 | spin_unlock_irqrestore(&priv->spinlock, flags); | 423 | spin_unlock_irqrestore(&priv->spinlock, flags); |
| 424 | return ret; | 424 | return -EFAULT; |
| 425 | } | 425 | } |
| 426 | 426 | ||
| 427 | buffer->length = words; | 427 | buffer->length = words; |
diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c index dce8c97b4333..75738a928610 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 842d157e1025..487911e2926c 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 74d9f546a2e8..2b9e56a6bde4 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 bd4840a8a6b7..bf12e53aed5c 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 b7dc1800efa9..bcb44a594ebc 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 6913fe168c25..dfef88c803d4 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 289edd519527..4e66349e4366 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 85d76ec4c63e..a2965ab92cfb 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 3e6934d4bea8..a20218c2fda8 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/ceph/caps.c b/fs/ceph/caps.c index 60d27bc9eb83..6b61ded701e1 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
| @@ -1560,9 +1560,10 @@ retry_locked: | |||
| 1560 | /* NOTE: no side-effects allowed, until we take s_mutex */ | 1560 | /* NOTE: no side-effects allowed, until we take s_mutex */ |
| 1561 | 1561 | ||
| 1562 | revoking = cap->implemented & ~cap->issued; | 1562 | revoking = cap->implemented & ~cap->issued; |
| 1563 | if (revoking) | 1563 | dout(" mds%d cap %p issued %s implemented %s revoking %s\n", |
| 1564 | dout(" mds%d revoking %s\n", cap->mds, | 1564 | cap->mds, cap, ceph_cap_string(cap->issued), |
| 1565 | ceph_cap_string(revoking)); | 1565 | ceph_cap_string(cap->implemented), |
| 1566 | ceph_cap_string(revoking)); | ||
| 1566 | 1567 | ||
| 1567 | if (cap == ci->i_auth_cap && | 1568 | if (cap == ci->i_auth_cap && |
| 1568 | (cap->issued & CEPH_CAP_FILE_WR)) { | 1569 | (cap->issued & CEPH_CAP_FILE_WR)) { |
| @@ -1658,6 +1659,8 @@ ack: | |||
| 1658 | 1659 | ||
| 1659 | if (cap == ci->i_auth_cap && ci->i_dirty_caps) | 1660 | if (cap == ci->i_auth_cap && ci->i_dirty_caps) |
| 1660 | flushing = __mark_caps_flushing(inode, session); | 1661 | flushing = __mark_caps_flushing(inode, session); |
| 1662 | else | ||
| 1663 | flushing = 0; | ||
| 1661 | 1664 | ||
| 1662 | mds = cap->mds; /* remember mds, so we don't repeat */ | 1665 | mds = cap->mds; /* remember mds, so we don't repeat */ |
| 1663 | sent++; | 1666 | sent++; |
| @@ -1940,6 +1943,35 @@ void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc, | |||
| 1940 | } | 1943 | } |
| 1941 | } | 1944 | } |
| 1942 | 1945 | ||
| 1946 | static void kick_flushing_inode_caps(struct ceph_mds_client *mdsc, | ||
| 1947 | struct ceph_mds_session *session, | ||
| 1948 | struct inode *inode) | ||
| 1949 | { | ||
| 1950 | struct ceph_inode_info *ci = ceph_inode(inode); | ||
| 1951 | struct ceph_cap *cap; | ||
| 1952 | int delayed = 0; | ||
| 1953 | |||
| 1954 | spin_lock(&inode->i_lock); | ||
| 1955 | cap = ci->i_auth_cap; | ||
| 1956 | dout("kick_flushing_inode_caps %p flushing %s flush_seq %lld\n", inode, | ||
| 1957 | ceph_cap_string(ci->i_flushing_caps), ci->i_cap_flush_seq); | ||
| 1958 | __ceph_flush_snaps(ci, &session, 1); | ||
| 1959 | if (ci->i_flushing_caps) { | ||
| 1960 | delayed = __send_cap(mdsc, cap, CEPH_CAP_OP_FLUSH, | ||
| 1961 | __ceph_caps_used(ci), | ||
| 1962 | __ceph_caps_wanted(ci), | ||
| 1963 | cap->issued | cap->implemented, | ||
| 1964 | ci->i_flushing_caps, NULL); | ||
| 1965 | if (delayed) { | ||
| 1966 | spin_lock(&inode->i_lock); | ||
| 1967 | __cap_delay_requeue(mdsc, ci); | ||
| 1968 | spin_unlock(&inode->i_lock); | ||
| 1969 | } | ||
| 1970 | } else { | ||
| 1971 | spin_unlock(&inode->i_lock); | ||
| 1972 | } | ||
| 1973 | } | ||
| 1974 | |||
| 1943 | 1975 | ||
| 1944 | /* | 1976 | /* |
| 1945 | * Take references to capabilities we hold, so that we don't release | 1977 | * Take references to capabilities we hold, so that we don't release |
| @@ -2687,7 +2719,7 @@ static void handle_cap_import(struct ceph_mds_client *mdsc, | |||
| 2687 | ceph_add_cap(inode, session, cap_id, -1, | 2719 | ceph_add_cap(inode, session, cap_id, -1, |
| 2688 | issued, wanted, seq, mseq, realmino, CEPH_CAP_FLAG_AUTH, | 2720 | issued, wanted, seq, mseq, realmino, CEPH_CAP_FLAG_AUTH, |
| 2689 | NULL /* no caps context */); | 2721 | NULL /* no caps context */); |
| 2690 | try_flush_caps(inode, session, NULL); | 2722 | kick_flushing_inode_caps(mdsc, session, inode); |
| 2691 | up_read(&mdsc->snap_rwsem); | 2723 | up_read(&mdsc->snap_rwsem); |
| 2692 | 2724 | ||
| 2693 | /* make sure we re-request max_size, if necessary */ | 2725 | /* make sure we re-request max_size, if necessary */ |
| @@ -2785,8 +2817,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
| 2785 | case CEPH_CAP_OP_IMPORT: | 2817 | case CEPH_CAP_OP_IMPORT: |
| 2786 | handle_cap_import(mdsc, inode, h, session, | 2818 | handle_cap_import(mdsc, inode, h, session, |
| 2787 | snaptrace, snaptrace_len); | 2819 | snaptrace, snaptrace_len); |
| 2788 | ceph_check_caps(ceph_inode(inode), CHECK_CAPS_NODELAY, | 2820 | ceph_check_caps(ceph_inode(inode), 0, session); |
| 2789 | session); | ||
| 2790 | goto done_unlocked; | 2821 | goto done_unlocked; |
| 2791 | } | 2822 | } |
| 2792 | 2823 | ||
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index e835eff551e3..5625463aa479 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
| @@ -710,10 +710,6 @@ static int fill_inode(struct inode *inode, | |||
| 710 | ci->i_ceph_flags |= CEPH_I_COMPLETE; | 710 | ci->i_ceph_flags |= CEPH_I_COMPLETE; |
| 711 | ci->i_max_offset = 2; | 711 | ci->i_max_offset = 2; |
| 712 | } | 712 | } |
| 713 | |||
| 714 | /* it may be better to set st_size in getattr instead? */ | ||
| 715 | if (ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb), RBYTES)) | ||
| 716 | inode->i_size = ci->i_rbytes; | ||
| 717 | break; | 713 | break; |
| 718 | default: | 714 | default: |
| 719 | pr_err("fill_inode %llx.%llx BAD mode 0%o\n", | 715 | pr_err("fill_inode %llx.%llx BAD mode 0%o\n", |
| @@ -1819,7 +1815,11 @@ int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
| 1819 | else | 1815 | else |
| 1820 | stat->dev = 0; | 1816 | stat->dev = 0; |
| 1821 | if (S_ISDIR(inode->i_mode)) { | 1817 | if (S_ISDIR(inode->i_mode)) { |
| 1822 | stat->size = ci->i_rbytes; | 1818 | if (ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb), |
| 1819 | RBYTES)) | ||
| 1820 | stat->size = ci->i_rbytes; | ||
| 1821 | else | ||
| 1822 | stat->size = ci->i_files + ci->i_subdirs; | ||
| 1823 | stat->blocks = 0; | 1823 | stat->blocks = 0; |
| 1824 | stat->blksize = 65536; | 1824 | stat->blksize = 65536; |
| 1825 | } | 1825 | } |
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 1e30d194a8e3..a1ee8fa3a8e7 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
| @@ -693,9 +693,11 @@ static int __choose_mds(struct ceph_mds_client *mdsc, | |||
| 693 | dout("choose_mds %p %llx.%llx " | 693 | dout("choose_mds %p %llx.%llx " |
| 694 | "frag %u mds%d (%d/%d)\n", | 694 | "frag %u mds%d (%d/%d)\n", |
| 695 | inode, ceph_vinop(inode), | 695 | inode, ceph_vinop(inode), |
| 696 | frag.frag, frag.mds, | 696 | frag.frag, mds, |
| 697 | (int)r, frag.ndist); | 697 | (int)r, frag.ndist); |
| 698 | return mds; | 698 | if (ceph_mdsmap_get_state(mdsc->mdsmap, mds) >= |
| 699 | CEPH_MDS_STATE_ACTIVE) | ||
| 700 | return mds; | ||
| 699 | } | 701 | } |
| 700 | 702 | ||
| 701 | /* since this file/dir wasn't known to be | 703 | /* since this file/dir wasn't known to be |
| @@ -708,7 +710,9 @@ static int __choose_mds(struct ceph_mds_client *mdsc, | |||
| 708 | dout("choose_mds %p %llx.%llx " | 710 | dout("choose_mds %p %llx.%llx " |
| 709 | "frag %u mds%d (auth)\n", | 711 | "frag %u mds%d (auth)\n", |
| 710 | inode, ceph_vinop(inode), frag.frag, mds); | 712 | inode, ceph_vinop(inode), frag.frag, mds); |
| 711 | return mds; | 713 | if (ceph_mdsmap_get_state(mdsc->mdsmap, mds) >= |
| 714 | CEPH_MDS_STATE_ACTIVE) | ||
| 715 | return mds; | ||
| 712 | } | 716 | } |
| 713 | } | 717 | } |
| 714 | } | 718 | } |
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index bf6f0f34082a..9c5085465a63 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
| @@ -290,6 +290,8 @@ static int parse_mount_options(struct ceph_mount_options **pfsopt, | |||
| 290 | 290 | ||
| 291 | fsopt->rsize = CEPH_MOUNT_RSIZE_DEFAULT; | 291 | fsopt->rsize = CEPH_MOUNT_RSIZE_DEFAULT; |
| 292 | fsopt->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL); | 292 | fsopt->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL); |
| 293 | fsopt->caps_wanted_delay_min = CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT; | ||
| 294 | fsopt->caps_wanted_delay_max = CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT; | ||
| 293 | fsopt->cap_release_safety = CEPH_CAP_RELEASE_SAFETY_DEFAULT; | 295 | fsopt->cap_release_safety = CEPH_CAP_RELEASE_SAFETY_DEFAULT; |
| 294 | fsopt->max_readdir = CEPH_MAX_READDIR_DEFAULT; | 296 | fsopt->max_readdir = CEPH_MAX_READDIR_DEFAULT; |
| 295 | fsopt->max_readdir_bytes = CEPH_MAX_READDIR_BYTES_DEFAULT; | 297 | fsopt->max_readdir_bytes = CEPH_MAX_READDIR_BYTES_DEFAULT; |
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index 6e12a6ba5f79..8c9eba6ef9df 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c | |||
| @@ -219,6 +219,7 @@ static struct ceph_inode_xattr *__get_xattr(struct ceph_inode_info *ci, | |||
| 219 | struct rb_node **p; | 219 | struct rb_node **p; |
| 220 | struct rb_node *parent = NULL; | 220 | struct rb_node *parent = NULL; |
| 221 | struct ceph_inode_xattr *xattr = NULL; | 221 | struct ceph_inode_xattr *xattr = NULL; |
| 222 | int name_len = strlen(name); | ||
| 222 | int c; | 223 | int c; |
| 223 | 224 | ||
| 224 | p = &ci->i_xattrs.index.rb_node; | 225 | p = &ci->i_xattrs.index.rb_node; |
| @@ -226,6 +227,8 @@ static struct ceph_inode_xattr *__get_xattr(struct ceph_inode_info *ci, | |||
| 226 | parent = *p; | 227 | parent = *p; |
| 227 | xattr = rb_entry(parent, struct ceph_inode_xattr, node); | 228 | xattr = rb_entry(parent, struct ceph_inode_xattr, node); |
| 228 | c = strncmp(name, xattr->name, xattr->name_len); | 229 | c = strncmp(name, xattr->name, xattr->name_len); |
| 230 | if (c == 0 && name_len > xattr->name_len) | ||
| 231 | c = 1; | ||
| 229 | if (c < 0) | 232 | if (c < 0) |
| 230 | p = &(*p)->rb_left; | 233 | p = &(*p)->rb_left; |
| 231 | else if (c > 0) | 234 | else if (c > 0) |
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 0994f6a76c07..58fd707174e1 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
| @@ -704,7 +704,8 @@ skip_mount_setup: | |||
| 704 | sbp[0]->s_state = | 704 | sbp[0]->s_state = |
| 705 | cpu_to_le16(le16_to_cpu(sbp[0]->s_state) & ~NILFS_VALID_FS); | 705 | cpu_to_le16(le16_to_cpu(sbp[0]->s_state) & ~NILFS_VALID_FS); |
| 706 | /* synchronize sbp[1] with sbp[0] */ | 706 | /* synchronize sbp[1] with sbp[0] */ |
| 707 | memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); | 707 | if (sbp[1]) |
| 708 | memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); | ||
| 708 | return nilfs_commit_super(sbi, NILFS_SB_COMMIT_ALL); | 709 | return nilfs_commit_super(sbi, NILFS_SB_COMMIT_ALL); |
| 709 | } | 710 | } |
| 710 | 711 | ||
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c index b572b6727181..326e7475a22a 100644 --- a/fs/ntfs/mft.c +++ b/fs/ntfs/mft.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /** | 1 | /** |
| 2 | * mft.c - NTFS kernel mft record operations. Part of the Linux-NTFS project. | 2 | * mft.c - NTFS kernel mft record operations. Part of the Linux-NTFS project. |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2001-2006 Anton Altaparmakov | 4 | * Copyright (c) 2001-2011 Anton Altaparmakov and Tuxera Inc. |
| 5 | * Copyright (c) 2002 Richard Russon | 5 | * Copyright (c) 2002 Richard Russon |
| 6 | * | 6 | * |
| 7 | * This program/include file is free software; you can redistribute it and/or | 7 | * This program/include file is free software; you can redistribute it and/or |
| @@ -2576,6 +2576,8 @@ mft_rec_already_initialized: | |||
| 2576 | flush_dcache_page(page); | 2576 | flush_dcache_page(page); |
| 2577 | SetPageUptodate(page); | 2577 | SetPageUptodate(page); |
| 2578 | if (base_ni) { | 2578 | if (base_ni) { |
| 2579 | MFT_RECORD *m_tmp; | ||
| 2580 | |||
| 2579 | /* | 2581 | /* |
| 2580 | * Setup the base mft record in the extent mft record. This | 2582 | * Setup the base mft record in the extent mft record. This |
| 2581 | * completes initialization of the allocated extent mft record | 2583 | * completes initialization of the allocated extent mft record |
| @@ -2588,11 +2590,11 @@ mft_rec_already_initialized: | |||
| 2588 | * attach it to the base inode @base_ni and map, pin, and lock | 2590 | * attach it to the base inode @base_ni and map, pin, and lock |
| 2589 | * its, i.e. the allocated, mft record. | 2591 | * its, i.e. the allocated, mft record. |
| 2590 | */ | 2592 | */ |
| 2591 | m = map_extent_mft_record(base_ni, bit, &ni); | 2593 | m_tmp = map_extent_mft_record(base_ni, bit, &ni); |
| 2592 | if (IS_ERR(m)) { | 2594 | if (IS_ERR(m_tmp)) { |
| 2593 | ntfs_error(vol->sb, "Failed to map allocated extent " | 2595 | ntfs_error(vol->sb, "Failed to map allocated extent " |
| 2594 | "mft record 0x%llx.", (long long)bit); | 2596 | "mft record 0x%llx.", (long long)bit); |
| 2595 | err = PTR_ERR(m); | 2597 | err = PTR_ERR(m_tmp); |
| 2596 | /* Set the mft record itself not in use. */ | 2598 | /* Set the mft record itself not in use. */ |
| 2597 | m->flags &= cpu_to_le16( | 2599 | m->flags &= cpu_to_le16( |
| 2598 | ~le16_to_cpu(MFT_RECORD_IN_USE)); | 2600 | ~le16_to_cpu(MFT_RECORD_IN_USE)); |
| @@ -2603,6 +2605,7 @@ mft_rec_already_initialized: | |||
| 2603 | ntfs_unmap_page(page); | 2605 | ntfs_unmap_page(page); |
| 2604 | goto undo_mftbmp_alloc; | 2606 | goto undo_mftbmp_alloc; |
| 2605 | } | 2607 | } |
| 2608 | BUG_ON(m != m_tmp); | ||
| 2606 | /* | 2609 | /* |
| 2607 | * Make sure the allocated mft record is written out to disk. | 2610 | * Make sure the allocated mft record is written out to disk. |
| 2608 | * No need to set the inode dirty because the caller is going | 2611 | * No need to set the inode dirty because the caller is going |
diff --git a/fs/proc/consoles.c b/fs/proc/consoles.c index eafc22ab1fdd..b701eaa482bf 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 2fb2882f0fa7..8ab48bc2fa7d 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 856756ca5ee4..c4eb40018256 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 818a5e063faf..4661ae2b1cec 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 9774fe6a1a97..7453cfd593c8 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 e470d387dd49..05e03284b92a 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/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h index bf173502d744..38d393092812 100644 --- a/include/linux/mmc/sh_mmcif.h +++ b/include/linux/mmc/sh_mmcif.h | |||
| @@ -94,12 +94,12 @@ struct sh_mmcif_plat_data { | |||
| 94 | 94 | ||
| 95 | static inline u32 sh_mmcif_readl(void __iomem *addr, int reg) | 95 | static inline u32 sh_mmcif_readl(void __iomem *addr, int reg) |
| 96 | { | 96 | { |
| 97 | return readl(addr + reg); | 97 | return __raw_readl(addr + reg); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | static inline void sh_mmcif_writel(void __iomem *addr, int reg, u32 val) | 100 | static inline void sh_mmcif_writel(void __iomem *addr, int reg, u32 val) |
| 101 | { | 101 | { |
| 102 | writel(val, addr + reg); | 102 | __raw_writel(val, addr + reg); |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | #define SH_MMCIF_BBS 512 /* boot block size */ | 105 | #define SH_MMCIF_BBS 512 /* boot block size */ |
diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h index 387fa7d05c98..7faf933cced7 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 a29feb01854e..d2cf88407690 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 e9eee99d8b1f..160a407c1963 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 53d9a9ec88e6..2ddbdc73aade 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/sched_fair.c b/kernel/sched_fair.c index 354769979c02..0c26e2df450e 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
| @@ -722,10 +722,10 @@ static void update_cfs_load(struct cfs_rq *cfs_rq, int global_update) | |||
| 722 | u64 now, delta; | 722 | u64 now, delta; |
| 723 | unsigned long load = cfs_rq->load.weight; | 723 | unsigned long load = cfs_rq->load.weight; |
| 724 | 724 | ||
| 725 | if (!cfs_rq) | 725 | if (cfs_rq->tg == &root_task_group) |
| 726 | return; | 726 | return; |
| 727 | 727 | ||
| 728 | now = rq_of(cfs_rq)->clock; | 728 | now = rq_of(cfs_rq)->clock_task; |
| 729 | delta = now - cfs_rq->load_stamp; | 729 | delta = now - cfs_rq->load_stamp; |
| 730 | 730 | ||
| 731 | /* truncate load history at 4 idle periods */ | 731 | /* truncate load history at 4 idle periods */ |
| @@ -830,9 +830,6 @@ static void update_cfs_shares(struct cfs_rq *cfs_rq, long weight_delta) | |||
| 830 | struct sched_entity *se; | 830 | struct sched_entity *se; |
| 831 | long shares; | 831 | long shares; |
| 832 | 832 | ||
| 833 | if (!cfs_rq) | ||
| 834 | return; | ||
| 835 | |||
| 836 | tg = cfs_rq->tg; | 833 | tg = cfs_rq->tg; |
| 837 | se = tg->se[cpu_of(rq_of(cfs_rq))]; | 834 | se = tg->se[cpu_of(rq_of(cfs_rq))]; |
| 838 | if (!se) | 835 | if (!se) |
| @@ -1432,7 +1429,7 @@ static inline unsigned long effective_load(struct task_group *tg, int cpu, | |||
| 1432 | 1429 | ||
| 1433 | static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync) | 1430 | static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync) |
| 1434 | { | 1431 | { |
| 1435 | unsigned long this_load, load; | 1432 | s64 this_load, load; |
| 1436 | int idx, this_cpu, prev_cpu; | 1433 | int idx, this_cpu, prev_cpu; |
| 1437 | unsigned long tl_per_task; | 1434 | unsigned long tl_per_task; |
| 1438 | struct task_group *tg; | 1435 | struct task_group *tg; |
| @@ -1471,8 +1468,8 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync) | |||
| 1471 | * Otherwise check if either cpus are near enough in load to allow this | 1468 | * Otherwise check if either cpus are near enough in load to allow this |
| 1472 | * task to be woken on this_cpu. | 1469 | * task to be woken on this_cpu. |
| 1473 | */ | 1470 | */ |
| 1474 | if (this_load) { | 1471 | if (this_load > 0) { |
| 1475 | unsigned long this_eff_load, prev_eff_load; | 1472 | s64 this_eff_load, prev_eff_load; |
| 1476 | 1473 | ||
| 1477 | this_eff_load = 100; | 1474 | this_eff_load = 100; |
| 1478 | this_eff_load *= power_of(prev_cpu); | 1475 | this_eff_load *= power_of(prev_cpu); |
diff --git a/kernel/sys.c b/kernel/sys.c index 31b71a276b40..18da702ec813 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
| @@ -1385,7 +1385,8 @@ static int check_prlimit_permission(struct task_struct *task) | |||
| 1385 | const struct cred *cred = current_cred(), *tcred; | 1385 | const struct cred *cred = current_cred(), *tcred; |
| 1386 | 1386 | ||
| 1387 | tcred = __task_cred(task); | 1387 | tcred = __task_cred(task); |
| 1388 | if ((cred->uid != tcred->euid || | 1388 | if (current != task && |
| 1389 | (cred->uid != tcred->euid || | ||
| 1389 | cred->uid != tcred->suid || | 1390 | cred->uid != tcred->suid || |
| 1390 | cred->uid != tcred->uid || | 1391 | cred->uid != tcred->uid || |
| 1391 | cred->gid != tcred->egid || | 1392 | cred->gid != tcred->egid || |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index bc86bb32e126..0f1bd83db985 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 5086bb962b4d..7ea2e033d715 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/rbtree.c b/lib/rbtree.c index 4693f79195d3..a16be19a1305 100644 --- a/lib/rbtree.c +++ b/lib/rbtree.c | |||
| @@ -315,6 +315,7 @@ void rb_augment_insert(struct rb_node *node, rb_augment_f func, void *data) | |||
| 315 | 315 | ||
| 316 | rb_augment_path(node, func, data); | 316 | rb_augment_path(node, func, data); |
| 317 | } | 317 | } |
| 318 | EXPORT_SYMBOL(rb_augment_insert); | ||
| 318 | 319 | ||
| 319 | /* | 320 | /* |
| 320 | * before removing the node, find the deepest node on the rebalance path | 321 | * before removing the node, find the deepest node on the rebalance path |
| @@ -340,6 +341,7 @@ struct rb_node *rb_augment_erase_begin(struct rb_node *node) | |||
| 340 | 341 | ||
| 341 | return deepest; | 342 | return deepest; |
| 342 | } | 343 | } |
| 344 | EXPORT_SYMBOL(rb_augment_erase_begin); | ||
| 343 | 345 | ||
| 344 | /* | 346 | /* |
| 345 | * after removal, update the tree to account for the removed entry | 347 | * after removal, update the tree to account for the removed entry |
| @@ -350,6 +352,7 @@ void rb_augment_erase_end(struct rb_node *node, rb_augment_f func, void *data) | |||
| 350 | if (node) | 352 | if (node) |
| 351 | rb_augment_path(node, func, data); | 353 | rb_augment_path(node, func, data); |
| 352 | } | 354 | } |
| 355 | EXPORT_SYMBOL(rb_augment_erase_end); | ||
| 353 | 356 | ||
| 354 | /* | 357 | /* |
| 355 | * This function returns the first node (in sort order) of the tree. | 358 | * This function returns the first node (in sort order) of the tree. |
diff --git a/lib/textsearch.c b/lib/textsearch.c index d608331b3e47..e0cc0146ae62 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 3ad483bdf505..e9c0c61f2ddd 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/kmemleak-test.c b/mm/kmemleak-test.c index 177a5169bbde..ff0d9779cec8 100644 --- a/mm/kmemleak-test.c +++ b/mm/kmemleak-test.c | |||
| @@ -75,13 +75,11 @@ static int __init kmemleak_test_init(void) | |||
| 75 | * after the module is removed. | 75 | * after the module is removed. |
| 76 | */ | 76 | */ |
| 77 | for (i = 0; i < 10; i++) { | 77 | for (i = 0; i < 10; i++) { |
| 78 | elem = kmalloc(sizeof(*elem), GFP_KERNEL); | 78 | elem = kzalloc(sizeof(*elem), GFP_KERNEL); |
| 79 | pr_info("kmemleak: kmalloc(sizeof(*elem)) = %p\n", elem); | 79 | pr_info("kmemleak: kzalloc(sizeof(*elem)) = %p\n", elem); |
| 80 | if (!elem) | 80 | if (!elem) |
| 81 | return -ENOMEM; | 81 | return -ENOMEM; |
| 82 | memset(elem, 0, sizeof(*elem)); | ||
| 83 | INIT_LIST_HEAD(&elem->list); | 82 | INIT_LIST_HEAD(&elem->list); |
| 84 | |||
| 85 | list_add_tail(&elem->list, &test_list); | 83 | list_add_tail(&elem->list, &test_list); |
| 86 | } | 84 | } |
| 87 | 85 | ||
diff --git a/mm/kmemleak.c b/mm/kmemleak.c index bd9bc214091b..84225f3b7190 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c | |||
| @@ -113,7 +113,9 @@ | |||
| 113 | #define BYTES_PER_POINTER sizeof(void *) | 113 | #define BYTES_PER_POINTER sizeof(void *) |
| 114 | 114 | ||
| 115 | /* GFP bitmask for kmemleak internal allocations */ | 115 | /* GFP bitmask for kmemleak internal allocations */ |
| 116 | #define GFP_KMEMLEAK_MASK (GFP_KERNEL | GFP_ATOMIC) | 116 | #define gfp_kmemleak_mask(gfp) (((gfp) & (GFP_KERNEL | GFP_ATOMIC)) | \ |
| 117 | __GFP_NORETRY | __GFP_NOMEMALLOC | \ | ||
| 118 | __GFP_NOWARN) | ||
| 117 | 119 | ||
| 118 | /* scanning area inside a memory block */ | 120 | /* scanning area inside a memory block */ |
| 119 | struct kmemleak_scan_area { | 121 | struct kmemleak_scan_area { |
| @@ -511,9 +513,10 @@ static struct kmemleak_object *create_object(unsigned long ptr, size_t size, | |||
| 511 | struct kmemleak_object *object; | 513 | struct kmemleak_object *object; |
| 512 | struct prio_tree_node *node; | 514 | struct prio_tree_node *node; |
| 513 | 515 | ||
| 514 | object = kmem_cache_alloc(object_cache, gfp & GFP_KMEMLEAK_MASK); | 516 | object = kmem_cache_alloc(object_cache, gfp_kmemleak_mask(gfp)); |
| 515 | if (!object) { | 517 | if (!object) { |
| 516 | kmemleak_stop("Cannot allocate a kmemleak_object structure\n"); | 518 | pr_warning("Cannot allocate a kmemleak_object structure\n"); |
| 519 | kmemleak_disable(); | ||
| 517 | return NULL; | 520 | return NULL; |
| 518 | } | 521 | } |
| 519 | 522 | ||
| @@ -734,9 +737,9 @@ static void add_scan_area(unsigned long ptr, size_t size, gfp_t gfp) | |||
| 734 | return; | 737 | return; |
| 735 | } | 738 | } |
| 736 | 739 | ||
| 737 | area = kmem_cache_alloc(scan_area_cache, gfp & GFP_KMEMLEAK_MASK); | 740 | area = kmem_cache_alloc(scan_area_cache, gfp_kmemleak_mask(gfp)); |
| 738 | if (!area) { | 741 | if (!area) { |
| 739 | kmemleak_warn("Cannot allocate a scan area\n"); | 742 | pr_warning("Cannot allocate a scan area\n"); |
| 740 | goto out; | 743 | goto out; |
| 741 | } | 744 | } |
| 742 | 745 | ||
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index db76ef726293..3878cfe399dc 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 46fe8cc13d67..9f29a3b7aac2 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 90c1439549fd..a873e61e312e 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 0369f5b3ba1b..eb663fb533e0 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 f5d90dedebba..148c6e630df2 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 6b90a4191734..99cd8d9d891b 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 8b602d881fd7..9c4541bc488a 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 38100170d380..a290854fdaa6 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 c791fcda7b2d..7550abb0c96a 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 ff8aaa736650..6b83776534fb 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 7c6a46f80372..24ea2d71e7ea 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 17741782a345..ff2302910b5e 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 d31bb36ae0dc..7cd1bc86d591 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 d900ab99814a..6b03f561caec 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 04c8b69fd426..7927589813b5 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 d9bc85751c74..a96e65674ac3 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 2549b29b062d..eb7f82ebf4a3 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 856f68466d49..02f583b3744a 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 24a1cf110d80..fd6782e3a038 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 373bd0416f69..1534508f6c68 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 7e74023ea6e4..da87428681cc 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 5950e3abead9..b64b42bc774b 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 c80d1c210c5d..5f63ec58942c 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 de55e642eafc..6b7fe4a84f13 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 60f4bdd4408e..0f7bf3fdfea5 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 aa4d6337e43c..d468b479aa93 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 2e45791d4f6c..14a799de1c35 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 984c1b0c6836..fc12fe6f5597 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 21f13da24763..436a2e75b322 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 1c4bce863479..6a3006b38dc5 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 966158d49dd1..fbd710d619bf 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 a6009c5a2c97..9f98dbd32d4c 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 239ec53a634d..edea8cefec6c 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 77565e721811..e93165820c3f 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 84ce48eadff4..d84e7329660f 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; |
diff --git a/security/keys/internal.h b/security/keys/internal.h index edfa50dbd6f5..a52aa7c88b41 100644 --- a/security/keys/internal.h +++ b/security/keys/internal.h | |||
| @@ -87,13 +87,13 @@ extern void key_type_put(struct key_type *ktype); | |||
| 87 | extern int __key_link_begin(struct key *keyring, | 87 | extern int __key_link_begin(struct key *keyring, |
| 88 | const struct key_type *type, | 88 | const struct key_type *type, |
| 89 | const char *description, | 89 | const char *description, |
| 90 | struct keyring_list **_prealloc); | 90 | unsigned long *_prealloc); |
| 91 | extern int __key_link_check_live_key(struct key *keyring, struct key *key); | 91 | extern int __key_link_check_live_key(struct key *keyring, struct key *key); |
| 92 | extern void __key_link(struct key *keyring, struct key *key, | 92 | extern void __key_link(struct key *keyring, struct key *key, |
| 93 | struct keyring_list **_prealloc); | 93 | unsigned long *_prealloc); |
| 94 | extern void __key_link_end(struct key *keyring, | 94 | extern void __key_link_end(struct key *keyring, |
| 95 | struct key_type *type, | 95 | struct key_type *type, |
| 96 | struct keyring_list *prealloc); | 96 | unsigned long prealloc); |
| 97 | 97 | ||
| 98 | extern key_ref_t __keyring_search_one(key_ref_t keyring_ref, | 98 | extern key_ref_t __keyring_search_one(key_ref_t keyring_ref, |
| 99 | const struct key_type *type, | 99 | const struct key_type *type, |
diff --git a/security/keys/key.c b/security/keys/key.c index 84d4eb568b08..1c2d43dc5107 100644 --- a/security/keys/key.c +++ b/security/keys/key.c | |||
| @@ -415,7 +415,7 @@ static int __key_instantiate_and_link(struct key *key, | |||
| 415 | size_t datalen, | 415 | size_t datalen, |
| 416 | struct key *keyring, | 416 | struct key *keyring, |
| 417 | struct key *authkey, | 417 | struct key *authkey, |
| 418 | struct keyring_list **_prealloc) | 418 | unsigned long *_prealloc) |
| 419 | { | 419 | { |
| 420 | int ret, awaken; | 420 | int ret, awaken; |
| 421 | 421 | ||
| @@ -481,7 +481,7 @@ int key_instantiate_and_link(struct key *key, | |||
| 481 | struct key *keyring, | 481 | struct key *keyring, |
| 482 | struct key *authkey) | 482 | struct key *authkey) |
| 483 | { | 483 | { |
| 484 | struct keyring_list *prealloc; | 484 | unsigned long prealloc; |
| 485 | int ret; | 485 | int ret; |
| 486 | 486 | ||
| 487 | if (keyring) { | 487 | if (keyring) { |
| @@ -526,7 +526,7 @@ int key_negate_and_link(struct key *key, | |||
| 526 | struct key *keyring, | 526 | struct key *keyring, |
| 527 | struct key *authkey) | 527 | struct key *authkey) |
| 528 | { | 528 | { |
| 529 | struct keyring_list *prealloc; | 529 | unsigned long prealloc; |
| 530 | struct timespec now; | 530 | struct timespec now; |
| 531 | int ret, awaken, link_ret = 0; | 531 | int ret, awaken, link_ret = 0; |
| 532 | 532 | ||
| @@ -814,7 +814,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref, | |||
| 814 | key_perm_t perm, | 814 | key_perm_t perm, |
| 815 | unsigned long flags) | 815 | unsigned long flags) |
| 816 | { | 816 | { |
| 817 | struct keyring_list *prealloc; | 817 | unsigned long prealloc; |
| 818 | const struct cred *cred = current_cred(); | 818 | const struct cred *cred = current_cred(); |
| 819 | struct key_type *ktype; | 819 | struct key_type *ktype; |
| 820 | struct key *keyring, *key = NULL; | 820 | struct key *keyring, *key = NULL; |
diff --git a/security/keys/keyring.c b/security/keys/keyring.c index 92024ed12e0a..5620f084dede 100644 --- a/security/keys/keyring.c +++ b/security/keys/keyring.c | |||
| @@ -25,6 +25,8 @@ | |||
| 25 | (keyring)->payload.subscriptions, \ | 25 | (keyring)->payload.subscriptions, \ |
| 26 | rwsem_is_locked((struct rw_semaphore *)&(keyring)->sem))) | 26 | rwsem_is_locked((struct rw_semaphore *)&(keyring)->sem))) |
| 27 | 27 | ||
| 28 | #define KEY_LINK_FIXQUOTA 1UL | ||
| 29 | |||
| 28 | /* | 30 | /* |
| 29 | * When plumbing the depths of the key tree, this sets a hard limit | 31 | * When plumbing the depths of the key tree, this sets a hard limit |
| 30 | * set on how deep we're willing to go. | 32 | * set on how deep we're willing to go. |
| @@ -699,11 +701,11 @@ static void keyring_unlink_rcu_disposal(struct rcu_head *rcu) | |||
| 699 | * Preallocate memory so that a key can be linked into to a keyring. | 701 | * Preallocate memory so that a key can be linked into to a keyring. |
| 700 | */ | 702 | */ |
| 701 | int __key_link_begin(struct key *keyring, const struct key_type *type, | 703 | int __key_link_begin(struct key *keyring, const struct key_type *type, |
| 702 | const char *description, | 704 | const char *description, unsigned long *_prealloc) |
| 703 | struct keyring_list **_prealloc) | ||
| 704 | __acquires(&keyring->sem) | 705 | __acquires(&keyring->sem) |
| 705 | { | 706 | { |
| 706 | struct keyring_list *klist, *nklist; | 707 | struct keyring_list *klist, *nklist; |
| 708 | unsigned long prealloc; | ||
| 707 | unsigned max; | 709 | unsigned max; |
| 708 | size_t size; | 710 | size_t size; |
| 709 | int loop, ret; | 711 | int loop, ret; |
| @@ -746,6 +748,7 @@ int __key_link_begin(struct key *keyring, const struct key_type *type, | |||
| 746 | 748 | ||
| 747 | /* note replacement slot */ | 749 | /* note replacement slot */ |
| 748 | klist->delkey = nklist->delkey = loop; | 750 | klist->delkey = nklist->delkey = loop; |
| 751 | prealloc = (unsigned long)nklist; | ||
| 749 | goto done; | 752 | goto done; |
| 750 | } | 753 | } |
| 751 | } | 754 | } |
| @@ -760,6 +763,7 @@ int __key_link_begin(struct key *keyring, const struct key_type *type, | |||
| 760 | if (klist && klist->nkeys < klist->maxkeys) { | 763 | if (klist && klist->nkeys < klist->maxkeys) { |
| 761 | /* there's sufficient slack space to append directly */ | 764 | /* there's sufficient slack space to append directly */ |
| 762 | nklist = NULL; | 765 | nklist = NULL; |
| 766 | prealloc = KEY_LINK_FIXQUOTA; | ||
| 763 | } else { | 767 | } else { |
| 764 | /* grow the key list */ | 768 | /* grow the key list */ |
| 765 | max = 4; | 769 | max = 4; |
| @@ -794,8 +798,9 @@ int __key_link_begin(struct key *keyring, const struct key_type *type, | |||
| 794 | nklist->keys[nklist->delkey] = NULL; | 798 | nklist->keys[nklist->delkey] = NULL; |
| 795 | } | 799 | } |
| 796 | 800 | ||
| 801 | prealloc = (unsigned long)nklist | KEY_LINK_FIXQUOTA; | ||
| 797 | done: | 802 | done: |
| 798 | *_prealloc = nklist; | 803 | *_prealloc = prealloc; |
| 799 | kleave(" = 0"); | 804 | kleave(" = 0"); |
| 800 | return 0; | 805 | return 0; |
| 801 | 806 | ||
| @@ -836,12 +841,12 @@ int __key_link_check_live_key(struct key *keyring, struct key *key) | |||
| 836 | * combination. | 841 | * combination. |
| 837 | */ | 842 | */ |
| 838 | void __key_link(struct key *keyring, struct key *key, | 843 | void __key_link(struct key *keyring, struct key *key, |
| 839 | struct keyring_list **_prealloc) | 844 | unsigned long *_prealloc) |
| 840 | { | 845 | { |
| 841 | struct keyring_list *klist, *nklist; | 846 | struct keyring_list *klist, *nklist; |
| 842 | 847 | ||
| 843 | nklist = *_prealloc; | 848 | nklist = (struct keyring_list *)(*_prealloc & ~KEY_LINK_FIXQUOTA); |
| 844 | *_prealloc = NULL; | 849 | *_prealloc = 0; |
| 845 | 850 | ||
| 846 | kenter("%d,%d,%p", keyring->serial, key->serial, nklist); | 851 | kenter("%d,%d,%p", keyring->serial, key->serial, nklist); |
| 847 | 852 | ||
| @@ -881,20 +886,22 @@ void __key_link(struct key *keyring, struct key *key, | |||
| 881 | * Must be called with __key_link_begin() having being called. | 886 | * Must be called with __key_link_begin() having being called. |
| 882 | */ | 887 | */ |
| 883 | void __key_link_end(struct key *keyring, struct key_type *type, | 888 | void __key_link_end(struct key *keyring, struct key_type *type, |
| 884 | struct keyring_list *prealloc) | 889 | unsigned long prealloc) |
| 885 | __releases(&keyring->sem) | 890 | __releases(&keyring->sem) |
| 886 | { | 891 | { |
| 887 | BUG_ON(type == NULL); | 892 | BUG_ON(type == NULL); |
| 888 | BUG_ON(type->name == NULL); | 893 | BUG_ON(type->name == NULL); |
| 889 | kenter("%d,%s,%p", keyring->serial, type->name, prealloc); | 894 | kenter("%d,%s,%lx", keyring->serial, type->name, prealloc); |
| 890 | 895 | ||
| 891 | if (type == &key_type_keyring) | 896 | if (type == &key_type_keyring) |
| 892 | up_write(&keyring_serialise_link_sem); | 897 | up_write(&keyring_serialise_link_sem); |
| 893 | 898 | ||
| 894 | if (prealloc) { | 899 | if (prealloc) { |
| 895 | kfree(prealloc); | 900 | if (prealloc & KEY_LINK_FIXQUOTA) |
| 896 | key_payload_reserve(keyring, | 901 | key_payload_reserve(keyring, |
| 897 | keyring->datalen - KEYQUOTA_LINK_BYTES); | 902 | keyring->datalen - |
| 903 | KEYQUOTA_LINK_BYTES); | ||
| 904 | kfree((struct keyring_list *)(prealloc & ~KEY_LINK_FIXQUOTA)); | ||
| 898 | } | 905 | } |
| 899 | up_write(&keyring->sem); | 906 | up_write(&keyring->sem); |
| 900 | } | 907 | } |
| @@ -921,7 +928,7 @@ void __key_link_end(struct key *keyring, struct key_type *type, | |||
| 921 | */ | 928 | */ |
| 922 | int key_link(struct key *keyring, struct key *key) | 929 | int key_link(struct key *keyring, struct key *key) |
| 923 | { | 930 | { |
| 924 | struct keyring_list *prealloc; | 931 | unsigned long prealloc; |
| 925 | int ret; | 932 | int ret; |
| 926 | 933 | ||
| 927 | key_check(keyring); | 934 | key_check(keyring); |
diff --git a/security/keys/request_key.c b/security/keys/request_key.c index 9a7fb3914b27..a3dc0d460def 100644 --- a/security/keys/request_key.c +++ b/security/keys/request_key.c | |||
| @@ -352,8 +352,8 @@ static int construct_alloc_key(struct key_type *type, | |||
| 352 | struct key_user *user, | 352 | struct key_user *user, |
| 353 | struct key **_key) | 353 | struct key **_key) |
| 354 | { | 354 | { |
| 355 | struct keyring_list *prealloc; | ||
| 356 | const struct cred *cred = current_cred(); | 355 | const struct cred *cred = current_cred(); |
| 356 | unsigned long prealloc; | ||
| 357 | struct key *key; | 357 | struct key *key; |
| 358 | key_ref_t key_ref; | 358 | key_ref_t key_ref; |
| 359 | int ret; | 359 | int ret; |
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index 91acc9a243ec..24d3013c0231 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c | |||
| @@ -30,6 +30,8 @@ | |||
| 30 | 30 | ||
| 31 | #define DRIVER_NAME "aaci-pl041" | 31 | #define DRIVER_NAME "aaci-pl041" |
| 32 | 32 | ||
| 33 | #define FRAME_PERIOD_US 21 | ||
| 34 | |||
| 33 | /* | 35 | /* |
| 34 | * PM support is not complete. Turn it off. | 36 | * PM support is not complete. Turn it off. |
| 35 | */ | 37 | */ |
| @@ -64,8 +66,8 @@ static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg, | |||
| 64 | unsigned short val) | 66 | unsigned short val) |
| 65 | { | 67 | { |
| 66 | struct aaci *aaci = ac97->private_data; | 68 | struct aaci *aaci = ac97->private_data; |
| 69 | int timeout; | ||
| 67 | u32 v; | 70 | u32 v; |
| 68 | int timeout = 5000; | ||
| 69 | 71 | ||
| 70 | if (ac97->num >= 4) | 72 | if (ac97->num >= 4) |
| 71 | return; | 73 | return; |
| @@ -81,14 +83,17 @@ static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg, | |||
| 81 | writel(val << 4, aaci->base + AACI_SL2TX); | 83 | writel(val << 4, aaci->base + AACI_SL2TX); |
| 82 | writel(reg << 12, aaci->base + AACI_SL1TX); | 84 | writel(reg << 12, aaci->base + AACI_SL1TX); |
| 83 | 85 | ||
| 84 | /* | 86 | /* Initially, wait one frame period */ |
| 85 | * Wait for the transmission of both slots to complete. | 87 | udelay(FRAME_PERIOD_US); |
| 86 | */ | 88 | |
| 89 | /* And then wait an additional eight frame periods for it to be sent */ | ||
| 90 | timeout = FRAME_PERIOD_US * 8; | ||
| 87 | do { | 91 | do { |
| 92 | udelay(1); | ||
| 88 | v = readl(aaci->base + AACI_SLFR); | 93 | v = readl(aaci->base + AACI_SLFR); |
| 89 | } while ((v & (SLFR_1TXB|SLFR_2TXB)) && --timeout); | 94 | } while ((v & (SLFR_1TXB|SLFR_2TXB)) && --timeout); |
| 90 | 95 | ||
| 91 | if (!timeout) | 96 | if (v & (SLFR_1TXB|SLFR_2TXB)) |
| 92 | dev_err(&aaci->dev->dev, | 97 | dev_err(&aaci->dev->dev, |
| 93 | "timeout waiting for write to complete\n"); | 98 | "timeout waiting for write to complete\n"); |
| 94 | 99 | ||
| @@ -101,9 +106,8 @@ static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg, | |||
| 101 | static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg) | 106 | static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg) |
| 102 | { | 107 | { |
| 103 | struct aaci *aaci = ac97->private_data; | 108 | struct aaci *aaci = ac97->private_data; |
| 109 | int timeout, retries = 10; | ||
| 104 | u32 v; | 110 | u32 v; |
| 105 | int timeout = 5000; | ||
| 106 | int retries = 10; | ||
| 107 | 111 | ||
| 108 | if (ac97->num >= 4) | 112 | if (ac97->num >= 4) |
| 109 | return ~0; | 113 | return ~0; |
| @@ -117,35 +121,34 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg) | |||
| 117 | */ | 121 | */ |
| 118 | writel((reg << 12) | (1 << 19), aaci->base + AACI_SL1TX); | 122 | writel((reg << 12) | (1 << 19), aaci->base + AACI_SL1TX); |
| 119 | 123 | ||
| 120 | /* | 124 | /* Initially, wait one frame period */ |
| 121 | * Wait for the transmission to complete. | 125 | udelay(FRAME_PERIOD_US); |
| 122 | */ | 126 | |
| 127 | /* And then wait an additional eight frame periods for it to be sent */ | ||
| 128 | timeout = FRAME_PERIOD_US * 8; | ||
| 123 | do { | 129 | do { |
| 130 | udelay(1); | ||
| 124 | v = readl(aaci->base + AACI_SLFR); | 131 | v = readl(aaci->base + AACI_SLFR); |
| 125 | } while ((v & SLFR_1TXB) && --timeout); | 132 | } while ((v & SLFR_1TXB) && --timeout); |
| 126 | 133 | ||
| 127 | if (!timeout) { | 134 | if (v & SLFR_1TXB) { |
| 128 | dev_err(&aaci->dev->dev, "timeout on slot 1 TX busy\n"); | 135 | dev_err(&aaci->dev->dev, "timeout on slot 1 TX busy\n"); |
| 129 | v = ~0; | 136 | v = ~0; |
| 130 | goto out; | 137 | goto out; |
| 131 | } | 138 | } |
| 132 | 139 | ||
| 133 | /* | 140 | /* Now wait for the response frame */ |
| 134 | * Give the AC'97 codec more than enough time | 141 | udelay(FRAME_PERIOD_US); |
| 135 | * to respond. (42us = ~2 frames at 48kHz.) | ||
| 136 | */ | ||
| 137 | udelay(42); | ||
| 138 | 142 | ||
| 139 | /* | 143 | /* And then wait an additional eight frame periods for data */ |
| 140 | * Wait for slot 2 to indicate data. | 144 | timeout = FRAME_PERIOD_US * 8; |
| 141 | */ | ||
| 142 | timeout = 5000; | ||
| 143 | do { | 145 | do { |
| 146 | udelay(1); | ||
| 144 | cond_resched(); | 147 | cond_resched(); |
| 145 | v = readl(aaci->base + AACI_SLFR) & (SLFR_1RXV|SLFR_2RXV); | 148 | v = readl(aaci->base + AACI_SLFR) & (SLFR_1RXV|SLFR_2RXV); |
| 146 | } while ((v != (SLFR_1RXV|SLFR_2RXV)) && --timeout); | 149 | } while ((v != (SLFR_1RXV|SLFR_2RXV)) && --timeout); |
| 147 | 150 | ||
| 148 | if (!timeout) { | 151 | if (v != (SLFR_1RXV|SLFR_2RXV)) { |
| 149 | dev_err(&aaci->dev->dev, "timeout on RX valid\n"); | 152 | dev_err(&aaci->dev->dev, "timeout on RX valid\n"); |
| 150 | v = ~0; | 153 | v = ~0; |
| 151 | goto out; | 154 | goto out; |
| @@ -179,6 +182,7 @@ aaci_chan_wait_ready(struct aaci_runtime *aacirun, unsigned long mask) | |||
| 179 | int timeout = 5000; | 182 | int timeout = 5000; |
| 180 | 183 | ||
| 181 | do { | 184 | do { |
| 185 | udelay(1); | ||
| 182 | val = readl(aacirun->base + AACI_SR); | 186 | val = readl(aacirun->base + AACI_SR); |
| 183 | } while (val & mask && timeout--); | 187 | } while (val & mask && timeout--); |
| 184 | } | 188 | } |
| @@ -874,7 +878,7 @@ static int __devinit aaci_probe_ac97(struct aaci *aaci) | |||
| 874 | * Give the AC'97 codec more than enough time | 878 | * Give the AC'97 codec more than enough time |
| 875 | * to wake up. (42us = ~2 frames at 48kHz.) | 879 | * to wake up. (42us = ~2 frames at 48kHz.) |
| 876 | */ | 880 | */ |
| 877 | udelay(42); | 881 | udelay(FRAME_PERIOD_US * 2); |
| 878 | 882 | ||
| 879 | ret = snd_ac97_bus(aaci->card, 0, &aaci_bus_ops, aaci, &ac97_bus); | 883 | ret = snd_ac97_bus(aaci->card, 0, &aaci_bus_ops, aaci, &ac97_bus); |
| 880 | if (ret) | 884 | if (ret) |
diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c index 10c3a871a12d..b310702c646e 100644 --- a/sound/atmel/ac97c.c +++ b/sound/atmel/ac97c.c | |||
| @@ -33,9 +33,12 @@ | |||
| 33 | #include <linux/dw_dmac.h> | 33 | #include <linux/dw_dmac.h> |
| 34 | 34 | ||
| 35 | #include <mach/cpu.h> | 35 | #include <mach/cpu.h> |
| 36 | #include <mach/hardware.h> | ||
| 37 | #include <mach/gpio.h> | 36 | #include <mach/gpio.h> |
| 38 | 37 | ||
| 38 | #ifdef CONFIG_ARCH_AT91 | ||
| 39 | #include <mach/hardware.h> | ||
| 40 | #endif | ||
| 41 | |||
| 39 | #include "ac97c.h" | 42 | #include "ac97c.h" |
| 40 | 43 | ||
| 41 | enum { | 44 | enum { |
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index 6117595fc075..573594bf3225 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c | |||
| @@ -979,31 +979,25 @@ snd_azf3328_codec_setfmt(struct snd_azf3328_codec_data *codec, | |||
| 979 | 979 | ||
| 980 | snd_azf3328_dbgcallenter(); | 980 | snd_azf3328_dbgcallenter(); |
| 981 | switch (bitrate) { | 981 | switch (bitrate) { |
| 982 | #define AZF_FMT_XLATE(in_freq, out_bits) \ | 982 | case AZF_FREQ_4000: freq = SOUNDFORMAT_FREQ_SUSPECTED_4000; break; |
| 983 | do { \ | 983 | case AZF_FREQ_4800: freq = SOUNDFORMAT_FREQ_SUSPECTED_4800; break; |
| 984 | case AZF_FREQ_ ## in_freq: \ | 984 | case AZF_FREQ_5512: |
| 985 | freq = SOUNDFORMAT_FREQ_ ## out_bits; \ | 985 | /* the AZF3328 names it "5510" for some strange reason */ |
| 986 | break; \ | 986 | freq = SOUNDFORMAT_FREQ_5510; break; |
| 987 | } while (0); | 987 | case AZF_FREQ_6620: freq = SOUNDFORMAT_FREQ_6620; break; |
| 988 | AZF_FMT_XLATE(4000, SUSPECTED_4000) | 988 | case AZF_FREQ_8000: freq = SOUNDFORMAT_FREQ_8000; break; |
| 989 | AZF_FMT_XLATE(4800, SUSPECTED_4800) | 989 | case AZF_FREQ_9600: freq = SOUNDFORMAT_FREQ_9600; break; |
| 990 | /* the AZF3328 names it "5510" for some strange reason: */ | 990 | case AZF_FREQ_11025: freq = SOUNDFORMAT_FREQ_11025; break; |
| 991 | AZF_FMT_XLATE(5512, 5510) | 991 | case AZF_FREQ_13240: freq = SOUNDFORMAT_FREQ_SUSPECTED_13240; break; |
| 992 | AZF_FMT_XLATE(6620, 6620) | 992 | case AZF_FREQ_16000: freq = SOUNDFORMAT_FREQ_16000; break; |
| 993 | AZF_FMT_XLATE(8000, 8000) | 993 | case AZF_FREQ_22050: freq = SOUNDFORMAT_FREQ_22050; break; |
| 994 | AZF_FMT_XLATE(9600, 9600) | 994 | case AZF_FREQ_32000: freq = SOUNDFORMAT_FREQ_32000; break; |
| 995 | AZF_FMT_XLATE(11025, 11025) | ||
| 996 | AZF_FMT_XLATE(13240, SUSPECTED_13240) | ||
| 997 | AZF_FMT_XLATE(16000, 16000) | ||
| 998 | AZF_FMT_XLATE(22050, 22050) | ||
| 999 | AZF_FMT_XLATE(32000, 32000) | ||
| 1000 | default: | 995 | default: |
| 1001 | snd_printk(KERN_WARNING "unknown bitrate %d, assuming 44.1kHz!\n", bitrate); | 996 | snd_printk(KERN_WARNING "unknown bitrate %d, assuming 44.1kHz!\n", bitrate); |
| 1002 | /* fall-through */ | 997 | /* fall-through */ |
| 1003 | AZF_FMT_XLATE(44100, 44100) | 998 | case AZF_FREQ_44100: freq = SOUNDFORMAT_FREQ_44100; break; |
| 1004 | AZF_FMT_XLATE(48000, 48000) | 999 | case AZF_FREQ_48000: freq = SOUNDFORMAT_FREQ_48000; break; |
| 1005 | AZF_FMT_XLATE(66200, SUSPECTED_66200) | 1000 | case AZF_FREQ_66200: freq = SOUNDFORMAT_FREQ_SUSPECTED_66200; break; |
| 1006 | #undef AZF_FMT_XLATE | ||
| 1007 | } | 1001 | } |
| 1008 | /* val = 0xff07; 3m27.993s (65301Hz; -> 64000Hz???) hmm, 66120, 65967, 66123 */ | 1002 | /* val = 0xff07; 3m27.993s (65301Hz; -> 64000Hz???) hmm, 66120, 65967, 66123 */ |
| 1009 | /* val = 0xff09; 17m15.098s (13123,478Hz; -> 12000Hz???) hmm, 13237.2Hz? */ | 1003 | /* val = 0xff09; 17m15.098s (13123,478Hz; -> 12000Hz???) hmm, 13237.2Hz? */ |
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index 4a663471dadc..74b0560289c0 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c | |||
| @@ -381,7 +381,7 @@ static void hdmi_show_short_audio_desc(struct cea_sad *a) | |||
| 381 | snd_print_pcm_rates(a->rates, buf, sizeof(buf)); | 381 | snd_print_pcm_rates(a->rates, buf, sizeof(buf)); |
| 382 | 382 | ||
| 383 | if (a->format == AUDIO_CODING_TYPE_LPCM) | 383 | if (a->format == AUDIO_CODING_TYPE_LPCM) |
| 384 | snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2 - 8)); | 384 | snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2) - 8); |
| 385 | else if (a->max_bitrate) | 385 | else if (a->max_bitrate) |
| 386 | snprintf(buf2, sizeof(buf2), | 386 | snprintf(buf2, sizeof(buf2), |
| 387 | ", max bitrate = %d", a->max_bitrate); | 387 | ", max bitrate = %d", a->max_bitrate); |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index be4df4c6fd56..2fa9ed99c32f 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -14954,9 +14954,11 @@ static struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
| 14954 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), | 14954 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
| 14955 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), | 14955 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
| 14956 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), | 14956 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
| 14957 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), | ||
| 14958 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), | ||
| 14959 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), | 14957 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
| 14958 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), | ||
| 14959 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), | ||
| 14960 | SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), | ||
| 14961 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), | ||
| 14960 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), | 14962 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
| 14961 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), | 14963 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
| 14962 | {} | 14964 | {} |
diff --git a/sound/pci/oxygen/xonar_cs43xx.c b/sound/pci/oxygen/xonar_cs43xx.c index 9f72d424969c..252719101c42 100644 --- a/sound/pci/oxygen/xonar_cs43xx.c +++ b/sound/pci/oxygen/xonar_cs43xx.c | |||
| @@ -392,7 +392,7 @@ static void dump_d1_registers(struct oxygen *chip, | |||
| 392 | unsigned int i; | 392 | unsigned int i; |
| 393 | 393 | ||
| 394 | snd_iprintf(buffer, "\nCS4398: 7?"); | 394 | snd_iprintf(buffer, "\nCS4398: 7?"); |
| 395 | for (i = 2; i <= 8; ++i) | 395 | for (i = 2; i < 8; ++i) |
| 396 | snd_iprintf(buffer, " %02x", data->cs4398_regs[i]); | 396 | snd_iprintf(buffer, " %02x", data->cs4398_regs[i]); |
| 397 | snd_iprintf(buffer, "\n"); | 397 | snd_iprintf(buffer, "\n"); |
| 398 | dump_cs4362a_registers(data, buffer); | 398 | dump_cs4362a_registers(data, buffer); |
diff --git a/sound/soc/atmel/snd-soc-afeb9260.c b/sound/soc/atmel/snd-soc-afeb9260.c index da2208e06b0d..5e4d499d8434 100644 --- a/sound/soc/atmel/snd-soc-afeb9260.c +++ b/sound/soc/atmel/snd-soc-afeb9260.c | |||
| @@ -129,7 +129,7 @@ static struct snd_soc_dai_link afeb9260_dai = { | |||
| 129 | .cpu_dai_name = "atmel-ssc-dai.0", | 129 | .cpu_dai_name = "atmel-ssc-dai.0", |
| 130 | .codec_dai_name = "tlv320aic23-hifi", | 130 | .codec_dai_name = "tlv320aic23-hifi", |
| 131 | .platform_name = "atmel_pcm-audio", | 131 | .platform_name = "atmel_pcm-audio", |
| 132 | .codec_name = "tlv320aic23-codec.0-0x1a", | 132 | .codec_name = "tlv320aic23-codec.0-001a", |
| 133 | .init = afeb9260_tlv320aic23_init, | 133 | .init = afeb9260_tlv320aic23_init, |
| 134 | .ops = &afeb9260_ops, | 134 | .ops = &afeb9260_ops, |
| 135 | }; | 135 | }; |
diff --git a/sound/soc/blackfin/bf5xx-ssm2602.c b/sound/soc/blackfin/bf5xx-ssm2602.c index e902b24c1856..ad28663f5bbd 100644 --- a/sound/soc/blackfin/bf5xx-ssm2602.c +++ b/sound/soc/blackfin/bf5xx-ssm2602.c | |||
| @@ -119,7 +119,7 @@ static struct snd_soc_dai_link bf5xx_ssm2602_dai = { | |||
| 119 | .cpu_dai_name = "bf5xx-i2s", | 119 | .cpu_dai_name = "bf5xx-i2s", |
| 120 | .codec_dai_name = "ssm2602-hifi", | 120 | .codec_dai_name = "ssm2602-hifi", |
| 121 | .platform_name = "bf5xx-pcm-audio", | 121 | .platform_name = "bf5xx-pcm-audio", |
| 122 | .codec_name = "ssm2602-codec.0-0x1b", | 122 | .codec_name = "ssm2602-codec.0-001b", |
| 123 | .ops = &bf5xx_ssm2602_ops, | 123 | .ops = &bf5xx_ssm2602_ops, |
| 124 | }; | 124 | }; |
| 125 | 125 | ||
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 247a6a99feb8..3351f77607b3 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
| @@ -2386,7 +2386,7 @@ static int wm8994_set_tristate(struct snd_soc_dai *codec_dai, int tristate) | |||
| 2386 | else | 2386 | else |
| 2387 | val = 0; | 2387 | val = 0; |
| 2388 | 2388 | ||
| 2389 | return snd_soc_update_bits(codec, reg, mask, reg); | 2389 | return snd_soc_update_bits(codec, reg, mask, val); |
| 2390 | } | 2390 | } |
| 2391 | 2391 | ||
| 2392 | #define WM8994_RATES SNDRV_PCM_RATE_8000_96000 | 2392 | #define WM8994_RATES SNDRV_PCM_RATE_8000_96000 |
diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c index 6045cbde492b..608c84c5aa8e 100644 --- a/sound/soc/codecs/wm8995.c +++ b/sound/soc/codecs/wm8995.c | |||
| @@ -1223,7 +1223,7 @@ static int wm8995_set_tristate(struct snd_soc_dai *codec_dai, int tristate) | |||
| 1223 | else | 1223 | else |
| 1224 | val = 0; | 1224 | val = 0; |
| 1225 | 1225 | ||
| 1226 | return snd_soc_update_bits(codec, reg, mask, reg); | 1226 | return snd_soc_update_bits(codec, reg, mask, val); |
| 1227 | } | 1227 | } |
| 1228 | 1228 | ||
| 1229 | /* The size in bits of the FLL divide multiplied by 10 | 1229 | /* The size in bits of the FLL divide multiplied by 10 |
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index c466982eed23..613df5db0b32 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
| @@ -91,6 +91,7 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, unsigned int op) | |||
| 91 | static void calibrate_dc_servo(struct snd_soc_codec *codec) | 91 | static void calibrate_dc_servo(struct snd_soc_codec *codec) |
| 92 | { | 92 | { |
| 93 | struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); | 93 | struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); |
| 94 | s8 offset; | ||
| 94 | u16 reg, reg_l, reg_r, dcs_cfg; | 95 | u16 reg, reg_l, reg_r, dcs_cfg; |
| 95 | 96 | ||
| 96 | /* If we're using a digital only path and have a previously | 97 | /* If we're using a digital only path and have a previously |
| @@ -149,16 +150,14 @@ static void calibrate_dc_servo(struct snd_soc_codec *codec) | |||
| 149 | hubs->dcs_codes); | 150 | hubs->dcs_codes); |
| 150 | 151 | ||
| 151 | /* HPOUT1L */ | 152 | /* HPOUT1L */ |
| 152 | if (reg_l + hubs->dcs_codes > 0 && | 153 | offset = reg_l; |
| 153 | reg_l + hubs->dcs_codes < 0xff) | 154 | offset += hubs->dcs_codes; |
| 154 | reg_l += hubs->dcs_codes; | 155 | dcs_cfg = (u8)offset << WM8993_DCS_DAC_WR_VAL_1_SHIFT; |
| 155 | dcs_cfg = reg_l << WM8993_DCS_DAC_WR_VAL_1_SHIFT; | ||
| 156 | 156 | ||
| 157 | /* HPOUT1R */ | 157 | /* HPOUT1R */ |
| 158 | if (reg_r + hubs->dcs_codes > 0 && | 158 | offset = reg_r; |
| 159 | reg_r + hubs->dcs_codes < 0xff) | 159 | offset += hubs->dcs_codes; |
| 160 | reg_r += hubs->dcs_codes; | 160 | dcs_cfg |= (u8)offset; |
| 161 | dcs_cfg |= reg_r; | ||
| 162 | 161 | ||
| 163 | dev_dbg(codec->dev, "DCS result: %x\n", dcs_cfg); | 162 | dev_dbg(codec->dev, "DCS result: %x\n", dcs_cfg); |
| 164 | 163 | ||
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 0c2d6bacc681..b36f0b39b090 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c | |||
| @@ -223,7 +223,7 @@ static struct snd_soc_dai_link da8xx_evm_dai = { | |||
| 223 | .stream_name = "AIC3X", | 223 | .stream_name = "AIC3X", |
| 224 | .cpu_dai_name= "davinci-mcasp.0", | 224 | .cpu_dai_name= "davinci-mcasp.0", |
| 225 | .codec_dai_name = "tlv320aic3x-hifi", | 225 | .codec_dai_name = "tlv320aic3x-hifi", |
| 226 | .codec_name = "tlv320aic3x-codec.0-001a", | 226 | .codec_name = "tlv320aic3x-codec.1-0018", |
| 227 | .platform_name = "davinci-pcm-audio", | 227 | .platform_name = "davinci-pcm-audio", |
| 228 | .init = evm_aic3x_init, | 228 | .init = evm_aic3x_init, |
| 229 | .ops = &evm_ops, | 229 | .ops = &evm_ops, |
diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c index fc592f0d5fc7..784cff5f67e8 100644 --- a/sound/soc/pxa/corgi.c +++ b/sound/soc/pxa/corgi.c | |||
| @@ -307,10 +307,10 @@ static int corgi_wm8731_init(struct snd_soc_pcm_runtime *rtd) | |||
| 307 | static struct snd_soc_dai_link corgi_dai = { | 307 | static struct snd_soc_dai_link corgi_dai = { |
| 308 | .name = "WM8731", | 308 | .name = "WM8731", |
| 309 | .stream_name = "WM8731", | 309 | .stream_name = "WM8731", |
| 310 | .cpu_dai_name = "pxa-is2-dai", | 310 | .cpu_dai_name = "pxa2xx-i2s", |
| 311 | .codec_dai_name = "wm8731-hifi", | 311 | .codec_dai_name = "wm8731-hifi", |
| 312 | .platform_name = "pxa-pcm-audio", | 312 | .platform_name = "pxa-pcm-audio", |
| 313 | .codec_name = "wm8731-codec-0.001a", | 313 | .codec_name = "wm8731-codec-0.001b", |
| 314 | .init = corgi_wm8731_init, | 314 | .init = corgi_wm8731_init, |
| 315 | .ops = &corgi_ops, | 315 | .ops = &corgi_ops, |
| 316 | }; | 316 | }; |
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c index 6298ee115e27..a7d4999f9b24 100644 --- a/sound/soc/pxa/poodle.c +++ b/sound/soc/pxa/poodle.c | |||
| @@ -276,7 +276,7 @@ static struct snd_soc_dai_link poodle_dai = { | |||
| 276 | .cpu_dai_name = "pxa2xx-i2s", | 276 | .cpu_dai_name = "pxa2xx-i2s", |
| 277 | .codec_dai_name = "wm8731-hifi", | 277 | .codec_dai_name = "wm8731-hifi", |
| 278 | .platform_name = "pxa-pcm-audio", | 278 | .platform_name = "pxa-pcm-audio", |
| 279 | .codec_name = "wm8731-codec.0-001a", | 279 | .codec_name = "wm8731-codec.0-001b", |
| 280 | .init = poodle_wm8731_init, | 280 | .init = poodle_wm8731_init, |
| 281 | .ops = &poodle_ops, | 281 | .ops = &poodle_ops, |
| 282 | }; | 282 | }; |
diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c index c2acb69b957a..8e1571350630 100644 --- a/sound/soc/pxa/spitz.c +++ b/sound/soc/pxa/spitz.c | |||
| @@ -315,10 +315,10 @@ static int spitz_wm8750_init(struct snd_soc_pcm_runtime *rtd) | |||
| 315 | static struct snd_soc_dai_link spitz_dai = { | 315 | static struct snd_soc_dai_link spitz_dai = { |
| 316 | .name = "wm8750", | 316 | .name = "wm8750", |
| 317 | .stream_name = "WM8750", | 317 | .stream_name = "WM8750", |
| 318 | .cpu_dai_name = "pxa-is2", | 318 | .cpu_dai_name = "pxa2xx-i2s", |
| 319 | .codec_dai_name = "wm8750-hifi", | 319 | .codec_dai_name = "wm8750-hifi", |
| 320 | .platform_name = "pxa-pcm-audio", | 320 | .platform_name = "pxa-pcm-audio", |
| 321 | .codec_name = "wm8750-codec.0-001a", | 321 | .codec_name = "wm8750-codec.0-001b", |
| 322 | .init = spitz_wm8750_init, | 322 | .init = spitz_wm8750_init, |
| 323 | .ops = &spitz_ops, | 323 | .ops = &spitz_ops, |
| 324 | }; | 324 | }; |
diff --git a/sound/soc/samsung/neo1973_gta02_wm8753.c b/sound/soc/samsung/neo1973_gta02_wm8753.c index 3eec610c10f9..0d0ae2b9eef6 100644 --- a/sound/soc/samsung/neo1973_gta02_wm8753.c +++ b/sound/soc/samsung/neo1973_gta02_wm8753.c | |||
| @@ -397,11 +397,11 @@ static struct snd_soc_dai_link neo1973_gta02_dai[] = { | |||
| 397 | { /* Hifi Playback - for similatious use with voice below */ | 397 | { /* Hifi Playback - for similatious use with voice below */ |
| 398 | .name = "WM8753", | 398 | .name = "WM8753", |
| 399 | .stream_name = "WM8753 HiFi", | 399 | .stream_name = "WM8753 HiFi", |
| 400 | .cpu_dai_name = "s3c24xx-i2s", | 400 | .cpu_dai_name = "s3c24xx-iis", |
| 401 | .codec_dai_name = "wm8753-hifi", | 401 | .codec_dai_name = "wm8753-hifi", |
| 402 | .init = neo1973_gta02_wm8753_init, | 402 | .init = neo1973_gta02_wm8753_init, |
| 403 | .platform_name = "samsung-audio", | 403 | .platform_name = "samsung-audio", |
| 404 | .codec_name = "wm8753-codec.0-0x1a", | 404 | .codec_name = "wm8753-codec.0-001a", |
| 405 | .ops = &neo1973_gta02_hifi_ops, | 405 | .ops = &neo1973_gta02_hifi_ops, |
| 406 | }, | 406 | }, |
| 407 | { /* Voice via BT */ | 407 | { /* Voice via BT */ |
| @@ -410,7 +410,7 @@ static struct snd_soc_dai_link neo1973_gta02_dai[] = { | |||
| 410 | .cpu_dai_name = "bluetooth-dai", | 410 | .cpu_dai_name = "bluetooth-dai", |
| 411 | .codec_dai_name = "wm8753-voice", | 411 | .codec_dai_name = "wm8753-voice", |
| 412 | .ops = &neo1973_gta02_voice_ops, | 412 | .ops = &neo1973_gta02_voice_ops, |
| 413 | .codec_name = "wm8753-codec.0-0x1a", | 413 | .codec_name = "wm8753-codec.0-001a", |
| 414 | .platform_name = "samsung-audio", | 414 | .platform_name = "samsung-audio", |
| 415 | }, | 415 | }, |
| 416 | }; | 416 | }; |
diff --git a/sound/soc/samsung/neo1973_wm8753.c b/sound/soc/samsung/neo1973_wm8753.c index c7a24514beb5..d20815d5ab2e 100644 --- a/sound/soc/samsung/neo1973_wm8753.c +++ b/sound/soc/samsung/neo1973_wm8753.c | |||
| @@ -559,9 +559,9 @@ static struct snd_soc_dai_link neo1973_dai[] = { | |||
| 559 | .name = "WM8753", | 559 | .name = "WM8753", |
| 560 | .stream_name = "WM8753 HiFi", | 560 | .stream_name = "WM8753 HiFi", |
| 561 | .platform_name = "samsung-audio", | 561 | .platform_name = "samsung-audio", |
| 562 | .cpu_dai_name = "s3c24xx-i2s", | 562 | .cpu_dai_name = "s3c24xx-iis", |
| 563 | .codec_dai_name = "wm8753-hifi", | 563 | .codec_dai_name = "wm8753-hifi", |
| 564 | .codec_name = "wm8753-codec.0-0x1a", | 564 | .codec_name = "wm8753-codec.0-001a", |
| 565 | .init = neo1973_wm8753_init, | 565 | .init = neo1973_wm8753_init, |
| 566 | .ops = &neo1973_hifi_ops, | 566 | .ops = &neo1973_hifi_ops, |
| 567 | }, | 567 | }, |
| @@ -571,7 +571,7 @@ static struct snd_soc_dai_link neo1973_dai[] = { | |||
| 571 | .platform_name = "samsung-audio", | 571 | .platform_name = "samsung-audio", |
| 572 | .cpu_dai_name = "bluetooth-dai", | 572 | .cpu_dai_name = "bluetooth-dai", |
| 573 | .codec_dai_name = "wm8753-voice", | 573 | .codec_dai_name = "wm8753-voice", |
| 574 | .codec_name = "wm8753-codec.0-0x1a", | 574 | .codec_name = "wm8753-codec.0-001a", |
| 575 | .ops = &neo1973_voice_ops, | 575 | .ops = &neo1973_voice_ops, |
| 576 | }, | 576 | }, |
| 577 | }; | 577 | }; |
diff --git a/sound/soc/samsung/s3c24xx_simtec_hermes.c b/sound/soc/samsung/s3c24xx_simtec_hermes.c index bb4292e3596c..08fcaaa66907 100644 --- a/sound/soc/samsung/s3c24xx_simtec_hermes.c +++ b/sound/soc/samsung/s3c24xx_simtec_hermes.c | |||
| @@ -94,8 +94,8 @@ static int simtec_hermes_init(struct snd_soc_pcm_runtime *rtd) | |||
| 94 | static struct snd_soc_dai_link simtec_dai_aic33 = { | 94 | static struct snd_soc_dai_link simtec_dai_aic33 = { |
| 95 | .name = "tlv320aic33", | 95 | .name = "tlv320aic33", |
| 96 | .stream_name = "TLV320AIC33", | 96 | .stream_name = "TLV320AIC33", |
| 97 | .codec_name = "tlv320aic3x-codec.0-0x1a", | 97 | .codec_name = "tlv320aic3x-codec.0-001a", |
| 98 | .cpu_dai_name = "s3c24xx-i2s", | 98 | .cpu_dai_name = "s3c24xx-iis", |
| 99 | .codec_dai_name = "tlv320aic3x-hifi", | 99 | .codec_dai_name = "tlv320aic3x-hifi", |
| 100 | .platform_name = "samsung-audio", | 100 | .platform_name = "samsung-audio", |
| 101 | .init = simtec_hermes_init, | 101 | .init = simtec_hermes_init, |
diff --git a/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c b/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c index fbba4e367729..116e3e670167 100644 --- a/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c +++ b/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c | |||
| @@ -85,8 +85,8 @@ static int simtec_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd) | |||
| 85 | static struct snd_soc_dai_link simtec_dai_aic23 = { | 85 | static struct snd_soc_dai_link simtec_dai_aic23 = { |
| 86 | .name = "tlv320aic23", | 86 | .name = "tlv320aic23", |
| 87 | .stream_name = "TLV320AIC23", | 87 | .stream_name = "TLV320AIC23", |
| 88 | .codec_name = "tlv320aic3x-codec.0-0x1a", | 88 | .codec_name = "tlv320aic3x-codec.0-001a", |
| 89 | .cpu_dai_name = "s3c24xx-i2s", | 89 | .cpu_dai_name = "s3c24xx-iis", |
| 90 | .codec_dai_name = "tlv320aic3x-hifi", | 90 | .codec_dai_name = "tlv320aic3x-hifi", |
| 91 | .platform_name = "samsung-audio", | 91 | .platform_name = "samsung-audio", |
| 92 | .init = simtec_tlv320aic23_init, | 92 | .init = simtec_tlv320aic23_init, |
diff --git a/sound/soc/samsung/s3c24xx_uda134x.c b/sound/soc/samsung/s3c24xx_uda134x.c index cdc8ecbcb8ef..2c09e93dd566 100644 --- a/sound/soc/samsung/s3c24xx_uda134x.c +++ b/sound/soc/samsung/s3c24xx_uda134x.c | |||
| @@ -228,7 +228,7 @@ static struct snd_soc_dai_link s3c24xx_uda134x_dai_link = { | |||
| 228 | .stream_name = "UDA134X", | 228 | .stream_name = "UDA134X", |
| 229 | .codec_name = "uda134x-hifi", | 229 | .codec_name = "uda134x-hifi", |
| 230 | .codec_dai_name = "uda134x-hifi", | 230 | .codec_dai_name = "uda134x-hifi", |
| 231 | .cpu_dai_name = "s3c24xx-i2s", | 231 | .cpu_dai_name = "s3c24xx-iis", |
| 232 | .ops = &s3c24xx_uda134x_ops, | 232 | .ops = &s3c24xx_uda134x_ops, |
| 233 | .platform_name = "samsung-audio", | 233 | .platform_name = "samsung-audio", |
| 234 | }; | 234 | }; |
