Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'tip/rtmutex' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into core/locking

*git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace tip/rtmutex:
rtmutex: Simplify PI algorithm and make highest prio task get lock

+2793 -1356
+1
.mailmap
··· 23 23 Arnaud Patard <arnaud.patard@rtp-net.org> 24 24 Arnd Bergmann <arnd@arndb.de> 25 25 Axel Dyks <xl@xlsigned.net> 26 + Axel Lin <axel.lin@gmail.com> 26 27 Ben Gardner <bgardner@wabtec.com> 27 28 Ben M Cahill <ben.m.cahill@intel.com> 28 29 Björn Steinbrink <B.Steinbrink@gmx.de>
+2 -2
Documentation/DocBook/device-drivers.tmpl
··· 217 217 <chapter id="uart16x50"> 218 218 <title>16x50 UART Driver</title> 219 219 !Iinclude/linux/serial_core.h 220 - !Edrivers/serial/serial_core.c 221 - !Edrivers/serial/8250.c 220 + !Edrivers/tty/serial/serial_core.c 221 + !Edrivers/tty/serial/8250.c 222 222 </chapter> 223 223 224 224 <chapter id="fbdev">
+2 -2
Documentation/kernel-parameters.txt
··· 43 43 AVR32 AVR32 architecture is enabled. 44 44 AX25 Appropriate AX.25 support is enabled. 45 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 48 EDD BIOS Enhanced Disk Drive Services (EDD) is enabled 47 49 EFI EFI Partitioning (GPT) is enabled 48 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 51 FB The frame buffer device is enabled. 52 52 GCOV GCOV profiling is enabled. 53 53 HW Appropriate hardware is enabled.
+22
MAINTAINERS
··· 3674 3674 F: include/keys/ 3675 3675 F: security/keys/ 3676 3676 3677 + KEYS-TRUSTED 3678 + M: David Safford <safford@watson.ibm.com> 3679 + M: Mimi Zohar <zohar@us.ibm.com> 3680 + L: linux-security-module@vger.kernel.org 3681 + L: keyrings@linux-nfs.org 3682 + S: Supported 3683 + F: Documentation/keys-trusted-encrypted.txt 3684 + F: include/keys/trusted-type.h 3685 + F: security/keys/trusted.c 3686 + F: security/keys/trusted.h 3687 + 3688 + KEYS-ENCRYPTED 3689 + M: Mimi Zohar <zohar@us.ibm.com> 3690 + M: David Safford <safford@watson.ibm.com> 3691 + L: linux-security-module@vger.kernel.org 3692 + L: keyrings@linux-nfs.org 3693 + S: Supported 3694 + F: Documentation/keys-trusted-encrypted.txt 3695 + F: include/keys/encrypted-type.h 3696 + F: security/keys/encrypted.c 3697 + F: security/keys/encrypted.h 3698 + 3677 3699 KGDB / KDB /debug_core 3678 3700 M: Jason Wessel <jason.wessel@windriver.com> 3679 3701 W: http://kgdb.wiki.kernel.org/
+6
arch/arm/include/asm/hardware/sp810.h
··· 50 50 #define SCPCELLID2 0xFF8 51 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 59 static inline void sysctl_soft_reset(void __iomem *base) 54 60 { 55 61 /* writing any value to SCSYSSTAT reg will reset system */
+1 -1
arch/arm/include/asm/memory.h
··· 188 188 * translation for translating DMA addresses. Use the driver 189 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 193 return __virt_to_phys((unsigned long)(x)); 194 194 }
+2 -5
arch/arm/kernel/smp_twd.c
··· 36 36 /* timer load already set up */ 37 37 ctrl = TWD_TIMER_CONTROL_ENABLE | TWD_TIMER_CONTROL_IT_ENABLE 38 38 | TWD_TIMER_CONTROL_PERIODIC; 39 + __raw_writel(twd_timer_rate / HZ, twd_base + TWD_TIMER_LOAD); 39 40 break; 40 41 case CLOCK_EVT_MODE_ONESHOT: 41 42 /* period set, and timer enabled in 'next_event' hook */ ··· 82 81 83 82 static void __cpuinit twd_calibrate_rate(void) 84 83 { 85 - unsigned long load, count; 84 + unsigned long count; 86 85 u64 waitjiffies; 87 86 88 87 /* ··· 117 116 printk("%lu.%02luMHz.\n", twd_timer_rate / 1000000, 118 117 (twd_timer_rate / 1000000) % 100); 119 118 } 120 - 121 - load = twd_timer_rate / HZ; 122 - 123 - __raw_writel(load, twd_base + TWD_TIMER_LOAD); 124 119 } 125 120 126 121 /*
+7
arch/arm/mach-ep93xx/gpio.c
··· 427 427 { 428 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 437 for (i = 0; i < ARRAY_SIZE(ep93xx_gpio_banks); i++) 431 438 gpiochip_add(&ep93xx_gpio_banks[i].chip); 432 439 }
+2
arch/arm/mach-omap1/Kconfig
··· 9 9 depends on ARCH_OMAP1 10 10 bool "OMAP730 Based System" 11 11 select CPU_ARM926T 12 + select OMAP_MPU_TIMER 12 13 select ARCH_OMAP_OTG 13 14 14 15 config ARCH_OMAP850 ··· 23 22 default y 24 23 bool "OMAP15xx Based System" 25 24 select CPU_ARM925T 25 + select OMAP_MPU_TIMER 26 26 27 27 config ARCH_OMAP16XX 28 28 depends on ARCH_OMAP1
+1 -2
arch/arm/mach-omap1/Makefile
··· 3 3 # 4 4 5 5 # Common support 6 - obj-y := io.o id.o sram.o irq.o mux.o flash.o serial.o devices.o dma.o 6 + obj-y := io.o id.o sram.o time.o irq.o mux.o flash.o serial.o devices.o dma.o 7 7 obj-y += clock.o clock_data.o opp_data.o 8 8 9 9 obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o 10 10 11 - obj-$(CONFIG_OMAP_MPU_TIMER) += time.o 12 11 obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o 13 12 14 13 # Power Management
+94 -7
arch/arm/mach-omap1/time.c
··· 44 44 #include <linux/clocksource.h> 45 45 #include <linux/clockchips.h> 46 46 #include <linux/io.h> 47 + #include <linux/sched.h> 47 48 48 49 #include <asm/system.h> 49 50 #include <mach/hardware.h> 50 51 #include <asm/leds.h> 51 52 #include <asm/irq.h> 53 + #include <asm/sched_clock.h> 54 + 52 55 #include <asm/mach/irq.h> 53 56 #include <asm/mach/time.h> 54 57 55 58 #include <plat/common.h> 59 + 60 + #ifdef CONFIG_OMAP_MPU_TIMER 56 61 57 62 #define OMAP_MPU_TIMER_BASE OMAP_MPU_TIMER1_BASE 58 63 #define OMAP_MPU_TIMER_OFFSET 0x100 ··· 72 67 ((volatile omap_mpu_timer_regs_t*)OMAP1_IO_ADDRESS(OMAP_MPU_TIMER_BASE + \ 73 68 (n)*OMAP_MPU_TIMER_OFFSET)) 74 69 75 - static inline unsigned long omap_mpu_timer_read(int nr) 70 + static inline unsigned long notrace omap_mpu_timer_read(int nr) 76 71 { 77 72 volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr); 78 73 return timer->read_tim; ··· 217 212 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 218 213 }; 219 214 215 + static DEFINE_CLOCK_DATA(cd); 216 + 217 + static inline unsigned long long notrace _omap_mpu_sched_clock(void) 218 + { 219 + u32 cyc = mpu_read(&clocksource_mpu); 220 + return cyc_to_sched_clock(&cd, cyc, (u32)~0); 221 + } 222 + 223 + #ifndef CONFIG_OMAP_32K_TIMER 224 + unsigned long long notrace sched_clock(void) 225 + { 226 + return _omap_mpu_sched_clock(); 227 + } 228 + #else 229 + static unsigned long long notrace omap_mpu_sched_clock(void) 230 + { 231 + return _omap_mpu_sched_clock(); 232 + } 233 + #endif 234 + 235 + static void notrace mpu_update_sched_clock(void) 236 + { 237 + u32 cyc = mpu_read(&clocksource_mpu); 238 + update_sched_clock(&cd, cyc, (u32)~0); 239 + } 240 + 220 241 static void __init omap_init_clocksource(unsigned long rate) 221 242 { 222 243 static char err[] __initdata = KERN_ERR ··· 250 219 251 220 setup_irq(INT_TIMER2, &omap_mpu_timer2_irq); 252 221 omap_mpu_timer_start(1, ~0, 1); 222 + init_sched_clock(&cd, mpu_update_sched_clock, 32, rate); 253 223 254 224 if (clocksource_register_hz(&clocksource_mpu, rate)) 255 225 printk(err, clocksource_mpu.name); 256 226 } 257 227 258 - /* 259 - * --------------------------------------------------------------------------- 260 - * Timer initialization 261 - * --------------------------------------------------------------------------- 262 - */ 263 - static void __init omap_timer_init(void) 228 + static void __init omap_mpu_timer_init(void) 264 229 { 265 230 struct clk *ck_ref = clk_get(NULL, "ck_ref"); 266 231 unsigned long rate; ··· 271 244 272 245 omap_init_mpu_timer(rate); 273 246 omap_init_clocksource(rate); 247 + } 248 + 249 + #else 250 + static inline void omap_mpu_timer_init(void) 251 + { 252 + pr_err("Bogus timer, should not happen\n"); 253 + } 254 + #endif /* CONFIG_OMAP_MPU_TIMER */ 255 + 256 + #if defined(CONFIG_OMAP_MPU_TIMER) && defined(CONFIG_OMAP_32K_TIMER) 257 + static unsigned long long (*preferred_sched_clock)(void); 258 + 259 + unsigned long long notrace sched_clock(void) 260 + { 261 + if (!preferred_sched_clock) 262 + return 0; 263 + 264 + return preferred_sched_clock(); 265 + } 266 + 267 + static inline void preferred_sched_clock_init(bool use_32k_sched_clock) 268 + { 269 + if (use_32k_sched_clock) 270 + preferred_sched_clock = omap_32k_sched_clock; 271 + else 272 + preferred_sched_clock = omap_mpu_sched_clock; 273 + } 274 + #else 275 + static inline void preferred_sched_clock_init(bool use_32k_sched_clcok) 276 + { 277 + } 278 + #endif 279 + 280 + static inline int omap_32k_timer_usable(void) 281 + { 282 + int res = false; 283 + 284 + if (cpu_is_omap730() || cpu_is_omap15xx()) 285 + return res; 286 + 287 + #ifdef CONFIG_OMAP_32K_TIMER 288 + res = omap_32k_timer_init(); 289 + #endif 290 + 291 + return res; 292 + } 293 + 294 + /* 295 + * --------------------------------------------------------------------------- 296 + * Timer initialization 297 + * --------------------------------------------------------------------------- 298 + */ 299 + static void __init omap_timer_init(void) 300 + { 301 + if (omap_32k_timer_usable()) { 302 + preferred_sched_clock_init(1); 303 + } else { 304 + omap_mpu_timer_init(); 305 + preferred_sched_clock_init(0); 306 + } 274 307 } 275 308 276 309 struct sys_timer omap_timer = {
+6 -7
arch/arm/mach-omap1/timer32k.c
··· 52 52 #include <asm/irq.h> 53 53 #include <asm/mach/irq.h> 54 54 #include <asm/mach/time.h> 55 + #include <plat/common.h> 55 56 #include <plat/dmtimer.h> 56 - 57 - struct sys_timer omap_timer; 58 57 59 58 /* 60 59 * --------------------------------------------------------------------------- ··· 180 181 * Timer initialization 181 182 * --------------------------------------------------------------------------- 182 183 */ 183 - static void __init omap_timer_init(void) 184 + bool __init omap_32k_timer_init(void) 184 185 { 186 + omap_init_clocksource_32k(); 187 + 185 188 #ifdef CONFIG_OMAP_DM_TIMER 186 189 omap_dm_timer_init(); 187 190 #endif 188 191 omap_init_32k_timer(); 189 - } 190 192 191 - struct sys_timer omap_timer = { 192 - .init = omap_timer_init, 193 - }; 193 + return true; 194 + }
+24 -5
arch/arm/mach-omap2/board-cm-t3517.c
··· 124 124 #if defined(CONFIG_RTC_DRV_V3020) || defined(CONFIG_RTC_DRV_V3020_MODULE) 125 125 #define RTC_IO_GPIO (153) 126 126 #define RTC_WR_GPIO (154) 127 - #define RTC_RD_GPIO (160) 127 + #define RTC_RD_GPIO (53) 128 128 #define RTC_CS_GPIO (163) 129 + #define RTC_CS_EN_GPIO (160) 129 130 130 131 struct v3020_platform_data cm_t3517_v3020_pdata = { 131 132 .use_gpio = 1, ··· 146 145 147 146 static void __init cm_t3517_init_rtc(void) 148 147 { 148 + int err; 149 + 150 + err = gpio_request(RTC_CS_EN_GPIO, "rtc cs en"); 151 + if (err) { 152 + pr_err("CM-T3517: rtc cs en gpio request failed: %d\n", err); 153 + return; 154 + } 155 + 156 + gpio_direction_output(RTC_CS_EN_GPIO, 1); 157 + 149 158 platform_device_register(&cm_t3517_rtc_device); 150 159 } 151 160 #else ··· 225 214 }, 226 215 { 227 216 .name = "linux", 228 - .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */ 217 + .offset = MTDPART_OFS_APPEND, /* Offset = 0x2A0000 */ 229 218 .size = 32 * NAND_BLOCK_SIZE, 230 219 }, 231 220 { 232 221 .name = "rootfs", 233 - .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */ 222 + .offset = MTDPART_OFS_APPEND, /* Offset = 0x6A0000 */ 234 223 .size = MTDPART_SIZ_FULL, 235 224 }, 236 225 }; ··· 267 256 static struct omap_board_mux board_mux[] __initdata = { 268 257 /* GPIO186 - Green LED */ 269 258 OMAP3_MUX(SYS_CLKOUT2, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), 270 - /* RTC GPIOs: IO, WR#, RD#, CS# */ 259 + 260 + /* RTC GPIOs: */ 261 + /* IO - GPIO153 */ 271 262 OMAP3_MUX(MCBSP4_DR, OMAP_MUX_MODE4 | OMAP_PIN_INPUT), 263 + /* WR# - GPIO154 */ 272 264 OMAP3_MUX(MCBSP4_DX, OMAP_MUX_MODE4 | OMAP_PIN_INPUT), 273 - OMAP3_MUX(MCBSP_CLKS, OMAP_MUX_MODE4 | OMAP_PIN_INPUT), 265 + /* RD# - GPIO53 */ 266 + OMAP3_MUX(GPMC_NCS2, OMAP_MUX_MODE4 | OMAP_PIN_INPUT), 267 + /* CS# - GPIO163 */ 274 268 OMAP3_MUX(UART3_CTS_RCTX, OMAP_MUX_MODE4 | OMAP_PIN_INPUT), 269 + /* CS EN - GPIO160 */ 270 + OMAP3_MUX(MCBSP_CLKS, OMAP_MUX_MODE4 | OMAP_PIN_INPUT), 271 + 275 272 /* HSUSB1 RESET */ 276 273 OMAP3_MUX(UART2_TX, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), 277 274 /* HSUSB2 RESET */
+1 -2
arch/arm/mach-omap2/board-devkit8000.c
··· 275 275 .irq_base = TWL4030_GPIO_IRQ_BASE, 276 276 .irq_end = TWL4030_GPIO_IRQ_END, 277 277 .use_leds = true, 278 - .pullups = BIT(1), 279 - .pulldowns = BIT(2) | BIT(6) | BIT(7) | BIT(8) | BIT(13) 278 + .pulldowns = BIT(1) | BIT(2) | BIT(6) | BIT(8) | BIT(13) 280 279 | BIT(15) | BIT(16) | BIT(17), 281 280 .setup = devkit8000_twl_gpio_setup, 282 281 };
-1
arch/arm/mach-omap2/clock44xx_data.c
··· 34 34 #include "cm2_44xx.h" 35 35 #include "cm-regbits-44xx.h" 36 36 #include "prm44xx.h" 37 - #include "prm44xx.h" 38 37 #include "prm-regbits-44xx.h" 39 38 #include "control.h" 40 39 #include "scrm44xx.h"
+26 -4
arch/arm/mach-omap2/clockdomain.c
··· 423 423 { 424 424 struct clkdm_dep *cd; 425 425 426 + if (!cpu_is_omap24xx() && !cpu_is_omap34xx()) { 427 + pr_err("clockdomain: %s/%s: %s: not yet implemented\n", 428 + clkdm1->name, clkdm2->name, __func__); 429 + return -EINVAL; 430 + } 431 + 426 432 if (!clkdm1 || !clkdm2) 427 433 return -EINVAL; 428 434 ··· 463 457 int clkdm_del_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2) 464 458 { 465 459 struct clkdm_dep *cd; 460 + 461 + if (!cpu_is_omap24xx() && !cpu_is_omap34xx()) { 462 + pr_err("clockdomain: %s/%s: %s: not yet implemented\n", 463 + clkdm1->name, clkdm2->name, __func__); 464 + return -EINVAL; 465 + } 466 466 467 467 if (!clkdm1 || !clkdm2) 468 468 return -EINVAL; ··· 512 500 if (!clkdm1 || !clkdm2) 513 501 return -EINVAL; 514 502 503 + if (!cpu_is_omap24xx() && !cpu_is_omap34xx()) { 504 + pr_err("clockdomain: %s/%s: %s: not yet implemented\n", 505 + clkdm1->name, clkdm2->name, __func__); 506 + return -EINVAL; 507 + } 508 + 515 509 cd = _clkdm_deps_lookup(clkdm2, clkdm1->wkdep_srcs); 516 510 if (IS_ERR(cd)) { 517 511 pr_debug("clockdomain: hardware cannot set/clear wake up of " ··· 544 526 { 545 527 struct clkdm_dep *cd; 546 528 u32 mask = 0; 529 + 530 + if (!cpu_is_omap24xx() && !cpu_is_omap34xx()) { 531 + pr_err("clockdomain: %s: %s: not yet implemented\n", 532 + clkdm->name, __func__); 533 + return -EINVAL; 534 + } 547 535 548 536 if (!clkdm) 549 537 return -EINVAL; ··· 854 830 * dependency code and data for OMAP4. 855 831 */ 856 832 if (cpu_is_omap44xx()) { 857 - WARN_ONCE(1, "clockdomain: OMAP4 wakeup/sleep dependency " 858 - "support is not yet implemented\n"); 833 + pr_err("clockdomain: %s: OMAP4 wakeup/sleep dependency support: not yet implemented\n", clkdm->name); 859 834 } else { 860 835 if (atomic_read(&clkdm->usecount) > 0) 861 836 _clkdm_add_autodeps(clkdm); ··· 895 872 * dependency code and data for OMAP4. 896 873 */ 897 874 if (cpu_is_omap44xx()) { 898 - WARN_ONCE(1, "clockdomain: OMAP4 wakeup/sleep dependency " 899 - "support is not yet implemented\n"); 875 + pr_err("clockdomain: %s: OMAP4 wakeup/sleep dependency support: not yet implemented\n", clkdm->name); 900 876 } else { 901 877 if (atomic_read(&clkdm->usecount) > 0) 902 878 _clkdm_del_autodeps(clkdm);
-2
arch/arm/mach-omap2/clockdomains44xx_data.c
··· 30 30 #include "cm1_44xx.h" 31 31 #include "cm2_44xx.h" 32 32 33 - #include "cm1_44xx.h" 34 - #include "cm2_44xx.h" 35 33 #include "cm-regbits-44xx.h" 36 34 #include "prm44xx.h" 37 35 #include "prcm44xx.h"
+2 -2
arch/arm/mach-omap2/pm24xx.c
··· 134 134 135 135 /* Block console output in case it is on one of the OMAP UARTs */ 136 136 if (!is_suspending()) 137 - if (try_acquire_console_sem()) 137 + if (!console_trylock()) 138 138 goto no_sleep; 139 139 140 140 omap_uart_prepare_idle(0); ··· 151 151 omap_uart_resume_idle(0); 152 152 153 153 if (!is_suspending()) 154 - release_console_sem(); 154 + console_unlock(); 155 155 156 156 no_sleep: 157 157 if (omap2_pm_debug) {
+2 -2
arch/arm/mach-omap2/pm34xx.c
··· 398 398 if (!is_suspending()) 399 399 if (per_next_state < PWRDM_POWER_ON || 400 400 core_next_state < PWRDM_POWER_ON) 401 - if (try_acquire_console_sem()) 401 + if (!console_trylock()) 402 402 goto console_still_active; 403 403 404 404 /* PER */ ··· 481 481 } 482 482 483 483 if (!is_suspending()) 484 - release_console_sem(); 484 + console_unlock(); 485 485 486 486 console_still_active: 487 487 /* Disable IO-PAD and IO-CHAIN wakeup */
-1
arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
··· 19 19 #include <plat/prcm.h> 20 20 21 21 #include "powerdomain.h" 22 - #include "prm-regbits-34xx.h" 23 22 #include "prm.h" 24 23 #include "prm-regbits-24xx.h" 25 24 #include "prm-regbits-34xx.h"
+2 -2
arch/arm/mach-omap2/serial.c
··· 812 812 813 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 818 * Because of early UART probing, UART did not get idled ··· 838 838 omap_uart_block_sleep(uart); 839 839 uart->timeout = DEFAULT_TIMEOUT; 840 840 841 - release_console_sem(); 841 + console_unlock(); 842 842 843 843 if ((cpu_is_omap34xx() && uart->padconf) || 844 844 (uart->wk_en && uart->wk_mask)) {
+8 -2
arch/arm/mach-omap2/timer-gp.c
··· 42 42 43 43 #include "timer-gp.h" 44 44 45 + #include <plat/common.h> 46 + 45 47 /* MAX_GPTIMER_ID: number of GPTIMERs on the chip */ 46 48 #define MAX_GPTIMER_ID 12 47 49 ··· 178 176 /* 179 177 * When 32k-timer is enabled, don't use GPTimer for clocksource 180 178 * instead, just leave default clocksource which uses the 32k 181 - * sync counter. See clocksource setup in see plat-omap/common.c. 179 + * sync counter. See clocksource setup in plat-omap/counter_32k.c 182 180 */ 183 181 184 - static inline void __init omap2_gp_clocksource_init(void) {} 182 + static void __init omap2_gp_clocksource_init(void) 183 + { 184 + omap_init_clocksource_32k(); 185 + } 186 + 185 187 #else 186 188 /* 187 189 * clocksource
+27 -22
arch/arm/mach-realview/Kconfig
··· 2 2 depends on ARCH_REALVIEW 3 3 4 4 config MACH_REALVIEW_EB 5 - bool "Support RealView/EB platform" 5 + bool "Support RealView(R) Emulation Baseboard" 6 6 select ARM_GIC 7 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 11 config REALVIEW_EB_A9MP 11 - bool "Support Multicore Cortex-A9" 12 + bool "Support Multicore Cortex-A9 Tile" 12 13 depends on MACH_REALVIEW_EB 13 14 select CPU_V7 14 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 19 config REALVIEW_EB_ARM11MP 18 - bool "Support ARM11MPCore tile" 20 + bool "Support ARM11MPCore Tile" 19 21 depends on MACH_REALVIEW_EB 20 22 select CPU_V6 21 23 select ARCH_HAS_BARRIERS if SMP 22 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 28 config REALVIEW_EB_ARM11MP_REVB 26 - bool "Support ARM11MPCore RevB tile" 29 + bool "Support ARM11MPCore RevB Tile" 27 30 depends on REALVIEW_EB_ARM11MP 28 31 help 29 - Enable support for the ARM11MPCore RevB tile on the Realview 30 - platform. Since there are device address differences, a 31 - kernel built with this option enabled is not compatible with 32 - other revisions of the ARM11MPCore tile. 32 + Enable support for the ARM11MPCore Revision B tile on the 33 + Realview(R) Emulation Baseboard platform. Since there are device 34 + address differences, a kernel built with this option enabled is 35 + not compatible with other revisions of the ARM11MPCore tile. 33 36 34 37 config MACH_REALVIEW_PB11MP 35 - bool "Support RealView/PB11MPCore platform" 38 + bool "Support RealView(R) Platform Baseboard for ARM11MPCore" 36 39 select CPU_V6 37 40 select ARM_GIC 38 41 select HAVE_PATA_PLATFORM 39 42 select ARCH_HAS_BARRIERS if SMP 40 43 help 41 - Include support for the ARM(R) RealView MPCore Platform Baseboard. 42 - PB11MPCore is a platform with an on-board ARM11MPCore and has 44 + Include support for the ARM(R) RealView(R) Platform Baseboard for 45 + the ARM11MPCore. This platform has an on-board ARM11MPCore and has 43 46 support for PCI-E and Compact Flash. 44 47 45 48 config MACH_REALVIEW_PB1176 46 - bool "Support RealView/PB1176 platform" 49 + bool "Support RealView(R) Platform Baseboard for ARM1176JZF-S" 47 50 select CPU_V6 48 51 select ARM_GIC 49 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 56 config REALVIEW_PB1176_SECURE_FLASH 53 57 bool "Allow access to the secure flash memory block" ··· 63 59 block (64MB @ 0x3c000000) is required. 64 60 65 61 config MACH_REALVIEW_PBA8 66 - bool "Support RealView/PB-A8 platform" 62 + bool "Support RealView(R) Platform Baseboard for Cortex(tm)-A8 platform" 67 63 select CPU_V7 68 64 select ARM_GIC 69 65 select HAVE_PATA_PLATFORM 70 66 help 71 - Include support for the ARM(R) RealView Cortex-A8 Platform Baseboard. 72 - PB-A8 is a platform with an on-board Cortex-A8 and has support for 73 - PCI-E and Compact Flash. 67 + Include support for the ARM(R) RealView Platform Baseboard for 68 + Cortex(tm)-A8. This platform has an on-board Cortex-A8 and has 69 + support for PCI-E and Compact Flash. 74 70 75 71 config MACH_REALVIEW_PBX 76 - bool "Support RealView/PBX platform" 72 + bool "Support RealView(R) Platform Baseboard Explore" 77 73 select ARM_GIC 78 74 select HAVE_PATA_PLATFORM 79 75 select ARCH_SPARSEMEM_ENABLE if CPU_V7 && !REALVIEW_HIGH_PHYS_OFFSET 80 76 select ZONE_DMA if SPARSEMEM 81 77 help 82 - Include support for the ARM(R) RealView PBX platform. 78 + Include support for the ARM(R) RealView(R) Platform Baseboard 79 + Explore. 83 80 84 81 config REALVIEW_HIGH_PHYS_OFFSET 85 82 bool "High physical base address for the RealView platform"
+1 -1
arch/arm/mach-realview/platsmp.c
··· 41 41 * observers, irrespective of whether they're taking part in coherency 42 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 46 pen_release = val; 47 47 smp_wmb();
+2
arch/arm/mach-shmobile/Kconfig
··· 60 60 61 61 config MACH_AG5EVM 62 62 bool "AG5EVM board" 63 + select ARCH_REQUIRE_GPIOLIB 64 + select SH_LCD_MIPI_DSI 63 65 depends on ARCH_SH73A0 64 66 65 67 config MACH_MACKEREL
+178 -2
arch/arm/mach-shmobile/board-ag5evm.c
··· 34 34 #include <linux/input/sh_keysc.h> 35 35 #include <linux/mmc/host.h> 36 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 40 #include <sound/sh_fsi.h> 39 - 40 41 #include <mach/hardware.h> 41 42 #include <mach/sh73a0.h> 42 43 #include <mach/common.h> ··· 184 183 .resource = sh_mmcif_resources, 185 184 }; 186 185 186 + /* IrDA */ 187 + static struct resource irda_resources[] = { 188 + [0] = { 189 + .start = 0xE6D00000, 190 + .end = 0xE6D01FD4 - 1, 191 + .flags = IORESOURCE_MEM, 192 + }, 193 + [1] = { 194 + .start = gic_spi(95), 195 + .flags = IORESOURCE_IRQ, 196 + }, 197 + }; 198 + 199 + static struct platform_device irda_device = { 200 + .name = "sh_irda", 201 + .id = 0, 202 + .resource = irda_resources, 203 + .num_resources = ARRAY_SIZE(irda_resources), 204 + }; 205 + 206 + static unsigned char lcd_backlight_seq[3][2] = { 207 + { 0x04, 0x07 }, 208 + { 0x23, 0x80 }, 209 + { 0x03, 0x01 }, 210 + }; 211 + 212 + static void lcd_backlight_on(void) 213 + { 214 + struct i2c_adapter *a; 215 + struct i2c_msg msg; 216 + int k; 217 + 218 + a = i2c_get_adapter(1); 219 + for (k = 0; a && k < 3; k++) { 220 + msg.addr = 0x6d; 221 + msg.buf = &lcd_backlight_seq[k][0]; 222 + msg.len = 2; 223 + msg.flags = 0; 224 + if (i2c_transfer(a, &msg, 1) != 1) 225 + break; 226 + } 227 + } 228 + 229 + static void lcd_backlight_reset(void) 230 + { 231 + gpio_set_value(GPIO_PORT235, 0); 232 + mdelay(24); 233 + gpio_set_value(GPIO_PORT235, 1); 234 + } 235 + 236 + static void lcd_on(void *board_data, struct fb_info *info) 237 + { 238 + lcd_backlight_on(); 239 + } 240 + 241 + static void lcd_off(void *board_data) 242 + { 243 + lcd_backlight_reset(); 244 + } 245 + 246 + /* LCDC0 */ 247 + static const struct fb_videomode lcdc0_modes[] = { 248 + { 249 + .name = "R63302(QHD)", 250 + .xres = 544, 251 + .yres = 961, 252 + .left_margin = 72, 253 + .right_margin = 600, 254 + .hsync_len = 16, 255 + .upper_margin = 8, 256 + .lower_margin = 8, 257 + .vsync_len = 2, 258 + .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT, 259 + }, 260 + }; 261 + 262 + static struct sh_mobile_lcdc_info lcdc0_info = { 263 + .clock_source = LCDC_CLK_PERIPHERAL, 264 + .ch[0] = { 265 + .chan = LCDC_CHAN_MAINLCD, 266 + .interface_type = RGB24, 267 + .clock_divider = 1, 268 + .flags = LCDC_FLAGS_DWPOL, 269 + .lcd_size_cfg.width = 44, 270 + .lcd_size_cfg.height = 79, 271 + .bpp = 16, 272 + .lcd_cfg = lcdc0_modes, 273 + .num_cfg = ARRAY_SIZE(lcdc0_modes), 274 + .board_cfg = { 275 + .display_on = lcd_on, 276 + .display_off = lcd_off, 277 + }, 278 + } 279 + }; 280 + 281 + static struct resource lcdc0_resources[] = { 282 + [0] = { 283 + .name = "LCDC0", 284 + .start = 0xfe940000, /* P4-only space */ 285 + .end = 0xfe943fff, 286 + .flags = IORESOURCE_MEM, 287 + }, 288 + [1] = { 289 + .start = intcs_evt2irq(0x580), 290 + .flags = IORESOURCE_IRQ, 291 + }, 292 + }; 293 + 294 + static struct platform_device lcdc0_device = { 295 + .name = "sh_mobile_lcdc_fb", 296 + .num_resources = ARRAY_SIZE(lcdc0_resources), 297 + .resource = lcdc0_resources, 298 + .id = 0, 299 + .dev = { 300 + .platform_data = &lcdc0_info, 301 + .coherent_dma_mask = ~0, 302 + }, 303 + }; 304 + 305 + /* MIPI-DSI */ 306 + static struct resource mipidsi0_resources[] = { 307 + [0] = { 308 + .start = 0xfeab0000, 309 + .end = 0xfeab3fff, 310 + .flags = IORESOURCE_MEM, 311 + }, 312 + [1] = { 313 + .start = 0xfeab4000, 314 + .end = 0xfeab7fff, 315 + .flags = IORESOURCE_MEM, 316 + }, 317 + }; 318 + 319 + static struct sh_mipi_dsi_info mipidsi0_info = { 320 + .data_format = MIPI_RGB888, 321 + .lcd_chan = &lcdc0_info.ch[0], 322 + .vsynw_offset = 20, 323 + .clksrc = 1, 324 + .flags = SH_MIPI_DSI_HSABM, 325 + }; 326 + 327 + static struct platform_device mipidsi0_device = { 328 + .name = "sh-mipi-dsi", 329 + .num_resources = ARRAY_SIZE(mipidsi0_resources), 330 + .resource = mipidsi0_resources, 331 + .id = 0, 332 + .dev = { 333 + .platform_data = &mipidsi0_info, 334 + }, 335 + }; 336 + 187 337 static struct platform_device *ag5evm_devices[] __initdata = { 188 338 &eth_device, 189 339 &keysc_device, 190 340 &fsi_device, 191 341 &mmc_device, 342 + &irda_device, 343 + &lcdc0_device, 344 + &mipidsi0_device, 192 345 }; 193 346 194 347 static struct map_desc ag5evm_io_desc[] __initdata = { ··· 378 223 __raw_writel(__raw_readl(PINTER0A) | (1<<29), PINTER0A); 379 224 __raw_writew(__raw_readw(PINTCR0A) | (2<<10), PINTCR0A); 380 225 } 226 + 227 + #define DSI0PHYCR 0xe615006c 381 228 382 229 static void __init ag5evm_init(void) 383 230 { ··· 443 286 gpio_request(GPIO_FN_FSIAIBT, NULL); 444 287 gpio_request(GPIO_FN_FSIAISLD, NULL); 445 288 gpio_request(GPIO_FN_FSIAOSLD, NULL); 289 + 290 + /* IrDA */ 291 + gpio_request(GPIO_FN_PORT241_IRDA_OUT, NULL); 292 + gpio_request(GPIO_FN_PORT242_IRDA_IN, NULL); 293 + gpio_request(GPIO_FN_PORT243_IRDA_FIRSEL, NULL); 294 + 295 + /* LCD panel */ 296 + gpio_request(GPIO_PORT217, NULL); /* RESET */ 297 + gpio_direction_output(GPIO_PORT217, 0); 298 + mdelay(1); 299 + gpio_set_value(GPIO_PORT217, 1); 300 + 301 + /* LCD backlight controller */ 302 + gpio_request(GPIO_PORT235, NULL); /* RESET */ 303 + gpio_direction_output(GPIO_PORT235, 0); 304 + lcd_backlight_reset(); 305 + 306 + /* MIPI-DSI clock setup */ 307 + __raw_writel(0x2a809010, DSI0PHYCR); 446 308 447 309 #ifdef CONFIG_CACHE_L2X0 448 310 /* Shared attribute override enable, 64K*8way */
-1
arch/arm/mach-shmobile/board-g3evm.c
··· 347 347 gpio_request(GPIO_FN_IRDA_OUT, NULL); 348 348 gpio_request(GPIO_FN_IRDA_IN, NULL); 349 349 gpio_request(GPIO_FN_IRDA_FIRSEL, NULL); 350 - set_irq_type(evt2irq(0x480), IRQ_TYPE_LEVEL_LOW); 351 350 352 351 sh7367_add_standard_devices(); 353 352
+2 -3
arch/arm/mach-shmobile/board-mackerel.c
··· 169 169 * SW1 | SW33 170 170 * | bit1 | bit2 | bit3 | bit4 171 171 * -------------+------+------+------+------- 172 - * MMC0 OFF | OFF | ON | ON | X 173 - * MMC1 ON | OFF | ON | X | ON 174 - * SDHI1 OFF | ON | X | OFF | ON 172 + * MMC0 OFF | OFF | X | ON | X (Use MMCIF) 173 + * SDHI1 OFF | ON | X | OFF | X (Use MFD_SH_MOBILE_SDHI) 175 174 * 176 175 */ 177 176
+3 -1
arch/arm/mach-shmobile/clock-sh7372.c
··· 234 234 235 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 241 return 0; 240 242 }
+25 -4
arch/arm/mach-shmobile/clock-sh73a0.c
··· 118 118 { 119 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 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 132 return clk->parent->rate * mult; 125 133 } ··· 220 212 static struct clk div4_clks[DIV4_NR] = { 221 213 [DIV4_I] = DIV4(FRQCRA, 20, 0xfff, CLK_ENABLE_ON_INIT), 222 214 [DIV4_ZG] = DIV4(FRQCRA, 16, 0xbff, CLK_ENABLE_ON_INIT), 223 - [DIV4_M3] = DIV4(FRQCRA, 8, 0xfff, CLK_ENABLE_ON_INIT), 215 + [DIV4_M3] = DIV4(FRQCRA, 12, 0xfff, CLK_ENABLE_ON_INIT), 224 216 [DIV4_B] = DIV4(FRQCRA, 8, 0xfff, CLK_ENABLE_ON_INIT), 225 217 [DIV4_M1] = DIV4(FRQCRA, 4, 0xfff, 0), 226 218 [DIV4_M2] = DIV4(FRQCRA, 0, 0xfff, 0), ··· 263 255 }; 264 256 265 257 enum { MSTP001, 266 - MSTP125, MSTP116, 258 + MSTP125, MSTP118, MSTP116, MSTP100, 267 259 MSTP219, 268 260 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, 269 - MSTP331, MSTP329, MSTP323, MSTP312, 261 + MSTP331, MSTP329, MSTP325, MSTP323, MSTP312, 270 262 MSTP411, MSTP410, MSTP403, 271 263 MSTP_NR }; 272 264 ··· 276 268 static struct clk mstp_clks[MSTP_NR] = { 277 269 [MSTP001] = MSTP(&div4_clks[DIV4_HP], SMSTPCR0, 1, 0), /* IIC2 */ 278 270 [MSTP125] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */ 271 + [MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, 0), /* DSITX0 */ 279 272 [MSTP116] = MSTP(&div4_clks[DIV4_HP], SMSTPCR1, 16, 0), /* IIC0 */ 273 + [MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */ 280 274 [MSTP219] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 19, 0), /* SCIFA7 */ 281 275 [MSTP207] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */ 282 276 [MSTP206] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */ ··· 289 279 [MSTP200] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 0, 0), /* SCIFA4 */ 290 280 [MSTP331] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 31, 0), /* SCIFA6 */ 291 281 [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */ 282 + [MSTP325] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 25, 0), /* IrDA */ 292 283 [MSTP323] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 23, 0), /* IIC1 */ 293 284 [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMCIF0 */ 294 285 [MSTP411] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 11, 0), /* IIC3 */ ··· 299 288 300 289 #define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } 301 290 #define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk } 291 + #define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk } 302 292 303 293 static struct clk_lookup lookups[] = { 304 294 /* main clocks */ 305 295 CLKDEV_CON_ID("r_clk", &r_clk), 306 296 297 + /* DIV6 clocks */ 298 + CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]), 299 + CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]), 300 + CLKDEV_ICK_ID("dsi0p_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]), 301 + CLKDEV_ICK_ID("dsi1p_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]), 302 + 307 303 /* MSTP32 clocks */ 308 304 CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */ 305 + CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */ 309 306 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]), /* TMU00 */ 310 307 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP125]), /* TMU01 */ 311 308 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* I2C0 */ 309 + CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX */ 312 310 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */ 313 311 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */ 314 312 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */ ··· 328 308 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */ 329 309 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */ 330 310 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */ 311 + CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */ 331 312 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */ 332 313 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */ 333 314 CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* I2C3 */
+7 -4
arch/arm/mach-shmobile/intc-sh7372.c
··· 365 365 366 366 enum { 367 367 UNUSED_INTCS = 0, 368 + ENABLED_INTCS, 368 369 369 370 INTCS, 370 371 ··· 414 413 CMT4, 415 414 DSITX1_DSITX1_0, 416 415 DSITX1_DSITX1_1, 417 - /* MFIS2 */ 416 + MFIS2_INTCS, /* Priority always enabled using ENABLED_INTCS */ 418 417 CPORTS2R, 419 418 /* CEC */ 420 419 JPU6E, ··· 478 477 INTCS_VECT(CMT4, 0x1980), 479 478 INTCS_VECT(DSITX1_DSITX1_0, 0x19a0), 480 479 INTCS_VECT(DSITX1_DSITX1_1, 0x19c0), 481 - /* MFIS2 */ 480 + INTCS_VECT(MFIS2_INTCS, 0x1a00), 482 481 INTCS_VECT(CPORTS2R, 0x1a20), 483 482 /* CEC */ 484 483 INTCS_VECT(JPU6E, 0x1a80), ··· 544 543 { 0, TMU1_TUNI2, TMU1_TUNI1, TMU1_TUNI0, 545 544 CMT4, DSITX1_DSITX1_0, DSITX1_DSITX1_1, 0 } }, 546 545 { 0xffd5019c, 0xffd501dc, 8, /* IMR7SA3 / IMCR7SA3 */ 547 - { 0, CPORTS2R, 0, 0, 546 + { MFIS2_INTCS, CPORTS2R, 0, 0, 548 547 JPU6E, 0, 0, 0 } }, 549 548 { 0xffd20104, 0, 16, /* INTAMASK */ 550 549 { 0, 0, 0, 0, 0, 0, 0, 0, ··· 572 571 { 0xffd50030, 0, 16, 4, /* IPRMS3 */ { TMU1, 0, 0, 0 } }, 573 572 { 0xffd50034, 0, 16, 4, /* IPRNS3 */ { CMT4, DSITX1_DSITX1_0, 574 573 DSITX1_DSITX1_1, 0 } }, 575 - { 0xffd50038, 0, 16, 4, /* IPROS3 */ { 0, CPORTS2R, 0, 0 } }, 574 + { 0xffd50038, 0, 16, 4, /* IPROS3 */ { ENABLED_INTCS, CPORTS2R, 575 + 0, 0 } }, 576 576 { 0xffd5003c, 0, 16, 4, /* IPRPS3 */ { JPU6E, 0, 0, 0 } }, 577 577 }; 578 578 ··· 592 590 593 591 static struct intc_desc intcs_desc __initdata = { 594 592 .name = "sh7372-intcs", 593 + .force_enable = ENABLED_INTCS, 595 594 .resource = intcs_resources, 596 595 .num_resources = ARRAY_SIZE(intcs_resources), 597 596 .hw = INTC_HW_DESC(intcs_vectors, intcs_groups, intcs_mask_registers,
+3 -2
arch/arm/mach-shmobile/intc-sh73a0.c
··· 252 252 253 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 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 261 register_intc_controller(&intcs_desc); 261 262
+61
arch/arm/mach-tegra/include/mach/kbc.h
··· 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
+6 -4
arch/arm/mach-versatile/Kconfig
··· 2 2 depends on ARCH_VERSATILE 3 3 4 4 config ARCH_VERSATILE_PB 5 - bool "Support Versatile/PB platform" 5 + bool "Support Versatile Platform Baseboard for ARM926EJ-S" 6 6 select CPU_ARM926T 7 7 select MIGHT_HAVE_PCI 8 8 default y 9 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 13 config MACH_VERSATILE_AB 13 - bool "Support Versatile/AB platform" 14 + bool "Support Versatile Application Baseboard for ARM926EJ-S" 14 15 select CPU_ARM926T 15 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 20 endmenu
+1 -1
arch/arm/mach-vexpress/platsmp.c
··· 39 39 * observers, irrespective of whether they're taking part in coherency 40 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 44 pen_release = val; 45 45 smp_wmb();
+9
arch/arm/mach-vexpress/v2m.c
··· 19 19 #include <asm/mach/time.h> 20 20 #include <asm/hardware/arm_timer.h> 21 21 #include <asm/hardware/timer-sp.h> 22 + #include <asm/hardware/sp810.h> 22 23 23 24 #include <mach/motherboard.h> 24 25 ··· 51 50 52 51 static void __init v2m_timer_init(void) 53 52 { 53 + u32 scctrl; 54 + 54 55 versatile_sched_clock_init(MMIO_P2V(V2M_SYS_24MHZ), 24000000); 56 + 57 + /* Select 1MHz TIMCLK as the reference clock for SP804 timers */ 58 + scctrl = readl(MMIO_P2V(V2M_SYSCTL + SCCTRL)); 59 + scctrl |= SCCTRL_TIMEREN0SEL_TIMCLK; 60 + scctrl |= SCCTRL_TIMEREN1SEL_TIMCLK; 61 + writel(scctrl, MMIO_P2V(V2M_SYSCTL + SCCTRL)); 55 62 56 63 writel(0, MMIO_P2V(V2M_TIMER0) + TIMER_CTRL); 57 64 writel(0, MMIO_P2V(V2M_TIMER1) + TIMER_CTRL);
+2 -6
arch/arm/plat-omap/Kconfig
··· 144 144 config OMAP_IOMMU_IVA2 145 145 bool 146 146 147 - choice 148 - prompt "System timer" 149 - default OMAP_32K_TIMER if !ARCH_OMAP15XX 150 - 151 147 config OMAP_MPU_TIMER 152 148 bool "Use mpu timer" 149 + depends on ARCH_OMAP1 153 150 help 154 151 Select this option if you want to use the OMAP mpu timer. This 155 152 timer provides more intra-tick resolution than the 32KHz timer, ··· 155 158 config OMAP_32K_TIMER 156 159 bool "Use 32KHz timer" 157 160 depends on ARCH_OMAP16XX || ARCH_OMAP2PLUS 161 + default y if (ARCH_OMAP16XX || ARCH_OMAP2PLUS) 158 162 help 159 163 Select this option if you want to enable the OMAP 32KHz timer. 160 164 This timer saves power compared to the OMAP_MPU_TIMER, and has 161 165 support for no tick during idle. The 32KHz timer provides less 162 166 intra-tick resolution than OMAP_MPU_TIMER. The 32KHz timer is 163 167 currently only available for OMAP16XX, 24XX, 34XX and OMAP4. 164 - 165 - endchoice 166 168 167 169 config OMAP3_L2_AUX_SECURE_SAVE_RESTORE 168 170 bool "OMAP3 HS/EMU save and restore for L2 AUX control register"
+14 -8
arch/arm/plat-omap/counter_32k.c
··· 36 36 37 37 #define OMAP16XX_TIMER_32K_SYNCHRONIZED 0xfffbc410 38 38 39 - #if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX)) 40 - 41 39 #include <linux/clocksource.h> 42 40 43 41 /* ··· 120 122 #define SC_MULT 4000000000u 121 123 #define SC_SHIFT 17 122 124 123 - unsigned long long notrace sched_clock(void) 125 + static inline unsigned long long notrace _omap_32k_sched_clock(void) 124 126 { 125 127 u32 cyc = clocksource_32k.read(&clocksource_32k); 126 128 return cyc_to_fixed_sched_clock(&cd, cyc, (u32)~0, SC_MULT, SC_SHIFT); 127 129 } 130 + 131 + #ifndef CONFIG_OMAP_MPU_TIMER 132 + unsigned long long notrace sched_clock(void) 133 + { 134 + return _omap_32k_sched_clock(); 135 + } 136 + #else 137 + unsigned long long notrace omap_32k_sched_clock(void) 138 + { 139 + return _omap_32k_sched_clock(); 140 + } 141 + #endif 128 142 129 143 static void notrace omap_update_sched_clock(void) 130 144 { ··· 170 160 *ts = *tsp; 171 161 } 172 162 173 - static int __init omap_init_clocksource_32k(void) 163 + int __init omap_init_clocksource_32k(void) 174 164 { 175 165 static char err[] __initdata = KERN_ERR 176 166 "%s: can't register clocksource!\n"; ··· 205 195 } 206 196 return 0; 207 197 } 208 - arch_initcall(omap_init_clocksource_32k); 209 - 210 - #endif /* !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX)) */ 211 -
+3 -4
arch/arm/plat-omap/dma.c
··· 53 53 #endif 54 54 55 55 #define OMAP_DMA_ACTIVE 0x01 56 - #define OMAP2_DMA_CSR_CLEAR_MASK 0xffe 56 + #define OMAP2_DMA_CSR_CLEAR_MASK 0xffffffff 57 57 58 58 #define OMAP_FUNC_MUX_ARM_BASE (0xfffe1000 + 0xec) 59 59 ··· 1873 1873 printk(KERN_INFO "DMA misaligned error with device %d\n", 1874 1874 dma_chan[ch].dev_id); 1875 1875 1876 - p->dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR, ch); 1876 + p->dma_write(status, CSR, ch); 1877 1877 p->dma_write(1 << ch, IRQSTATUS_L0, ch); 1878 1878 /* read back the register to flush the write */ 1879 1879 p->dma_read(IRQSTATUS_L0, ch); ··· 1893 1893 OMAP_DMA_CHAIN_INCQHEAD(chain_id); 1894 1894 1895 1895 status = p->dma_read(CSR, ch); 1896 + p->dma_write(status, CSR, ch); 1896 1897 } 1897 - 1898 - p->dma_write(status, CSR, ch); 1899 1898 1900 1899 if (likely(dma_chan[ch].callback != NULL)) 1901 1900 dma_chan[ch].callback(ch, status, dma_chan[ch].data);
+3
arch/arm/plat-omap/include/plat/common.h
··· 35 35 36 36 extern void omap_map_common_io(void); 37 37 extern struct sys_timer omap_timer; 38 + extern bool omap_32k_timer_init(void); 39 + extern int __init omap_init_clocksource_32k(void); 40 + extern unsigned long long notrace omap_32k_sched_clock(void); 38 41 39 42 extern void omap_reserve(void); 40 43
+7 -9
arch/m68k/amiga/config.c
··· 610 610 611 611 static int __init amiga_savekmsg_setup(char *arg) 612 612 { 613 - static struct resource debug_res = { .name = "Debug" }; 614 - 615 613 if (!MACH_IS_AMIGA || strcmp(arg, "mem")) 616 - goto done; 614 + return 0; 617 615 618 - if (!AMIGAHW_PRESENT(CHIP_RAM)) { 619 - printk("Warning: no chipram present for debugging\n"); 620 - goto done; 616 + if (amiga_chip_size < SAVEKMSG_MAXMEM) { 617 + pr_err("Not enough chipram for debugging\n"); 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 624 savekmsg->magic1 = SAVEKMSG_MAGIC1; 625 625 savekmsg->magic2 = SAVEKMSG_MAGIC2; 626 626 savekmsg->magicptr = ZTWO_PADDR(savekmsg); ··· 628 628 629 629 amiga_console_driver.write = amiga_mem_console_write; 630 630 register_console(&amiga_console_driver); 631 - 632 - done: 633 631 return 0; 634 632 } 635 633
+2 -2
arch/m68k/atari/ataints.c
··· 388 388 } 389 389 390 390 if (ATARIHW_PRESENT(SCC) && !atari_SCC_reset_done) { 391 - scc.cha_a_ctrl = 9; 391 + atari_scc.cha_a_ctrl = 9; 392 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 396 if (ATARIHW_PRESENT(SCU)) {
+1 -1
arch/m68k/atari/config.c
··· 315 315 ATARIHW_SET(SCC_DMA); 316 316 printk("SCC_DMA "); 317 317 } 318 - if (scc_test(&scc.cha_a_ctrl)) { 318 + if (scc_test(&atari_scc.cha_a_ctrl)) { 319 319 ATARIHW_SET(SCC); 320 320 printk("SCC "); 321 321 }
+7 -7
arch/m68k/atari/debug.c
··· 53 53 { 54 54 do { 55 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 57 MFPDELAY(); 58 - scc.cha_b_data = c; 58 + atari_scc.cha_b_data = c; 59 59 } 60 60 61 61 static void atari_scc_console_write(struct console *co, const char *str, ··· 140 140 { 141 141 do { 142 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 144 MFPDELAY(); 145 - return scc.cha_b_data; 145 + return atari_scc.cha_b_data; 146 146 } 147 147 148 148 int atari_midi_console_wait_key(struct console *co) ··· 185 185 186 186 #define SCC_WRITE(reg, val) \ 187 187 do { \ 188 - scc.cha_b_ctrl = (reg); \ 188 + atari_scc.cha_b_ctrl = (reg); \ 189 189 MFPDELAY(); \ 190 - scc.cha_b_ctrl = (val); \ 190 + atari_scc.cha_b_ctrl = (val); \ 191 191 MFPDELAY(); \ 192 192 } while (0) 193 193 ··· 240 240 reg3 = (cflag & CSIZE) == CS8 ? 0xc0 : 0x40; 241 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 244 SCC_WRITE(9, 0xc0); /* reset */ 245 245 LONG_DELAY(); /* extra delay after WR9 access */ 246 246 SCC_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03)
+1 -1
arch/m68k/include/asm/atarihw.h
··· 449 449 u_char char_dummy3; 450 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 454 /* The ESCC (Z85230) in an Atari ST. The channels are reversed! */ 455 455 # define st_escc ((*(volatile struct SCC*)0xfffffa31))
-12
arch/m68k/include/asm/string.h
··· 81 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 84 #ifndef CONFIG_COLDFIRE 97 85 #define __HAVE_ARCH_STRCMP 98 86 static inline int strcmp(const char *cs, const char *ct)
+2 -2
arch/parisc/kernel/pdc_cons.c
··· 169 169 170 170 struct console *tmp; 171 171 172 - acquire_console_sem(); 172 + console_lock(); 173 173 for_each_console(tmp) 174 174 if (tmp == &pdc_cons) 175 175 break; 176 - release_console_sem(); 176 + console_unlock(); 177 177 178 178 if (!tmp) { 179 179 printk(KERN_INFO "PDC console driver not registered anymore, not creating %s\n", pdc_cons.name);
+1
arch/powerpc/kernel/perf_event_fsl_emb.c
··· 596 596 if (left <= 0) 597 597 left = period; 598 598 record = 1; 599 + event->hw.last_period = event->hw.sample_period; 599 600 } 600 601 if (left < 0x80000000LL) 601 602 val = 0x80000000LL - left;
+1
arch/sh/Kconfig
··· 15 15 select HAVE_KERNEL_GZIP 16 16 select HAVE_KERNEL_BZIP2 17 17 select HAVE_KERNEL_LZMA 18 + select HAVE_KERNEL_XZ 18 19 select HAVE_KERNEL_LZO 19 20 select HAVE_SYSCALL_TRACEPOINTS 20 21 select HAVE_REGS_AND_STACK_ACCESS_API
+2 -1
arch/sh/Makefile
··· 200 200 libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y) 201 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 204 uImage.srec uImage.bin zImage vmlinux.bin vmlinux.srec \ 205 205 romImage 206 206 PHONY += $(BOOT_TARGETS) ··· 230 230 @echo '* uImage.gz - Kernel-only image for U-Boot (gzip)' 231 231 @echo ' uImage.bz2 - Kernel-only image for U-Boot (bzip2)' 232 232 @echo ' uImage.lzma - Kernel-only image for U-Boot (lzma)' 233 + @echo ' uImage.xz - Kernel-only image for U-Boot (xz)' 233 234 @echo ' uImage.lzo - Kernel-only image for U-Boot (lzo)' 234 235 endef
+2
arch/sh/boards/mach-ecovec24/setup.c
··· 1294 1294 i2c_register_board_info(1, i2c1_devices, 1295 1295 ARRAY_SIZE(i2c1_devices)); 1296 1296 1297 + #if defined(CONFIG_VIDEO_SH_VOU) || defined(CONFIG_VIDEO_SH_VOU_MODULE) 1297 1298 /* VOU */ 1298 1299 gpio_request(GPIO_FN_DV_D15, NULL); 1299 1300 gpio_request(GPIO_FN_DV_D14, NULL); ··· 1326 1325 1327 1326 /* Remove reset */ 1328 1327 gpio_set_value(GPIO_PTG4, 1); 1328 + #endif 1329 1329 1330 1330 return platform_add_devices(ecovec_devices, 1331 1331 ARRAY_SIZE(ecovec_devices));
+9 -2
arch/sh/boot/Makefile
··· 24 24 suffix-$(CONFIG_KERNEL_GZIP) := gz 25 25 suffix-$(CONFIG_KERNEL_BZIP2) := bz2 26 26 suffix-$(CONFIG_KERNEL_LZMA) := lzma 27 + suffix-$(CONFIG_KERNEL_XZ) := xz 27 28 suffix-$(CONFIG_KERNEL_LZO) := lzo 28 29 29 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 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 34 subdir- := compressed romimage 34 35 35 36 $(obj)/zImage: $(obj)/compressed/vmlinux FORCE ··· 77 76 $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE 78 77 $(call if_changed,lzma) 79 78 79 + $(obj)/vmlinux.bin.xz: $(obj)/vmlinux.bin FORCE 80 + $(call if_changed,xzkern) 81 + 80 82 $(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE 81 83 $(call if_changed,lzo) 82 84 ··· 91 87 92 88 $(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma 93 89 $(call if_changed,uimage,lzma) 90 + 91 + $(obj)/uImage.xz: $(obj)/vmlinux.bin.xz 92 + $(call if_changed,uimage,xz) 94 93 95 94 $(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo 96 95 $(call if_changed,uimage,lzo)
+3 -1
arch/sh/boot/compressed/Makefile
··· 6 6 7 7 targets := vmlinux vmlinux.bin vmlinux.bin.gz \ 8 8 vmlinux.bin.bz2 vmlinux.bin.lzma \ 9 - vmlinux.bin.lzo \ 9 + vmlinux.bin.xz vmlinux.bin.lzo \ 10 10 head_$(BITS).o misc.o piggy.o 11 11 12 12 OBJECTS = $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/cache.o ··· 50 50 $(call if_changed,bzip2) 51 51 $(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE 52 52 $(call if_changed,lzma) 53 + $(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE 54 + $(call if_changed,xzkern) 53 55 $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE 54 56 $(call if_changed,lzo) 55 57
+4
arch/sh/boot/compressed/misc.c
··· 61 61 #include "../../../../lib/decompress_unlzma.c" 62 62 #endif 63 63 64 + #ifdef CONFIG_KERNEL_XZ 65 + #include "../../../../lib/decompress_unxz.c" 66 + #endif 67 + 64 68 #ifdef CONFIG_KERNEL_LZO 65 69 #include "../../../../lib/decompress_unlzo.c" 66 70 #endif
+1
arch/sh/include/asm/pgtable.h
··· 134 134 extern void pgtable_cache_init(void); 135 135 136 136 struct vm_area_struct; 137 + struct mm_struct; 137 138 138 139 extern void __update_cache(struct vm_area_struct *vma, 139 140 unsigned long address, pte_t pte);
+3 -3
arch/sh/kernel/cpu/sh4/setup-sh7750.c
··· 230 230 static int __init sh7750_devices_setup(void) 231 231 { 232 232 if (mach_is_rts7751r2d()) { 233 - platform_register_device(&scif_device); 233 + platform_device_register(&scif_device); 234 234 } else { 235 - platform_register_device(&sci_device); 236 - platform_register_device(&scif_device); 235 + platform_device_register(&sci_device); 236 + platform_device_register(&scif_device); 237 237 } 238 238 239 239 return platform_add_devices(sh7750_devices,
+1
arch/sh/kernel/topology.c
··· 17 17 static DEFINE_PER_CPU(struct cpu, cpu_devices); 18 18 19 19 cpumask_t cpu_core_map[NR_CPUS]; 20 + EXPORT_SYMBOL(cpu_core_map); 20 21 21 22 static cpumask_t cpu_coregroup_map(unsigned int cpu) 22 23 {
+1 -41
arch/x86/include/asm/cacheflush.h
··· 1 1 #ifndef _ASM_X86_CACHEFLUSH_H 2 2 #define _ASM_X86_CACHEFLUSH_H 3 3 4 - /* Keep includes the same across arches. */ 5 - #include <linux/mm.h> 6 - 7 4 /* Caches aren't brain-dead on the intel. */ 8 - static inline void flush_cache_all(void) { } 9 - static inline void flush_cache_mm(struct mm_struct *mm) { } 10 - static inline void flush_cache_dup_mm(struct mm_struct *mm) { } 11 - static inline void flush_cache_range(struct vm_area_struct *vma, 12 - unsigned long start, unsigned long end) { } 13 - static inline void flush_cache_page(struct vm_area_struct *vma, 14 - unsigned long vmaddr, unsigned long pfn) { } 15 - #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 16 - static inline void flush_dcache_page(struct page *page) { } 17 - static inline void flush_dcache_mmap_lock(struct address_space *mapping) { } 18 - static inline void flush_dcache_mmap_unlock(struct address_space *mapping) { } 19 - static inline void flush_icache_range(unsigned long start, 20 - unsigned long end) { } 21 - static inline void flush_icache_page(struct vm_area_struct *vma, 22 - struct page *page) { } 23 - static inline void flush_icache_user_range(struct vm_area_struct *vma, 24 - struct page *page, 25 - unsigned long addr, 26 - unsigned long len) { } 27 - static inline void flush_cache_vmap(unsigned long start, unsigned long end) { } 28 - static inline void flush_cache_vunmap(unsigned long start, 29 - unsigned long end) { } 30 - 31 - static inline void copy_to_user_page(struct vm_area_struct *vma, 32 - struct page *page, unsigned long vaddr, 33 - void *dst, const void *src, 34 - unsigned long len) 35 - { 36 - memcpy(dst, src, len); 37 - } 38 - 39 - static inline void copy_from_user_page(struct vm_area_struct *vma, 40 - struct page *page, unsigned long vaddr, 41 - void *dst, const void *src, 42 - unsigned long len) 43 - { 44 - memcpy(dst, src, len); 45 - } 5 + #include <asm-generic/cacheflush.h> 46 6 47 7 #ifdef CONFIG_X86_PAT 48 8 /*
+1
arch/x86/include/asm/cpu.h
··· 32 32 33 33 DECLARE_PER_CPU(int, cpu_state); 34 34 35 + int __cpuinit mwait_usable(const struct cpuinfo_x86 *); 35 36 36 37 #endif /* _ASM_X86_CPU_H */
+1 -1
arch/x86/include/asm/jump_label.h
··· 14 14 do { \ 15 15 asm goto("1:" \ 16 16 JUMP_LABEL_INITIAL_NOP \ 17 - ".pushsection __jump_table, \"a\" \n\t"\ 17 + ".pushsection __jump_table, \"aw\" \n\t"\ 18 18 _ASM_PTR "1b, %l[" #label "], %c0 \n\t" \ 19 19 ".popsection \n\t" \ 20 20 : : "i" (key) : : label); \
+2 -3
arch/x86/include/asm/paravirt.h
··· 558 558 static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, 559 559 pmd_t *pmdp, pmd_t pmd) 560 560 { 561 - #if PAGETABLE_LEVELS >= 3 562 561 if (sizeof(pmdval_t) > sizeof(long)) 563 562 /* 5 arg words */ 564 563 pv_mmu_ops.set_pmd_at(mm, addr, pmdp, pmd); 565 564 else 566 - PVOP_VCALL4(pv_mmu_ops.set_pmd_at, mm, addr, pmdp, pmd.pmd); 567 - #endif 565 + PVOP_VCALL4(pv_mmu_ops.set_pmd_at, mm, addr, pmdp, 566 + native_pmd_val(pmd)); 568 567 } 569 568 #endif 570 569
+3
arch/x86/kernel/cpu/intel_cacheinfo.c
··· 45 45 { 0x0a, LVL_1_DATA, 8 }, /* 2 way set assoc, 32 byte line size */ 46 46 { 0x0c, LVL_1_DATA, 16 }, /* 4-way set assoc, 32 byte line size */ 47 47 { 0x0d, LVL_1_DATA, 16 }, /* 4-way set assoc, 64 byte line size */ 48 + { 0x0e, LVL_1_DATA, 24 }, /* 6-way set assoc, 64 byte line size */ 48 49 { 0x21, LVL_2, 256 }, /* 8-way set assoc, 64 byte line size */ 49 50 { 0x22, LVL_3, 512 }, /* 4-way set assoc, sectored cache, 64 byte line size */ 50 51 { 0x23, LVL_3, MB(1) }, /* 8-way set assoc, sectored cache, 64 byte line size */ ··· 67 66 { 0x45, LVL_2, MB(2) }, /* 4-way set assoc, 32 byte line size */ 68 67 { 0x46, LVL_3, MB(4) }, /* 4-way set assoc, 64 byte line size */ 69 68 { 0x47, LVL_3, MB(8) }, /* 8-way set assoc, 64 byte line size */ 69 + { 0x48, LVL_2, MB(3) }, /* 12-way set assoc, 64 byte line size */ 70 70 { 0x49, LVL_3, MB(4) }, /* 16-way set assoc, 64 byte line size */ 71 71 { 0x4a, LVL_3, MB(6) }, /* 12-way set assoc, 64 byte line size */ 72 72 { 0x4b, LVL_3, MB(8) }, /* 16-way set assoc, 64 byte line size */ ··· 89 87 { 0x7c, LVL_2, MB(1) }, /* 8-way set assoc, sectored cache, 64 byte line size */ 90 88 { 0x7d, LVL_2, MB(2) }, /* 8-way set assoc, 64 byte line size */ 91 89 { 0x7f, LVL_2, 512 }, /* 2-way set assoc, 64 byte line size */ 90 + { 0x80, LVL_2, 512 }, /* 8-way set assoc, 64 byte line size */ 92 91 { 0x82, LVL_2, 256 }, /* 8-way set assoc, 32 byte line size */ 93 92 { 0x83, LVL_2, 512 }, /* 8-way set assoc, 32 byte line size */ 94 93 { 0x84, LVL_2, MB(1) }, /* 8-way set assoc, 32 byte line size */
+1
arch/x86/kernel/cpu/mcheck/therm_throt.c
··· 59 59 60 60 /* Callback to handle core threshold interrupts */ 61 61 int (*platform_thermal_notify)(__u64 msr_val); 62 + EXPORT_SYMBOL(platform_thermal_notify); 62 63 63 64 static DEFINE_PER_CPU(struct thermal_state, thermal_state); 64 65
+2 -1
arch/x86/kernel/process.c
··· 14 14 #include <linux/utsname.h> 15 15 #include <trace/events/power.h> 16 16 #include <linux/hw_breakpoint.h> 17 + #include <asm/cpu.h> 17 18 #include <asm/system.h> 18 19 #include <asm/apic.h> 19 20 #include <asm/syscalls.h> ··· 506 505 #define MWAIT_ECX_EXTENDED_INFO 0x01 507 506 #define MWAIT_EDX_C1 0xf0 508 507 509 - static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c) 508 + int __cpuinit mwait_usable(const struct cpuinfo_x86 *c) 510 509 { 511 510 u32 eax, ebx, ecx, edx; 512 511
+2 -1
arch/x86/kernel/smpboot.c
··· 1402 1402 unsigned int highest_subcstate = 0; 1403 1403 int i; 1404 1404 void *mwait_ptr; 1405 + struct cpuinfo_x86 *c = __this_cpu_ptr(&cpu_info); 1405 1406 1406 - if (!cpu_has(__this_cpu_ptr(&cpu_info), X86_FEATURE_MWAIT)) 1407 + if (!(cpu_has(c, X86_FEATURE_MWAIT) && mwait_usable(c))) 1407 1408 return; 1408 1409 if (!cpu_has(__this_cpu_ptr(&cpu_info), X86_FEATURE_CLFLSH)) 1409 1410 return;
+9 -10
drivers/char/agp/intel-gtt.c
··· 68 68 phys_addr_t gma_bus_addr; 69 69 u32 PGETBL_save; 70 70 u32 __iomem *gtt; /* I915G */ 71 + bool clear_fake_agp; /* on first access via agp, fill with scratch */ 71 72 int num_dcache_entries; 72 73 union { 73 74 void __iomem *i9xx_flush_page; ··· 870 869 871 870 static int intel_fake_agp_configure(void) 872 871 { 873 - int i; 874 - 875 872 if (!intel_enable_gtt()) 876 873 return -EIO; 877 874 875 + intel_private.clear_fake_agp = true; 878 876 agp_bridge->gart_bus_addr = intel_private.gma_bus_addr; 879 - 880 - for (i = 0; i < intel_private.base.gtt_total_entries; i++) { 881 - intel_private.driver->write_entry(intel_private.scratch_page_dma, 882 - i, 0); 883 - } 884 - readl(intel_private.gtt+i-1); /* PCI Posting. */ 885 - 886 - global_cache_flush(); 887 877 888 878 return 0; 889 879 } ··· 936 944 off_t pg_start, int type) 937 945 { 938 946 int ret = -EINVAL; 947 + 948 + if (intel_private.clear_fake_agp) { 949 + int start = intel_private.base.stolen_size / PAGE_SIZE; 950 + int end = intel_private.base.gtt_mappable_entries; 951 + intel_gtt_clear_range(start, end - start); 952 + intel_private.clear_fake_agp = false; 953 + } 939 954 940 955 if (INTEL_GTT_GEN == 1 && type == AGP_DCACHE_MEMORY) 941 956 return i810_insert_dcache_entries(mem, pg_start, type);
+4 -4
drivers/char/bfin_jtag_comm.c
··· 183 183 } 184 184 185 185 #ifndef CONFIG_BFIN_JTAG_COMM_CONSOLE 186 - # define acquire_console_sem() 187 - # define release_console_sem() 186 + # define console_lock() 187 + # define console_unlock() 188 188 #endif 189 189 static int 190 190 bfin_jc_write(struct tty_struct *tty, const unsigned char *buf, int count) 191 191 { 192 192 int i; 193 - acquire_console_sem(); 193 + console_lock(); 194 194 i = bfin_jc_circ_write(buf, count); 195 - release_console_sem(); 195 + console_unlock(); 196 196 wake_up_process(bfin_jc_kthread); 197 197 return i; 198 198 }
+6 -4
drivers/char/tpm/tpm.c
··· 364 364 tpm_protected_ordinal_duration[ordinal & 365 365 TPM_PROTECTED_ORDINAL_MASK]; 366 366 367 - if (duration_idx != TPM_UNDEFINED) 367 + if (duration_idx != TPM_UNDEFINED) { 368 368 duration = chip->vendor.duration[duration_idx]; 369 - if (duration <= 0) 369 + /* if duration is 0, it's because chip->vendor.duration wasn't */ 370 + /* filled yet, so we set the lowest timeout just to give enough */ 371 + /* time for tpm_get_timeouts() to succeed */ 372 + return (duration <= 0 ? HZ : duration); 373 + } else 370 374 return 2 * 60 * HZ; 371 - else 372 - return duration; 373 375 } 374 376 EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration); 375 377
+3 -3
drivers/char/tpm/tpm_tis.c
··· 493 493 "1.2 TPM (device-id 0x%X, rev-id %d)\n", 494 494 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); 495 495 496 - if (is_itpm(to_pnp_dev(dev))) 497 - itpm = 1; 498 - 499 496 if (itpm) 500 497 dev_info(dev, "Intel iTPM workaround enabled\n"); 501 498 ··· 633 636 irq = pnp_irq(pnp_dev, 0); 634 637 else 635 638 interrupts = 0; 639 + 640 + if (is_itpm(pnp_dev)) 641 + itpm = 1; 636 642 637 643 return tpm_tis_init(&pnp_dev->dev, start, len, irq); 638 644 }
+5 -1
drivers/clocksource/acpi_pm.c
··· 202 202 printk(KERN_INFO "PM-Timer had inconsistent results:" 203 203 " 0x%#llx, 0x%#llx - aborting.\n", 204 204 value1, value2); 205 + pmtmr_ioport = 0; 205 206 return -EINVAL; 206 207 } 207 208 if (i == ACPI_PM_READ_CHECKS) { 208 209 printk(KERN_INFO "PM-Timer failed consistency check " 209 210 " (0x%#llx) - aborting.\n", value1); 211 + pmtmr_ioport = 0; 210 212 return -ENODEV; 211 213 } 212 214 } 213 215 214 - if (verify_pmtmr_rate() != 0) 216 + if (verify_pmtmr_rate() != 0){ 217 + pmtmr_ioport = 0; 215 218 return -ENODEV; 219 + } 216 220 217 221 return clocksource_register_hz(&clocksource_acpi_pm, 218 222 PMTMR_TICKS_PER_SEC);
+2 -2
drivers/clocksource/tcb_clksrc.c
··· 196 196 clkevt.clkevt.min_delta_ns = clockevent_delta2ns(1, &clkevt.clkevt) + 1; 197 197 clkevt.clkevt.cpumask = cpumask_of(0); 198 198 199 - setup_irq(irq, &tc_irqaction); 200 - 201 199 clockevents_register_device(&clkevt.clkevt); 200 + 201 + setup_irq(irq, &tc_irqaction); 202 202 } 203 203 204 204 #else /* !CONFIG_GENERIC_CLOCKEVENTS */
+7 -2
drivers/gpio/langwell_gpio.c
··· 187 187 188 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 191 u32 base, gpio; 192 192 void __iomem *gedr; 193 193 u32 gedr_v; ··· 206 206 /* clear the edge detect status bit */ 207 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 217 static int __devinit lnw_gpio_probe(struct pci_dev *pdev,
+3
drivers/gpu/drm/Kconfig
··· 100 100 config DRM_I915 101 101 tristate "i915 driver" 102 102 depends on AGP_INTEL 103 + # we need shmfs for the swappable backing store, and in particular 104 + # the shmem_readpage() which depends upon tmpfs 103 105 select SHMEM 106 + select TMPFS 104 107 select DRM_KMS_HELPER 105 108 select FB_CFB_FILLRECT 106 109 select FB_CFB_COPYAREA
+15 -20
drivers/gpu/drm/i915/i915_dma.c
··· 152 152 { 153 153 drm_i915_private_t *dev_priv = dev->dev_private; 154 154 struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv; 155 - struct intel_ring_buffer *ring = LP_RING(dev_priv); 155 + int ret; 156 156 157 157 master_priv->sarea = drm_getsarea(dev); 158 158 if (master_priv->sarea) { ··· 163 163 } 164 164 165 165 if (init->ring_size != 0) { 166 - if (ring->obj != NULL) { 166 + if (LP_RING(dev_priv)->obj != NULL) { 167 167 i915_dma_cleanup(dev); 168 168 DRM_ERROR("Client tried to initialize ringbuffer in " 169 169 "GEM mode\n"); 170 170 return -EINVAL; 171 171 } 172 172 173 - ring->size = init->ring_size; 174 - 175 - ring->map.offset = init->ring_start; 176 - ring->map.size = init->ring_size; 177 - ring->map.type = 0; 178 - ring->map.flags = 0; 179 - ring->map.mtrr = 0; 180 - 181 - drm_core_ioremap_wc(&ring->map, dev); 182 - 183 - if (ring->map.handle == NULL) { 173 + ret = intel_render_ring_init_dri(dev, 174 + init->ring_start, 175 + init->ring_size); 176 + if (ret) { 184 177 i915_dma_cleanup(dev); 185 - DRM_ERROR("can not ioremap virtual address for" 186 - " ring buffer\n"); 187 - return -ENOMEM; 178 + return ret; 188 179 } 189 180 } 190 - 191 - ring->virtual_start = ring->map.handle; 192 181 193 182 dev_priv->cpp = init->cpp; 194 183 dev_priv->back_offset = init->back_offset; ··· 1215 1226 if (ret) 1216 1227 DRM_INFO("failed to find VBIOS tables\n"); 1217 1228 1218 - /* if we have > 1 VGA cards, then disable the radeon VGA resources */ 1229 + /* If we have > 1 VGA cards, then we need to arbitrate access 1230 + * to the common VGA resources. 1231 + * 1232 + * If we are a secondary display controller (!PCI_DISPLAY_CLASS_VGA), 1233 + * then we do not take part in VGA arbitration and the 1234 + * vga_client_register() fails with -ENODEV. 1235 + */ 1219 1236 ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode); 1220 - if (ret) 1237 + if (ret && ret != -ENODEV) 1221 1238 goto cleanup_ringbuffer; 1222 1239 1223 1240 intel_register_dsm_handler();
+4 -1
drivers/gpu/drm/i915/i915_drv.c
··· 60 60 61 61 #define INTEL_VGA_DEVICE(id, info) { \ 62 62 .class = PCI_CLASS_DISPLAY_VGA << 8, \ 63 - .class_mask = 0xffff00, \ 63 + .class_mask = 0xff0000, \ 64 64 .vendor = 0x8086, \ 65 65 .device = id, \ 66 66 .subvendor = PCI_ANY_ID, \ ··· 751 751 if (vgacon_text_force() && i915_modeset == -1) 752 752 driver.driver_features &= ~DRIVER_MODESET; 753 753 #endif 754 + 755 + if (!(driver.driver_features & DRIVER_MODESET)) 756 + driver.get_vblank_timestamp = NULL; 754 757 755 758 return drm_init(&driver); 756 759 }
+4 -1
drivers/gpu/drm/i915/i915_drv.h
··· 543 543 /** List of all objects in gtt_space. Used to restore gtt 544 544 * mappings on resume */ 545 545 struct list_head gtt_list; 546 - /** End of mappable part of GTT */ 546 + 547 + /** Usable portion of the GTT for GEM */ 548 + unsigned long gtt_start; 547 549 unsigned long gtt_mappable_end; 550 + unsigned long gtt_end; 548 551 549 552 struct io_mapping *gtt_mapping; 550 553 int gtt_mtrr;
+8 -4
drivers/gpu/drm/i915/i915_gem.c
··· 140 140 { 141 141 drm_i915_private_t *dev_priv = dev->dev_private; 142 142 143 - drm_mm_init(&dev_priv->mm.gtt_space, start, 144 - end - start); 143 + drm_mm_init(&dev_priv->mm.gtt_space, start, end - start); 145 144 145 + dev_priv->mm.gtt_start = start; 146 + dev_priv->mm.gtt_mappable_end = mappable_end; 147 + dev_priv->mm.gtt_end = end; 146 148 dev_priv->mm.gtt_total = end - start; 147 149 dev_priv->mm.mappable_gtt_total = min(end, mappable_end) - start; 148 - dev_priv->mm.gtt_mappable_end = mappable_end; 150 + 151 + /* Take over this portion of the GTT */ 152 + intel_gtt_clear_range(start / PAGE_SIZE, (end-start) / PAGE_SIZE); 149 153 } 150 154 151 155 int ··· 1861 1857 1862 1858 seqno = ring->get_seqno(ring); 1863 1859 1864 - for (i = 0; i < I915_NUM_RINGS; i++) 1860 + for (i = 0; i < ARRAY_SIZE(ring->sync_seqno); i++) 1865 1861 if (seqno >= ring->sync_seqno[i]) 1866 1862 ring->sync_seqno[i] = 0; 1867 1863
+1 -1
drivers/gpu/drm/i915/i915_gem_execbuffer.c
··· 1175 1175 goto err; 1176 1176 1177 1177 seqno = i915_gem_next_request_seqno(dev, ring); 1178 - for (i = 0; i < I915_NUM_RINGS-1; i++) { 1178 + for (i = 0; i < ARRAY_SIZE(ring->sync_seqno); i++) { 1179 1179 if (seqno < ring->sync_seqno[i]) { 1180 1180 /* The GPU can not handle its semaphore value wrapping, 1181 1181 * so every billion or so execbuffers, we need to stall
+4
drivers/gpu/drm/i915/i915_gem_gtt.c
··· 34 34 struct drm_i915_private *dev_priv = dev->dev_private; 35 35 struct drm_i915_gem_object *obj; 36 36 37 + /* First fill our portion of the GTT with scratch pages */ 38 + intel_gtt_clear_range(dev_priv->mm.gtt_start / PAGE_SIZE, 39 + (dev_priv->mm.gtt_end - dev_priv->mm.gtt_start) / PAGE_SIZE); 40 + 37 41 list_for_each_entry(obj, &dev_priv->mm.gtt_list, gtt_list) { 38 42 i915_gem_clflush_object(obj); 39 43
+27 -10
drivers/gpu/drm/i915/i915_irq.c
··· 274 274 return ret; 275 275 } 276 276 277 - int i915_get_vblank_timestamp(struct drm_device *dev, int crtc, 277 + int i915_get_vblank_timestamp(struct drm_device *dev, int pipe, 278 278 int *max_error, 279 279 struct timeval *vblank_time, 280 280 unsigned flags) 281 281 { 282 - struct drm_crtc *drmcrtc; 282 + struct drm_i915_private *dev_priv = dev->dev_private; 283 + struct drm_crtc *crtc; 283 284 284 - if (crtc < 0 || crtc >= dev->num_crtcs) { 285 - DRM_ERROR("Invalid crtc %d\n", crtc); 285 + if (pipe < 0 || pipe >= dev_priv->num_pipe) { 286 + DRM_ERROR("Invalid crtc %d\n", pipe); 286 287 return -EINVAL; 287 288 } 288 289 289 290 /* Get drm_crtc to timestamp: */ 290 - drmcrtc = intel_get_crtc_for_pipe(dev, crtc); 291 + crtc = intel_get_crtc_for_pipe(dev, pipe); 292 + if (crtc == NULL) { 293 + DRM_ERROR("Invalid crtc %d\n", pipe); 294 + return -EINVAL; 295 + } 296 + 297 + if (!crtc->enabled) { 298 + DRM_DEBUG_KMS("crtc %d is disabled\n", pipe); 299 + return -EBUSY; 300 + } 291 301 292 302 /* Helper routine in DRM core does all the work: */ 293 - return drm_calc_vbltimestamp_from_scanoutpos(dev, crtc, max_error, 294 - vblank_time, flags, drmcrtc); 303 + return drm_calc_vbltimestamp_from_scanoutpos(dev, pipe, max_error, 304 + vblank_time, flags, 305 + crtc); 295 306 } 296 307 297 308 /* ··· 359 348 struct intel_ring_buffer *ring) 360 349 { 361 350 struct drm_i915_private *dev_priv = dev->dev_private; 362 - u32 seqno = ring->get_seqno(ring); 351 + u32 seqno; 363 352 353 + if (ring->obj == NULL) 354 + return; 355 + 356 + seqno = ring->get_seqno(ring); 364 357 trace_i915_gem_request_complete(dev, seqno); 365 358 366 359 ring->irq_seqno = seqno; ··· 846 831 i++; 847 832 error->pinned_bo_count = i - error->active_bo_count; 848 833 834 + error->active_bo = NULL; 835 + error->pinned_bo = NULL; 849 836 if (i) { 850 837 error->active_bo = kmalloc(sizeof(*error->active_bo)*i, 851 838 GFP_ATOMIC); ··· 1295 1278 if (master_priv->sarea_priv) 1296 1279 master_priv->sarea_priv->perf_boxes |= I915_BOX_WAIT; 1297 1280 1298 - ret = -ENODEV; 1299 1281 if (ring->irq_get(ring)) { 1300 1282 DRM_WAIT_ON(ret, ring->irq_queue, 3 * DRM_HZ, 1301 1283 READ_BREADCRUMB(dev_priv) >= irq_nr); 1302 1284 ring->irq_put(ring); 1303 - } 1285 + } else if (wait_for(READ_BREADCRUMB(dev_priv) >= irq_nr, 3000)) 1286 + ret = -EBUSY; 1304 1287 1305 1288 if (ret == -EBUSY) { 1306 1289 DRM_ERROR("EBUSY -- rec: %d emitted: %d\n",
+6
drivers/gpu/drm/i915/i915_reg.h
··· 513 513 #define GEN6_BLITTER_SYNC_STATUS (1 << 24) 514 514 #define GEN6_BLITTER_USER_INTERRUPT (1 << 22) 515 515 516 + #define GEN6_BLITTER_ECOSKPD 0x221d0 517 + #define GEN6_BLITTER_LOCK_SHIFT 16 518 + #define GEN6_BLITTER_FBC_NOTIFY (1<<3) 519 + 516 520 #define GEN6_BSD_SLEEP_PSMI_CONTROL 0x12050 517 521 #define GEN6_BSD_SLEEP_PSMI_CONTROL_RC_ILDL_MESSAGE_MODIFY_MASK (1 << 16) 518 522 #define GEN6_BSD_SLEEP_PSMI_CONTROL_RC_ILDL_MESSAGE_DISABLE (1 << 0) ··· 2630 2626 #define DISPLAY_PORT_PLL_BIOS_2 0x46014 2631 2627 2632 2628 #define PCH_DSPCLK_GATE_D 0x42020 2629 + # define DPFCUNIT_CLOCK_GATE_DISABLE (1 << 9) 2630 + # define DPFCRUNIT_CLOCK_GATE_DISABLE (1 << 8) 2633 2631 # define DPFDUNIT_CLOCK_GATE_DISABLE (1 << 7) 2634 2632 # define DPARBUNIT_CLOCK_GATE_DISABLE (1 << 5) 2635 2633
+24 -1
drivers/gpu/drm/i915/intel_display.c
··· 1213 1213 return I915_READ(DPFC_CONTROL) & DPFC_CTL_EN; 1214 1214 } 1215 1215 1216 + static void sandybridge_blit_fbc_update(struct drm_device *dev) 1217 + { 1218 + struct drm_i915_private *dev_priv = dev->dev_private; 1219 + u32 blt_ecoskpd; 1220 + 1221 + /* Make sure blitter notifies FBC of writes */ 1222 + __gen6_force_wake_get(dev_priv); 1223 + blt_ecoskpd = I915_READ(GEN6_BLITTER_ECOSKPD); 1224 + blt_ecoskpd |= GEN6_BLITTER_FBC_NOTIFY << 1225 + GEN6_BLITTER_LOCK_SHIFT; 1226 + I915_WRITE(GEN6_BLITTER_ECOSKPD, blt_ecoskpd); 1227 + blt_ecoskpd |= GEN6_BLITTER_FBC_NOTIFY; 1228 + I915_WRITE(GEN6_BLITTER_ECOSKPD, blt_ecoskpd); 1229 + blt_ecoskpd &= ~(GEN6_BLITTER_FBC_NOTIFY << 1230 + GEN6_BLITTER_LOCK_SHIFT); 1231 + I915_WRITE(GEN6_BLITTER_ECOSKPD, blt_ecoskpd); 1232 + POSTING_READ(GEN6_BLITTER_ECOSKPD); 1233 + __gen6_force_wake_put(dev_priv); 1234 + } 1235 + 1216 1236 static void ironlake_enable_fbc(struct drm_crtc *crtc, unsigned long interval) 1217 1237 { 1218 1238 struct drm_device *dev = crtc->dev; ··· 1286 1266 I915_WRITE(SNB_DPFC_CTL_SA, 1287 1267 SNB_CPU_FENCE_ENABLE | dev_priv->cfb_fence); 1288 1268 I915_WRITE(DPFC_CPU_FENCE_OFFSET, crtc->y); 1269 + sandybridge_blit_fbc_update(dev); 1289 1270 } 1290 1271 1291 1272 DRM_DEBUG_KMS("enabled fbc on plane %d\n", intel_crtc->plane); ··· 6307 6286 6308 6287 if (IS_GEN5(dev)) { 6309 6288 /* Required for FBC */ 6310 - dspclk_gate |= DPFDUNIT_CLOCK_GATE_DISABLE; 6289 + dspclk_gate |= DPFCUNIT_CLOCK_GATE_DISABLE | 6290 + DPFCRUNIT_CLOCK_GATE_DISABLE | 6291 + DPFDUNIT_CLOCK_GATE_DISABLE; 6311 6292 /* Required for CxSR */ 6312 6293 dspclk_gate |= DPARBUNIT_CLOCK_GATE_DISABLE; 6313 6294
+2 -1
drivers/gpu/drm/i915/intel_opregion.c
··· 26 26 */ 27 27 28 28 #include <linux/acpi.h> 29 + #include <linux/acpi_io.h> 29 30 #include <acpi/video.h> 30 31 31 32 #include "drmP.h" ··· 477 476 return -ENOTSUPP; 478 477 } 479 478 480 - base = ioremap(asls, OPREGION_SIZE); 479 + base = acpi_os_ioremap(asls, OPREGION_SIZE); 481 480 if (!base) 482 481 return -ENOMEM; 483 482
+66 -17
drivers/gpu/drm/i915/intel_ringbuffer.c
··· 34 34 #include "i915_trace.h" 35 35 #include "intel_drv.h" 36 36 37 + static inline int ring_space(struct intel_ring_buffer *ring) 38 + { 39 + int space = (ring->head & HEAD_ADDR) - (ring->tail + 8); 40 + if (space < 0) 41 + space += ring->size; 42 + return space; 43 + } 44 + 37 45 static u32 i915_gem_get_seqno(struct drm_device *dev) 38 46 { 39 47 drm_i915_private_t *dev_priv = dev->dev_private; ··· 212 204 if (!drm_core_check_feature(ring->dev, DRIVER_MODESET)) 213 205 i915_kernel_lost_context(ring->dev); 214 206 else { 215 - ring->head = I915_READ_HEAD(ring) & HEAD_ADDR; 207 + ring->head = I915_READ_HEAD(ring); 216 208 ring->tail = I915_READ_TAIL(ring) & TAIL_ADDR; 217 - ring->space = ring->head - (ring->tail + 8); 218 - if (ring->space < 0) 219 - ring->space += ring->size; 209 + ring->space = ring_space(ring); 220 210 } 221 211 222 212 return 0; ··· 927 921 } 928 922 929 923 ring->tail = 0; 930 - ring->space = ring->head - 8; 924 + ring->space = ring_space(ring); 931 925 932 926 return 0; 933 927 } 934 928 935 929 int intel_wait_ring_buffer(struct intel_ring_buffer *ring, int n) 936 930 { 937 - int reread = 0; 938 931 struct drm_device *dev = ring->dev; 939 932 struct drm_i915_private *dev_priv = dev->dev_private; 940 933 unsigned long end; 941 934 u32 head; 942 935 936 + /* If the reported head position has wrapped or hasn't advanced, 937 + * fallback to the slow and accurate path. 938 + */ 939 + head = intel_read_status_page(ring, 4); 940 + if (head > ring->head) { 941 + ring->head = head; 942 + ring->space = ring_space(ring); 943 + if (ring->space >= n) 944 + return 0; 945 + } 946 + 943 947 trace_i915_ring_wait_begin (dev); 944 948 end = jiffies + 3 * HZ; 945 949 do { 946 - /* If the reported head position has wrapped or hasn't advanced, 947 - * fallback to the slow and accurate path. 948 - */ 949 - head = intel_read_status_page(ring, 4); 950 - if (reread) 951 - head = I915_READ_HEAD(ring); 952 - ring->head = head & HEAD_ADDR; 953 - ring->space = ring->head - (ring->tail + 8); 954 - if (ring->space < 0) 955 - ring->space += ring->size; 950 + ring->head = I915_READ_HEAD(ring); 951 + ring->space = ring_space(ring); 956 952 if (ring->space >= n) { 957 953 trace_i915_ring_wait_end(dev); 958 954 return 0; ··· 969 961 msleep(1); 970 962 if (atomic_read(&dev_priv->mm.wedged)) 971 963 return -EAGAIN; 972 - reread = 1; 973 964 } while (!time_after(jiffies, end)); 974 965 trace_i915_ring_wait_end (dev); 975 966 return -EBUSY; ··· 1297 1290 } 1298 1291 1299 1292 return intel_init_ring_buffer(dev, ring); 1293 + } 1294 + 1295 + int intel_render_ring_init_dri(struct drm_device *dev, u64 start, u32 size) 1296 + { 1297 + drm_i915_private_t *dev_priv = dev->dev_private; 1298 + struct intel_ring_buffer *ring = &dev_priv->ring[RCS]; 1299 + 1300 + *ring = render_ring; 1301 + if (INTEL_INFO(dev)->gen >= 6) { 1302 + ring->add_request = gen6_add_request; 1303 + ring->irq_get = gen6_render_ring_get_irq; 1304 + ring->irq_put = gen6_render_ring_put_irq; 1305 + } else if (IS_GEN5(dev)) { 1306 + ring->add_request = pc_render_add_request; 1307 + ring->get_seqno = pc_render_get_seqno; 1308 + } 1309 + 1310 + ring->dev = dev; 1311 + INIT_LIST_HEAD(&ring->active_list); 1312 + INIT_LIST_HEAD(&ring->request_list); 1313 + INIT_LIST_HEAD(&ring->gpu_write_list); 1314 + 1315 + ring->size = size; 1316 + ring->effective_size = ring->size; 1317 + if (IS_I830(ring->dev)) 1318 + ring->effective_size -= 128; 1319 + 1320 + ring->map.offset = start; 1321 + ring->map.size = size; 1322 + ring->map.type = 0; 1323 + ring->map.flags = 0; 1324 + ring->map.mtrr = 0; 1325 + 1326 + drm_core_ioremap_wc(&ring->map, dev); 1327 + if (ring->map.handle == NULL) { 1328 + DRM_ERROR("can not ioremap virtual address for" 1329 + " ring buffer\n"); 1330 + return -ENOMEM; 1331 + } 1332 + 1333 + ring->virtual_start = (void __force __iomem *)ring->map.handle; 1334 + return 0; 1300 1335 } 1301 1336 1302 1337 int intel_init_bsd_ring_buffer(struct drm_device *dev)
+3
drivers/gpu/drm/i915/intel_ringbuffer.h
··· 166 166 u32 intel_ring_get_active_head(struct intel_ring_buffer *ring); 167 167 void intel_ring_setup_status_page(struct intel_ring_buffer *ring); 168 168 169 + /* DRI warts */ 170 + int intel_render_ring_init_dri(struct drm_device *dev, u64 start, u32 size); 171 + 169 172 #endif /* _INTEL_RINGBUFFER_H_ */
+4 -4
drivers/gpu/drm/nouveau/nouveau_drv.c
··· 234 234 pci_set_power_state(pdev, PCI_D3hot); 235 235 } 236 236 237 - acquire_console_sem(); 237 + console_lock(); 238 238 nouveau_fbcon_set_suspend(dev, 1); 239 - release_console_sem(); 239 + console_unlock(); 240 240 nouveau_fbcon_restore_accel(dev); 241 241 return 0; 242 242 ··· 359 359 nv_crtc->lut.depth = 0; 360 360 } 361 361 362 - acquire_console_sem(); 362 + console_lock(); 363 363 nouveau_fbcon_set_suspend(dev, 0); 364 - release_console_sem(); 364 + console_unlock(); 365 365 366 366 nouveau_fbcon_zfill_all(dev); 367 367
+5 -17
drivers/gpu/drm/radeon/atombios_crtc.c
··· 606 606 args.v1.usPixelClock = cpu_to_le16(mode->clock / 10); 607 607 args.v1.ucTransmitterID = radeon_encoder->encoder_id; 608 608 args.v1.ucEncodeMode = encoder_mode; 609 - if (encoder_mode == ATOM_ENCODER_MODE_DP) { 610 - if (ss_enabled) 611 - args.v1.ucConfig |= 612 - ADJUST_DISPLAY_CONFIG_SS_ENABLE; 613 - } else if (encoder_mode == ATOM_ENCODER_MODE_LVDS) { 609 + if (ss_enabled) 614 610 args.v1.ucConfig |= 615 611 ADJUST_DISPLAY_CONFIG_SS_ENABLE; 616 - } 617 612 618 613 atom_execute_table(rdev->mode_info.atom_context, 619 614 index, (uint32_t *)&args); ··· 619 624 args.v3.sInput.ucTransmitterID = radeon_encoder->encoder_id; 620 625 args.v3.sInput.ucEncodeMode = encoder_mode; 621 626 args.v3.sInput.ucDispPllConfig = 0; 627 + if (ss_enabled) 628 + args.v3.sInput.ucDispPllConfig |= 629 + DISPPLL_CONFIG_SS_ENABLE; 622 630 if (radeon_encoder->devices & (ATOM_DEVICE_DFP_SUPPORT)) { 623 631 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; 624 632 if (encoder_mode == ATOM_ENCODER_MODE_DP) { 625 - if (ss_enabled) 626 - args.v3.sInput.ucDispPllConfig |= 627 - DISPPLL_CONFIG_SS_ENABLE; 628 633 args.v3.sInput.ucDispPllConfig |= 629 634 DISPPLL_CONFIG_COHERENT_MODE; 630 635 /* 16200 or 27000 */ ··· 644 649 } 645 650 } else if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { 646 651 if (encoder_mode == ATOM_ENCODER_MODE_DP) { 647 - if (ss_enabled) 648 - args.v3.sInput.ucDispPllConfig |= 649 - DISPPLL_CONFIG_SS_ENABLE; 650 652 args.v3.sInput.ucDispPllConfig |= 651 653 DISPPLL_CONFIG_COHERENT_MODE; 652 654 /* 16200 or 27000 */ 653 655 args.v3.sInput.usPixelClock = cpu_to_le16(dp_clock / 10); 654 - } else if (encoder_mode == ATOM_ENCODER_MODE_LVDS) { 655 - if (ss_enabled) 656 - args.v3.sInput.ucDispPllConfig |= 657 - DISPPLL_CONFIG_SS_ENABLE; 658 - } else { 656 + } else if (encoder_mode != ATOM_ENCODER_MODE_LVDS) { 659 657 if (mode->clock > 165000) 660 658 args.v3.sInput.ucDispPllConfig |= 661 659 DISPPLL_CONFIG_DUAL_LINK;
+3
drivers/gpu/drm/radeon/evergreen.c
··· 2201 2201 struct evergreen_mc_save save; 2202 2202 u32 grbm_reset = 0; 2203 2203 2204 + if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE)) 2205 + return 0; 2206 + 2204 2207 dev_info(rdev->dev, "GPU softreset \n"); 2205 2208 dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n", 2206 2209 RREG32(GRBM_STATUS));
+1 -1
drivers/gpu/drm/radeon/r100.c
··· 3522 3522 if (i < rdev->usec_timeout) { 3523 3523 DRM_INFO("ring test succeeded in %d usecs\n", i); 3524 3524 } else { 3525 - DRM_ERROR("radeon: ring test failed (sracth(0x%04X)=0x%08X)\n", 3525 + DRM_ERROR("radeon: ring test failed (scratch(0x%04X)=0x%08X)\n", 3526 3526 scratch, tmp); 3527 3527 r = -EINVAL; 3528 3528 }
+3
drivers/gpu/drm/radeon/r600.c
··· 1287 1287 S_008014_CB2_BUSY(1) | S_008014_CB3_BUSY(1); 1288 1288 u32 tmp; 1289 1289 1290 + if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE)) 1291 + return 0; 1292 + 1290 1293 dev_info(rdev->dev, "GPU softreset \n"); 1291 1294 dev_info(rdev->dev, " R_008010_GRBM_STATUS=0x%08X\n", 1292 1295 RREG32(R_008010_GRBM_STATUS));
+5 -9
drivers/gpu/drm/radeon/radeon_atombios.c
··· 387 387 *line_mux = 0x90; 388 388 } 389 389 390 - /* mac rv630 */ 391 - if ((dev->pdev->device == 0x9588) && 392 - (dev->pdev->subsystem_vendor == 0x106b) && 393 - (dev->pdev->subsystem_device == 0x00a6)) { 394 - if ((supported_device == ATOM_DEVICE_TV1_SUPPORT) && 395 - (*connector_type == DRM_MODE_CONNECTOR_DVII)) { 396 - *connector_type = DRM_MODE_CONNECTOR_9PinDIN; 397 - *line_mux = CONNECTOR_7PIN_DIN_ENUM_ID1; 398 - } 390 + /* mac rv630, rv730, others */ 391 + if ((supported_device == ATOM_DEVICE_TV1_SUPPORT) && 392 + (*connector_type == DRM_MODE_CONNECTOR_DVII)) { 393 + *connector_type = DRM_MODE_CONNECTOR_9PinDIN; 394 + *line_mux = CONNECTOR_7PIN_DIN_ENUM_ID1; 399 395 } 400 396 401 397 /* ASUS HD 3600 XT board lists the DVI port as HDMI */
+5 -5
drivers/gpu/drm/radeon/radeon_device.c
··· 891 891 pci_disable_device(dev->pdev); 892 892 pci_set_power_state(dev->pdev, PCI_D3hot); 893 893 } 894 - acquire_console_sem(); 894 + console_lock(); 895 895 radeon_fbdev_set_suspend(rdev, 1); 896 - release_console_sem(); 896 + console_unlock(); 897 897 return 0; 898 898 } 899 899 ··· 905 905 if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) 906 906 return 0; 907 907 908 - acquire_console_sem(); 908 + console_lock(); 909 909 pci_set_power_state(dev->pdev, PCI_D0); 910 910 pci_restore_state(dev->pdev); 911 911 if (pci_enable_device(dev->pdev)) { 912 - release_console_sem(); 912 + console_unlock(); 913 913 return -1; 914 914 } 915 915 pci_set_master(dev->pdev); ··· 920 920 radeon_restore_bios_scratch_regs(rdev); 921 921 922 922 radeon_fbdev_set_suspend(rdev, 0); 923 - release_console_sem(); 923 + console_unlock(); 924 924 925 925 /* reset hpd state */ 926 926 radeon_hpd_init(rdev);
+1 -1
drivers/gpu/drm/radeon/radeon_drv.c
··· 48 48 * - 2.5.0 - add get accel 2 to work around ddx breakage for evergreen 49 49 * - 2.6.0 - add tiling config query (r6xx+), add initial HiZ support (r300->r500) 50 50 * 2.7.0 - fixups for r600 2D tiling support. (no external ABI change), add eg dyn gpr regs 51 - * 2.8.0 - pageflip support, r500 US_FORMAT regs. r500 ARGB2101010 colorbuf, r300->r500 CMASK 51 + * 2.8.0 - pageflip support, r500 US_FORMAT regs. r500 ARGB2101010 colorbuf, r300->r500 CMASK, clock crystal query 52 52 */ 53 53 #define KMS_DRIVER_MAJOR 2 54 54 #define KMS_DRIVER_MINOR 8
+3
drivers/gpu/drm/radeon/radeon_irq_kms.c
··· 110 110 111 111 int radeon_irq_kms_init(struct radeon_device *rdev) 112 112 { 113 + int i; 113 114 int r = 0; 114 115 115 116 INIT_WORK(&rdev->hotplug_work, radeon_hotplug_work_func); 116 117 117 118 spin_lock_init(&rdev->irq.sw_lock); 119 + for (i = 0; i < rdev->num_crtc; i++) 120 + spin_lock_init(&rdev->irq.pflip_lock[i]); 118 121 r = drm_vblank_init(rdev->ddev, rdev->num_crtc); 119 122 if (r) { 120 123 return r;
+4
drivers/gpu/drm/radeon/radeon_kms.c
··· 201 201 } 202 202 radeon_set_filp_rights(dev, &rdev->cmask_filp, filp, &value); 203 203 break; 204 + case RADEON_INFO_CLOCK_CRYSTAL_FREQ: 205 + /* return clock value in KHz */ 206 + value = rdev->clock.spll.reference_freq * 10; 207 + break; 204 208 default: 205 209 DRM_DEBUG_KMS("Invalid request %d\n", info->request); 206 210 return -EINVAL;
+1 -1
drivers/gpu/vga/vgaarb.c
··· 636 636 void (*irq_set_state)(void *cookie, bool state), 637 637 unsigned int (*set_vga_decode)(void *cookie, bool decode)) 638 638 { 639 - int ret = -1; 639 + int ret = -ENODEV; 640 640 struct vga_device *vgadev; 641 641 unsigned long flags; 642 642
+2 -6
drivers/idle/intel_idle.c
··· 263 263 clockevents_notify(reason, &cpu); 264 264 } 265 265 266 - static int __cpuinit setup_broadcast_cpuhp_notify(struct notifier_block *n, 266 + static int setup_broadcast_cpuhp_notify(struct notifier_block *n, 267 267 unsigned long action, void *hcpu) 268 268 { 269 269 int hotcpu = (unsigned long)hcpu; ··· 273 273 smp_call_function_single(hotcpu, __setup_broadcast_timer, 274 274 (void *)true, 1); 275 275 break; 276 - case CPU_DOWN_PREPARE: 277 - smp_call_function_single(hotcpu, __setup_broadcast_timer, 278 - (void *)false, 1); 279 - break; 280 276 } 281 277 return NOTIFY_OK; 282 278 } 283 279 284 - static struct notifier_block __cpuinitdata setup_broadcast_notifier = { 280 + static struct notifier_block setup_broadcast_notifier = { 285 281 .notifier_call = setup_broadcast_cpuhp_notify, 286 282 }; 287 283
+10
drivers/input/keyboard/Kconfig
··· 343 343 To compile this driver as a module, choose M here: the 344 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 356 config KEYBOARD_OPENCORES 347 357 tristate "OpenCores Keyboard Controller" 348 358 help
+1
drivers/input/keyboard/Makefile
··· 42 42 obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o 43 43 obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o 44 44 obj-$(CONFIG_KEYBOARD_TC3589X) += tc3589x-keypad.o 45 + obj-$(CONFIG_KEYBOARD_TEGRA) += tegra-kbc.o 45 46 obj-$(CONFIG_KEYBOARD_TNETV107X) += tnetv107x-keypad.o 46 47 obj-$(CONFIG_KEYBOARD_TWL4030) += twl4030_keypad.o 47 48 obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o
+3 -3
drivers/input/keyboard/gpio_keys.c
··· 322 322 struct gpio_keys_button *button = bdata->button; 323 323 struct input_dev *input = bdata->input; 324 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 327 input_event(input, type, button->code, !!state); 328 328 input_sync(input); ··· 410 410 if (!button->can_disable) 411 411 irqflags |= IRQF_SHARED; 412 412 413 - error = request_irq(irq, gpio_keys_isr, irqflags, desc, bdata); 414 - if (error) { 413 + error = request_any_context_irq(irq, gpio_keys_isr, irqflags, desc, bdata); 414 + if (error < 0) { 415 415 dev_err(dev, "Unable to claim irq %d; error %d\n", 416 416 irq, error); 417 417 goto fail3;
+727
drivers/input/keyboard/tegra-kbc.c
··· 1 + /* 2 + * Keyboard class input driver for the NVIDIA Tegra SoC internal matrix 3 + * keyboard controller 4 + * 5 + * Copyright (c) 2009-2011, NVIDIA Corporation. 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License as published by 9 + * the Free Software Foundation; either version 2 of the License, or 10 + * (at your option) any later version. 11 + * 12 + * This program is distributed in the hope that it will be useful, but WITHOUT 13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 + * more details. 16 + * 17 + * You should have received a copy of the GNU General Public License along 18 + * with this program; if not, write to the Free Software Foundation, Inc., 19 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 + */ 21 + 22 + #include <linux/module.h> 23 + #include <linux/input.h> 24 + #include <linux/platform_device.h> 25 + #include <linux/delay.h> 26 + #include <linux/io.h> 27 + #include <linux/interrupt.h> 28 + #include <linux/clk.h> 29 + #include <linux/slab.h> 30 + #include <mach/clk.h> 31 + #include <mach/kbc.h> 32 + 33 + #define KBC_MAX_DEBOUNCE_CNT 0x3ffu 34 + 35 + /* KBC row scan time and delay for beginning the row scan. */ 36 + #define KBC_ROW_SCAN_TIME 16 37 + #define KBC_ROW_SCAN_DLY 5 38 + 39 + /* KBC uses a 32KHz clock so a cycle = 1/32Khz */ 40 + #define KBC_CYCLE_USEC 32 41 + 42 + /* KBC Registers */ 43 + 44 + /* KBC Control Register */ 45 + #define KBC_CONTROL_0 0x0 46 + #define KBC_FIFO_TH_CNT_SHIFT(cnt) (cnt << 14) 47 + #define KBC_DEBOUNCE_CNT_SHIFT(cnt) (cnt << 4) 48 + #define KBC_CONTROL_FIFO_CNT_INT_EN (1 << 3) 49 + #define KBC_CONTROL_KBC_EN (1 << 0) 50 + 51 + /* KBC Interrupt Register */ 52 + #define KBC_INT_0 0x4 53 + #define KBC_INT_FIFO_CNT_INT_STATUS (1 << 2) 54 + 55 + #define KBC_ROW_CFG0_0 0x8 56 + #define KBC_COL_CFG0_0 0x18 57 + #define KBC_INIT_DLY_0 0x28 58 + #define KBC_RPT_DLY_0 0x2c 59 + #define KBC_KP_ENT0_0 0x30 60 + #define KBC_KP_ENT1_0 0x34 61 + #define KBC_ROW0_MASK_0 0x38 62 + 63 + #define KBC_ROW_SHIFT 3 64 + 65 + struct tegra_kbc { 66 + void __iomem *mmio; 67 + struct input_dev *idev; 68 + unsigned int irq; 69 + unsigned int wake_enable_rows; 70 + unsigned int wake_enable_cols; 71 + spinlock_t lock; 72 + unsigned int repoll_dly; 73 + unsigned long cp_dly_jiffies; 74 + const struct tegra_kbc_platform_data *pdata; 75 + unsigned short keycode[KBC_MAX_KEY]; 76 + unsigned short current_keys[KBC_MAX_KPENT]; 77 + unsigned int num_pressed_keys; 78 + struct timer_list timer; 79 + struct clk *clk; 80 + }; 81 + 82 + static const u32 tegra_kbc_default_keymap[] = { 83 + KEY(0, 2, KEY_W), 84 + KEY(0, 3, KEY_S), 85 + KEY(0, 4, KEY_A), 86 + KEY(0, 5, KEY_Z), 87 + KEY(0, 7, KEY_FN), 88 + 89 + KEY(1, 7, KEY_MENU), 90 + 91 + KEY(2, 6, KEY_RIGHTALT), 92 + KEY(2, 7, KEY_LEFTALT), 93 + 94 + KEY(3, 0, KEY_5), 95 + KEY(3, 1, KEY_4), 96 + KEY(3, 2, KEY_R), 97 + KEY(3, 3, KEY_E), 98 + KEY(3, 4, KEY_F), 99 + KEY(3, 5, KEY_D), 100 + KEY(3, 6, KEY_X), 101 + 102 + KEY(4, 0, KEY_7), 103 + KEY(4, 1, KEY_6), 104 + KEY(4, 2, KEY_T), 105 + KEY(4, 3, KEY_H), 106 + KEY(4, 4, KEY_G), 107 + KEY(4, 5, KEY_V), 108 + KEY(4, 6, KEY_C), 109 + KEY(4, 7, KEY_SPACE), 110 + 111 + KEY(5, 0, KEY_9), 112 + KEY(5, 1, KEY_8), 113 + KEY(5, 2, KEY_U), 114 + KEY(5, 3, KEY_Y), 115 + KEY(5, 4, KEY_J), 116 + KEY(5, 5, KEY_N), 117 + KEY(5, 6, KEY_B), 118 + KEY(5, 7, KEY_BACKSLASH), 119 + 120 + KEY(6, 0, KEY_MINUS), 121 + KEY(6, 1, KEY_0), 122 + KEY(6, 2, KEY_O), 123 + KEY(6, 3, KEY_I), 124 + KEY(6, 4, KEY_L), 125 + KEY(6, 5, KEY_K), 126 + KEY(6, 6, KEY_COMMA), 127 + KEY(6, 7, KEY_M), 128 + 129 + KEY(7, 1, KEY_EQUAL), 130 + KEY(7, 2, KEY_RIGHTBRACE), 131 + KEY(7, 3, KEY_ENTER), 132 + KEY(7, 7, KEY_MENU), 133 + 134 + KEY(8, 4, KEY_RIGHTSHIFT), 135 + KEY(8, 5, KEY_LEFTSHIFT), 136 + 137 + KEY(9, 5, KEY_RIGHTCTRL), 138 + KEY(9, 7, KEY_LEFTCTRL), 139 + 140 + KEY(11, 0, KEY_LEFTBRACE), 141 + KEY(11, 1, KEY_P), 142 + KEY(11, 2, KEY_APOSTROPHE), 143 + KEY(11, 3, KEY_SEMICOLON), 144 + KEY(11, 4, KEY_SLASH), 145 + KEY(11, 5, KEY_DOT), 146 + 147 + KEY(12, 0, KEY_F10), 148 + KEY(12, 1, KEY_F9), 149 + KEY(12, 2, KEY_BACKSPACE), 150 + KEY(12, 3, KEY_3), 151 + KEY(12, 4, KEY_2), 152 + KEY(12, 5, KEY_UP), 153 + KEY(12, 6, KEY_PRINT), 154 + KEY(12, 7, KEY_PAUSE), 155 + 156 + KEY(13, 0, KEY_INSERT), 157 + KEY(13, 1, KEY_DELETE), 158 + KEY(13, 3, KEY_PAGEUP), 159 + KEY(13, 4, KEY_PAGEDOWN), 160 + KEY(13, 5, KEY_RIGHT), 161 + KEY(13, 6, KEY_DOWN), 162 + KEY(13, 7, KEY_LEFT), 163 + 164 + KEY(14, 0, KEY_F11), 165 + KEY(14, 1, KEY_F12), 166 + KEY(14, 2, KEY_F8), 167 + KEY(14, 3, KEY_Q), 168 + KEY(14, 4, KEY_F4), 169 + KEY(14, 5, KEY_F3), 170 + KEY(14, 6, KEY_1), 171 + KEY(14, 7, KEY_F7), 172 + 173 + KEY(15, 0, KEY_ESC), 174 + KEY(15, 1, KEY_GRAVE), 175 + KEY(15, 2, KEY_F5), 176 + KEY(15, 3, KEY_TAB), 177 + KEY(15, 4, KEY_F1), 178 + KEY(15, 5, KEY_F2), 179 + KEY(15, 6, KEY_CAPSLOCK), 180 + KEY(15, 7, KEY_F6), 181 + }; 182 + 183 + static const struct matrix_keymap_data tegra_kbc_default_keymap_data = { 184 + .keymap = tegra_kbc_default_keymap, 185 + .keymap_size = ARRAY_SIZE(tegra_kbc_default_keymap), 186 + }; 187 + 188 + static void tegra_kbc_report_released_keys(struct input_dev *input, 189 + unsigned short old_keycodes[], 190 + unsigned int old_num_keys, 191 + unsigned short new_keycodes[], 192 + unsigned int new_num_keys) 193 + { 194 + unsigned int i, j; 195 + 196 + for (i = 0; i < old_num_keys; i++) { 197 + for (j = 0; j < new_num_keys; j++) 198 + if (old_keycodes[i] == new_keycodes[j]) 199 + break; 200 + 201 + if (j == new_num_keys) 202 + input_report_key(input, old_keycodes[i], 0); 203 + } 204 + } 205 + 206 + static void tegra_kbc_report_pressed_keys(struct input_dev *input, 207 + unsigned char scancodes[], 208 + unsigned short keycodes[], 209 + unsigned int num_pressed_keys) 210 + { 211 + unsigned int i; 212 + 213 + for (i = 0; i < num_pressed_keys; i++) { 214 + input_event(input, EV_MSC, MSC_SCAN, scancodes[i]); 215 + input_report_key(input, keycodes[i], 1); 216 + } 217 + } 218 + 219 + static void tegra_kbc_report_keys(struct tegra_kbc *kbc) 220 + { 221 + unsigned char scancodes[KBC_MAX_KPENT]; 222 + unsigned short keycodes[KBC_MAX_KPENT]; 223 + u32 val = 0; 224 + unsigned int i; 225 + unsigned int num_down = 0; 226 + unsigned long flags; 227 + 228 + spin_lock_irqsave(&kbc->lock, flags); 229 + for (i = 0; i < KBC_MAX_KPENT; i++) { 230 + if ((i % 4) == 0) 231 + val = readl(kbc->mmio + KBC_KP_ENT0_0 + i); 232 + 233 + if (val & 0x80) { 234 + unsigned int col = val & 0x07; 235 + unsigned int row = (val >> 3) & 0x0f; 236 + unsigned char scancode = 237 + MATRIX_SCAN_CODE(row, col, KBC_ROW_SHIFT); 238 + 239 + scancodes[num_down] = scancode; 240 + keycodes[num_down++] = kbc->keycode[scancode]; 241 + } 242 + 243 + val >>= 8; 244 + } 245 + spin_unlock_irqrestore(&kbc->lock, flags); 246 + 247 + tegra_kbc_report_released_keys(kbc->idev, 248 + kbc->current_keys, kbc->num_pressed_keys, 249 + keycodes, num_down); 250 + tegra_kbc_report_pressed_keys(kbc->idev, scancodes, keycodes, num_down); 251 + input_sync(kbc->idev); 252 + 253 + memcpy(kbc->current_keys, keycodes, sizeof(kbc->current_keys)); 254 + kbc->num_pressed_keys = num_down; 255 + } 256 + 257 + static void tegra_kbc_keypress_timer(unsigned long data) 258 + { 259 + struct tegra_kbc *kbc = (struct tegra_kbc *)data; 260 + unsigned long flags; 261 + u32 val; 262 + unsigned int i; 263 + 264 + val = (readl(kbc->mmio + KBC_INT_0) >> 4) & 0xf; 265 + if (val) { 266 + unsigned long dly; 267 + 268 + tegra_kbc_report_keys(kbc); 269 + 270 + /* 271 + * If more than one keys are pressed we need not wait 272 + * for the repoll delay. 273 + */ 274 + dly = (val == 1) ? kbc->repoll_dly : 1; 275 + mod_timer(&kbc->timer, jiffies + msecs_to_jiffies(dly)); 276 + } else { 277 + /* Release any pressed keys and exit the polling loop */ 278 + for (i = 0; i < kbc->num_pressed_keys; i++) 279 + input_report_key(kbc->idev, kbc->current_keys[i], 0); 280 + input_sync(kbc->idev); 281 + 282 + kbc->num_pressed_keys = 0; 283 + 284 + /* All keys are released so enable the keypress interrupt */ 285 + spin_lock_irqsave(&kbc->lock, flags); 286 + val = readl(kbc->mmio + KBC_CONTROL_0); 287 + val |= KBC_CONTROL_FIFO_CNT_INT_EN; 288 + writel(val, kbc->mmio + KBC_CONTROL_0); 289 + spin_unlock_irqrestore(&kbc->lock, flags); 290 + } 291 + } 292 + 293 + static irqreturn_t tegra_kbc_isr(int irq, void *args) 294 + { 295 + struct tegra_kbc *kbc = args; 296 + u32 val, ctl; 297 + 298 + /* 299 + * Until all keys are released, defer further processing to 300 + * the polling loop in tegra_kbc_keypress_timer 301 + */ 302 + ctl = readl(kbc->mmio + KBC_CONTROL_0); 303 + ctl &= ~KBC_CONTROL_FIFO_CNT_INT_EN; 304 + writel(ctl, kbc->mmio + KBC_CONTROL_0); 305 + 306 + /* 307 + * Quickly bail out & reenable interrupts if the fifo threshold 308 + * count interrupt wasn't the interrupt source 309 + */ 310 + val = readl(kbc->mmio + KBC_INT_0); 311 + writel(val, kbc->mmio + KBC_INT_0); 312 + 313 + if (val & KBC_INT_FIFO_CNT_INT_STATUS) { 314 + /* 315 + * Schedule timer to run when hardware is in continuous 316 + * polling mode. 317 + */ 318 + mod_timer(&kbc->timer, jiffies + kbc->cp_dly_jiffies); 319 + } else { 320 + ctl |= KBC_CONTROL_FIFO_CNT_INT_EN; 321 + writel(ctl, kbc->mmio + KBC_CONTROL_0); 322 + } 323 + 324 + return IRQ_HANDLED; 325 + } 326 + 327 + static void tegra_kbc_setup_wakekeys(struct tegra_kbc *kbc, bool filter) 328 + { 329 + const struct tegra_kbc_platform_data *pdata = kbc->pdata; 330 + int i; 331 + unsigned int rst_val; 332 + 333 + BUG_ON(pdata->wake_cnt > KBC_MAX_KEY); 334 + rst_val = (filter && pdata->wake_cnt) ? ~0 : 0; 335 + 336 + for (i = 0; i < KBC_MAX_ROW; i++) 337 + writel(rst_val, kbc->mmio + KBC_ROW0_MASK_0 + i * 4); 338 + 339 + if (filter) { 340 + for (i = 0; i < pdata->wake_cnt; i++) { 341 + u32 val, addr; 342 + addr = pdata->wake_cfg[i].row * 4 + KBC_ROW0_MASK_0; 343 + val = readl(kbc->mmio + addr); 344 + val &= ~(1 << pdata->wake_cfg[i].col); 345 + writel(val, kbc->mmio + addr); 346 + } 347 + } 348 + } 349 + 350 + static void tegra_kbc_config_pins(struct tegra_kbc *kbc) 351 + { 352 + const struct tegra_kbc_platform_data *pdata = kbc->pdata; 353 + int i; 354 + 355 + for (i = 0; i < KBC_MAX_GPIO; i++) { 356 + u32 r_shft = 5 * (i % 6); 357 + u32 c_shft = 4 * (i % 8); 358 + u32 r_mask = 0x1f << r_shift; 359 + u32 c_mask = 0x0f << c_shift; 360 + u32 r_offs = (i / 6) * 4 + KBC_ROW_CFG0_0; 361 + u32 c_offs = (i / 8) * 4 + KBC_COL_CFG0_0; 362 + u32 row_cfg = readl(kbc->mmio + r_offs); 363 + u32 col_cfg = readl(kbc->mmio + c_offs); 364 + 365 + row_cfg &= ~r_mask; 366 + col_cfg &= ~c_mask; 367 + 368 + if (pdata->pin_cfg[i].is_row) 369 + row_cfg |= ((pdata->pin_cfg[i].num << 1) | 1) << r_shft; 370 + else 371 + col_cfg |= ((pdata->pin_cfg[i].num << 1) | 1) << c_shft; 372 + 373 + writel(row_cfg, kbc->mmio + r_offs); 374 + writel(col_cfg, kbc->mmio + c_offs); 375 + } 376 + } 377 + 378 + static int tegra_kbc_start(struct tegra_kbc *kbc) 379 + { 380 + const struct tegra_kbc_platform_data *pdata = kbc->pdata; 381 + unsigned long flags; 382 + unsigned int debounce_cnt; 383 + u32 val = 0; 384 + 385 + clk_enable(kbc->clk); 386 + 387 + /* Reset the KBC controller to clear all previous status.*/ 388 + tegra_periph_reset_assert(kbc->clk); 389 + udelay(100); 390 + tegra_periph_reset_deassert(kbc->clk); 391 + udelay(100); 392 + 393 + tegra_kbc_config_pins(kbc); 394 + tegra_kbc_setup_wakekeys(kbc, false); 395 + 396 + writel(pdata->repeat_cnt, kbc->mmio + KBC_RPT_DLY_0); 397 + 398 + /* Keyboard debounce count is maximum of 12 bits. */ 399 + debounce_cnt = min(pdata->debounce_cnt, KBC_MAX_DEBOUNCE_CNT); 400 + val = KBC_DEBOUNCE_CNT_SHIFT(debounce_cnt); 401 + val |= KBC_FIFO_TH_CNT_SHIFT(1); /* set fifo interrupt threshold to 1 */ 402 + val |= KBC_CONTROL_FIFO_CNT_INT_EN; /* interrupt on FIFO threshold */ 403 + val |= KBC_CONTROL_KBC_EN; /* enable */ 404 + writel(val, kbc->mmio + KBC_CONTROL_0); 405 + 406 + /* 407 + * Compute the delay(ns) from interrupt mode to continuous polling 408 + * mode so the timer routine is scheduled appropriately. 409 + */ 410 + val = readl(kbc->mmio + KBC_INIT_DLY_0); 411 + kbc->cp_dly_jiffies = usecs_to_jiffies((val & 0xfffff) * 32); 412 + 413 + kbc->num_pressed_keys = 0; 414 + 415 + /* 416 + * Atomically clear out any remaining entries in the key FIFO 417 + * and enable keyboard interrupts. 418 + */ 419 + spin_lock_irqsave(&kbc->lock, flags); 420 + while (1) { 421 + val = readl(kbc->mmio + KBC_INT_0); 422 + val >>= 4; 423 + if (!val) 424 + break; 425 + 426 + val = readl(kbc->mmio + KBC_KP_ENT0_0); 427 + val = readl(kbc->mmio + KBC_KP_ENT1_0); 428 + } 429 + writel(0x7, kbc->mmio + KBC_INT_0); 430 + spin_unlock_irqrestore(&kbc->lock, flags); 431 + 432 + enable_irq(kbc->irq); 433 + 434 + return 0; 435 + } 436 + 437 + static void tegra_kbc_stop(struct tegra_kbc *kbc) 438 + { 439 + unsigned long flags; 440 + u32 val; 441 + 442 + spin_lock_irqsave(&kbc->lock, flags); 443 + val = readl(kbc->mmio + KBC_CONTROL_0); 444 + val &= ~1; 445 + writel(val, kbc->mmio + KBC_CONTROL_0); 446 + spin_unlock_irqrestore(&kbc->lock, flags); 447 + 448 + disable_irq(kbc->irq); 449 + del_timer_sync(&kbc->timer); 450 + 451 + clk_disable(kbc->clk); 452 + } 453 + 454 + static int tegra_kbc_open(struct input_dev *dev) 455 + { 456 + struct tegra_kbc *kbc = input_get_drvdata(dev); 457 + 458 + return tegra_kbc_start(kbc); 459 + } 460 + 461 + static void tegra_kbc_close(struct input_dev *dev) 462 + { 463 + struct tegra_kbc *kbc = input_get_drvdata(dev); 464 + 465 + return tegra_kbc_stop(kbc); 466 + } 467 + 468 + static bool __devinit 469 + tegra_kbc_check_pin_cfg(const struct tegra_kbc_platform_data *pdata, 470 + struct device *dev, unsigned int *num_rows) 471 + { 472 + int i; 473 + 474 + *num_rows = 0; 475 + 476 + for (i = 0; i < KBC_MAX_GPIO; i++) { 477 + const struct tegra_kbc_pin_cfg *pin_cfg = &pdata->pin_cfg[i]; 478 + 479 + if (pin_cfg->is_row) { 480 + if (pin_cfg->num >= KBC_MAX_ROW) { 481 + dev_err(dev, 482 + "pin_cfg[%d]: invalid row number %d\n", 483 + i, pin_cfg->num); 484 + return false; 485 + } 486 + (*num_rows)++; 487 + } else { 488 + if (pin_cfg->num >= KBC_MAX_COL) { 489 + dev_err(dev, 490 + "pin_cfg[%d]: invalid column number %d\n", 491 + i, pin_cfg->num); 492 + return false; 493 + } 494 + } 495 + } 496 + 497 + return true; 498 + } 499 + 500 + static int __devinit tegra_kbc_probe(struct platform_device *pdev) 501 + { 502 + const struct tegra_kbc_platform_data *pdata = pdev->dev.platform_data; 503 + const struct matrix_keymap_data *keymap_data; 504 + struct tegra_kbc *kbc; 505 + struct input_dev *input_dev; 506 + struct resource *res; 507 + int irq; 508 + int err; 509 + int i; 510 + int num_rows = 0; 511 + unsigned int debounce_cnt; 512 + unsigned int scan_time_rows; 513 + 514 + if (!pdata) 515 + return -EINVAL; 516 + 517 + if (!tegra_kbc_check_pin_cfg(pdata, &pdev->dev, &num_rows)) 518 + return -EINVAL; 519 + 520 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 521 + if (!res) { 522 + dev_err(&pdev->dev, "failed to get I/O memory\n"); 523 + return -ENXIO; 524 + } 525 + 526 + irq = platform_get_irq(pdev, 0); 527 + if (irq < 0) { 528 + dev_err(&pdev->dev, "failed to get keyboard IRQ\n"); 529 + return -ENXIO; 530 + } 531 + 532 + kbc = kzalloc(sizeof(*kbc), GFP_KERNEL); 533 + input_dev = input_allocate_device(); 534 + if (!kbc || !input_dev) { 535 + err = -ENOMEM; 536 + goto err_free_mem; 537 + } 538 + 539 + kbc->pdata = pdata; 540 + kbc->idev = input_dev; 541 + kbc->irq = irq; 542 + spin_lock_init(&kbc->lock); 543 + setup_timer(&kbc->timer, tegra_kbc_keypress_timer, (unsigned long)kbc); 544 + 545 + res = request_mem_region(res->start, resource_size(res), pdev->name); 546 + if (!res) { 547 + dev_err(&pdev->dev, "failed to request I/O memory\n"); 548 + err = -EBUSY; 549 + goto err_free_mem; 550 + } 551 + 552 + kbc->mmio = ioremap(res->start, resource_size(res)); 553 + if (!kbc->mmio) { 554 + dev_err(&pdev->dev, "failed to remap I/O memory\n"); 555 + err = -ENXIO; 556 + goto err_free_mem_region; 557 + } 558 + 559 + kbc->clk = clk_get(&pdev->dev, NULL); 560 + if (IS_ERR(kbc->clk)) { 561 + dev_err(&pdev->dev, "failed to get keyboard clock\n"); 562 + err = PTR_ERR(kbc->clk); 563 + goto err_iounmap; 564 + } 565 + 566 + kbc->wake_enable_rows = 0; 567 + kbc->wake_enable_cols = 0; 568 + for (i = 0; i < pdata->wake_cnt; i++) { 569 + kbc->wake_enable_rows |= (1 << pdata->wake_cfg[i].row); 570 + kbc->wake_enable_cols |= (1 << pdata->wake_cfg[i].col); 571 + } 572 + 573 + /* 574 + * The time delay between two consecutive reads of the FIFO is 575 + * the sum of the repeat time and the time taken for scanning 576 + * the rows. There is an additional delay before the row scanning 577 + * starts. The repoll delay is computed in milliseconds. 578 + */ 579 + debounce_cnt = min(pdata->debounce_cnt, KBC_MAX_DEBOUNCE_CNT); 580 + scan_time_rows = (KBC_ROW_SCAN_TIME + debounce_cnt) * num_rows; 581 + kbc->repoll_dly = KBC_ROW_SCAN_DLY + scan_time_rows + pdata->repeat_cnt; 582 + kbc->repoll_dly = ((kbc->repoll_dly * KBC_CYCLE_USEC) + 999) / 1000; 583 + 584 + input_dev->name = pdev->name; 585 + input_dev->id.bustype = BUS_HOST; 586 + input_dev->dev.parent = &pdev->dev; 587 + input_dev->open = tegra_kbc_open; 588 + input_dev->close = tegra_kbc_close; 589 + 590 + input_set_drvdata(input_dev, kbc); 591 + 592 + input_dev->evbit[0] = BIT_MASK(EV_KEY); 593 + input_set_capability(input_dev, EV_MSC, MSC_SCAN); 594 + 595 + input_dev->keycode = kbc->keycode; 596 + input_dev->keycodesize = sizeof(kbc->keycode[0]); 597 + input_dev->keycodemax = ARRAY_SIZE(kbc->keycode); 598 + 599 + keymap_data = pdata->keymap_data ?: &tegra_kbc_default_keymap_data; 600 + matrix_keypad_build_keymap(keymap_data, KBC_ROW_SHIFT, 601 + input_dev->keycode, input_dev->keybit); 602 + 603 + err = request_irq(kbc->irq, tegra_kbc_isr, IRQF_TRIGGER_HIGH, 604 + pdev->name, kbc); 605 + if (err) { 606 + dev_err(&pdev->dev, "failed to request keyboard IRQ\n"); 607 + goto err_put_clk; 608 + } 609 + 610 + disable_irq(kbc->irq); 611 + 612 + err = input_register_device(kbc->idev); 613 + if (err) { 614 + dev_err(&pdev->dev, "failed to register input device\n"); 615 + goto err_free_irq; 616 + } 617 + 618 + platform_set_drvdata(pdev, kbc); 619 + device_init_wakeup(&pdev->dev, pdata->wakeup); 620 + 621 + return 0; 622 + 623 + err_free_irq: 624 + free_irq(kbc->irq, pdev); 625 + err_put_clk: 626 + clk_put(kbc->clk); 627 + err_iounmap: 628 + iounmap(kbc->mmio); 629 + err_free_mem_region: 630 + release_mem_region(res->start, resource_size(res)); 631 + err_free_mem: 632 + input_free_device(kbc->idev); 633 + kfree(kbc); 634 + 635 + return err; 636 + } 637 + 638 + static int __devexit tegra_kbc_remove(struct platform_device *pdev) 639 + { 640 + struct tegra_kbc *kbc = platform_get_drvdata(pdev); 641 + struct resource *res; 642 + 643 + free_irq(kbc->irq, pdev); 644 + clk_put(kbc->clk); 645 + 646 + input_unregister_device(kbc->idev); 647 + iounmap(kbc->mmio); 648 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 649 + release_mem_region(res->start, resource_size(res)); 650 + 651 + kfree(kbc); 652 + 653 + platform_set_drvdata(pdev, NULL); 654 + 655 + return 0; 656 + } 657 + 658 + #ifdef CONFIG_PM_SLEEP 659 + static int tegra_kbc_suspend(struct device *dev) 660 + { 661 + struct platform_device *pdev = to_platform_device(dev); 662 + struct tegra_kbc *kbc = platform_get_drvdata(pdev); 663 + 664 + if (device_may_wakeup(&pdev->dev)) { 665 + tegra_kbc_setup_wakekeys(kbc, true); 666 + enable_irq_wake(kbc->irq); 667 + /* Forcefully clear the interrupt status */ 668 + writel(0x7, kbc->mmio + KBC_INT_0); 669 + msleep(30); 670 + } else { 671 + mutex_lock(&kbc->idev->mutex); 672 + if (kbc->idev->users) 673 + tegra_kbc_stop(kbc); 674 + mutex_unlock(&kbc->idev->mutex); 675 + } 676 + 677 + return 0; 678 + } 679 + 680 + static int tegra_kbc_resume(struct device *dev) 681 + { 682 + struct platform_device *pdev = to_platform_device(dev); 683 + struct tegra_kbc *kbc = platform_get_drvdata(pdev); 684 + int err = 0; 685 + 686 + if (device_may_wakeup(&pdev->dev)) { 687 + disable_irq_wake(kbc->irq); 688 + tegra_kbc_setup_wakekeys(kbc, false); 689 + } else { 690 + mutex_lock(&kbc->idev->mutex); 691 + if (kbc->idev->users) 692 + err = tegra_kbc_start(kbc); 693 + mutex_unlock(&kbc->idev->mutex); 694 + } 695 + 696 + return err; 697 + } 698 + #endif 699 + 700 + static SIMPLE_DEV_PM_OPS(tegra_kbc_pm_ops, tegra_kbc_suspend, tegra_kbc_resume); 701 + 702 + static struct platform_driver tegra_kbc_driver = { 703 + .probe = tegra_kbc_probe, 704 + .remove = __devexit_p(tegra_kbc_remove), 705 + .driver = { 706 + .name = "tegra-kbc", 707 + .owner = THIS_MODULE, 708 + .pm = &tegra_kbc_pm_ops, 709 + }, 710 + }; 711 + 712 + static void __exit tegra_kbc_exit(void) 713 + { 714 + platform_driver_unregister(&tegra_kbc_driver); 715 + } 716 + module_exit(tegra_kbc_exit); 717 + 718 + static int __init tegra_kbc_init(void) 719 + { 720 + return platform_driver_register(&tegra_kbc_driver); 721 + } 722 + module_init(tegra_kbc_init); 723 + 724 + MODULE_LICENSE("GPL"); 725 + MODULE_AUTHOR("Rakesh Iyer <riyer@nvidia.com>"); 726 + MODULE_DESCRIPTION("Tegra matrix keyboard controller driver"); 727 + MODULE_ALIAS("platform:tegra-kbc");
+3 -2
drivers/input/keyboard/tnetv107x-keypad.c
··· 14 14 */ 15 15 16 16 #include <linux/kernel.h> 17 + #include <linux/err.h> 17 18 #include <linux/errno.h> 18 19 #include <linux/input.h> 19 20 #include <linux/platform_device.h> ··· 220 219 } 221 220 222 221 kp->clk = clk_get(dev, NULL); 223 - if (!kp->clk) { 222 + if (IS_ERR(kp->clk)) { 224 223 dev_err(dev, "cannot claim device clock\n"); 225 - error = -EINVAL; 224 + error = PTR_ERR(kp->clk); 226 225 goto error_clk; 227 226 } 228 227
+5 -3
drivers/input/serio/ct82c710.c
··· 111 111 static int ct82c710_open(struct serio *serio) 112 112 { 113 113 unsigned char status; 114 + int err; 114 115 115 - if (request_irq(CT82C710_IRQ, ct82c710_interrupt, 0, "ct82c710", NULL)) 116 - return -1; 116 + err = request_irq(CT82C710_IRQ, ct82c710_interrupt, 0, "ct82c710", NULL); 117 + if (err) 118 + return err; 117 119 118 120 status = inb_p(CT82C710_STATUS); 119 121 ··· 133 131 status &= ~(CT82C710_ENABLE | CT82C710_INTS_ON); 134 132 outb_p(status, CT82C710_STATUS); 135 133 free_irq(CT82C710_IRQ, NULL); 136 - return -1; 134 + return -EBUSY; 137 135 } 138 136 139 137 return 0;
+20 -4
drivers/input/serio/serport.c
··· 116 116 117 117 /* 118 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' 120 - * routine. 119 + * are ready for us. We forward the characters and flags, one by one to the 120 + * 'interrupt' routine. 121 121 */ 122 122 123 123 static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) 124 124 { 125 125 struct serport *serport = (struct serport*) tty->disc_data; 126 126 unsigned long flags; 127 + unsigned int ch_flags; 127 128 int i; 128 129 129 130 spin_lock_irqsave(&serport->lock, flags); ··· 132 131 if (!test_bit(SERPORT_ACTIVE, &serport->flags)) 133 132 goto out; 134 133 135 - for (i = 0; i < count; i++) 136 - serio_interrupt(serport->serio, cp[i], 0); 134 + for (i = 0; i < count; i++) { 135 + switch (fp[i]) { 136 + case TTY_FRAME: 137 + ch_flags = SERIO_FRAME; 138 + break; 139 + 140 + case TTY_PARITY: 141 + ch_flags = SERIO_PARITY; 142 + break; 143 + 144 + default: 145 + ch_flags = 0; 146 + break; 147 + } 148 + 149 + serio_interrupt(serport->serio, cp[i], ch_flags); 150 + } 137 151 138 152 out: 139 153 spin_unlock_irqrestore(&serport->lock, flags);
+1
drivers/input/sparse-keymap.c
··· 201 201 break; 202 202 203 203 case KE_SW: 204 + case KE_VSW: 204 205 __set_bit(EV_SW, dev->evbit); 205 206 __set_bit(entry->sw.code, dev->swbit); 206 207 break;
+25 -2
drivers/input/tablet/wacom_wac.c
··· 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 1111 void wacom_setup_input_capabilities(struct input_dev *input_dev, 1105 1112 struct wacom_wac *wacom_wac) 1106 1113 { ··· 1235 1228 case TABLETPC: 1236 1229 if (features->device_type == BTN_TOOL_DOUBLETAP || 1237 1230 features->device_type == BTN_TOOL_TRIPLETAP) { 1238 - input_set_abs_params(input_dev, ABS_RX, 0, features->x_phy, 0, 0); 1239 - input_set_abs_params(input_dev, ABS_RY, 0, features->y_phy, 0, 0); 1231 + input_abs_set_res(input_dev, ABS_X, 1232 + wacom_calculate_touch_res(features->x_max, 1233 + features->x_phy)); 1234 + input_abs_set_res(input_dev, ABS_Y, 1235 + wacom_calculate_touch_res(features->y_max, 1236 + features->y_phy)); 1240 1237 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); 1241 1238 } 1242 1239 ··· 1283 1272 input_set_abs_params(input_dev, ABS_MT_PRESSURE, 1284 1273 0, features->pressure_max, 1285 1274 features->pressure_fuzz, 0); 1275 + input_abs_set_res(input_dev, ABS_X, 1276 + wacom_calculate_touch_res(features->x_max, 1277 + features->x_phy)); 1278 + input_abs_set_res(input_dev, ABS_Y, 1279 + wacom_calculate_touch_res(features->y_max, 1280 + features->y_phy)); 1286 1281 } else if (features->device_type == BTN_TOOL_PEN) { 1287 1282 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); 1288 1283 __set_bit(BTN_TOOL_PEN, input_dev->keybit); ··· 1443 1426 { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; 1444 1427 static const struct wacom_features wacom_features_0xD4 = 1445 1428 { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 255, 63, BAMBOO_PT }; 1429 + static struct wacom_features wacom_features_0xD6 = 1430 + { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; 1431 + static struct wacom_features wacom_features_0xD7 = 1432 + { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; 1446 1433 static struct wacom_features wacom_features_0xD8 = 1447 1434 { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; 1448 1435 static struct wacom_features wacom_features_0xDA = ··· 1528 1507 { USB_DEVICE_WACOM(0xD2) }, 1529 1508 { USB_DEVICE_WACOM(0xD3) }, 1530 1509 { USB_DEVICE_WACOM(0xD4) }, 1510 + { USB_DEVICE_WACOM(0xD6) }, 1511 + { USB_DEVICE_WACOM(0xD7) }, 1531 1512 { USB_DEVICE_WACOM(0xD8) }, 1532 1513 { USB_DEVICE_WACOM(0xDA) }, 1533 1514 { USB_DEVICE_WACOM(0xDB) },
+36 -3
drivers/input/touchscreen/bu21013_ts.c
··· 12 12 #include <linux/input.h> 13 13 #include <linux/input/bu21013.h> 14 14 #include <linux/slab.h> 15 + #include <linux/regulator/consumer.h> 15 16 16 17 #define PEN_DOWN_INTR 0 17 18 #define MAX_FINGERS 2 ··· 140 139 * @chip: pointer to the touch panel controller 141 140 * @in_dev: pointer to the input device structure 142 141 * @intr_pin: interrupt pin value 142 + * @regulator: pointer to the Regulator used for touch screen 143 143 * 144 144 * Touch panel device data structure 145 145 */ ··· 151 149 const struct bu21013_platform_device *chip; 152 150 struct input_dev *in_dev; 153 151 unsigned int intr_pin; 152 + struct regulator *regulator; 154 153 }; 155 154 156 155 /** ··· 459 456 bu21013_data->in_dev = in_dev; 460 457 bu21013_data->chip = pdata; 461 458 bu21013_data->client = client; 459 + 460 + bu21013_data->regulator = regulator_get(&client->dev, "V-TOUCH"); 461 + if (IS_ERR(bu21013_data->regulator)) { 462 + dev_err(&client->dev, "regulator_get failed\n"); 463 + error = PTR_ERR(bu21013_data->regulator); 464 + goto err_free_mem; 465 + } 466 + 467 + error = regulator_enable(bu21013_data->regulator); 468 + if (error < 0) { 469 + dev_err(&client->dev, "regulator enable failed\n"); 470 + goto err_put_regulator; 471 + } 472 + 462 473 bu21013_data->touch_stopped = false; 463 474 init_waitqueue_head(&bu21013_data->wait); 464 475 ··· 481 464 error = pdata->cs_en(pdata->cs_pin); 482 465 if (error < 0) { 483 466 dev_err(&client->dev, "chip init failed\n"); 484 - goto err_free_mem; 467 + goto err_disable_regulator; 485 468 } 486 469 } 487 470 ··· 502 485 __set_bit(EV_ABS, in_dev->evbit); 503 486 504 487 input_set_abs_params(in_dev, ABS_MT_POSITION_X, 0, 505 - pdata->x_max_res, 0, 0); 488 + pdata->touch_x_max, 0, 0); 506 489 input_set_abs_params(in_dev, ABS_MT_POSITION_Y, 0, 507 - pdata->y_max_res, 0, 0); 490 + pdata->touch_y_max, 0, 0); 508 491 input_set_drvdata(in_dev, bu21013_data); 509 492 510 493 error = request_threaded_irq(pdata->irq, NULL, bu21013_gpio_irq, ··· 530 513 bu21013_free_irq(bu21013_data); 531 514 err_cs_disable: 532 515 pdata->cs_dis(pdata->cs_pin); 516 + err_disable_regulator: 517 + regulator_disable(bu21013_data->regulator); 518 + err_put_regulator: 519 + regulator_put(bu21013_data->regulator); 533 520 err_free_mem: 534 521 input_free_device(in_dev); 535 522 kfree(bu21013_data); ··· 556 535 bu21013_data->chip->cs_dis(bu21013_data->chip->cs_pin); 557 536 558 537 input_unregister_device(bu21013_data->in_dev); 538 + 539 + regulator_disable(bu21013_data->regulator); 540 + regulator_put(bu21013_data->regulator); 541 + 559 542 kfree(bu21013_data); 560 543 561 544 device_init_wakeup(&client->dev, false); ··· 586 561 else 587 562 disable_irq(bu21013_data->chip->irq); 588 563 564 + regulator_disable(bu21013_data->regulator); 565 + 589 566 return 0; 590 567 } 591 568 ··· 603 576 struct bu21013_ts_data *bu21013_data = dev_get_drvdata(dev); 604 577 struct i2c_client *client = bu21013_data->client; 605 578 int retval; 579 + 580 + retval = regulator_enable(bu21013_data->regulator); 581 + if (retval < 0) { 582 + dev_err(&client->dev, "bu21013 regulator enable failed\n"); 583 + return retval; 584 + } 606 585 607 586 retval = bu21013_init_chip(bu21013_data); 608 587 if (retval < 0) {
+3 -2
drivers/input/touchscreen/tnetv107x-ts.c
··· 14 14 */ 15 15 16 16 #include <linux/kernel.h> 17 + #include <linux/err.h> 17 18 #include <linux/errno.h> 18 19 #include <linux/input.h> 19 20 #include <linux/platform_device.h> ··· 290 289 } 291 290 292 291 ts->clk = clk_get(dev, NULL); 293 - if (!ts->clk) { 292 + if (IS_ERR(ts->clk)) { 294 293 dev_err(dev, "cannot claim device clock\n"); 295 - error = -EINVAL; 294 + error = PTR_ERR(ts->clk); 296 295 goto error_clk; 297 296 } 298 297
+1
drivers/leds/leds-pwm.c
··· 69 69 led_dat->pwm = pwm_request(cur_led->pwm_id, 70 70 cur_led->name); 71 71 if (IS_ERR(led_dat->pwm)) { 72 + ret = PTR_ERR(led_dat->pwm); 72 73 dev_err(&pdev->dev, "unable to request PWM %d\n", 73 74 cur_led->pwm_id); 74 75 goto err;
+23 -81
drivers/mmc/host/mmci.c
··· 46 46 * is asserted (likewise for RX) 47 47 * @fifohalfsize: number of bytes that can be written when MCI_TXFIFOHALFEMPTY 48 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 49 * @sdio: variant supports SDIO 54 50 * @st_clkdiv: true if using a ST-specific clock divider algorithm 55 51 */ ··· 55 59 unsigned int datalength_bits; 56 60 unsigned int fifosize; 57 61 unsigned int fifohalfsize; 58 - bool broken_blockend; 59 - bool broken_blockend_dma; 60 62 bool sdio; 61 63 bool st_clkdiv; 62 64 }; ··· 70 76 .fifohalfsize = 8 * 4, 71 77 .clkreg_enable = 1 << 13, /* HWFCEN */ 72 78 .datalength_bits = 16, 73 - .broken_blockend_dma = true, 74 79 .sdio = true, 75 80 }; 76 81 ··· 79 86 .clkreg = MCI_CLK_ENABLE, 80 87 .clkreg_enable = 1 << 14, /* HWFCEN */ 81 88 .datalength_bits = 24, 82 - .broken_blockend = true, 83 89 .sdio = true, 84 90 .st_clkdiv = true, 85 91 }; ··· 202 210 host->data = data; 203 211 host->size = data->blksz * data->blocks; 204 212 host->data_xfered = 0; 205 - host->blockend = false; 206 - host->dataend = false; 207 213 208 214 mmci_init_sg(host, data); 209 215 ··· 278 288 mmci_data_irq(struct mmci_host *host, struct mmc_data *data, 279 289 unsigned int status) 280 290 { 281 - struct variant_data *variant = host->variant; 282 - 283 291 /* First check for errors */ 284 292 if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_TXUNDERRUN|MCI_RXOVERRUN)) { 285 - dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status); 286 - if (status & MCI_DATACRCFAIL) 287 - data->error = -EILSEQ; 288 - else if (status & MCI_DATATIMEOUT) 289 - data->error = -ETIMEDOUT; 290 - else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) 291 - data->error = -EIO; 293 + u32 remain, success; 292 294 293 - /* Force-complete the transaction */ 294 - host->blockend = true; 295 - host->dataend = true; 295 + /* Calculate how far we are into the transfer */ 296 + remain = readl(host->base + MMCIDATACNT) << 2; 297 + success = data->blksz * data->blocks - remain; 298 + 299 + dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status); 300 + if (status & MCI_DATACRCFAIL) { 301 + /* Last block was not successful */ 302 + host->data_xfered = ((success / data->blksz) - 1 * data->blksz); 303 + data->error = -EILSEQ; 304 + } else if (status & MCI_DATATIMEOUT) { 305 + host->data_xfered = success; 306 + data->error = -ETIMEDOUT; 307 + } else if (status & (MCI_TXUNDERRUN|MCI_RXOVERRUN)) { 308 + host->data_xfered = success; 309 + data->error = -EIO; 310 + } 296 311 297 312 /* 298 313 * We hit an error condition. Ensure that any data ··· 316 321 } 317 322 } 318 323 319 - /* 320 - * On ARM variants in PIO mode, MCI_DATABLOCKEND 321 - * is always sent first, and we increase the 322 - * transfered number of bytes for that IRQ. Then 323 - * MCI_DATAEND follows and we conclude the transaction. 324 - * 325 - * On the Ux500 single-IRQ variant MCI_DATABLOCKEND 326 - * doesn't seem to immediately clear from the status, 327 - * so we can't use it keep count when only one irq is 328 - * used because the irq will hit for other reasons, and 329 - * then the flag is still up. So we use the MCI_DATAEND 330 - * IRQ at the end of the entire transfer because 331 - * MCI_DATABLOCKEND is broken. 332 - * 333 - * In the U300, the IRQs can arrive out-of-order, 334 - * e.g. MCI_DATABLOCKEND sometimes arrives after MCI_DATAEND, 335 - * so for this case we use the flags "blockend" and 336 - * "dataend" to make sure both IRQs have arrived before 337 - * concluding the transaction. (This does not apply 338 - * to the Ux500 which doesn't fire MCI_DATABLOCKEND 339 - * at all.) In DMA mode it suffers from the same problem 340 - * as the Ux500. 341 - */ 342 - if (status & MCI_DATABLOCKEND) { 343 - /* 344 - * Just being a little over-cautious, we do not 345 - * use this progressive update if the hardware blockend 346 - * flag is unreliable: since it can stay high between 347 - * IRQs it will corrupt the transfer counter. 348 - */ 349 - if (!variant->broken_blockend) 350 - host->data_xfered += data->blksz; 351 - host->blockend = true; 352 - } 324 + if (status & MCI_DATABLOCKEND) 325 + dev_err(mmc_dev(host->mmc), "stray MCI_DATABLOCKEND interrupt\n"); 353 326 354 - if (status & MCI_DATAEND) 355 - host->dataend = true; 356 - 357 - /* 358 - * On variants with broken blockend we shall only wait for dataend, 359 - * on others we must sync with the blockend signal since they can 360 - * appear out-of-order. 361 - */ 362 - if (host->dataend && (host->blockend || variant->broken_blockend)) { 327 + if (status & MCI_DATAEND) { 363 328 mmci_stop_data(host); 364 329 365 - /* Reset these flags */ 366 - host->blockend = false; 367 - host->dataend = false; 368 - 369 - /* 370 - * Variants with broken blockend flags need to handle the 371 - * end of the entire transfer here. 372 - */ 373 - if (variant->broken_blockend && !data->error) 330 + if (!data->error) 331 + /* The error clause is handled above, success! */ 374 332 host->data_xfered += data->blksz * data->blocks; 375 333 376 334 if (!data->stop) { ··· 718 770 struct variant_data *variant = id->data; 719 771 struct mmci_host *host; 720 772 struct mmc_host *mmc; 721 - unsigned int mask; 722 773 int ret; 723 774 724 775 /* must have platform data */ ··· 898 951 goto irq0_free; 899 952 } 900 953 901 - mask = MCI_IRQENABLE; 902 - /* Don't use the datablockend flag if it's broken */ 903 - if (variant->broken_blockend) 904 - mask &= ~MCI_DATABLOCKEND; 905 - 906 - writel(mask, host->base + MMCIMASK0); 954 + writel(MCI_IRQENABLE, host->base + MMCIMASK0); 907 955 908 956 amba_set_drvdata(dev, mmc); 909 957
+1 -4
drivers/mmc/host/mmci.h
··· 137 137 #define MCI_IRQENABLE \ 138 138 (MCI_CMDCRCFAILMASK|MCI_DATACRCFAILMASK|MCI_CMDTIMEOUTMASK| \ 139 139 MCI_DATATIMEOUTMASK|MCI_TXUNDERRUNMASK|MCI_RXOVERRUNMASK| \ 140 - MCI_CMDRESPENDMASK|MCI_CMDSENTMASK|MCI_DATABLOCKENDMASK) 140 + MCI_CMDRESPENDMASK|MCI_CMDSENTMASK) 141 141 142 142 /* These interrupts are directed to IRQ1 when two IRQ lines are available */ 143 143 #define MCI_IRQ1MASK \ ··· 176 176 177 177 struct timer_list timer; 178 178 unsigned int oldstat; 179 - 180 - bool blockend; 181 - bool dataend; 182 179 183 180 /* pio stuff */ 184 181 struct sg_mapping_iter sg_miter;
+22 -30
drivers/mmc/host/msm_sdcc.c
··· 383 383 host->curr.user_pages = 0; 384 384 385 385 box = &nc->cmd[0]; 386 - for (i = 0; i < host->dma.num_ents; i++) { 386 + 387 + /* location of command block must be 64 bit aligned */ 388 + BUG_ON(host->dma.cmd_busaddr & 0x07); 389 + 390 + nc->cmdptr = (host->dma.cmd_busaddr >> 3) | CMD_PTR_LP; 391 + host->dma.hdr.cmdptr = DMOV_CMD_PTR_LIST | 392 + DMOV_CMD_ADDR(host->dma.cmdptr_busaddr); 393 + host->dma.hdr.complete_func = msmsdcc_dma_complete_func; 394 + 395 + n = dma_map_sg(mmc_dev(host->mmc), host->dma.sg, 396 + host->dma.num_ents, host->dma.dir); 397 + if (n == 0) { 398 + printk(KERN_ERR "%s: Unable to map in all sg elements\n", 399 + mmc_hostname(host->mmc)); 400 + host->dma.sg = NULL; 401 + host->dma.num_ents = 0; 402 + return -ENOMEM; 403 + } 404 + 405 + for_each_sg(host->dma.sg, sg, n, i) { 406 + 387 407 box->cmd = CMD_MODE_BOX; 388 408 389 - /* Initialize sg dma address */ 390 - sg->dma_address = page_to_dma(mmc_dev(host->mmc), sg_page(sg)) 391 - + sg->offset; 392 - 393 - if (i == (host->dma.num_ents - 1)) 409 + if (i == n - 1) 394 410 box->cmd |= CMD_LC; 395 411 rows = (sg_dma_len(sg) % MCI_FIFOSIZE) ? 396 412 (sg_dma_len(sg) / MCI_FIFOSIZE) + 1 : ··· 434 418 box->cmd |= CMD_DST_CRCI(crci); 435 419 } 436 420 box++; 437 - sg++; 438 - } 439 - 440 - /* location of command block must be 64 bit aligned */ 441 - BUG_ON(host->dma.cmd_busaddr & 0x07); 442 - 443 - nc->cmdptr = (host->dma.cmd_busaddr >> 3) | CMD_PTR_LP; 444 - host->dma.hdr.cmdptr = DMOV_CMD_PTR_LIST | 445 - DMOV_CMD_ADDR(host->dma.cmdptr_busaddr); 446 - host->dma.hdr.complete_func = msmsdcc_dma_complete_func; 447 - 448 - n = dma_map_sg(mmc_dev(host->mmc), host->dma.sg, 449 - host->dma.num_ents, host->dma.dir); 450 - /* dsb inside dma_map_sg will write nc out to mem as well */ 451 - 452 - if (n != host->dma.num_ents) { 453 - printk(KERN_ERR "%s: Unable to map in all sg elements\n", 454 - mmc_hostname(host->mmc)); 455 - host->dma.sg = NULL; 456 - host->dma.num_ents = 0; 457 - return -ENOMEM; 458 421 } 459 422 460 423 return 0; ··· 1326 1331 if (host->timer.function) 1327 1332 pr_info("%s: Polling status mode enabled\n", mmc_hostname(mmc)); 1328 1333 1329 - #if BUSCLK_PWRSAVE 1330 - msmsdcc_disable_clocks(host, 1); 1331 - #endif 1332 1334 return 0; 1333 1335 cmd_irq_free: 1334 1336 free_irq(cmd_irqres->start, host);
+1 -1
drivers/net/arm/ks8695net.c
··· 1644 1644 module_init(ks8695_init); 1645 1645 module_exit(ks8695_cleanup); 1646 1646 1647 - MODULE_AUTHOR("Simtec Electronics") 1647 + MODULE_AUTHOR("Simtec Electronics"); 1648 1648 MODULE_DESCRIPTION("Micrel KS8695 (Centaur) Ethernet driver"); 1649 1649 MODULE_LICENSE("GPL"); 1650 1650 MODULE_ALIAS("platform:" MODULENAME);
+2 -2
drivers/parport/share.c
··· 678 678 679 679 /* Make sure we haven't left any pointers around in the wait 680 680 * list. */ 681 - spin_lock (&port->waitlist_lock); 681 + spin_lock_irq(&port->waitlist_lock); 682 682 if (dev->waitprev || dev->waitnext || port->waithead == dev) { 683 683 if (dev->waitprev) 684 684 dev->waitprev->waitnext = dev->waitnext; ··· 689 689 else 690 690 port->waittail = dev->waitprev; 691 691 } 692 - spin_unlock (&port->waitlist_lock); 692 + spin_unlock_irq(&port->waitlist_lock); 693 693 694 694 kfree(dev->state); 695 695 kfree(dev);
+3 -4
drivers/platform/x86/intel_scu_ipc.c
··· 161 161 { 162 162 int i, nc, bytes, d; 163 163 u32 offset = 0; 164 - u32 err = 0; 164 + int err; 165 165 u8 cbuf[IPC_WWBUF_SIZE] = { }; 166 166 u32 *wbuf = (u32 *)&cbuf; 167 167 ··· 404 404 */ 405 405 int intel_scu_ipc_simple_command(int cmd, int sub) 406 406 { 407 - u32 err = 0; 407 + int err; 408 408 409 409 mutex_lock(&ipclock); 410 410 if (ipcdev.pdev == NULL) { ··· 434 434 int intel_scu_ipc_command(int cmd, int sub, u32 *in, int inlen, 435 435 u32 *out, int outlen) 436 436 { 437 - u32 err = 0; 438 - int i = 0; 437 + int i, err; 439 438 440 439 mutex_lock(&ipclock); 441 440 if (ipcdev.pdev == NULL) {
+1 -1
drivers/platform/x86/intel_scu_ipcutil.c
··· 128 128 module_init(ipc_module_init); 129 129 module_exit(ipc_module_exit); 130 130 131 - MODULE_LICENSE("GPL V2"); 131 + MODULE_LICENSE("GPL v2"); 132 132 MODULE_DESCRIPTION("Utility driver for intel scu ipc"); 133 133 MODULE_AUTHOR("Sreedhara <sreedhara.ds@intel.com>");
-2
drivers/pps/clients/pps-ktimer.c
··· 46 46 /* First of all we get the time stamp... */ 47 47 pps_get_ts(&ts); 48 48 49 - dev_info(pps->dev, "PPS event at %lu\n", jiffies); 50 - 51 49 pps_event(pps, &ts, PPS_CAPTUREASSERT, NULL); 52 50 53 51 mod_timer(&ktimer, jiffies + HZ);
+1 -1
drivers/pps/clients/pps_parport.c
··· 163 163 } 164 164 165 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 167 if (!device->pardev) { 168 168 pr_err("couldn't register with %s\n", port->name); 169 169 goto err_free;
+1 -1
drivers/pps/generators/pps_gen_parport.c
··· 198 198 } 199 199 200 200 device.pardev = parport_register_device(port, KBUILD_MODNAME, 201 - NULL, NULL, NULL, 0, &device); 201 + NULL, NULL, NULL, PARPORT_FLAG_EXCL, &device); 202 202 if (!device.pardev) { 203 203 pr_err("couldn't register with %s\n", port->name); 204 204 return;
+2
drivers/rapidio/rio-scan.c
··· 943 943 * @port: Master port to send transactions 944 944 * @destid: Current destination ID in network 945 945 * @hopcount: Number of hops into the network 946 + * @prev: previous rio_dev 947 + * @prev_port: previous port number 946 948 * 947 949 * Recursively discovers a RIO network. Transactions are sent via the 948 950 * master port passed in @port.
-12
drivers/rtc/Kconfig
··· 97 97 98 98 If unsure, say Y. 99 99 100 - config RTC_INTF_DEV_UIE_EMUL 101 - bool "RTC UIE emulation on dev interface" 102 - depends on RTC_INTF_DEV 103 - help 104 - Provides an emulation for RTC_UIE if the underlying rtc chip 105 - driver does not expose RTC_UIE ioctls. Those requests generate 106 - once-per-second update interrupts, used for synchronization. 107 - 108 - The emulation code will read the time from the hardware 109 - clock several times per second, please enable this option 110 - only if you know that you really need it. 111 - 112 100 config RTC_DRV_TEST 113 101 tristate "Test driver/device" 114 102 help
+37 -24
drivers/rtc/interface.c
··· 16 16 #include <linux/log2.h> 17 17 #include <linux/workqueue.h> 18 18 19 + static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer); 20 + static void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer); 21 + 19 22 static int __rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm) 20 23 { 21 24 int err; ··· 123 120 err = mutex_lock_interruptible(&rtc->ops_lock); 124 121 if (err) 125 122 return err; 126 - alarm->enabled = rtc->aie_timer.enabled; 127 - if (alarm->enabled) 123 + if (rtc->ops == NULL) 124 + err = -ENODEV; 125 + else if (!rtc->ops->read_alarm) 126 + err = -EINVAL; 127 + else { 128 + memset(alarm, 0, sizeof(struct rtc_wkalrm)); 129 + alarm->enabled = rtc->aie_timer.enabled; 128 130 alarm->time = rtc_ktime_to_tm(rtc->aie_timer.node.expires); 131 + } 129 132 mutex_unlock(&rtc->ops_lock); 130 133 131 - return 0; 134 + return err; 132 135 } 133 136 EXPORT_SYMBOL_GPL(rtc_read_alarm); 134 137 ··· 184 175 return err; 185 176 if (rtc->aie_timer.enabled) { 186 177 rtc_timer_remove(rtc, &rtc->aie_timer); 187 - rtc->aie_timer.enabled = 0; 188 178 } 189 179 rtc->aie_timer.node.expires = rtc_tm_to_ktime(alarm->time); 190 180 rtc->aie_timer.period = ktime_set(0, 0); 191 181 if (alarm->enabled) { 192 - rtc->aie_timer.enabled = 1; 193 - rtc_timer_enqueue(rtc, &rtc->aie_timer); 182 + err = rtc_timer_enqueue(rtc, &rtc->aie_timer); 194 183 } 195 184 mutex_unlock(&rtc->ops_lock); 196 - return 0; 185 + return err; 197 186 } 198 187 EXPORT_SYMBOL_GPL(rtc_set_alarm); 199 188 ··· 202 195 return err; 203 196 204 197 if (rtc->aie_timer.enabled != enabled) { 205 - if (enabled) { 206 - rtc->aie_timer.enabled = 1; 207 - rtc_timer_enqueue(rtc, &rtc->aie_timer); 208 - } else { 198 + if (enabled) 199 + err = rtc_timer_enqueue(rtc, &rtc->aie_timer); 200 + else 209 201 rtc_timer_remove(rtc, &rtc->aie_timer); 210 - rtc->aie_timer.enabled = 0; 211 - } 212 202 } 203 + 204 + if (err) 205 + return err; 213 206 214 207 if (!rtc->ops) 215 208 err = -ENODEV; ··· 242 235 now = rtc_tm_to_ktime(tm); 243 236 rtc->uie_rtctimer.node.expires = ktime_add(now, onesec); 244 237 rtc->uie_rtctimer.period = ktime_set(1, 0); 245 - rtc->uie_rtctimer.enabled = 1; 246 - rtc_timer_enqueue(rtc, &rtc->uie_rtctimer); 247 - } else { 238 + err = rtc_timer_enqueue(rtc, &rtc->uie_rtctimer); 239 + } else 248 240 rtc_timer_remove(rtc, &rtc->uie_rtctimer); 249 - rtc->uie_rtctimer.enabled = 0; 250 - } 251 241 252 242 out: 253 243 mutex_unlock(&rtc->ops_lock); ··· 492 488 * Enqueues a timer onto the rtc devices timerqueue and sets 493 489 * the next alarm event appropriately. 494 490 * 491 + * Sets the enabled bit on the added timer. 492 + * 495 493 * Must hold ops_lock for proper serialization of timerqueue 496 494 */ 497 - void rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer) 495 + static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer) 498 496 { 497 + timer->enabled = 1; 499 498 timerqueue_add(&rtc->timerqueue, &timer->node); 500 499 if (&timer->node == timerqueue_getnext(&rtc->timerqueue)) { 501 500 struct rtc_wkalrm alarm; ··· 508 501 err = __rtc_set_alarm(rtc, &alarm); 509 502 if (err == -ETIME) 510 503 schedule_work(&rtc->irqwork); 504 + else if (err) { 505 + timerqueue_del(&rtc->timerqueue, &timer->node); 506 + timer->enabled = 0; 507 + return err; 508 + } 511 509 } 510 + return 0; 512 511 } 513 512 514 513 /** ··· 525 512 * Removes a timer onto the rtc devices timerqueue and sets 526 513 * the next alarm event appropriately. 527 514 * 515 + * Clears the enabled bit on the removed timer. 516 + * 528 517 * Must hold ops_lock for proper serialization of timerqueue 529 518 */ 530 - void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer) 519 + static void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer) 531 520 { 532 521 struct timerqueue_node *next = timerqueue_getnext(&rtc->timerqueue); 533 522 timerqueue_del(&rtc->timerqueue, &timer->node); 534 - 523 + timer->enabled = 0; 535 524 if (next == &timer->node) { 536 525 struct rtc_wkalrm alarm; 537 526 int err; ··· 641 626 timer->node.expires = expires; 642 627 timer->period = period; 643 628 644 - timer->enabled = 1; 645 - rtc_timer_enqueue(rtc, timer); 629 + ret = rtc_timer_enqueue(rtc, timer); 646 630 647 631 mutex_unlock(&rtc->ops_lock); 648 632 return ret; ··· 659 645 mutex_lock(&rtc->ops_lock); 660 646 if (timer->enabled) 661 647 rtc_timer_remove(rtc, timer); 662 - timer->enabled = 0; 663 648 mutex_unlock(&rtc->ops_lock); 664 649 return ret; 665 650 }
+4 -2
drivers/sh/intc/chip.c
··· 173 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 179 static unsigned char intc_irq_sense_table[IRQ_TYPE_SENSE_MASK + 1] = { 179 180 [IRQ_TYPE_EDGE_FALLING] = VALID(0), ··· 202 201 ihp = intc_find_irq(d->sense, d->nr_sense, irq); 203 202 if (ihp) { 204 203 addr = INTC_REG(d, _INTC_ADDR_E(ihp->handle), 0); 205 - intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle, value); 204 + intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle, 205 + value & ~SENSE_VALID_FLAG); 206 206 } 207 207 208 208 return 0;
+4 -4
drivers/staging/msm/msm_fb.c
··· 347 347 if ((!mfd) || (mfd->key != MFD_KEY)) 348 348 return 0; 349 349 350 - acquire_console_sem(); 350 + console_lock(); 351 351 fb_set_suspend(mfd->fbi, 1); 352 352 353 353 ret = msm_fb_suspend_sub(mfd); ··· 358 358 pdev->dev.power.power_state = state; 359 359 } 360 360 361 - release_console_sem(); 361 + console_unlock(); 362 362 return ret; 363 363 } 364 364 #else ··· 431 431 if ((!mfd) || (mfd->key != MFD_KEY)) 432 432 return 0; 433 433 434 - acquire_console_sem(); 434 + console_lock(); 435 435 ret = msm_fb_resume_sub(mfd); 436 436 pdev->dev.power.power_state = PMSG_ON; 437 437 fb_set_suspend(mfd->fbi, 1); 438 - release_console_sem(); 438 + console_unlock(); 439 439 440 440 return ret; 441 441 }
+5 -5
drivers/staging/olpc_dcon/olpc_dcon.c
··· 373 373 * 374 374 * For now, we just hope.. 375 375 */ 376 - acquire_console_sem(); 376 + console_lock(); 377 377 ignore_fb_events = 1; 378 378 if (fb_blank(fbinfo, FB_BLANK_UNBLANK)) { 379 379 ignore_fb_events = 0; 380 - release_console_sem(); 380 + console_unlock(); 381 381 printk(KERN_ERR "olpc-dcon: Failed to enter CPU mode\n"); 382 382 dcon_pending = DCON_SOURCE_DCON; 383 383 return; 384 384 } 385 385 ignore_fb_events = 0; 386 - release_console_sem(); 386 + console_unlock(); 387 387 388 388 /* And turn off the DCON */ 389 389 pdata->set_dconload(1); ··· 435 435 } 436 436 } 437 437 438 - acquire_console_sem(); 438 + console_lock(); 439 439 ignore_fb_events = 1; 440 440 if (fb_blank(fbinfo, FB_BLANK_POWERDOWN)) 441 441 printk(KERN_ERR "olpc-dcon: couldn't blank fb!\n"); 442 442 ignore_fb_events = 0; 443 - release_console_sem(); 443 + console_unlock(); 444 444 445 445 printk(KERN_INFO "olpc-dcon: The DCON has control\n"); 446 446 break;
+4 -4
drivers/staging/sm7xx/smtcfb.c
··· 1044 1044 1045 1045 /* when doing suspend, call fb apis and pci apis */ 1046 1046 if (msg.event == PM_EVENT_SUSPEND) { 1047 - acquire_console_sem(); 1047 + console_lock(); 1048 1048 fb_set_suspend(&sfb->fb, 1); 1049 - release_console_sem(); 1049 + console_unlock(); 1050 1050 retv = pci_save_state(pdev); 1051 1051 pci_disable_device(pdev); 1052 1052 retv = pci_choose_state(pdev, msg); ··· 1105 1105 1106 1106 smtcfb_setmode(sfb); 1107 1107 1108 - acquire_console_sem(); 1108 + console_lock(); 1109 1109 fb_set_suspend(&sfb->fb, 0); 1110 - release_console_sem(); 1110 + console_unlock(); 1111 1111 1112 1112 return 0; 1113 1113 }
+1 -1
drivers/tty/serial/sb1250-duart.c
··· 829 829 #ifdef CONFIG_SERIAL_SB1250_DUART_CONSOLE 830 830 /* 831 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 833 * shouldn't be interrupted for more console activity. 834 834 */ 835 835 static void sbd_console_putchar(struct uart_port *uport, int ch)
+1 -1
drivers/tty/sysrq.c
··· 46 46 #include <asm/irq_regs.h> 47 47 48 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 50 static bool __read_mostly sysrq_always_enabled; 51 51 52 52 static bool sysrq_on(void)
+2 -2
drivers/tty/tty_io.c
··· 3256 3256 struct console *c; 3257 3257 ssize_t count = 0; 3258 3258 3259 - acquire_console_sem(); 3259 + console_lock(); 3260 3260 for (c = console_drivers; c; c = c->next) { 3261 3261 if (!c->device) 3262 3262 continue; ··· 3271 3271 while (i--) 3272 3272 count += sprintf(buf + count, "%s%d%c", 3273 3273 cs[i]->name, cs[i]->index, i ? ' ':'\n'); 3274 - release_console_sem(); 3274 + console_unlock(); 3275 3275 3276 3276 return count; 3277 3277 }
+2 -2
drivers/tty/vt/selection.c
··· 316 316 /* always called with BTM from vt_ioctl */ 317 317 WARN_ON(!tty_locked()); 318 318 319 - acquire_console_sem(); 319 + console_lock(); 320 320 poke_blanked_console(); 321 - release_console_sem(); 321 + console_unlock(); 322 322 323 323 ld = tty_ldisc_ref(tty); 324 324 if (!ld) {
+8 -8
drivers/tty/vt/vc_screen.c
··· 202 202 /* Select the proper current console and verify 203 203 * sanity of the situation under the console lock. 204 204 */ 205 - acquire_console_sem(); 205 + console_lock(); 206 206 207 207 attr = (currcons & 128); 208 208 currcons = (currcons & 127); ··· 336 336 * the pagefault handling code may want to call printk(). 337 337 */ 338 338 339 - release_console_sem(); 339 + console_unlock(); 340 340 ret = copy_to_user(buf, con_buf_start, orig_count); 341 - acquire_console_sem(); 341 + console_lock(); 342 342 343 343 if (ret) { 344 344 read += (orig_count - ret); ··· 354 354 if (read) 355 355 ret = read; 356 356 unlock_out: 357 - release_console_sem(); 357 + console_unlock(); 358 358 mutex_unlock(&con_buf_mtx); 359 359 return ret; 360 360 } ··· 379 379 /* Select the proper current console and verify 380 380 * sanity of the situation under the console lock. 381 381 */ 382 - acquire_console_sem(); 382 + console_lock(); 383 383 384 384 attr = (currcons & 128); 385 385 currcons = (currcons & 127); ··· 414 414 /* Temporarily drop the console lock so that we can read 415 415 * in the write data from userspace safely. 416 416 */ 417 - release_console_sem(); 417 + console_unlock(); 418 418 ret = copy_from_user(con_buf, buf, this_round); 419 - acquire_console_sem(); 419 + console_lock(); 420 420 421 421 if (ret) { 422 422 this_round -= ret; ··· 542 542 vcs_scr_updated(vc); 543 543 544 544 unlock_out: 545 - release_console_sem(); 545 + console_unlock(); 546 546 547 547 mutex_unlock(&con_buf_mtx); 548 548
+62 -62
drivers/tty/vt/vt.c
··· 1003 1003 struct vc_data *vc = tty->driver_data; 1004 1004 int ret; 1005 1005 1006 - acquire_console_sem(); 1006 + console_lock(); 1007 1007 ret = vc_do_resize(tty, vc, ws->ws_col, ws->ws_row); 1008 - release_console_sem(); 1008 + console_unlock(); 1009 1009 return ret; 1010 1010 } 1011 1011 ··· 1271 1271 vc->vc_color = vc->vc_def_color; 1272 1272 } 1273 1273 1274 - /* console_sem is held */ 1274 + /* console_lock is held */ 1275 1275 static void csi_m(struct vc_data *vc) 1276 1276 { 1277 1277 int i; ··· 1415 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 1419 static void set_mode(struct vc_data *vc, int on_off) 1420 1420 { 1421 1421 int i; ··· 1485 1485 } 1486 1486 } 1487 1487 1488 - /* console_sem is held */ 1488 + /* console_lock is held */ 1489 1489 static void setterm_command(struct vc_data *vc) 1490 1490 { 1491 1491 switch(vc->vc_par[0]) { ··· 1545 1545 } 1546 1546 } 1547 1547 1548 - /* console_sem is held */ 1548 + /* console_lock is held */ 1549 1549 static void csi_at(struct vc_data *vc, unsigned int nr) 1550 1550 { 1551 1551 if (nr > vc->vc_cols - vc->vc_x) ··· 1555 1555 insert_char(vc, nr); 1556 1556 } 1557 1557 1558 - /* console_sem is held */ 1558 + /* console_lock is held */ 1559 1559 static void csi_L(struct vc_data *vc, unsigned int nr) 1560 1560 { 1561 1561 if (nr > vc->vc_rows - vc->vc_y) ··· 1566 1566 vc->vc_need_wrap = 0; 1567 1567 } 1568 1568 1569 - /* console_sem is held */ 1569 + /* console_lock is held */ 1570 1570 static void csi_P(struct vc_data *vc, unsigned int nr) 1571 1571 { 1572 1572 if (nr > vc->vc_cols - vc->vc_x) ··· 1576 1576 delete_char(vc, nr); 1577 1577 } 1578 1578 1579 - /* console_sem is held */ 1579 + /* console_lock is held */ 1580 1580 static void csi_M(struct vc_data *vc, unsigned int nr) 1581 1581 { 1582 1582 if (nr > vc->vc_rows - vc->vc_y) ··· 1587 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 1591 static void save_cur(struct vc_data *vc) 1592 1592 { 1593 1593 vc->vc_saved_x = vc->vc_x; ··· 1603 1603 vc->vc_saved_G1 = vc->vc_G1_charset; 1604 1604 } 1605 1605 1606 - /* console_sem is held */ 1606 + /* console_lock is held */ 1607 1607 static void restore_cur(struct vc_data *vc) 1608 1608 { 1609 1609 gotoxy(vc, vc->vc_saved_x, vc->vc_saved_y); ··· 1625 1625 EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd, 1626 1626 ESpalette }; 1627 1627 1628 - /* console_sem is held (except via vc_init()) */ 1628 + /* console_lock is held (except via vc_init()) */ 1629 1629 static void reset_terminal(struct vc_data *vc, int do_clear) 1630 1630 { 1631 1631 vc->vc_top = 0; ··· 1685 1685 csi_J(vc, 2); 1686 1686 } 1687 1687 1688 - /* console_sem is held */ 1688 + /* console_lock is held */ 1689 1689 static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) 1690 1690 { 1691 1691 /* ··· 2119 2119 return bisearch(ucs, double_width, ARRAY_SIZE(double_width) - 1); 2120 2120 } 2121 2121 2122 - /* acquires console_sem */ 2122 + /* acquires console_lock */ 2123 2123 static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int count) 2124 2124 { 2125 2125 #ifdef VT_BUF_VRAM_ONLY ··· 2147 2147 2148 2148 might_sleep(); 2149 2149 2150 - acquire_console_sem(); 2150 + console_lock(); 2151 2151 vc = tty->driver_data; 2152 2152 if (vc == NULL) { 2153 2153 printk(KERN_ERR "vt: argh, driver_data is NULL !\n"); 2154 - release_console_sem(); 2154 + console_unlock(); 2155 2155 return 0; 2156 2156 } 2157 2157 ··· 2159 2159 if (!vc_cons_allocated(currcons)) { 2160 2160 /* could this happen? */ 2161 2161 printk_once("con_write: tty %d not allocated\n", currcons+1); 2162 - release_console_sem(); 2162 + console_unlock(); 2163 2163 return 0; 2164 2164 } 2165 2165 ··· 2375 2375 } 2376 2376 FLUSH 2377 2377 console_conditional_schedule(); 2378 - release_console_sem(); 2378 + console_unlock(); 2379 2379 notify_update(vc); 2380 2380 return n; 2381 2381 #undef FLUSH ··· 2388 2388 * us to do the switches asynchronously (needed when we want 2389 2389 * to switch due to a keyboard interrupt). Synchronization 2390 2390 * with other console code and prevention of re-entrancy is 2391 - * ensured with console_sem. 2391 + * ensured with console_lock. 2392 2392 */ 2393 2393 static void console_callback(struct work_struct *ignored) 2394 2394 { 2395 - acquire_console_sem(); 2395 + console_lock(); 2396 2396 2397 2397 if (want_console >= 0) { 2398 2398 if (want_console != fg_console && ··· 2422 2422 } 2423 2423 notify_update(vc_cons[fg_console].d); 2424 2424 2425 - release_console_sem(); 2425 + console_unlock(); 2426 2426 } 2427 2427 2428 2428 int set_console(int nr) ··· 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 2608 * There are some functions which don't need it. 2609 2609 * ··· 2629 2629 switch (type) 2630 2630 { 2631 2631 case TIOCL_SETSEL: 2632 - acquire_console_sem(); 2632 + console_lock(); 2633 2633 ret = set_selection((struct tiocl_selection __user *)(p+1), tty); 2634 - release_console_sem(); 2634 + console_unlock(); 2635 2635 break; 2636 2636 case TIOCL_PASTESEL: 2637 2637 ret = paste_selection(tty); 2638 2638 break; 2639 2639 case TIOCL_UNBLANKSCREEN: 2640 - acquire_console_sem(); 2640 + console_lock(); 2641 2641 unblank_screen(); 2642 - release_console_sem(); 2642 + console_unlock(); 2643 2643 break; 2644 2644 case TIOCL_SELLOADLUT: 2645 2645 ret = sel_loadlut(p); ··· 2688 2688 } 2689 2689 break; 2690 2690 case TIOCL_BLANKSCREEN: /* until explicitly unblanked, not only poked */ 2691 - acquire_console_sem(); 2691 + console_lock(); 2692 2692 ignore_poke = 1; 2693 2693 do_blank_screen(0); 2694 - release_console_sem(); 2694 + console_unlock(); 2695 2695 break; 2696 2696 case TIOCL_BLANKEDSCREEN: 2697 2697 ret = console_blanked; ··· 2790 2790 return; 2791 2791 2792 2792 /* if we race with con_close(), vt may be null */ 2793 - acquire_console_sem(); 2793 + console_lock(); 2794 2794 vc = tty->driver_data; 2795 2795 if (vc) 2796 2796 set_cursor(vc); 2797 - release_console_sem(); 2797 + console_unlock(); 2798 2798 } 2799 2799 2800 2800 /* ··· 2805 2805 unsigned int currcons = tty->index; 2806 2806 int ret = 0; 2807 2807 2808 - acquire_console_sem(); 2808 + console_lock(); 2809 2809 if (tty->driver_data == NULL) { 2810 2810 ret = vc_allocate(currcons); 2811 2811 if (ret == 0) { ··· 2813 2813 2814 2814 /* Still being freed */ 2815 2815 if (vc->port.tty) { 2816 - release_console_sem(); 2816 + console_unlock(); 2817 2817 return -ERESTARTSYS; 2818 2818 } 2819 2819 tty->driver_data = vc; ··· 2827 2827 tty->termios->c_iflag |= IUTF8; 2828 2828 else 2829 2829 tty->termios->c_iflag &= ~IUTF8; 2830 - release_console_sem(); 2830 + console_unlock(); 2831 2831 return ret; 2832 2832 } 2833 2833 } 2834 - release_console_sem(); 2834 + console_unlock(); 2835 2835 return ret; 2836 2836 } 2837 2837 ··· 2844 2844 { 2845 2845 struct vc_data *vc = tty->driver_data; 2846 2846 BUG_ON(vc == NULL); 2847 - acquire_console_sem(); 2847 + console_lock(); 2848 2848 vc->port.tty = NULL; 2849 - release_console_sem(); 2849 + console_unlock(); 2850 2850 tty_shutdown(tty); 2851 2851 } 2852 2852 ··· 2893 2893 struct vc_data *vc; 2894 2894 unsigned int currcons = 0, i; 2895 2895 2896 - acquire_console_sem(); 2896 + console_lock(); 2897 2897 2898 2898 if (conswitchp) 2899 2899 display_desc = conswitchp->con_startup(); 2900 2900 if (!display_desc) { 2901 2901 fg_console = 0; 2902 - release_console_sem(); 2902 + console_unlock(); 2903 2903 return 0; 2904 2904 } 2905 2905 ··· 2946 2946 printable = 1; 2947 2947 printk("\n"); 2948 2948 2949 - release_console_sem(); 2949 + console_unlock(); 2950 2950 2951 2951 #ifdef CONFIG_VT_CONSOLE 2952 2952 register_console(&vt_console_driver); ··· 3037 3037 if (!try_module_get(owner)) 3038 3038 return -ENODEV; 3039 3039 3040 - acquire_console_sem(); 3040 + console_lock(); 3041 3041 3042 3042 /* check if driver is registered */ 3043 3043 for (i = 0; i < MAX_NR_CON_DRIVER; i++) { ··· 3122 3122 3123 3123 retval = 0; 3124 3124 err: 3125 - release_console_sem(); 3125 + console_unlock(); 3126 3126 module_put(owner); 3127 3127 return retval; 3128 3128 }; ··· 3171 3171 if (!try_module_get(owner)) 3172 3172 return -ENODEV; 3173 3173 3174 - acquire_console_sem(); 3174 + console_lock(); 3175 3175 3176 3176 /* check if driver is registered and if it is unbindable */ 3177 3177 for (i = 0; i < MAX_NR_CON_DRIVER; i++) { ··· 3185 3185 } 3186 3186 3187 3187 if (retval) { 3188 - release_console_sem(); 3188 + console_unlock(); 3189 3189 goto err; 3190 3190 } 3191 3191 ··· 3204 3204 } 3205 3205 3206 3206 if (retval) { 3207 - release_console_sem(); 3207 + console_unlock(); 3208 3208 goto err; 3209 3209 } 3210 3210 3211 3211 if (!con_is_bound(csw)) { 3212 - release_console_sem(); 3212 + console_unlock(); 3213 3213 goto err; 3214 3214 } 3215 3215 ··· 3238 3238 if (!con_is_bound(csw)) 3239 3239 con_driver->flag &= ~CON_DRIVER_FLAG_INIT; 3240 3240 3241 - release_console_sem(); 3241 + console_unlock(); 3242 3242 /* ignore return value, binding should not fail */ 3243 3243 bind_con_driver(defcsw, first, last, deflt); 3244 3244 err: ··· 3538 3538 if (!try_module_get(owner)) 3539 3539 return -ENODEV; 3540 3540 3541 - acquire_console_sem(); 3541 + console_lock(); 3542 3542 3543 3543 for (i = 0; i < MAX_NR_CON_DRIVER; i++) { 3544 3544 con_driver = &registered_con_driver[i]; ··· 3592 3592 } 3593 3593 3594 3594 err: 3595 - release_console_sem(); 3595 + console_unlock(); 3596 3596 module_put(owner); 3597 3597 return retval; 3598 3598 } ··· 3613 3613 { 3614 3614 int i, retval = -ENODEV; 3615 3615 3616 - acquire_console_sem(); 3616 + console_lock(); 3617 3617 3618 3618 /* cannot unregister a bound driver */ 3619 3619 if (con_is_bound(csw)) ··· 3639 3639 } 3640 3640 } 3641 3641 err: 3642 - release_console_sem(); 3642 + console_unlock(); 3643 3643 return retval; 3644 3644 } 3645 3645 EXPORT_SYMBOL(unregister_con_driver); ··· 3934 3934 { 3935 3935 int rc; 3936 3936 3937 - acquire_console_sem(); 3937 + console_lock(); 3938 3938 rc = set_get_cmap (arg,1); 3939 - release_console_sem(); 3939 + console_unlock(); 3940 3940 3941 3941 return rc; 3942 3942 } ··· 3945 3945 { 3946 3946 int rc; 3947 3947 3948 - acquire_console_sem(); 3948 + console_lock(); 3949 3949 rc = set_get_cmap (arg,0); 3950 - release_console_sem(); 3950 + console_unlock(); 3951 3951 3952 3952 return rc; 3953 3953 } ··· 3994 3994 } else 3995 3995 font.data = NULL; 3996 3996 3997 - acquire_console_sem(); 3997 + console_lock(); 3998 3998 if (vc->vc_sw->con_font_get) 3999 3999 rc = vc->vc_sw->con_font_get(vc, &font); 4000 4000 else 4001 4001 rc = -ENOSYS; 4002 - release_console_sem(); 4002 + console_unlock(); 4003 4003 4004 4004 if (rc) 4005 4005 goto out; ··· 4076 4076 font.data = memdup_user(op->data, size); 4077 4077 if (IS_ERR(font.data)) 4078 4078 return PTR_ERR(font.data); 4079 - acquire_console_sem(); 4079 + console_lock(); 4080 4080 if (vc->vc_sw->con_font_set) 4081 4081 rc = vc->vc_sw->con_font_set(vc, &font, op->flags); 4082 4082 else 4083 4083 rc = -ENOSYS; 4084 - release_console_sem(); 4084 + console_unlock(); 4085 4085 kfree(font.data); 4086 4086 return rc; 4087 4087 } ··· 4103 4103 else 4104 4104 name[MAX_FONT_NAME - 1] = 0; 4105 4105 4106 - acquire_console_sem(); 4106 + console_lock(); 4107 4107 if (vc->vc_sw->con_font_default) 4108 4108 rc = vc->vc_sw->con_font_default(vc, &font, s); 4109 4109 else 4110 4110 rc = -ENOSYS; 4111 - release_console_sem(); 4111 + console_unlock(); 4112 4112 if (!rc) { 4113 4113 op->width = font.width; 4114 4114 op->height = font.height; ··· 4124 4124 if (vc->vc_mode != KD_TEXT) 4125 4125 return -EINVAL; 4126 4126 4127 - acquire_console_sem(); 4127 + console_lock(); 4128 4128 if (!vc->vc_sw->con_font_copy) 4129 4129 rc = -ENOSYS; 4130 4130 else if (con < 0 || !vc_cons_allocated(con)) ··· 4133 4133 rc = 0; 4134 4134 else 4135 4135 rc = vc->vc_sw->con_font_copy(vc, con); 4136 - release_console_sem(); 4136 + console_unlock(); 4137 4137 return rc; 4138 4138 } 4139 4139
+30 -30
drivers/tty/vt/vt_ioctl.c
··· 649 649 /* 650 650 * explicitly blank/unblank the screen if switching modes 651 651 */ 652 - acquire_console_sem(); 652 + console_lock(); 653 653 if (arg == KD_TEXT) 654 654 do_unblank_screen(1); 655 655 else 656 656 do_blank_screen(1); 657 - release_console_sem(); 657 + console_unlock(); 658 658 break; 659 659 660 660 case KDGETMODE: ··· 893 893 ret = -EINVAL; 894 894 goto out; 895 895 } 896 - acquire_console_sem(); 896 + console_lock(); 897 897 vc->vt_mode = tmp; 898 898 /* the frsig is ignored, so we set it to 0 */ 899 899 vc->vt_mode.frsig = 0; ··· 901 901 vc->vt_pid = get_pid(task_pid(current)); 902 902 /* no switch is required -- saw@shade.msu.ru */ 903 903 vc->vt_newvt = -1; 904 - release_console_sem(); 904 + console_unlock(); 905 905 break; 906 906 } 907 907 ··· 910 910 struct vt_mode tmp; 911 911 int rc; 912 912 913 - acquire_console_sem(); 913 + console_lock(); 914 914 memcpy(&tmp, &vc->vt_mode, sizeof(struct vt_mode)); 915 - release_console_sem(); 915 + console_unlock(); 916 916 917 917 rc = copy_to_user(up, &tmp, sizeof(struct vt_mode)); 918 918 if (rc) ··· 965 965 ret = -ENXIO; 966 966 else { 967 967 arg--; 968 - acquire_console_sem(); 968 + console_lock(); 969 969 ret = vc_allocate(arg); 970 - release_console_sem(); 970 + console_unlock(); 971 971 if (ret) 972 972 break; 973 973 set_console(arg); ··· 990 990 ret = -ENXIO; 991 991 else { 992 992 vsa.console--; 993 - acquire_console_sem(); 993 + console_lock(); 994 994 ret = vc_allocate(vsa.console); 995 995 if (ret == 0) { 996 996 struct vc_data *nvc; ··· 1003 1003 put_pid(nvc->vt_pid); 1004 1004 nvc->vt_pid = get_pid(task_pid(current)); 1005 1005 } 1006 - release_console_sem(); 1006 + console_unlock(); 1007 1007 if (ret) 1008 1008 break; 1009 1009 /* Commence switch and lock */ ··· 1044 1044 /* 1045 1045 * Switching-from response 1046 1046 */ 1047 - acquire_console_sem(); 1047 + console_lock(); 1048 1048 if (vc->vt_newvt >= 0) { 1049 1049 if (arg == 0) 1050 1050 /* ··· 1063 1063 vc->vt_newvt = -1; 1064 1064 ret = vc_allocate(newvt); 1065 1065 if (ret) { 1066 - release_console_sem(); 1066 + console_unlock(); 1067 1067 break; 1068 1068 } 1069 1069 /* ··· 1083 1083 if (arg != VT_ACKACQ) 1084 1084 ret = -EINVAL; 1085 1085 } 1086 - release_console_sem(); 1086 + console_unlock(); 1087 1087 break; 1088 1088 1089 1089 /* ··· 1096 1096 } 1097 1097 if (arg == 0) { 1098 1098 /* deallocate all unused consoles, but leave 0 */ 1099 - acquire_console_sem(); 1099 + console_lock(); 1100 1100 for (i=1; i<MAX_NR_CONSOLES; i++) 1101 1101 if (! VT_BUSY(i)) 1102 1102 vc_deallocate(i); 1103 - release_console_sem(); 1103 + console_unlock(); 1104 1104 } else { 1105 1105 /* deallocate a single console, if possible */ 1106 1106 arg--; 1107 1107 if (VT_BUSY(arg)) 1108 1108 ret = -EBUSY; 1109 1109 else if (arg) { /* leave 0 */ 1110 - acquire_console_sem(); 1110 + console_lock(); 1111 1111 vc_deallocate(arg); 1112 - release_console_sem(); 1112 + console_unlock(); 1113 1113 } 1114 1114 } 1115 1115 break; ··· 1126 1126 get_user(cc, &vtsizes->v_cols)) 1127 1127 ret = -EFAULT; 1128 1128 else { 1129 - acquire_console_sem(); 1129 + console_lock(); 1130 1130 for (i = 0; i < MAX_NR_CONSOLES; i++) { 1131 1131 vc = vc_cons[i].d; 1132 1132 ··· 1135 1135 vc_resize(vc_cons[i].d, cc, ll); 1136 1136 } 1137 1137 } 1138 - release_console_sem(); 1138 + console_unlock(); 1139 1139 } 1140 1140 break; 1141 1141 } ··· 1187 1187 for (i = 0; i < MAX_NR_CONSOLES; i++) { 1188 1188 if (!vc_cons[i].d) 1189 1189 continue; 1190 - acquire_console_sem(); 1190 + console_lock(); 1191 1191 if (vlin) 1192 1192 vc_cons[i].d->vc_scan_lines = vlin; 1193 1193 if (clin) 1194 1194 vc_cons[i].d->vc_font.height = clin; 1195 1195 vc_cons[i].d->vc_resize_user = 1; 1196 1196 vc_resize(vc_cons[i].d, cc, ll); 1197 - release_console_sem(); 1197 + console_unlock(); 1198 1198 } 1199 1199 break; 1200 1200 } ··· 1367 1367 struct vc_data *vc; 1368 1368 struct tty_struct *tty; 1369 1369 1370 - acquire_console_sem(); 1370 + console_lock(); 1371 1371 vc = vc_con->d; 1372 1372 if (vc) { 1373 1373 tty = vc->port.tty; ··· 1379 1379 __do_SAK(tty); 1380 1380 reset_vc(vc); 1381 1381 } 1382 - release_console_sem(); 1382 + console_unlock(); 1383 1383 } 1384 1384 1385 1385 #ifdef CONFIG_COMPAT ··· 1737 1737 { 1738 1738 int prev; 1739 1739 1740 - acquire_console_sem(); 1740 + console_lock(); 1741 1741 /* Graphics mode - up to X */ 1742 1742 if (disable_vt_switch) { 1743 - release_console_sem(); 1743 + console_unlock(); 1744 1744 return 0; 1745 1745 } 1746 1746 prev = fg_console; ··· 1748 1748 if (alloc && vc_allocate(vt)) { 1749 1749 /* we can't have a free VC for now. Too bad, 1750 1750 * we don't want to mess the screen for now. */ 1751 - release_console_sem(); 1751 + console_unlock(); 1752 1752 return -ENOSPC; 1753 1753 } 1754 1754 ··· 1758 1758 * Let the calling function know so it can decide 1759 1759 * what to do. 1760 1760 */ 1761 - release_console_sem(); 1761 + console_unlock(); 1762 1762 return -EIO; 1763 1763 } 1764 - release_console_sem(); 1764 + console_unlock(); 1765 1765 tty_lock(); 1766 1766 if (vt_waitactive(vt + 1)) { 1767 1767 pr_debug("Suspend: Can't switch VCs."); ··· 1781 1781 */ 1782 1782 void pm_set_vt_switch(int do_switch) 1783 1783 { 1784 - acquire_console_sem(); 1784 + console_lock(); 1785 1785 disable_vt_switch = !do_switch; 1786 - release_console_sem(); 1786 + console_unlock(); 1787 1787 } 1788 1788 EXPORT_SYMBOL(pm_set_vt_switch);
+6 -6
drivers/video/arkfb.c
··· 23 23 #include <linux/svga.h> 24 24 #include <linux/init.h> 25 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 27 #include <video/vga.h> 28 28 29 29 #ifdef CONFIG_MTRR ··· 1091 1091 1092 1092 dev_info(info->device, "suspend\n"); 1093 1093 1094 - acquire_console_sem(); 1094 + console_lock(); 1095 1095 mutex_lock(&(par->open_lock)); 1096 1096 1097 1097 if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) { 1098 1098 mutex_unlock(&(par->open_lock)); 1099 - release_console_sem(); 1099 + console_unlock(); 1100 1100 return 0; 1101 1101 } 1102 1102 ··· 1107 1107 pci_set_power_state(dev, pci_choose_state(dev, state)); 1108 1108 1109 1109 mutex_unlock(&(par->open_lock)); 1110 - release_console_sem(); 1110 + console_unlock(); 1111 1111 1112 1112 return 0; 1113 1113 } ··· 1122 1122 1123 1123 dev_info(info->device, "resume\n"); 1124 1124 1125 - acquire_console_sem(); 1125 + console_lock(); 1126 1126 mutex_lock(&(par->open_lock)); 1127 1127 1128 1128 if (par->ref_count == 0) ··· 1141 1141 1142 1142 fail: 1143 1143 mutex_unlock(&(par->open_lock)); 1144 - release_console_sem(); 1144 + console_unlock(); 1145 1145 return 0; 1146 1146 } 1147 1147 #else
+6 -6
drivers/video/aty/aty128fb.c
··· 1860 1860 { 1861 1861 struct aty128fb_par *par = data; 1862 1862 1863 - if (try_acquire_console_sem()) 1863 + if (!console_trylock()) 1864 1864 return; 1865 1865 pci_restore_state(par->pdev); 1866 1866 aty128_do_resume(par->pdev); 1867 - release_console_sem(); 1867 + console_unlock(); 1868 1868 } 1869 1869 #endif /* CONFIG_PPC_PMAC */ 1870 1870 ··· 2438 2438 2439 2439 printk(KERN_DEBUG "aty128fb: suspending...\n"); 2440 2440 2441 - acquire_console_sem(); 2441 + console_lock(); 2442 2442 2443 2443 fb_set_suspend(info, 1); 2444 2444 ··· 2470 2470 if (state.event != PM_EVENT_ON) 2471 2471 aty128_set_suspend(par, 1); 2472 2472 2473 - release_console_sem(); 2473 + console_unlock(); 2474 2474 2475 2475 pdev->dev.power.power_state = state; 2476 2476 ··· 2527 2527 { 2528 2528 int rc; 2529 2529 2530 - acquire_console_sem(); 2530 + console_lock(); 2531 2531 rc = aty128_do_resume(pdev); 2532 - release_console_sem(); 2532 + console_unlock(); 2533 2533 2534 2534 return rc; 2535 2535 }
+5 -5
drivers/video/aty/atyfb_base.c
··· 2069 2069 if (state.event == pdev->dev.power.power_state.event) 2070 2070 return 0; 2071 2071 2072 - acquire_console_sem(); 2072 + console_lock(); 2073 2073 2074 2074 fb_set_suspend(info, 1); 2075 2075 ··· 2097 2097 par->lock_blank = 0; 2098 2098 atyfb_blank(FB_BLANK_UNBLANK, info); 2099 2099 fb_set_suspend(info, 0); 2100 - release_console_sem(); 2100 + console_unlock(); 2101 2101 return -EIO; 2102 2102 } 2103 2103 #else 2104 2104 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 2105 2105 #endif 2106 2106 2107 - release_console_sem(); 2107 + console_unlock(); 2108 2108 2109 2109 pdev->dev.power.power_state = state; 2110 2110 ··· 2133 2133 if (pdev->dev.power.power_state.event == PM_EVENT_ON) 2134 2134 return 0; 2135 2135 2136 - acquire_console_sem(); 2136 + console_lock(); 2137 2137 2138 2138 /* 2139 2139 * PCI state will have been restored by the core, so ··· 2161 2161 par->lock_blank = 0; 2162 2162 atyfb_blank(FB_BLANK_UNBLANK, info); 2163 2163 2164 - release_console_sem(); 2164 + console_unlock(); 2165 2165 2166 2166 pdev->dev.power.power_state = PMSG_ON; 2167 2167
+5 -5
drivers/video/aty/radeon_pm.c
··· 2626 2626 goto done; 2627 2627 } 2628 2628 2629 - acquire_console_sem(); 2629 + console_lock(); 2630 2630 2631 2631 fb_set_suspend(info, 1); 2632 2632 ··· 2690 2690 if (rinfo->pm_mode & radeon_pm_d2) 2691 2691 radeon_set_suspend(rinfo, 1); 2692 2692 2693 - release_console_sem(); 2693 + console_unlock(); 2694 2694 2695 2695 done: 2696 2696 pdev->dev.power.power_state = mesg; ··· 2715 2715 return 0; 2716 2716 2717 2717 if (rinfo->no_schedule) { 2718 - if (try_acquire_console_sem()) 2718 + if (!console_trylock()) 2719 2719 return 0; 2720 2720 } else 2721 - acquire_console_sem(); 2721 + console_lock(); 2722 2722 2723 2723 printk(KERN_DEBUG "radeonfb (%s): resuming from state: %d...\n", 2724 2724 pci_name(pdev), pdev->dev.power.power_state.event); ··· 2783 2783 pdev->dev.power.power_state = PMSG_ON; 2784 2784 2785 2785 bail: 2786 - release_console_sem(); 2786 + console_unlock(); 2787 2787 2788 2788 return rc; 2789 2789 }
+33 -25
drivers/video/bf537-lq035.c
··· 696 696 { 697 697 struct backlight_properties props; 698 698 dma_addr_t dma_handle; 699 + int ret; 699 700 700 701 if (request_dma(CH_PPI, KBUILD_MODNAME)) { 701 702 pr_err("couldn't request PPI DMA\n"); ··· 705 704 706 705 if (request_ports()) { 707 706 pr_err("couldn't request gpio port\n"); 708 - free_dma(CH_PPI); 709 - return -EFAULT; 707 + ret = -EFAULT; 708 + goto out_ports; 710 709 } 711 710 712 711 fb_buffer = dma_alloc_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, 713 712 &dma_handle, GFP_KERNEL); 714 713 if (fb_buffer == NULL) { 715 714 pr_err("couldn't allocate dma buffer\n"); 716 - free_dma(CH_PPI); 717 - free_ports(); 718 - return -ENOMEM; 715 + ret = -ENOMEM; 716 + goto out_dma_coherent; 719 717 } 720 718 721 719 if (L1_DATA_A_LENGTH) ··· 725 725 726 726 if (dma_desc_table == NULL) { 727 727 pr_err("couldn't allocate dma descriptor\n"); 728 - free_dma(CH_PPI); 729 - free_ports(); 730 - dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); 731 - return -ENOMEM; 728 + ret = -ENOMEM; 729 + goto out_table; 732 730 } 733 731 734 732 bfin_lq035_fb.screen_base = (void *)fb_buffer; ··· 769 771 bfin_lq035_fb.pseudo_palette = kzalloc(sizeof(u32) * 16, GFP_KERNEL); 770 772 if (bfin_lq035_fb.pseudo_palette == NULL) { 771 773 pr_err("failed to allocate pseudo_palette\n"); 772 - free_dma(CH_PPI); 773 - free_ports(); 774 - dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); 775 - return -ENOMEM; 774 + ret = -ENOMEM; 775 + goto out_palette; 776 776 } 777 777 778 778 if (fb_alloc_cmap(&bfin_lq035_fb.cmap, NBR_PALETTE, 0) < 0) { 779 779 pr_err("failed to allocate colormap (%d entries)\n", 780 780 NBR_PALETTE); 781 - free_dma(CH_PPI); 782 - free_ports(); 783 - dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); 784 - kfree(bfin_lq035_fb.pseudo_palette); 785 - return -EFAULT; 781 + ret = -EFAULT; 782 + goto out_cmap; 786 783 } 787 784 788 785 if (register_framebuffer(&bfin_lq035_fb) < 0) { 789 786 pr_err("unable to register framebuffer\n"); 790 - free_dma(CH_PPI); 791 - free_ports(); 792 - dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); 793 - fb_buffer = NULL; 794 - kfree(bfin_lq035_fb.pseudo_palette); 795 - fb_dealloc_cmap(&bfin_lq035_fb.cmap); 796 - return -EINVAL; 787 + ret = -EINVAL; 788 + goto out_reg; 797 789 } 798 790 799 791 i2c_add_driver(&ad5280_driver); ··· 795 807 796 808 lcd_dev = lcd_device_register(KBUILD_MODNAME, &pdev->dev, NULL, 797 809 &bfin_lcd_ops); 810 + if (IS_ERR(lcd_dev)) { 811 + pr_err("unable to register lcd\n"); 812 + ret = PTR_ERR(lcd_dev); 813 + goto out_lcd; 814 + } 798 815 lcd_dev->props.max_contrast = 255, 799 816 800 817 pr_info("initialized"); 801 818 802 819 return 0; 820 + out_lcd: 821 + unregister_framebuffer(&bfin_lq035_fb); 822 + out_reg: 823 + fb_dealloc_cmap(&bfin_lq035_fb.cmap); 824 + out_cmap: 825 + kfree(bfin_lq035_fb.pseudo_palette); 826 + out_palette: 827 + out_table: 828 + dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); 829 + fb_buffer = NULL; 830 + out_dma_coherent: 831 + free_ports(); 832 + out_ports: 833 + free_dma(CH_PPI); 834 + return ret; 803 835 } 804 836 805 837 static int __devexit bfin_lq035_remove(struct platform_device *pdev)
+4 -4
drivers/video/chipsfb.c
··· 460 460 if (!(state.event & PM_EVENT_SLEEP)) 461 461 goto done; 462 462 463 - acquire_console_sem(); 463 + console_lock(); 464 464 chipsfb_blank(1, p); 465 465 fb_set_suspend(p, 1); 466 - release_console_sem(); 466 + console_unlock(); 467 467 done: 468 468 pdev->dev.power.power_state = state; 469 469 return 0; ··· 473 473 { 474 474 struct fb_info *p = pci_get_drvdata(pdev); 475 475 476 - acquire_console_sem(); 476 + console_lock(); 477 477 fb_set_suspend(p, 0); 478 478 chipsfb_blank(0, p); 479 - release_console_sem(); 479 + console_unlock(); 480 480 481 481 pdev->dev.power.power_state = PMSG_ON; 482 482 return 0;
+21 -21
drivers/video/console/fbcon.c
··· 375 375 int c; 376 376 int mode; 377 377 378 - acquire_console_sem(); 378 + console_lock(); 379 379 if (ops && ops->currcon != -1) 380 380 vc = vc_cons[ops->currcon].d; 381 381 382 382 if (!vc || !CON_IS_VISIBLE(vc) || 383 383 registered_fb[con2fb_map[vc->vc_num]] != info || 384 384 vc->vc_deccm != 1) { 385 - release_console_sem(); 385 + console_unlock(); 386 386 return; 387 387 } 388 388 ··· 392 392 CM_ERASE : CM_DRAW; 393 393 ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1), 394 394 get_color(vc, info, c, 0)); 395 - release_console_sem(); 395 + console_unlock(); 396 396 } 397 397 398 398 static void cursor_timer_handler(unsigned long dev_addr) ··· 836 836 837 837 found = search_fb_in_map(newidx); 838 838 839 - acquire_console_sem(); 839 + console_lock(); 840 840 con2fb_map[unit] = newidx; 841 841 if (!err && !found) 842 842 err = con2fb_acquire_newinfo(vc, info, unit, oldidx); ··· 863 863 if (!search_fb_in_map(info_idx)) 864 864 info_idx = newidx; 865 865 866 - release_console_sem(); 866 + console_unlock(); 867 867 return err; 868 868 } 869 869 ··· 3321 3321 if (fbcon_has_exited) 3322 3322 return count; 3323 3323 3324 - acquire_console_sem(); 3324 + console_lock(); 3325 3325 idx = con2fb_map[fg_console]; 3326 3326 3327 3327 if (idx == -1 || registered_fb[idx] == NULL) ··· 3331 3331 rotate = simple_strtoul(buf, last, 0); 3332 3332 fbcon_rotate(info, rotate); 3333 3333 err: 3334 - release_console_sem(); 3334 + console_unlock(); 3335 3335 return count; 3336 3336 } 3337 3337 ··· 3346 3346 if (fbcon_has_exited) 3347 3347 return count; 3348 3348 3349 - acquire_console_sem(); 3349 + console_lock(); 3350 3350 idx = con2fb_map[fg_console]; 3351 3351 3352 3352 if (idx == -1 || registered_fb[idx] == NULL) ··· 3356 3356 rotate = simple_strtoul(buf, last, 0); 3357 3357 fbcon_rotate_all(info, rotate); 3358 3358 err: 3359 - release_console_sem(); 3359 + console_unlock(); 3360 3360 return count; 3361 3361 } 3362 3362 ··· 3369 3369 if (fbcon_has_exited) 3370 3370 return 0; 3371 3371 3372 - acquire_console_sem(); 3372 + console_lock(); 3373 3373 idx = con2fb_map[fg_console]; 3374 3374 3375 3375 if (idx == -1 || registered_fb[idx] == NULL) ··· 3378 3378 info = registered_fb[idx]; 3379 3379 rotate = fbcon_get_rotate(info); 3380 3380 err: 3381 - release_console_sem(); 3381 + console_unlock(); 3382 3382 return snprintf(buf, PAGE_SIZE, "%d\n", rotate); 3383 3383 } 3384 3384 ··· 3392 3392 if (fbcon_has_exited) 3393 3393 return 0; 3394 3394 3395 - acquire_console_sem(); 3395 + console_lock(); 3396 3396 idx = con2fb_map[fg_console]; 3397 3397 3398 3398 if (idx == -1 || registered_fb[idx] == NULL) ··· 3406 3406 3407 3407 blink = (ops->flags & FBCON_FLAGS_CURSOR_TIMER) ? 1 : 0; 3408 3408 err: 3409 - release_console_sem(); 3409 + console_unlock(); 3410 3410 return snprintf(buf, PAGE_SIZE, "%d\n", blink); 3411 3411 } 3412 3412 ··· 3421 3421 if (fbcon_has_exited) 3422 3422 return count; 3423 3423 3424 - acquire_console_sem(); 3424 + console_lock(); 3425 3425 idx = con2fb_map[fg_console]; 3426 3426 3427 3427 if (idx == -1 || registered_fb[idx] == NULL) ··· 3443 3443 } 3444 3444 3445 3445 err: 3446 - release_console_sem(); 3446 + console_unlock(); 3447 3447 return count; 3448 3448 } 3449 3449 ··· 3482 3482 if (num_registered_fb) { 3483 3483 int i; 3484 3484 3485 - acquire_console_sem(); 3485 + console_lock(); 3486 3486 3487 3487 for (i = 0; i < FB_MAX; i++) { 3488 3488 if (registered_fb[i] != NULL) { ··· 3491 3491 } 3492 3492 } 3493 3493 3494 - release_console_sem(); 3494 + console_unlock(); 3495 3495 fbcon_takeover(0); 3496 3496 } 3497 3497 } ··· 3552 3552 { 3553 3553 int i; 3554 3554 3555 - acquire_console_sem(); 3555 + console_lock(); 3556 3556 fb_register_client(&fbcon_event_notifier); 3557 3557 fbcon_device = device_create(fb_class, NULL, MKDEV(0, 0), NULL, 3558 3558 "fbcon"); ··· 3568 3568 for (i = 0; i < MAX_NR_CONSOLES; i++) 3569 3569 con2fb_map[i] = -1; 3570 3570 3571 - release_console_sem(); 3571 + console_unlock(); 3572 3572 fbcon_start(); 3573 3573 return 0; 3574 3574 } ··· 3591 3591 3592 3592 static void __exit fb_console_exit(void) 3593 3593 { 3594 - acquire_console_sem(); 3594 + console_lock(); 3595 3595 fb_unregister_client(&fbcon_event_notifier); 3596 3596 fbcon_deinit_device(); 3597 3597 device_destroy(fb_class, MKDEV(0, 0)); 3598 3598 fbcon_exit(); 3599 - release_console_sem(); 3599 + console_unlock(); 3600 3600 unregister_con_driver(&fb_con); 3601 3601 } 3602 3602
+1 -5
drivers/video/console/vgacon.c
··· 202 202 } 203 203 } 204 204 205 - /* 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) 205 + static void vgacon_scrollback_startup(void) 210 206 { 211 207 vgacon_scrollback = kcalloc(CONFIG_VGACON_SOFT_SCROLLBACK_SIZE, 1024, GFP_NOWAIT); 212 208 vgacon_scrollback_init(vga_video_num_columns * 2);
+6 -5
drivers/video/da8xx-fb.c
··· 1092 1092 1093 1093 irq_freq: 1094 1094 #ifdef CONFIG_CPU_FREQ 1095 + lcd_da8xx_cpufreq_deregister(par); 1096 + #endif 1095 1097 err_cpu_freq: 1096 1098 unregister_framebuffer(da8xx_fb_info); 1097 - #endif 1098 1099 1099 1100 err_dealloc_cmap: 1100 1101 fb_dealloc_cmap(&da8xx_fb_info->cmap); ··· 1131 1130 struct fb_info *info = platform_get_drvdata(dev); 1132 1131 struct da8xx_fb_par *par = info->par; 1133 1132 1134 - acquire_console_sem(); 1133 + console_lock(); 1135 1134 if (par->panel_power_ctrl) 1136 1135 par->panel_power_ctrl(0); 1137 1136 1138 1137 fb_set_suspend(info, 1); 1139 1138 lcd_disable_raster(); 1140 1139 clk_disable(par->lcdc_clk); 1141 - release_console_sem(); 1140 + console_unlock(); 1142 1141 1143 1142 return 0; 1144 1143 } ··· 1147 1146 struct fb_info *info = platform_get_drvdata(dev); 1148 1147 struct da8xx_fb_par *par = info->par; 1149 1148 1150 - acquire_console_sem(); 1149 + console_lock(); 1151 1150 if (par->panel_power_ctrl) 1152 1151 par->panel_power_ctrl(1); 1153 1152 1154 1153 clk_enable(par->lcdc_clk); 1155 1154 lcd_enable_raster(); 1156 1155 fb_set_suspend(info, 0); 1157 - release_console_sem(); 1156 + console_unlock(); 1158 1157 1159 1158 return 0; 1160 1159 }
+6 -6
drivers/video/fbmem.c
··· 1036 1036 return -EFAULT; 1037 1037 if (!lock_fb_info(info)) 1038 1038 return -ENODEV; 1039 - acquire_console_sem(); 1039 + console_lock(); 1040 1040 info->flags |= FBINFO_MISC_USEREVENT; 1041 1041 ret = fb_set_var(info, &var); 1042 1042 info->flags &= ~FBINFO_MISC_USEREVENT; 1043 - release_console_sem(); 1043 + console_unlock(); 1044 1044 unlock_fb_info(info); 1045 1045 if (!ret && copy_to_user(argp, &var, sizeof(var))) 1046 1046 ret = -EFAULT; ··· 1072 1072 return -EFAULT; 1073 1073 if (!lock_fb_info(info)) 1074 1074 return -ENODEV; 1075 - acquire_console_sem(); 1075 + console_lock(); 1076 1076 ret = fb_pan_display(info, &var); 1077 - release_console_sem(); 1077 + console_unlock(); 1078 1078 unlock_fb_info(info); 1079 1079 if (ret == 0 && copy_to_user(argp, &var, sizeof(var))) 1080 1080 return -EFAULT; ··· 1119 1119 case FBIOBLANK: 1120 1120 if (!lock_fb_info(info)) 1121 1121 return -ENODEV; 1122 - acquire_console_sem(); 1122 + console_lock(); 1123 1123 info->flags |= FBINFO_MISC_USEREVENT; 1124 1124 ret = fb_blank(info, arg); 1125 1125 info->flags &= ~FBINFO_MISC_USEREVENT; 1126 - release_console_sem(); 1126 + console_unlock(); 1127 1127 unlock_fb_info(info); 1128 1128 break; 1129 1129 default:
+10 -10
drivers/video/fbsysfs.c
··· 90 90 int err; 91 91 92 92 var->activate |= FB_ACTIVATE_FORCE; 93 - acquire_console_sem(); 93 + console_lock(); 94 94 fb_info->flags |= FBINFO_MISC_USEREVENT; 95 95 err = fb_set_var(fb_info, var); 96 96 fb_info->flags &= ~FBINFO_MISC_USEREVENT; 97 - release_console_sem(); 97 + console_unlock(); 98 98 if (err) 99 99 return err; 100 100 return 0; ··· 175 175 if (i * sizeof(struct fb_videomode) != count) 176 176 return -EINVAL; 177 177 178 - acquire_console_sem(); 178 + console_lock(); 179 179 list_splice(&fb_info->modelist, &old_list); 180 180 fb_videomode_to_modelist((const struct fb_videomode *)buf, i, 181 181 &fb_info->modelist); ··· 185 185 } else 186 186 fb_destroy_modelist(&old_list); 187 187 188 - release_console_sem(); 188 + console_unlock(); 189 189 190 190 return 0; 191 191 } ··· 301 301 char *last = NULL; 302 302 int err; 303 303 304 - acquire_console_sem(); 304 + console_lock(); 305 305 fb_info->flags |= FBINFO_MISC_USEREVENT; 306 306 err = fb_blank(fb_info, simple_strtoul(buf, &last, 0)); 307 307 fb_info->flags &= ~FBINFO_MISC_USEREVENT; 308 - release_console_sem(); 308 + console_unlock(); 309 309 if (err < 0) 310 310 return err; 311 311 return count; ··· 364 364 return -EINVAL; 365 365 var.yoffset = simple_strtoul(last, &last, 0); 366 366 367 - acquire_console_sem(); 367 + console_lock(); 368 368 err = fb_pan_display(fb_info, &var); 369 - release_console_sem(); 369 + console_unlock(); 370 370 371 371 if (err < 0) 372 372 return err; ··· 399 399 400 400 state = simple_strtoul(buf, &last, 0); 401 401 402 - acquire_console_sem(); 402 + console_lock(); 403 403 fb_set_suspend(fb_info, (int)state); 404 - release_console_sem(); 404 + console_unlock(); 405 405 406 406 return count; 407 407 }
+4 -4
drivers/video/geode/gxfb_core.c
··· 344 344 struct fb_info *info = pci_get_drvdata(pdev); 345 345 346 346 if (state.event == PM_EVENT_SUSPEND) { 347 - acquire_console_sem(); 347 + console_lock(); 348 348 gx_powerdown(info); 349 349 fb_set_suspend(info, 1); 350 - release_console_sem(); 350 + console_unlock(); 351 351 } 352 352 353 353 /* there's no point in setting PCI states; we emulate PCI, so ··· 361 361 struct fb_info *info = pci_get_drvdata(pdev); 362 362 int ret; 363 363 364 - acquire_console_sem(); 364 + console_lock(); 365 365 ret = gx_powerup(info); 366 366 if (ret) { 367 367 printk(KERN_ERR "gxfb: power up failed!\n"); ··· 369 369 } 370 370 371 371 fb_set_suspend(info, 0); 372 - release_console_sem(); 372 + console_unlock(); 373 373 return 0; 374 374 } 375 375 #endif
+4 -4
drivers/video/geode/lxfb_core.c
··· 465 465 struct fb_info *info = pci_get_drvdata(pdev); 466 466 467 467 if (state.event == PM_EVENT_SUSPEND) { 468 - acquire_console_sem(); 468 + console_lock(); 469 469 lx_powerdown(info); 470 470 fb_set_suspend(info, 1); 471 - release_console_sem(); 471 + console_unlock(); 472 472 } 473 473 474 474 /* there's no point in setting PCI states; we emulate PCI, so ··· 482 482 struct fb_info *info = pci_get_drvdata(pdev); 483 483 int ret; 484 484 485 - acquire_console_sem(); 485 + console_lock(); 486 486 ret = lx_powerup(info); 487 487 if (ret) { 488 488 printk(KERN_ERR "lxfb: power up failed!\n"); ··· 490 490 } 491 491 492 492 fb_set_suspend(info, 0); 493 - release_console_sem(); 493 + console_unlock(); 494 494 return 0; 495 495 } 496 496 #else
+4 -4
drivers/video/i810/i810_main.c
··· 1574 1574 return 0; 1575 1575 } 1576 1576 1577 - acquire_console_sem(); 1577 + console_lock(); 1578 1578 fb_set_suspend(info, 1); 1579 1579 1580 1580 if (info->fbops->fb_sync) ··· 1587 1587 pci_save_state(dev); 1588 1588 pci_disable_device(dev); 1589 1589 pci_set_power_state(dev, pci_choose_state(dev, mesg)); 1590 - release_console_sem(); 1590 + console_unlock(); 1591 1591 1592 1592 return 0; 1593 1593 } ··· 1605 1605 return 0; 1606 1606 } 1607 1607 1608 - acquire_console_sem(); 1608 + console_lock(); 1609 1609 pci_set_power_state(dev, PCI_D0); 1610 1610 pci_restore_state(dev); 1611 1611 ··· 1621 1621 fb_set_suspend (info, 0); 1622 1622 info->fbops->fb_blank(VESA_NO_BLANKING, info); 1623 1623 fail: 1624 - release_console_sem(); 1624 + console_unlock(); 1625 1625 return 0; 1626 1626 } 1627 1627 /***********************************************************************
+4 -4
drivers/video/jz4740_fb.c
··· 778 778 { 779 779 struct jzfb *jzfb = dev_get_drvdata(dev); 780 780 781 - acquire_console_sem(); 781 + console_lock(); 782 782 fb_set_suspend(jzfb->fb, 1); 783 - release_console_sem(); 783 + console_unlock(); 784 784 785 785 mutex_lock(&jzfb->lock); 786 786 if (jzfb->is_enabled) ··· 800 800 jzfb_enable(jzfb); 801 801 mutex_unlock(&jzfb->lock); 802 802 803 - acquire_console_sem(); 803 + console_lock(); 804 804 fb_set_suspend(jzfb->fb, 0); 805 - release_console_sem(); 805 + console_unlock(); 806 806 807 807 return 0; 808 808 }
+4 -4
drivers/video/mx3fb.c
··· 1177 1177 struct mx3fb_data *mx3fb = platform_get_drvdata(pdev); 1178 1178 struct mx3fb_info *mx3_fbi = mx3fb->fbi->par; 1179 1179 1180 - acquire_console_sem(); 1180 + console_lock(); 1181 1181 fb_set_suspend(mx3fb->fbi, 1); 1182 - release_console_sem(); 1182 + console_unlock(); 1183 1183 1184 1184 if (mx3_fbi->blank == FB_BLANK_UNBLANK) { 1185 1185 sdc_disable_channel(mx3_fbi); ··· 1202 1202 sdc_set_brightness(mx3fb, mx3fb->backlight_level); 1203 1203 } 1204 1204 1205 - acquire_console_sem(); 1205 + console_lock(); 1206 1206 fb_set_suspend(mx3fb->fbi, 0); 1207 - release_console_sem(); 1207 + console_unlock(); 1208 1208 1209 1209 return 0; 1210 1210 }
+4 -2
drivers/video/nuc900fb.c
··· 696 696 nuc900fb_stop_lcd(fbinfo); 697 697 msleep(1); 698 698 699 + unregister_framebuffer(fbinfo); 700 + nuc900fb_cpufreq_deregister(fbi); 699 701 nuc900fb_unmap_video_memory(fbinfo); 700 702 701 703 iounmap(fbi->io); ··· 725 723 struct fb_info *fbinfo = platform_get_drvdata(dev); 726 724 struct nuc900fb_info *info = fbinfo->par; 727 725 728 - nuc900fb_stop_lcd(); 726 + nuc900fb_stop_lcd(fbinfo); 729 727 msleep(1); 730 728 clk_disable(info->clk); 731 729 return 0; ··· 742 740 msleep(1); 743 741 744 742 nuc900fb_init_registers(fbinfo); 745 - nuc900fb_activate_var(bfinfo); 743 + nuc900fb_activate_var(fbinfo); 746 744 747 745 return 0; 748 746 }
+4 -4
drivers/video/nvidia/nvidia.c
··· 1057 1057 1058 1058 if (mesg.event == PM_EVENT_PRETHAW) 1059 1059 mesg.event = PM_EVENT_FREEZE; 1060 - acquire_console_sem(); 1060 + console_lock(); 1061 1061 par->pm_state = mesg.event; 1062 1062 1063 1063 if (mesg.event & PM_EVENT_SLEEP) { ··· 1070 1070 } 1071 1071 dev->dev.power.power_state = mesg; 1072 1072 1073 - release_console_sem(); 1073 + console_unlock(); 1074 1074 return 0; 1075 1075 } 1076 1076 ··· 1079 1079 struct fb_info *info = pci_get_drvdata(dev); 1080 1080 struct nvidia_par *par = info->par; 1081 1081 1082 - acquire_console_sem(); 1082 + console_lock(); 1083 1083 pci_set_power_state(dev, PCI_D0); 1084 1084 1085 1085 if (par->pm_state != PM_EVENT_FREEZE) { ··· 1097 1097 nvidiafb_blank(FB_BLANK_UNBLANK, info); 1098 1098 1099 1099 fail: 1100 - release_console_sem(); 1100 + console_unlock(); 1101 1101 return 0; 1102 1102 } 1103 1103 #else
+8 -8
drivers/video/ps3fb.c
··· 513 513 if (atomic_dec_and_test(&ps3fb.f_count)) { 514 514 if (atomic_read(&ps3fb.ext_flip)) { 515 515 atomic_set(&ps3fb.ext_flip, 0); 516 - if (!try_acquire_console_sem()) { 516 + if (console_trylock()) { 517 517 ps3fb_sync(info, 0); /* single buffer */ 518 - release_console_sem(); 518 + console_unlock(); 519 519 } 520 520 } 521 521 } ··· 830 830 if (vmode) { 831 831 var = info->var; 832 832 fb_videomode_to_var(&var, vmode); 833 - acquire_console_sem(); 833 + console_lock(); 834 834 info->flags |= FBINFO_MISC_USEREVENT; 835 835 /* Force, in case only special bits changed */ 836 836 var.activate |= FB_ACTIVATE_FORCE; 837 837 par->new_mode_id = val; 838 838 retval = fb_set_var(info, &var); 839 839 info->flags &= ~FBINFO_MISC_USEREVENT; 840 - release_console_sem(); 840 + console_unlock(); 841 841 } 842 842 break; 843 843 } ··· 881 881 break; 882 882 883 883 dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val); 884 - acquire_console_sem(); 884 + console_lock(); 885 885 retval = ps3fb_sync(info, val); 886 - release_console_sem(); 886 + console_unlock(); 887 887 break; 888 888 889 889 default: ··· 903 903 set_current_state(TASK_INTERRUPTIBLE); 904 904 if (ps3fb.is_kicked) { 905 905 ps3fb.is_kicked = 0; 906 - acquire_console_sem(); 906 + console_lock(); 907 907 ps3fb_sync(info, 0); /* single buffer */ 908 - release_console_sem(); 908 + console_unlock(); 909 909 } 910 910 schedule(); 911 911 }
+1 -5
drivers/video/pxa168fb.c
··· 701 701 */ 702 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 705 * Fill in sane defaults. 710 706 */ 711 707 ret = pxa168fb_check_var(&info->var, info); 712 708 if (ret) 713 - goto failed; 709 + goto failed_free_fbmem; 714 710 715 711 /* 716 712 * enable controller clock
+2 -2
drivers/video/pxa3xx-gcu.c
··· 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 4 * This driver needs a DirectFB counterpart in user space, communication 5 5 * is handled via mmap()ed memory areas and an ioctl. ··· 421 421 buffer->next = priv->free; 422 422 priv->free = buffer; 423 423 spin_unlock_irqrestore(&priv->spinlock, flags); 424 - return ret; 424 + return -EFAULT; 425 425 } 426 426 427 427 buffer->length = words;
+8 -8
drivers/video/s3fb.c
··· 22 22 #include <linux/svga.h> 23 23 #include <linux/init.h> 24 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 26 #include <video/vga.h> 27 27 28 28 #ifdef CONFIG_MTRR ··· 1113 1113 1114 1114 dev_info(info->device, "suspend\n"); 1115 1115 1116 - acquire_console_sem(); 1116 + console_lock(); 1117 1117 mutex_lock(&(par->open_lock)); 1118 1118 1119 1119 if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) { 1120 1120 mutex_unlock(&(par->open_lock)); 1121 - release_console_sem(); 1121 + console_unlock(); 1122 1122 return 0; 1123 1123 } 1124 1124 ··· 1129 1129 pci_set_power_state(dev, pci_choose_state(dev, state)); 1130 1130 1131 1131 mutex_unlock(&(par->open_lock)); 1132 - release_console_sem(); 1132 + console_unlock(); 1133 1133 1134 1134 return 0; 1135 1135 } ··· 1145 1145 1146 1146 dev_info(info->device, "resume\n"); 1147 1147 1148 - acquire_console_sem(); 1148 + console_lock(); 1149 1149 mutex_lock(&(par->open_lock)); 1150 1150 1151 1151 if (par->ref_count == 0) { 1152 1152 mutex_unlock(&(par->open_lock)); 1153 - release_console_sem(); 1153 + console_unlock(); 1154 1154 return 0; 1155 1155 } 1156 1156 ··· 1159 1159 err = pci_enable_device(dev); 1160 1160 if (err) { 1161 1161 mutex_unlock(&(par->open_lock)); 1162 - release_console_sem(); 1162 + console_unlock(); 1163 1163 dev_err(info->device, "error %d enabling device for resume\n", err); 1164 1164 return err; 1165 1165 } ··· 1169 1169 fb_set_suspend(info, 0); 1170 1170 1171 1171 mutex_unlock(&(par->open_lock)); 1172 - release_console_sem(); 1172 + console_unlock(); 1173 1173 1174 1174 return 0; 1175 1175 }
+4 -4
drivers/video/savage/savagefb_driver.c
··· 2373 2373 if (mesg.event == PM_EVENT_FREEZE) 2374 2374 return 0; 2375 2375 2376 - acquire_console_sem(); 2376 + console_lock(); 2377 2377 fb_set_suspend(info, 1); 2378 2378 2379 2379 if (info->fbops->fb_sync) ··· 2385 2385 pci_save_state(dev); 2386 2386 pci_disable_device(dev); 2387 2387 pci_set_power_state(dev, pci_choose_state(dev, mesg)); 2388 - release_console_sem(); 2388 + console_unlock(); 2389 2389 2390 2390 return 0; 2391 2391 } ··· 2409 2409 return 0; 2410 2410 } 2411 2411 2412 - acquire_console_sem(); 2412 + console_lock(); 2413 2413 2414 2414 pci_set_power_state(dev, PCI_D0); 2415 2415 pci_restore_state(dev); ··· 2423 2423 savagefb_set_par(info); 2424 2424 fb_set_suspend(info, 0); 2425 2425 savagefb_blank(FB_BLANK_UNBLANK, info); 2426 - release_console_sem(); 2426 + console_unlock(); 2427 2427 2428 2428 return 0; 2429 2429 }
+4 -4
drivers/video/sh_mobile_hdmi.c
··· 1151 1151 1152 1152 ch = info->par; 1153 1153 1154 - acquire_console_sem(); 1154 + console_lock(); 1155 1155 1156 1156 /* HDMI plug in */ 1157 1157 if (!sh_hdmi_must_reconfigure(hdmi) && ··· 1171 1171 fb_set_suspend(info, 0); 1172 1172 } 1173 1173 1174 - release_console_sem(); 1174 + console_unlock(); 1175 1175 } else { 1176 1176 ret = 0; 1177 1177 if (!hdmi->info) ··· 1181 1181 fb_destroy_modedb(hdmi->monspec.modedb); 1182 1182 hdmi->monspec.modedb = NULL; 1183 1183 1184 - acquire_console_sem(); 1184 + console_lock(); 1185 1185 1186 1186 /* HDMI disconnect */ 1187 1187 fb_set_suspend(hdmi->info, 1); 1188 1188 1189 - release_console_sem(); 1189 + console_unlock(); 1190 1190 pm_runtime_put(hdmi->dev); 1191 1191 } 1192 1192
+2 -2
drivers/video/sh_mobile_lcdcfb.c
··· 912 912 913 913 /* Nothing to reconfigure, when called from fbcon */ 914 914 if (user) { 915 - acquire_console_sem(); 915 + console_lock(); 916 916 sh_mobile_fb_reconfig(info); 917 - release_console_sem(); 917 + console_unlock(); 918 918 } 919 919 920 920 mutex_unlock(&ch->open_lock);
+4 -4
drivers/video/sm501fb.c
··· 2010 2010 2011 2011 /* tell console/fb driver we are suspending */ 2012 2012 2013 - acquire_console_sem(); 2013 + console_lock(); 2014 2014 fb_set_suspend(fbi, 1); 2015 - release_console_sem(); 2015 + console_unlock(); 2016 2016 2017 2017 /* backup copies in case chip is powered down over suspend */ 2018 2018 ··· 2069 2069 memcpy_toio(par->cursor.k_addr, par->store_cursor, 2070 2070 par->cursor.size); 2071 2071 2072 - acquire_console_sem(); 2072 + console_lock(); 2073 2073 fb_set_suspend(fbi, 0); 2074 - release_console_sem(); 2074 + console_unlock(); 2075 2075 2076 2076 vfree(par->store_fb); 2077 2077 vfree(par->store_cursor);
+5 -5
drivers/video/tmiofb.c
··· 25 25 #include <linux/fb.h> 26 26 #include <linux/interrupt.h> 27 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 29 #include <linux/console.h> 30 30 #include <linux/mfd/core.h> 31 31 #include <linux/mfd/tmio.h> ··· 944 944 struct mfd_cell *cell = dev->dev.platform_data; 945 945 int retval = 0; 946 946 947 - acquire_console_sem(); 947 + console_lock(); 948 948 949 949 fb_set_suspend(info, 1); 950 950 ··· 965 965 if (cell->suspend) 966 966 retval = cell->suspend(dev); 967 967 968 - release_console_sem(); 968 + console_unlock(); 969 969 970 970 return retval; 971 971 } ··· 976 976 struct mfd_cell *cell = dev->dev.platform_data; 977 977 int retval = 0; 978 978 979 - acquire_console_sem(); 979 + console_lock(); 980 980 981 981 if (cell->resume) { 982 982 retval = cell->resume(dev); ··· 992 992 993 993 fb_set_suspend(info, 0); 994 994 out: 995 - release_console_sem(); 995 + console_unlock(); 996 996 return retval; 997 997 } 998 998 #else
+4 -4
drivers/video/via/viafbdev.c
··· 1674 1674 #ifdef CONFIG_PM 1675 1675 static int viafb_suspend(void *unused) 1676 1676 { 1677 - acquire_console_sem(); 1677 + console_lock(); 1678 1678 fb_set_suspend(viafbinfo, 1); 1679 1679 viafb_sync(viafbinfo); 1680 - release_console_sem(); 1680 + console_unlock(); 1681 1681 1682 1682 return 0; 1683 1683 } 1684 1684 1685 1685 static int viafb_resume(void *unused) 1686 1686 { 1687 - acquire_console_sem(); 1687 + console_lock(); 1688 1688 if (viaparinfo->shared->vdev->engine_mmio) 1689 1689 viafb_reset_engine(viaparinfo); 1690 1690 viafb_set_par(viafbinfo); ··· 1692 1692 viafb_set_par(viafbinfo1); 1693 1693 fb_set_suspend(viafbinfo, 0); 1694 1694 1695 - release_console_sem(); 1695 + console_unlock(); 1696 1696 return 0; 1697 1697 } 1698 1698
+6 -6
drivers/video/vt8623fb.c
··· 23 23 #include <linux/svga.h> 24 24 #include <linux/init.h> 25 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 27 #include <video/vga.h> 28 28 29 29 #ifdef CONFIG_MTRR ··· 819 819 820 820 dev_info(info->device, "suspend\n"); 821 821 822 - acquire_console_sem(); 822 + console_lock(); 823 823 mutex_lock(&(par->open_lock)); 824 824 825 825 if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) { 826 826 mutex_unlock(&(par->open_lock)); 827 - release_console_sem(); 827 + console_unlock(); 828 828 return 0; 829 829 } 830 830 ··· 835 835 pci_set_power_state(dev, pci_choose_state(dev, state)); 836 836 837 837 mutex_unlock(&(par->open_lock)); 838 - release_console_sem(); 838 + console_unlock(); 839 839 840 840 return 0; 841 841 } ··· 850 850 851 851 dev_info(info->device, "resume\n"); 852 852 853 - acquire_console_sem(); 853 + console_lock(); 854 854 mutex_lock(&(par->open_lock)); 855 855 856 856 if (par->ref_count == 0) ··· 869 869 870 870 fail: 871 871 mutex_unlock(&(par->open_lock)); 872 - release_console_sem(); 872 + console_unlock(); 873 873 874 874 return 0; 875 875 }
+2 -2
drivers/video/xen-fbfront.c
··· 491 491 if (console_set_on_cmdline) 492 492 return; 493 493 494 - acquire_console_sem(); 494 + console_lock(); 495 495 for_each_console(c) { 496 496 if (!strcmp(c->name, "tty") && c->index == 0) 497 497 break; 498 498 } 499 - release_console_sem(); 499 + console_unlock(); 500 500 if (c) { 501 501 unregister_console(c); 502 502 c->flags |= CON_CONSDEV;
-1
fs/cifs/cifs_dfs_ref.c
··· 297 297 298 298 cifs_sb = CIFS_SB(mntpt->d_inode->i_sb); 299 299 tlink = cifs_sb_tlink(cifs_sb); 300 - mnt = ERR_PTR(-EINVAL); 301 300 if (IS_ERR(tlink)) { 302 301 mnt = ERR_CAST(tlink); 303 302 goto free_full_path;
+33
fs/cifs/cifsglob.h
··· 166 166 struct socket *ssocket; 167 167 struct sockaddr_storage dstaddr; 168 168 struct sockaddr_storage srcaddr; /* locally bind to this IP */ 169 + #ifdef CONFIG_NET_NS 170 + struct net *net; 171 + #endif 169 172 wait_queue_head_t response_q; 170 173 wait_queue_head_t request_q; /* if more than maxmpx to srvr must block*/ 171 174 struct list_head pending_mid_q; ··· 218 215 atomic_t num_waiters; /* blocked waiting to get in sendrecv */ 219 216 #endif 220 217 }; 218 + 219 + /* 220 + * Macros to allow the TCP_Server_Info->net field and related code to drop out 221 + * when CONFIG_NET_NS isn't set. 222 + */ 223 + 224 + #ifdef CONFIG_NET_NS 225 + 226 + static inline struct net *cifs_net_ns(struct TCP_Server_Info *srv) 227 + { 228 + return srv->net; 229 + } 230 + 231 + static inline void cifs_set_net_ns(struct TCP_Server_Info *srv, struct net *net) 232 + { 233 + srv->net = net; 234 + } 235 + 236 + #else 237 + 238 + static inline struct net *cifs_net_ns(struct TCP_Server_Info *srv) 239 + { 240 + return &init_net; 241 + } 242 + 243 + static inline void cifs_set_net_ns(struct TCP_Server_Info *srv, struct net *net) 244 + { 245 + } 246 + 247 + #endif 221 248 222 249 /* 223 250 * Session structure. One of these for each uid session with a particular host
+10 -2
fs/cifs/connect.c
··· 1568 1568 1569 1569 spin_lock(&cifs_tcp_ses_lock); 1570 1570 list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) { 1571 + if (!net_eq(cifs_net_ns(server), current->nsproxy->net_ns)) 1572 + continue; 1573 + 1571 1574 if (!match_address(server, addr, 1572 1575 (struct sockaddr *)&vol->srcaddr)) 1573 1576 continue; ··· 1600 1597 spin_unlock(&cifs_tcp_ses_lock); 1601 1598 return; 1602 1599 } 1600 + 1601 + put_net(cifs_net_ns(server)); 1603 1602 1604 1603 list_del_init(&server->tcp_ses_list); 1605 1604 spin_unlock(&cifs_tcp_ses_lock); ··· 1677 1672 goto out_err; 1678 1673 } 1679 1674 1675 + cifs_set_net_ns(tcp_ses, get_net(current->nsproxy->net_ns)); 1680 1676 tcp_ses->hostname = extract_hostname(volume_info->UNC); 1681 1677 if (IS_ERR(tcp_ses->hostname)) { 1682 1678 rc = PTR_ERR(tcp_ses->hostname); ··· 1757 1751 1758 1752 out_err_crypto_release: 1759 1753 cifs_crypto_shash_release(tcp_ses); 1754 + 1755 + put_net(cifs_net_ns(tcp_ses)); 1760 1756 1761 1757 out_err: 1762 1758 if (tcp_ses) { ··· 2271 2263 } 2272 2264 2273 2265 if (socket == NULL) { 2274 - rc = sock_create_kern(sfamily, SOCK_STREAM, 2275 - IPPROTO_TCP, &socket); 2266 + rc = __sock_create(cifs_net_ns(server), sfamily, SOCK_STREAM, 2267 + IPPROTO_TCP, &socket, 1); 2276 2268 if (rc < 0) { 2277 2269 cERROR(1, "Error %d creating socket", rc); 2278 2270 server->ssocket = NULL;
+3 -1
fs/dcache.c
··· 176 176 177 177 /** 178 178 * dentry_rcuwalk_barrier - invalidate in-progress rcu-walk lookups 179 + * @dentry: the target dentry 179 180 * After this call, in-progress rcu-walk path lookup will fail. This 180 181 * should be called after unhashing, and after changing d_inode (if 181 182 * the dentry has not already been unhashed). ··· 282 281 /** 283 282 * d_kill - kill dentry and return parent 284 283 * @dentry: dentry to kill 284 + * @parent: parent dentry 285 285 * 286 286 * The dentry must already be unhashed and removed from the LRU. 287 287 * ··· 1975 1973 /** 1976 1974 * d_validate - verify dentry provided from insecure source (deprecated) 1977 1975 * @dentry: The dentry alleged to be valid child of @dparent 1978 - * @parent: The parent dentry (known to be valid) 1976 + * @dparent: The parent dentry (known to be valid) 1979 1977 * 1980 1978 * An insecure source has sent us a dentry, here we verify it and dget() it. 1981 1979 * This is used by ncpfs in its readdir implementation.
+2 -1
fs/nilfs2/super.c
··· 704 704 sbp[0]->s_state = 705 705 cpu_to_le16(le16_to_cpu(sbp[0]->s_state) & ~NILFS_VALID_FS); 706 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 709 return nilfs_commit_super(sbi, NILFS_SB_COMMIT_ALL); 709 710 } 710 711
+2 -2
fs/proc/consoles.c
··· 67 67 struct console *con; 68 68 loff_t off = 0; 69 69 70 - acquire_console_sem(); 70 + console_lock(); 71 71 for_each_console(con) 72 72 if (off++ == *pos) 73 73 break; ··· 84 84 85 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 90 static const struct seq_operations consoles_op = {
+8
fs/squashfs/block.c
··· 63 63 *length = (unsigned char) bh->b_data[*offset] | 64 64 (unsigned char) bh->b_data[*offset + 1] << 8; 65 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 76 return bh;
-6
fs/squashfs/xz_wrapper.c
··· 95 95 if (!buffer_uptodate(bh[k])) 96 96 goto release_mutex; 97 97 98 - if (avail == 0) { 99 - offset = 0; 100 - put_bh(bh[k++]); 101 - continue; 102 - } 103 - 104 98 stream->buf.in = bh[k]->b_data + offset; 105 99 stream->buf.in_size = avail; 106 100 stream->buf.in_pos = 0;
-6
fs/squashfs/zlib_wrapper.c
··· 82 82 if (!buffer_uptodate(bh[k])) 83 83 goto release_mutex; 84 84 85 - if (avail == 0) { 86 - offset = 0; 87 - put_bh(bh[k++]); 88 - continue; 89 - } 90 - 91 85 stream->next_in = bh[k]->b_data + offset; 92 86 stream->avail_in = avail; 93 87 offset = 0;
+7
include/asm-generic/vmlinux.lds.h
··· 364 364 VMLINUX_SYMBOL(__start___param) = .; \ 365 365 *(__param) \ 366 366 VMLINUX_SYMBOL(__stop___param) = .; \ 367 + } \ 368 + \ 369 + /* Built-in module versions. */ \ 370 + __modver : AT(ADDR(__modver) - LOAD_OFFSET) { \ 371 + VMLINUX_SYMBOL(__start___modver) = .; \ 372 + *(__modver) \ 373 + VMLINUX_SYMBOL(__stop___modver) = .; \ 367 374 . = ALIGN((align)); \ 368 375 VMLINUX_SYMBOL(__end_rodata) = .; \ 369 376 } \
+1
include/drm/radeon_drm.h
··· 907 907 #define RADEON_INFO_TILING_CONFIG 0x06 908 908 #define RADEON_INFO_WANT_HYPERZ 0x07 909 909 #define RADEON_INFO_WANT_CMASK 0x08 /* get access to CMASK on r300 */ 910 + #define RADEON_INFO_CLOCK_CRYSTAL_FREQ 0x09 /* clock crystal frequency */ 910 911 911 912 struct drm_radeon_info { 912 913 uint32_t request;
+3 -3
include/linux/console.h
··· 139 139 extern void register_console(struct console *); 140 140 extern int unregister_console(struct console *); 141 141 extern struct console *console_drivers; 142 - extern void acquire_console_sem(void); 143 - extern int try_acquire_console_sem(void); 144 - extern void release_console_sem(void); 142 + extern void console_lock(void); 143 + extern int console_trylock(void); 144 + extern void console_unlock(void); 145 145 extern void console_conditional_schedule(void); 146 146 extern void console_unblank(void); 147 147 extern struct tty_driver *console_device(int *);
+1 -1
include/linux/gfp.h
··· 249 249 ((1 << ZONES_SHIFT) - 1); 250 250 251 251 if (__builtin_constant_p(bit)) 252 - MAYBE_BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1); 252 + BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1); 253 253 else { 254 254 #ifdef CONFIG_DEBUG_VM 255 255 BUG_ON((GFP_ZONE_BAD >> bit) & 1);
-4
include/linux/input/bu21013.h
··· 12 12 * @cs_en: pointer to the cs enable function 13 13 * @cs_dis: pointer to the cs disable function 14 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 15 * @touch_x_max: touch x max 18 16 * @touch_y_max: touch y max 19 17 * @cs_pin: chip select pin ··· 27 29 int (*cs_en)(int reset_pin); 28 30 int (*cs_dis)(int reset_pin); 29 31 int (*irq_read_val)(void); 30 - int x_max_res; 31 - int y_max_res; 32 32 int touch_x_max; 33 33 int touch_y_max; 34 34 unsigned int cs_pin;
+26 -6
include/linux/kernel.h
··· 575 575 char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 576 576 }; 577 577 578 - /* Force a compilation error if condition is true */ 579 - #define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition)) 580 - 581 - /* Force a compilation error if condition is constant and true */ 582 - #define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)])) 583 - 584 578 /* Force a compilation error if a constant expression is not a power of 2 */ 585 579 #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ 586 580 BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) ··· 585 591 aren't permitted). */ 586 592 #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) 587 593 #define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) 594 + 595 + /** 596 + * BUILD_BUG_ON - break compile if a condition is true. 597 + * @cond: the condition which the compiler should know is false. 598 + * 599 + * If you have some code which relies on certain constants being equal, or 600 + * other compile-time-evaluated condition, you should use BUILD_BUG_ON to 601 + * detect if someone changes it. 602 + * 603 + * The implementation uses gcc's reluctance to create a negative array, but 604 + * gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments 605 + * to inline functions). So as a fallback we use the optimizer; if it can't 606 + * prove the condition is false, it will cause a link error on the undefined 607 + * "__build_bug_on_failed". This error message can be harder to track down 608 + * though, hence the two different methods. 609 + */ 610 + #ifndef __OPTIMIZE__ 611 + #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) 612 + #else 613 + extern int __build_bug_on_failed; 614 + #define BUILD_BUG_ON(condition) \ 615 + do { \ 616 + ((void)sizeof(char[1 - 2*!!(condition)])); \ 617 + if (condition) __build_bug_on_failed = 1; \ 618 + } while(0) 619 + #endif 588 620 589 621 /* Trap pasters of __FUNCTION__ at compile-time */ 590 622 #define __FUNCTION__ (__func__)
+1 -1
include/linux/kmemcheck.h
··· 76 76 \ 77 77 _n = (long) &((ptr)->name##_end) \ 78 78 - (long) &((ptr)->name##_begin); \ 79 - MAYBE_BUILD_BUG_ON(_n < 0); \ 79 + BUILD_BUG_ON(_n < 0); \ 80 80 \ 81 81 kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \ 82 82 } while (0)
+2 -2
include/linux/mmc/sh_mmcif.h
··· 94 94 95 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 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 105 #define SH_MMCIF_BBS 512 /* boot block size */
+27
include/linux/module.h
··· 58 58 void (*free)(struct module *); 59 59 }; 60 60 61 + struct module_version_attribute { 62 + struct module_attribute mattr; 63 + const char *module_name; 64 + const char *version; 65 + }; 66 + 61 67 struct module_kobject 62 68 { 63 69 struct kobject kobj; ··· 167 161 Using this automatically adds a checksum of the .c files and the 168 162 local headers in "srcversion". 169 163 */ 164 + 165 + #if defined(MODULE) || !defined(CONFIG_SYSFS) 170 166 #define MODULE_VERSION(_version) MODULE_INFO(version, _version) 167 + #else 168 + #define MODULE_VERSION(_version) \ 169 + extern ssize_t __modver_version_show(struct module_attribute *, \ 170 + struct module *, char *); \ 171 + static struct module_version_attribute __modver_version_attr \ 172 + __used \ 173 + __attribute__ ((__section__ ("__modver"),aligned(sizeof(void *)))) \ 174 + = { \ 175 + .mattr = { \ 176 + .attr = { \ 177 + .name = "version", \ 178 + .mode = S_IRUGO, \ 179 + }, \ 180 + .show = __modver_version_show, \ 181 + }, \ 182 + .module_name = KBUILD_MODNAME, \ 183 + .version = _version, \ 184 + } 185 + #endif 171 186 172 187 /* Optional firmware file (or files) needed by the module 173 188 * format is simply firmware file name. Multiple firmware
+4 -2
include/linux/moduleparam.h
··· 16 16 /* Chosen so that structs with an unsigned long line up. */ 17 17 #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long)) 18 18 19 - #ifdef MODULE 20 19 #define ___module_cat(a,b) __mod_ ## a ## b 21 20 #define __module_cat(a,b) ___module_cat(a,b) 21 + #ifdef MODULE 22 22 #define __MODULE_INFO(tag, name, info) \ 23 23 static const char __module_cat(name,__LINE__)[] \ 24 24 __used __attribute__((section(".modinfo"), unused, aligned(1))) \ 25 25 = __stringify(tag) "=" info 26 26 #else /* !MODULE */ 27 - #define __MODULE_INFO(tag, name, info) 27 + /* This struct is here for syntactic coherency, it is not used */ 28 + #define __MODULE_INFO(tag, name, info) \ 29 + struct __module_cat(name,__LINE__) {} 28 30 #endif 29 31 #define __MODULE_PARM_TYPE(name, _type) \ 30 32 __MODULE_INFO(parmtype, name##type, #name ":" _type)
-4
include/linux/rtc.h
··· 235 235 struct rtc_task *task, int freq); 236 236 extern int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled); 237 237 extern int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled); 238 - extern int rtc_dev_update_irq_enable_emul(struct rtc_device *rtc, 239 - unsigned int enabled); 240 238 241 239 void rtc_aie_update_irq(void *private); 242 240 void rtc_uie_update_irq(void *private); ··· 244 246 int rtc_unregister(rtc_task_t *task); 245 247 int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg); 246 248 247 - void rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer); 248 - void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer); 249 249 void rtc_timer_init(struct rtc_timer *timer, void (*f)(void* p), void* data); 250 250 int rtc_timer_start(struct rtc_device *rtc, struct rtc_timer* timer, 251 251 ktime_t expires, ktime_t period);
+3
include/linux/sysrq.h
··· 17 17 #include <linux/errno.h> 18 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 23 /* Possible values of bitmask for enabling sysrq functions */ 21 24 /* 0x0001 is reserved for enable everything */ 22 25 #define SYSRQ_ENABLE_LOG 0x0002
+4 -1
include/linux/virtio_config.h
··· 109 109 unsigned int fbit) 110 110 { 111 111 /* Did you forget to fix assumptions on max features? */ 112 - MAYBE_BUILD_BUG_ON(fbit >= 32); 112 + if (__builtin_constant_p(fbit)) 113 + BUILD_BUG_ON(fbit >= 32); 114 + else 115 + BUG_ON(fbit >= 32); 113 116 114 117 if (fbit < VIRTIO_TRANSPORT_F_START) 115 118 virtio_check_driver_offered_feature(vdev, fbit);
+12 -10
kernel/futex.c
··· 1556 1556 1557 1557 /* 1558 1558 * We are here either because we stole the rtmutex from the 1559 - * pending owner or we are the pending owner which failed to 1560 - * get the rtmutex. We have to replace the pending owner TID 1561 - * in the user space variable. This must be atomic as we have 1562 - * to preserve the owner died bit here. 1559 + * previous highest priority waiter or we are the highest priority 1560 + * waiter but failed to get the rtmutex the first time. 1561 + * We have to replace the newowner TID in the user space variable. 1562 + * This must be atomic as we have to preserve the owner died bit here. 1563 1563 * 1564 1564 * Note: We write the user space value _before_ changing the pi_state 1565 1565 * because we can fault here. Imagine swapped out pages or a fork ··· 1608 1608 1609 1609 /* 1610 1610 * To handle the page fault we need to drop the hash bucket 1611 - * lock here. That gives the other task (either the pending 1612 - * owner itself or the task which stole the rtmutex) the 1611 + * lock here. That gives the other task (either the highest priority 1612 + * waiter itself or the task which stole the rtmutex) the 1613 1613 * chance to try the fixup of the pi_state. So once we are 1614 1614 * back from handling the fault we need to check the pi_state 1615 1615 * after reacquiring the hash bucket lock and before trying to ··· 1685 1685 /* 1686 1686 * pi_state is incorrect, some other task did a lock steal and 1687 1687 * we returned due to timeout or signal without taking the 1688 - * rt_mutex. Too late. We can access the rt_mutex_owner without 1689 - * locking, as the other task is now blocked on the hash bucket 1690 - * lock. Fix the state up. 1688 + * rt_mutex. Too late. 1691 1689 */ 1690 + raw_spin_lock(&q->pi_state->pi_mutex.wait_lock); 1692 1691 owner = rt_mutex_owner(&q->pi_state->pi_mutex); 1692 + if (!owner) 1693 + owner = rt_mutex_next_owner(&q->pi_state->pi_mutex); 1694 + raw_spin_unlock(&q->pi_state->pi_mutex.wait_lock); 1693 1695 ret = fixup_pi_state_owner(uaddr, q, owner); 1694 1696 goto out; 1695 1697 } 1696 1698 1697 1699 /* 1698 1700 * Paranoia check. If we did not take the lock, then we should not be 1699 - * the owner, nor the pending owner, of the rt_mutex. 1701 + * the owner of the rt_mutex. 1700 1702 */ 1701 1703 if (rt_mutex_owner(&q->pi_state->pi_mutex) == current) 1702 1704 printk(KERN_ERR "fixup_owner: ret = %d pi-mutex: %p "
+54 -11
kernel/params.c
··· 719 719 params[i].ops->free(params[i].arg); 720 720 } 721 721 722 - static void __init kernel_add_sysfs_param(const char *name, 723 - struct kernel_param *kparam, 724 - unsigned int name_skip) 722 + static struct module_kobject * __init locate_module_kobject(const char *name) 725 723 { 726 724 struct module_kobject *mk; 727 725 struct kobject *kobj; ··· 727 729 728 730 kobj = kset_find_obj(module_kset, name); 729 731 if (kobj) { 730 - /* We already have one. Remove params so we can add more. */ 731 732 mk = to_module_kobject(kobj); 732 - /* We need to remove it before adding parameters. */ 733 - sysfs_remove_group(&mk->kobj, &mk->mp->grp); 734 733 } else { 735 734 mk = kzalloc(sizeof(struct module_kobject), GFP_KERNEL); 736 735 BUG_ON(!mk); ··· 738 743 "%s", name); 739 744 if (err) { 740 745 kobject_put(&mk->kobj); 741 - printk(KERN_ERR "Module '%s' failed add to sysfs, " 742 - "error number %d\n", name, err); 743 - printk(KERN_ERR "The system will be unstable now.\n"); 744 - return; 746 + printk(KERN_ERR 747 + "Module '%s' failed add to sysfs, error number %d\n", 748 + name, err); 749 + printk(KERN_ERR 750 + "The system will be unstable now.\n"); 751 + return NULL; 745 752 } 746 - /* So that exit path is even. */ 753 + 754 + /* So that we hold reference in both cases. */ 747 755 kobject_get(&mk->kobj); 748 756 } 757 + 758 + return mk; 759 + } 760 + 761 + static void __init kernel_add_sysfs_param(const char *name, 762 + struct kernel_param *kparam, 763 + unsigned int name_skip) 764 + { 765 + struct module_kobject *mk; 766 + int err; 767 + 768 + mk = locate_module_kobject(name); 769 + if (!mk) 770 + return; 771 + 772 + /* We need to remove old parameters before adding more. */ 773 + if (mk->mp) 774 + sysfs_remove_group(&mk->kobj, &mk->mp->grp); 749 775 750 776 /* These should not fail at boot. */ 751 777 err = add_sysfs_param(mk, kparam, kparam->name + name_skip); ··· 812 796 } 813 797 } 814 798 799 + ssize_t __modver_version_show(struct module_attribute *mattr, 800 + struct module *mod, char *buf) 801 + { 802 + struct module_version_attribute *vattr = 803 + container_of(mattr, struct module_version_attribute, mattr); 804 + 805 + return sprintf(buf, "%s\n", vattr->version); 806 + } 807 + 808 + extern struct module_version_attribute __start___modver[], __stop___modver[]; 809 + 810 + static void __init version_sysfs_builtin(void) 811 + { 812 + const struct module_version_attribute *vattr; 813 + struct module_kobject *mk; 814 + int err; 815 + 816 + for (vattr = __start___modver; vattr < __stop___modver; vattr++) { 817 + mk = locate_module_kobject(vattr->module_name); 818 + if (mk) { 819 + err = sysfs_create_file(&mk->kobj, &vattr->mattr.attr); 820 + kobject_uevent(&mk->kobj, KOBJ_ADD); 821 + kobject_put(&mk->kobj); 822 + } 823 + } 824 + } 815 825 816 826 /* module-related sysfs stuff */ 817 827 ··· 917 875 } 918 876 module_sysfs_initialized = 1; 919 877 878 + version_sysfs_builtin(); 920 879 param_sysfs_builtin(); 921 880 922 881 return 0;
+27 -19
kernel/perf_event.c
··· 2201 2201 if (!task) 2202 2202 return ERR_PTR(-ESRCH); 2203 2203 2204 - /* 2205 - * Can't attach events to a dying task. 2206 - */ 2207 - err = -ESRCH; 2208 - if (task->flags & PF_EXITING) 2209 - goto errout; 2210 - 2211 2204 /* Reuse ptrace permission checks for now. */ 2212 2205 err = -EACCES; 2213 2206 if (!ptrace_may_access(task, PTRACE_MODE_READ)) ··· 2261 2268 2262 2269 get_ctx(ctx); 2263 2270 2264 - if (cmpxchg(&task->perf_event_ctxp[ctxn], NULL, ctx)) { 2265 - /* 2266 - * We raced with some other task; use 2267 - * the context they set. 2268 - */ 2271 + err = 0; 2272 + mutex_lock(&task->perf_event_mutex); 2273 + /* 2274 + * If it has already passed perf_event_exit_task(). 2275 + * we must see PF_EXITING, it takes this mutex too. 2276 + */ 2277 + if (task->flags & PF_EXITING) 2278 + err = -ESRCH; 2279 + else if (task->perf_event_ctxp[ctxn]) 2280 + err = -EAGAIN; 2281 + else 2282 + rcu_assign_pointer(task->perf_event_ctxp[ctxn], ctx); 2283 + mutex_unlock(&task->perf_event_mutex); 2284 + 2285 + if (unlikely(err)) { 2269 2286 put_task_struct(task); 2270 2287 kfree(ctx); 2271 - goto retry; 2288 + 2289 + if (err == -EAGAIN) 2290 + goto retry; 2291 + goto errout; 2272 2292 } 2273 2293 } 2274 2294 ··· 5380 5374 goto out; 5381 5375 } 5382 5376 5377 + static struct lock_class_key cpuctx_mutex; 5378 + 5383 5379 int perf_pmu_register(struct pmu *pmu, char *name, int type) 5384 5380 { 5385 5381 int cpu, ret; ··· 5430 5422 5431 5423 cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu); 5432 5424 __perf_event_init_context(&cpuctx->ctx); 5425 + lockdep_set_class(&cpuctx->ctx.mutex, &cpuctx_mutex); 5433 5426 cpuctx->ctx.type = cpu_context; 5434 5427 cpuctx->ctx.pmu = pmu; 5435 5428 cpuctx->jiffies_interval = 1; ··· 6136 6127 * scheduled, so we are now safe from rescheduling changing 6137 6128 * our context. 6138 6129 */ 6139 - child_ctx = child->perf_event_ctxp[ctxn]; 6130 + child_ctx = rcu_dereference_raw(child->perf_event_ctxp[ctxn]); 6140 6131 task_ctx_sched_out(child_ctx, EVENT_ALL); 6141 6132 6142 6133 /* ··· 6449 6440 unsigned long flags; 6450 6441 int ret = 0; 6451 6442 6452 - child->perf_event_ctxp[ctxn] = NULL; 6453 - 6454 - mutex_init(&child->perf_event_mutex); 6455 - INIT_LIST_HEAD(&child->perf_event_list); 6456 - 6457 6443 if (likely(!parent->perf_event_ctxp[ctxn])) 6458 6444 return 0; 6459 6445 ··· 6536 6532 int perf_event_init_task(struct task_struct *child) 6537 6533 { 6538 6534 int ctxn, ret; 6535 + 6536 + memset(child->perf_event_ctxp, 0, sizeof(child->perf_event_ctxp)); 6537 + mutex_init(&child->perf_event_mutex); 6538 + INIT_LIST_HEAD(&child->perf_event_list); 6539 6539 6540 6540 for_each_task_context_nr(ctxn) { 6541 6541 ret = perf_event_init_context(child, ctxn);
+54 -46
kernel/printk.c
··· 97 97 /* 98 98 * logbuf_lock protects log_buf, log_start, log_end, con_start and logged_chars 99 99 * It is also used in interesting ways to provide interlocking in 100 - * release_console_sem(). 100 + * console_unlock();. 101 101 */ 102 102 static DEFINE_SPINLOCK(logbuf_lock); 103 103 ··· 501 501 /* 502 502 * Call the console drivers, asking them to write out 503 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 506 static void call_console_drivers(unsigned start, unsigned end) 507 507 { ··· 604 604 * 605 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 608 * call the console drivers. If we fail to get the semaphore we place the output 609 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 611 - * consoles before releasing the semaphore. 610 + * notice the new output in console_unlock(); and will send it to the 611 + * consoles before releasing the lock. 612 612 * 613 613 * One effect of this deferred printing is that code which calls printk() and 614 614 * then changes console_loglevel may break. This is because console_loglevel ··· 659 659 /* 660 660 * Try to get console ownership to actually show the kernel 661 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 663 * is successful, false otherwise. 664 664 * 665 665 * This gets called with the 'logbuf_lock' spinlock held and 666 666 * interrupts disabled. It should return with 'lockbuf_lock' 667 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 670 __releases(&logbuf_lock) 671 671 { 672 672 int retval = 0; 673 673 674 - if (!try_acquire_console_sem()) { 674 + if (console_trylock()) { 675 675 retval = 1; 676 676 677 677 /* ··· 827 827 * actual magic (print out buffers, wake up klogd, 828 828 * etc). 829 829 * 830 - * The acquire_console_semaphore_for_printk() function 830 + * The console_trylock_for_printk() function 831 831 * will release 'logbuf_lock' regardless of whether it 832 832 * actually gets the semaphore or not. 833 833 */ 834 - if (acquire_console_semaphore_for_printk(this_cpu)) 835 - release_console_sem(); 834 + if (console_trylock_for_printk(this_cpu)) 835 + console_unlock(); 836 836 837 837 lockdep_on(); 838 838 out_restore_irqs: ··· 993 993 if (!console_suspend_enabled) 994 994 return; 995 995 printk("Suspending console(s) (use no_console_suspend to debug)\n"); 996 - acquire_console_sem(); 996 + console_lock(); 997 997 console_suspended = 1; 998 998 up(&console_sem); 999 999 } ··· 1004 1004 return; 1005 1005 down(&console_sem); 1006 1006 console_suspended = 0; 1007 - release_console_sem(); 1007 + console_unlock(); 1008 1008 } 1009 1009 1010 1010 /** ··· 1027 1027 case CPU_DYING: 1028 1028 case CPU_DOWN_FAILED: 1029 1029 case CPU_UP_CANCELED: 1030 - acquire_console_sem(); 1031 - release_console_sem(); 1030 + console_lock(); 1031 + console_unlock(); 1032 1032 } 1033 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 1040 * exclusive access to the console system and the console_drivers list. 1041 1041 * 1042 1042 * Can sleep, returns nothing. 1043 1043 */ 1044 - void acquire_console_sem(void) 1044 + void console_lock(void) 1045 1045 { 1046 1046 BUG_ON(in_interrupt()); 1047 1047 down(&console_sem); ··· 1050 1050 console_locked = 1; 1051 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 1065 if (down_trylock(&console_sem)) 1058 - return -1; 1066 + return 0; 1059 1067 if (console_suspended) { 1060 1068 up(&console_sem); 1061 - return -1; 1069 + return 0; 1062 1070 } 1063 1071 console_locked = 1; 1064 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 1077 int is_console_locked(void) 1070 1078 { ··· 1103 1095 } 1104 1096 1105 1097 /** 1106 - * release_console_sem - unlock the console system 1098 + * console_unlock - unlock the console system 1107 1099 * 1108 - * Releases the semaphore which the caller holds on the console system 1100 + * Releases the console_lock which the caller holds on the console system 1109 1101 * and the console driver list. 1110 1102 * 1111 - * While the semaphore was held, console output may have been buffered 1112 - * by printk(). If this is the case, release_console_sem() emits 1113 - * the output prior to releasing the semaphore. 1103 + * While the console_lock was held, console output may have been buffered 1104 + * by printk(). If this is the case, console_unlock(); emits 1105 + * the output prior to releasing the lock. 1114 1106 * 1115 1107 * If there is output waiting for klogd, we wake it up. 1116 1108 * 1117 - * release_console_sem() may be called from any context. 1109 + * console_unlock(); may be called from any context. 1118 1110 */ 1119 - void release_console_sem(void) 1111 + void console_unlock(void) 1120 1112 { 1121 1113 unsigned long flags; 1122 1114 unsigned _con_start, _log_end; ··· 1149 1141 if (wake_klogd) 1150 1142 wake_up_klogd(); 1151 1143 } 1152 - EXPORT_SYMBOL(release_console_sem); 1144 + EXPORT_SYMBOL(console_unlock); 1153 1145 1154 1146 /** 1155 1147 * console_conditional_schedule - yield the CPU if required ··· 1158 1150 * if this CPU should yield the CPU to another task, do 1159 1151 * so here. 1160 1152 * 1161 - * Must be called within acquire_console_sem(). 1153 + * Must be called within console_lock();. 1162 1154 */ 1163 1155 void __sched console_conditional_schedule(void) 1164 1156 { ··· 1179 1171 if (down_trylock(&console_sem) != 0) 1180 1172 return; 1181 1173 } else 1182 - acquire_console_sem(); 1174 + console_lock(); 1183 1175 1184 1176 console_locked = 1; 1185 1177 console_may_schedule = 0; 1186 1178 for_each_console(c) 1187 1179 if ((c->flags & CON_ENABLED) && c->unblank) 1188 1180 c->unblank(); 1189 - release_console_sem(); 1181 + console_unlock(); 1190 1182 } 1191 1183 1192 1184 /* ··· 1197 1189 struct console *c; 1198 1190 struct tty_driver *driver = NULL; 1199 1191 1200 - acquire_console_sem(); 1192 + console_lock(); 1201 1193 for_each_console(c) { 1202 1194 if (!c->device) 1203 1195 continue; ··· 1205 1197 if (driver) 1206 1198 break; 1207 1199 } 1208 - release_console_sem(); 1200 + console_unlock(); 1209 1201 return driver; 1210 1202 } 1211 1203 ··· 1216 1208 */ 1217 1209 void console_stop(struct console *console) 1218 1210 { 1219 - acquire_console_sem(); 1211 + console_lock(); 1220 1212 console->flags &= ~CON_ENABLED; 1221 - release_console_sem(); 1213 + console_unlock(); 1222 1214 } 1223 1215 EXPORT_SYMBOL(console_stop); 1224 1216 1225 1217 void console_start(struct console *console) 1226 1218 { 1227 - acquire_console_sem(); 1219 + console_lock(); 1228 1220 console->flags |= CON_ENABLED; 1229 - release_console_sem(); 1221 + console_unlock(); 1230 1222 } 1231 1223 EXPORT_SYMBOL(console_start); 1232 1224 ··· 1348 1340 * Put this console in the list - keep the 1349 1341 * preferred driver at the head of the list. 1350 1342 */ 1351 - acquire_console_sem(); 1343 + console_lock(); 1352 1344 if ((newcon->flags & CON_CONSDEV) || console_drivers == NULL) { 1353 1345 newcon->next = console_drivers; 1354 1346 console_drivers = newcon; ··· 1360 1352 } 1361 1353 if (newcon->flags & CON_PRINTBUFFER) { 1362 1354 /* 1363 - * release_console_sem() will print out the buffered messages 1355 + * console_unlock(); will print out the buffered messages 1364 1356 * for us. 1365 1357 */ 1366 1358 spin_lock_irqsave(&logbuf_lock, flags); 1367 1359 con_start = log_start; 1368 1360 spin_unlock_irqrestore(&logbuf_lock, flags); 1369 1361 } 1370 - release_console_sem(); 1362 + console_unlock(); 1371 1363 console_sysfs_notify(); 1372 1364 1373 1365 /* ··· 1404 1396 return braille_unregister_console(console); 1405 1397 #endif 1406 1398 1407 - acquire_console_sem(); 1399 + console_lock(); 1408 1400 if (console_drivers == console) { 1409 1401 console_drivers=console->next; 1410 1402 res = 0; ··· 1426 1418 if (console_drivers != NULL && console->flags & CON_CONSDEV) 1427 1419 console_drivers->flags |= CON_CONSDEV; 1428 1420 1429 - release_console_sem(); 1421 + console_unlock(); 1430 1422 console_sysfs_notify(); 1431 1423 return res; 1432 1424 }
-1
kernel/rtmutex-debug.c
··· 215 215 put_pid(waiter->deadlock_task_pid); 216 216 TRACE_WARN_ON(!plist_node_empty(&waiter->list_entry)); 217 217 TRACE_WARN_ON(!plist_node_empty(&waiter->pi_list_entry)); 218 - TRACE_WARN_ON(waiter->task); 219 218 memset(waiter, 0x22, sizeof(*waiter)); 220 219 } 221 220
+113 -205
kernel/rtmutex.c
··· 20 20 /* 21 21 * lock->owner state tracking: 22 22 * 23 - * lock->owner holds the task_struct pointer of the owner. Bit 0 and 1 24 - * are used to keep track of the "owner is pending" and "lock has 25 - * waiters" state. 23 + * lock->owner holds the task_struct pointer of the owner. Bit 0 24 + * is used to keep track of the "lock has waiters" state. 26 25 * 27 - * owner bit1 bit0 28 - * NULL 0 0 lock is free (fast acquire possible) 29 - * NULL 0 1 invalid state 30 - * NULL 1 0 Transitional State* 31 - * NULL 1 1 invalid state 32 - * taskpointer 0 0 lock is held (fast release possible) 33 - * taskpointer 0 1 task is pending owner 34 - * taskpointer 1 0 lock is held and has waiters 35 - * taskpointer 1 1 task is pending owner and lock has more waiters 36 - * 37 - * Pending ownership is assigned to the top (highest priority) 38 - * waiter of the lock, when the lock is released. The thread is woken 39 - * up and can now take the lock. Until the lock is taken (bit 0 40 - * cleared) a competing higher priority thread can steal the lock 41 - * which puts the woken up thread back on the waiters list. 26 + * owner bit0 27 + * NULL 0 lock is free (fast acquire possible) 28 + * NULL 1 lock is free and has waiters and the top waiter 29 + * is going to take the lock* 30 + * taskpointer 0 lock is held (fast release possible) 31 + * taskpointer 1 lock is held and has waiters** 42 32 * 43 33 * The fast atomic compare exchange based acquire and release is only 44 - * possible when bit 0 and 1 of lock->owner are 0. 34 + * possible when bit 0 of lock->owner is 0. 45 35 * 46 - * (*) There's a small time where the owner can be NULL and the 47 - * "lock has waiters" bit is set. This can happen when grabbing the lock. 48 - * To prevent a cmpxchg of the owner releasing the lock, we need to set this 49 - * bit before looking at the lock, hence the reason this is a transitional 50 - * state. 36 + * (*) It also can be a transitional state when grabbing the lock 37 + * with ->wait_lock is held. To prevent any fast path cmpxchg to the lock, 38 + * we need to set the bit0 before looking at the lock, and the owner may be 39 + * NULL in this small time, hence this can be a transitional state. 40 + * 41 + * (**) There is a small time when bit 0 is set but there are no 42 + * waiters. This can happen when grabbing the lock in the slow path. 43 + * To prevent a cmpxchg of the owner releasing the lock, we need to 44 + * set this bit before looking at the lock. 51 45 */ 52 46 53 47 static void 54 - rt_mutex_set_owner(struct rt_mutex *lock, struct task_struct *owner, 55 - unsigned long mask) 48 + rt_mutex_set_owner(struct rt_mutex *lock, struct task_struct *owner) 56 49 { 57 - unsigned long val = (unsigned long)owner | mask; 50 + unsigned long val = (unsigned long)owner; 58 51 59 52 if (rt_mutex_has_waiters(lock)) 60 53 val |= RT_MUTEX_HAS_WAITERS; ··· 196 203 * reached or the state of the chain has changed while we 197 204 * dropped the locks. 198 205 */ 199 - if (!waiter || !waiter->task) 206 + if (!waiter) 200 207 goto out_unlock_pi; 201 208 202 209 /* 203 210 * Check the orig_waiter state. After we dropped the locks, 204 - * the previous owner of the lock might have released the lock 205 - * and made us the pending owner: 211 + * the previous owner of the lock might have released the lock. 206 212 */ 207 - if (orig_waiter && !orig_waiter->task) 213 + if (orig_waiter && !rt_mutex_owner(orig_lock)) 208 214 goto out_unlock_pi; 209 215 210 216 /* ··· 246 254 247 255 /* Release the task */ 248 256 raw_spin_unlock_irqrestore(&task->pi_lock, flags); 257 + if (!rt_mutex_owner(lock)) { 258 + /* 259 + * If the requeue above changed the top waiter, then we need 260 + * to wake the new top waiter up to try to get the lock. 261 + */ 262 + 263 + if (top_waiter != rt_mutex_top_waiter(lock)) 264 + wake_up_process(rt_mutex_top_waiter(lock)->task); 265 + raw_spin_unlock(&lock->wait_lock); 266 + goto out_put_task; 267 + } 249 268 put_task_struct(task); 250 269 251 270 /* Grab the next task */ ··· 299 296 } 300 297 301 298 /* 302 - * Optimization: check if we can steal the lock from the 303 - * assigned pending owner [which might not have taken the 304 - * lock yet]: 305 - */ 306 - static inline int try_to_steal_lock(struct rt_mutex *lock, 307 - struct task_struct *task) 308 - { 309 - struct task_struct *pendowner = rt_mutex_owner(lock); 310 - struct rt_mutex_waiter *next; 311 - unsigned long flags; 312 - 313 - if (!rt_mutex_owner_pending(lock)) 314 - return 0; 315 - 316 - if (pendowner == task) 317 - return 1; 318 - 319 - raw_spin_lock_irqsave(&pendowner->pi_lock, flags); 320 - if (task->prio >= pendowner->prio) { 321 - raw_spin_unlock_irqrestore(&pendowner->pi_lock, flags); 322 - return 0; 323 - } 324 - 325 - /* 326 - * Check if a waiter is enqueued on the pending owners 327 - * pi_waiters list. Remove it and readjust pending owners 328 - * priority. 329 - */ 330 - if (likely(!rt_mutex_has_waiters(lock))) { 331 - raw_spin_unlock_irqrestore(&pendowner->pi_lock, flags); 332 - return 1; 333 - } 334 - 335 - /* No chain handling, pending owner is not blocked on anything: */ 336 - next = rt_mutex_top_waiter(lock); 337 - plist_del(&next->pi_list_entry, &pendowner->pi_waiters); 338 - __rt_mutex_adjust_prio(pendowner); 339 - raw_spin_unlock_irqrestore(&pendowner->pi_lock, flags); 340 - 341 - /* 342 - * We are going to steal the lock and a waiter was 343 - * enqueued on the pending owners pi_waiters queue. So 344 - * we have to enqueue this waiter into 345 - * task->pi_waiters list. This covers the case, 346 - * where task is boosted because it holds another 347 - * lock and gets unboosted because the booster is 348 - * interrupted, so we would delay a waiter with higher 349 - * priority as task->normal_prio. 350 - * 351 - * Note: in the rare case of a SCHED_OTHER task changing 352 - * its priority and thus stealing the lock, next->task 353 - * might be task: 354 - */ 355 - if (likely(next->task != task)) { 356 - raw_spin_lock_irqsave(&task->pi_lock, flags); 357 - plist_add(&next->pi_list_entry, &task->pi_waiters); 358 - __rt_mutex_adjust_prio(task); 359 - raw_spin_unlock_irqrestore(&task->pi_lock, flags); 360 - } 361 - return 1; 362 - } 363 - 364 - /* 365 299 * Try to take an rt-mutex 366 300 * 367 - * This fails 368 - * - when the lock has a real owner 369 - * - when a different pending owner exists and has higher priority than current 370 - * 371 301 * Must be called with lock->wait_lock held. 302 + * 303 + * @lock: the lock to be acquired. 304 + * @task: the task which wants to acquire the lock 305 + * @waiter: the waiter that is queued to the lock's wait list. (could be NULL) 372 306 */ 373 - static int try_to_take_rt_mutex(struct rt_mutex *lock) 307 + static int try_to_take_rt_mutex(struct rt_mutex *lock, struct task_struct *task, 308 + struct rt_mutex_waiter *waiter) 374 309 { 375 310 /* 376 311 * We have to be careful here if the atomic speedups are ··· 331 390 */ 332 391 mark_rt_mutex_waiters(lock); 333 392 334 - if (rt_mutex_owner(lock) && !try_to_steal_lock(lock, current)) 393 + if (rt_mutex_owner(lock)) 335 394 return 0; 395 + 396 + /* 397 + * It will get the lock because of one of these conditions: 398 + * 1) there is no waiter 399 + * 2) higher priority than waiters 400 + * 3) it is top waiter 401 + */ 402 + if (rt_mutex_has_waiters(lock)) { 403 + if (task->prio >= rt_mutex_top_waiter(lock)->list_entry.prio) { 404 + if (!waiter || waiter != rt_mutex_top_waiter(lock)) 405 + return 0; 406 + } 407 + } 408 + 409 + if (waiter || rt_mutex_has_waiters(lock)) { 410 + unsigned long flags; 411 + struct rt_mutex_waiter *top; 412 + 413 + raw_spin_lock_irqsave(&task->pi_lock, flags); 414 + 415 + /* remove the queued waiter. */ 416 + if (waiter) { 417 + plist_del(&waiter->list_entry, &lock->wait_list); 418 + task->pi_blocked_on = NULL; 419 + } 420 + 421 + /* 422 + * We have to enqueue the top waiter(if it exists) into 423 + * task->pi_waiters list. 424 + */ 425 + if (rt_mutex_has_waiters(lock)) { 426 + top = rt_mutex_top_waiter(lock); 427 + top->pi_list_entry.prio = top->list_entry.prio; 428 + plist_add(&top->pi_list_entry, &task->pi_waiters); 429 + } 430 + raw_spin_unlock_irqrestore(&task->pi_lock, flags); 431 + } 336 432 337 433 /* We got the lock. */ 338 434 debug_rt_mutex_lock(lock); 339 435 340 - rt_mutex_set_owner(lock, current, 0); 436 + rt_mutex_set_owner(lock, task); 341 437 342 - rt_mutex_deadlock_account_lock(lock, current); 438 + rt_mutex_deadlock_account_lock(lock, task); 343 439 344 440 return 1; 345 441 } ··· 414 436 415 437 raw_spin_unlock_irqrestore(&task->pi_lock, flags); 416 438 439 + if (!owner) 440 + return 0; 441 + 417 442 if (waiter == rt_mutex_top_waiter(lock)) { 418 443 raw_spin_lock_irqsave(&owner->pi_lock, flags); 419 444 plist_del(&top_waiter->pi_list_entry, &owner->pi_waiters); ··· 453 472 /* 454 473 * Wake up the next waiter on the lock. 455 474 * 456 - * Remove the top waiter from the current tasks waiter list and from 457 - * the lock waiter list. Set it as pending owner. Then wake it up. 475 + * Remove the top waiter from the current tasks waiter list and wake it up. 458 476 * 459 477 * Called with lock->wait_lock held. 460 478 */ 461 479 static void wakeup_next_waiter(struct rt_mutex *lock) 462 480 { 463 481 struct rt_mutex_waiter *waiter; 464 - struct task_struct *pendowner; 465 482 unsigned long flags; 466 483 467 484 raw_spin_lock_irqsave(&current->pi_lock, flags); 468 485 469 486 waiter = rt_mutex_top_waiter(lock); 470 - plist_del(&waiter->list_entry, &lock->wait_list); 471 487 472 488 /* 473 489 * Remove it from current->pi_waiters. We do not adjust a ··· 473 495 * lock->wait_lock. 474 496 */ 475 497 plist_del(&waiter->pi_list_entry, &current->pi_waiters); 476 - pendowner = waiter->task; 477 - waiter->task = NULL; 478 498 479 - rt_mutex_set_owner(lock, pendowner, RT_MUTEX_OWNER_PENDING); 499 + rt_mutex_set_owner(lock, NULL); 480 500 481 501 raw_spin_unlock_irqrestore(&current->pi_lock, flags); 482 502 483 - /* 484 - * Clear the pi_blocked_on variable and enqueue a possible 485 - * waiter into the pi_waiters list of the pending owner. This 486 - * prevents that in case the pending owner gets unboosted a 487 - * waiter with higher priority than pending-owner->normal_prio 488 - * is blocked on the unboosted (pending) owner. 489 - */ 490 - raw_spin_lock_irqsave(&pendowner->pi_lock, flags); 491 - 492 - WARN_ON(!pendowner->pi_blocked_on); 493 - WARN_ON(pendowner->pi_blocked_on != waiter); 494 - WARN_ON(pendowner->pi_blocked_on->lock != lock); 495 - 496 - pendowner->pi_blocked_on = NULL; 497 - 498 - if (rt_mutex_has_waiters(lock)) { 499 - struct rt_mutex_waiter *next; 500 - 501 - next = rt_mutex_top_waiter(lock); 502 - plist_add(&next->pi_list_entry, &pendowner->pi_waiters); 503 - } 504 - raw_spin_unlock_irqrestore(&pendowner->pi_lock, flags); 505 - 506 - wake_up_process(pendowner); 503 + wake_up_process(waiter->task); 507 504 } 508 505 509 506 /* 510 - * Remove a waiter from a lock 507 + * Remove a waiter from a lock and give up 511 508 * 512 - * Must be called with lock->wait_lock held 509 + * Must be called with lock->wait_lock held and 510 + * have just failed to try_to_take_rt_mutex(). 513 511 */ 514 512 static void remove_waiter(struct rt_mutex *lock, 515 513 struct rt_mutex_waiter *waiter) ··· 497 543 498 544 raw_spin_lock_irqsave(&current->pi_lock, flags); 499 545 plist_del(&waiter->list_entry, &lock->wait_list); 500 - waiter->task = NULL; 501 546 current->pi_blocked_on = NULL; 502 547 raw_spin_unlock_irqrestore(&current->pi_lock, flags); 503 548 504 - if (first && owner != current) { 549 + if (!owner) 550 + return; 551 + 552 + if (first) { 505 553 506 554 raw_spin_lock_irqsave(&owner->pi_lock, flags); 507 555 ··· 570 614 * or TASK_UNINTERRUPTIBLE) 571 615 * @timeout: the pre-initialized and started timer, or NULL for none 572 616 * @waiter: the pre-initialized rt_mutex_waiter 573 - * @detect_deadlock: passed to task_blocks_on_rt_mutex 574 617 * 575 618 * lock->wait_lock must be held by the caller. 576 619 */ 577 620 static int __sched 578 621 __rt_mutex_slowlock(struct rt_mutex *lock, int state, 579 622 struct hrtimer_sleeper *timeout, 580 - struct rt_mutex_waiter *waiter, 581 - int detect_deadlock) 623 + struct rt_mutex_waiter *waiter) 582 624 { 583 625 int ret = 0; 584 626 585 627 for (;;) { 586 628 /* Try to acquire the lock: */ 587 - if (try_to_take_rt_mutex(lock)) 629 + if (try_to_take_rt_mutex(lock, current, waiter)) 588 630 break; 589 631 590 632 /* ··· 599 645 break; 600 646 } 601 647 602 - /* 603 - * waiter->task is NULL the first time we come here and 604 - * when we have been woken up by the previous owner 605 - * but the lock got stolen by a higher prio task. 606 - */ 607 - if (!waiter->task) { 608 - ret = task_blocks_on_rt_mutex(lock, waiter, current, 609 - detect_deadlock); 610 - /* 611 - * If we got woken up by the owner then start loop 612 - * all over without going into schedule to try 613 - * to get the lock now: 614 - */ 615 - if (unlikely(!waiter->task)) { 616 - /* 617 - * Reset the return value. We might 618 - * have returned with -EDEADLK and the 619 - * owner released the lock while we 620 - * were walking the pi chain. 621 - */ 622 - ret = 0; 623 - continue; 624 - } 625 - if (unlikely(ret)) 626 - break; 627 - } 628 - 629 648 raw_spin_unlock(&lock->wait_lock); 630 649 631 650 debug_rt_mutex_print_deadlock(waiter); 632 651 633 - if (waiter->task) 634 - schedule_rt_mutex(lock); 652 + schedule_rt_mutex(lock); 635 653 636 654 raw_spin_lock(&lock->wait_lock); 637 655 set_current_state(state); ··· 624 698 int ret = 0; 625 699 626 700 debug_rt_mutex_init_waiter(&waiter); 627 - waiter.task = NULL; 628 701 629 702 raw_spin_lock(&lock->wait_lock); 630 703 631 704 /* Try to acquire the lock again: */ 632 - if (try_to_take_rt_mutex(lock)) { 705 + if (try_to_take_rt_mutex(lock, current, NULL)) { 633 706 raw_spin_unlock(&lock->wait_lock); 634 707 return 0; 635 708 } ··· 642 717 timeout->task = NULL; 643 718 } 644 719 645 - ret = __rt_mutex_slowlock(lock, state, timeout, &waiter, 646 - detect_deadlock); 720 + ret = task_blocks_on_rt_mutex(lock, &waiter, current, detect_deadlock); 721 + 722 + if (likely(!ret)) 723 + ret = __rt_mutex_slowlock(lock, state, timeout, &waiter); 647 724 648 725 set_current_state(TASK_RUNNING); 649 726 650 - if (unlikely(waiter.task)) 727 + if (unlikely(ret)) 651 728 remove_waiter(lock, &waiter); 652 729 653 730 /* ··· 663 736 /* Remove pending timer: */ 664 737 if (unlikely(timeout)) 665 738 hrtimer_cancel(&timeout->timer); 666 - 667 - /* 668 - * Readjust priority, when we did not get the lock. We might 669 - * have been the pending owner and boosted. Since we did not 670 - * take the lock, the PI boost has to go. 671 - */ 672 - if (unlikely(ret)) 673 - rt_mutex_adjust_prio(current); 674 739 675 740 debug_rt_mutex_free_waiter(&waiter); 676 741 ··· 681 762 682 763 if (likely(rt_mutex_owner(lock) != current)) { 683 764 684 - ret = try_to_take_rt_mutex(lock); 765 + ret = try_to_take_rt_mutex(lock, current, NULL); 685 766 /* 686 767 * try_to_take_rt_mutex() sets the lock waiters 687 768 * bit unconditionally. Clean this up. ··· 911 992 { 912 993 __rt_mutex_init(lock, NULL); 913 994 debug_rt_mutex_proxy_lock(lock, proxy_owner); 914 - rt_mutex_set_owner(lock, proxy_owner, 0); 995 + rt_mutex_set_owner(lock, proxy_owner); 915 996 rt_mutex_deadlock_account_lock(lock, proxy_owner); 916 997 } 917 998 ··· 927 1008 struct task_struct *proxy_owner) 928 1009 { 929 1010 debug_rt_mutex_proxy_unlock(lock); 930 - rt_mutex_set_owner(lock, NULL, 0); 1011 + rt_mutex_set_owner(lock, NULL); 931 1012 rt_mutex_deadlock_account_unlock(proxy_owner); 932 1013 } 933 1014 ··· 953 1034 954 1035 raw_spin_lock(&lock->wait_lock); 955 1036 956 - mark_rt_mutex_waiters(lock); 957 - 958 - if (!rt_mutex_owner(lock) || try_to_steal_lock(lock, task)) { 959 - /* We got the lock for task. */ 960 - debug_rt_mutex_lock(lock); 961 - rt_mutex_set_owner(lock, task, 0); 1037 + if (try_to_take_rt_mutex(lock, task, NULL)) { 962 1038 raw_spin_unlock(&lock->wait_lock); 963 - rt_mutex_deadlock_account_lock(lock, task); 964 1039 return 1; 965 1040 } 966 1041 967 1042 ret = task_blocks_on_rt_mutex(lock, waiter, task, detect_deadlock); 968 1043 969 - if (ret && !waiter->task) { 1044 + if (ret && !rt_mutex_owner(lock)) { 970 1045 /* 971 1046 * Reset the return value. We might have 972 1047 * returned with -EDEADLK and the owner ··· 969 1056 */ 970 1057 ret = 0; 971 1058 } 1059 + 1060 + if (unlikely(ret)) 1061 + remove_waiter(lock, waiter); 1062 + 972 1063 raw_spin_unlock(&lock->wait_lock); 973 1064 974 1065 debug_rt_mutex_print_deadlock(waiter); ··· 1027 1110 1028 1111 set_current_state(TASK_INTERRUPTIBLE); 1029 1112 1030 - ret = __rt_mutex_slowlock(lock, TASK_INTERRUPTIBLE, to, waiter, 1031 - detect_deadlock); 1113 + ret = __rt_mutex_slowlock(lock, TASK_INTERRUPTIBLE, to, waiter); 1032 1114 1033 1115 set_current_state(TASK_RUNNING); 1034 1116 1035 - if (unlikely(waiter->task)) 1117 + if (unlikely(ret)) 1036 1118 remove_waiter(lock, waiter); 1037 1119 1038 1120 /* ··· 1041 1125 fixup_rt_mutex_waiters(lock); 1042 1126 1043 1127 raw_spin_unlock(&lock->wait_lock); 1044 - 1045 - /* 1046 - * Readjust priority, when we did not get the lock. We might have been 1047 - * the pending owner and boosted. Since we did not take the lock, the 1048 - * PI boost has to go. 1049 - */ 1050 - if (unlikely(ret)) 1051 - rt_mutex_adjust_prio(current); 1052 1128 1053 1129 return ret; 1054 1130 }
+2 -14
kernel/rtmutex_common.h
··· 91 91 /* 92 92 * lock->owner state tracking: 93 93 */ 94 - #define RT_MUTEX_OWNER_PENDING 1UL 95 - #define RT_MUTEX_HAS_WAITERS 2UL 96 - #define RT_MUTEX_OWNER_MASKALL 3UL 94 + #define RT_MUTEX_HAS_WAITERS 1UL 95 + #define RT_MUTEX_OWNER_MASKALL 1UL 97 96 98 97 static inline struct task_struct *rt_mutex_owner(struct rt_mutex *lock) 99 98 { 100 99 return (struct task_struct *) 101 100 ((unsigned long)lock->owner & ~RT_MUTEX_OWNER_MASKALL); 102 - } 103 - 104 - static inline struct task_struct *rt_mutex_real_owner(struct rt_mutex *lock) 105 - { 106 - return (struct task_struct *) 107 - ((unsigned long)lock->owner & ~RT_MUTEX_HAS_WAITERS); 108 - } 109 - 110 - static inline unsigned long rt_mutex_owner_pending(struct rt_mutex *lock) 111 - { 112 - return (unsigned long)lock->owner & RT_MUTEX_OWNER_PENDING; 113 101 } 114 102 115 103 /*
+53 -25
kernel/sched_fair.c
··· 699 699 cfs_rq->nr_running--; 700 700 } 701 701 702 - #if defined CONFIG_SMP && defined CONFIG_FAIR_GROUP_SCHED 702 + #ifdef CONFIG_FAIR_GROUP_SCHED 703 + # ifdef CONFIG_SMP 703 704 static void update_cfs_rq_load_contribution(struct cfs_rq *cfs_rq, 704 705 int global_update) 705 706 { ··· 763 762 list_del_leaf_cfs_rq(cfs_rq); 764 763 } 765 764 765 + static long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg, 766 + long weight_delta) 767 + { 768 + long load_weight, load, shares; 769 + 770 + load = cfs_rq->load.weight + weight_delta; 771 + 772 + load_weight = atomic_read(&tg->load_weight); 773 + load_weight -= cfs_rq->load_contribution; 774 + load_weight += load; 775 + 776 + shares = (tg->shares * load); 777 + if (load_weight) 778 + shares /= load_weight; 779 + 780 + if (shares < MIN_SHARES) 781 + shares = MIN_SHARES; 782 + if (shares > tg->shares) 783 + shares = tg->shares; 784 + 785 + return shares; 786 + } 787 + 788 + static void update_entity_shares_tick(struct cfs_rq *cfs_rq) 789 + { 790 + if (cfs_rq->load_unacc_exec_time > sysctl_sched_shares_window) { 791 + update_cfs_load(cfs_rq, 0); 792 + update_cfs_shares(cfs_rq, 0); 793 + } 794 + } 795 + # else /* CONFIG_SMP */ 796 + static void update_cfs_load(struct cfs_rq *cfs_rq, int global_update) 797 + { 798 + } 799 + 800 + static inline long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg, 801 + long weight_delta) 802 + { 803 + return tg->shares; 804 + } 805 + 806 + static inline void update_entity_shares_tick(struct cfs_rq *cfs_rq) 807 + { 808 + } 809 + # endif /* CONFIG_SMP */ 766 810 static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, 767 811 unsigned long weight) 768 812 { ··· 828 782 { 829 783 struct task_group *tg; 830 784 struct sched_entity *se; 831 - long load_weight, load, shares; 785 + long shares; 832 786 833 787 if (!cfs_rq) 834 788 return; ··· 837 791 se = tg->se[cpu_of(rq_of(cfs_rq))]; 838 792 if (!se) 839 793 return; 840 - 841 - load = cfs_rq->load.weight + weight_delta; 842 - 843 - load_weight = atomic_read(&tg->load_weight); 844 - load_weight -= cfs_rq->load_contribution; 845 - load_weight += load; 846 - 847 - shares = (tg->shares * load); 848 - if (load_weight) 849 - shares /= load_weight; 850 - 851 - if (shares < MIN_SHARES) 852 - shares = MIN_SHARES; 853 - if (shares > tg->shares) 854 - shares = tg->shares; 794 + #ifndef CONFIG_SMP 795 + if (likely(se->load.weight == tg->shares)) 796 + return; 797 + #endif 798 + shares = calc_cfs_shares(cfs_rq, tg, weight_delta); 855 799 856 800 reweight_entity(cfs_rq_of(se), se, shares); 857 - } 858 - 859 - static void update_entity_shares_tick(struct cfs_rq *cfs_rq) 860 - { 861 - if (cfs_rq->load_unacc_exec_time > sysctl_sched_shares_window) { 862 - update_cfs_load(cfs_rq, 0); 863 - update_cfs_shares(cfs_rq, 0); 864 - } 865 801 } 866 802 #else /* CONFIG_FAIR_GROUP_SCHED */ 867 803 static void update_cfs_load(struct cfs_rq *cfs_rq, int global_update)
+2 -1
kernel/sysctl.c
··· 170 170 #endif 171 171 172 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 176 static int sysrq_sysctl_handler(ctl_table *table, int write, 176 177 void __user *buffer, size_t *lenp,
+4 -3
kernel/time/tick-sched.c
··· 642 642 } 643 643 local_irq_enable(); 644 644 645 - printk(KERN_INFO "Switched to NOHz mode on CPU #%d\n", 646 - smp_processor_id()); 645 + printk(KERN_INFO "Switched to NOHz mode on CPU #%d\n", smp_processor_id()); 647 646 } 648 647 649 648 /* ··· 794 795 } 795 796 796 797 #ifdef CONFIG_NO_HZ 797 - if (tick_nohz_enabled) 798 + if (tick_nohz_enabled) { 798 799 ts->nohz_mode = NOHZ_MODE_HIGHRES; 800 + printk(KERN_INFO "Switched to NOHz mode on CPU #%d\n", smp_processor_id()); 801 + } 799 802 #endif 800 803 } 801 804 #endif /* HIGH_RES_TIMERS */
+4 -3
lib/radix-tree.c
··· 736 736 } 737 737 } 738 738 /* 739 - * The iftag must have been set somewhere because otherwise 740 - * we would return immediated at the beginning of the function 739 + * We need not to tag the root tag if there is no tag which is set with 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 744 *first_indexp = index; 744 745 745 746 return tagged;
+1 -1
mm/Kconfig
··· 179 179 config COMPACTION 180 180 bool "Allow for memory compaction" 181 181 select MIGRATION 182 - depends on EXPERIMENTAL && HUGETLB_PAGE && MMU 182 + depends on MMU 183 183 help 184 184 Allows the compaction of memory for the allocation of huge pages. 185 185
+21 -10
mm/memcontrol.c
··· 1832 1832 if (likely(!ret)) 1833 1833 return CHARGE_OK; 1834 1834 1835 + res_counter_uncharge(&mem->res, csize); 1835 1836 mem_over_limit = mem_cgroup_from_res_counter(fail_res, memsw); 1836 1837 flags |= MEM_CGROUP_RECLAIM_NOSWAP; 1837 1838 } else ··· 2145 2144 struct page_cgroup *tail_pc = lookup_page_cgroup(tail); 2146 2145 unsigned long flags; 2147 2146 2147 + if (mem_cgroup_disabled()) 2148 + return; 2148 2149 /* 2149 2150 * We have no races with charge/uncharge but will have races with 2150 2151 * page state accounting. ··· 2236 2233 { 2237 2234 int ret = -EINVAL; 2238 2235 unsigned long flags; 2239 - 2236 + /* 2237 + * The page is isolated from LRU. So, collapse function 2238 + * will not handle this page. But page splitting can happen. 2239 + * Do this check under compound_page_lock(). The caller should 2240 + * hold it. 2241 + */ 2240 2242 if ((charge_size > PAGE_SIZE) && !PageTransHuge(pc->page)) 2241 2243 return -EBUSY; 2242 2244 ··· 2273 2265 struct cgroup *cg = child->css.cgroup; 2274 2266 struct cgroup *pcg = cg->parent; 2275 2267 struct mem_cgroup *parent; 2276 - int charge = PAGE_SIZE; 2268 + int page_size = PAGE_SIZE; 2277 2269 unsigned long flags; 2278 2270 int ret; 2279 2271 ··· 2286 2278 goto out; 2287 2279 if (isolate_lru_page(page)) 2288 2280 goto put; 2289 - /* The page is isolated from LRU and we have no race with splitting */ 2290 - charge = PAGE_SIZE << compound_order(page); 2281 + 2282 + if (PageTransHuge(page)) 2283 + page_size = HPAGE_SIZE; 2291 2284 2292 2285 parent = mem_cgroup_from_cont(pcg); 2293 - ret = __mem_cgroup_try_charge(NULL, gfp_mask, &parent, false, charge); 2286 + ret = __mem_cgroup_try_charge(NULL, gfp_mask, 2287 + &parent, false, page_size); 2294 2288 if (ret || !parent) 2295 2289 goto put_back; 2296 2290 2297 - if (charge > PAGE_SIZE) 2291 + if (page_size > PAGE_SIZE) 2298 2292 flags = compound_lock_irqsave(page); 2299 2293 2300 - ret = mem_cgroup_move_account(pc, child, parent, true, charge); 2294 + ret = mem_cgroup_move_account(pc, child, parent, true, page_size); 2301 2295 if (ret) 2302 - mem_cgroup_cancel_charge(parent, charge); 2303 - put_back: 2304 - if (charge > PAGE_SIZE) 2296 + mem_cgroup_cancel_charge(parent, page_size); 2297 + 2298 + if (page_size > PAGE_SIZE) 2305 2299 compound_unlock_irqrestore(page, flags); 2300 + put_back: 2306 2301 putback_lru_page(page); 2307 2302 put: 2308 2303 put_page(page);
+1 -1
mm/migrate.c
··· 888 888 * are movable anymore because to has become empty 889 889 * or no retryable pages exist anymore. 890 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 893 * Return: Number of pages not migrated or error code. 894 894 */
+15 -3
mm/page_alloc.c
··· 1088 1088 pset = per_cpu_ptr(zone->pageset, cpu); 1089 1089 1090 1090 pcp = &pset->pcp; 1091 - free_pcppages_bulk(zone, pcp->count, pcp); 1092 - pcp->count = 0; 1091 + if (pcp->count) { 1092 + free_pcppages_bulk(zone, pcp->count, pcp); 1093 + pcp->count = 0; 1094 + } 1093 1095 local_irq_restore(flags); 1094 1096 } 1095 1097 } ··· 2036 2034 */ 2037 2035 alloc_flags = gfp_to_alloc_flags(gfp_mask); 2038 2036 2037 + /* 2038 + * Find the true preferred zone if the allocation is unconstrained by 2039 + * cpusets. 2040 + */ 2041 + if (!(alloc_flags & ALLOC_CPUSET) && !nodemask) 2042 + first_zones_zonelist(zonelist, high_zoneidx, NULL, 2043 + &preferred_zone); 2044 + 2039 2045 /* This is the last chance, in general, before the goto nopage. */ 2040 2046 page = get_page_from_freelist(gfp_mask, nodemask, order, zonelist, 2041 2047 high_zoneidx, alloc_flags & ~ALLOC_NO_WATERMARKS, ··· 2202 2192 2203 2193 get_mems_allowed(); 2204 2194 /* The preferred zone is used for statistics later */ 2205 - first_zones_zonelist(zonelist, high_zoneidx, nodemask, &preferred_zone); 2195 + first_zones_zonelist(zonelist, high_zoneidx, 2196 + nodemask ? : &cpuset_current_mems_allowed, 2197 + &preferred_zone); 2206 2198 if (!preferred_zone) { 2207 2199 put_mems_allowed(); 2208 2200 return NULL;
+1
mm/pgtable-generic.c
··· 6 6 * Copyright (C) 2010 Linus Torvalds 7 7 */ 8 8 9 + #include <linux/pagemap.h> 9 10 #include <asm/tlb.h> 10 11 #include <asm-generic/pgtable.h> 11 12
+2 -1
mm/vmscan.c
··· 2083 2083 struct zone *preferred_zone; 2084 2084 2085 2085 first_zones_zonelist(zonelist, gfp_zone(sc->gfp_mask), 2086 - NULL, &preferred_zone); 2086 + &cpuset_current_mems_allowed, 2087 + &preferred_zone); 2087 2088 wait_iff_congested(preferred_zone, BLK_RW_ASYNC, HZ/10); 2088 2089 } 2089 2090 }
+1 -1
net/dsa/dsa.c
··· 428 428 } 429 429 module_exit(dsa_cleanup_module); 430 430 431 - MODULE_AUTHOR("Lennert Buytenhek <buytenh@wantstofly.org>") 431 + MODULE_AUTHOR("Lennert Buytenhek <buytenh@wantstofly.org>"); 432 432 MODULE_DESCRIPTION("Driver for Distributed Switch Architecture switch chips"); 433 433 MODULE_LICENSE("GPL"); 434 434 MODULE_ALIAS("platform:dsa");
+2 -2
security/keys/Makefile
··· 13 13 request_key_auth.o \ 14 14 user_defined.o 15 15 16 - obj-$(CONFIG_TRUSTED_KEYS) += trusted_defined.o 17 - obj-$(CONFIG_ENCRYPTED_KEYS) += encrypted_defined.o 16 + obj-$(CONFIG_TRUSTED_KEYS) += trusted.o 17 + obj-$(CONFIG_ENCRYPTED_KEYS) += encrypted.o 18 18 obj-$(CONFIG_KEYS_COMPAT) += compat.o 19 19 obj-$(CONFIG_PROC_FS) += proc.o 20 20 obj-$(CONFIG_SYSCTL) += sysctl.o
+2 -1
security/keys/encrypted_defined.c security/keys/encrypted.c
··· 30 30 #include <crypto/sha.h> 31 31 #include <crypto/aes.h> 32 32 33 - #include "encrypted_defined.h" 33 + #include "encrypted.h" 34 34 35 35 static const char KEY_TRUSTED_PREFIX[] = "trusted:"; 36 36 static const char KEY_USER_PREFIX[] = "user:"; ··· 888 888 out: 889 889 encrypted_shash_release(); 890 890 return ret; 891 + 891 892 } 892 893 893 894 static void __exit cleanup_encrypted(void)
security/keys/encrypted_defined.h security/keys/encrypted.h
+3 -3
security/keys/internal.h
··· 87 87 extern int __key_link_begin(struct key *keyring, 88 88 const struct key_type *type, 89 89 const char *description, 90 - struct keyring_list **_prealloc); 90 + unsigned long *_prealloc); 91 91 extern int __key_link_check_live_key(struct key *keyring, struct key *key); 92 92 extern void __key_link(struct key *keyring, struct key *key, 93 - struct keyring_list **_prealloc); 93 + unsigned long *_prealloc); 94 94 extern void __key_link_end(struct key *keyring, 95 95 struct key_type *type, 96 - struct keyring_list *prealloc); 96 + unsigned long prealloc); 97 97 98 98 extern key_ref_t __keyring_search_one(key_ref_t keyring_ref, 99 99 const struct key_type *type,
+4 -4
security/keys/key.c
··· 415 415 size_t datalen, 416 416 struct key *keyring, 417 417 struct key *authkey, 418 - struct keyring_list **_prealloc) 418 + unsigned long *_prealloc) 419 419 { 420 420 int ret, awaken; 421 421 ··· 481 481 struct key *keyring, 482 482 struct key *authkey) 483 483 { 484 - struct keyring_list *prealloc; 484 + unsigned long prealloc; 485 485 int ret; 486 486 487 487 if (keyring) { ··· 526 526 struct key *keyring, 527 527 struct key *authkey) 528 528 { 529 - struct keyring_list *prealloc; 529 + unsigned long prealloc; 530 530 struct timespec now; 531 531 int ret, awaken, link_ret = 0; 532 532 ··· 814 814 key_perm_t perm, 815 815 unsigned long flags) 816 816 { 817 - struct keyring_list *prealloc; 817 + unsigned long prealloc; 818 818 const struct cred *cred = current_cred(); 819 819 struct key_type *ktype; 820 820 struct key *keyring, *key = NULL;
+19 -12
security/keys/keyring.c
··· 25 25 (keyring)->payload.subscriptions, \ 26 26 rwsem_is_locked((struct rw_semaphore *)&(keyring)->sem))) 27 27 28 + #define KEY_LINK_FIXQUOTA 1UL 29 + 28 30 /* 29 31 * When plumbing the depths of the key tree, this sets a hard limit 30 32 * set on how deep we're willing to go. ··· 701 699 * Preallocate memory so that a key can be linked into to a keyring. 702 700 */ 703 701 int __key_link_begin(struct key *keyring, const struct key_type *type, 704 - const char *description, 705 - struct keyring_list **_prealloc) 702 + const char *description, unsigned long *_prealloc) 706 703 __acquires(&keyring->sem) 707 704 { 708 705 struct keyring_list *klist, *nklist; 706 + unsigned long prealloc; 709 707 unsigned max; 710 708 size_t size; 711 709 int loop, ret; ··· 748 746 749 747 /* note replacement slot */ 750 748 klist->delkey = nklist->delkey = loop; 749 + prealloc = (unsigned long)nklist; 751 750 goto done; 752 751 } 753 752 } ··· 763 760 if (klist && klist->nkeys < klist->maxkeys) { 764 761 /* there's sufficient slack space to append directly */ 765 762 nklist = NULL; 763 + prealloc = KEY_LINK_FIXQUOTA; 766 764 } else { 767 765 /* grow the key list */ 768 766 max = 4; ··· 798 794 nklist->keys[nklist->delkey] = NULL; 799 795 } 800 796 797 + prealloc = (unsigned long)nklist | KEY_LINK_FIXQUOTA; 801 798 done: 802 - *_prealloc = nklist; 799 + *_prealloc = prealloc; 803 800 kleave(" = 0"); 804 801 return 0; 805 802 ··· 841 836 * combination. 842 837 */ 843 838 void __key_link(struct key *keyring, struct key *key, 844 - struct keyring_list **_prealloc) 839 + unsigned long *_prealloc) 845 840 { 846 841 struct keyring_list *klist, *nklist; 847 842 848 - nklist = *_prealloc; 849 - *_prealloc = NULL; 843 + nklist = (struct keyring_list *)(*_prealloc & ~KEY_LINK_FIXQUOTA); 844 + *_prealloc = 0; 850 845 851 846 kenter("%d,%d,%p", keyring->serial, key->serial, nklist); 852 847 ··· 886 881 * Must be called with __key_link_begin() having being called. 887 882 */ 888 883 void __key_link_end(struct key *keyring, struct key_type *type, 889 - struct keyring_list *prealloc) 884 + unsigned long prealloc) 890 885 __releases(&keyring->sem) 891 886 { 892 887 BUG_ON(type == NULL); 893 888 BUG_ON(type->name == NULL); 894 - kenter("%d,%s,%p", keyring->serial, type->name, prealloc); 889 + kenter("%d,%s,%lx", keyring->serial, type->name, prealloc); 895 890 896 891 if (type == &key_type_keyring) 897 892 up_write(&keyring_serialise_link_sem); 898 893 899 894 if (prealloc) { 900 - kfree(prealloc); 901 - key_payload_reserve(keyring, 902 - keyring->datalen - KEYQUOTA_LINK_BYTES); 895 + if (prealloc & KEY_LINK_FIXQUOTA) 896 + key_payload_reserve(keyring, 897 + keyring->datalen - 898 + KEYQUOTA_LINK_BYTES); 899 + kfree((struct keyring_list *)(prealloc & ~KEY_LINK_FIXQUOTA)); 903 900 } 904 901 up_write(&keyring->sem); 905 902 } ··· 928 921 */ 929 922 int key_link(struct key *keyring, struct key *key) 930 923 { 931 - struct keyring_list *prealloc; 924 + unsigned long prealloc; 932 925 int ret; 933 926 934 927 key_check(keyring);
+1 -1
security/keys/request_key.c
··· 352 352 struct key_user *user, 353 353 struct key **_key) 354 354 { 355 - struct keyring_list *prealloc; 356 355 const struct cred *cred = current_cred(); 356 + unsigned long prealloc; 357 357 struct key *key; 358 358 key_ref_t key_ref; 359 359 int ret;
+2 -1
security/keys/trusted_defined.c security/keys/trusted.c
··· 29 29 #include <linux/tpm.h> 30 30 #include <linux/tpm_command.h> 31 31 32 - #include "trusted_defined.h" 32 + #include "trusted.h" 33 33 34 34 static const char hmac_alg[] = "hmac(sha1)"; 35 35 static const char hash_alg[] = "sha1"; ··· 1032 1032 ret = datablob_parse(datablob, new_p, new_o); 1033 1033 if (ret != Opt_update) { 1034 1034 ret = -EINVAL; 1035 + kfree(new_p); 1035 1036 goto out; 1036 1037 } 1037 1038 /* copy old key values, and reseal with new pcrs */
security/keys/trusted_defined.h security/keys/trusted.h
+1 -1
security/selinux/ss/conditional.c
··· 178 178 p->bool_val_to_struct = (struct cond_bool_datum **) 179 179 kmalloc(p->p_bools.nprim * sizeof(struct cond_bool_datum *), GFP_KERNEL); 180 180 if (!p->bool_val_to_struct) 181 - return -1; 181 + return -ENOMEM; 182 182 return 0; 183 183 } 184 184
+2 -2
security/selinux/ss/policydb.c
··· 501 501 if (rc) 502 502 goto out; 503 503 504 - rc = -ENOMEM; 505 - if (cond_init_bool_indexes(p)) 504 + rc = cond_init_bool_indexes(p); 505 + if (rc) 506 506 goto out; 507 507 508 508 for (i = 0; i < SYM_NUM; i++) {
+26 -22
sound/arm/aaci.c
··· 30 30 31 31 #define DRIVER_NAME "aaci-pl041" 32 32 33 + #define FRAME_PERIOD_US 21 34 + 33 35 /* 34 36 * PM support is not complete. Turn it off. 35 37 */ ··· 66 64 unsigned short val) 67 65 { 68 66 struct aaci *aaci = ac97->private_data; 67 + int timeout; 69 68 u32 v; 70 - int timeout = 5000; 71 69 72 70 if (ac97->num >= 4) 73 71 return; ··· 83 81 writel(val << 4, aaci->base + AACI_SL2TX); 84 82 writel(reg << 12, aaci->base + AACI_SL1TX); 85 83 86 - /* 87 - * Wait for the transmission of both slots to complete. 88 - */ 84 + /* Initially, wait one frame period */ 85 + udelay(FRAME_PERIOD_US); 86 + 87 + /* And then wait an additional eight frame periods for it to be sent */ 88 + timeout = FRAME_PERIOD_US * 8; 89 89 do { 90 + udelay(1); 90 91 v = readl(aaci->base + AACI_SLFR); 91 92 } while ((v & (SLFR_1TXB|SLFR_2TXB)) && --timeout); 92 93 93 - if (!timeout) 94 + if (v & (SLFR_1TXB|SLFR_2TXB)) 94 95 dev_err(&aaci->dev->dev, 95 96 "timeout waiting for write to complete\n"); 96 97 ··· 106 101 static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg) 107 102 { 108 103 struct aaci *aaci = ac97->private_data; 104 + int timeout, retries = 10; 109 105 u32 v; 110 - int timeout = 5000; 111 - int retries = 10; 112 106 113 107 if (ac97->num >= 4) 114 108 return ~0; ··· 121 117 */ 122 118 writel((reg << 12) | (1 << 19), aaci->base + AACI_SL1TX); 123 119 124 - /* 125 - * Wait for the transmission to complete. 126 - */ 120 + /* Initially, wait one frame period */ 121 + udelay(FRAME_PERIOD_US); 122 + 123 + /* And then wait an additional eight frame periods for it to be sent */ 124 + timeout = FRAME_PERIOD_US * 8; 127 125 do { 126 + udelay(1); 128 127 v = readl(aaci->base + AACI_SLFR); 129 128 } while ((v & SLFR_1TXB) && --timeout); 130 129 131 - if (!timeout) { 130 + if (v & SLFR_1TXB) { 132 131 dev_err(&aaci->dev->dev, "timeout on slot 1 TX busy\n"); 133 132 v = ~0; 134 133 goto out; 135 134 } 136 135 137 - /* 138 - * Give the AC'97 codec more than enough time 139 - * to respond. (42us = ~2 frames at 48kHz.) 140 - */ 141 - udelay(42); 136 + /* Now wait for the response frame */ 137 + udelay(FRAME_PERIOD_US); 142 138 143 - /* 144 - * Wait for slot 2 to indicate data. 145 - */ 146 - timeout = 5000; 139 + /* And then wait an additional eight frame periods for data */ 140 + timeout = FRAME_PERIOD_US * 8; 147 141 do { 142 + udelay(1); 148 143 cond_resched(); 149 144 v = readl(aaci->base + AACI_SLFR) & (SLFR_1RXV|SLFR_2RXV); 150 145 } while ((v != (SLFR_1RXV|SLFR_2RXV)) && --timeout); 151 146 152 - if (!timeout) { 147 + if (v != (SLFR_1RXV|SLFR_2RXV)) { 153 148 dev_err(&aaci->dev->dev, "timeout on RX valid\n"); 154 149 v = ~0; 155 150 goto out; ··· 182 179 int timeout = 5000; 183 180 184 181 do { 182 + udelay(1); 185 183 val = readl(aacirun->base + AACI_SR); 186 184 } while (val & mask && timeout--); 187 185 } ··· 878 874 * Give the AC'97 codec more than enough time 879 875 * to wake up. (42us = ~2 frames at 48kHz.) 880 876 */ 881 - udelay(42); 877 + udelay(FRAME_PERIOD_US * 2); 882 878 883 879 ret = snd_ac97_bus(aaci->card, 0, &aaci_bus_ops, aaci, &ac97_bus); 884 880 if (ret)
+7 -2
tools/perf/Makefile
··· 204 204 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Winit-self 205 205 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wpacked 206 206 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wredundant-decls 207 - EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstack-protector 208 207 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-aliasing=3 209 208 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-default 210 209 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wswitch-enum 211 210 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wno-system-headers 212 211 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wundef 213 - EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wvolatile-register-var 214 212 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wwrite-strings 215 213 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wbad-function-cast 216 214 EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-declarations ··· 292 294 CFLAGS := $(CFLAGS) -fstack-protector-all 293 295 endif 294 296 297 + ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -Wstack-protector),y) 298 + CFLAGS := $(CFLAGS) -Wstack-protector 299 + endif 300 + 301 + ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -Wvolatile-register-var),y) 302 + CFLAGS := $(CFLAGS) -Wvolatile-register-var 303 + endif 295 304 296 305 ### --- END CONFIGURATION SECTION --- 297 306
+3 -3
tools/perf/builtin-annotate.c
··· 212 212 continue; 213 213 214 214 offset = start + i; 215 - sprintf(cmd, "addr2line -e %s %016llx", filename, offset); 215 + sprintf(cmd, "addr2line -e %s %016" PRIx64, filename, offset); 216 216 fp = popen(cmd, "r"); 217 217 if (!fp) 218 218 continue; ··· 270 270 271 271 for (offset = 0; offset < len; ++offset) 272 272 if (h->ip[offset] != 0) 273 - printf("%*Lx: %Lu\n", BITS_PER_LONG / 2, 273 + printf("%*" PRIx64 ": %" PRIu64 "\n", BITS_PER_LONG / 2, 274 274 sym->start + offset, h->ip[offset]); 275 - printf("%*s: %Lu\n", BITS_PER_LONG / 2, "h->sum", h->sum); 275 + printf("%*s: %" PRIu64 "\n", BITS_PER_LONG / 2, "h->sum", h->sum); 276 276 } 277 277 278 278 static int hist_entry__tty_annotate(struct hist_entry *he)
+2 -2
tools/perf/builtin-kmem.c
··· 371 371 addr = data->ptr; 372 372 373 373 if (sym != NULL) 374 - snprintf(buf, sizeof(buf), "%s+%Lx", sym->name, 374 + snprintf(buf, sizeof(buf), "%s+%" PRIx64 "", sym->name, 375 375 addr - map->unmap_ip(map, sym->start)); 376 376 else 377 - snprintf(buf, sizeof(buf), "%#Lx", addr); 377 + snprintf(buf, sizeof(buf), "%#" PRIx64 "", addr); 378 378 printf(" %-34s |", buf); 379 379 380 380 printf(" %9llu/%-5lu | %9llu/%-5lu | %8lu | %8lu | %6.3f%%\n",
+3 -3
tools/perf/builtin-lock.c
··· 782 782 pr_info("%10u ", st->nr_acquired); 783 783 pr_info("%10u ", st->nr_contended); 784 784 785 - pr_info("%15llu ", st->wait_time_total); 786 - pr_info("%15llu ", st->wait_time_max); 787 - pr_info("%15llu ", st->wait_time_min == ULLONG_MAX ? 785 + pr_info("%15" PRIu64 " ", st->wait_time_total); 786 + pr_info("%15" PRIu64 " ", st->wait_time_max); 787 + pr_info("%15" PRIu64 " ", st->wait_time_min == ULLONG_MAX ? 788 788 0 : st->wait_time_min); 789 789 pr_info("\n"); 790 790 }
+1 -1
tools/perf/builtin-record.c
··· 817 817 * Approximate RIP event size: 24 bytes. 818 818 */ 819 819 fprintf(stderr, 820 - "[ perf record: Captured and wrote %.3f MB %s (~%lld samples) ]\n", 820 + "[ perf record: Captured and wrote %.3f MB %s (~%" PRIu64 " samples) ]\n", 821 821 (double)bytes_written / 1024.0 / 1024.0, 822 822 output_name, 823 823 bytes_written / 24);
+1 -1
tools/perf/builtin-report.c
··· 197 197 event->read.value); 198 198 } 199 199 200 - dump_printf(": %d %d %s %Lu\n", event->read.pid, event->read.tid, 200 + dump_printf(": %d %d %s %" PRIu64 "\n", event->read.pid, event->read.tid, 201 201 attr ? __event_name(attr->type, attr->config) : "FAIL", 202 202 event->read.value); 203 203
+10 -10
tools/perf/builtin-sched.c
··· 193 193 } 194 194 run_measurement_overhead = min_delta; 195 195 196 - printf("run measurement overhead: %Ld nsecs\n", min_delta); 196 + printf("run measurement overhead: %" PRIu64 " nsecs\n", min_delta); 197 197 } 198 198 199 199 static void calibrate_sleep_measurement_overhead(void) ··· 211 211 min_delta -= 10000; 212 212 sleep_measurement_overhead = min_delta; 213 213 214 - printf("sleep measurement overhead: %Ld nsecs\n", min_delta); 214 + printf("sleep measurement overhead: %" PRIu64 " nsecs\n", min_delta); 215 215 } 216 216 217 217 static struct sched_atom * ··· 617 617 burn_nsecs(1e6); 618 618 T1 = get_nsecs(); 619 619 620 - printf("the run test took %Ld nsecs\n", T1-T0); 620 + printf("the run test took %" PRIu64 " nsecs\n", T1 - T0); 621 621 622 622 T0 = get_nsecs(); 623 623 sleep_nsecs(1e6); 624 624 T1 = get_nsecs(); 625 625 626 - printf("the sleep test took %Ld nsecs\n", T1-T0); 626 + printf("the sleep test took %" PRIu64 " nsecs\n", T1 - T0); 627 627 } 628 628 629 629 #define FILL_FIELD(ptr, field, event, data) \ ··· 816 816 delta = 0; 817 817 818 818 if (delta < 0) 819 - die("hm, delta: %Ld < 0 ?\n", delta); 819 + die("hm, delta: %" PRIu64 " < 0 ?\n", delta); 820 820 821 821 if (verbose) { 822 - printf(" ... switch from %s/%d to %s/%d [ran %Ld nsecs]\n", 822 + printf(" ... switch from %s/%d to %s/%d [ran %" PRIu64 " nsecs]\n", 823 823 switch_event->prev_comm, switch_event->prev_pid, 824 824 switch_event->next_comm, switch_event->next_pid, 825 825 delta); ··· 1048 1048 delta = 0; 1049 1049 1050 1050 if (delta < 0) 1051 - die("hm, delta: %Ld < 0 ?\n", delta); 1051 + die("hm, delta: %" PRIu64 " < 0 ?\n", delta); 1052 1052 1053 1053 1054 1054 sched_out = perf_session__findnew(session, switch_event->prev_pid); ··· 1221 1221 1222 1222 avg = work_list->total_lat / work_list->nb_atoms; 1223 1223 1224 - printf("|%11.3f ms |%9llu | avg:%9.3f ms | max:%9.3f ms | max at: %9.6f s\n", 1224 + printf("|%11.3f ms |%9" PRIu64 " | avg:%9.3f ms | max:%9.3f ms | max at: %9.6f s\n", 1225 1225 (double)work_list->total_runtime / 1e6, 1226 1226 work_list->nb_atoms, (double)avg / 1e6, 1227 1227 (double)work_list->max_lat / 1e6, ··· 1423 1423 delta = 0; 1424 1424 1425 1425 if (delta < 0) 1426 - die("hm, delta: %Ld < 0 ?\n", delta); 1426 + die("hm, delta: %" PRIu64 " < 0 ?\n", delta); 1427 1427 1428 1428 1429 1429 sched_out = perf_session__findnew(session, switch_event->prev_pid); ··· 1713 1713 } 1714 1714 1715 1715 printf(" -----------------------------------------------------------------------------------------\n"); 1716 - printf(" TOTAL: |%11.3f ms |%9Ld |\n", 1716 + printf(" TOTAL: |%11.3f ms |%9" PRIu64 " |\n", 1717 1717 (double)all_runtime/1e6, all_count); 1718 1718 1719 1719 printf(" ---------------------------------------------------\n");
+3 -3
tools/perf/builtin-script.c
··· 77 77 if (session->sample_type & PERF_SAMPLE_RAW) { 78 78 if (debug_mode) { 79 79 if (sample->time < last_timestamp) { 80 - pr_err("Samples misordered, previous: %llu " 81 - "this: %llu\n", last_timestamp, 80 + pr_err("Samples misordered, previous: %" PRIu64 81 + " this: %" PRIu64 "\n", last_timestamp, 82 82 sample->time); 83 83 nr_unordered++; 84 84 } ··· 126 126 ret = perf_session__process_events(session, &event_ops); 127 127 128 128 if (debug_mode) 129 - pr_err("Misordered timestamps: %llu\n", nr_unordered); 129 + pr_err("Misordered timestamps: %" PRIu64 "\n", nr_unordered); 130 130 131 131 return ret; 132 132 }
+2 -2
tools/perf/builtin-stat.c
··· 206 206 update_stats(&ps->res_stats[i], count[i]); 207 207 208 208 if (verbose) { 209 - fprintf(stderr, "%s: %Ld %Ld %Ld\n", event_name(counter), 210 - count[0], count[1], count[2]); 209 + fprintf(stderr, "%s: %" PRIu64 " %" PRIu64 " %" PRIu64 "\n", 210 + event_name(counter), count[0], count[1], count[2]); 211 211 } 212 212 213 213 /*
+32 -22
tools/perf/builtin-test.c
··· 146 146 if (llabs(skew) < page_size) 147 147 continue; 148 148 149 - pr_debug("%#Lx: diff end addr for %s v: %#Lx k: %#Lx\n", 149 + pr_debug("%#" PRIx64 ": diff end addr for %s v: %#" PRIx64 " k: %#" PRIx64 "\n", 150 150 sym->start, sym->name, sym->end, pair->end); 151 151 } else { 152 152 struct rb_node *nnd; ··· 168 168 goto detour; 169 169 } 170 170 171 - pr_debug("%#Lx: diff name v: %s k: %s\n", 171 + pr_debug("%#" PRIx64 ": diff name v: %s k: %s\n", 172 172 sym->start, sym->name, pair->name); 173 173 } 174 174 } else 175 - pr_debug("%#Lx: %s not on kallsyms\n", sym->start, sym->name); 175 + pr_debug("%#" PRIx64 ": %s not on kallsyms\n", sym->start, sym->name); 176 176 177 177 err = -1; 178 178 } ··· 211 211 212 212 if (pair->start == pos->start) { 213 213 pair->priv = 1; 214 - pr_info(" %Lx-%Lx %Lx %s in kallsyms as", 214 + pr_info(" %" PRIx64 "-%" PRIx64 " %" PRIx64 " %s in kallsyms as", 215 215 pos->start, pos->end, pos->pgoff, pos->dso->name); 216 216 if (pos->pgoff != pair->pgoff || pos->end != pair->end) 217 - pr_info(": \n*%Lx-%Lx %Lx", 217 + pr_info(": \n*%" PRIx64 "-%" PRIx64 " %" PRIx64 "", 218 218 pair->start, pair->end, pair->pgoff); 219 219 pr_info(" %s\n", pair->dso->name); 220 220 pair->priv = 1; ··· 307 307 } 308 308 309 309 if (evsel->counts->cpu[0].val != nr_open_calls) { 310 - pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls, got %Ld\n", 310 + pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls, got %" PRIu64 "\n", 311 311 nr_open_calls, evsel->counts->cpu[0].val); 312 312 goto out_close_fd; 313 313 } ··· 332 332 struct perf_evsel *evsel; 333 333 struct perf_event_attr attr; 334 334 unsigned int nr_open_calls = 111, i; 335 - cpu_set_t *cpu_set; 336 - size_t cpu_set_size; 335 + cpu_set_t cpu_set; 337 336 int id = trace_event__id("sys_enter_open"); 338 337 339 338 if (id < 0) { ··· 352 353 return -1; 353 354 } 354 355 355 - cpu_set = CPU_ALLOC(cpus->nr); 356 356 357 - if (cpu_set == NULL) 358 - goto out_thread_map_delete; 359 - 360 - cpu_set_size = CPU_ALLOC_SIZE(cpus->nr); 361 - CPU_ZERO_S(cpu_set_size, cpu_set); 357 + CPU_ZERO(&cpu_set); 362 358 363 359 memset(&attr, 0, sizeof(attr)); 364 360 attr.type = PERF_TYPE_TRACEPOINT; ··· 361 367 evsel = perf_evsel__new(&attr, 0); 362 368 if (evsel == NULL) { 363 369 pr_debug("perf_evsel__new\n"); 364 - goto out_cpu_free; 370 + goto out_thread_map_delete; 365 371 } 366 372 367 373 if (perf_evsel__open(evsel, cpus, threads) < 0) { ··· 373 379 374 380 for (cpu = 0; cpu < cpus->nr; ++cpu) { 375 381 unsigned int ncalls = nr_open_calls + cpu; 382 + /* 383 + * XXX eventually lift this restriction in a way that 384 + * keeps perf building on older glibc installations 385 + * without CPU_ALLOC. 1024 cpus in 2010 still seems 386 + * a reasonable upper limit tho :-) 387 + */ 388 + if (cpus->map[cpu] >= CPU_SETSIZE) { 389 + pr_debug("Ignoring CPU %d\n", cpus->map[cpu]); 390 + continue; 391 + } 376 392 377 - CPU_SET(cpu, cpu_set); 378 - sched_setaffinity(0, cpu_set_size, cpu_set); 393 + CPU_SET(cpus->map[cpu], &cpu_set); 394 + if (sched_setaffinity(0, sizeof(cpu_set), &cpu_set) < 0) { 395 + pr_debug("sched_setaffinity() failed on CPU %d: %s ", 396 + cpus->map[cpu], 397 + strerror(errno)); 398 + goto out_close_fd; 399 + } 379 400 for (i = 0; i < ncalls; ++i) { 380 401 fd = open("/etc/passwd", O_RDONLY); 381 402 close(fd); 382 403 } 383 - CPU_CLR(cpu, cpu_set); 404 + CPU_CLR(cpus->map[cpu], &cpu_set); 384 405 } 385 406 386 407 /* ··· 411 402 for (cpu = 0; cpu < cpus->nr; ++cpu) { 412 403 unsigned int expected; 413 404 405 + if (cpus->map[cpu] >= CPU_SETSIZE) 406 + continue; 407 + 414 408 if (perf_evsel__read_on_cpu(evsel, cpu, 0) < 0) { 415 409 pr_debug("perf_evsel__open_read_on_cpu\n"); 416 410 goto out_close_fd; ··· 421 409 422 410 expected = nr_open_calls + cpu; 423 411 if (evsel->counts->cpu[cpu].val != expected) { 424 - pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls on cpu %d, got %Ld\n", 425 - expected, cpu, evsel->counts->cpu[cpu].val); 412 + pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls on cpu %d, got %" PRIu64 "\n", 413 + expected, cpus->map[cpu], evsel->counts->cpu[cpu].val); 426 414 goto out_close_fd; 427 415 } 428 416 } ··· 432 420 perf_evsel__close_fd(evsel, 1, threads->nr); 433 421 out_evsel_delete: 434 422 perf_evsel__delete(evsel); 435 - out_cpu_free: 436 - CPU_FREE(cpu_set); 437 423 out_thread_map_delete: 438 424 thread_map__delete(threads); 439 425 return err;
+5 -4
tools/perf/builtin-top.c
··· 40 40 #include <stdio.h> 41 41 #include <termios.h> 42 42 #include <unistd.h> 43 + #include <inttypes.h> 43 44 44 45 #include <errno.h> 45 46 #include <time.h> ··· 215 214 len = sym->end - sym->start; 216 215 217 216 sprintf(command, 218 - "objdump --start-address=%#0*Lx --stop-address=%#0*Lx -dS %s", 217 + "objdump --start-address=%#0*" PRIx64 " --stop-address=%#0*" PRIx64 " -dS %s", 219 218 BITS_PER_LONG / 4, map__rip_2objdump(map, sym->start), 220 219 BITS_PER_LONG / 4, map__rip_2objdump(map, sym->end), path); 221 220 ··· 309 308 struct source_line *line; 310 309 char pattern[PATTERN_LEN + 1]; 311 310 312 - sprintf(pattern, "%0*Lx <", BITS_PER_LONG / 4, 311 + sprintf(pattern, "%0*" PRIx64 " <", BITS_PER_LONG / 4, 313 312 map__rip_2objdump(syme->map, symbol->start)); 314 313 315 314 pthread_mutex_lock(&syme->src->lock); ··· 538 537 if (nr_counters == 1 || !display_weighted) { 539 538 struct perf_evsel *first; 540 539 first = list_entry(evsel_list.next, struct perf_evsel, node); 541 - printf("%Ld", first->attr.sample_period); 540 + printf("%" PRIu64, (uint64_t)first->attr.sample_period); 542 541 if (freq) 543 542 printf("Hz "); 544 543 else ··· 641 640 642 641 percent_color_fprintf(stdout, "%4.1f%%", pcnt); 643 642 if (verbose) 644 - printf(" %016llx", sym->start); 643 + printf(" %016" PRIx64, sym->start); 645 644 printf(" %-*.*s", sym_width, sym_width, sym->name); 646 645 printf(" %-*.*s\n", dso_width, dso_width, 647 646 dso_width >= syme->map->dso->long_name_len ?
+3 -2
tools/perf/util/event.c
··· 459 459 int event__process_lost(event_t *self, struct sample_data *sample __used, 460 460 struct perf_session *session) 461 461 { 462 - dump_printf(": id:%Ld: lost:%Ld\n", self->lost.id, self->lost.lost); 462 + dump_printf(": id:%" PRIu64 ": lost:%" PRIu64 "\n", 463 + self->lost.id, self->lost.lost); 463 464 session->hists.stats.total_lost += self->lost.lost; 464 465 return 0; 465 466 } ··· 576 575 u8 cpumode = self->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; 577 576 int ret = 0; 578 577 579 - dump_printf(" %d/%d: [%#Lx(%#Lx) @ %#Lx]: %s\n", 578 + dump_printf(" %d/%d: [%#" PRIx64 "(%#" PRIx64 ") @ %#" PRIx64 "]: %s\n", 580 579 self->mmap.pid, self->mmap.tid, self->mmap.start, 581 580 self->mmap.len, self->mmap.pgoff, self->mmap.filename); 582 581
+2 -2
tools/perf/util/header.c
··· 798 798 int feat, int fd) 799 799 { 800 800 if (lseek(fd, self->offset, SEEK_SET) == (off_t)-1) { 801 - pr_debug("Failed to lseek to %Ld offset for feature %d, " 802 - "continuing...\n", self->offset, feat); 801 + pr_debug("Failed to lseek to %" PRIu64 " offset for feature " 802 + "%d, continuing...\n", self->offset, feat); 803 803 return 0; 804 804 } 805 805
+9 -8
tools/perf/util/hist.c
··· 636 636 } 637 637 } 638 638 } else 639 - ret = snprintf(s, size, sep ? "%lld" : "%12lld ", period); 639 + ret = snprintf(s, size, sep ? "%" PRIu64 : "%12" PRIu64 " ", period); 640 640 641 641 if (symbol_conf.show_nr_samples) { 642 642 if (sep) 643 - ret += snprintf(s + ret, size - ret, "%c%lld", *sep, period); 643 + ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, period); 644 644 else 645 - ret += snprintf(s + ret, size - ret, "%11lld", period); 645 + ret += snprintf(s + ret, size - ret, "%11" PRIu64, period); 646 646 } 647 647 648 648 if (pair_hists) { ··· 971 971 sym_size = sym->end - sym->start; 972 972 offset = ip - sym->start; 973 973 974 - pr_debug3("%s: ip=%#Lx\n", __func__, self->ms.map->unmap_ip(self->ms.map, ip)); 974 + pr_debug3("%s: ip=%#" PRIx64 "\n", __func__, self->ms.map->unmap_ip(self->ms.map, ip)); 975 975 976 976 if (offset >= sym_size) 977 977 return 0; ··· 980 980 h->sum++; 981 981 h->ip[offset]++; 982 982 983 - pr_debug3("%#Lx %s: period++ [ip: %#Lx, %#Lx] => %Ld\n", self->ms.sym->start, 984 - self->ms.sym->name, ip, ip - self->ms.sym->start, h->ip[offset]); 983 + pr_debug3("%#" PRIx64 " %s: period++ [ip: %#" PRIx64 ", %#" PRIx64 984 + "] => %" PRIu64 "\n", self->ms.sym->start, self->ms.sym->name, 985 + ip, ip - self->ms.sym->start, h->ip[offset]); 985 986 return 0; 986 987 } 987 988 ··· 1133 1132 goto out_free_filename; 1134 1133 } 1135 1134 1136 - pr_debug("%s: filename=%s, sym=%s, start=%#Lx, end=%#Lx\n", __func__, 1135 + pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 "\n", __func__, 1137 1136 filename, sym->name, map->unmap_ip(map, sym->start), 1138 1137 map->unmap_ip(map, sym->end)); 1139 1138 ··· 1143 1142 dso, dso->long_name, sym, sym->name); 1144 1143 1145 1144 snprintf(command, sizeof(command), 1146 - "objdump --start-address=0x%016Lx --stop-address=0x%016Lx -dS -C %s|grep -v %s|expand", 1145 + "objdump --start-address=0x%016" PRIx64 " --stop-address=0x%016" PRIx64 " -dS -C %s|grep -v %s|expand", 1147 1146 map__rip_2objdump(map, sym->start), 1148 1147 map__rip_2objdump(map, sym->end), 1149 1148 symfs_filename, filename);
+1
tools/perf/util/include/linux/bitops.h
··· 2 2 #define _PERF_LINUX_BITOPS_H_ 3 3 4 4 #include <linux/kernel.h> 5 + #include <linux/compiler.h> 5 6 #include <asm/hweight.h> 6 7 7 8 #define BITS_PER_LONG __WORDSIZE
+2 -1
tools/perf/util/map.c
··· 1 1 #include "symbol.h" 2 2 #include <errno.h> 3 + #include <inttypes.h> 3 4 #include <limits.h> 4 5 #include <stdlib.h> 5 6 #include <string.h> ··· 196 195 197 196 size_t map__fprintf(struct map *self, FILE *fp) 198 197 { 199 - return fprintf(fp, " %Lx-%Lx %Lx %s\n", 198 + return fprintf(fp, " %" PRIx64 "-%" PRIx64 " %" PRIx64 " %s\n", 200 199 self->start, self->end, self->pgoff, self->dso->name); 201 200 } 202 201
+1 -1
tools/perf/util/parse-events.c
··· 279 279 static char buf[32]; 280 280 281 281 if (type == PERF_TYPE_RAW) { 282 - sprintf(buf, "raw 0x%llx", config); 282 + sprintf(buf, "raw 0x%" PRIx64, config); 283 283 return buf; 284 284 } 285 285
+1 -1
tools/perf/util/parse-events.h
··· 23 23 }; 24 24 25 25 extern struct tracepoint_path *tracepoint_id_to_path(u64 config); 26 - extern bool have_tracepoints(struct list_head *evsel_list); 26 + extern bool have_tracepoints(struct list_head *evlist); 27 27 28 28 extern int nr_counters; 29 29
+1 -1
tools/perf/util/probe-event.c
··· 172 172 sym = __find_kernel_function_by_name(tp->symbol, &map); 173 173 if (sym) { 174 174 addr = map->unmap_ip(map, sym->start + tp->offset); 175 - pr_debug("try to find %s+%ld@%llx\n", tp->symbol, 175 + pr_debug("try to find %s+%ld@%" PRIx64 "\n", tp->symbol, 176 176 tp->offset, addr); 177 177 ret = find_perf_probe_point((unsigned long)addr, pp); 178 178 }
+15 -13
tools/perf/util/session.c
··· 652 652 { 653 653 unsigned int i; 654 654 655 - printf("... chain: nr:%Lu\n", sample->callchain->nr); 655 + printf("... chain: nr:%" PRIu64 "\n", sample->callchain->nr); 656 656 657 657 for (i = 0; i < sample->callchain->nr; i++) 658 - printf("..... %2d: %016Lx\n", i, sample->callchain->ips[i]); 658 + printf("..... %2d: %016" PRIx64 "\n", 659 + i, sample->callchain->ips[i]); 659 660 } 660 661 661 662 static void perf_session__print_tstamp(struct perf_session *session, ··· 673 672 printf("%u ", sample->cpu); 674 673 675 674 if (session->sample_type & PERF_SAMPLE_TIME) 676 - printf("%Lu ", sample->time); 675 + printf("%" PRIu64 " ", sample->time); 677 676 } 678 677 679 678 static void dump_event(struct perf_session *session, event_t *event, ··· 682 681 if (!dump_trace) 683 682 return; 684 683 685 - printf("\n%#Lx [%#x]: event: %d\n", file_offset, event->header.size, 686 - event->header.type); 684 + printf("\n%#" PRIx64 " [%#x]: event: %d\n", 685 + file_offset, event->header.size, event->header.type); 687 686 688 687 trace_event(event); 689 688 690 689 if (sample) 691 690 perf_session__print_tstamp(session, event, sample); 692 691 693 - printf("%#Lx [%#x]: PERF_RECORD_%s", file_offset, event->header.size, 694 - event__get_event_name(event->header.type)); 692 + printf("%#" PRIx64 " [%#x]: PERF_RECORD_%s", file_offset, 693 + event->header.size, event__get_event_name(event->header.type)); 695 694 } 696 695 697 696 static void dump_sample(struct perf_session *session, event_t *event, ··· 700 699 if (!dump_trace) 701 700 return; 702 701 703 - printf("(IP, %d): %d/%d: %#Lx period: %Ld\n", event->header.misc, 704 - sample->pid, sample->tid, sample->ip, sample->period); 702 + printf("(IP, %d): %d/%d: %#" PRIx64 " period: %" PRIu64 "\n", 703 + event->header.misc, sample->pid, sample->tid, sample->ip, 704 + sample->period); 705 705 706 706 if (session->sample_type & PERF_SAMPLE_CALLCHAIN) 707 707 callchain__printf(sample); ··· 845 843 { 846 844 if (ops->lost == event__process_lost && 847 845 session->hists.stats.total_lost != 0) { 848 - ui__warning("Processed %Lu events and LOST %Lu!\n\n" 849 - "Check IO/CPU overload!\n\n", 846 + ui__warning("Processed %" PRIu64 " events and LOST %" PRIu64 847 + "!\n\nCheck IO/CPU overload!\n\n", 850 848 session->hists.stats.total_period, 851 849 session->hists.stats.total_lost); 852 850 } ··· 920 918 921 919 if (size == 0 || 922 920 (skip = perf_session__process_event(self, &event, ops, head)) < 0) { 923 - dump_printf("%#Lx [%#x]: skipping unknown header type: %d\n", 921 + dump_printf("%#" PRIx64 " [%#x]: skipping unknown header type: %d\n", 924 922 head, event.header.size, event.header.type); 925 923 /* 926 924 * assume we lost track of the stream, check alignment, and ··· 1025 1023 1026 1024 if (size == 0 || 1027 1025 perf_session__process_event(session, event, ops, file_pos) < 0) { 1028 - dump_printf("%#Lx [%#x]: skipping unknown header type: %d\n", 1026 + dump_printf("%#" PRIx64 " [%#x]: skipping unknown header type: %d\n", 1029 1027 file_offset + head, event->header.size, 1030 1028 event->header.type); 1031 1029 /*
+5 -4
tools/perf/util/svghelper.c
··· 12 12 * of the License. 13 13 */ 14 14 15 + #include <inttypes.h> 15 16 #include <stdio.h> 16 17 #include <stdlib.h> 17 18 #include <unistd.h> ··· 44 43 return cpu2slot(cpu) * SLOT_MULT; 45 44 } 46 45 47 - static double time2pixels(u64 time) 46 + static double time2pixels(u64 __time) 48 47 { 49 48 double X; 50 49 51 - X = 1.0 * svg_page_width * (time - first_time) / (last_time - first_time); 50 + X = 1.0 * svg_page_width * (__time - first_time) / (last_time - first_time); 52 51 return X; 53 52 } 54 53 ··· 95 94 96 95 total_height = (1 + rows + cpu2slot(cpus)) * SLOT_MULT; 97 96 fprintf(svgfile, "<?xml version=\"1.0\" standalone=\"no\"?> \n"); 98 - fprintf(svgfile, "<svg width=\"%i\" height=\"%llu\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n", svg_page_width, total_height); 97 + fprintf(svgfile, "<svg width=\"%i\" height=\"%" PRIu64 "\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n", svg_page_width, total_height); 99 98 100 99 fprintf(svgfile, "<defs>\n <style type=\"text/css\">\n <![CDATA[\n"); 101 100 ··· 484 483 color = 128; 485 484 } 486 485 487 - fprintf(svgfile, "<line x1=\"%4.8f\" y1=\"%4.2f\" x2=\"%4.8f\" y2=\"%llu\" style=\"stroke:rgb(%i,%i,%i);stroke-width:%1.3f\"/>\n", 486 + fprintf(svgfile, "<line x1=\"%4.8f\" y1=\"%4.2f\" x2=\"%4.8f\" y2=\"%" PRIu64 "\" style=\"stroke:rgb(%i,%i,%i);stroke-width:%1.3f\"/>\n", 488 487 time2pixels(i), SLOT_MULT/2, time2pixels(i), total_height, color, color, color, thickness); 489 488 490 489 i += 10000000;
+12 -4
tools/perf/util/symbol.c
··· 11 11 #include <sys/param.h> 12 12 #include <fcntl.h> 13 13 #include <unistd.h> 14 + #include <inttypes.h> 14 15 #include "build-id.h" 15 16 #include "debug.h" 16 17 #include "symbol.h" ··· 154 153 self->binding = binding; 155 154 self->namelen = namelen - 1; 156 155 157 - pr_debug4("%s: %s %#Lx-%#Lx\n", __func__, name, start, self->end); 156 + pr_debug4("%s: %s %#" PRIx64 "-%#" PRIx64 "\n", __func__, name, start, self->end); 158 157 159 158 memcpy(self->name, name, namelen); 160 159 ··· 168 167 169 168 static size_t symbol__fprintf(struct symbol *self, FILE *fp) 170 169 { 171 - return fprintf(fp, " %llx-%llx %c %s\n", 170 + return fprintf(fp, " %" PRIx64 "-%" PRIx64 " %c %s\n", 172 171 self->start, self->end, 173 172 self->binding == STB_GLOBAL ? 'g' : 174 173 self->binding == STB_LOCAL ? 'l' : 'w', ··· 1162 1161 1163 1162 section_name = elf_sec__name(&shdr, secstrs); 1164 1163 1164 + /* On ARM, symbols for thumb functions have 1 added to 1165 + * the symbol address as a flag - remove it */ 1166 + if ((ehdr.e_machine == EM_ARM) && 1167 + (map->type == MAP__FUNCTION) && 1168 + (sym.st_value & 1)) 1169 + --sym.st_value; 1170 + 1165 1171 if (self->kernel != DSO_TYPE_USER || kmodule) { 1166 1172 char dso_name[PATH_MAX]; 1167 1173 ··· 1216 1208 } 1217 1209 1218 1210 if (curr_dso->adjust_symbols) { 1219 - pr_debug4("%s: adjusting symbol: st_value: %#Lx " 1220 - "sh_addr: %#Lx sh_offset: %#Lx\n", __func__, 1211 + pr_debug4("%s: adjusting symbol: st_value: %#" PRIx64 " " 1212 + "sh_addr: %#" PRIx64 " sh_offset: %#" PRIx64 "\n", __func__, 1221 1213 (u64)sym.st_value, (u64)shdr.sh_addr, 1222 1214 (u64)shdr.sh_offset); 1223 1215 sym.st_value -= shdr.sh_addr - shdr.sh_offset;
+6 -4
tools/perf/util/types.h
··· 1 1 #ifndef __PERF_TYPES_H 2 2 #define __PERF_TYPES_H 3 3 4 + #include <stdint.h> 5 + 4 6 /* 5 - * We define u64 as unsigned long long for every architecture 6 - * so that we can print it with %Lx without getting warnings. 7 + * We define u64 as uint64_t for every architecture 8 + * so that we can print it with "%"PRIx64 without getting warnings. 7 9 */ 8 - typedef unsigned long long u64; 9 - typedef signed long long s64; 10 + typedef uint64_t u64; 11 + typedef int64_t s64; 10 12 typedef unsigned int u32; 11 13 typedef signed int s32; 12 14 typedef unsigned short u16;
+1 -1
tools/perf/util/ui/browsers/hists.c
··· 350 350 if (self->ms.sym) 351 351 return self->ms.sym->name; 352 352 353 - snprintf(bf, bfsize, "%#Lx", self->ip); 353 + snprintf(bf, bfsize, "%#" PRIx64, self->ip); 354 354 return bf; 355 355 } 356 356
+3 -2
tools/perf/util/ui/browsers/map.c
··· 1 1 #include "../libslang.h" 2 2 #include <elf.h> 3 + #include <inttypes.h> 3 4 #include <sys/ttydefaults.h> 4 5 #include <ctype.h> 5 6 #include <string.h> ··· 58 57 int width; 59 58 60 59 ui_browser__set_percent_color(self, 0, current_entry); 61 - slsmg_printf("%*llx %*llx %c ", 60 + slsmg_printf("%*" PRIx64 " %*" PRIx64 " %c ", 62 61 mb->addrlen, sym->start, mb->addrlen, sym->end, 63 62 sym->binding == STB_GLOBAL ? 'g' : 64 63 sym->binding == STB_LOCAL ? 'l' : 'w'); ··· 151 150 ++mb.b.nr_entries; 152 151 } 153 152 154 - mb.addrlen = snprintf(tmp, sizeof(tmp), "%llx", maxaddr); 153 + mb.addrlen = snprintf(tmp, sizeof(tmp), "%" PRIx64, maxaddr); 155 154 return map_browser__run(&mb); 156 155 }
+5 -5
tools/perf/util/values.c
··· 150 150 if (width > tidwidth) 151 151 tidwidth = width; 152 152 for (j = 0; j < values->counters; j++) { 153 - width = snprintf(NULL, 0, "%Lu", values->value[i][j]); 153 + width = snprintf(NULL, 0, "%" PRIu64, values->value[i][j]); 154 154 if (width > counterwidth[j]) 155 155 counterwidth[j] = width; 156 156 } ··· 165 165 fprintf(fp, " %*d %*d", pidwidth, values->pid[i], 166 166 tidwidth, values->tid[i]); 167 167 for (j = 0; j < values->counters; j++) 168 - fprintf(fp, " %*Lu", 168 + fprintf(fp, " %*" PRIu64, 169 169 counterwidth[j], values->value[i][j]); 170 170 fprintf(fp, "\n"); 171 171 } ··· 196 196 width = strlen(values->countername[j]); 197 197 if (width > namewidth) 198 198 namewidth = width; 199 - width = snprintf(NULL, 0, "%llx", values->counterrawid[j]); 199 + width = snprintf(NULL, 0, "%" PRIx64, values->counterrawid[j]); 200 200 if (width > rawwidth) 201 201 rawwidth = width; 202 202 } 203 203 for (i = 0; i < values->threads; i++) { 204 204 for (j = 0; j < values->counters; j++) { 205 - width = snprintf(NULL, 0, "%Lu", values->value[i][j]); 205 + width = snprintf(NULL, 0, "%" PRIu64, values->value[i][j]); 206 206 if (width > countwidth) 207 207 countwidth = width; 208 208 } ··· 214 214 countwidth, "Count"); 215 215 for (i = 0; i < values->threads; i++) 216 216 for (j = 0; j < values->counters; j++) 217 - fprintf(fp, " %*d %*d %*s %*llx %*Lu\n", 217 + fprintf(fp, " %*d %*d %*s %*" PRIx64 " %*" PRIu64, 218 218 pidwidth, values->pid[i], 219 219 tidwidth, values->tid[i], 220 220 namewidth, values->countername[j],