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

Merge branch 'for_2.6.40/pm-cleanup' of ssh://master.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm into omap-for-linus

+1651 -1104
+1 -1
Makefile
··· 1 1 VERSION = 2 2 2 PATCHLEVEL = 6 3 3 SUBLEVEL = 39 4 - EXTRAVERSION = -rc7 4 + EXTRAVERSION = 5 5 NAME = Flesh-Eating Bats with Fangs 6 6 7 7 # *DOCUMENTATION*
+5 -1
arch/alpha/include/asm/unistd.h
··· 452 452 #define __NR_fanotify_init 494 453 453 #define __NR_fanotify_mark 495 454 454 #define __NR_prlimit64 496 455 + #define __NR_name_to_handle_at 497 456 + #define __NR_open_by_handle_at 498 457 + #define __NR_clock_adjtime 499 458 + #define __NR_syncfs 500 455 459 456 460 #ifdef __KERNEL__ 457 461 458 - #define NR_SYSCALLS 497 462 + #define NR_SYSCALLS 501 459 463 460 464 #define __ARCH_WANT_IPC_PARSE_VERSION 461 465 #define __ARCH_WANT_OLD_READDIR
+8 -4
arch/alpha/kernel/systbls.S
··· 498 498 .quad sys_ni_syscall /* sys_timerfd */ 499 499 .quad sys_eventfd 500 500 .quad sys_recvmmsg 501 - .quad sys_fallocate /* 480 */ 501 + .quad sys_fallocate /* 480 */ 502 502 .quad sys_timerfd_create 503 503 .quad sys_timerfd_settime 504 504 .quad sys_timerfd_gettime 505 505 .quad sys_signalfd4 506 - .quad sys_eventfd2 /* 485 */ 506 + .quad sys_eventfd2 /* 485 */ 507 507 .quad sys_epoll_create1 508 508 .quad sys_dup3 509 509 .quad sys_pipe2 510 510 .quad sys_inotify_init1 511 - .quad sys_preadv /* 490 */ 511 + .quad sys_preadv /* 490 */ 512 512 .quad sys_pwritev 513 513 .quad sys_rt_tgsigqueueinfo 514 514 .quad sys_perf_event_open 515 515 .quad sys_fanotify_init 516 - .quad sys_fanotify_mark /* 495 */ 516 + .quad sys_fanotify_mark /* 495 */ 517 517 .quad sys_prlimit64 518 + .quad sys_name_to_handle_at 519 + .quad sys_open_by_handle_at 520 + .quad sys_clock_adjtime 521 + .quad sys_syncfs /* 500 */ 518 522 519 523 .size sys_call_table, . - sys_call_table 520 524 .type sys_call_table, @object
+1 -2
arch/alpha/kernel/time.c
··· 375 375 376 376 static inline void register_rpcc_clocksource(long cycle_freq) 377 377 { 378 - clocksource_calc_mult_shift(&clocksource_rpcc, cycle_freq, 4); 379 - clocksource_register(&clocksource_rpcc); 378 + clocksource_register_hz(&clocksource_rpcc, cycle_freq); 380 379 } 381 380 #else /* !CONFIG_SMP */ 382 381 static inline void register_rpcc_clocksource(long cycle_freq)
-19
arch/arm/mach-omap2/board-3430sdp.c
··· 59 59 60 60 #define TWL4030_MSECURE_GPIO 22 61 61 62 - /* FIXME: These values need to be updated based on more profiling on 3430sdp*/ 63 - static struct cpuidle_params omap3_cpuidle_params_table[] = { 64 - /* C1 */ 65 - {1, 2, 2, 5}, 66 - /* C2 */ 67 - {1, 10, 10, 30}, 68 - /* C3 */ 69 - {1, 50, 50, 300}, 70 - /* C4 */ 71 - {1, 1500, 1800, 4000}, 72 - /* C5 */ 73 - {1, 2500, 7500, 12000}, 74 - /* C6 */ 75 - {1, 3000, 8500, 15000}, 76 - /* C7 */ 77 - {1, 10000, 30000, 300000}, 78 - }; 79 - 80 62 static uint32_t board_keymap[] = { 81 63 KEY(0, 0, KEY_LEFT), 82 64 KEY(0, 1, KEY_RIGHT), ··· 782 800 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 783 801 omap_board_config = sdp3430_config; 784 802 omap_board_config_size = ARRAY_SIZE(sdp3430_config); 785 - omap3_pm_init_cpuidle(omap3_cpuidle_params_table); 786 803 omap3430_i2c_init(); 787 804 omap_display_init(&sdp3430_dss_data); 788 805 if (omap_rev() > OMAP3430_REV_ES1_0)
+11 -7
arch/arm/mach-omap2/board-rx51.c
··· 58 58 }, 59 59 }; 60 60 61 + /* 62 + * cpuidle C-states definition override from the default values. 63 + * The 'exit_latency' field is the sum of sleep and wake-up latencies. 64 + */ 61 65 static struct cpuidle_params rx51_cpuidle_params[] = { 62 66 /* C1 */ 63 - {1, 110, 162, 5}, 67 + {110 + 162, 5 , 1}, 64 68 /* C2 */ 65 - {1, 106, 180, 309}, 69 + {106 + 180, 309, 1}, 66 70 /* C3 */ 67 - {0, 107, 410, 46057}, 71 + {107 + 410, 46057, 0}, 68 72 /* C4 */ 69 - {0, 121, 3374, 46057}, 73 + {121 + 3374, 46057, 0}, 70 74 /* C5 */ 71 - {1, 855, 1146, 46057}, 75 + {855 + 1146, 46057, 1}, 72 76 /* C6 */ 73 - {0, 7580, 4134, 484329}, 77 + {7580 + 4134, 484329, 0}, 74 78 /* C7 */ 75 - {1, 7505, 15274, 484329}, 79 + {7505 + 15274, 484329, 1}, 76 80 }; 77 81 78 82 static struct omap_lcd_config rx51_lcd_config = {
+146 -290
arch/arm/mach-omap2/cpuidle34xx.c
··· 36 36 37 37 #ifdef CONFIG_CPU_IDLE 38 38 39 - #define OMAP3_MAX_STATES 7 40 - #define OMAP3_STATE_C1 0 /* C1 - MPU WFI + Core active */ 41 - #define OMAP3_STATE_C2 1 /* C2 - MPU WFI + Core inactive */ 42 - #define OMAP3_STATE_C3 2 /* C3 - MPU CSWR + Core inactive */ 43 - #define OMAP3_STATE_C4 3 /* C4 - MPU OFF + Core iactive */ 44 - #define OMAP3_STATE_C5 4 /* C5 - MPU RET + Core RET */ 45 - #define OMAP3_STATE_C6 5 /* C6 - MPU OFF + Core RET */ 46 - #define OMAP3_STATE_C7 6 /* C7 - MPU OFF + Core OFF */ 47 - 48 - #define OMAP3_STATE_MAX OMAP3_STATE_C7 49 - 50 - #define CPUIDLE_FLAG_CHECK_BM 0x10000 /* use omap3_enter_idle_bm() */ 51 - 52 - struct omap3_processor_cx { 53 - u8 valid; 54 - u8 type; 55 - u32 sleep_latency; 56 - u32 wakeup_latency; 57 - u32 mpu_state; 58 - u32 core_state; 59 - u32 threshold; 60 - u32 flags; 61 - const char *desc; 62 - }; 63 - 64 - struct omap3_processor_cx omap3_power_states[OMAP3_MAX_STATES]; 65 - struct omap3_processor_cx current_cx_state; 66 - struct powerdomain *mpu_pd, *core_pd, *per_pd; 67 - struct powerdomain *cam_pd; 68 - 69 39 /* 70 40 * The latencies/thresholds for various C states have 71 41 * to be configured from the respective board files. ··· 45 75 */ 46 76 static struct cpuidle_params cpuidle_params_table[] = { 47 77 /* C1 */ 48 - {1, 2, 2, 5}, 78 + {2 + 2, 5, 1}, 49 79 /* C2 */ 50 - {1, 10, 10, 30}, 80 + {10 + 10, 30, 1}, 51 81 /* C3 */ 52 - {1, 50, 50, 300}, 82 + {50 + 50, 300, 1}, 53 83 /* C4 */ 54 - {1, 1500, 1800, 4000}, 84 + {1500 + 1800, 4000, 1}, 55 85 /* C5 */ 56 - {1, 2500, 7500, 12000}, 86 + {2500 + 7500, 12000, 1}, 57 87 /* C6 */ 58 - {1, 3000, 8500, 15000}, 88 + {3000 + 8500, 15000, 1}, 59 89 /* C7 */ 60 - {1, 10000, 30000, 300000}, 90 + {10000 + 30000, 300000, 1}, 61 91 }; 92 + #define OMAP3_NUM_STATES ARRAY_SIZE(cpuidle_params_table) 62 93 63 - static int omap3_idle_bm_check(void) 64 - { 65 - if (!omap3_can_sleep()) 66 - return 1; 67 - return 0; 68 - } 94 + /* Mach specific information to be recorded in the C-state driver_data */ 95 + struct omap3_idle_statedata { 96 + u32 mpu_state; 97 + u32 core_state; 98 + u8 valid; 99 + }; 100 + struct omap3_idle_statedata omap3_idle_data[OMAP3_NUM_STATES]; 101 + 102 + struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd; 69 103 70 104 static int _cpuidle_allow_idle(struct powerdomain *pwrdm, 71 105 struct clockdomain *clkdm) ··· 96 122 static int omap3_enter_idle(struct cpuidle_device *dev, 97 123 struct cpuidle_state *state) 98 124 { 99 - struct omap3_processor_cx *cx = cpuidle_get_statedata(state); 125 + struct omap3_idle_statedata *cx = cpuidle_get_statedata(state); 100 126 struct timespec ts_preidle, ts_postidle, ts_idle; 101 127 u32 mpu_state = cx->mpu_state, core_state = cx->core_state; 102 - 103 - current_cx_state = *cx; 104 128 105 129 /* Used to keep track of the total time in idle */ 106 130 getnstimeofday(&ts_preidle); ··· 112 140 if (omap_irq_pending() || need_resched()) 113 141 goto return_sleep_time; 114 142 115 - if (cx->type == OMAP3_STATE_C1) { 143 + /* Deny idle for C1 */ 144 + if (state == &dev->states[0]) { 116 145 pwrdm_for_each_clkdm(mpu_pd, _cpuidle_deny_idle); 117 146 pwrdm_for_each_clkdm(core_pd, _cpuidle_deny_idle); 118 147 } ··· 121 148 /* Execute ARM wfi */ 122 149 omap_sram_idle(); 123 150 124 - if (cx->type == OMAP3_STATE_C1) { 151 + /* Re-allow idle for C1 */ 152 + if (state == &dev->states[0]) { 125 153 pwrdm_for_each_clkdm(mpu_pd, _cpuidle_allow_idle); 126 154 pwrdm_for_each_clkdm(core_pd, _cpuidle_allow_idle); 127 155 } ··· 138 164 } 139 165 140 166 /** 141 - * next_valid_state - Find next valid c-state 167 + * next_valid_state - Find next valid C-state 142 168 * @dev: cpuidle device 143 - * @state: Currently selected c-state 169 + * @state: Currently selected C-state 144 170 * 145 171 * If the current state is valid, it is returned back to the caller. 146 172 * Else, this function searches for a lower c-state which is still 147 - * valid (as defined in omap3_power_states[]). 173 + * valid. 174 + * 175 + * A state is valid if the 'valid' field is enabled and 176 + * if it satisfies the enable_off_mode condition. 148 177 */ 149 178 static struct cpuidle_state *next_valid_state(struct cpuidle_device *dev, 150 - struct cpuidle_state *curr) 179 + struct cpuidle_state *curr) 151 180 { 152 181 struct cpuidle_state *next = NULL; 153 - struct omap3_processor_cx *cx; 182 + struct omap3_idle_statedata *cx = cpuidle_get_statedata(curr); 183 + u32 mpu_deepest_state = PWRDM_POWER_RET; 184 + u32 core_deepest_state = PWRDM_POWER_RET; 154 185 155 - cx = (struct omap3_processor_cx *)cpuidle_get_statedata(curr); 186 + if (enable_off_mode) { 187 + mpu_deepest_state = PWRDM_POWER_OFF; 188 + /* 189 + * Erratum i583: valable for ES rev < Es1.2 on 3630. 190 + * CORE OFF mode is not supported in a stable form, restrict 191 + * instead the CORE state to RET. 192 + */ 193 + if (!IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583)) 194 + core_deepest_state = PWRDM_POWER_OFF; 195 + } 156 196 157 197 /* Check if current state is valid */ 158 - if (cx->valid) { 198 + if ((cx->valid) && 199 + (cx->mpu_state >= mpu_deepest_state) && 200 + (cx->core_state >= core_deepest_state)) { 159 201 return curr; 160 202 } else { 161 - u8 idx = OMAP3_STATE_MAX; 203 + int idx = OMAP3_NUM_STATES - 1; 162 204 163 - /* 164 - * Reach the current state starting at highest C-state 165 - */ 166 - for (; idx >= OMAP3_STATE_C1; idx--) { 205 + /* Reach the current state starting at highest C-state */ 206 + for (; idx >= 0; idx--) { 167 207 if (&dev->states[idx] == curr) { 168 208 next = &dev->states[idx]; 169 209 break; 170 210 } 171 211 } 172 212 173 - /* 174 - * Should never hit this condition. 175 - */ 213 + /* Should never hit this condition */ 176 214 WARN_ON(next == NULL); 177 215 178 216 /* ··· 192 206 * Start search from the next (lower) state. 193 207 */ 194 208 idx--; 195 - for (; idx >= OMAP3_STATE_C1; idx--) { 196 - struct omap3_processor_cx *cx; 197 - 209 + for (; idx >= 0; idx--) { 198 210 cx = cpuidle_get_statedata(&dev->states[idx]); 199 - if (cx->valid) { 211 + if ((cx->valid) && 212 + (cx->mpu_state >= mpu_deepest_state) && 213 + (cx->core_state >= core_deepest_state)) { 200 214 next = &dev->states[idx]; 201 215 break; 202 216 } 203 217 } 204 218 /* 205 - * C1 and C2 are always valid. 219 + * C1 is always valid. 206 220 * So, no need to check for 'next==NULL' outside this loop. 207 221 */ 208 222 } ··· 215 229 * @dev: cpuidle device 216 230 * @state: The target state to be programmed 217 231 * 218 - * Used for C states with CPUIDLE_FLAG_CHECK_BM flag set. This 219 - * function checks for any pending activity and then programs the 220 - * device to the specified or a safer state. 232 + * This function checks for any pending activity and then programs 233 + * the device to the specified or a safer state. 221 234 */ 222 235 static int omap3_enter_idle_bm(struct cpuidle_device *dev, 223 236 struct cpuidle_state *state) 224 237 { 225 - struct cpuidle_state *new_state = next_valid_state(dev, state); 226 - u32 core_next_state, per_next_state = 0, per_saved_state = 0; 227 - u32 cam_state; 228 - struct omap3_processor_cx *cx; 238 + struct cpuidle_state *new_state; 239 + u32 core_next_state, per_next_state = 0, per_saved_state = 0, cam_state; 240 + struct omap3_idle_statedata *cx; 229 241 int ret; 230 242 231 - if ((state->flags & CPUIDLE_FLAG_CHECK_BM) && omap3_idle_bm_check()) { 232 - BUG_ON(!dev->safe_state); 243 + if (!omap3_can_sleep()) { 233 244 new_state = dev->safe_state; 234 245 goto select_state; 235 246 } 236 - 237 - cx = cpuidle_get_statedata(state); 238 - core_next_state = cx->core_state; 239 - 240 - /* 241 - * FIXME: we currently manage device-specific idle states 242 - * for PER and CORE in combination with CPU-specific 243 - * idle states. This is wrong, and device-specific 244 - * idle management needs to be separated out into 245 - * its own code. 246 - */ 247 247 248 248 /* 249 249 * Prevent idle completely if CAM is active. ··· 242 270 } 243 271 244 272 /* 273 + * FIXME: we currently manage device-specific idle states 274 + * for PER and CORE in combination with CPU-specific 275 + * idle states. This is wrong, and device-specific 276 + * idle management needs to be separated out into 277 + * its own code. 278 + */ 279 + 280 + /* 245 281 * Prevent PER off if CORE is not in retention or off as this 246 282 * would disable PER wakeups completely. 247 283 */ 284 + cx = cpuidle_get_statedata(state); 285 + core_next_state = cx->core_state; 248 286 per_next_state = per_saved_state = pwrdm_read_next_pwrst(per_pd); 249 287 if ((per_next_state == PWRDM_POWER_OFF) && 250 288 (core_next_state > PWRDM_POWER_RET)) ··· 263 281 /* Are we changing PER target state? */ 264 282 if (per_next_state != per_saved_state) 265 283 pwrdm_set_next_pwrst(per_pd, per_next_state); 284 + 285 + new_state = next_valid_state(dev, state); 266 286 267 287 select_state: 268 288 dev->last_state = new_state; ··· 279 295 280 296 DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev); 281 297 282 - /** 283 - * omap3_cpuidle_update_states() - Update the cpuidle states 284 - * @mpu_deepest_state: Enable states up to and including this for mpu domain 285 - * @core_deepest_state: Enable states up to and including this for core domain 286 - * 287 - * This goes through the list of states available and enables and disables the 288 - * validity of C states based on deepest state that can be achieved for the 289 - * variable domain 290 - */ 291 - void omap3_cpuidle_update_states(u32 mpu_deepest_state, u32 core_deepest_state) 292 - { 293 - int i; 294 - 295 - for (i = OMAP3_STATE_C1; i < OMAP3_MAX_STATES; i++) { 296 - struct omap3_processor_cx *cx = &omap3_power_states[i]; 297 - 298 - if ((cx->mpu_state >= mpu_deepest_state) && 299 - (cx->core_state >= core_deepest_state)) { 300 - cx->valid = 1; 301 - } else { 302 - cx->valid = 0; 303 - } 304 - } 305 - } 306 - 307 298 void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params) 308 299 { 309 300 int i; ··· 286 327 if (!cpuidle_board_params) 287 328 return; 288 329 289 - for (i = OMAP3_STATE_C1; i < OMAP3_MAX_STATES; i++) { 290 - cpuidle_params_table[i].valid = 291 - cpuidle_board_params[i].valid; 292 - cpuidle_params_table[i].sleep_latency = 293 - cpuidle_board_params[i].sleep_latency; 294 - cpuidle_params_table[i].wake_latency = 295 - cpuidle_board_params[i].wake_latency; 296 - cpuidle_params_table[i].threshold = 297 - cpuidle_board_params[i].threshold; 330 + for (i = 0; i < OMAP3_NUM_STATES; i++) { 331 + cpuidle_params_table[i].valid = cpuidle_board_params[i].valid; 332 + cpuidle_params_table[i].exit_latency = 333 + cpuidle_board_params[i].exit_latency; 334 + cpuidle_params_table[i].target_residency = 335 + cpuidle_board_params[i].target_residency; 298 336 } 299 337 return; 300 - } 301 - 302 - /* omap3_init_power_states - Initialises the OMAP3 specific C states. 303 - * 304 - * Below is the desciption of each C state. 305 - * C1 . MPU WFI + Core active 306 - * C2 . MPU WFI + Core inactive 307 - * C3 . MPU CSWR + Core inactive 308 - * C4 . MPU OFF + Core inactive 309 - * C5 . MPU CSWR + Core CSWR 310 - * C6 . MPU OFF + Core CSWR 311 - * C7 . MPU OFF + Core OFF 312 - */ 313 - void omap_init_power_states(void) 314 - { 315 - /* C1 . MPU WFI + Core active */ 316 - omap3_power_states[OMAP3_STATE_C1].valid = 317 - cpuidle_params_table[OMAP3_STATE_C1].valid; 318 - omap3_power_states[OMAP3_STATE_C1].type = OMAP3_STATE_C1; 319 - omap3_power_states[OMAP3_STATE_C1].sleep_latency = 320 - cpuidle_params_table[OMAP3_STATE_C1].sleep_latency; 321 - omap3_power_states[OMAP3_STATE_C1].wakeup_latency = 322 - cpuidle_params_table[OMAP3_STATE_C1].wake_latency; 323 - omap3_power_states[OMAP3_STATE_C1].threshold = 324 - cpuidle_params_table[OMAP3_STATE_C1].threshold; 325 - omap3_power_states[OMAP3_STATE_C1].mpu_state = PWRDM_POWER_ON; 326 - omap3_power_states[OMAP3_STATE_C1].core_state = PWRDM_POWER_ON; 327 - omap3_power_states[OMAP3_STATE_C1].flags = CPUIDLE_FLAG_TIME_VALID; 328 - omap3_power_states[OMAP3_STATE_C1].desc = "MPU ON + CORE ON"; 329 - 330 - /* C2 . MPU WFI + Core inactive */ 331 - omap3_power_states[OMAP3_STATE_C2].valid = 332 - cpuidle_params_table[OMAP3_STATE_C2].valid; 333 - omap3_power_states[OMAP3_STATE_C2].type = OMAP3_STATE_C2; 334 - omap3_power_states[OMAP3_STATE_C2].sleep_latency = 335 - cpuidle_params_table[OMAP3_STATE_C2].sleep_latency; 336 - omap3_power_states[OMAP3_STATE_C2].wakeup_latency = 337 - cpuidle_params_table[OMAP3_STATE_C2].wake_latency; 338 - omap3_power_states[OMAP3_STATE_C2].threshold = 339 - cpuidle_params_table[OMAP3_STATE_C2].threshold; 340 - omap3_power_states[OMAP3_STATE_C2].mpu_state = PWRDM_POWER_ON; 341 - omap3_power_states[OMAP3_STATE_C2].core_state = PWRDM_POWER_ON; 342 - omap3_power_states[OMAP3_STATE_C2].flags = CPUIDLE_FLAG_TIME_VALID | 343 - CPUIDLE_FLAG_CHECK_BM; 344 - omap3_power_states[OMAP3_STATE_C2].desc = "MPU ON + CORE ON"; 345 - 346 - /* C3 . MPU CSWR + Core inactive */ 347 - omap3_power_states[OMAP3_STATE_C3].valid = 348 - cpuidle_params_table[OMAP3_STATE_C3].valid; 349 - omap3_power_states[OMAP3_STATE_C3].type = OMAP3_STATE_C3; 350 - omap3_power_states[OMAP3_STATE_C3].sleep_latency = 351 - cpuidle_params_table[OMAP3_STATE_C3].sleep_latency; 352 - omap3_power_states[OMAP3_STATE_C3].wakeup_latency = 353 - cpuidle_params_table[OMAP3_STATE_C3].wake_latency; 354 - omap3_power_states[OMAP3_STATE_C3].threshold = 355 - cpuidle_params_table[OMAP3_STATE_C3].threshold; 356 - omap3_power_states[OMAP3_STATE_C3].mpu_state = PWRDM_POWER_RET; 357 - omap3_power_states[OMAP3_STATE_C3].core_state = PWRDM_POWER_ON; 358 - omap3_power_states[OMAP3_STATE_C3].flags = CPUIDLE_FLAG_TIME_VALID | 359 - CPUIDLE_FLAG_CHECK_BM; 360 - omap3_power_states[OMAP3_STATE_C3].desc = "MPU RET + CORE ON"; 361 - 362 - /* C4 . MPU OFF + Core inactive */ 363 - omap3_power_states[OMAP3_STATE_C4].valid = 364 - cpuidle_params_table[OMAP3_STATE_C4].valid; 365 - omap3_power_states[OMAP3_STATE_C4].type = OMAP3_STATE_C4; 366 - omap3_power_states[OMAP3_STATE_C4].sleep_latency = 367 - cpuidle_params_table[OMAP3_STATE_C4].sleep_latency; 368 - omap3_power_states[OMAP3_STATE_C4].wakeup_latency = 369 - cpuidle_params_table[OMAP3_STATE_C4].wake_latency; 370 - omap3_power_states[OMAP3_STATE_C4].threshold = 371 - cpuidle_params_table[OMAP3_STATE_C4].threshold; 372 - omap3_power_states[OMAP3_STATE_C4].mpu_state = PWRDM_POWER_OFF; 373 - omap3_power_states[OMAP3_STATE_C4].core_state = PWRDM_POWER_ON; 374 - omap3_power_states[OMAP3_STATE_C4].flags = CPUIDLE_FLAG_TIME_VALID | 375 - CPUIDLE_FLAG_CHECK_BM; 376 - omap3_power_states[OMAP3_STATE_C4].desc = "MPU OFF + CORE ON"; 377 - 378 - /* C5 . MPU CSWR + Core CSWR*/ 379 - omap3_power_states[OMAP3_STATE_C5].valid = 380 - cpuidle_params_table[OMAP3_STATE_C5].valid; 381 - omap3_power_states[OMAP3_STATE_C5].type = OMAP3_STATE_C5; 382 - omap3_power_states[OMAP3_STATE_C5].sleep_latency = 383 - cpuidle_params_table[OMAP3_STATE_C5].sleep_latency; 384 - omap3_power_states[OMAP3_STATE_C5].wakeup_latency = 385 - cpuidle_params_table[OMAP3_STATE_C5].wake_latency; 386 - omap3_power_states[OMAP3_STATE_C5].threshold = 387 - cpuidle_params_table[OMAP3_STATE_C5].threshold; 388 - omap3_power_states[OMAP3_STATE_C5].mpu_state = PWRDM_POWER_RET; 389 - omap3_power_states[OMAP3_STATE_C5].core_state = PWRDM_POWER_RET; 390 - omap3_power_states[OMAP3_STATE_C5].flags = CPUIDLE_FLAG_TIME_VALID | 391 - CPUIDLE_FLAG_CHECK_BM; 392 - omap3_power_states[OMAP3_STATE_C5].desc = "MPU RET + CORE RET"; 393 - 394 - /* C6 . MPU OFF + Core CSWR */ 395 - omap3_power_states[OMAP3_STATE_C6].valid = 396 - cpuidle_params_table[OMAP3_STATE_C6].valid; 397 - omap3_power_states[OMAP3_STATE_C6].type = OMAP3_STATE_C6; 398 - omap3_power_states[OMAP3_STATE_C6].sleep_latency = 399 - cpuidle_params_table[OMAP3_STATE_C6].sleep_latency; 400 - omap3_power_states[OMAP3_STATE_C6].wakeup_latency = 401 - cpuidle_params_table[OMAP3_STATE_C6].wake_latency; 402 - omap3_power_states[OMAP3_STATE_C6].threshold = 403 - cpuidle_params_table[OMAP3_STATE_C6].threshold; 404 - omap3_power_states[OMAP3_STATE_C6].mpu_state = PWRDM_POWER_OFF; 405 - omap3_power_states[OMAP3_STATE_C6].core_state = PWRDM_POWER_RET; 406 - omap3_power_states[OMAP3_STATE_C6].flags = CPUIDLE_FLAG_TIME_VALID | 407 - CPUIDLE_FLAG_CHECK_BM; 408 - omap3_power_states[OMAP3_STATE_C6].desc = "MPU OFF + CORE RET"; 409 - 410 - /* C7 . MPU OFF + Core OFF */ 411 - omap3_power_states[OMAP3_STATE_C7].valid = 412 - cpuidle_params_table[OMAP3_STATE_C7].valid; 413 - omap3_power_states[OMAP3_STATE_C7].type = OMAP3_STATE_C7; 414 - omap3_power_states[OMAP3_STATE_C7].sleep_latency = 415 - cpuidle_params_table[OMAP3_STATE_C7].sleep_latency; 416 - omap3_power_states[OMAP3_STATE_C7].wakeup_latency = 417 - cpuidle_params_table[OMAP3_STATE_C7].wake_latency; 418 - omap3_power_states[OMAP3_STATE_C7].threshold = 419 - cpuidle_params_table[OMAP3_STATE_C7].threshold; 420 - omap3_power_states[OMAP3_STATE_C7].mpu_state = PWRDM_POWER_OFF; 421 - omap3_power_states[OMAP3_STATE_C7].core_state = PWRDM_POWER_OFF; 422 - omap3_power_states[OMAP3_STATE_C7].flags = CPUIDLE_FLAG_TIME_VALID | 423 - CPUIDLE_FLAG_CHECK_BM; 424 - omap3_power_states[OMAP3_STATE_C7].desc = "MPU OFF + CORE OFF"; 425 - 426 - /* 427 - * Erratum i583: implementation for ES rev < Es1.2 on 3630. We cannot 428 - * enable OFF mode in a stable form for previous revisions. 429 - * we disable C7 state as a result. 430 - */ 431 - if (IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583)) { 432 - omap3_power_states[OMAP3_STATE_C7].valid = 0; 433 - cpuidle_params_table[OMAP3_STATE_C7].valid = 0; 434 - pr_warn("%s: core off state C7 disabled due to i583\n", 435 - __func__); 436 - } 437 338 } 438 339 439 340 struct cpuidle_driver omap3_idle_driver = { ··· 301 482 .owner = THIS_MODULE, 302 483 }; 303 484 485 + /* Helper to fill the C-state common data and register the driver_data */ 486 + static inline struct omap3_idle_statedata *_fill_cstate( 487 + struct cpuidle_device *dev, 488 + int idx, const char *descr) 489 + { 490 + struct omap3_idle_statedata *cx = &omap3_idle_data[idx]; 491 + struct cpuidle_state *state = &dev->states[idx]; 492 + 493 + state->exit_latency = cpuidle_params_table[idx].exit_latency; 494 + state->target_residency = cpuidle_params_table[idx].target_residency; 495 + state->flags = CPUIDLE_FLAG_TIME_VALID; 496 + state->enter = omap3_enter_idle_bm; 497 + cx->valid = cpuidle_params_table[idx].valid; 498 + sprintf(state->name, "C%d", idx + 1); 499 + strncpy(state->desc, descr, CPUIDLE_DESC_LEN); 500 + cpuidle_set_statedata(state, cx); 501 + 502 + return cx; 503 + } 504 + 304 505 /** 305 506 * omap3_idle_init - Init routine for OMAP3 idle 306 507 * 307 - * Registers the OMAP3 specific cpuidle driver with the cpuidle 508 + * Registers the OMAP3 specific cpuidle driver to the cpuidle 308 509 * framework with the valid set of states. 309 510 */ 310 511 int __init omap3_idle_init(void) 311 512 { 312 - int i, count = 0; 313 - struct omap3_processor_cx *cx; 314 - struct cpuidle_state *state; 315 513 struct cpuidle_device *dev; 514 + struct omap3_idle_statedata *cx; 316 515 317 516 mpu_pd = pwrdm_lookup("mpu_pwrdm"); 318 517 core_pd = pwrdm_lookup("core_pwrdm"); 319 518 per_pd = pwrdm_lookup("per_pwrdm"); 320 519 cam_pd = pwrdm_lookup("cam_pwrdm"); 321 520 322 - omap_init_power_states(); 323 521 cpuidle_register_driver(&omap3_idle_driver); 324 - 325 522 dev = &per_cpu(omap3_idle_dev, smp_processor_id()); 326 523 327 - for (i = OMAP3_STATE_C1; i < OMAP3_MAX_STATES; i++) { 328 - cx = &omap3_power_states[i]; 329 - state = &dev->states[count]; 524 + /* C1 . MPU WFI + Core active */ 525 + cx = _fill_cstate(dev, 0, "MPU ON + CORE ON"); 526 + (&dev->states[0])->enter = omap3_enter_idle; 527 + dev->safe_state = &dev->states[0]; 528 + cx->valid = 1; /* C1 is always valid */ 529 + cx->mpu_state = PWRDM_POWER_ON; 530 + cx->core_state = PWRDM_POWER_ON; 330 531 331 - if (!cx->valid) 332 - continue; 333 - cpuidle_set_statedata(state, cx); 334 - state->exit_latency = cx->sleep_latency + cx->wakeup_latency; 335 - state->target_residency = cx->threshold; 336 - state->flags = cx->flags; 337 - state->enter = (state->flags & CPUIDLE_FLAG_CHECK_BM) ? 338 - omap3_enter_idle_bm : omap3_enter_idle; 339 - if (cx->type == OMAP3_STATE_C1) 340 - dev->safe_state = state; 341 - sprintf(state->name, "C%d", count+1); 342 - strncpy(state->desc, cx->desc, CPUIDLE_DESC_LEN); 343 - count++; 532 + /* C2 . MPU WFI + Core inactive */ 533 + cx = _fill_cstate(dev, 1, "MPU ON + CORE ON"); 534 + cx->mpu_state = PWRDM_POWER_ON; 535 + cx->core_state = PWRDM_POWER_ON; 536 + 537 + /* C3 . MPU CSWR + Core inactive */ 538 + cx = _fill_cstate(dev, 2, "MPU RET + CORE ON"); 539 + cx->mpu_state = PWRDM_POWER_RET; 540 + cx->core_state = PWRDM_POWER_ON; 541 + 542 + /* C4 . MPU OFF + Core inactive */ 543 + cx = _fill_cstate(dev, 3, "MPU OFF + CORE ON"); 544 + cx->mpu_state = PWRDM_POWER_OFF; 545 + cx->core_state = PWRDM_POWER_ON; 546 + 547 + /* C5 . MPU RET + Core RET */ 548 + cx = _fill_cstate(dev, 4, "MPU RET + CORE RET"); 549 + cx->mpu_state = PWRDM_POWER_RET; 550 + cx->core_state = PWRDM_POWER_RET; 551 + 552 + /* C6 . MPU OFF + Core RET */ 553 + cx = _fill_cstate(dev, 5, "MPU OFF + CORE RET"); 554 + cx->mpu_state = PWRDM_POWER_OFF; 555 + cx->core_state = PWRDM_POWER_RET; 556 + 557 + /* C7 . MPU OFF + Core OFF */ 558 + cx = _fill_cstate(dev, 6, "MPU OFF + CORE OFF"); 559 + /* 560 + * Erratum i583: implementation for ES rev < Es1.2 on 3630. We cannot 561 + * enable OFF mode in a stable form for previous revisions. 562 + * We disable C7 state as a result. 563 + */ 564 + if (IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583)) { 565 + cx->valid = 0; 566 + pr_warn("%s: core off state C7 disabled due to i583\n", 567 + __func__); 344 568 } 569 + cx->mpu_state = PWRDM_POWER_OFF; 570 + cx->core_state = PWRDM_POWER_OFF; 345 571 346 - if (!count) 347 - return -EINVAL; 348 - dev->state_count = count; 349 - 350 - if (enable_off_mode) 351 - omap3_cpuidle_update_states(PWRDM_POWER_OFF, PWRDM_POWER_OFF); 352 - else 353 - omap3_cpuidle_update_states(PWRDM_POWER_RET, PWRDM_POWER_RET); 354 - 572 + dev->state_count = OMAP3_NUM_STATES; 355 573 if (cpuidle_register_device(dev)) { 356 574 printk(KERN_ERR "%s: CPUidle register device failed\n", 357 575 __func__);
+9 -8
arch/arm/mach-omap2/pm.h
··· 36 36 } 37 37 #endif 38 38 39 + /* 40 + * cpuidle mach specific parameters 41 + * 42 + * The board code can override the default C-states definition using 43 + * omap3_pm_init_cpuidle 44 + */ 39 45 struct cpuidle_params { 40 - u8 valid; 41 - u32 sleep_latency; 42 - u32 wake_latency; 43 - u32 threshold; 46 + u32 exit_latency; /* exit_latency = sleep + wake-up latencies */ 47 + u32 target_residency; 48 + u8 valid; /* validates the C-state */ 44 49 }; 45 50 46 51 #if defined(CONFIG_PM) && defined(CONFIG_CPU_IDLE) ··· 76 71 #define omap2_pm_debug 0 77 72 #define enable_off_mode 0 78 73 #define sleep_while_idle 0 79 - #endif 80 - 81 - #if defined(CONFIG_CPU_IDLE) 82 - extern void omap3_cpuidle_update_states(u32, u32); 83 74 #endif 84 75 85 76 #if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
-14
arch/arm/mach-omap2/pm34xx.c
··· 779 779 else 780 780 state = PWRDM_POWER_RET; 781 781 782 - #ifdef CONFIG_CPU_IDLE 783 - /* 784 - * Erratum i583: implementation for ES rev < Es1.2 on 3630. We cannot 785 - * enable OFF mode in a stable form for previous revisions, restrict 786 - * instead to RET 787 - */ 788 - if (IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583)) 789 - omap3_cpuidle_update_states(state, PWRDM_POWER_RET); 790 - else 791 - omap3_cpuidle_update_states(state, state); 792 - #endif 793 - 794 782 list_for_each_entry(pwrst, &pwrst_list, node) { 795 783 if (IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583) && 796 784 pwrst->pwrdm == core_pwrdm && ··· 882 894 return -ENODEV; 883 895 884 896 pm_errata_configure(); 885 - 886 - printk(KERN_ERR "Power Management for TI OMAP3.\n"); 887 897 888 898 /* XXX prcm_setup_regs needs to be before enabling hw 889 899 * supervised mode for powerdomains */
+1 -3
arch/mips/ar7/gpio.c
··· 325 325 size = 0x1f; 326 326 } 327 327 328 - gpch->regs = ioremap_nocache(AR7_REGS_GPIO, 329 - AR7_REGS_GPIO + 0x10); 330 - 328 + gpch->regs = ioremap_nocache(AR7_REGS_GPIO, size); 331 329 if (!gpch->regs) { 332 330 printk(KERN_ERR "%s: failed to ioremap regs\n", 333 331 gpch->chip.label);
+2
arch/mips/include/asm/dma-mapping.h
··· 5 5 #include <asm/cache.h> 6 6 #include <asm-generic/dma-coherent.h> 7 7 8 + #ifndef CONFIG_SGI_IP27 /* Kludge to fix 2.6.39 build for IP27 */ 8 9 #include <dma-coherence.h> 10 + #endif 9 11 10 12 extern struct dma_map_ops *mips_dma_map_ops; 11 13
+2 -4
arch/mips/kernel/traps.c
··· 374 374 unsigned long dvpret = dvpe(); 375 375 #endif /* CONFIG_MIPS_MT_SMTC */ 376 376 377 - notify_die(DIE_OOPS, str, regs, 0, regs_to_trapnr(regs), SIGSEGV); 377 + if (notify_die(DIE_OOPS, str, regs, 0, regs_to_trapnr(regs), SIGSEGV) == NOTIFY_STOP) 378 + sig = 0; 378 379 379 380 console_verbose(); 380 381 spin_lock_irq(&die_lock); ··· 383 382 #ifdef CONFIG_MIPS_MT_SMTC 384 383 mips_mt_regdump(dvpret); 385 384 #endif /* CONFIG_MIPS_MT_SMTC */ 386 - 387 - if (notify_die(DIE_OOPS, str, regs, 0, regs_to_trapnr(regs), SIGSEGV) == NOTIFY_STOP) 388 - sig = 0; 389 385 390 386 printk("%s[#%d]:\n", str, ++die_counter); 391 387 show_registers(regs);
+1 -1
arch/mips/rb532/gpio.c
··· 185 185 struct resource *r; 186 186 187 187 r = rb532_gpio_reg0_res; 188 - rb532_gpio_chip->regbase = ioremap_nocache(r->start, r->end - r->start); 188 + rb532_gpio_chip->regbase = ioremap_nocache(r->start, resource_size(r)); 189 189 190 190 if (!rb532_gpio_chip->regbase) { 191 191 printk(KERN_ERR "rb532: cannot remap GPIO register 0\n");
+5 -2
arch/powerpc/platforms/83xx/suspend.c
··· 318 318 .end = mpc83xx_suspend_end, 319 319 }; 320 320 321 + static struct of_device_id pmc_match[]; 321 322 static int pmc_probe(struct platform_device *ofdev) 322 323 { 324 + const struct of_device_id *match; 323 325 struct device_node *np = ofdev->dev.of_node; 324 326 struct resource res; 325 327 struct pmc_type *type; 326 328 int ret = 0; 327 329 328 - if (!ofdev->dev.of_match) 330 + match = of_match_device(pmc_match, &ofdev->dev); 331 + if (!match) 329 332 return -EINVAL; 330 333 331 - type = ofdev->dev.of_match->data; 334 + type = match->data; 332 335 333 336 if (!of_device_is_available(np)) 334 337 return -ENODEV;
+5 -2
arch/powerpc/sysdev/fsl_msi.c
··· 304 304 return 0; 305 305 } 306 306 307 + static const struct of_device_id fsl_of_msi_ids[]; 307 308 static int __devinit fsl_of_msi_probe(struct platform_device *dev) 308 309 { 310 + const struct of_device_id *match; 309 311 struct fsl_msi *msi; 310 312 struct resource res; 311 313 int err, i, j, irq_index, count; ··· 318 316 u32 offset; 319 317 static const u32 all_avail[] = { 0, NR_MSI_IRQS }; 320 318 321 - if (!dev->dev.of_match) 319 + match = of_match_device(fsl_of_msi_ids, &dev->dev); 320 + if (!match) 322 321 return -EINVAL; 323 - features = dev->dev.of_match->data; 322 + features = match->data; 324 323 325 324 printk(KERN_DEBUG "Setting up Freescale MSI support\n"); 326 325
+1 -1
arch/sparc/kernel/apc.c
··· 165 165 return 0; 166 166 } 167 167 168 - static struct of_device_id __initdata apc_match[] = { 168 + static struct of_device_id apc_match[] = { 169 169 { 170 170 .name = APC_OBPNAME, 171 171 },
+4 -1
arch/sparc/kernel/pci_sabre.c
··· 452 452 sabre_scan_bus(pbm, &op->dev); 453 453 } 454 454 455 + static const struct of_device_id sabre_match[]; 455 456 static int __devinit sabre_probe(struct platform_device *op) 456 457 { 458 + const struct of_device_id *match; 457 459 const struct linux_prom64_registers *pr_regs; 458 460 struct device_node *dp = op->dev.of_node; 459 461 struct pci_pbm_info *pbm; ··· 465 463 const u32 *vdma; 466 464 u64 clear_irq; 467 465 468 - hummingbird_p = op->dev.of_match && (op->dev.of_match->data != NULL); 466 + match = of_match_device(sabre_match, &op->dev); 467 + hummingbird_p = match && (match->data != NULL); 469 468 if (!hummingbird_p) { 470 469 struct device_node *cpu_dp; 471 470
+6 -2
arch/sparc/kernel/pci_schizo.c
··· 1458 1458 return err; 1459 1459 } 1460 1460 1461 + static const struct of_device_id schizo_match[]; 1461 1462 static int __devinit schizo_probe(struct platform_device *op) 1462 1463 { 1463 - if (!op->dev.of_match) 1464 + const struct of_device_id *match; 1465 + 1466 + match = of_match_device(schizo_match, &op->dev); 1467 + if (!match) 1464 1468 return -EINVAL; 1465 - return __schizo_init(op, (unsigned long) op->dev.of_match->data); 1469 + return __schizo_init(op, (unsigned long)match->data); 1466 1470 } 1467 1471 1468 1472 /* The ordering of this table is very important. Some Tomatillo
+1 -1
arch/sparc/kernel/pmc.c
··· 69 69 return 0; 70 70 } 71 71 72 - static struct of_device_id __initdata pmc_match[] = { 72 + static struct of_device_id pmc_match[] = { 73 73 { 74 74 .name = PMC_OBPNAME, 75 75 },
+7 -3
arch/sparc/kernel/smp_32.c
··· 53 53 void __cpuinit smp_store_cpu_info(int id) 54 54 { 55 55 int cpu_node; 56 + int mid; 56 57 57 58 cpu_data(id).udelay_val = loops_per_jiffy; 58 59 ··· 61 60 cpu_data(id).clock_tick = prom_getintdefault(cpu_node, 62 61 "clock-frequency", 0); 63 62 cpu_data(id).prom_node = cpu_node; 64 - cpu_data(id).mid = cpu_get_hwmid(cpu_node); 63 + mid = cpu_get_hwmid(cpu_node); 65 64 66 - if (cpu_data(id).mid < 0) 67 - panic("No MID found for CPU%d at node 0x%08d", id, cpu_node); 65 + if (mid < 0) { 66 + printk(KERN_NOTICE "No MID found for CPU%d at node 0x%08d", id, cpu_node); 67 + mid = 0; 68 + } 69 + cpu_data(id).mid = mid; 68 70 } 69 71 70 72 void __init smp_cpus_done(unsigned int max_cpus)
+1 -1
arch/sparc/kernel/time_32.c
··· 168 168 return 0; 169 169 } 170 170 171 - static struct of_device_id __initdata clock_match[] = { 171 + static struct of_device_id clock_match[] = { 172 172 { 173 173 .name = "eeprom", 174 174 },
+9 -3
arch/sparc/lib/checksum_32.S
··· 289 289 290 290 /* Also, handle the alignment code out of band. */ 291 291 cc_dword_align: 292 - cmp %g1, 6 293 - bl,a ccte 292 + cmp %g1, 16 293 + bge 1f 294 + srl %g1, 1, %o3 295 + 2: cmp %o3, 0 296 + be,a ccte 294 297 andcc %g1, 0xf, %o3 295 - andcc %o0, 0x1, %g0 298 + andcc %o3, %o0, %g0 ! Check %o0 only (%o1 has the same last 2 bits) 299 + be,a 2b 300 + srl %o3, 1, %o3 301 + 1: andcc %o0, 0x1, %g0 296 302 bne ccslow 297 303 andcc %o0, 0x2, %g0 298 304 be 1f
+22 -1
arch/um/os-Linux/util.c
··· 5 5 6 6 #include <stdio.h> 7 7 #include <stdlib.h> 8 + #include <unistd.h> 8 9 #include <errno.h> 9 10 #include <signal.h> 10 11 #include <string.h> ··· 76 75 host.release, host.version, host.machine); 77 76 } 78 77 78 + /* 79 + * We cannot use glibc's abort(). It makes use of tgkill() which 80 + * has no effect within UML's kernel threads. 81 + * After that glibc would execute an invalid instruction to kill 82 + * the calling process and UML crashes with SIGSEGV. 83 + */ 84 + static inline void __attribute__ ((noreturn)) uml_abort(void) 85 + { 86 + sigset_t sig; 87 + 88 + fflush(NULL); 89 + 90 + if (!sigemptyset(&sig) && !sigaddset(&sig, SIGABRT)) 91 + sigprocmask(SIG_UNBLOCK, &sig, 0); 92 + 93 + for (;;) 94 + if (kill(getpid(), SIGABRT) < 0) 95 + exit(127); 96 + } 97 + 79 98 void os_dump_core(void) 80 99 { 81 100 int pid; ··· 137 116 while ((pid = waitpid(-1, NULL, WNOHANG | __WALL)) > 0) 138 117 os_kill_ptraced_process(pid, 0); 139 118 140 - abort(); 119 + uml_abort(); 141 120 }
+1
arch/x86/include/asm/apicdef.h
··· 78 78 #define APIC_DEST_LOGICAL 0x00800 79 79 #define APIC_DEST_PHYSICAL 0x00000 80 80 #define APIC_DM_FIXED 0x00000 81 + #define APIC_DM_FIXED_MASK 0x00700 81 82 #define APIC_DM_LOWEST 0x00100 82 83 #define APIC_DM_SMI 0x00200 83 84 #define APIC_DM_REMRD 0x00300
+1
arch/x86/include/asm/pgtable_types.h
··· 299 299 /* Install a pte for a particular vaddr in kernel space. */ 300 300 void set_pte_vaddr(unsigned long vaddr, pte_t pte); 301 301 302 + extern void native_pagetable_reserve(u64 start, u64 end); 302 303 #ifdef CONFIG_X86_32 303 304 extern void native_pagetable_setup_start(pgd_t *base); 304 305 extern void native_pagetable_setup_done(pgd_t *base);
+13 -4
arch/x86/include/asm/uv/uv_bau.h
··· 94 94 /* after this # consecutive successes, bump up the throttle if it was lowered */ 95 95 #define COMPLETE_THRESHOLD 5 96 96 97 + #define UV_LB_SUBNODEID 0x10 98 + 97 99 /* 98 100 * number of entries in the destination side payload queue 99 101 */ ··· 126 124 * The distribution specification (32 bytes) is interpreted as a 256-bit 127 125 * distribution vector. Adjacent bits correspond to consecutive even numbered 128 126 * nodeIDs. The result of adding the index of a given bit to the 15-bit 129 - * 'base_dest_nodeid' field of the header corresponds to the 127 + * 'base_dest_nasid' field of the header corresponds to the 130 128 * destination nodeID associated with that specified bit. 131 129 */ 132 130 struct bau_target_uvhubmask { ··· 178 176 struct bau_msg_header { 179 177 unsigned int dest_subnodeid:6; /* must be 0x10, for the LB */ 180 178 /* bits 5:0 */ 181 - unsigned int base_dest_nodeid:15; /* nasid of the */ 179 + unsigned int base_dest_nasid:15; /* nasid of the */ 182 180 /* bits 20:6 */ /* first bit in uvhub map */ 183 181 unsigned int command:8; /* message type */ 184 182 /* bits 28:21 */ ··· 380 378 unsigned long d_rcanceled; /* number of messages canceled by resets */ 381 379 }; 382 380 381 + struct hub_and_pnode { 382 + short uvhub; 383 + short pnode; 384 + }; 383 385 /* 384 386 * one per-cpu; to locate the software tables 385 387 */ ··· 405 399 int baudisabled; 406 400 int set_bau_off; 407 401 short cpu; 402 + short osnode; 408 403 short uvhub_cpu; 409 404 short uvhub; 410 405 short cpus_in_socket; 411 406 short cpus_in_uvhub; 407 + short partition_base_pnode; 412 408 unsigned short message_number; 413 409 unsigned short uvhub_quiesce; 414 410 short socket_acknowledge_count[DEST_Q_SIZE]; ··· 430 422 int congested_period; 431 423 cycles_t period_time; 432 424 long period_requests; 425 + struct hub_and_pnode *target_hub_and_pnode; 433 426 }; 434 427 435 428 static inline int bau_uvhub_isset(int uvhub, struct bau_target_uvhubmask *dstp) 436 429 { 437 430 return constant_test_bit(uvhub, &dstp->bits[0]); 438 431 } 439 - static inline void bau_uvhub_set(int uvhub, struct bau_target_uvhubmask *dstp) 432 + static inline void bau_uvhub_set(int pnode, struct bau_target_uvhubmask *dstp) 440 433 { 441 - __set_bit(uvhub, &dstp->bits[0]); 434 + __set_bit(pnode, &dstp->bits[0]); 442 435 } 443 436 static inline void bau_uvhubs_clear(struct bau_target_uvhubmask *dstp, 444 437 int nbits)
+2
arch/x86/include/asm/uv/uv_hub.h
··· 398 398 unsigned short nr_online_cpus; 399 399 unsigned short pnode; 400 400 short memory_nid; 401 + spinlock_t nmi_lock; 402 + unsigned long nmi_count; 401 403 }; 402 404 extern struct uv_blade_info *uv_blade_info; 403 405 extern short *uv_node_to_blade;
+15 -1
arch/x86/include/asm/uv/uv_mmrs.h
··· 5 5 * 6 6 * SGI UV MMR definitions 7 7 * 8 - * Copyright (C) 2007-2010 Silicon Graphics, Inc. All rights reserved. 8 + * Copyright (C) 2007-2011 Silicon Graphics, Inc. All rights reserved. 9 9 */ 10 10 11 11 #ifndef _ASM_X86_UV_UV_MMRS_H ··· 1099 1099 } s; 1100 1100 }; 1101 1101 1102 + /* ========================================================================= */ 1103 + /* UVH_SCRATCH5 */ 1104 + /* ========================================================================= */ 1105 + #define UVH_SCRATCH5 0x2d0200UL 1106 + #define UVH_SCRATCH5_32 0x00778 1107 + 1108 + #define UVH_SCRATCH5_SCRATCH5_SHFT 0 1109 + #define UVH_SCRATCH5_SCRATCH5_MASK 0xffffffffffffffffUL 1110 + union uvh_scratch5_u { 1111 + unsigned long v; 1112 + struct uvh_scratch5_s { 1113 + unsigned long scratch5 : 64; /* RW, W1CS */ 1114 + } s; 1115 + }; 1102 1116 1103 1117 #endif /* __ASM_UV_MMRS_X86_H__ */
+12
arch/x86/include/asm/x86_init.h
··· 68 68 }; 69 69 70 70 /** 71 + * struct x86_init_mapping - platform specific initial kernel pagetable setup 72 + * @pagetable_reserve: reserve a range of addresses for kernel pagetable usage 73 + * 74 + * For more details on the purpose of this hook, look in 75 + * init_memory_mapping and the commit that added it. 76 + */ 77 + struct x86_init_mapping { 78 + void (*pagetable_reserve)(u64 start, u64 end); 79 + }; 80 + 81 + /** 71 82 * struct x86_init_paging - platform specific paging functions 72 83 * @pagetable_setup_start: platform specific pre paging_init() call 73 84 * @pagetable_setup_done: platform specific post paging_init() call ··· 134 123 struct x86_init_mpparse mpparse; 135 124 struct x86_init_irqs irqs; 136 125 struct x86_init_oem oem; 126 + struct x86_init_mapping mapping; 137 127 struct x86_init_paging paging; 138 128 struct x86_init_timers timers; 139 129 struct x86_init_iommu iommu;
+43 -5
arch/x86/kernel/apic/x2apic_uv_x.c
··· 37 37 #include <asm/smp.h> 38 38 #include <asm/x86_init.h> 39 39 #include <asm/emergency-restart.h> 40 + #include <asm/nmi.h> 41 + 42 + /* BMC sets a bit this MMR non-zero before sending an NMI */ 43 + #define UVH_NMI_MMR UVH_SCRATCH5 44 + #define UVH_NMI_MMR_CLEAR (UVH_NMI_MMR + 8) 45 + #define UV_NMI_PENDING_MASK (1UL << 63) 46 + DEFINE_PER_CPU(unsigned long, cpu_last_nmi_count); 40 47 41 48 DEFINE_PER_CPU(int, x2apic_extra_bits); 42 49 ··· 649 642 */ 650 643 int uv_handle_nmi(struct notifier_block *self, unsigned long reason, void *data) 651 644 { 645 + unsigned long real_uv_nmi; 646 + int bid; 647 + 652 648 if (reason != DIE_NMIUNKNOWN) 653 649 return NOTIFY_OK; 654 650 655 651 if (in_crash_kexec) 656 652 /* do nothing if entering the crash kernel */ 657 653 return NOTIFY_OK; 654 + 658 655 /* 659 - * Use a lock so only one cpu prints at a time 660 - * to prevent intermixed output. 656 + * Each blade has an MMR that indicates when an NMI has been sent 657 + * to cpus on the blade. If an NMI is detected, atomically 658 + * clear the MMR and update a per-blade NMI count used to 659 + * cause each cpu on the blade to notice a new NMI. 660 + */ 661 + bid = uv_numa_blade_id(); 662 + real_uv_nmi = (uv_read_local_mmr(UVH_NMI_MMR) & UV_NMI_PENDING_MASK); 663 + 664 + if (unlikely(real_uv_nmi)) { 665 + spin_lock(&uv_blade_info[bid].nmi_lock); 666 + real_uv_nmi = (uv_read_local_mmr(UVH_NMI_MMR) & UV_NMI_PENDING_MASK); 667 + if (real_uv_nmi) { 668 + uv_blade_info[bid].nmi_count++; 669 + uv_write_local_mmr(UVH_NMI_MMR_CLEAR, UV_NMI_PENDING_MASK); 670 + } 671 + spin_unlock(&uv_blade_info[bid].nmi_lock); 672 + } 673 + 674 + if (likely(__get_cpu_var(cpu_last_nmi_count) == uv_blade_info[bid].nmi_count)) 675 + return NOTIFY_DONE; 676 + 677 + __get_cpu_var(cpu_last_nmi_count) = uv_blade_info[bid].nmi_count; 678 + 679 + /* 680 + * Use a lock so only one cpu prints at a time. 681 + * This prevents intermixed output. 661 682 */ 662 683 spin_lock(&uv_nmi_lock); 663 - pr_info("NMI stack dump cpu %u:\n", smp_processor_id()); 684 + pr_info("UV NMI stack dump cpu %u:\n", smp_processor_id()); 664 685 dump_stack(); 665 686 spin_unlock(&uv_nmi_lock); 666 687 ··· 696 661 } 697 662 698 663 static struct notifier_block uv_dump_stack_nmi_nb = { 699 - .notifier_call = uv_handle_nmi 664 + .notifier_call = uv_handle_nmi, 665 + .priority = NMI_LOCAL_LOW_PRIOR - 1, 700 666 }; 701 667 702 668 void uv_register_nmi_notifier(void) ··· 756 720 printk(KERN_DEBUG "UV: Found %d blades\n", uv_num_possible_blades()); 757 721 758 722 bytes = sizeof(struct uv_blade_info) * uv_num_possible_blades(); 759 - uv_blade_info = kmalloc(bytes, GFP_KERNEL); 723 + uv_blade_info = kzalloc(bytes, GFP_KERNEL); 760 724 BUG_ON(!uv_blade_info); 725 + 761 726 for (blade = 0; blade < uv_num_possible_blades(); blade++) 762 727 uv_blade_info[blade].memory_nid = -1; 763 728 ··· 784 747 uv_blade_info[blade].pnode = pnode; 785 748 uv_blade_info[blade].nr_possible_cpus = 0; 786 749 uv_blade_info[blade].nr_online_cpus = 0; 750 + spin_lock_init(&uv_blade_info[blade].nmi_lock); 787 751 max_pnode = max(pnode, max_pnode); 788 752 blade++; 789 753 }
+2 -2
arch/x86/kernel/cpu/amd.c
··· 613 613 #endif 614 614 615 615 /* As a rule processors have APIC timer running in deep C states */ 616 - if (c->x86 >= 0xf && !cpu_has_amd_erratum(amd_erratum_400)) 616 + if (c->x86 > 0xf && !cpu_has_amd_erratum(amd_erratum_400)) 617 617 set_cpu_cap(c, X86_FEATURE_ARAT); 618 618 619 619 /* ··· 698 698 */ 699 699 700 700 const int amd_erratum_400[] = 701 - AMD_OSVW_ERRATUM(1, AMD_MODEL_RANGE(0x0f, 0x4, 0x2, 0xff, 0xf), 701 + AMD_OSVW_ERRATUM(1, AMD_MODEL_RANGE(0xf, 0x41, 0x2, 0xff, 0xf), 702 702 AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf)); 703 703 EXPORT_SYMBOL_GPL(amd_erratum_400); 704 704
+1
arch/x86/kernel/cpu/mcheck/mce_amd.c
··· 509 509 out_free: 510 510 if (b) { 511 511 kobject_put(&b->kobj); 512 + list_del(&b->miscj); 512 513 kfree(b); 513 514 } 514 515 return err;
+7 -5
arch/x86/kernel/cpu/mcheck/therm_throt.c
··· 446 446 */ 447 447 rdmsr(MSR_IA32_MISC_ENABLE, l, h); 448 448 449 + h = lvtthmr_init; 449 450 /* 450 451 * The initial value of thermal LVT entries on all APs always reads 451 452 * 0x10000 because APs are woken up by BSP issuing INIT-SIPI-SIPI 452 453 * sequence to them and LVT registers are reset to 0s except for 453 454 * the mask bits which are set to 1s when APs receive INIT IPI. 454 - * Always restore the value that BIOS has programmed on AP based on 455 - * BSP's info we saved since BIOS is always setting the same value 456 - * for all threads/cores 455 + * If BIOS takes over the thermal interrupt and sets its interrupt 456 + * delivery mode to SMI (not fixed), it restores the value that the 457 + * BIOS has programmed on AP based on BSP's info we saved since BIOS 458 + * is always setting the same value for all threads/cores. 457 459 */ 458 - apic_write(APIC_LVTTHMR, lvtthmr_init); 460 + if ((h & APIC_DM_FIXED_MASK) != APIC_DM_FIXED) 461 + apic_write(APIC_LVTTHMR, lvtthmr_init); 459 462 460 - h = lvtthmr_init; 461 463 462 464 if ((l & MSR_IA32_MISC_ENABLE_TM1) && (h & APIC_DM_SMI)) { 463 465 printk(KERN_DEBUG
+3 -2
arch/x86/kernel/kprobes.c
··· 1183 1183 struct pt_regs *regs) 1184 1184 { 1185 1185 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 1186 + unsigned long flags; 1186 1187 1187 1188 /* This is possible if op is under delayed unoptimizing */ 1188 1189 if (kprobe_disabled(&op->kp)) 1189 1190 return; 1190 1191 1191 - preempt_disable(); 1192 + local_irq_save(flags); 1192 1193 if (kprobe_running()) { 1193 1194 kprobes_inc_nmissed_count(&op->kp); 1194 1195 } else { ··· 1208 1207 opt_pre_handler(&op->kp, regs); 1209 1208 __this_cpu_write(current_kprobe, NULL); 1210 1209 } 1211 - preempt_enable_no_resched(); 1210 + local_irq_restore(flags); 1212 1211 } 1213 1212 1214 1213 static int __kprobes copy_optimized_instructions(u8 *dest, u8 *src)
+4
arch/x86/kernel/x86_init.c
··· 61 61 .banner = default_banner, 62 62 }, 63 63 64 + .mapping = { 65 + .pagetable_reserve = native_pagetable_reserve, 66 + }, 67 + 64 68 .paging = { 65 69 .pagetable_setup_start = native_pagetable_setup_start, 66 70 .pagetable_setup_done = native_pagetable_setup_done,
+22 -2
arch/x86/mm/init.c
··· 81 81 end, pgt_buf_start << PAGE_SHIFT, pgt_buf_top << PAGE_SHIFT); 82 82 } 83 83 84 + void __init native_pagetable_reserve(u64 start, u64 end) 85 + { 86 + memblock_x86_reserve_range(start, end, "PGTABLE"); 87 + } 88 + 84 89 struct map_range { 85 90 unsigned long start; 86 91 unsigned long end; ··· 277 272 278 273 __flush_tlb_all(); 279 274 275 + /* 276 + * Reserve the kernel pagetable pages we used (pgt_buf_start - 277 + * pgt_buf_end) and free the other ones (pgt_buf_end - pgt_buf_top) 278 + * so that they can be reused for other purposes. 279 + * 280 + * On native it just means calling memblock_x86_reserve_range, on Xen it 281 + * also means marking RW the pagetable pages that we allocated before 282 + * but that haven't been used. 283 + * 284 + * In fact on xen we mark RO the whole range pgt_buf_start - 285 + * pgt_buf_top, because we have to make sure that when 286 + * init_memory_mapping reaches the pagetable pages area, it maps 287 + * RO all the pagetable pages, including the ones that are beyond 288 + * pgt_buf_end at that time. 289 + */ 280 290 if (!after_bootmem && pgt_buf_end > pgt_buf_start) 281 - memblock_x86_reserve_range(pgt_buf_start << PAGE_SHIFT, 282 - pgt_buf_end << PAGE_SHIFT, "PGTABLE"); 291 + x86_init.mapping.pagetable_reserve(PFN_PHYS(pgt_buf_start), 292 + PFN_PHYS(pgt_buf_end)); 283 293 284 294 if (!after_bootmem) 285 295 early_memtest(start, end);
+64 -30
arch/x86/platform/uv/tlb_uv.c
··· 699 699 struct mm_struct *mm, 700 700 unsigned long va, unsigned int cpu) 701 701 { 702 - int tcpu; 703 - int uvhub; 704 702 int locals = 0; 705 703 int remotes = 0; 706 704 int hubs = 0; 705 + int tcpu; 706 + int tpnode; 707 707 struct bau_desc *bau_desc; 708 708 struct cpumask *flush_mask; 709 709 struct ptc_stats *stat; 710 710 struct bau_control *bcp; 711 711 struct bau_control *tbcp; 712 + struct hub_and_pnode *hpp; 712 713 713 714 /* kernel was booted 'nobau' */ 714 715 if (nobau) ··· 751 750 bau_desc += UV_ITEMS_PER_DESCRIPTOR * bcp->uvhub_cpu; 752 751 bau_uvhubs_clear(&bau_desc->distribution, UV_DISTRIBUTION_SIZE); 753 752 754 - /* cpu statistics */ 755 753 for_each_cpu(tcpu, flush_mask) { 756 - uvhub = uv_cpu_to_blade_id(tcpu); 757 - bau_uvhub_set(uvhub, &bau_desc->distribution); 758 - if (uvhub == bcp->uvhub) 754 + /* 755 + * The distribution vector is a bit map of pnodes, relative 756 + * to the partition base pnode (and the partition base nasid 757 + * in the header). 758 + * Translate cpu to pnode and hub using an array stored 759 + * in local memory. 760 + */ 761 + hpp = &bcp->socket_master->target_hub_and_pnode[tcpu]; 762 + tpnode = hpp->pnode - bcp->partition_base_pnode; 763 + bau_uvhub_set(tpnode, &bau_desc->distribution); 764 + if (hpp->uvhub == bcp->uvhub) 759 765 locals++; 760 766 else 761 767 remotes++; ··· 863 855 * an interrupt, but causes an error message to be returned to 864 856 * the sender. 865 857 */ 866 - static void uv_enable_timeouts(void) 858 + static void __init uv_enable_timeouts(void) 867 859 { 868 860 int uvhub; 869 861 int nuvhubs; ··· 1334 1326 } 1335 1327 1336 1328 /* 1337 - * initialize the sending side's sending buffers 1329 + * Initialize the sending side's sending buffers. 1338 1330 */ 1339 1331 static void 1340 - uv_activation_descriptor_init(int node, int pnode) 1332 + uv_activation_descriptor_init(int node, int pnode, int base_pnode) 1341 1333 { 1342 1334 int i; 1343 1335 int cpu; ··· 1360 1352 n = pa >> uv_nshift; 1361 1353 m = pa & uv_mmask; 1362 1354 1355 + /* the 14-bit pnode */ 1363 1356 uv_write_global_mmr64(pnode, UVH_LB_BAU_SB_DESCRIPTOR_BASE, 1364 1357 (n << UV_DESC_BASE_PNODE_SHIFT | m)); 1365 - 1366 1358 /* 1367 - * initializing all 8 (UV_ITEMS_PER_DESCRIPTOR) descriptors for each 1359 + * Initializing all 8 (UV_ITEMS_PER_DESCRIPTOR) descriptors for each 1368 1360 * cpu even though we only use the first one; one descriptor can 1369 1361 * describe a broadcast to 256 uv hubs. 1370 1362 */ ··· 1373 1365 memset(bd2, 0, sizeof(struct bau_desc)); 1374 1366 bd2->header.sw_ack_flag = 1; 1375 1367 /* 1376 - * base_dest_nodeid is the nasid of the first uvhub 1377 - * in the partition. The bit map will indicate uvhub numbers, 1378 - * which are 0-N in a partition. Pnodes are unique system-wide. 1368 + * The base_dest_nasid set in the message header is the nasid 1369 + * of the first uvhub in the partition. The bit map will 1370 + * indicate destination pnode numbers relative to that base. 1371 + * They may not be consecutive if nasid striding is being used. 1379 1372 */ 1380 - bd2->header.base_dest_nodeid = UV_PNODE_TO_NASID(uv_partition_base_pnode); 1381 - bd2->header.dest_subnodeid = 0x10; /* the LB */ 1373 + bd2->header.base_dest_nasid = UV_PNODE_TO_NASID(base_pnode); 1374 + bd2->header.dest_subnodeid = UV_LB_SUBNODEID; 1382 1375 bd2->header.command = UV_NET_ENDPOINT_INTD; 1383 1376 bd2->header.int_both = 1; 1384 1377 /* ··· 1451 1442 /* 1452 1443 * Initialization of each UV hub's structures 1453 1444 */ 1454 - static void __init uv_init_uvhub(int uvhub, int vector) 1445 + static void __init uv_init_uvhub(int uvhub, int vector, int base_pnode) 1455 1446 { 1456 1447 int node; 1457 1448 int pnode; ··· 1459 1450 1460 1451 node = uvhub_to_first_node(uvhub); 1461 1452 pnode = uv_blade_to_pnode(uvhub); 1462 - uv_activation_descriptor_init(node, pnode); 1453 + uv_activation_descriptor_init(node, pnode, base_pnode); 1463 1454 uv_payload_queue_init(node, pnode); 1464 1455 /* 1465 - * the below initialization can't be in firmware because the 1466 - * messaging IRQ will be determined by the OS 1456 + * The below initialization can't be in firmware because the 1457 + * messaging IRQ will be determined by the OS. 1467 1458 */ 1468 1459 apicid = uvhub_to_first_apicid(uvhub) | uv_apicid_hibits; 1469 1460 uv_write_global_mmr64(pnode, UVH_BAU_DATA_CONFIG, ··· 1500 1491 /* 1501 1492 * initialize the bau_control structure for each cpu 1502 1493 */ 1503 - static int __init uv_init_per_cpu(int nuvhubs) 1494 + static int __init uv_init_per_cpu(int nuvhubs, int base_part_pnode) 1504 1495 { 1505 1496 int i; 1506 1497 int cpu; 1498 + int tcpu; 1507 1499 int pnode; 1508 1500 int uvhub; 1509 1501 int have_hmaster; ··· 1538 1528 bcp = &per_cpu(bau_control, cpu); 1539 1529 memset(bcp, 0, sizeof(struct bau_control)); 1540 1530 pnode = uv_cpu_hub_info(cpu)->pnode; 1531 + if ((pnode - base_part_pnode) >= UV_DISTRIBUTION_SIZE) { 1532 + printk(KERN_EMERG 1533 + "cpu %d pnode %d-%d beyond %d; BAU disabled\n", 1534 + cpu, pnode, base_part_pnode, 1535 + UV_DISTRIBUTION_SIZE); 1536 + return 1; 1537 + } 1538 + bcp->osnode = cpu_to_node(cpu); 1539 + bcp->partition_base_pnode = uv_partition_base_pnode; 1541 1540 uvhub = uv_cpu_hub_info(cpu)->numa_blade_id; 1542 1541 *(uvhub_mask + (uvhub/8)) |= (1 << (uvhub%8)); 1543 1542 bdp = &uvhub_descs[uvhub]; ··· 1555 1536 bdp->pnode = pnode; 1556 1537 /* kludge: 'assuming' one node per socket, and assuming that 1557 1538 disabling a socket just leaves a gap in node numbers */ 1558 - socket = (cpu_to_node(cpu) & 1); 1539 + socket = bcp->osnode & 1; 1559 1540 bdp->socket_mask |= (1 << socket); 1560 1541 sdp = &bdp->socket[socket]; 1561 1542 sdp->cpu_number[sdp->num_cpus] = cpu; ··· 1604 1585 nextsocket: 1605 1586 socket++; 1606 1587 socket_mask = (socket_mask >> 1); 1588 + /* each socket gets a local array of pnodes/hubs */ 1589 + bcp = smaster; 1590 + bcp->target_hub_and_pnode = kmalloc_node( 1591 + sizeof(struct hub_and_pnode) * 1592 + num_possible_cpus(), GFP_KERNEL, bcp->osnode); 1593 + memset(bcp->target_hub_and_pnode, 0, 1594 + sizeof(struct hub_and_pnode) * 1595 + num_possible_cpus()); 1596 + for_each_present_cpu(tcpu) { 1597 + bcp->target_hub_and_pnode[tcpu].pnode = 1598 + uv_cpu_hub_info(tcpu)->pnode; 1599 + bcp->target_hub_and_pnode[tcpu].uvhub = 1600 + uv_cpu_hub_info(tcpu)->numa_blade_id; 1601 + } 1607 1602 } 1608 1603 } 1609 1604 kfree(uvhub_descs); ··· 1670 1637 spin_lock_init(&disable_lock); 1671 1638 congested_cycles = microsec_2_cycles(congested_response_us); 1672 1639 1673 - if (uv_init_per_cpu(nuvhubs)) { 1640 + uv_partition_base_pnode = 0x7fffffff; 1641 + for (uvhub = 0; uvhub < nuvhubs; uvhub++) { 1642 + if (uv_blade_nr_possible_cpus(uvhub) && 1643 + (uv_blade_to_pnode(uvhub) < uv_partition_base_pnode)) 1644 + uv_partition_base_pnode = uv_blade_to_pnode(uvhub); 1645 + } 1646 + 1647 + if (uv_init_per_cpu(nuvhubs, uv_partition_base_pnode)) { 1674 1648 nobau = 1; 1675 1649 return 0; 1676 1650 } 1677 1651 1678 - uv_partition_base_pnode = 0x7fffffff; 1679 - for (uvhub = 0; uvhub < nuvhubs; uvhub++) 1680 - if (uv_blade_nr_possible_cpus(uvhub) && 1681 - (uv_blade_to_pnode(uvhub) < uv_partition_base_pnode)) 1682 - uv_partition_base_pnode = uv_blade_to_pnode(uvhub); 1683 - 1684 1652 vector = UV_BAU_MESSAGE; 1685 1653 for_each_possible_blade(uvhub) 1686 1654 if (uv_blade_nr_possible_cpus(uvhub)) 1687 - uv_init_uvhub(uvhub, vector); 1655 + uv_init_uvhub(uvhub, vector, uv_partition_base_pnode); 1688 1656 1689 1657 uv_enable_timeouts(); 1690 1658 alloc_intr_gate(vector, uv_bau_message_intr1);
+15 -123
arch/x86/xen/mmu.c
··· 1275 1275 { 1276 1276 } 1277 1277 1278 + static __init void xen_mapping_pagetable_reserve(u64 start, u64 end) 1279 + { 1280 + /* reserve the range used */ 1281 + native_pagetable_reserve(start, end); 1282 + 1283 + /* set as RW the rest */ 1284 + printk(KERN_DEBUG "xen: setting RW the range %llx - %llx\n", end, 1285 + PFN_PHYS(pgt_buf_top)); 1286 + while (end < PFN_PHYS(pgt_buf_top)) { 1287 + make_lowmem_page_readwrite(__va(end)); 1288 + end += PAGE_SIZE; 1289 + } 1290 + } 1291 + 1278 1292 static void xen_post_allocator_init(void); 1279 1293 1280 1294 static __init void xen_pagetable_setup_done(pgd_t *base) ··· 1477 1463 return ret; 1478 1464 } 1479 1465 1480 - #ifdef CONFIG_X86_64 1481 - static __initdata u64 __last_pgt_set_rw = 0; 1482 - static __initdata u64 __pgt_buf_start = 0; 1483 - static __initdata u64 __pgt_buf_end = 0; 1484 - static __initdata u64 __pgt_buf_top = 0; 1485 - /* 1486 - * As a consequence of the commit: 1487 - * 1488 - * commit 4b239f458c229de044d6905c2b0f9fe16ed9e01e 1489 - * Author: Yinghai Lu <yinghai@kernel.org> 1490 - * Date: Fri Dec 17 16:58:28 2010 -0800 1491 - * 1492 - * x86-64, mm: Put early page table high 1493 - * 1494 - * at some point init_memory_mapping is going to reach the pagetable pages 1495 - * area and map those pages too (mapping them as normal memory that falls 1496 - * in the range of addresses passed to init_memory_mapping as argument). 1497 - * Some of those pages are already pagetable pages (they are in the range 1498 - * pgt_buf_start-pgt_buf_end) therefore they are going to be mapped RO and 1499 - * everything is fine. 1500 - * Some of these pages are not pagetable pages yet (they fall in the range 1501 - * pgt_buf_end-pgt_buf_top; for example the page at pgt_buf_end) so they 1502 - * are going to be mapped RW. When these pages become pagetable pages and 1503 - * are hooked into the pagetable, xen will find that the guest has already 1504 - * a RW mapping of them somewhere and fail the operation. 1505 - * The reason Xen requires pagetables to be RO is that the hypervisor needs 1506 - * to verify that the pagetables are valid before using them. The validation 1507 - * operations are called "pinning". 1508 - * 1509 - * In order to fix the issue we mark all the pages in the entire range 1510 - * pgt_buf_start-pgt_buf_top as RO, however when the pagetable allocation 1511 - * is completed only the range pgt_buf_start-pgt_buf_end is reserved by 1512 - * init_memory_mapping. Hence the kernel is going to crash as soon as one 1513 - * of the pages in the range pgt_buf_end-pgt_buf_top is reused (b/c those 1514 - * ranges are RO). 1515 - * 1516 - * For this reason, 'mark_rw_past_pgt' is introduced which is called _after_ 1517 - * the init_memory_mapping has completed (in a perfect world we would 1518 - * call this function from init_memory_mapping, but lets ignore that). 1519 - * 1520 - * Because we are called _after_ init_memory_mapping the pgt_buf_[start, 1521 - * end,top] have all changed to new values (b/c init_memory_mapping 1522 - * is called and setting up another new page-table). Hence, the first time 1523 - * we enter this function, we save away the pgt_buf_start value and update 1524 - * the pgt_buf_[end,top]. 1525 - * 1526 - * When we detect that the "old" pgt_buf_start through pgt_buf_end 1527 - * PFNs have been reserved (so memblock_x86_reserve_range has been called), 1528 - * we immediately set out to RW the "old" pgt_buf_end through pgt_buf_top. 1529 - * 1530 - * And then we update those "old" pgt_buf_[end|top] with the new ones 1531 - * so that we can redo this on the next pagetable. 1532 - */ 1533 - static __init void mark_rw_past_pgt(void) { 1534 - 1535 - if (pgt_buf_end > pgt_buf_start) { 1536 - u64 addr, size; 1537 - 1538 - /* Save it away. */ 1539 - if (!__pgt_buf_start) { 1540 - __pgt_buf_start = pgt_buf_start; 1541 - __pgt_buf_end = pgt_buf_end; 1542 - __pgt_buf_top = pgt_buf_top; 1543 - return; 1544 - } 1545 - /* If we get the range that starts at __pgt_buf_end that means 1546 - * the range is reserved, and that in 'init_memory_mapping' 1547 - * the 'memblock_x86_reserve_range' has been called with the 1548 - * outdated __pgt_buf_start, __pgt_buf_end (the "new" 1549 - * pgt_buf_[start|end|top] refer now to a new pagetable. 1550 - * Note: we are called _after_ the pgt_buf_[..] have been 1551 - * updated.*/ 1552 - 1553 - addr = memblock_x86_find_in_range_size(PFN_PHYS(__pgt_buf_start), 1554 - &size, PAGE_SIZE); 1555 - 1556 - /* Still not reserved, meaning 'memblock_x86_reserve_range' 1557 - * hasn't been called yet. Update the _end and _top.*/ 1558 - if (addr == PFN_PHYS(__pgt_buf_start)) { 1559 - __pgt_buf_end = pgt_buf_end; 1560 - __pgt_buf_top = pgt_buf_top; 1561 - return; 1562 - } 1563 - 1564 - /* OK, the area is reserved, meaning it is time for us to 1565 - * set RW for the old end->top PFNs. */ 1566 - 1567 - /* ..unless we had already done this. */ 1568 - if (__pgt_buf_end == __last_pgt_set_rw) 1569 - return; 1570 - 1571 - addr = PFN_PHYS(__pgt_buf_end); 1572 - 1573 - /* set as RW the rest */ 1574 - printk(KERN_DEBUG "xen: setting RW the range %llx - %llx\n", 1575 - PFN_PHYS(__pgt_buf_end), PFN_PHYS(__pgt_buf_top)); 1576 - 1577 - while (addr < PFN_PHYS(__pgt_buf_top)) { 1578 - make_lowmem_page_readwrite(__va(addr)); 1579 - addr += PAGE_SIZE; 1580 - } 1581 - /* And update everything so that we are ready for the next 1582 - * pagetable (the one created for regions past 4GB) */ 1583 - __last_pgt_set_rw = __pgt_buf_end; 1584 - __pgt_buf_start = pgt_buf_start; 1585 - __pgt_buf_end = pgt_buf_end; 1586 - __pgt_buf_top = pgt_buf_top; 1587 - } 1588 - return; 1589 - } 1590 - #else 1591 - static __init void mark_rw_past_pgt(void) { } 1592 - #endif 1593 1466 static void xen_pgd_free(struct mm_struct *mm, pgd_t *pgd) 1594 1467 { 1595 1468 #ifdef CONFIG_X86_64 ··· 1502 1601 { 1503 1602 unsigned long pfn = pte_pfn(pte); 1504 1603 1505 - /* 1506 - * A bit of optimization. We do not need to call the workaround 1507 - * when xen_set_pte_init is called with a PTE with 0 as PFN. 1508 - * That is b/c the pagetable at that point are just being populated 1509 - * with empty values and we can save some cycles by not calling 1510 - * the 'memblock' code.*/ 1511 - if (pfn) 1512 - mark_rw_past_pgt(); 1513 1604 /* 1514 1605 * If the new pfn is within the range of the newly allocated 1515 1606 * kernel pagetable, and it isn't being mapped into an ··· 2011 2118 2012 2119 static __init void xen_post_allocator_init(void) 2013 2120 { 2014 - mark_rw_past_pgt(); 2015 - 2016 2121 #ifdef CONFIG_XEN_DEBUG 2017 2122 pv_mmu_ops.make_pte = PV_CALLEE_SAVE(xen_make_pte_debug); 2018 2123 #endif ··· 2119 2228 2120 2229 void __init xen_init_mmu_ops(void) 2121 2230 { 2231 + x86_init.mapping.pagetable_reserve = xen_mapping_pagetable_reserve; 2122 2232 x86_init.paging.pagetable_setup_start = xen_pagetable_setup_start; 2123 2233 x86_init.paging.pagetable_setup_done = xen_pagetable_setup_done; 2124 2234 pv_mmu_ops = xen_mmu_ops;
+7
block/blk-cgroup.c
··· 114 114 } 115 115 EXPORT_SYMBOL_GPL(cgroup_to_blkio_cgroup); 116 116 117 + struct blkio_cgroup *task_blkio_cgroup(struct task_struct *tsk) 118 + { 119 + return container_of(task_subsys_state(tsk, blkio_subsys_id), 120 + struct blkio_cgroup, css); 121 + } 122 + EXPORT_SYMBOL_GPL(task_blkio_cgroup); 123 + 117 124 static inline void 118 125 blkio_update_group_weight(struct blkio_group *blkg, unsigned int weight) 119 126 {
+3
block/blk-cgroup.h
··· 291 291 #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE) 292 292 extern struct blkio_cgroup blkio_root_cgroup; 293 293 extern struct blkio_cgroup *cgroup_to_blkio_cgroup(struct cgroup *cgroup); 294 + extern struct blkio_cgroup *task_blkio_cgroup(struct task_struct *tsk); 294 295 extern void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg, 295 296 struct blkio_group *blkg, void *key, dev_t dev, 296 297 enum blkio_policy_id plid); ··· 315 314 struct cgroup; 316 315 static inline struct blkio_cgroup * 317 316 cgroup_to_blkio_cgroup(struct cgroup *cgroup) { return NULL; } 317 + static inline struct blkio_cgroup * 318 + task_blkio_cgroup(struct task_struct *tsk) { return NULL; } 318 319 319 320 static inline void blkiocg_add_blkio_group(struct blkio_cgroup *blkcg, 320 321 struct blkio_group *blkg, void *key, dev_t dev,
+3 -1
block/blk-core.c
··· 316 316 */ 317 317 void blk_run_queue_async(struct request_queue *q) 318 318 { 319 - if (likely(!blk_queue_stopped(q))) 319 + if (likely(!blk_queue_stopped(q))) { 320 + __cancel_delayed_work(&q->delay_work); 320 321 queue_delayed_work(kblockd_workqueue, &q->delay_work, 0); 322 + } 321 323 } 322 324 EXPORT_SYMBOL(blk_run_queue_async); 323 325
+4 -5
block/blk-throttle.c
··· 160 160 } 161 161 162 162 static struct throtl_grp * throtl_find_alloc_tg(struct throtl_data *td, 163 - struct cgroup *cgroup) 163 + struct blkio_cgroup *blkcg) 164 164 { 165 - struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgroup); 166 165 struct throtl_grp *tg = NULL; 167 166 void *key = td; 168 167 struct backing_dev_info *bdi = &td->queue->backing_dev_info; ··· 228 229 229 230 static struct throtl_grp * throtl_get_tg(struct throtl_data *td) 230 231 { 231 - struct cgroup *cgroup; 232 232 struct throtl_grp *tg = NULL; 233 + struct blkio_cgroup *blkcg; 233 234 234 235 rcu_read_lock(); 235 - cgroup = task_cgroup(current, blkio_subsys_id); 236 - tg = throtl_find_alloc_tg(td, cgroup); 236 + blkcg = task_blkio_cgroup(current); 237 + tg = throtl_find_alloc_tg(td, blkcg); 237 238 if (!tg) 238 239 tg = &td->root_tg; 239 240 rcu_read_unlock();
+5 -6
block/cfq-iosched.c
··· 1014 1014 cfqg->needs_update = true; 1015 1015 } 1016 1016 1017 - static struct cfq_group * 1018 - cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create) 1017 + static struct cfq_group * cfq_find_alloc_cfqg(struct cfq_data *cfqd, 1018 + struct blkio_cgroup *blkcg, int create) 1019 1019 { 1020 - struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgroup); 1021 1020 struct cfq_group *cfqg = NULL; 1022 1021 void *key = cfqd; 1023 1022 int i, j; ··· 1078 1079 */ 1079 1080 static struct cfq_group *cfq_get_cfqg(struct cfq_data *cfqd, int create) 1080 1081 { 1081 - struct cgroup *cgroup; 1082 + struct blkio_cgroup *blkcg; 1082 1083 struct cfq_group *cfqg = NULL; 1083 1084 1084 1085 rcu_read_lock(); 1085 - cgroup = task_cgroup(current, blkio_subsys_id); 1086 - cfqg = cfq_find_alloc_cfqg(cfqd, cgroup, create); 1086 + blkcg = task_blkio_cgroup(current); 1087 + cfqg = cfq_find_alloc_cfqg(cfqd, blkcg, create); 1087 1088 if (!cfqg && create) 1088 1089 cfqg = &cfqd->root_group; 1089 1090 rcu_read_unlock();
-21
drivers/ata/libahci.c
··· 561 561 { 562 562 void __iomem *port_mmio = ahci_port_base(ap); 563 563 u32 tmp; 564 - u8 status; 565 - 566 - status = readl(port_mmio + PORT_TFDATA) & 0xFF; 567 - 568 - /* 569 - * At end of section 10.1 of AHCI spec (rev 1.3), it states 570 - * Software shall not set PxCMD.ST to 1 until it is determined 571 - * that a functoinal device is present on the port as determined by 572 - * PxTFD.STS.BSY=0, PxTFD.STS.DRQ=0 and PxSSTS.DET=3h 573 - * 574 - * Even though most AHCI host controllers work without this check, 575 - * specific controller will fail under this condition 576 - */ 577 - if (status & (ATA_BUSY | ATA_DRQ)) 578 - return; 579 - else { 580 - ahci_scr_read(&ap->link, SCR_STATUS, &tmp); 581 - 582 - if ((tmp & 0xf) != 0x3) 583 - return; 584 - } 585 564 586 565 /* start DMA */ 587 566 tmp = readl(port_mmio + PORT_CMD);
+1 -1
drivers/ata/libata-eh.c
··· 3316 3316 struct ata_eh_context *ehc = &link->eh_context; 3317 3317 struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL; 3318 3318 enum ata_lpm_policy old_policy = link->lpm_policy; 3319 - bool no_dipm = ap->flags & ATA_FLAG_NO_DIPM; 3319 + bool no_dipm = link->ap->flags & ATA_FLAG_NO_DIPM; 3320 3320 unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM; 3321 3321 unsigned int err_mask; 3322 3322 int rc;
+5 -2
drivers/atm/fore200e.c
··· 2643 2643 } 2644 2644 2645 2645 #ifdef CONFIG_SBUS 2646 + static const struct of_device_id fore200e_sba_match[]; 2646 2647 static int __devinit fore200e_sba_probe(struct platform_device *op) 2647 2648 { 2649 + const struct of_device_id *match; 2648 2650 const struct fore200e_bus *bus; 2649 2651 struct fore200e *fore200e; 2650 2652 static int index = 0; 2651 2653 int err; 2652 2654 2653 - if (!op->dev.of_match) 2655 + match = of_match_device(fore200e_sba_match, &op->dev); 2656 + if (!match) 2654 2657 return -EINVAL; 2655 - bus = op->dev.of_match->data; 2658 + bus = match->data; 2656 2659 2657 2660 fore200e = kzalloc(sizeof(struct fore200e), GFP_KERNEL); 2658 2661 if (!fore200e)
-1
drivers/block/DAC960.c
··· 2547 2547 disk->major = MajorNumber; 2548 2548 disk->first_minor = n << DAC960_MaxPartitionsBits; 2549 2549 disk->fops = &DAC960_BlockDeviceOperations; 2550 - disk->events = DISK_EVENT_MEDIA_CHANGE; 2551 2550 } 2552 2551 /* 2553 2552 Indicate the Block Device Registration completed successfully,
-1
drivers/block/amiflop.c
··· 1736 1736 disk->major = FLOPPY_MAJOR; 1737 1737 disk->first_minor = drive; 1738 1738 disk->fops = &floppy_fops; 1739 - disk->events = DISK_EVENT_MEDIA_CHANGE; 1740 1739 sprintf(disk->disk_name, "fd%d", drive); 1741 1740 disk->private_data = &unit[drive]; 1742 1741 set_capacity(disk, 880*2);
-1
drivers/block/ataflop.c
··· 1964 1964 unit[i].disk->first_minor = i; 1965 1965 sprintf(unit[i].disk->disk_name, "fd%d", i); 1966 1966 unit[i].disk->fops = &floppy_fops; 1967 - unit[i].disk->events = DISK_EVENT_MEDIA_CHANGE; 1968 1967 unit[i].disk->private_data = &unit[i]; 1969 1968 unit[i].disk->queue = blk_init_queue(do_fd_request, 1970 1969 &ataflop_lock);
-1
drivers/block/floppy.c
··· 4205 4205 disks[dr]->major = FLOPPY_MAJOR; 4206 4206 disks[dr]->first_minor = TOMINOR(dr); 4207 4207 disks[dr]->fops = &floppy_fops; 4208 - disks[dr]->events = DISK_EVENT_MEDIA_CHANGE; 4209 4208 sprintf(disks[dr]->disk_name, "fd%d", dr); 4210 4209 4211 4210 init_timer(&motor_off_timer[dr]);
-1
drivers/block/paride/pcd.c
··· 320 320 disk->first_minor = unit; 321 321 strcpy(disk->disk_name, cd->name); /* umm... */ 322 322 disk->fops = &pcd_bdops; 323 - disk->events = DISK_EVENT_MEDIA_CHANGE; 324 323 } 325 324 } 326 325
-1
drivers/block/paride/pd.c
··· 837 837 p->fops = &pd_fops; 838 838 p->major = major; 839 839 p->first_minor = (disk - pd) << PD_BITS; 840 - p->events = DISK_EVENT_MEDIA_CHANGE; 841 840 disk->gd = p; 842 841 p->private_data = disk; 843 842 p->queue = pd_queue;
-1
drivers/block/paride/pf.c
··· 294 294 disk->first_minor = unit; 295 295 strcpy(disk->disk_name, pf->name); 296 296 disk->fops = &pf_fops; 297 - disk->events = DISK_EVENT_MEDIA_CHANGE; 298 297 if (!(*drives[unit])[D_PRT]) 299 298 pf_drive_count++; 300 299 }
+156 -21
drivers/block/rbd.c
··· 92 92 struct list_head node; 93 93 }; 94 94 95 + struct rbd_req_coll; 96 + 95 97 /* 96 98 * a single io request 97 99 */ ··· 102 100 struct bio *bio; /* cloned bio */ 103 101 struct page **pages; /* list of used pages */ 104 102 u64 len; 103 + int coll_index; 104 + struct rbd_req_coll *coll; 105 + }; 106 + 107 + struct rbd_req_status { 108 + int done; 109 + int rc; 110 + u64 bytes; 111 + }; 112 + 113 + /* 114 + * a collection of requests 115 + */ 116 + struct rbd_req_coll { 117 + int total; 118 + int num_done; 119 + struct kref kref; 120 + struct rbd_req_status status[0]; 105 121 }; 106 122 107 123 struct rbd_snap { ··· 436 416 rbd_dev->client = NULL; 437 417 } 438 418 419 + /* 420 + * Destroy requests collection 421 + */ 422 + static void rbd_coll_release(struct kref *kref) 423 + { 424 + struct rbd_req_coll *coll = 425 + container_of(kref, struct rbd_req_coll, kref); 426 + 427 + dout("rbd_coll_release %p\n", coll); 428 + kfree(coll); 429 + } 439 430 440 431 /* 441 432 * Create a new header structure, translate header format from the on-disk ··· 621 590 return len; 622 591 } 623 592 593 + static int rbd_get_num_segments(struct rbd_image_header *header, 594 + u64 ofs, u64 len) 595 + { 596 + u64 start_seg = ofs >> header->obj_order; 597 + u64 end_seg = (ofs + len - 1) >> header->obj_order; 598 + return end_seg - start_seg + 1; 599 + } 600 + 624 601 /* 625 602 * bio helpers 626 603 */ ··· 774 735 kfree(ops); 775 736 } 776 737 738 + static void rbd_coll_end_req_index(struct request *rq, 739 + struct rbd_req_coll *coll, 740 + int index, 741 + int ret, u64 len) 742 + { 743 + struct request_queue *q; 744 + int min, max, i; 745 + 746 + dout("rbd_coll_end_req_index %p index %d ret %d len %lld\n", 747 + coll, index, ret, len); 748 + 749 + if (!rq) 750 + return; 751 + 752 + if (!coll) { 753 + blk_end_request(rq, ret, len); 754 + return; 755 + } 756 + 757 + q = rq->q; 758 + 759 + spin_lock_irq(q->queue_lock); 760 + coll->status[index].done = 1; 761 + coll->status[index].rc = ret; 762 + coll->status[index].bytes = len; 763 + max = min = coll->num_done; 764 + while (max < coll->total && coll->status[max].done) 765 + max++; 766 + 767 + for (i = min; i<max; i++) { 768 + __blk_end_request(rq, coll->status[i].rc, 769 + coll->status[i].bytes); 770 + coll->num_done++; 771 + kref_put(&coll->kref, rbd_coll_release); 772 + } 773 + spin_unlock_irq(q->queue_lock); 774 + } 775 + 776 + static void rbd_coll_end_req(struct rbd_request *req, 777 + int ret, u64 len) 778 + { 779 + rbd_coll_end_req_index(req->rq, req->coll, req->coll_index, ret, len); 780 + } 781 + 777 782 /* 778 783 * Send ceph osd request 779 784 */ ··· 832 749 int flags, 833 750 struct ceph_osd_req_op *ops, 834 751 int num_reply, 752 + struct rbd_req_coll *coll, 753 + int coll_index, 835 754 void (*rbd_cb)(struct ceph_osd_request *req, 836 755 struct ceph_msg *msg), 837 756 struct ceph_osd_request **linger_req, ··· 848 763 struct ceph_osd_request_head *reqhead; 849 764 struct rbd_image_header *header = &dev->header; 850 765 851 - ret = -ENOMEM; 852 766 req_data = kzalloc(sizeof(*req_data), GFP_NOIO); 853 - if (!req_data) 854 - goto done; 767 + if (!req_data) { 768 + if (coll) 769 + rbd_coll_end_req_index(rq, coll, coll_index, 770 + -ENOMEM, len); 771 + return -ENOMEM; 772 + } 855 773 856 - dout("rbd_do_request len=%lld ofs=%lld\n", len, ofs); 774 + if (coll) { 775 + req_data->coll = coll; 776 + req_data->coll_index = coll_index; 777 + } 778 + 779 + dout("rbd_do_request obj=%s ofs=%lld len=%lld\n", obj, len, ofs); 857 780 858 781 down_read(&header->snap_rwsem); 859 782 ··· 921 828 ret = ceph_osdc_wait_request(&dev->client->osdc, req); 922 829 if (ver) 923 830 *ver = le64_to_cpu(req->r_reassert_version.version); 924 - dout("reassert_ver=%lld\n", le64_to_cpu(req->r_reassert_version.version)); 831 + dout("reassert_ver=%lld\n", 832 + le64_to_cpu(req->r_reassert_version.version)); 925 833 ceph_osdc_put_request(req); 926 834 } 927 835 return ret; ··· 931 837 bio_chain_put(req_data->bio); 932 838 ceph_osdc_put_request(req); 933 839 done_pages: 840 + rbd_coll_end_req(req_data, ret, len); 934 841 kfree(req_data); 935 - done: 936 - if (rq) 937 - blk_end_request(rq, ret, len); 938 842 return ret; 939 843 } 940 844 ··· 966 874 bytes = req_data->len; 967 875 } 968 876 969 - blk_end_request(req_data->rq, rc, bytes); 877 + rbd_coll_end_req(req_data, rc, bytes); 970 878 971 879 if (req_data->bio) 972 880 bio_chain_put(req_data->bio); ··· 1026 934 flags, 1027 935 ops, 1028 936 2, 937 + NULL, 0, 1029 938 NULL, 1030 939 linger_req, ver); 1031 940 if (ret < 0) ··· 1052 959 u64 snapid, 1053 960 int opcode, int flags, int num_reply, 1054 961 u64 ofs, u64 len, 1055 - struct bio *bio) 962 + struct bio *bio, 963 + struct rbd_req_coll *coll, 964 + int coll_index) 1056 965 { 1057 966 char *seg_name; 1058 967 u64 seg_ofs; ··· 1090 995 flags, 1091 996 ops, 1092 997 num_reply, 998 + coll, coll_index, 1093 999 rbd_req_cb, 0, NULL); 1000 + 1001 + rbd_destroy_ops(ops); 1094 1002 done: 1095 1003 kfree(seg_name); 1096 1004 return ret; ··· 1106 1008 struct rbd_device *rbd_dev, 1107 1009 struct ceph_snap_context *snapc, 1108 1010 u64 ofs, u64 len, 1109 - struct bio *bio) 1011 + struct bio *bio, 1012 + struct rbd_req_coll *coll, 1013 + int coll_index) 1110 1014 { 1111 1015 return rbd_do_op(rq, rbd_dev, snapc, CEPH_NOSNAP, 1112 1016 CEPH_OSD_OP_WRITE, 1113 1017 CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK, 1114 1018 2, 1115 - ofs, len, bio); 1019 + ofs, len, bio, coll, coll_index); 1116 1020 } 1117 1021 1118 1022 /* ··· 1124 1024 struct rbd_device *rbd_dev, 1125 1025 u64 snapid, 1126 1026 u64 ofs, u64 len, 1127 - struct bio *bio) 1027 + struct bio *bio, 1028 + struct rbd_req_coll *coll, 1029 + int coll_index) 1128 1030 { 1129 1031 return rbd_do_op(rq, rbd_dev, NULL, 1130 1032 (snapid ? snapid : CEPH_NOSNAP), 1131 1033 CEPH_OSD_OP_READ, 1132 1034 CEPH_OSD_FLAG_READ, 1133 1035 2, 1134 - ofs, len, bio); 1036 + ofs, len, bio, coll, coll_index); 1135 1037 } 1136 1038 1137 1039 /* ··· 1165 1063 { 1166 1064 struct ceph_osd_req_op *ops; 1167 1065 struct page **pages = NULL; 1168 - int ret = rbd_create_rw_ops(&ops, 1, CEPH_OSD_OP_NOTIFY_ACK, 0); 1066 + int ret; 1067 + 1068 + ret = rbd_create_rw_ops(&ops, 1, CEPH_OSD_OP_NOTIFY_ACK, 0); 1169 1069 if (ret < 0) 1170 1070 return ret; 1171 1071 ··· 1181 1077 CEPH_OSD_FLAG_READ, 1182 1078 ops, 1183 1079 1, 1080 + NULL, 0, 1184 1081 rbd_simple_req_cb, 0, NULL); 1185 1082 1186 1083 rbd_destroy_ops(ops); ··· 1379 1274 return ret; 1380 1275 } 1381 1276 1277 + static struct rbd_req_coll *rbd_alloc_coll(int num_reqs) 1278 + { 1279 + struct rbd_req_coll *coll = 1280 + kzalloc(sizeof(struct rbd_req_coll) + 1281 + sizeof(struct rbd_req_status) * num_reqs, 1282 + GFP_ATOMIC); 1283 + 1284 + if (!coll) 1285 + return NULL; 1286 + coll->total = num_reqs; 1287 + kref_init(&coll->kref); 1288 + return coll; 1289 + } 1290 + 1382 1291 /* 1383 1292 * block device queue callback 1384 1293 */ ··· 1410 1291 bool do_write; 1411 1292 int size, op_size = 0; 1412 1293 u64 ofs; 1294 + int num_segs, cur_seg = 0; 1295 + struct rbd_req_coll *coll; 1413 1296 1414 1297 /* peek at request from block layer */ 1415 1298 if (!rq) ··· 1442 1321 do_write ? "write" : "read", 1443 1322 size, blk_rq_pos(rq) * 512ULL); 1444 1323 1324 + num_segs = rbd_get_num_segments(&rbd_dev->header, ofs, size); 1325 + coll = rbd_alloc_coll(num_segs); 1326 + if (!coll) { 1327 + spin_lock_irq(q->queue_lock); 1328 + __blk_end_request_all(rq, -ENOMEM); 1329 + goto next; 1330 + } 1331 + 1445 1332 do { 1446 1333 /* a bio clone to be passed down to OSD req */ 1447 1334 dout("rq->bio->bi_vcnt=%d\n", rq->bio->bi_vcnt); ··· 1457 1328 rbd_dev->header.block_name, 1458 1329 ofs, size, 1459 1330 NULL, NULL); 1331 + kref_get(&coll->kref); 1460 1332 bio = bio_chain_clone(&rq_bio, &next_bio, &bp, 1461 1333 op_size, GFP_ATOMIC); 1462 1334 if (!bio) { 1463 - spin_lock_irq(q->queue_lock); 1464 - __blk_end_request_all(rq, -ENOMEM); 1465 - goto next; 1335 + rbd_coll_end_req_index(rq, coll, cur_seg, 1336 + -ENOMEM, op_size); 1337 + goto next_seg; 1466 1338 } 1339 + 1467 1340 1468 1341 /* init OSD command: write or read */ 1469 1342 if (do_write) 1470 1343 rbd_req_write(rq, rbd_dev, 1471 1344 rbd_dev->header.snapc, 1472 1345 ofs, 1473 - op_size, bio); 1346 + op_size, bio, 1347 + coll, cur_seg); 1474 1348 else 1475 1349 rbd_req_read(rq, rbd_dev, 1476 1350 cur_snap_id(rbd_dev), 1477 1351 ofs, 1478 - op_size, bio); 1352 + op_size, bio, 1353 + coll, cur_seg); 1479 1354 1355 + next_seg: 1480 1356 size -= op_size; 1481 1357 ofs += op_size; 1482 1358 1359 + cur_seg++; 1483 1360 rq_bio = next_bio; 1484 1361 } while (size > 0); 1362 + kref_put(&coll->kref, rbd_coll_release); 1485 1363 1486 1364 if (bp) 1487 1365 bio_pair_release(bp); 1488 - 1489 1366 spin_lock_irq(q->queue_lock); 1490 1367 next: 1491 1368 rq = blk_fetch_request(q);
-1
drivers/block/swim.c
··· 858 858 swd->unit[drive].disk->first_minor = drive; 859 859 sprintf(swd->unit[drive].disk->disk_name, "fd%d", drive); 860 860 swd->unit[drive].disk->fops = &floppy_fops; 861 - swd->unit[drive].disk->events = DISK_EVENT_MEDIA_CHANGE; 862 861 swd->unit[drive].disk->private_data = &swd->unit[drive]; 863 862 swd->unit[drive].disk->queue = swd->queue; 864 863 set_capacity(swd->unit[drive].disk, 2880);
-1
drivers/block/swim3.c
··· 1163 1163 disk->major = FLOPPY_MAJOR; 1164 1164 disk->first_minor = i; 1165 1165 disk->fops = &floppy_fops; 1166 - disk->events = DISK_EVENT_MEDIA_CHANGE; 1167 1166 disk->private_data = &floppy_states[i]; 1168 1167 disk->queue = swim3_queue; 1169 1168 disk->flags |= GENHD_FL_REMOVABLE;
-1
drivers/block/ub.c
··· 2334 2334 disk->major = UB_MAJOR; 2335 2335 disk->first_minor = lun->id * UB_PARTS_PER_LUN; 2336 2336 disk->fops = &ub_bd_fops; 2337 - disk->events = DISK_EVENT_MEDIA_CHANGE; 2338 2337 disk->private_data = lun; 2339 2338 disk->driverfs_dev = &sc->intf->dev; 2340 2339
-1
drivers/block/xsysace.c
··· 1005 1005 ace->gd->major = ace_major; 1006 1006 ace->gd->first_minor = ace->id * ACE_NUM_MINORS; 1007 1007 ace->gd->fops = &ace_fops; 1008 - ace->gd->events = DISK_EVENT_MEDIA_CHANGE; 1009 1008 ace->gd->queue = ace->queue; 1010 1009 ace->gd->private_data = ace; 1011 1010 snprintf(ace->gd->disk_name, 32, "xs%c", ace->id + 'a');
+3 -3
drivers/cdrom/cdrom.c
··· 986 986 987 987 cdinfo(CD_OPEN, "entering cdrom_open\n"); 988 988 989 + /* open is event synchronization point, check events first */ 990 + check_disk_change(bdev); 991 + 989 992 /* if this was a O_NONBLOCK open and we should honor the flags, 990 993 * do a quick open without drive/disc integrity checks. */ 991 994 cdi->use_count++; ··· 1015 1012 1016 1013 cdinfo(CD_OPEN, "Use count for \"/dev/%s\" now %d\n", 1017 1014 cdi->name, cdi->use_count); 1018 - /* Do this on open. Don't wait for mount, because they might 1019 - not be mounting, but opening with O_NONBLOCK */ 1020 - check_disk_change(bdev); 1021 1015 return 0; 1022 1016 err_release: 1023 1017 if (CDROM_CAN(CDC_LOCK) && cdi->options & CDO_LOCK) {
-1
drivers/cdrom/gdrom.c
··· 803 803 goto probe_fail_cdrom_register; 804 804 } 805 805 gd.disk->fops = &gdrom_bdops; 806 - gd.disk->events = DISK_EVENT_MEDIA_CHANGE; 807 806 /* latch on to the interrupt */ 808 807 err = gdrom_set_interrupt_handlers(); 809 808 if (err)
-1
drivers/cdrom/viocd.c
··· 626 626 gendisk->queue = q; 627 627 gendisk->fops = &viocd_fops; 628 628 gendisk->flags = GENHD_FL_CD|GENHD_FL_REMOVABLE; 629 - gendisk->events = DISK_EVENT_MEDIA_CHANGE; 630 629 set_capacity(gendisk, 0); 631 630 gendisk->private_data = d; 632 631 d->viocd_disk = gendisk;
+5 -2
drivers/char/hw_random/n2-drv.c
··· 619 619 pr_info("%s", version); 620 620 } 621 621 622 + static const struct of_device_id n2rng_match[]; 622 623 static int __devinit n2rng_probe(struct platform_device *op) 623 624 { 625 + const struct of_device_id *match; 624 626 int victoria_falls; 625 627 int err = -ENOMEM; 626 628 struct n2rng *np; 627 629 628 - if (!op->dev.of_match) 630 + match = of_match_device(n2rng_match, &op->dev); 631 + if (!match) 629 632 return -EINVAL; 630 - victoria_falls = (op->dev.of_match->data != NULL); 633 + victoria_falls = (match->data != NULL); 631 634 632 635 n2rng_driver_version(); 633 636 np = kzalloc(sizeof(*np), GFP_KERNEL);
+5 -2
drivers/char/ipmi/ipmi_si_intf.c
··· 2554 2554 }; 2555 2555 #endif /* CONFIG_PCI */ 2556 2556 2557 + static struct of_device_id ipmi_match[]; 2557 2558 static int __devinit ipmi_probe(struct platform_device *dev) 2558 2559 { 2559 2560 #ifdef CONFIG_OF 2561 + const struct of_device_id *match; 2560 2562 struct smi_info *info; 2561 2563 struct resource resource; 2562 2564 const __be32 *regsize, *regspacing, *regshift; ··· 2568 2566 2569 2567 dev_info(&dev->dev, "probing via device tree\n"); 2570 2568 2571 - if (!dev->dev.of_match) 2569 + match = of_match_device(ipmi_match, &dev->dev); 2570 + if (!match) 2572 2571 return -EINVAL; 2573 2572 2574 2573 ret = of_address_to_resource(np, 0, &resource); ··· 2604 2601 return -ENOMEM; 2605 2602 } 2606 2603 2607 - info->si_type = (enum si_type) dev->dev.of_match->data; 2604 + info->si_type = (enum si_type) match->data; 2608 2605 info->addr_source = SI_DEVICETREE; 2609 2606 info->irq_setup = std_irq_setup; 2610 2607
+9 -5
drivers/char/xilinx_hwicap/xilinx_hwicap.c
··· 715 715 } 716 716 717 717 #ifdef CONFIG_OF 718 - static int __devinit hwicap_of_probe(struct platform_device *op) 718 + static int __devinit hwicap_of_probe(struct platform_device *op, 719 + const struct hwicap_driver_config *config) 719 720 { 720 721 struct resource res; 721 722 const unsigned int *id; 722 723 const char *family; 723 724 int rc; 724 - const struct hwicap_driver_config *config = op->dev.of_match->data; 725 725 const struct config_registers *regs; 726 726 727 727 ··· 751 751 regs); 752 752 } 753 753 #else 754 - static inline int hwicap_of_probe(struct platform_device *op) 754 + static inline int hwicap_of_probe(struct platform_device *op, 755 + const struct hwicap_driver_config *config) 755 756 { 756 757 return -EINVAL; 757 758 } 758 759 #endif /* CONFIG_OF */ 759 760 761 + static const struct of_device_id __devinitconst hwicap_of_match[]; 760 762 static int __devinit hwicap_drv_probe(struct platform_device *pdev) 761 763 { 764 + const struct of_device_id *match; 762 765 struct resource *res; 763 766 const struct config_registers *regs; 764 767 const char *family; 765 768 766 - if (pdev->dev.of_match) 767 - return hwicap_of_probe(pdev); 769 + match = of_match_device(hwicap_of_match, &pdev->dev); 770 + if (match) 771 + return hwicap_of_probe(pdev, match->data); 768 772 769 773 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 770 774 if (!res)
+1 -1
drivers/edac/ppc4xx_edac.c
··· 1019 1019 struct ppc4xx_edac_pdata *pdata = NULL; 1020 1020 const struct device_node *np = op->dev.of_node; 1021 1021 1022 - if (op->dev.of_match == NULL) 1022 + if (of_match_device(ppc4xx_edac_match, &op->dev) == NULL) 1023 1023 return -EINVAL; 1024 1024 1025 1025 /* Initial driver pointers and private data */
+22 -4
drivers/gpu/drm/drm_fb_helper.c
··· 1516 1516 } 1517 1517 EXPORT_SYMBOL(drm_fb_helper_initial_config); 1518 1518 1519 - bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper) 1519 + /** 1520 + * drm_fb_helper_hotplug_event - respond to a hotplug notification by 1521 + * probing all the outputs attached to the fb. 1522 + * @fb_helper: the drm_fb_helper 1523 + * 1524 + * LOCKING: 1525 + * Called at runtime, must take mode config lock. 1526 + * 1527 + * Scan the connectors attached to the fb_helper and try to put together a 1528 + * setup after *notification of a change in output configuration. 1529 + * 1530 + * RETURNS: 1531 + * 0 on success and a non-zero error code otherwise. 1532 + */ 1533 + int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper) 1520 1534 { 1535 + struct drm_device *dev = fb_helper->dev; 1521 1536 int count = 0; 1522 1537 u32 max_width, max_height, bpp_sel; 1523 1538 bool bound = false, crtcs_bound = false; 1524 1539 struct drm_crtc *crtc; 1525 1540 1526 1541 if (!fb_helper->fb) 1527 - return false; 1542 + return 0; 1528 1543 1529 - list_for_each_entry(crtc, &fb_helper->dev->mode_config.crtc_list, head) { 1544 + mutex_lock(&dev->mode_config.mutex); 1545 + list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 1530 1546 if (crtc->fb) 1531 1547 crtcs_bound = true; 1532 1548 if (crtc->fb == fb_helper->fb) ··· 1551 1535 1552 1536 if (!bound && crtcs_bound) { 1553 1537 fb_helper->delayed_hotplug = true; 1554 - return false; 1538 + mutex_unlock(&dev->mode_config.mutex); 1539 + return 0; 1555 1540 } 1556 1541 DRM_DEBUG_KMS("\n"); 1557 1542 ··· 1563 1546 count = drm_fb_helper_probe_connector_modes(fb_helper, max_width, 1564 1547 max_height); 1565 1548 drm_setup_crtcs(fb_helper); 1549 + mutex_unlock(&dev->mode_config.mutex); 1566 1550 1567 1551 return drm_fb_helper_single_fb_probe(fb_helper, bpp_sel); 1568 1552 }
+1 -1
drivers/gpu/drm/i915/i915_drv.c
··· 49 49 unsigned int i915_powersave = 1; 50 50 module_param_named(powersave, i915_powersave, int, 0600); 51 51 52 - unsigned int i915_semaphores = 1; 52 + unsigned int i915_semaphores = 0; 53 53 module_param_named(semaphores, i915_semaphores, int, 0600); 54 54 55 55 unsigned int i915_enable_rc6 = 0;
+2
drivers/gpu/drm/i915/intel_display.c
··· 5154 5154 5155 5155 I915_WRITE(DSPCNTR(plane), dspcntr); 5156 5156 POSTING_READ(DSPCNTR(plane)); 5157 + if (!HAS_PCH_SPLIT(dev)) 5158 + intel_enable_plane(dev_priv, plane, pipe); 5157 5159 5158 5160 ret = intel_pipe_set_base(crtc, x, y, old_fb); 5159 5161
+4 -1
drivers/gpu/drm/radeon/evergreen.c
··· 1780 1780 1781 1781 1782 1782 mc_shared_chmap = RREG32(MC_SHARED_CHMAP); 1783 - mc_arb_ramcfg = RREG32(MC_ARB_RAMCFG); 1783 + if (rdev->flags & RADEON_IS_IGP) 1784 + mc_arb_ramcfg = RREG32(FUS_MC_ARB_RAMCFG); 1785 + else 1786 + mc_arb_ramcfg = RREG32(MC_ARB_RAMCFG); 1784 1787 1785 1788 switch (rdev->config.evergreen.max_tile_pipes) { 1786 1789 case 1:
+1
drivers/gpu/drm/radeon/evergreend.h
··· 200 200 #define BURSTLENGTH_SHIFT 9 201 201 #define BURSTLENGTH_MASK 0x00000200 202 202 #define CHANSIZE_OVERRIDE (1 << 11) 203 + #define FUS_MC_ARB_RAMCFG 0x2768 203 204 #define MC_VM_AGP_TOP 0x2028 204 205 #define MC_VM_AGP_BOT 0x202C 205 206 #define MC_VM_AGP_BASE 0x2030
+11 -3
drivers/gpu/drm/radeon/radeon_atombios.c
··· 1574 1574 ATOM_FAKE_EDID_PATCH_RECORD *fake_edid_record; 1575 1575 ATOM_PANEL_RESOLUTION_PATCH_RECORD *panel_res_record; 1576 1576 bool bad_record = false; 1577 - u8 *record = (u8 *)(mode_info->atom_context->bios + 1578 - data_offset + 1579 - le16_to_cpu(lvds_info->info.usModePatchTableOffset)); 1577 + u8 *record; 1578 + 1579 + if ((frev == 1) && (crev < 2)) 1580 + /* absolute */ 1581 + record = (u8 *)(mode_info->atom_context->bios + 1582 + le16_to_cpu(lvds_info->info.usModePatchTableOffset)); 1583 + else 1584 + /* relative */ 1585 + record = (u8 *)(mode_info->atom_context->bios + 1586 + data_offset + 1587 + le16_to_cpu(lvds_info->info.usModePatchTableOffset)); 1580 1588 while (*record != ATOM_RECORD_END_TYPE) { 1581 1589 switch (*record) { 1582 1590 case LCD_MODE_PATCH_RECORD_MODE_TYPE:
+1
drivers/gpu/drm/radeon/reg_srcs/cayman
··· 33 33 0x00008E48 SQ_EX_ALLOC_TABLE_SLOTS 34 34 0x00009100 SPI_CONFIG_CNTL 35 35 0x0000913C SPI_CONFIG_CNTL_1 36 + 0x00009508 TA_CNTL_AUX 36 37 0x00009830 DB_DEBUG 37 38 0x00009834 DB_DEBUG2 38 39 0x00009838 DB_DEBUG3
+1
drivers/gpu/drm/radeon/reg_srcs/evergreen
··· 46 46 0x00008E48 SQ_EX_ALLOC_TABLE_SLOTS 47 47 0x00009100 SPI_CONFIG_CNTL 48 48 0x0000913C SPI_CONFIG_CNTL_1 49 + 0x00009508 TA_CNTL_AUX 49 50 0x00009700 VC_CNTL 50 51 0x00009714 VC_ENHANCE 51 52 0x00009830 DB_DEBUG
+3 -3
drivers/gpu/vga/vga_switcheroo.c
··· 219 219 int i; 220 220 struct vga_switcheroo_client *active = NULL; 221 221 222 - if (new_client->active == true) 223 - return 0; 224 - 225 222 for (i = 0; i < VGA_SWITCHEROO_MAX_CLIENTS; i++) { 226 223 if (vgasr_priv.clients[i].active == true) { 227 224 active = &vgasr_priv.clients[i]; ··· 368 371 ret = vgasr_priv.handler->switchto(client_id); 369 372 goto out; 370 373 } 374 + 375 + if (client->active == true) 376 + goto out; 371 377 372 378 /* okay we want a switch - test if devices are willing to switch */ 373 379 can_switch = true;
+6 -3
drivers/i2c/busses/i2c-mpc.c
··· 560 560 .timeout = HZ, 561 561 }; 562 562 563 + static const struct of_device_id mpc_i2c_of_match[]; 563 564 static int __devinit fsl_i2c_probe(struct platform_device *op) 564 565 { 566 + const struct of_device_id *match; 565 567 struct mpc_i2c *i2c; 566 568 const u32 *prop; 567 569 u32 clock = MPC_I2C_CLOCK_LEGACY; 568 570 int result = 0; 569 571 int plen; 570 572 571 - if (!op->dev.of_match) 573 + match = of_match_device(mpc_i2c_of_match, &op->dev); 574 + if (!match) 572 575 return -EINVAL; 573 576 574 577 i2c = kzalloc(sizeof(*i2c), GFP_KERNEL); ··· 608 605 clock = *prop; 609 606 } 610 607 611 - if (op->dev.of_match->data) { 612 - struct mpc_i2c_data *data = op->dev.of_match->data; 608 + if (match->data) { 609 + struct mpc_i2c_data *data = match->data; 613 610 data->setup(op->dev.of_node, i2c, clock, data->prescaler); 614 611 } else { 615 612 /* Backwards compatibility */
+1 -1
drivers/i2c/busses/i2c-pnx.c
··· 65 65 jiffies, expires); 66 66 67 67 timer->expires = jiffies + expires; 68 - timer->data = (unsigned long)&alg_data; 68 + timer->data = (unsigned long)alg_data; 69 69 70 70 add_timer(timer); 71 71 }
+10 -3
drivers/input/touchscreen/ads7846.c
··· 281 281 u8 command; 282 282 u8 ref_off; 283 283 u16 scratch; 284 - __be16 sample; 285 284 struct spi_message msg; 286 285 struct spi_transfer xfer[6]; 286 + /* 287 + * DMA (thus cache coherency maintenance) requires the 288 + * transfer buffers to live in their own cache lines. 289 + */ 290 + __be16 sample ____cacheline_aligned; 287 291 }; 288 292 289 293 struct ads7845_ser_req { 290 294 u8 command[3]; 291 - u8 pwrdown[3]; 292 - u8 sample[3]; 293 295 struct spi_message msg; 294 296 struct spi_transfer xfer[2]; 297 + /* 298 + * DMA (thus cache coherency maintenance) requires the 299 + * transfer buffers to live in their own cache lines. 300 + */ 301 + u8 sample[3] ____cacheline_aligned; 295 302 }; 296 303 297 304 static int ads7846_read12_ser(struct device *dev, unsigned command)
+1
drivers/leds/leds-lm3530.c
··· 349 349 {LM3530_NAME, 0}, 350 350 {} 351 351 }; 352 + MODULE_DEVICE_TABLE(i2c, lm3530_id); 352 353 353 354 static struct i2c_driver lm3530_i2c_driver = { 354 355 .probe = lm3530_probe,
+1 -1
drivers/media/video/cx88/cx88-input.c
··· 524 524 for (todo = 32; todo > 0; todo -= bits) { 525 525 ev.pulse = samples & 0x80000000 ? false : true; 526 526 bits = min(todo, 32U - fls(ev.pulse ? samples : ~samples)); 527 - ev.duration = (bits * NSEC_PER_SEC) / (1000 * ir_samplerate); 527 + ev.duration = (bits * (NSEC_PER_SEC / 1000)) / ir_samplerate; 528 528 ir_raw_event_store_with_filter(ir->dev, &ev); 529 529 samples <<= bits; 530 530 }
+42 -6
drivers/media/video/soc_camera.c
··· 136 136 } 137 137 EXPORT_SYMBOL(soc_camera_apply_sensor_flags); 138 138 139 + #define pixfmtstr(x) (x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, \ 140 + ((x) >> 24) & 0xff 141 + 142 + static int soc_camera_try_fmt(struct soc_camera_device *icd, 143 + struct v4l2_format *f) 144 + { 145 + struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); 146 + struct v4l2_pix_format *pix = &f->fmt.pix; 147 + int ret; 148 + 149 + dev_dbg(&icd->dev, "TRY_FMT(%c%c%c%c, %ux%u)\n", 150 + pixfmtstr(pix->pixelformat), pix->width, pix->height); 151 + 152 + pix->bytesperline = 0; 153 + pix->sizeimage = 0; 154 + 155 + ret = ici->ops->try_fmt(icd, f); 156 + if (ret < 0) 157 + return ret; 158 + 159 + if (!pix->sizeimage) { 160 + if (!pix->bytesperline) { 161 + const struct soc_camera_format_xlate *xlate; 162 + 163 + xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); 164 + if (!xlate) 165 + return -EINVAL; 166 + 167 + ret = soc_mbus_bytes_per_line(pix->width, 168 + xlate->host_fmt); 169 + if (ret > 0) 170 + pix->bytesperline = ret; 171 + } 172 + if (pix->bytesperline) 173 + pix->sizeimage = pix->bytesperline * pix->height; 174 + } 175 + 176 + return 0; 177 + } 178 + 139 179 static int soc_camera_try_fmt_vid_cap(struct file *file, void *priv, 140 180 struct v4l2_format *f) 141 181 { 142 182 struct soc_camera_device *icd = file->private_data; 143 - struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); 144 183 145 184 WARN_ON(priv != file->private_data); 146 185 ··· 188 149 return -EINVAL; 189 150 190 151 /* limit format to hardware capabilities */ 191 - return ici->ops->try_fmt(icd, f); 152 + return soc_camera_try_fmt(icd, f); 192 153 } 193 154 194 155 static int soc_camera_enum_input(struct file *file, void *priv, ··· 401 362 icd->user_formats = NULL; 402 363 } 403 364 404 - #define pixfmtstr(x) (x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, \ 405 - ((x) >> 24) & 0xff 406 - 407 365 /* Called with .vb_lock held, or from the first open(2), see comment there */ 408 366 static int soc_camera_set_fmt(struct soc_camera_device *icd, 409 367 struct v4l2_format *f) ··· 413 377 pixfmtstr(pix->pixelformat), pix->width, pix->height); 414 378 415 379 /* We always call try_fmt() before set_fmt() or set_crop() */ 416 - ret = ici->ops->try_fmt(icd, f); 380 + ret = soc_camera_try_fmt(icd, f); 417 381 if (ret < 0) 418 382 return ret; 419 383
+4 -1
drivers/media/video/v4l2-device.c
··· 155 155 sd->v4l2_dev = v4l2_dev; 156 156 if (sd->internal_ops && sd->internal_ops->registered) { 157 157 err = sd->internal_ops->registered(sd); 158 - if (err) 158 + if (err) { 159 + module_put(sd->owner); 159 160 return err; 161 + } 160 162 } 161 163 162 164 /* This just returns 0 if either of the two args is NULL */ ··· 166 164 if (err) { 167 165 if (sd->internal_ops && sd->internal_ops->unregistered) 168 166 sd->internal_ops->unregistered(sd); 167 + module_put(sd->owner); 169 168 return err; 170 169 } 171 170
+7 -7
drivers/media/video/v4l2-subdev.c
··· 155 155 156 156 switch (cmd) { 157 157 case VIDIOC_QUERYCTRL: 158 - return v4l2_subdev_queryctrl(sd, arg); 158 + return v4l2_queryctrl(sd->ctrl_handler, arg); 159 159 160 160 case VIDIOC_QUERYMENU: 161 - return v4l2_subdev_querymenu(sd, arg); 161 + return v4l2_querymenu(sd->ctrl_handler, arg); 162 162 163 163 case VIDIOC_G_CTRL: 164 - return v4l2_subdev_g_ctrl(sd, arg); 164 + return v4l2_g_ctrl(sd->ctrl_handler, arg); 165 165 166 166 case VIDIOC_S_CTRL: 167 - return v4l2_subdev_s_ctrl(sd, arg); 167 + return v4l2_s_ctrl(sd->ctrl_handler, arg); 168 168 169 169 case VIDIOC_G_EXT_CTRLS: 170 - return v4l2_subdev_g_ext_ctrls(sd, arg); 170 + return v4l2_g_ext_ctrls(sd->ctrl_handler, arg); 171 171 172 172 case VIDIOC_S_EXT_CTRLS: 173 - return v4l2_subdev_s_ext_ctrls(sd, arg); 173 + return v4l2_s_ext_ctrls(sd->ctrl_handler, arg); 174 174 175 175 case VIDIOC_TRY_EXT_CTRLS: 176 - return v4l2_subdev_try_ext_ctrls(sd, arg); 176 + return v4l2_try_ext_ctrls(sd->ctrl_handler, arg); 177 177 178 178 case VIDIOC_DQEVENT: 179 179 if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS))
-1
drivers/message/i2o/i2o_block.c
··· 1000 1000 gd->major = I2O_MAJOR; 1001 1001 gd->queue = queue; 1002 1002 gd->fops = &i2o_block_fops; 1003 - gd->events = DISK_EVENT_MEDIA_CHANGE; 1004 1003 gd->private_data = dev; 1005 1004 1006 1005 dev->gd = gd;
+5 -4
drivers/mmc/core/host.c
··· 94 94 spin_unlock_irqrestore(&host->clk_lock, flags); 95 95 return; 96 96 } 97 - mmc_claim_host(host); 97 + mutex_lock(&host->clk_gate_mutex); 98 98 spin_lock_irqsave(&host->clk_lock, flags); 99 99 if (!host->clk_requests) { 100 100 spin_unlock_irqrestore(&host->clk_lock, flags); ··· 104 104 pr_debug("%s: gated MCI clock\n", mmc_hostname(host)); 105 105 } 106 106 spin_unlock_irqrestore(&host->clk_lock, flags); 107 - mmc_release_host(host); 107 + mutex_unlock(&host->clk_gate_mutex); 108 108 } 109 109 110 110 /* ··· 130 130 { 131 131 unsigned long flags; 132 132 133 - mmc_claim_host(host); 133 + mutex_lock(&host->clk_gate_mutex); 134 134 spin_lock_irqsave(&host->clk_lock, flags); 135 135 if (host->clk_gated) { 136 136 spin_unlock_irqrestore(&host->clk_lock, flags); ··· 140 140 } 141 141 host->clk_requests++; 142 142 spin_unlock_irqrestore(&host->clk_lock, flags); 143 - mmc_release_host(host); 143 + mutex_unlock(&host->clk_gate_mutex); 144 144 } 145 145 146 146 /** ··· 215 215 host->clk_gated = false; 216 216 INIT_WORK(&host->clk_gate_work, mmc_host_clk_gate_work); 217 217 spin_lock_init(&host->clk_lock); 218 + mutex_init(&host->clk_gate_mutex); 218 219 } 219 220 220 221 /**
+5 -2
drivers/mmc/host/sdhci-of-core.c
··· 124 124 #endif 125 125 } 126 126 127 + static const struct of_device_id sdhci_of_match[]; 127 128 static int __devinit sdhci_of_probe(struct platform_device *ofdev) 128 129 { 130 + const struct of_device_id *match; 129 131 struct device_node *np = ofdev->dev.of_node; 130 132 struct sdhci_of_data *sdhci_of_data; 131 133 struct sdhci_host *host; ··· 136 134 int size; 137 135 int ret; 138 136 139 - if (!ofdev->dev.of_match) 137 + match = of_match_device(sdhci_of_match, &ofdev->dev); 138 + if (!match) 140 139 return -EINVAL; 141 - sdhci_of_data = ofdev->dev.of_match->data; 140 + sdhci_of_data = match->data; 142 141 143 142 if (!of_device_is_available(np)) 144 143 return -ENODEV;
+5 -2
drivers/mtd/maps/physmap_of.c
··· 214 214 } 215 215 #endif 216 216 217 + static struct of_device_id of_flash_match[]; 217 218 static int __devinit of_flash_probe(struct platform_device *dev) 218 219 { 219 220 #ifdef CONFIG_MTD_PARTITIONS 220 221 const char **part_probe_types; 221 222 #endif 223 + const struct of_device_id *match; 222 224 struct device_node *dp = dev->dev.of_node; 223 225 struct resource res; 224 226 struct of_flash *info; ··· 234 232 struct mtd_info **mtd_list = NULL; 235 233 resource_size_t res_size; 236 234 237 - if (!dev->dev.of_match) 235 + match = of_match_device(of_flash_match, &dev->dev); 236 + if (!match) 238 237 return -EINVAL; 239 - probe_type = dev->dev.of_match->data; 238 + probe_type = match->data; 240 239 241 240 reg_tuple_size = (of_n_addr_cells(dp) + of_n_size_cells(dp)) * sizeof(u32); 242 241
+3 -3
drivers/net/Makefile
··· 144 144 obj-$(CONFIG_SB1250_MAC) += sb1250-mac.o 145 145 obj-$(CONFIG_B44) += b44.o 146 146 obj-$(CONFIG_FORCEDETH) += forcedeth.o 147 - obj-$(CONFIG_NE_H8300) += ne-h8300.o 8390.o 147 + obj-$(CONFIG_NE_H8300) += ne-h8300.o 148 148 obj-$(CONFIG_AX88796) += ax88796.o 149 149 obj-$(CONFIG_BCM63XX_ENET) += bcm63xx_enet.o 150 150 obj-$(CONFIG_FTMAC100) += ftmac100.o ··· 219 219 obj-$(CONFIG_LP486E) += lp486e.o 220 220 221 221 obj-$(CONFIG_ETH16I) += eth16i.o 222 - obj-$(CONFIG_ZORRO8390) += zorro8390.o 8390.o 222 + obj-$(CONFIG_ZORRO8390) += zorro8390.o 223 223 obj-$(CONFIG_HPLANCE) += hplance.o 7990.o 224 224 obj-$(CONFIG_MVME147_NET) += mvme147.o 7990.o 225 225 obj-$(CONFIG_EQUALIZER) += eql.o ··· 231 231 obj-$(CONFIG_DECLANCE) += declance.o 232 232 obj-$(CONFIG_ATARILANCE) += atarilance.o 233 233 obj-$(CONFIG_A2065) += a2065.o 234 - obj-$(CONFIG_HYDRA) += hydra.o 8390.o 234 + obj-$(CONFIG_HYDRA) += hydra.o 235 235 obj-$(CONFIG_ARIADNE) += ariadne.o 236 236 obj-$(CONFIG_CS89x0) += cs89x0.o 237 237 obj-$(CONFIG_MACSONIC) += macsonic.o
+5 -5
drivers/net/bonding/bond_3ad.h
··· 39 39 40 40 typedef struct mac_addr { 41 41 u8 mac_addr_value[ETH_ALEN]; 42 - } mac_addr_t; 42 + } __packed mac_addr_t; 43 43 44 44 enum { 45 45 BOND_AD_STABLE = 0, ··· 134 134 u8 tlv_type_terminator; // = terminator 135 135 u8 terminator_length; // = 0 136 136 u8 reserved_50[50]; // = 0 137 - } lacpdu_t; 137 + } __packed lacpdu_t; 138 138 139 139 typedef struct lacpdu_header { 140 140 struct ethhdr hdr; 141 141 struct lacpdu lacpdu; 142 - } lacpdu_header_t; 142 + } __packed lacpdu_header_t; 143 143 144 144 // Marker Protocol Data Unit(PDU) structure(43.5.3.2 in the 802.3ad standard) 145 145 typedef struct bond_marker { ··· 155 155 u8 tlv_type_terminator; // = 0x00 156 156 u8 terminator_length; // = 0x00 157 157 u8 reserved_90[90]; // = 0 158 - } bond_marker_t; 158 + } __packed bond_marker_t; 159 159 160 160 typedef struct bond_marker_header { 161 161 struct ethhdr hdr; 162 162 struct bond_marker marker; 163 - } bond_marker_header_t; 163 + } __packed bond_marker_header_t; 164 164 165 165 #pragma pack() 166 166
+5 -2
drivers/net/can/mscan/mpc5xxx_can.c
··· 247 247 } 248 248 #endif /* CONFIG_PPC_MPC512x */ 249 249 250 + static struct of_device_id mpc5xxx_can_table[]; 250 251 static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev) 251 252 { 253 + const struct of_device_id *match; 252 254 struct mpc5xxx_can_data *data; 253 255 struct device_node *np = ofdev->dev.of_node; 254 256 struct net_device *dev; ··· 260 258 int irq, mscan_clksrc = 0; 261 259 int err = -ENOMEM; 262 260 263 - if (!ofdev->dev.of_match) 261 + match = of_match_device(mpc5xxx_can_table, &ofdev->dev); 262 + if (!match) 264 263 return -EINVAL; 265 - data = (struct mpc5xxx_can_data *)ofdev->dev.of_match->data; 264 + data = match->data; 266 265 267 266 base = of_iomap(np, 0); 268 267 if (!base) {
+3 -3
drivers/net/ehea/ehea_main.c
··· 2688 2688 netif_start_queue(dev); 2689 2689 } 2690 2690 2691 - init_waitqueue_head(&port->swqe_avail_wq); 2692 - init_waitqueue_head(&port->restart_wq); 2693 - 2694 2691 mutex_unlock(&port->port_lock); 2695 2692 2696 2693 return ret; ··· 3272 3275 dev->features |= NETIF_F_LRO; 3273 3276 3274 3277 INIT_WORK(&port->reset_task, ehea_reset_port); 3278 + 3279 + init_waitqueue_head(&port->swqe_avail_wq); 3280 + init_waitqueue_head(&port->restart_wq); 3275 3281 3276 3282 ret = register_netdev(dev); 3277 3283 if (ret) {
+6 -3
drivers/net/fs_enet/fs_enet-main.c
··· 998 998 #endif 999 999 }; 1000 1000 1001 + static struct of_device_id fs_enet_match[]; 1001 1002 static int __devinit fs_enet_probe(struct platform_device *ofdev) 1002 1003 { 1004 + const struct of_device_id *match; 1003 1005 struct net_device *ndev; 1004 1006 struct fs_enet_private *fep; 1005 1007 struct fs_platform_info *fpi; ··· 1009 1007 const u8 *mac_addr; 1010 1008 int privsize, len, ret = -ENODEV; 1011 1009 1012 - if (!ofdev->dev.of_match) 1010 + match = of_match_device(fs_enet_match, &ofdev->dev); 1011 + if (!match) 1013 1012 return -EINVAL; 1014 1013 1015 1014 fpi = kzalloc(sizeof(*fpi), GFP_KERNEL); 1016 1015 if (!fpi) 1017 1016 return -ENOMEM; 1018 1017 1019 - if (!IS_FEC(ofdev->dev.of_match)) { 1018 + if (!IS_FEC(match)) { 1020 1019 data = of_get_property(ofdev->dev.of_node, "fsl,cpm-command", &len); 1021 1020 if (!data || len != 4) 1022 1021 goto out_free_fpi; ··· 1052 1049 fep->dev = &ofdev->dev; 1053 1050 fep->ndev = ndev; 1054 1051 fep->fpi = fpi; 1055 - fep->ops = ofdev->dev.of_match->data; 1052 + fep->ops = match->data; 1056 1053 1057 1054 ret = fep->ops->setup_data(ndev); 1058 1055 if (ret)
+5 -2
drivers/net/fs_enet/mii-fec.c
··· 101 101 return 0; 102 102 } 103 103 104 + static struct of_device_id fs_enet_mdio_fec_match[]; 104 105 static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev) 105 106 { 107 + const struct of_device_id *match; 106 108 struct resource res; 107 109 struct mii_bus *new_bus; 108 110 struct fec_info *fec; 109 111 int (*get_bus_freq)(struct device_node *); 110 112 int ret = -ENOMEM, clock, speed; 111 113 112 - if (!ofdev->dev.of_match) 114 + match = of_match_device(fs_enet_mdio_fec_match, &ofdev->dev); 115 + if (!match) 113 116 return -EINVAL; 114 - get_bus_freq = ofdev->dev.of_match->data; 117 + get_bus_freq = match->data; 115 118 116 119 new_bus = mdiobus_alloc(); 117 120 if (!new_bus)
+7 -7
drivers/net/hydra.c
··· 98 98 .ndo_open = hydra_open, 99 99 .ndo_stop = hydra_close, 100 100 101 - .ndo_start_xmit = ei_start_xmit, 102 - .ndo_tx_timeout = ei_tx_timeout, 103 - .ndo_get_stats = ei_get_stats, 104 - .ndo_set_multicast_list = ei_set_multicast_list, 101 + .ndo_start_xmit = __ei_start_xmit, 102 + .ndo_tx_timeout = __ei_tx_timeout, 103 + .ndo_get_stats = __ei_get_stats, 104 + .ndo_set_multicast_list = __ei_set_multicast_list, 105 105 .ndo_validate_addr = eth_validate_addr, 106 - .ndo_set_mac_address = eth_mac_addr, 106 + .ndo_set_mac_address = eth_mac_addr, 107 107 .ndo_change_mtu = eth_change_mtu, 108 108 #ifdef CONFIG_NET_POLL_CONTROLLER 109 - .ndo_poll_controller = ei_poll, 109 + .ndo_poll_controller = __ei_poll, 110 110 #endif 111 111 }; 112 112 ··· 125 125 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e, 126 126 }; 127 127 128 - dev = alloc_ei_netdev(); 128 + dev = ____alloc_ei_netdev(0); 129 129 if (!dev) 130 130 return -ENOMEM; 131 131
+8 -8
drivers/net/ne-h8300.c
··· 167 167 #ifndef MODULE 168 168 struct net_device * __init ne_probe(int unit) 169 169 { 170 - struct net_device *dev = alloc_ei_netdev(); 170 + struct net_device *dev = ____alloc_ei_netdev(0); 171 171 int err; 172 172 173 173 if (!dev) ··· 197 197 .ndo_open = ne_open, 198 198 .ndo_stop = ne_close, 199 199 200 - .ndo_start_xmit = ei_start_xmit, 201 - .ndo_tx_timeout = ei_tx_timeout, 202 - .ndo_get_stats = ei_get_stats, 203 - .ndo_set_multicast_list = ei_set_multicast_list, 200 + .ndo_start_xmit = __ei_start_xmit, 201 + .ndo_tx_timeout = __ei_tx_timeout, 202 + .ndo_get_stats = __ei_get_stats, 203 + .ndo_set_multicast_list = __ei_set_multicast_list, 204 204 .ndo_validate_addr = eth_validate_addr, 205 - .ndo_set_mac_address = eth_mac_addr, 205 + .ndo_set_mac_address = eth_mac_addr, 206 206 .ndo_change_mtu = eth_change_mtu, 207 207 #ifdef CONFIG_NET_POLL_CONTROLLER 208 - .ndo_poll_controller = ei_poll, 208 + .ndo_poll_controller = __ei_poll, 209 209 #endif 210 210 }; 211 211 ··· 637 637 int err; 638 638 639 639 for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) { 640 - struct net_device *dev = alloc_ei_netdev(); 640 + struct net_device *dev = ____alloc_ei_netdev(0); 641 641 if (!dev) 642 642 break; 643 643 if (io[this_dev]) {
+30 -19
drivers/net/sfc/mcdi.c
··· 50 50 return &nic_data->mcdi; 51 51 } 52 52 53 + static inline void 54 + efx_mcdi_readd(struct efx_nic *efx, efx_dword_t *value, unsigned reg) 55 + { 56 + struct siena_nic_data *nic_data = efx->nic_data; 57 + value->u32[0] = (__force __le32)__raw_readl(nic_data->mcdi_smem + reg); 58 + } 59 + 60 + static inline void 61 + efx_mcdi_writed(struct efx_nic *efx, const efx_dword_t *value, unsigned reg) 62 + { 63 + struct siena_nic_data *nic_data = efx->nic_data; 64 + __raw_writel((__force u32)value->u32[0], nic_data->mcdi_smem + reg); 65 + } 66 + 53 67 void efx_mcdi_init(struct efx_nic *efx) 54 68 { 55 69 struct efx_mcdi_iface *mcdi; ··· 84 70 const u8 *inbuf, size_t inlen) 85 71 { 86 72 struct efx_mcdi_iface *mcdi = efx_mcdi(efx); 87 - unsigned pdu = FR_CZ_MC_TREG_SMEM + MCDI_PDU(efx); 88 - unsigned doorbell = FR_CZ_MC_TREG_SMEM + MCDI_DOORBELL(efx); 73 + unsigned pdu = MCDI_PDU(efx); 74 + unsigned doorbell = MCDI_DOORBELL(efx); 89 75 unsigned int i; 90 76 efx_dword_t hdr; 91 77 u32 xflags, seqno; ··· 106 92 MCDI_HEADER_SEQ, seqno, 107 93 MCDI_HEADER_XFLAGS, xflags); 108 94 109 - efx_writed(efx, &hdr, pdu); 95 + efx_mcdi_writed(efx, &hdr, pdu); 110 96 111 - for (i = 0; i < inlen; i += 4) { 112 - _efx_writed(efx, *((__le32 *)(inbuf + i)), pdu + 4 + i); 113 - /* use wmb() within loop to inhibit write combining */ 114 - wmb(); 115 - } 97 + for (i = 0; i < inlen; i += 4) 98 + efx_mcdi_writed(efx, (const efx_dword_t *)(inbuf + i), 99 + pdu + 4 + i); 116 100 117 101 /* ring the doorbell with a distinctive value */ 118 - _efx_writed(efx, (__force __le32) 0x45789abc, doorbell); 119 - wmb(); 102 + EFX_POPULATE_DWORD_1(hdr, EFX_DWORD_0, 0x45789abc); 103 + efx_mcdi_writed(efx, &hdr, doorbell); 120 104 } 121 105 122 106 static void efx_mcdi_copyout(struct efx_nic *efx, u8 *outbuf, size_t outlen) 123 107 { 124 108 struct efx_mcdi_iface *mcdi = efx_mcdi(efx); 125 - unsigned int pdu = FR_CZ_MC_TREG_SMEM + MCDI_PDU(efx); 109 + unsigned int pdu = MCDI_PDU(efx); 126 110 int i; 127 111 128 112 BUG_ON(atomic_read(&mcdi->state) == MCDI_STATE_QUIESCENT); 129 113 BUG_ON(outlen & 3 || outlen >= 0x100); 130 114 131 115 for (i = 0; i < outlen; i += 4) 132 - *((__le32 *)(outbuf + i)) = _efx_readd(efx, pdu + 4 + i); 116 + efx_mcdi_readd(efx, (efx_dword_t *)(outbuf + i), pdu + 4 + i); 133 117 } 134 118 135 119 static int efx_mcdi_poll(struct efx_nic *efx) ··· 135 123 struct efx_mcdi_iface *mcdi = efx_mcdi(efx); 136 124 unsigned int time, finish; 137 125 unsigned int respseq, respcmd, error; 138 - unsigned int pdu = FR_CZ_MC_TREG_SMEM + MCDI_PDU(efx); 126 + unsigned int pdu = MCDI_PDU(efx); 139 127 unsigned int rc, spins; 140 128 efx_dword_t reg; 141 129 ··· 161 149 162 150 time = get_seconds(); 163 151 164 - rmb(); 165 - efx_readd(efx, &reg, pdu); 152 + efx_mcdi_readd(efx, &reg, pdu); 166 153 167 154 /* All 1's indicates that shared memory is in reset (and is 168 155 * not a valid header). Wait for it to come out reset before ··· 188 177 respseq, mcdi->seqno); 189 178 rc = EIO; 190 179 } else if (error) { 191 - efx_readd(efx, &reg, pdu + 4); 180 + efx_mcdi_readd(efx, &reg, pdu + 4); 192 181 switch (EFX_DWORD_FIELD(reg, EFX_DWORD_0)) { 193 182 #define TRANSLATE_ERROR(name) \ 194 183 case MC_CMD_ERR_ ## name: \ ··· 222 211 /* Test and clear MC-rebooted flag for this port/function */ 223 212 int efx_mcdi_poll_reboot(struct efx_nic *efx) 224 213 { 225 - unsigned int addr = FR_CZ_MC_TREG_SMEM + MCDI_REBOOT_FLAG(efx); 214 + unsigned int addr = MCDI_REBOOT_FLAG(efx); 226 215 efx_dword_t reg; 227 216 uint32_t value; 228 217 229 218 if (efx_nic_rev(efx) < EFX_REV_SIENA_A0) 230 219 return false; 231 220 232 - efx_readd(efx, &reg, addr); 221 + efx_mcdi_readd(efx, &reg, addr); 233 222 value = EFX_DWORD_FIELD(reg, EFX_DWORD_0); 234 223 235 224 if (value == 0) 236 225 return 0; 237 226 238 227 EFX_ZERO_DWORD(reg); 239 - efx_writed(efx, &reg, addr); 228 + efx_mcdi_writed(efx, &reg, addr); 240 229 241 230 if (value == MC_STATUS_DWORD_ASSERT) 242 231 return -EINTR;
+7
drivers/net/sfc/nic.c
··· 1937 1937 1938 1938 size = min_t(size_t, table->step, 16); 1939 1939 1940 + if (table->offset >= efx->type->mem_map_size) { 1941 + /* No longer mapped; return dummy data */ 1942 + memcpy(buf, "\xde\xc0\xad\xde", 4); 1943 + buf += table->rows * size; 1944 + continue; 1945 + } 1946 + 1940 1947 for (i = 0; i < table->rows; i++) { 1941 1948 switch (table->step) { 1942 1949 case 4: /* 32-bit register or SRAM */
+2
drivers/net/sfc/nic.h
··· 143 143 /** 144 144 * struct siena_nic_data - Siena NIC state 145 145 * @mcdi: Management-Controller-to-Driver Interface 146 + * @mcdi_smem: MCDI shared memory mapping. The mapping is always uncacheable. 146 147 * @wol_filter_id: Wake-on-LAN packet filter id 147 148 */ 148 149 struct siena_nic_data { 149 150 struct efx_mcdi_iface mcdi; 151 + void __iomem *mcdi_smem; 150 152 int wol_filter_id; 151 153 }; 152 154
+21 -4
drivers/net/sfc/siena.c
··· 220 220 efx_reado(efx, &reg, FR_AZ_CS_DEBUG); 221 221 efx->net_dev->dev_id = EFX_OWORD_FIELD(reg, FRF_CZ_CS_PORT_NUM) - 1; 222 222 223 + /* Initialise MCDI */ 224 + nic_data->mcdi_smem = ioremap_nocache(efx->membase_phys + 225 + FR_CZ_MC_TREG_SMEM, 226 + FR_CZ_MC_TREG_SMEM_STEP * 227 + FR_CZ_MC_TREG_SMEM_ROWS); 228 + if (!nic_data->mcdi_smem) { 229 + netif_err(efx, probe, efx->net_dev, 230 + "could not map MCDI at %llx+%x\n", 231 + (unsigned long long)efx->membase_phys + 232 + FR_CZ_MC_TREG_SMEM, 233 + FR_CZ_MC_TREG_SMEM_STEP * FR_CZ_MC_TREG_SMEM_ROWS); 234 + rc = -ENOMEM; 235 + goto fail1; 236 + } 223 237 efx_mcdi_init(efx); 224 238 225 239 /* Recover from a failed assertion before probing */ 226 240 rc = efx_mcdi_handle_assertion(efx); 227 241 if (rc) 228 - goto fail1; 242 + goto fail2; 229 243 230 244 /* Let the BMC know that the driver is now in charge of link and 231 245 * filter settings. We must do this before we reset the NIC */ ··· 294 280 fail3: 295 281 efx_mcdi_drv_attach(efx, false, NULL); 296 282 fail2: 283 + iounmap(nic_data->mcdi_smem); 297 284 fail1: 298 285 kfree(efx->nic_data); 299 286 return rc; ··· 374 359 375 360 static void siena_remove_nic(struct efx_nic *efx) 376 361 { 362 + struct siena_nic_data *nic_data = efx->nic_data; 363 + 377 364 efx_nic_free_buffer(efx, &efx->irq_status); 378 365 379 366 siena_reset_hw(efx, RESET_TYPE_ALL); ··· 385 368 efx_mcdi_drv_attach(efx, false, NULL); 386 369 387 370 /* Tear down the private nic state */ 388 - kfree(efx->nic_data); 371 + iounmap(nic_data->mcdi_smem); 372 + kfree(nic_data); 389 373 efx->nic_data = NULL; 390 374 } 391 375 ··· 624 606 .default_mac_ops = &efx_mcdi_mac_operations, 625 607 626 608 .revision = EFX_REV_SIENA_A0, 627 - .mem_map_size = (FR_CZ_MC_TREG_SMEM + 628 - FR_CZ_MC_TREG_SMEM_STEP * FR_CZ_MC_TREG_SMEM_ROWS), 609 + .mem_map_size = FR_CZ_MC_TREG_SMEM, /* MC_TREG_SMEM mapped separately */ 629 610 .txd_ptr_tbl_base = FR_BZ_TX_DESC_PTR_TBL, 630 611 .rxd_ptr_tbl_base = FR_BZ_RX_DESC_PTR_TBL, 631 612 .buf_tbl_base = FR_BZ_BUF_FULL_TBL,
+5 -2
drivers/net/sunhme.c
··· 3237 3237 #endif 3238 3238 3239 3239 #ifdef CONFIG_SBUS 3240 + static const struct of_device_id hme_sbus_match[]; 3240 3241 static int __devinit hme_sbus_probe(struct platform_device *op) 3241 3242 { 3243 + const struct of_device_id *match; 3242 3244 struct device_node *dp = op->dev.of_node; 3243 3245 const char *model = of_get_property(dp, "model", NULL); 3244 3246 int is_qfe; 3245 3247 3246 - if (!op->dev.of_match) 3248 + match = of_match_device(hme_sbus_match, &op->dev); 3249 + if (!match) 3247 3250 return -EINVAL; 3248 - is_qfe = (op->dev.of_match->data != NULL); 3251 + is_qfe = (match->data != NULL); 3249 3252 3250 3253 if (!is_qfe && model && !strcmp(model, "SUNW,sbus-qfe")) 3251 3254 is_qfe = 1;
+3
drivers/net/vmxnet3/vmxnet3_ethtool.c
··· 311 311 /* toggle the LRO feature*/ 312 312 netdev->features ^= NETIF_F_LRO; 313 313 314 + /* Update private LRO flag */ 315 + adapter->lro = lro_requested; 316 + 314 317 /* update harware LRO capability accordingly */ 315 318 if (lro_requested) 316 319 adapter->shared->devRead.misc.uptFeatures |=
+8
drivers/net/wireless/ath/ath9k/main.c
··· 2141 2141 static void ath9k_flush(struct ieee80211_hw *hw, bool drop) 2142 2142 { 2143 2143 struct ath_softc *sc = hw->priv; 2144 + struct ath_hw *ah = sc->sc_ah; 2145 + struct ath_common *common = ath9k_hw_common(ah); 2144 2146 int timeout = 200; /* ms */ 2145 2147 int i, j; 2146 2148 ··· 2150 2148 mutex_lock(&sc->mutex); 2151 2149 2152 2150 cancel_delayed_work_sync(&sc->tx_complete_work); 2151 + 2152 + if (sc->sc_flags & SC_OP_INVALID) { 2153 + ath_dbg(common, ATH_DBG_ANY, "Device not present\n"); 2154 + mutex_unlock(&sc->mutex); 2155 + return; 2156 + } 2153 2157 2154 2158 if (drop) 2155 2159 timeout = 1;
+7
drivers/net/wireless/iwlegacy/iwl-core.c
··· 2155 2155 goto set_ch_out; 2156 2156 } 2157 2157 2158 + if (priv->iw_mode == NL80211_IFTYPE_ADHOC && 2159 + !iwl_legacy_is_channel_ibss(ch_info)) { 2160 + IWL_DEBUG_MAC80211(priv, "leave - not IBSS channel\n"); 2161 + ret = -EINVAL; 2162 + goto set_ch_out; 2163 + } 2164 + 2158 2165 spin_lock_irqsave(&priv->lock, flags); 2159 2166 2160 2167 for_each_context(priv, ctx) {
+6
drivers/net/wireless/iwlegacy/iwl-dev.h
··· 1411 1411 return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0; 1412 1412 } 1413 1413 1414 + static inline int 1415 + iwl_legacy_is_channel_ibss(const struct iwl_channel_info *ch) 1416 + { 1417 + return (ch->flags & EEPROM_CHANNEL_IBSS) ? 1 : 0; 1418 + } 1419 + 1414 1420 static inline void 1415 1421 __iwl_legacy_free_pages(struct iwl_priv *priv, struct page *page) 1416 1422 {
+4 -2
drivers/net/wireless/libertas/cmd.c
··· 1339 1339 cpu_to_le16(PS_MODE_ACTION_EXIT_PS)) { 1340 1340 lbs_deb_host( 1341 1341 "EXEC_NEXT_CMD: ignore ENTER_PS cmd\n"); 1342 - list_del(&cmdnode->list); 1343 1342 spin_lock_irqsave(&priv->driver_lock, flags); 1343 + list_del(&cmdnode->list); 1344 1344 lbs_complete_command(priv, cmdnode, 0); 1345 1345 spin_unlock_irqrestore(&priv->driver_lock, flags); 1346 1346 ··· 1352 1352 (priv->psstate == PS_STATE_PRE_SLEEP)) { 1353 1353 lbs_deb_host( 1354 1354 "EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n"); 1355 - list_del(&cmdnode->list); 1356 1355 spin_lock_irqsave(&priv->driver_lock, flags); 1356 + list_del(&cmdnode->list); 1357 1357 lbs_complete_command(priv, cmdnode, 0); 1358 1358 spin_unlock_irqrestore(&priv->driver_lock, flags); 1359 1359 priv->needtowakeup = 1; ··· 1366 1366 "EXEC_NEXT_CMD: sending EXIT_PS\n"); 1367 1367 } 1368 1368 } 1369 + spin_lock_irqsave(&priv->driver_lock, flags); 1369 1370 list_del(&cmdnode->list); 1371 + spin_unlock_irqrestore(&priv->driver_lock, flags); 1370 1372 lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n", 1371 1373 le16_to_cpu(cmd->command)); 1372 1374 lbs_submit_command(priv, cmdnode);
+6 -6
drivers/net/zorro8390.c
··· 126 126 127 127 board = z->resource.start; 128 128 ioaddr = board+cards[i].offset; 129 - dev = alloc_ei_netdev(); 129 + dev = ____alloc_ei_netdev(0); 130 130 if (!dev) 131 131 return -ENOMEM; 132 132 if (!request_mem_region(ioaddr, NE_IO_EXTENT*2, DRV_NAME)) { ··· 146 146 static const struct net_device_ops zorro8390_netdev_ops = { 147 147 .ndo_open = zorro8390_open, 148 148 .ndo_stop = zorro8390_close, 149 - .ndo_start_xmit = ei_start_xmit, 150 - .ndo_tx_timeout = ei_tx_timeout, 151 - .ndo_get_stats = ei_get_stats, 152 - .ndo_set_multicast_list = ei_set_multicast_list, 149 + .ndo_start_xmit = __ei_start_xmit, 150 + .ndo_tx_timeout = __ei_tx_timeout, 151 + .ndo_get_stats = __ei_get_stats, 152 + .ndo_set_multicast_list = __ei_set_multicast_list, 153 153 .ndo_validate_addr = eth_validate_addr, 154 154 .ndo_set_mac_address = eth_mac_addr, 155 155 .ndo_change_mtu = eth_change_mtu, 156 156 #ifdef CONFIG_NET_POLL_CONTROLLER 157 - .ndo_poll_controller = ei_poll, 157 + .ndo_poll_controller = __ei_poll, 158 158 #endif 159 159 }; 160 160
+2 -2
drivers/pci/setup-bus.c
··· 579 579 } 580 580 size0 = calculate_iosize(size, min_size, size1, 581 581 resource_size(b_res), 4096); 582 - size1 = !add_size? size0: 582 + size1 = (!add_head || (add_head && !add_size)) ? size0 : 583 583 calculate_iosize(size, min_size+add_size, size1, 584 584 resource_size(b_res), 4096); 585 585 if (!size0 && !size1) { ··· 677 677 align += aligns[order]; 678 678 } 679 679 size0 = calculate_memsize(size, min_size, 0, resource_size(b_res), min_align); 680 - size1 = !add_size ? size : 680 + size1 = (!add_head || (add_head && !add_size)) ? size0 : 681 681 calculate_memsize(size, min_size+add_size, 0, 682 682 resource_size(b_res), min_align); 683 683 if (!size0 && !size1) {
+9
drivers/rapidio/switches/idt_gen2.c
··· 95 95 else 96 96 table++; 97 97 98 + if (route_port == RIO_INVALID_ROUTE) 99 + route_port = IDT_DEFAULT_ROUTE; 100 + 98 101 rio_mport_write_config_32(mport, destid, hopcount, 99 102 LOCAL_RTE_CONF_DESTID_SEL, table); 100 103 ··· 413 410 rdev->rswitch->em_init = idtg2_em_init; 414 411 rdev->rswitch->em_handle = idtg2_em_handler; 415 412 rdev->rswitch->sw_sysfs = idtg2_sysfs; 413 + 414 + if (do_enum) { 415 + /* Ensure that default routing is disabled on startup */ 416 + rio_write_config_32(rdev, 417 + RIO_STD_RTE_DEFAULT_PORT, IDT_NO_ROUTE); 418 + } 416 419 417 420 return 0; 418 421 }
+6
drivers/rapidio/switches/idtcps.c
··· 26 26 { 27 27 u32 result; 28 28 29 + if (route_port == RIO_INVALID_ROUTE) 30 + route_port = CPS_DEFAULT_ROUTE; 31 + 29 32 if (table == RIO_GLOBAL_TABLE) { 30 33 rio_mport_write_config_32(mport, destid, hopcount, 31 34 RIO_STD_RTE_CONF_DESTID_SEL_CSR, route_destid); ··· 133 130 /* set TVAL = ~50us */ 134 131 rio_write_config_32(rdev, 135 132 rdev->phys_efptr + RIO_PORT_LINKTO_CTL_CSR, 0x8e << 8); 133 + /* Ensure that default routing is disabled on startup */ 134 + rio_write_config_32(rdev, 135 + RIO_STD_RTE_DEFAULT_PORT, CPS_NO_ROUTE); 136 136 } 137 137 138 138 return 0;
+6
drivers/rapidio/switches/tsi57x.c
··· 303 303 rdev->rswitch->em_init = tsi57x_em_init; 304 304 rdev->rswitch->em_handle = tsi57x_em_handler; 305 305 306 + if (do_enum) { 307 + /* Ensure that default routing is disabled on startup */ 308 + rio_write_config_32(rdev, RIO_STD_RTE_DEFAULT_PORT, 309 + RIO_INVALID_ROUTE); 310 + } 311 + 306 312 return 0; 307 313 } 308 314
+3 -2
drivers/rtc/rtc-davinci.c
··· 524 524 goto fail2; 525 525 } 526 526 527 + platform_set_drvdata(pdev, davinci_rtc); 528 + 527 529 davinci_rtc->rtc = rtc_device_register(pdev->name, &pdev->dev, 528 530 &davinci_rtc_ops, THIS_MODULE); 529 531 if (IS_ERR(davinci_rtc->rtc)) { ··· 555 553 556 554 rtcss_write(davinci_rtc, PRTCSS_RTC_CCTRL_CAEN, PRTCSS_RTC_CCTRL); 557 555 558 - platform_set_drvdata(pdev, davinci_rtc); 559 - 560 556 device_init_wakeup(&pdev->dev, 0); 561 557 562 558 return 0; ··· 562 562 fail4: 563 563 rtc_device_unregister(davinci_rtc->rtc); 564 564 fail3: 565 + platform_set_drvdata(pdev, NULL); 565 566 iounmap(davinci_rtc->base); 566 567 fail2: 567 568 release_mem_region(davinci_rtc->pbase, davinci_rtc->base_size);
+1 -1
drivers/rtc/rtc-ds1286.c
··· 355 355 goto out; 356 356 } 357 357 spin_lock_init(&priv->lock); 358 + platform_set_drvdata(pdev, priv); 358 359 rtc = rtc_device_register("ds1286", &pdev->dev, 359 360 &ds1286_ops, THIS_MODULE); 360 361 if (IS_ERR(rtc)) { ··· 363 362 goto out; 364 363 } 365 364 priv->rtc = rtc; 366 - platform_set_drvdata(pdev, priv); 367 365 return 0; 368 366 369 367 out:
+2 -3
drivers/rtc/rtc-ep93xx.c
··· 151 151 return -ENXIO; 152 152 153 153 pdev->dev.platform_data = ep93xx_rtc; 154 + platform_set_drvdata(pdev, rtc); 154 155 155 156 rtc = rtc_device_register(pdev->name, 156 157 &pdev->dev, &ep93xx_rtc_ops, THIS_MODULE); ··· 160 159 goto exit; 161 160 } 162 161 163 - platform_set_drvdata(pdev, rtc); 164 - 165 162 err = sysfs_create_group(&pdev->dev.kobj, &ep93xx_rtc_sysfs_files); 166 163 if (err) 167 164 goto fail; ··· 167 168 return 0; 168 169 169 170 fail: 170 - platform_set_drvdata(pdev, NULL); 171 171 rtc_device_unregister(rtc); 172 172 exit: 173 + platform_set_drvdata(pdev, NULL); 173 174 pdev->dev.platform_data = NULL; 174 175 return err; 175 176 }
+3 -2
drivers/rtc/rtc-m41t80.c
··· 783 783 goto exit; 784 784 } 785 785 786 + clientdata->features = id->driver_data; 787 + i2c_set_clientdata(client, clientdata); 788 + 786 789 rtc = rtc_device_register(client->name, &client->dev, 787 790 &m41t80_rtc_ops, THIS_MODULE); 788 791 if (IS_ERR(rtc)) { ··· 795 792 } 796 793 797 794 clientdata->rtc = rtc; 798 - clientdata->features = id->driver_data; 799 - i2c_set_clientdata(client, clientdata); 800 795 801 796 /* Make sure HT (Halt Update) bit is cleared */ 802 797 rc = i2c_smbus_read_byte_data(client, M41T80_REG_ALARM_HOUR);
+3 -2
drivers/rtc/rtc-max8925.c
··· 258 258 } 259 259 260 260 dev_set_drvdata(&pdev->dev, info); 261 + /* XXX - isn't this redundant? */ 262 + platform_set_drvdata(pdev, info); 261 263 262 264 info->rtc_dev = rtc_device_register("max8925-rtc", &pdev->dev, 263 265 &max8925_rtc_ops, THIS_MODULE); ··· 269 267 goto out_rtc; 270 268 } 271 269 272 - platform_set_drvdata(pdev, info); 273 - 274 270 return 0; 275 271 out_rtc: 272 + platform_set_drvdata(pdev, NULL); 276 273 free_irq(chip->irq_base + MAX8925_IRQ_RTC_ALARM0, info); 277 274 out_irq: 278 275 kfree(info);
+3 -2
drivers/rtc/rtc-max8998.c
··· 265 265 info->rtc = max8998->rtc; 266 266 info->irq = max8998->irq_base + MAX8998_IRQ_ALARM0; 267 267 268 + platform_set_drvdata(pdev, info); 269 + 268 270 info->rtc_dev = rtc_device_register("max8998-rtc", &pdev->dev, 269 271 &max8998_rtc_ops, THIS_MODULE); 270 272 ··· 275 273 dev_err(&pdev->dev, "Failed to register RTC device: %d\n", ret); 276 274 goto out_rtc; 277 275 } 278 - 279 - platform_set_drvdata(pdev, info); 280 276 281 277 ret = request_threaded_irq(info->irq, NULL, max8998_rtc_alarm_irq, 0, 282 278 "rtc-alarm0", info); ··· 293 293 return 0; 294 294 295 295 out_rtc: 296 + platform_set_drvdata(pdev, NULL); 296 297 kfree(info); 297 298 return ret; 298 299 }
+6 -2
drivers/rtc/rtc-mc13xxx.c
··· 349 349 if (ret) 350 350 goto err_alarm_irq_request; 351 351 352 + mc13xxx_unlock(mc13xxx); 353 + 352 354 priv->rtc = rtc_device_register(pdev->name, 353 355 &pdev->dev, &mc13xxx_rtc_ops, THIS_MODULE); 354 356 if (IS_ERR(priv->rtc)) { 355 357 ret = PTR_ERR(priv->rtc); 358 + 359 + mc13xxx_lock(mc13xxx); 356 360 357 361 mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_TODA, priv); 358 362 err_alarm_irq_request: ··· 369 365 mc13xxx_irq_free(mc13xxx, MC13XXX_IRQ_RTCRST, priv); 370 366 err_reset_irq_request: 371 367 368 + mc13xxx_unlock(mc13xxx); 369 + 372 370 platform_set_drvdata(pdev, NULL); 373 371 kfree(priv); 374 372 } 375 - 376 - mc13xxx_unlock(mc13xxx); 377 373 378 374 return ret; 379 375 }
+2 -1
drivers/rtc/rtc-msm6242.c
··· 214 214 error = -ENOMEM; 215 215 goto out_free_priv; 216 216 } 217 + platform_set_drvdata(dev, priv); 217 218 218 219 rtc = rtc_device_register("rtc-msm6242", &dev->dev, &msm6242_rtc_ops, 219 220 THIS_MODULE); ··· 224 223 } 225 224 226 225 priv->rtc = rtc; 227 - platform_set_drvdata(dev, priv); 228 226 return 0; 229 227 230 228 out_unmap: 229 + platform_set_drvdata(dev, NULL); 231 230 iounmap(priv->regs); 232 231 out_free_priv: 233 232 kfree(priv);
+11 -8
drivers/rtc/rtc-mxc.c
··· 418 418 goto exit_put_clk; 419 419 } 420 420 421 - rtc = rtc_device_register(pdev->name, &pdev->dev, &mxc_rtc_ops, 422 - THIS_MODULE); 423 - if (IS_ERR(rtc)) { 424 - ret = PTR_ERR(rtc); 425 - goto exit_put_clk; 426 - } 427 - 428 - pdata->rtc = rtc; 429 421 platform_set_drvdata(pdev, pdata); 430 422 431 423 /* Configure and enable the RTC */ ··· 430 438 pdata->irq = -1; 431 439 } 432 440 441 + rtc = rtc_device_register(pdev->name, &pdev->dev, &mxc_rtc_ops, 442 + THIS_MODULE); 443 + if (IS_ERR(rtc)) { 444 + ret = PTR_ERR(rtc); 445 + goto exit_clr_drvdata; 446 + } 447 + 448 + pdata->rtc = rtc; 449 + 433 450 return 0; 434 451 452 + exit_clr_drvdata: 453 + platform_set_drvdata(pdev, NULL); 435 454 exit_put_clk: 436 455 clk_disable(pdata->clk); 437 456 clk_put(pdata->clk);
+3 -1
drivers/rtc/rtc-pcap.c
··· 151 151 152 152 pcap_rtc->pcap = dev_get_drvdata(pdev->dev.parent); 153 153 154 + platform_set_drvdata(pdev, pcap_rtc); 155 + 154 156 pcap_rtc->rtc = rtc_device_register("pcap", &pdev->dev, 155 157 &pcap_rtc_ops, THIS_MODULE); 156 158 if (IS_ERR(pcap_rtc->rtc)) { ··· 160 158 goto fail_rtc; 161 159 } 162 160 163 - platform_set_drvdata(pdev, pcap_rtc); 164 161 165 162 timer_irq = pcap_to_irq(pcap_rtc->pcap, PCAP_IRQ_1HZ); 166 163 alarm_irq = pcap_to_irq(pcap_rtc->pcap, PCAP_IRQ_TODA); ··· 178 177 fail_timer: 179 178 rtc_device_unregister(pcap_rtc->rtc); 180 179 fail_rtc: 180 + platform_set_drvdata(pdev, NULL); 181 181 kfree(pcap_rtc); 182 182 return err; 183 183 }
+3 -2
drivers/rtc/rtc-rp5c01.c
··· 249 249 250 250 spin_lock_init(&priv->lock); 251 251 252 + platform_set_drvdata(dev, priv); 253 + 252 254 rtc = rtc_device_register("rtc-rp5c01", &dev->dev, &rp5c01_rtc_ops, 253 255 THIS_MODULE); 254 256 if (IS_ERR(rtc)) { 255 257 error = PTR_ERR(rtc); 256 258 goto out_unmap; 257 259 } 258 - 259 260 priv->rtc = rtc; 260 - platform_set_drvdata(dev, priv); 261 261 262 262 error = sysfs_create_bin_file(&dev->dev.kobj, &priv->nvram_attr); 263 263 if (error) ··· 268 268 out_unregister: 269 269 rtc_device_unregister(rtc); 270 270 out_unmap: 271 + platform_set_drvdata(dev, NULL); 271 272 iounmap(priv->regs); 272 273 out_free_priv: 273 274 kfree(priv);
-1
drivers/s390/char/tape_block.c
··· 236 236 disk->major = tapeblock_major; 237 237 disk->first_minor = device->first_minor; 238 238 disk->fops = &tapeblock_fops; 239 - disk->events = DISK_EVENT_MEDIA_CHANGE; 240 239 disk->private_data = tape_get_device(device); 241 240 disk->queue = blkdat->request_queue; 242 241 set_capacity(disk, 0);
+5 -2
drivers/scsi/qlogicpti.c
··· 1292 1292 .use_clustering = ENABLE_CLUSTERING, 1293 1293 }; 1294 1294 1295 + static const struct of_device_id qpti_match[]; 1295 1296 static int __devinit qpti_sbus_probe(struct platform_device *op) 1296 1297 { 1298 + const struct of_device_id *match; 1297 1299 struct scsi_host_template *tpnt; 1298 1300 struct device_node *dp = op->dev.of_node; 1299 1301 struct Scsi_Host *host; ··· 1303 1301 static int nqptis; 1304 1302 const char *fcode; 1305 1303 1306 - if (!op->dev.of_match) 1304 + match = of_match_device(qpti_match, &op->dev); 1305 + if (!match) 1307 1306 return -EINVAL; 1308 - tpnt = op->dev.of_match->data; 1307 + tpnt = match->data; 1309 1308 1310 1309 /* Sometimes Antares cards come up not completely 1311 1310 * setup, and we get a report of a zero IRQ.
+16 -4
drivers/scsi/scsi_lib.c
··· 74 74 */ 75 75 #define SCSI_QUEUE_DELAY 3 76 76 77 - static void scsi_run_queue(struct request_queue *q); 78 - 79 77 /* 80 78 * Function: scsi_unprep_request() 81 79 * ··· 159 161 blk_requeue_request(q, cmd->request); 160 162 spin_unlock_irqrestore(q->queue_lock, flags); 161 163 162 - scsi_run_queue(q); 164 + kblockd_schedule_work(q, &device->requeue_work); 163 165 164 166 return 0; 165 167 } ··· 436 438 continue; 437 439 } 438 440 439 - blk_run_queue_async(sdev->request_queue); 441 + spin_unlock(shost->host_lock); 442 + spin_lock(sdev->request_queue->queue_lock); 443 + __blk_run_queue(sdev->request_queue); 444 + spin_unlock(sdev->request_queue->queue_lock); 445 + spin_lock(shost->host_lock); 440 446 } 441 447 /* put any unprocessed entries back */ 442 448 list_splice(&starved_list, &shost->starved_list); 443 449 spin_unlock_irqrestore(shost->host_lock, flags); 444 450 445 451 blk_run_queue(q); 452 + } 453 + 454 + void scsi_requeue_run_queue(struct work_struct *work) 455 + { 456 + struct scsi_device *sdev; 457 + struct request_queue *q; 458 + 459 + sdev = container_of(work, struct scsi_device, requeue_work); 460 + q = sdev->request_queue; 461 + scsi_run_queue(q); 446 462 } 447 463 448 464 /*
+2
drivers/scsi/scsi_scan.c
··· 242 242 int display_failure_msg = 1, ret; 243 243 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 244 244 extern void scsi_evt_thread(struct work_struct *work); 245 + extern void scsi_requeue_run_queue(struct work_struct *work); 245 246 246 247 sdev = kzalloc(sizeof(*sdev) + shost->transportt->device_size, 247 248 GFP_ATOMIC); ··· 265 264 INIT_LIST_HEAD(&sdev->event_list); 266 265 spin_lock_init(&sdev->list_lock); 267 266 INIT_WORK(&sdev->event_work, scsi_evt_thread); 267 + INIT_WORK(&sdev->requeue_work, scsi_requeue_run_queue); 268 268 269 269 sdev->sdev_gendev.parent = get_device(&starget->dev); 270 270 sdev->sdev_target = starget;
+5 -2
drivers/tty/serial/of_serial.c
··· 80 80 /* 81 81 * Try to register a serial port 82 82 */ 83 + static struct of_device_id of_platform_serial_table[]; 83 84 static int __devinit of_platform_serial_probe(struct platform_device *ofdev) 84 85 { 86 + const struct of_device_id *match; 85 87 struct of_serial_info *info; 86 88 struct uart_port port; 87 89 int port_type; 88 90 int ret; 89 91 90 - if (!ofdev->dev.of_match) 92 + match = of_match_device(of_platform_serial_table, &ofdev->dev); 93 + if (!match) 91 94 return -EINVAL; 92 95 93 96 if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL)) ··· 100 97 if (info == NULL) 101 98 return -ENOMEM; 102 99 103 - port_type = (unsigned long)ofdev->dev.of_match->data; 100 + port_type = (unsigned long)match->data; 104 101 ret = of_platform_serial_setup(ofdev, port_type, &port); 105 102 if (ret) 106 103 goto out;
+5 -2
drivers/usb/gadget/fsl_qe_udc.c
··· 2539 2539 } 2540 2540 2541 2541 /* Driver probe functions */ 2542 + static const struct of_device_id qe_udc_match[]; 2542 2543 static int __devinit qe_udc_probe(struct platform_device *ofdev) 2543 2544 { 2545 + const struct of_device_id *match; 2544 2546 struct device_node *np = ofdev->dev.of_node; 2545 2547 struct qe_ep *ep; 2546 2548 unsigned int ret = 0; 2547 2549 unsigned int i; 2548 2550 const void *prop; 2549 2551 2550 - if (!ofdev->dev.of_match) 2552 + match = of_match_device(qe_udc_match, &ofdev->dev); 2553 + if (!match) 2551 2554 return -EINVAL; 2552 2555 2553 2556 prop = of_get_property(np, "mode", NULL); ··· 2564 2561 return -ENOMEM; 2565 2562 } 2566 2563 2567 - udc_controller->soc_type = (unsigned long)ofdev->dev.of_match->data; 2564 + udc_controller->soc_type = (unsigned long)match->data; 2568 2565 udc_controller->usb_regs = of_iomap(np, 0); 2569 2566 if (!udc_controller->usb_regs) { 2570 2567 ret = -ENOMEM;
+150 -77
drivers/video/fbmem.c
··· 42 42 43 43 #define FBPIXMAPSIZE (1024 * 8) 44 44 45 + static DEFINE_MUTEX(registration_lock); 45 46 struct fb_info *registered_fb[FB_MAX] __read_mostly; 46 47 int num_registered_fb __read_mostly; 48 + 49 + static struct fb_info *get_fb_info(unsigned int idx) 50 + { 51 + struct fb_info *fb_info; 52 + 53 + if (idx >= FB_MAX) 54 + return ERR_PTR(-ENODEV); 55 + 56 + mutex_lock(&registration_lock); 57 + fb_info = registered_fb[idx]; 58 + if (fb_info) 59 + atomic_inc(&fb_info->count); 60 + mutex_unlock(&registration_lock); 61 + 62 + return fb_info; 63 + } 64 + 65 + static void put_fb_info(struct fb_info *fb_info) 66 + { 67 + if (!atomic_dec_and_test(&fb_info->count)) 68 + return; 69 + if (fb_info->fbops->fb_destroy) 70 + fb_info->fbops->fb_destroy(fb_info); 71 + } 47 72 48 73 int lock_fb_info(struct fb_info *info) 49 74 { ··· 672 647 673 648 static void *fb_seq_start(struct seq_file *m, loff_t *pos) 674 649 { 650 + mutex_lock(&registration_lock); 675 651 return (*pos < FB_MAX) ? pos : NULL; 676 652 } 677 653 ··· 684 658 685 659 static void fb_seq_stop(struct seq_file *m, void *v) 686 660 { 661 + mutex_unlock(&registration_lock); 687 662 } 688 663 689 664 static int fb_seq_show(struct seq_file *m, void *v) ··· 717 690 .release = seq_release, 718 691 }; 719 692 693 + /* 694 + * We hold a reference to the fb_info in file->private_data, 695 + * but if the current registered fb has changed, we don't 696 + * actually want to use it. 697 + * 698 + * So look up the fb_info using the inode minor number, 699 + * and just verify it against the reference we have. 700 + */ 701 + static struct fb_info *file_fb_info(struct file *file) 702 + { 703 + struct inode *inode = file->f_path.dentry->d_inode; 704 + int fbidx = iminor(inode); 705 + struct fb_info *info = registered_fb[fbidx]; 706 + 707 + if (info != file->private_data) 708 + info = NULL; 709 + return info; 710 + } 711 + 720 712 static ssize_t 721 713 fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) 722 714 { 723 715 unsigned long p = *ppos; 724 - struct inode *inode = file->f_path.dentry->d_inode; 725 - int fbidx = iminor(inode); 726 - struct fb_info *info = registered_fb[fbidx]; 716 + struct fb_info *info = file_fb_info(file); 727 717 u8 *buffer, *dst; 728 718 u8 __iomem *src; 729 719 int c, cnt = 0, err = 0; ··· 805 761 fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) 806 762 { 807 763 unsigned long p = *ppos; 808 - struct inode *inode = file->f_path.dentry->d_inode; 809 - int fbidx = iminor(inode); 810 - struct fb_info *info = registered_fb[fbidx]; 764 + struct fb_info *info = file_fb_info(file); 811 765 u8 *buffer, *src; 812 766 u8 __iomem *dst; 813 767 int c, cnt = 0, err = 0; ··· 1183 1141 1184 1142 static long fb_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 1185 1143 { 1186 - struct inode *inode = file->f_path.dentry->d_inode; 1187 - int fbidx = iminor(inode); 1188 - struct fb_info *info = registered_fb[fbidx]; 1144 + struct fb_info *info = file_fb_info(file); 1189 1145 1146 + if (!info) 1147 + return -ENODEV; 1190 1148 return do_fb_ioctl(info, cmd, arg); 1191 1149 } 1192 1150 ··· 1307 1265 static long fb_compat_ioctl(struct file *file, unsigned int cmd, 1308 1266 unsigned long arg) 1309 1267 { 1310 - struct inode *inode = file->f_path.dentry->d_inode; 1311 - int fbidx = iminor(inode); 1312 - struct fb_info *info = registered_fb[fbidx]; 1313 - struct fb_ops *fb = info->fbops; 1268 + struct fb_info *info = file_fb_info(file); 1269 + struct fb_ops *fb; 1314 1270 long ret = -ENOIOCTLCMD; 1315 1271 1272 + if (!info) 1273 + return -ENODEV; 1274 + fb = info->fbops; 1316 1275 switch(cmd) { 1317 1276 case FBIOGET_VSCREENINFO: 1318 1277 case FBIOPUT_VSCREENINFO: ··· 1346 1303 static int 1347 1304 fb_mmap(struct file *file, struct vm_area_struct * vma) 1348 1305 { 1349 - int fbidx = iminor(file->f_path.dentry->d_inode); 1350 - struct fb_info *info = registered_fb[fbidx]; 1351 - struct fb_ops *fb = info->fbops; 1306 + struct fb_info *info = file_fb_info(file); 1307 + struct fb_ops *fb; 1352 1308 unsigned long off; 1353 1309 unsigned long start; 1354 1310 u32 len; 1355 1311 1312 + if (!info) 1313 + return -ENODEV; 1356 1314 if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) 1357 1315 return -EINVAL; 1358 1316 off = vma->vm_pgoff << PAGE_SHIFT; 1317 + fb = info->fbops; 1359 1318 if (!fb) 1360 1319 return -ENODEV; 1361 1320 mutex_lock(&info->mm_lock); ··· 1406 1361 struct fb_info *info; 1407 1362 int res = 0; 1408 1363 1409 - if (fbidx >= FB_MAX) 1410 - return -ENODEV; 1411 - info = registered_fb[fbidx]; 1412 - if (!info) 1364 + info = get_fb_info(fbidx); 1365 + if (!info) { 1413 1366 request_module("fb%d", fbidx); 1414 - info = registered_fb[fbidx]; 1415 - if (!info) 1416 - return -ENODEV; 1367 + info = get_fb_info(fbidx); 1368 + if (!info) 1369 + return -ENODEV; 1370 + } 1371 + if (IS_ERR(info)) 1372 + return PTR_ERR(info); 1373 + 1417 1374 mutex_lock(&info->lock); 1418 1375 if (!try_module_get(info->fbops->owner)) { 1419 1376 res = -ENODEV; ··· 1433 1386 #endif 1434 1387 out: 1435 1388 mutex_unlock(&info->lock); 1389 + if (res) 1390 + put_fb_info(info); 1436 1391 return res; 1437 1392 } 1438 1393 ··· 1450 1401 info->fbops->fb_release(info,1); 1451 1402 module_put(info->fbops->owner); 1452 1403 mutex_unlock(&info->lock); 1404 + put_fb_info(info); 1453 1405 return 0; 1454 1406 } 1455 1407 ··· 1537 1487 return false; 1538 1488 } 1539 1489 1490 + static int do_unregister_framebuffer(struct fb_info *fb_info); 1491 + 1540 1492 #define VGA_FB_PHYS 0xA0000 1541 - void remove_conflicting_framebuffers(struct apertures_struct *a, 1493 + static void do_remove_conflicting_framebuffers(struct apertures_struct *a, 1542 1494 const char *name, bool primary) 1543 1495 { 1544 1496 int i; ··· 1562 1510 printk(KERN_INFO "fb: conflicting fb hw usage " 1563 1511 "%s vs %s - removing generic driver\n", 1564 1512 name, registered_fb[i]->fix.id); 1565 - unregister_framebuffer(registered_fb[i]); 1513 + do_unregister_framebuffer(registered_fb[i]); 1566 1514 } 1567 1515 } 1568 1516 } 1569 - EXPORT_SYMBOL(remove_conflicting_framebuffers); 1570 1517 1571 - /** 1572 - * register_framebuffer - registers a frame buffer device 1573 - * @fb_info: frame buffer info structure 1574 - * 1575 - * Registers a frame buffer device @fb_info. 1576 - * 1577 - * Returns negative errno on error, or zero for success. 1578 - * 1579 - */ 1580 - 1581 - int 1582 - register_framebuffer(struct fb_info *fb_info) 1518 + static int do_register_framebuffer(struct fb_info *fb_info) 1583 1519 { 1584 1520 int i; 1585 1521 struct fb_event event; 1586 1522 struct fb_videomode mode; 1587 1523 1588 - if (num_registered_fb == FB_MAX) 1589 - return -ENXIO; 1590 - 1591 1524 if (fb_check_foreignness(fb_info)) 1592 1525 return -ENOSYS; 1593 1526 1594 - remove_conflicting_framebuffers(fb_info->apertures, fb_info->fix.id, 1527 + do_remove_conflicting_framebuffers(fb_info->apertures, fb_info->fix.id, 1595 1528 fb_is_primary_device(fb_info)); 1529 + 1530 + if (num_registered_fb == FB_MAX) 1531 + return -ENXIO; 1596 1532 1597 1533 num_registered_fb++; 1598 1534 for (i = 0 ; i < FB_MAX; i++) 1599 1535 if (!registered_fb[i]) 1600 1536 break; 1601 1537 fb_info->node = i; 1538 + atomic_set(&fb_info->count, 1); 1602 1539 mutex_init(&fb_info->lock); 1603 1540 mutex_init(&fb_info->mm_lock); 1604 1541 ··· 1633 1592 return 0; 1634 1593 } 1635 1594 1595 + static int do_unregister_framebuffer(struct fb_info *fb_info) 1596 + { 1597 + struct fb_event event; 1598 + int i, ret = 0; 1599 + 1600 + i = fb_info->node; 1601 + if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info) 1602 + return -EINVAL; 1603 + 1604 + if (!lock_fb_info(fb_info)) 1605 + return -ENODEV; 1606 + event.info = fb_info; 1607 + ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event); 1608 + unlock_fb_info(fb_info); 1609 + 1610 + if (ret) 1611 + return -EINVAL; 1612 + 1613 + if (fb_info->pixmap.addr && 1614 + (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT)) 1615 + kfree(fb_info->pixmap.addr); 1616 + fb_destroy_modelist(&fb_info->modelist); 1617 + registered_fb[i] = NULL; 1618 + num_registered_fb--; 1619 + fb_cleanup_device(fb_info); 1620 + device_destroy(fb_class, MKDEV(FB_MAJOR, i)); 1621 + event.info = fb_info; 1622 + fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event); 1623 + 1624 + /* this may free fb info */ 1625 + put_fb_info(fb_info); 1626 + return 0; 1627 + } 1628 + 1629 + void remove_conflicting_framebuffers(struct apertures_struct *a, 1630 + const char *name, bool primary) 1631 + { 1632 + mutex_lock(&registration_lock); 1633 + do_remove_conflicting_framebuffers(a, name, primary); 1634 + mutex_unlock(&registration_lock); 1635 + } 1636 + EXPORT_SYMBOL(remove_conflicting_framebuffers); 1637 + 1638 + /** 1639 + * register_framebuffer - registers a frame buffer device 1640 + * @fb_info: frame buffer info structure 1641 + * 1642 + * Registers a frame buffer device @fb_info. 1643 + * 1644 + * Returns negative errno on error, or zero for success. 1645 + * 1646 + */ 1647 + int 1648 + register_framebuffer(struct fb_info *fb_info) 1649 + { 1650 + int ret; 1651 + 1652 + mutex_lock(&registration_lock); 1653 + ret = do_register_framebuffer(fb_info); 1654 + mutex_unlock(&registration_lock); 1655 + 1656 + return ret; 1657 + } 1636 1658 1637 1659 /** 1638 1660 * unregister_framebuffer - releases a frame buffer device ··· 1713 1609 * that the driver implements fb_open() and fb_release() to 1714 1610 * check that no processes are using the device. 1715 1611 */ 1716 - 1717 1612 int 1718 1613 unregister_framebuffer(struct fb_info *fb_info) 1719 1614 { 1720 - struct fb_event event; 1721 - int i, ret = 0; 1615 + int ret; 1722 1616 1723 - i = fb_info->node; 1724 - if (!registered_fb[i]) { 1725 - ret = -EINVAL; 1726 - goto done; 1727 - } 1617 + mutex_lock(&registration_lock); 1618 + ret = do_unregister_framebuffer(fb_info); 1619 + mutex_unlock(&registration_lock); 1728 1620 1729 - 1730 - if (!lock_fb_info(fb_info)) 1731 - return -ENODEV; 1732 - event.info = fb_info; 1733 - ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event); 1734 - unlock_fb_info(fb_info); 1735 - 1736 - if (ret) { 1737 - ret = -EINVAL; 1738 - goto done; 1739 - } 1740 - 1741 - if (fb_info->pixmap.addr && 1742 - (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT)) 1743 - kfree(fb_info->pixmap.addr); 1744 - fb_destroy_modelist(&fb_info->modelist); 1745 - registered_fb[i]=NULL; 1746 - num_registered_fb--; 1747 - fb_cleanup_device(fb_info); 1748 - device_destroy(fb_class, MKDEV(FB_MAJOR, i)); 1749 - event.info = fb_info; 1750 - fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event); 1751 - 1752 - /* this may free fb info */ 1753 - if (fb_info->fbops->fb_destroy) 1754 - fb_info->fbops->fb_destroy(fb_info); 1755 - done: 1756 1621 return ret; 1757 1622 } 1758 1623
+5 -2
drivers/watchdog/mpc8xxx_wdt.c
··· 185 185 .fops = &mpc8xxx_wdt_fops, 186 186 }; 187 187 188 + static const struct of_device_id mpc8xxx_wdt_match[]; 188 189 static int __devinit mpc8xxx_wdt_probe(struct platform_device *ofdev) 189 190 { 190 191 int ret; 192 + const struct of_device_id *match; 191 193 struct device_node *np = ofdev->dev.of_node; 192 194 struct mpc8xxx_wdt_type *wdt_type; 193 195 u32 freq = fsl_get_sys_freq(); 194 196 bool enabled; 195 197 196 - if (!ofdev->dev.of_match) 198 + match = of_match_device(mpc8xxx_wdt_match, &ofdev->dev); 199 + if (!match) 197 200 return -EINVAL; 198 - wdt_type = ofdev->dev.of_match->data; 201 + wdt_type = match->data; 199 202 200 203 if (!freq || freq == -1) 201 204 return -EINVAL;
+18 -9
fs/block_dev.c
··· 1102 1102 if (!bdev->bd_part) 1103 1103 goto out_clear; 1104 1104 1105 + ret = 0; 1105 1106 if (disk->fops->open) { 1106 1107 ret = disk->fops->open(bdev, mode); 1107 1108 if (ret == -ERESTARTSYS) { ··· 1119 1118 put_disk(disk); 1120 1119 goto restart; 1121 1120 } 1122 - if (ret) 1123 - goto out_clear; 1124 1121 } 1122 + /* 1123 + * If the device is invalidated, rescan partition 1124 + * if open succeeded or failed with -ENOMEDIUM. 1125 + * The latter is necessary to prevent ghost 1126 + * partitions on a removed medium. 1127 + */ 1128 + if (bdev->bd_invalidated && (!ret || ret == -ENOMEDIUM)) 1129 + rescan_partitions(disk, bdev); 1130 + if (ret) 1131 + goto out_clear; 1132 + 1125 1133 if (!bdev->bd_openers) { 1126 1134 bd_set_size(bdev,(loff_t)get_capacity(disk)<<9); 1127 1135 bdi = blk_get_backing_dev_info(bdev); ··· 1138 1128 bdi = &default_backing_dev_info; 1139 1129 bdev_inode_switch_bdi(bdev->bd_inode, bdi); 1140 1130 } 1141 - if (bdev->bd_invalidated) 1142 - rescan_partitions(disk, bdev); 1143 1131 } else { 1144 1132 struct block_device *whole; 1145 1133 whole = bdget_disk(disk, 0); ··· 1161 1153 } 1162 1154 } else { 1163 1155 if (bdev->bd_contains == bdev) { 1164 - if (bdev->bd_disk->fops->open) { 1156 + ret = 0; 1157 + if (bdev->bd_disk->fops->open) 1165 1158 ret = bdev->bd_disk->fops->open(bdev, mode); 1166 - if (ret) 1167 - goto out_unlock_bdev; 1168 - } 1169 - if (bdev->bd_invalidated) 1159 + /* the same as first opener case, read comment there */ 1160 + if (bdev->bd_invalidated && (!ret || ret == -ENOMEDIUM)) 1170 1161 rescan_partitions(bdev->bd_disk, bdev); 1162 + if (ret) 1163 + goto out_unlock_bdev; 1171 1164 } 1172 1165 /* only one opener holds refs to the module and disk */ 1173 1166 module_put(disk->fops->owner);
+3 -2
fs/btrfs/acl.c
··· 178 178 179 179 if (value) { 180 180 acl = posix_acl_from_xattr(value, size); 181 + if (IS_ERR(acl)) 182 + return PTR_ERR(acl); 183 + 181 184 if (acl) { 182 185 ret = posix_acl_valid(acl); 183 186 if (ret) 184 187 goto out; 185 - } else if (IS_ERR(acl)) { 186 - return PTR_ERR(acl); 187 188 } 188 189 } 189 190
+26 -11
fs/btrfs/extent-tree.c
··· 8856 8856 int btrfs_init_space_info(struct btrfs_fs_info *fs_info) 8857 8857 { 8858 8858 struct btrfs_space_info *space_info; 8859 + struct btrfs_super_block *disk_super; 8860 + u64 features; 8861 + u64 flags; 8862 + int mixed = 0; 8859 8863 int ret; 8860 8864 8861 - ret = update_space_info(fs_info, BTRFS_BLOCK_GROUP_SYSTEM, 0, 0, 8862 - &space_info); 8863 - if (ret) 8864 - return ret; 8865 + disk_super = &fs_info->super_copy; 8866 + if (!btrfs_super_root(disk_super)) 8867 + return 1; 8865 8868 8866 - ret = update_space_info(fs_info, BTRFS_BLOCK_GROUP_METADATA, 0, 0, 8867 - &space_info); 8868 - if (ret) 8869 - return ret; 8869 + features = btrfs_super_incompat_flags(disk_super); 8870 + if (features & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) 8871 + mixed = 1; 8870 8872 8871 - ret = update_space_info(fs_info, BTRFS_BLOCK_GROUP_DATA, 0, 0, 8872 - &space_info); 8873 + flags = BTRFS_BLOCK_GROUP_SYSTEM; 8874 + ret = update_space_info(fs_info, flags, 0, 0, &space_info); 8873 8875 if (ret) 8874 - return ret; 8876 + goto out; 8875 8877 8878 + if (mixed) { 8879 + flags = BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_DATA; 8880 + ret = update_space_info(fs_info, flags, 0, 0, &space_info); 8881 + } else { 8882 + flags = BTRFS_BLOCK_GROUP_METADATA; 8883 + ret = update_space_info(fs_info, flags, 0, 0, &space_info); 8884 + if (ret) 8885 + goto out; 8886 + 8887 + flags = BTRFS_BLOCK_GROUP_DATA; 8888 + ret = update_space_info(fs_info, flags, 0, 0, &space_info); 8889 + } 8890 + out: 8876 8891 return ret; 8877 8892 } 8878 8893
+15 -9
fs/btrfs/ioctl.c
··· 81 81 iflags |= FS_NOATIME_FL; 82 82 if (flags & BTRFS_INODE_DIRSYNC) 83 83 iflags |= FS_DIRSYNC_FL; 84 + if (flags & BTRFS_INODE_NODATACOW) 85 + iflags |= FS_NOCOW_FL; 86 + 87 + if ((flags & BTRFS_INODE_COMPRESS) && !(flags & BTRFS_INODE_NOCOMPRESS)) 88 + iflags |= FS_COMPR_FL; 89 + else if (flags & BTRFS_INODE_NOCOMPRESS) 90 + iflags |= FS_NOCOMP_FL; 84 91 85 92 return iflags; 86 93 } ··· 151 144 if (flags & ~(FS_IMMUTABLE_FL | FS_APPEND_FL | \ 152 145 FS_NOATIME_FL | FS_NODUMP_FL | \ 153 146 FS_SYNC_FL | FS_DIRSYNC_FL | \ 154 - FS_NOCOMP_FL | FS_COMPR_FL | \ 155 - FS_NOCOW_FL | FS_COW_FL)) 147 + FS_NOCOMP_FL | FS_COMPR_FL | 148 + FS_NOCOW_FL)) 156 149 return -EOPNOTSUPP; 157 150 158 151 if ((flags & FS_NOCOMP_FL) && (flags & FS_COMPR_FL)) 159 - return -EINVAL; 160 - 161 - if ((flags & FS_NOCOW_FL) && (flags & FS_COW_FL)) 162 152 return -EINVAL; 163 153 164 154 return 0; ··· 222 218 ip->flags |= BTRFS_INODE_DIRSYNC; 223 219 else 224 220 ip->flags &= ~BTRFS_INODE_DIRSYNC; 221 + if (flags & FS_NOCOW_FL) 222 + ip->flags |= BTRFS_INODE_NODATACOW; 223 + else 224 + ip->flags &= ~BTRFS_INODE_NODATACOW; 225 225 226 226 /* 227 227 * The COMPRESS flag can only be changed by users, while the NOCOMPRESS ··· 238 230 } else if (flags & FS_COMPR_FL) { 239 231 ip->flags |= BTRFS_INODE_COMPRESS; 240 232 ip->flags &= ~BTRFS_INODE_NOCOMPRESS; 233 + } else { 234 + ip->flags &= ~(BTRFS_INODE_COMPRESS | BTRFS_INODE_NOCOMPRESS); 241 235 } 242 - if (flags & FS_NOCOW_FL) 243 - ip->flags |= BTRFS_INODE_NODATACOW; 244 - else if (flags & FS_COW_FL) 245 - ip->flags &= ~BTRFS_INODE_NODATACOW; 246 236 247 237 trans = btrfs_join_transaction(root, 1); 248 238 BUG_ON(IS_ERR(trans));
+6 -8
fs/cifs/cifs_unicode.c
··· 277 277 278 278 for (i = 0, j = 0; i < srclen; j++) { 279 279 src_char = source[i]; 280 + charlen = 1; 280 281 switch (src_char) { 281 282 case 0: 282 283 put_unaligned(0, &target[j]); ··· 317 316 dst_char = cpu_to_le16(0x003f); 318 317 charlen = 1; 319 318 } 320 - /* 321 - * character may take more than one byte in the source 322 - * string, but will take exactly two bytes in the 323 - * target string 324 - */ 325 - i += charlen; 326 - continue; 327 319 } 320 + /* 321 + * character may take more than one byte in the source string, 322 + * but will take exactly two bytes in the target string 323 + */ 324 + i += charlen; 328 325 put_unaligned(dst_char, &target[j]); 329 - i++; /* move to next char in source string */ 330 326 } 331 327 332 328 ctoUCS_out:
+5
fs/cifs/connect.c
··· 2673 2673 0 /* not legacy */, cifs_sb->local_nls, 2674 2674 cifs_sb->mnt_cifs_flags & 2675 2675 CIFS_MOUNT_MAP_SPECIAL_CHR); 2676 + 2677 + if (rc == -EOPNOTSUPP || rc == -EINVAL) 2678 + rc = SMBQueryInformation(xid, tcon, full_path, pfile_info, 2679 + cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & 2680 + CIFS_MOUNT_MAP_SPECIAL_CHR); 2676 2681 kfree(pfile_info); 2677 2682 return rc; 2678 2683 }
+32 -7
fs/configfs/dir.c
··· 53 53 static void configfs_d_iput(struct dentry * dentry, 54 54 struct inode * inode) 55 55 { 56 - struct configfs_dirent * sd = dentry->d_fsdata; 56 + struct configfs_dirent *sd = dentry->d_fsdata; 57 57 58 58 if (sd) { 59 59 BUG_ON(sd->s_dentry != dentry); 60 + /* Coordinate with configfs_readdir */ 61 + spin_lock(&configfs_dirent_lock); 60 62 sd->s_dentry = NULL; 63 + spin_unlock(&configfs_dirent_lock); 61 64 configfs_put(sd); 62 65 } 63 66 iput(inode); ··· 692 689 sd = child->d_fsdata; 693 690 sd->s_type |= CONFIGFS_USET_DEFAULT; 694 691 } else { 695 - d_delete(child); 692 + BUG_ON(child->d_inode); 693 + d_drop(child); 696 694 dput(child); 697 695 } 698 696 } ··· 1549 1545 struct configfs_dirent * parent_sd = dentry->d_fsdata; 1550 1546 struct configfs_dirent *cursor = filp->private_data; 1551 1547 struct list_head *p, *q = &cursor->s_sibling; 1552 - ino_t ino; 1548 + ino_t ino = 0; 1553 1549 int i = filp->f_pos; 1554 1550 1555 1551 switch (i) { ··· 1577 1573 struct configfs_dirent *next; 1578 1574 const char * name; 1579 1575 int len; 1576 + struct inode *inode = NULL; 1580 1577 1581 1578 next = list_entry(p, struct configfs_dirent, 1582 1579 s_sibling); ··· 1586 1581 1587 1582 name = configfs_get_name(next); 1588 1583 len = strlen(name); 1589 - if (next->s_dentry) 1590 - ino = next->s_dentry->d_inode->i_ino; 1591 - else 1584 + 1585 + /* 1586 + * We'll have a dentry and an inode for 1587 + * PINNED items and for open attribute 1588 + * files. We lock here to prevent a race 1589 + * with configfs_d_iput() clearing 1590 + * s_dentry before calling iput(). 1591 + * 1592 + * Why do we go to the trouble? If 1593 + * someone has an attribute file open, 1594 + * the inode number should match until 1595 + * they close it. Beyond that, we don't 1596 + * care. 1597 + */ 1598 + spin_lock(&configfs_dirent_lock); 1599 + dentry = next->s_dentry; 1600 + if (dentry) 1601 + inode = dentry->d_inode; 1602 + if (inode) 1603 + ino = inode->i_ino; 1604 + spin_unlock(&configfs_dirent_lock); 1605 + if (!inode) 1592 1606 ino = iunique(configfs_sb, 2); 1593 1607 1594 1608 if (filldir(dirent, name, len, filp->f_pos, ino, ··· 1707 1683 err = configfs_attach_group(sd->s_element, &group->cg_item, 1708 1684 dentry); 1709 1685 if (err) { 1710 - d_delete(dentry); 1686 + BUG_ON(dentry->d_inode); 1687 + d_drop(dentry); 1711 1688 dput(dentry); 1712 1689 } else { 1713 1690 spin_lock(&configfs_dirent_lock);
+1 -1
fs/fuse/dir.c
··· 174 174 if (!inode) 175 175 return 0; 176 176 177 - if (nd->flags & LOOKUP_RCU) 177 + if (nd && (nd->flags & LOOKUP_RCU)) 178 178 return -ECHILD; 179 179 180 180 fc = get_fuse_conn(inode);
+1 -1
fs/namei.c
··· 179 179 static int acl_permission_check(struct inode *inode, int mask, unsigned int flags, 180 180 int (*check_acl)(struct inode *inode, int mask, unsigned int flags)) 181 181 { 182 - umode_t mode = inode->i_mode; 182 + unsigned int mode = inode->i_mode; 183 183 184 184 mask &= MAY_READ | MAY_WRITE | MAY_EXEC; 185 185
+16 -11
fs/nfs/nfs4filelayout.c
··· 117 117 case -EKEYEXPIRED: 118 118 rpc_delay(task, FILELAYOUT_POLL_RETRY_MAX); 119 119 break; 120 + case -NFS4ERR_RETRY_UNCACHED_REP: 121 + break; 120 122 default: 121 123 dprintk("%s DS error. Retry through MDS %d\n", __func__, 122 124 task->tk_status); ··· 418 416 filelayout_check_layout(struct pnfs_layout_hdr *lo, 419 417 struct nfs4_filelayout_segment *fl, 420 418 struct nfs4_layoutget_res *lgr, 421 - struct nfs4_deviceid *id) 419 + struct nfs4_deviceid *id, 420 + gfp_t gfp_flags) 422 421 { 423 422 struct nfs4_file_layout_dsaddr *dsaddr; 424 423 int status = -EINVAL; ··· 442 439 /* find and reference the deviceid */ 443 440 dsaddr = nfs4_fl_find_get_deviceid(id); 444 441 if (dsaddr == NULL) { 445 - dsaddr = get_device_info(lo->plh_inode, id); 442 + dsaddr = get_device_info(lo->plh_inode, id, gfp_flags); 446 443 if (dsaddr == NULL) 447 444 goto out; 448 445 } ··· 503 500 filelayout_decode_layout(struct pnfs_layout_hdr *flo, 504 501 struct nfs4_filelayout_segment *fl, 505 502 struct nfs4_layoutget_res *lgr, 506 - struct nfs4_deviceid *id) 503 + struct nfs4_deviceid *id, 504 + gfp_t gfp_flags) 507 505 { 508 506 struct xdr_stream stream; 509 507 struct xdr_buf buf = { ··· 520 516 521 517 dprintk("%s: set_layout_map Begin\n", __func__); 522 518 523 - scratch = alloc_page(GFP_KERNEL); 519 + scratch = alloc_page(gfp_flags); 524 520 if (!scratch) 525 521 return -ENOMEM; 526 522 ··· 558 554 goto out_err; 559 555 560 556 fl->fh_array = kzalloc(fl->num_fh * sizeof(struct nfs_fh *), 561 - GFP_KERNEL); 557 + gfp_flags); 562 558 if (!fl->fh_array) 563 559 goto out_err; 564 560 565 561 for (i = 0; i < fl->num_fh; i++) { 566 562 /* Do we want to use a mempool here? */ 567 - fl->fh_array[i] = kmalloc(sizeof(struct nfs_fh), GFP_KERNEL); 563 + fl->fh_array[i] = kmalloc(sizeof(struct nfs_fh), gfp_flags); 568 564 if (!fl->fh_array[i]) 569 565 goto out_err_free; 570 566 ··· 609 605 610 606 static struct pnfs_layout_segment * 611 607 filelayout_alloc_lseg(struct pnfs_layout_hdr *layoutid, 612 - struct nfs4_layoutget_res *lgr) 608 + struct nfs4_layoutget_res *lgr, 609 + gfp_t gfp_flags) 613 610 { 614 611 struct nfs4_filelayout_segment *fl; 615 612 int rc; 616 613 struct nfs4_deviceid id; 617 614 618 615 dprintk("--> %s\n", __func__); 619 - fl = kzalloc(sizeof(*fl), GFP_KERNEL); 616 + fl = kzalloc(sizeof(*fl), gfp_flags); 620 617 if (!fl) 621 618 return NULL; 622 619 623 - rc = filelayout_decode_layout(layoutid, fl, lgr, &id); 624 - if (rc != 0 || filelayout_check_layout(layoutid, fl, lgr, &id)) { 620 + rc = filelayout_decode_layout(layoutid, fl, lgr, &id, gfp_flags); 621 + if (rc != 0 || filelayout_check_layout(layoutid, fl, lgr, &id, gfp_flags)) { 625 622 _filelayout_free_lseg(fl); 626 623 return NULL; 627 624 } ··· 638 633 int size = (fl->stripe_type == STRIPE_SPARSE) ? 639 634 fl->dsaddr->ds_num : fl->dsaddr->stripe_count; 640 635 641 - fl->commit_buckets = kcalloc(size, sizeof(struct list_head), GFP_KERNEL); 636 + fl->commit_buckets = kcalloc(size, sizeof(struct list_head), gfp_flags); 642 637 if (!fl->commit_buckets) { 643 638 filelayout_free_lseg(&fl->generic_hdr); 644 639 return NULL;
+1 -1
fs/nfs/nfs4filelayout.h
··· 104 104 nfs4_fl_find_get_deviceid(struct nfs4_deviceid *dev_id); 105 105 extern void nfs4_fl_put_deviceid(struct nfs4_file_layout_dsaddr *dsaddr); 106 106 struct nfs4_file_layout_dsaddr * 107 - get_device_info(struct inode *inode, struct nfs4_deviceid *dev_id); 107 + get_device_info(struct inode *inode, struct nfs4_deviceid *dev_id, gfp_t gfp_flags); 108 108 109 109 #endif /* FS_NFS_NFS4FILELAYOUT_H */
+17 -17
fs/nfs/nfs4filelayoutdev.c
··· 225 225 } 226 226 227 227 static struct nfs4_pnfs_ds * 228 - nfs4_pnfs_ds_add(struct inode *inode, u32 ip_addr, u32 port) 228 + nfs4_pnfs_ds_add(struct inode *inode, u32 ip_addr, u32 port, gfp_t gfp_flags) 229 229 { 230 230 struct nfs4_pnfs_ds *tmp_ds, *ds; 231 231 232 - ds = kzalloc(sizeof(*tmp_ds), GFP_KERNEL); 232 + ds = kzalloc(sizeof(*tmp_ds), gfp_flags); 233 233 if (!ds) 234 234 goto out; 235 235 ··· 261 261 * Currently only support ipv4, and one multi-path address. 262 262 */ 263 263 static struct nfs4_pnfs_ds * 264 - decode_and_add_ds(struct xdr_stream *streamp, struct inode *inode) 264 + decode_and_add_ds(struct xdr_stream *streamp, struct inode *inode, gfp_t gfp_flags) 265 265 { 266 266 struct nfs4_pnfs_ds *ds = NULL; 267 267 char *buf; ··· 303 303 rlen); 304 304 goto out_err; 305 305 } 306 - buf = kmalloc(rlen + 1, GFP_KERNEL); 306 + buf = kmalloc(rlen + 1, gfp_flags); 307 307 if (!buf) { 308 308 dprintk("%s: Not enough memory\n", __func__); 309 309 goto out_err; ··· 333 333 sscanf(pstr, "-%d-%d", &tmp[0], &tmp[1]); 334 334 port = htons((tmp[0] << 8) | (tmp[1])); 335 335 336 - ds = nfs4_pnfs_ds_add(inode, ip_addr, port); 336 + ds = nfs4_pnfs_ds_add(inode, ip_addr, port, gfp_flags); 337 337 dprintk("%s: Decoded address and port %s\n", __func__, buf); 338 338 out_free: 339 339 kfree(buf); ··· 343 343 344 344 /* Decode opaque device data and return the result */ 345 345 static struct nfs4_file_layout_dsaddr* 346 - decode_device(struct inode *ino, struct pnfs_device *pdev) 346 + decode_device(struct inode *ino, struct pnfs_device *pdev, gfp_t gfp_flags) 347 347 { 348 348 int i; 349 349 u32 cnt, num; ··· 362 362 struct page *scratch; 363 363 364 364 /* set up xdr stream */ 365 - scratch = alloc_page(GFP_KERNEL); 365 + scratch = alloc_page(gfp_flags); 366 366 if (!scratch) 367 367 goto out_err; 368 368 ··· 384 384 } 385 385 386 386 /* read stripe indices */ 387 - stripe_indices = kcalloc(cnt, sizeof(u8), GFP_KERNEL); 387 + stripe_indices = kcalloc(cnt, sizeof(u8), gfp_flags); 388 388 if (!stripe_indices) 389 389 goto out_err_free_scratch; 390 390 ··· 423 423 424 424 dsaddr = kzalloc(sizeof(*dsaddr) + 425 425 (sizeof(struct nfs4_pnfs_ds *) * (num - 1)), 426 - GFP_KERNEL); 426 + gfp_flags); 427 427 if (!dsaddr) 428 428 goto out_err_free_stripe_indices; 429 429 ··· 452 452 for (j = 0; j < mp_count; j++) { 453 453 if (j == 0) { 454 454 dsaddr->ds_list[i] = decode_and_add_ds(&stream, 455 - ino); 455 + ino, gfp_flags); 456 456 if (dsaddr->ds_list[i] == NULL) 457 457 goto out_err_free_deviceid; 458 458 } else { ··· 503 503 * available devices. 504 504 */ 505 505 static struct nfs4_file_layout_dsaddr * 506 - decode_and_add_device(struct inode *inode, struct pnfs_device *dev) 506 + decode_and_add_device(struct inode *inode, struct pnfs_device *dev, gfp_t gfp_flags) 507 507 { 508 508 struct nfs4_file_layout_dsaddr *d, *new; 509 509 long hash; 510 510 511 - new = decode_device(inode, dev); 511 + new = decode_device(inode, dev, gfp_flags); 512 512 if (!new) { 513 513 printk(KERN_WARNING "%s: Could not decode or add device\n", 514 514 __func__); ··· 537 537 * of available devices, and return it. 538 538 */ 539 539 struct nfs4_file_layout_dsaddr * 540 - get_device_info(struct inode *inode, struct nfs4_deviceid *dev_id) 540 + get_device_info(struct inode *inode, struct nfs4_deviceid *dev_id, gfp_t gfp_flags) 541 541 { 542 542 struct pnfs_device *pdev = NULL; 543 543 u32 max_resp_sz; ··· 556 556 dprintk("%s inode %p max_resp_sz %u max_pages %d\n", 557 557 __func__, inode, max_resp_sz, max_pages); 558 558 559 - pdev = kzalloc(sizeof(struct pnfs_device), GFP_KERNEL); 559 + pdev = kzalloc(sizeof(struct pnfs_device), gfp_flags); 560 560 if (pdev == NULL) 561 561 return NULL; 562 562 563 - pages = kzalloc(max_pages * sizeof(struct page *), GFP_KERNEL); 563 + pages = kzalloc(max_pages * sizeof(struct page *), gfp_flags); 564 564 if (pages == NULL) { 565 565 kfree(pdev); 566 566 return NULL; 567 567 } 568 568 for (i = 0; i < max_pages; i++) { 569 - pages[i] = alloc_page(GFP_KERNEL); 569 + pages[i] = alloc_page(gfp_flags); 570 570 if (!pages[i]) 571 571 goto out_free; 572 572 } ··· 587 587 * Found new device, need to decode it and then add it to the 588 588 * list of known devices for this mountpoint. 589 589 */ 590 - dsaddr = decode_and_add_device(inode, pdev); 590 + dsaddr = decode_and_add_device(inode, pdev, gfp_flags); 591 591 out_free: 592 592 for (i = 0; i < max_pages; i++) 593 593 __free_page(pages[i]);
+6
fs/nfs/nfs4proc.c
··· 300 300 ret = nfs4_delay(server->client, &exception->timeout); 301 301 if (ret != 0) 302 302 break; 303 + case -NFS4ERR_RETRY_UNCACHED_REP: 303 304 case -NFS4ERR_OLD_STATEID: 304 305 exception->retry = 1; 305 306 break; ··· 3696 3695 rpc_delay(task, NFS4_POLL_RETRY_MAX); 3697 3696 task->tk_status = 0; 3698 3697 return -EAGAIN; 3698 + case -NFS4ERR_RETRY_UNCACHED_REP: 3699 3699 case -NFS4ERR_OLD_STATEID: 3700 3700 task->tk_status = 0; 3701 3701 return -EAGAIN; ··· 4846 4844 dprintk("%s Retry: tk_status %d\n", __func__, task->tk_status); 4847 4845 rpc_delay(task, NFS4_POLL_RETRY_MIN); 4848 4846 task->tk_status = 0; 4847 + /* fall through */ 4848 + case -NFS4ERR_RETRY_UNCACHED_REP: 4849 4849 nfs_restart_rpc(task, data->clp); 4850 4850 return; 4851 4851 } ··· 5483 5479 break; 5484 5480 case -NFS4ERR_DELAY: 5485 5481 rpc_delay(task, NFS4_POLL_RETRY_MAX); 5482 + /* fall through */ 5483 + case -NFS4ERR_RETRY_UNCACHED_REP: 5486 5484 return -EAGAIN; 5487 5485 default: 5488 5486 nfs4_schedule_lease_recovery(clp);
+20 -14
fs/nfs/pnfs.c
··· 383 383 plh_layouts); 384 384 dprintk("%s freeing layout for inode %lu\n", __func__, 385 385 lo->plh_inode->i_ino); 386 + list_del_init(&lo->plh_layouts); 386 387 pnfs_destroy_layout(NFS_I(lo->plh_inode)); 387 388 } 388 389 } ··· 467 466 static struct pnfs_layout_segment * 468 467 send_layoutget(struct pnfs_layout_hdr *lo, 469 468 struct nfs_open_context *ctx, 470 - u32 iomode) 469 + u32 iomode, 470 + gfp_t gfp_flags) 471 471 { 472 472 struct inode *ino = lo->plh_inode; 473 473 struct nfs_server *server = NFS_SERVER(ino); ··· 481 479 dprintk("--> %s\n", __func__); 482 480 483 481 BUG_ON(ctx == NULL); 484 - lgp = kzalloc(sizeof(*lgp), GFP_KERNEL); 482 + lgp = kzalloc(sizeof(*lgp), gfp_flags); 485 483 if (lgp == NULL) 486 484 return NULL; 487 485 ··· 489 487 max_resp_sz = server->nfs_client->cl_session->fc_attrs.max_resp_sz; 490 488 max_pages = max_resp_sz >> PAGE_SHIFT; 491 489 492 - pages = kzalloc(max_pages * sizeof(struct page *), GFP_KERNEL); 490 + pages = kzalloc(max_pages * sizeof(struct page *), gfp_flags); 493 491 if (!pages) 494 492 goto out_err_free; 495 493 496 494 for (i = 0; i < max_pages; i++) { 497 - pages[i] = alloc_page(GFP_KERNEL); 495 + pages[i] = alloc_page(gfp_flags); 498 496 if (!pages[i]) 499 497 goto out_err_free; 500 498 } ··· 510 508 lgp->args.layout.pages = pages; 511 509 lgp->args.layout.pglen = max_pages * PAGE_SIZE; 512 510 lgp->lsegpp = &lseg; 511 + lgp->gfp_flags = gfp_flags; 513 512 514 513 /* Synchronously retrieve layout information from server and 515 514 * store in lseg. ··· 668 665 } 669 666 670 667 static struct pnfs_layout_hdr * 671 - alloc_init_layout_hdr(struct inode *ino) 668 + alloc_init_layout_hdr(struct inode *ino, gfp_t gfp_flags) 672 669 { 673 670 struct pnfs_layout_hdr *lo; 674 671 675 - lo = kzalloc(sizeof(struct pnfs_layout_hdr), GFP_KERNEL); 672 + lo = kzalloc(sizeof(struct pnfs_layout_hdr), gfp_flags); 676 673 if (!lo) 677 674 return NULL; 678 675 atomic_set(&lo->plh_refcount, 1); ··· 684 681 } 685 682 686 683 static struct pnfs_layout_hdr * 687 - pnfs_find_alloc_layout(struct inode *ino) 684 + pnfs_find_alloc_layout(struct inode *ino, gfp_t gfp_flags) 688 685 { 689 686 struct nfs_inode *nfsi = NFS_I(ino); 690 687 struct pnfs_layout_hdr *new = NULL; ··· 699 696 return nfsi->layout; 700 697 } 701 698 spin_unlock(&ino->i_lock); 702 - new = alloc_init_layout_hdr(ino); 699 + new = alloc_init_layout_hdr(ino, gfp_flags); 703 700 spin_lock(&ino->i_lock); 704 701 705 702 if (likely(nfsi->layout == NULL)) /* Won the race? */ ··· 759 756 struct pnfs_layout_segment * 760 757 pnfs_update_layout(struct inode *ino, 761 758 struct nfs_open_context *ctx, 762 - enum pnfs_iomode iomode) 759 + enum pnfs_iomode iomode, 760 + gfp_t gfp_flags) 763 761 { 764 762 struct nfs_inode *nfsi = NFS_I(ino); 765 763 struct nfs_client *clp = NFS_SERVER(ino)->nfs_client; ··· 771 767 if (!pnfs_enabled_sb(NFS_SERVER(ino))) 772 768 return NULL; 773 769 spin_lock(&ino->i_lock); 774 - lo = pnfs_find_alloc_layout(ino); 770 + lo = pnfs_find_alloc_layout(ino, gfp_flags); 775 771 if (lo == NULL) { 776 772 dprintk("%s ERROR: can't get pnfs_layout_hdr\n", __func__); 777 773 goto out_unlock; ··· 811 807 spin_unlock(&clp->cl_lock); 812 808 } 813 809 814 - lseg = send_layoutget(lo, ctx, iomode); 810 + lseg = send_layoutget(lo, ctx, iomode, gfp_flags); 815 811 if (!lseg && first) { 816 812 spin_lock(&clp->cl_lock); 817 813 list_del_init(&lo->plh_layouts); ··· 850 846 goto out; 851 847 } 852 848 /* Inject layout blob into I/O device driver */ 853 - lseg = NFS_SERVER(ino)->pnfs_curr_ld->alloc_lseg(lo, res); 849 + lseg = NFS_SERVER(ino)->pnfs_curr_ld->alloc_lseg(lo, res, lgp->gfp_flags); 854 850 if (!lseg || IS_ERR(lseg)) { 855 851 if (!lseg) 856 852 status = -ENOMEM; ··· 903 899 /* This is first coelesce call for a series of nfs_pages */ 904 900 pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, 905 901 prev->wb_context, 906 - IOMODE_READ); 902 + IOMODE_READ, 903 + GFP_KERNEL); 907 904 } 908 905 return NFS_SERVER(pgio->pg_inode)->pnfs_curr_ld->pg_test(pgio, prev, req); 909 906 } ··· 926 921 /* This is first coelesce call for a series of nfs_pages */ 927 922 pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, 928 923 prev->wb_context, 929 - IOMODE_RW); 924 + IOMODE_RW, 925 + GFP_NOFS); 930 926 } 931 927 return NFS_SERVER(pgio->pg_inode)->pnfs_curr_ld->pg_test(pgio, prev, req); 932 928 }
+3 -3
fs/nfs/pnfs.h
··· 70 70 const u32 id; 71 71 const char *name; 72 72 struct module *owner; 73 - struct pnfs_layout_segment * (*alloc_lseg) (struct pnfs_layout_hdr *layoutid, struct nfs4_layoutget_res *lgr); 73 + struct pnfs_layout_segment * (*alloc_lseg) (struct pnfs_layout_hdr *layoutid, struct nfs4_layoutget_res *lgr, gfp_t gfp_flags); 74 74 void (*free_lseg) (struct pnfs_layout_segment *lseg); 75 75 76 76 /* test for nfs page cache coalescing */ ··· 126 126 void put_lseg(struct pnfs_layout_segment *lseg); 127 127 struct pnfs_layout_segment * 128 128 pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx, 129 - enum pnfs_iomode access_type); 129 + enum pnfs_iomode access_type, gfp_t gfp_flags); 130 130 void set_pnfs_layoutdriver(struct nfs_server *, u32 id); 131 131 void unset_pnfs_layoutdriver(struct nfs_server *); 132 132 enum pnfs_try_status pnfs_try_to_write_data(struct nfs_write_data *, ··· 245 245 246 246 static inline struct pnfs_layout_segment * 247 247 pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx, 248 - enum pnfs_iomode access_type) 248 + enum pnfs_iomode access_type, gfp_t gfp_flags) 249 249 { 250 250 return NULL; 251 251 }
+2 -2
fs/nfs/read.c
··· 288 288 atomic_set(&req->wb_complete, requests); 289 289 290 290 BUG_ON(desc->pg_lseg != NULL); 291 - lseg = pnfs_update_layout(desc->pg_inode, req->wb_context, IOMODE_READ); 291 + lseg = pnfs_update_layout(desc->pg_inode, req->wb_context, IOMODE_READ, GFP_KERNEL); 292 292 ClearPageError(page); 293 293 offset = 0; 294 294 nbytes = desc->pg_count; ··· 351 351 } 352 352 req = nfs_list_entry(data->pages.next); 353 353 if ((!lseg) && list_is_singular(&data->pages)) 354 - lseg = pnfs_update_layout(desc->pg_inode, req->wb_context, IOMODE_READ); 354 + lseg = pnfs_update_layout(desc->pg_inode, req->wb_context, IOMODE_READ, GFP_KERNEL); 355 355 356 356 ret = nfs_read_rpcsetup(req, data, &nfs_read_full_ops, desc->pg_count, 357 357 0, lseg);
+2 -2
fs/nfs/write.c
··· 939 939 atomic_set(&req->wb_complete, requests); 940 940 941 941 BUG_ON(desc->pg_lseg); 942 - lseg = pnfs_update_layout(desc->pg_inode, req->wb_context, IOMODE_RW); 942 + lseg = pnfs_update_layout(desc->pg_inode, req->wb_context, IOMODE_RW, GFP_NOFS); 943 943 ClearPageError(page); 944 944 offset = 0; 945 945 nbytes = desc->pg_count; ··· 1013 1013 } 1014 1014 req = nfs_list_entry(data->pages.next); 1015 1015 if ((!lseg) && list_is_singular(&data->pages)) 1016 - lseg = pnfs_update_layout(desc->pg_inode, req->wb_context, IOMODE_RW); 1016 + lseg = pnfs_update_layout(desc->pg_inode, req->wb_context, IOMODE_RW, GFP_NOFS); 1017 1017 1018 1018 if ((desc->pg_ioflags & FLUSH_COND_STABLE) && 1019 1019 (desc->pg_moreio || NFS_I(desc->pg_inode)->ncommit))
+43 -18
fs/ocfs2/cluster/heartbeat.c
··· 539 539 540 540 /* We want to make sure that nobody is heartbeating on top of us -- 541 541 * this will help detect an invalid configuration. */ 542 - static int o2hb_check_last_timestamp(struct o2hb_region *reg) 542 + static void o2hb_check_last_timestamp(struct o2hb_region *reg) 543 543 { 544 - int node_num, ret; 545 544 struct o2hb_disk_slot *slot; 546 545 struct o2hb_disk_heartbeat_block *hb_block; 546 + char *errstr; 547 547 548 - node_num = o2nm_this_node(); 549 - 550 - ret = 1; 551 - slot = &reg->hr_slots[node_num]; 548 + slot = &reg->hr_slots[o2nm_this_node()]; 552 549 /* Don't check on our 1st timestamp */ 553 - if (slot->ds_last_time) { 554 - hb_block = slot->ds_raw_block; 550 + if (!slot->ds_last_time) 551 + return; 555 552 556 - if (le64_to_cpu(hb_block->hb_seq) != slot->ds_last_time) 557 - ret = 0; 558 - } 553 + hb_block = slot->ds_raw_block; 554 + if (le64_to_cpu(hb_block->hb_seq) == slot->ds_last_time && 555 + le64_to_cpu(hb_block->hb_generation) == slot->ds_last_generation && 556 + hb_block->hb_node == slot->ds_node_num) 557 + return; 559 558 560 - return ret; 559 + #define ERRSTR1 "Another node is heartbeating on device" 560 + #define ERRSTR2 "Heartbeat generation mismatch on device" 561 + #define ERRSTR3 "Heartbeat sequence mismatch on device" 562 + 563 + if (hb_block->hb_node != slot->ds_node_num) 564 + errstr = ERRSTR1; 565 + else if (le64_to_cpu(hb_block->hb_generation) != 566 + slot->ds_last_generation) 567 + errstr = ERRSTR2; 568 + else 569 + errstr = ERRSTR3; 570 + 571 + mlog(ML_ERROR, "%s (%s): expected(%u:0x%llx, 0x%llx), " 572 + "ondisk(%u:0x%llx, 0x%llx)\n", errstr, reg->hr_dev_name, 573 + slot->ds_node_num, (unsigned long long)slot->ds_last_generation, 574 + (unsigned long long)slot->ds_last_time, hb_block->hb_node, 575 + (unsigned long long)le64_to_cpu(hb_block->hb_generation), 576 + (unsigned long long)le64_to_cpu(hb_block->hb_seq)); 561 577 } 562 578 563 579 static inline void o2hb_prepare_block(struct o2hb_region *reg, ··· 999 983 /* With an up to date view of the slots, we can check that no 1000 984 * other node has been improperly configured to heartbeat in 1001 985 * our slot. */ 1002 - if (!o2hb_check_last_timestamp(reg)) 1003 - mlog(ML_ERROR, "Device \"%s\": another node is heartbeating " 1004 - "in our slot!\n", reg->hr_dev_name); 986 + o2hb_check_last_timestamp(reg); 1005 987 1006 988 /* fill in the proper info for our next heartbeat */ 1007 989 o2hb_prepare_block(reg, reg->hr_generation); ··· 1013 999 } 1014 1000 1015 1001 i = -1; 1016 - while((i = find_next_bit(configured_nodes, O2NM_MAX_NODES, i + 1)) < O2NM_MAX_NODES) { 1017 - 1002 + while((i = find_next_bit(configured_nodes, 1003 + O2NM_MAX_NODES, i + 1)) < O2NM_MAX_NODES) { 1018 1004 change |= o2hb_check_slot(reg, &reg->hr_slots[i]); 1019 1005 } 1020 1006 ··· 1704 1690 struct file *filp = NULL; 1705 1691 struct inode *inode = NULL; 1706 1692 ssize_t ret = -EINVAL; 1693 + int live_threshold; 1707 1694 1708 1695 if (reg->hr_bdev) 1709 1696 goto out; ··· 1781 1766 * A node is considered live after it has beat LIVE_THRESHOLD 1782 1767 * times. We're not steady until we've given them a chance 1783 1768 * _after_ our first read. 1769 + * The default threshold is bare minimum so as to limit the delay 1770 + * during mounts. For global heartbeat, the threshold doubled for the 1771 + * first region. 1784 1772 */ 1785 - atomic_set(&reg->hr_steady_iterations, O2HB_LIVE_THRESHOLD + 1); 1773 + live_threshold = O2HB_LIVE_THRESHOLD; 1774 + if (o2hb_global_heartbeat_active()) { 1775 + spin_lock(&o2hb_live_lock); 1776 + if (o2hb_pop_count(&o2hb_region_bitmap, O2NM_MAX_REGIONS) == 1) 1777 + live_threshold <<= 1; 1778 + spin_unlock(&o2hb_live_lock); 1779 + } 1780 + atomic_set(&reg->hr_steady_iterations, live_threshold + 1); 1786 1781 1787 1782 hb_task = kthread_run(o2hb_thread, reg, "o2hb-%s", 1788 1783 reg->hr_item.ci_name);
+1 -1
fs/ocfs2/dir.c
··· 2868 2868 bytes = blocks_wanted << sb->s_blocksize_bits; 2869 2869 struct ocfs2_super *osb = OCFS2_SB(dir->i_sb); 2870 2870 struct ocfs2_inode_info *oi = OCFS2_I(dir); 2871 - struct ocfs2_alloc_context *data_ac; 2871 + struct ocfs2_alloc_context *data_ac = NULL; 2872 2872 struct ocfs2_alloc_context *meta_ac = NULL; 2873 2873 struct buffer_head *dirdata_bh = NULL; 2874 2874 struct buffer_head *dx_root_bh = NULL;
+2 -1
fs/ocfs2/dlm/dlmdomain.c
··· 1614 1614 spin_unlock(&dlm->spinlock); 1615 1615 1616 1616 /* Support for global heartbeat and node info was added in 1.1 */ 1617 - if (dlm_protocol.pv_major > 1 || dlm_protocol.pv_minor > 0) { 1617 + if (dlm->dlm_locking_proto.pv_major > 1 || 1618 + dlm->dlm_locking_proto.pv_minor > 0) { 1618 1619 status = dlm_send_nodeinfo(dlm, ctxt->yes_resp_map); 1619 1620 if (status) { 1620 1621 mlog_errno(status);
+3
fs/ocfs2/dlm/dlmmaster.c
··· 2574 2574 res->state &= ~DLM_LOCK_RES_MIGRATING; 2575 2575 wake = 1; 2576 2576 spin_unlock(&res->spinlock); 2577 + if (dlm_is_host_down(ret)) 2578 + dlm_wait_for_node_death(dlm, target, 2579 + DLM_NODE_DEATH_WAIT_MAX); 2577 2580 goto leave; 2578 2581 } 2579 2582
+12
fs/ocfs2/file.c
··· 1607 1607 range = le32_to_cpu(rec->e_cpos) + ocfs2_rec_clusters(el, rec); 1608 1608 1609 1609 if (le32_to_cpu(rec->e_cpos) >= trunc_start) { 1610 + /* 1611 + * remove an entire extent record. 1612 + */ 1610 1613 *trunc_cpos = le32_to_cpu(rec->e_cpos); 1611 1614 /* 1612 1615 * Skip holes if any. ··· 1620 1617 *blkno = le64_to_cpu(rec->e_blkno); 1621 1618 *trunc_end = le32_to_cpu(rec->e_cpos); 1622 1619 } else if (range > trunc_start) { 1620 + /* 1621 + * remove a partial extent record, which means we're 1622 + * removing the last extent record. 1623 + */ 1623 1624 *trunc_cpos = trunc_start; 1625 + /* 1626 + * skip hole if any. 1627 + */ 1628 + if (range < *trunc_end) 1629 + *trunc_end = range; 1624 1630 *trunc_len = *trunc_end - trunc_start; 1625 1631 coff = trunc_start - le32_to_cpu(rec->e_cpos); 1626 1632 *blkno = le64_to_cpu(rec->e_blkno) +
+3
fs/ocfs2/journal.c
··· 1260 1260 { 1261 1261 struct ocfs2_journal *journal = osb->journal; 1262 1262 1263 + if (ocfs2_is_hard_readonly(osb)) 1264 + return; 1265 + 1263 1266 /* No need to queue up our truncate_log as regular cleanup will catch 1264 1267 * that */ 1265 1268 ocfs2_queue_recovery_completion(journal, osb->slot_num,
+1 -1
include/drm/drm_fb_helper.h
··· 127 127 128 128 int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info); 129 129 130 - bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper); 130 + int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper); 131 131 bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel); 132 132 int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper); 133 133 int drm_fb_helper_debug_enter(struct fb_info *info);
+1 -12
include/linux/capability.h
··· 546 546 extern bool capable(int cap); 547 547 extern bool ns_capable(struct user_namespace *ns, int cap); 548 548 extern bool task_ns_capable(struct task_struct *t, int cap); 549 - 550 - /** 551 - * nsown_capable - Check superior capability to one's own user_ns 552 - * @cap: The capability in question 553 - * 554 - * Return true if the current task has the given superior capability 555 - * targeted at its own user namespace. 556 - */ 557 - static inline bool nsown_capable(int cap) 558 - { 559 - return ns_capable(current_user_ns(), cap); 560 - } 549 + extern bool nsown_capable(int cap); 561 550 562 551 /* audit system wants to get cap info from files as well */ 563 552 extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps);
+8 -2
include/linux/cred.h
··· 146 146 void *security; /* subjective LSM security */ 147 147 #endif 148 148 struct user_struct *user; /* real user ID subscription */ 149 + struct user_namespace *user_ns; /* cached user->user_ns */ 149 150 struct group_info *group_info; /* supplementary groups for euid/fsgid */ 150 151 struct rcu_head rcu; /* RCU deletion hook */ 151 152 }; ··· 355 354 #define current_fsgid() (current_cred_xxx(fsgid)) 356 355 #define current_cap() (current_cred_xxx(cap_effective)) 357 356 #define current_user() (current_cred_xxx(user)) 358 - #define _current_user_ns() (current_cred_xxx(user)->user_ns) 359 357 #define current_security() (current_cred_xxx(security)) 360 358 361 - extern struct user_namespace *current_user_ns(void); 359 + #ifdef CONFIG_USER_NS 360 + #define current_user_ns() (current_cred_xxx(user_ns)) 361 + #else 362 + extern struct user_namespace init_user_ns; 363 + #define current_user_ns() (&init_user_ns) 364 + #endif 365 + 362 366 363 367 #define current_uid_gid(_uid, _gid) \ 364 368 do { \
-1
include/linux/device.h
··· 442 442 struct dev_archdata archdata; 443 443 444 444 struct device_node *of_node; /* associated device tree node */ 445 - const struct of_device_id *of_match; /* matching of_device_id from driver */ 446 445 447 446 dev_t devt; /* dev_t, creates the sysfs "dev" */ 448 447
+1
include/linux/fb.h
··· 832 832 #define FBINFO_CAN_FORCE_OUTPUT 0x200000 833 833 834 834 struct fb_info { 835 + atomic_t count; 835 836 int node; 836 837 int flags; 837 838 struct mutex lock; /* Lock for open/release/ioctl funcs */
-1
include/linux/fs.h
··· 358 358 #define FS_EXTENT_FL 0x00080000 /* Extents */ 359 359 #define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */ 360 360 #define FS_NOCOW_FL 0x00800000 /* Do not cow file */ 361 - #define FS_COW_FL 0x02000000 /* Cow file */ 362 361 #define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ 363 362 364 363 #define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
+1
include/linux/mmc/host.h
··· 183 183 struct work_struct clk_gate_work; /* delayed clock gate */ 184 184 unsigned int clk_old; /* old clock value cache */ 185 185 spinlock_t clk_lock; /* lock for clk fields */ 186 + struct mutex clk_gate_mutex; /* mutex for clock gating */ 186 187 #endif 187 188 188 189 /* host specific block data */
+1
include/linux/nfs_xdr.h
··· 233 233 struct nfs4_layoutget_args args; 234 234 struct nfs4_layoutget_res res; 235 235 struct pnfs_layout_segment **lsegpp; 236 + gfp_t gfp_flags; 236 237 }; 237 238 238 239 struct nfs4_getdeviceinfo_args {
+6 -2
include/linux/of_device.h
··· 21 21 static inline int of_driver_match_device(struct device *dev, 22 22 const struct device_driver *drv) 23 23 { 24 - dev->of_match = of_match_device(drv->of_match_table, dev); 25 - return dev->of_match != NULL; 24 + return of_match_device(drv->of_match_table, dev) != NULL; 26 25 } 27 26 28 27 extern struct platform_device *of_dev_get(struct platform_device *dev); ··· 57 58 58 59 static inline void of_device_node_put(struct device *dev) { } 59 60 61 + static inline const struct of_device_id *of_match_device( 62 + const struct of_device_id *matches, const struct device *dev) 63 + { 64 + return NULL; 65 + } 60 66 #endif /* CONFIG_OF_DEVICE */ 61 67 62 68 #endif /* _LINUX_OF_DEVICE_H */
+2
include/linux/proc_fs.h
··· 208 208 struct proc_dir_entry *parent,const char *dest) {return NULL;} 209 209 static inline struct proc_dir_entry *proc_mkdir(const char *name, 210 210 struct proc_dir_entry *parent) {return NULL;} 211 + static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, 212 + mode_t mode, struct proc_dir_entry *parent) { return NULL; } 211 213 212 214 static inline struct proc_dir_entry *create_proc_read_entry(const char *name, 213 215 mode_t mode, struct proc_dir_entry *base,
+13 -3
include/net/inet_ecn.h
··· 38 38 return outer; 39 39 } 40 40 41 - #define INET_ECN_xmit(sk) do { inet_sk(sk)->tos |= INET_ECN_ECT_0; } while (0) 42 - #define INET_ECN_dontxmit(sk) \ 43 - do { inet_sk(sk)->tos &= ~INET_ECN_MASK; } while (0) 41 + static inline void INET_ECN_xmit(struct sock *sk) 42 + { 43 + inet_sk(sk)->tos |= INET_ECN_ECT_0; 44 + if (inet6_sk(sk) != NULL) 45 + inet6_sk(sk)->tclass |= INET_ECN_ECT_0; 46 + } 47 + 48 + static inline void INET_ECN_dontxmit(struct sock *sk) 49 + { 50 + inet_sk(sk)->tos &= ~INET_ECN_MASK; 51 + if (inet6_sk(sk) != NULL) 52 + inet6_sk(sk)->tclass &= ~INET_ECN_MASK; 53 + } 44 54 45 55 #define IP6_ECN_flow_init(label) do { \ 46 56 (label) &= ~htonl(INET_ECN_MASK << 20); \
+4 -4
include/net/llc_pdu.h
··· 199 199 u8 ssap; 200 200 u8 ctrl_1; 201 201 u8 ctrl_2; 202 - }; 202 + } __packed; 203 203 204 204 static inline struct llc_pdu_sn *llc_pdu_sn_hdr(struct sk_buff *skb) 205 205 { ··· 211 211 u8 dsap; 212 212 u8 ssap; 213 213 u8 ctrl_1; 214 - }; 214 + } __packed; 215 215 216 216 static inline struct llc_pdu_un *llc_pdu_un_hdr(struct sk_buff *skb) 217 217 { ··· 359 359 u8 fmt_id; /* always 0x81 for LLC */ 360 360 u8 type; /* different if NULL/non-NULL LSAP */ 361 361 u8 rw; /* sender receive window */ 362 - }; 362 + } __packed; 363 363 364 364 /** 365 365 * llc_pdu_init_as_xid_cmd - sets bytes 3, 4 & 5 of LLC header as XID ··· 415 415 u8 curr_ssv; /* current send state variable val */ 416 416 u8 curr_rsv; /* current receive state variable */ 417 417 u8 ind_bits; /* indicator bits set with macro */ 418 - }; 418 + } __packed; 419 419 420 420 extern void llc_pdu_set_cmd_rsp(struct sk_buff *skb, u8 type); 421 421 extern void llc_pdu_set_pf_bit(struct sk_buff *skb, u8 bit_value);
+1
include/scsi/scsi_device.h
··· 169 169 sdev_dev; 170 170 171 171 struct execute_work ew; /* used to get process context on put */ 172 + struct work_struct requeue_work; 172 173 173 174 struct scsi_dh_data *scsi_dh_data; 174 175 enum scsi_device_state sdev_state;
+12
kernel/capability.c
··· 399 399 return ns_capable(task_cred_xxx(t, user)->user_ns, cap); 400 400 } 401 401 EXPORT_SYMBOL(task_ns_capable); 402 + 403 + /** 404 + * nsown_capable - Check superior capability to one's own user_ns 405 + * @cap: The capability in question 406 + * 407 + * Return true if the current task has the given superior capability 408 + * targeted at its own user namespace. 409 + */ 410 + bool nsown_capable(int cap) 411 + { 412 + return ns_capable(current_user_ns(), cap); 413 + }
+6 -6
kernel/cred.c
··· 54 54 .cap_effective = CAP_INIT_EFF_SET, 55 55 .cap_bset = CAP_INIT_BSET, 56 56 .user = INIT_USER, 57 + .user_ns = &init_user_ns, 57 58 .group_info = &init_groups, 58 59 #ifdef CONFIG_KEYS 59 60 .tgcred = &init_tgcred, ··· 411 410 goto error_put; 412 411 } 413 412 413 + /* cache user_ns in cred. Doesn't need a refcount because it will 414 + * stay pinned by cred->user 415 + */ 416 + new->user_ns = new->user->user_ns; 417 + 414 418 #ifdef CONFIG_KEYS 415 419 /* new threads get their own thread keyrings if their parent already 416 420 * had one */ ··· 746 740 return security_kernel_create_files_as(new, inode); 747 741 } 748 742 EXPORT_SYMBOL(set_create_files_as); 749 - 750 - struct user_namespace *current_user_ns(void) 751 - { 752 - return _current_user_ns(); 753 - } 754 - EXPORT_SYMBOL(current_user_ns); 755 743 756 744 #ifdef CONFIG_DEBUG_CREDENTIALS 757 745
+2 -2
kernel/time/clocksource.c
··· 685 685 /* Add clocksource to the clcoksource list */ 686 686 mutex_lock(&clocksource_mutex); 687 687 clocksource_enqueue(cs); 688 - clocksource_select(); 689 688 clocksource_enqueue_watchdog(cs); 689 + clocksource_select(); 690 690 mutex_unlock(&clocksource_mutex); 691 691 return 0; 692 692 } ··· 706 706 707 707 mutex_lock(&clocksource_mutex); 708 708 clocksource_enqueue(cs); 709 - clocksource_select(); 710 709 clocksource_enqueue_watchdog(cs); 710 + clocksource_select(); 711 711 mutex_unlock(&clocksource_mutex); 712 712 return 0; 713 713 }
+11 -1
kernel/time/tick-broadcast.c
··· 522 522 */ 523 523 void tick_broadcast_setup_oneshot(struct clock_event_device *bc) 524 524 { 525 + int cpu = smp_processor_id(); 526 + 525 527 /* Set it up only once ! */ 526 528 if (bc->event_handler != tick_handle_oneshot_broadcast) { 527 529 int was_periodic = bc->mode == CLOCK_EVT_MODE_PERIODIC; 528 - int cpu = smp_processor_id(); 529 530 530 531 bc->event_handler = tick_handle_oneshot_broadcast; 531 532 clockevents_set_mode(bc, CLOCK_EVT_MODE_ONESHOT); ··· 552 551 tick_broadcast_set_event(tick_next_period, 1); 553 552 } else 554 553 bc->next_event.tv64 = KTIME_MAX; 554 + } else { 555 + /* 556 + * The first cpu which switches to oneshot mode sets 557 + * the bit for all other cpus which are in the general 558 + * (periodic) broadcast mask. So the bit is set and 559 + * would prevent the first broadcast enter after this 560 + * to program the bc device. 561 + */ 562 + tick_broadcast_clear_oneshot(cpu); 555 563 } 556 564 } 557 565
+1 -1
lib/vsprintf.c
··· 797 797 return string(buf, end, uuid, spec); 798 798 } 799 799 800 - int kptr_restrict = 1; 800 + int kptr_restrict __read_mostly; 801 801 802 802 /* 803 803 * Show a '%p' thing. A kernel extension is that the '%p' is followed
+1
mm/page_alloc.c
··· 2358 2358 /** 2359 2359 * alloc_pages_exact_nid - allocate an exact number of physically-contiguous 2360 2360 * pages on a node. 2361 + * @nid: the preferred node ID where memory should be allocated 2361 2362 * @size: the number of bytes to allocate 2362 2363 * @gfp_mask: GFP flags for the allocation 2363 2364 *
+4 -6
mm/shmem.c
··· 1037 1037 struct address_space *mapping; 1038 1038 unsigned long index; 1039 1039 struct inode *inode; 1040 - bool unlock_mutex = false; 1041 1040 1042 1041 BUG_ON(!PageLocked(page)); 1043 1042 mapping = page->mapping; ··· 1071 1072 * we've taken the spinlock, because shmem_unuse_inode() will 1072 1073 * prune a !swapped inode from the swaplist under both locks. 1073 1074 */ 1074 - if (swap.val && list_empty(&info->swaplist)) { 1075 + if (swap.val) { 1075 1076 mutex_lock(&shmem_swaplist_mutex); 1076 - /* move instead of add in case we're racing */ 1077 - list_move_tail(&info->swaplist, &shmem_swaplist); 1078 - unlock_mutex = true; 1077 + if (list_empty(&info->swaplist)) 1078 + list_add_tail(&info->swaplist, &shmem_swaplist); 1079 1079 } 1080 1080 1081 1081 spin_lock(&info->lock); 1082 - if (unlock_mutex) 1082 + if (swap.val) 1083 1083 mutex_unlock(&shmem_swaplist_mutex); 1084 1084 1085 1085 if (index >= info->next_index) {
+1 -1
mm/vmscan.c
··· 937 937 * back off and wait for congestion to clear because further reclaim 938 938 * will encounter the same problem 939 939 */ 940 - if (nr_dirty == nr_congested && nr_dirty != 0) 940 + if (nr_dirty && nr_dirty == nr_congested && scanning_global_lru(sc)) 941 941 zone_set_flag(zone, ZONE_CONGESTED); 942 942 943 943 free_page_list(&free_pages);
+1
net/9p/protocol.c
··· 674 674 } 675 675 676 676 strcpy(dirent->d_name, nameptr); 677 + kfree(nameptr); 677 678 678 679 out: 679 680 return fake_pdu.offset;
+1 -1
net/bridge/br_netfilter.c
··· 737 737 nf_bridge->mask |= BRNF_PKT_TYPE; 738 738 } 739 739 740 - if (br_parse_ip_options(skb)) 740 + if (pf == PF_INET && br_parse_ip_options(skb)) 741 741 return NF_DROP; 742 742 743 743 /* The physdev module checks on this */
+8 -14
net/core/dev.c
··· 5186 5186 /* Fix illegal checksum combinations */ 5187 5187 if ((features & NETIF_F_HW_CSUM) && 5188 5188 (features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) { 5189 - netdev_info(dev, "mixed HW and IP checksum settings.\n"); 5189 + netdev_warn(dev, "mixed HW and IP checksum settings.\n"); 5190 5190 features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM); 5191 5191 } 5192 5192 5193 5193 if ((features & NETIF_F_NO_CSUM) && 5194 5194 (features & (NETIF_F_HW_CSUM|NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) { 5195 - netdev_info(dev, "mixed no checksumming and other settings.\n"); 5195 + netdev_warn(dev, "mixed no checksumming and other settings.\n"); 5196 5196 features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM|NETIF_F_HW_CSUM); 5197 5197 } 5198 5198 5199 5199 /* Fix illegal SG+CSUM combinations. */ 5200 5200 if ((features & NETIF_F_SG) && 5201 5201 !(features & NETIF_F_ALL_CSUM)) { 5202 - netdev_info(dev, 5203 - "Dropping NETIF_F_SG since no checksum feature.\n"); 5202 + netdev_dbg(dev, 5203 + "Dropping NETIF_F_SG since no checksum feature.\n"); 5204 5204 features &= ~NETIF_F_SG; 5205 5205 } 5206 5206 5207 5207 /* TSO requires that SG is present as well. */ 5208 5208 if ((features & NETIF_F_ALL_TSO) && !(features & NETIF_F_SG)) { 5209 - netdev_info(dev, "Dropping TSO features since no SG feature.\n"); 5209 + netdev_dbg(dev, "Dropping TSO features since no SG feature.\n"); 5210 5210 features &= ~NETIF_F_ALL_TSO; 5211 5211 } 5212 5212 ··· 5216 5216 5217 5217 /* Software GSO depends on SG. */ 5218 5218 if ((features & NETIF_F_GSO) && !(features & NETIF_F_SG)) { 5219 - netdev_info(dev, "Dropping NETIF_F_GSO since no SG feature.\n"); 5219 + netdev_dbg(dev, "Dropping NETIF_F_GSO since no SG feature.\n"); 5220 5220 features &= ~NETIF_F_GSO; 5221 5221 } 5222 5222 ··· 5226 5226 if (!((features & NETIF_F_GEN_CSUM) || 5227 5227 (features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM)) 5228 5228 == (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) { 5229 - netdev_info(dev, 5229 + netdev_dbg(dev, 5230 5230 "Dropping NETIF_F_UFO since no checksum offload features.\n"); 5231 5231 features &= ~NETIF_F_UFO; 5232 5232 } 5233 5233 5234 5234 if (!(features & NETIF_F_SG)) { 5235 - netdev_info(dev, 5235 + netdev_dbg(dev, 5236 5236 "Dropping NETIF_F_UFO since no NETIF_F_SG feature.\n"); 5237 5237 features &= ~NETIF_F_UFO; 5238 5238 } ··· 5413 5413 dev->hw_features |= NETIF_F_SOFT_FEATURES; 5414 5414 dev->features |= NETIF_F_SOFT_FEATURES; 5415 5415 dev->wanted_features = dev->features & dev->hw_features; 5416 - 5417 - /* Avoid warning from netdev_fix_features() for GSO without SG */ 5418 - if (!(dev->wanted_features & NETIF_F_SG)) { 5419 - dev->wanted_features &= ~NETIF_F_GSO; 5420 - dev->features &= ~NETIF_F_GSO; 5421 - } 5422 5416 5423 5417 /* Enable GRO and NETIF_F_HIGHDMA for vlans by default, 5424 5418 * vlan_dev_init() will do the dev->features check, so these features
+4
net/mac80211/tx.c
··· 237 237 &local->dynamic_ps_disable_work); 238 238 } 239 239 240 + /* Don't restart the timer if we're not disassociated */ 241 + if (!ifmgd->associated) 242 + return TX_CONTINUE; 243 + 240 244 mod_timer(&local->dynamic_ps_timer, jiffies + 241 245 msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout)); 242 246
+1 -1
net/netfilter/ipvs/ip_vs_app.c
··· 572 572 .open = ip_vs_app_open, 573 573 .read = seq_read, 574 574 .llseek = seq_lseek, 575 - .release = seq_release, 575 + .release = seq_release_net, 576 576 }; 577 577 #endif 578 578
+2 -2
net/netfilter/ipvs/ip_vs_conn.c
··· 1046 1046 .open = ip_vs_conn_open, 1047 1047 .read = seq_read, 1048 1048 .llseek = seq_lseek, 1049 - .release = seq_release, 1049 + .release = seq_release_net, 1050 1050 }; 1051 1051 1052 1052 static const char *ip_vs_origin_name(unsigned flags) ··· 1114 1114 .open = ip_vs_conn_sync_open, 1115 1115 .read = seq_read, 1116 1116 .llseek = seq_lseek, 1117 - .release = seq_release, 1117 + .release = seq_release_net, 1118 1118 }; 1119 1119 1120 1120 #endif
+3 -3
net/netfilter/ipvs/ip_vs_ctl.c
··· 2066 2066 .open = ip_vs_info_open, 2067 2067 .read = seq_read, 2068 2068 .llseek = seq_lseek, 2069 - .release = seq_release_private, 2069 + .release = seq_release_net, 2070 2070 }; 2071 2071 2072 2072 #endif ··· 2109 2109 .open = ip_vs_stats_seq_open, 2110 2110 .read = seq_read, 2111 2111 .llseek = seq_lseek, 2112 - .release = single_release, 2112 + .release = single_release_net, 2113 2113 }; 2114 2114 2115 2115 static int ip_vs_stats_percpu_show(struct seq_file *seq, void *v) ··· 2178 2178 .open = ip_vs_stats_percpu_seq_open, 2179 2179 .read = seq_read, 2180 2180 .llseek = seq_lseek, 2181 - .release = single_release, 2181 + .release = single_release_net, 2182 2182 }; 2183 2183 #endif 2184 2184
-4
security/selinux/ss/policydb.c
··· 1819 1819 goto out; 1820 1820 nel = le32_to_cpu(buf[0]); 1821 1821 1822 - printk(KERN_ERR "%s: nel=%d\n", __func__, nel); 1823 - 1824 1822 last = p->filename_trans; 1825 1823 while (last && last->next) 1826 1824 last = last->next; ··· 1854 1856 if (rc) 1855 1857 goto out; 1856 1858 name[len] = 0; 1857 - 1858 - printk(KERN_ERR "%s: ft=%p ft->name=%p ft->name=%s\n", __func__, ft, ft->name, ft->name); 1859 1859 1860 1860 rc = next_entry(buf, fp, sizeof(u32) * 4); 1861 1861 if (rc)
+5 -5
sound/soc/codecs/ssm2602.c
··· 139 139 SOC_DOUBLE_R("Capture Switch", SSM2602_LINVOL, SSM2602_RINVOL, 7, 1, 1), 140 140 141 141 SOC_SINGLE("Mic Boost (+20dB)", SSM2602_APANA, 0, 1, 0), 142 - SOC_SINGLE("Mic Boost2 (+20dB)", SSM2602_APANA, 7, 1, 0), 142 + SOC_SINGLE("Mic Boost2 (+20dB)", SSM2602_APANA, 8, 1, 0), 143 143 SOC_SINGLE("Mic Switch", SSM2602_APANA, 1, 1, 1), 144 144 145 145 SOC_SINGLE("Sidetone Playback Volume", SSM2602_APANA, 6, 3, 1), ··· 602 602 .read = ssm2602_read_reg_cache, 603 603 .write = ssm2602_write, 604 604 .set_bias_level = ssm2602_set_bias_level, 605 - .reg_cache_size = sizeof(ssm2602_reg), 605 + .reg_cache_size = ARRAY_SIZE(ssm2602_reg), 606 606 .reg_word_size = sizeof(u16), 607 607 .reg_cache_default = ssm2602_reg, 608 608 }; ··· 614 614 * low = 0x1a 615 615 * high = 0x1b 616 616 */ 617 - static int ssm2602_i2c_probe(struct i2c_client *i2c, 617 + static int __devinit ssm2602_i2c_probe(struct i2c_client *i2c, 618 618 const struct i2c_device_id *id) 619 619 { 620 620 struct ssm2602_priv *ssm2602; ··· 635 635 return ret; 636 636 } 637 637 638 - static int ssm2602_i2c_remove(struct i2c_client *client) 638 + static int __devexit ssm2602_i2c_remove(struct i2c_client *client) 639 639 { 640 640 snd_soc_unregister_codec(&client->dev); 641 641 kfree(i2c_get_clientdata(client)); ··· 655 655 .owner = THIS_MODULE, 656 656 }, 657 657 .probe = ssm2602_i2c_probe, 658 - .remove = ssm2602_i2c_remove, 658 + .remove = __devexit_p(ssm2602_i2c_remove), 659 659 .id_table = ssm2602_i2c_id, 660 660 }; 661 661 #endif
-2
sound/soc/codecs/uda134x.c
··· 601 601 .reg_cache_step = 1, 602 602 .read = uda134x_read_reg_cache, 603 603 .write = uda134x_write, 604 - #ifdef POWER_OFF_ON_STANDBY 605 604 .set_bias_level = uda134x_set_bias_level, 606 - #endif 607 605 }; 608 606 609 607 static int __devinit uda134x_codec_probe(struct platform_device *pdev)
+1 -1
sound/soc/codecs/wm8903.c
··· 692 692 SOC_SINGLE_TLV("DRC Startup Volume", WM8903_DRC_0, 6, 18, 0, drc_tlv_startup), 693 693 694 694 SOC_DOUBLE_R_TLV("Digital Capture Volume", WM8903_ADC_DIGITAL_VOLUME_LEFT, 695 - WM8903_ADC_DIGITAL_VOLUME_RIGHT, 1, 96, 0, digital_tlv), 695 + WM8903_ADC_DIGITAL_VOLUME_RIGHT, 1, 120, 0, digital_tlv), 696 696 SOC_ENUM("ADC Companding Mode", adc_companding), 697 697 SOC_SINGLE("ADC Companding Switch", WM8903_AUDIO_INTERFACE_0, 3, 1, 0), 698 698
+1 -1
sound/soc/jz4740/jz4740-i2s.c
··· 133 133 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); 134 134 uint32_t conf; 135 135 136 - if (!dai->active) 136 + if (dai->active) 137 137 return; 138 138 139 139 conf = jz4740_i2s_read(i2s, JZ_REG_AIC_CONF);
+6
sound/soc/mid-x86/sst_platform.c
··· 376 376 return 0; 377 377 } 378 378 379 + static int sst_platform_pcm_hw_free(struct snd_pcm_substream *substream) 380 + { 381 + return snd_pcm_lib_free_pages(substream); 382 + } 383 + 379 384 static struct snd_pcm_ops sst_platform_ops = { 380 385 .open = sst_platform_open, 381 386 .close = sst_platform_close, ··· 389 384 .trigger = sst_platform_pcm_trigger, 390 385 .pointer = sst_platform_pcm_pointer, 391 386 .hw_params = sst_platform_pcm_hw_params, 387 + .hw_free = sst_platform_pcm_hw_free, 392 388 }; 393 389 394 390 static void sst_pcm_free(struct snd_pcm *pcm)
+2
sound/soc/soc-core.c
··· 3291 3291 if (!card->name || !card->dev) 3292 3292 return -EINVAL; 3293 3293 3294 + dev_set_drvdata(card->dev, card); 3295 + 3294 3296 snd_soc_initialize_card_lists(card); 3295 3297 3296 3298 soc_init_card_debugfs(card);
+1 -1
tools/perf/builtin-record.c
··· 427 427 { 428 428 int i; 429 429 430 - for (i = 0; i < evsel_list->cpus->nr; i++) { 430 + for (i = 0; i < evsel_list->nr_mmaps; i++) { 431 431 if (evsel_list->mmap[i].base) 432 432 mmap_read(&evsel_list->mmap[i]); 433 433 }
+1 -1
tools/perf/builtin-test.c
··· 549 549 ++foo; 550 550 } 551 551 552 - while ((event = perf_evlist__read_on_cpu(evlist, 0)) != NULL) { 552 + while ((event = perf_evlist__mmap_read(evlist, 0)) != NULL) { 553 553 struct perf_sample sample; 554 554 555 555 if (event->header.type != PERF_RECORD_SAMPLE) {
+4 -4
tools/perf/builtin-top.c
··· 801 801 } 802 802 } 803 803 804 - static void perf_session__mmap_read_cpu(struct perf_session *self, int cpu) 804 + static void perf_session__mmap_read_idx(struct perf_session *self, int idx) 805 805 { 806 806 struct perf_sample sample; 807 807 union perf_event *event; 808 808 809 - while ((event = perf_evlist__read_on_cpu(top.evlist, cpu)) != NULL) { 809 + while ((event = perf_evlist__mmap_read(top.evlist, idx)) != NULL) { 810 810 perf_session__parse_sample(self, event, &sample); 811 811 812 812 if (event->header.type == PERF_RECORD_SAMPLE) ··· 820 820 { 821 821 int i; 822 822 823 - for (i = 0; i < top.evlist->cpus->nr; i++) 824 - perf_session__mmap_read_cpu(self, i); 823 + for (i = 0; i < top.evlist->nr_mmaps; i++) 824 + perf_session__mmap_read_idx(self, i); 825 825 } 826 826 827 827 static void start_counters(struct perf_evlist *evlist)
+107 -46
tools/perf/util/evlist.c
··· 166 166 return NULL; 167 167 } 168 168 169 - union perf_event *perf_evlist__read_on_cpu(struct perf_evlist *evlist, int cpu) 169 + union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx) 170 170 { 171 171 /* XXX Move this to perf.c, making it generally available */ 172 172 unsigned int page_size = sysconf(_SC_PAGE_SIZE); 173 - struct perf_mmap *md = &evlist->mmap[cpu]; 173 + struct perf_mmap *md = &evlist->mmap[idx]; 174 174 unsigned int head = perf_mmap__read_head(md); 175 175 unsigned int old = md->prev; 176 176 unsigned char *data = md->base + page_size; ··· 235 235 236 236 void perf_evlist__munmap(struct perf_evlist *evlist) 237 237 { 238 - int cpu; 238 + int i; 239 239 240 - for (cpu = 0; cpu < evlist->cpus->nr; cpu++) { 241 - if (evlist->mmap[cpu].base != NULL) { 242 - munmap(evlist->mmap[cpu].base, evlist->mmap_len); 243 - evlist->mmap[cpu].base = NULL; 240 + for (i = 0; i < evlist->nr_mmaps; i++) { 241 + if (evlist->mmap[i].base != NULL) { 242 + munmap(evlist->mmap[i].base, evlist->mmap_len); 243 + evlist->mmap[i].base = NULL; 244 244 } 245 245 } 246 + 247 + free(evlist->mmap); 248 + evlist->mmap = NULL; 246 249 } 247 250 248 251 int perf_evlist__alloc_mmap(struct perf_evlist *evlist) 249 252 { 250 - evlist->mmap = zalloc(evlist->cpus->nr * sizeof(struct perf_mmap)); 253 + evlist->nr_mmaps = evlist->cpus->nr; 254 + if (evlist->cpus->map[0] == -1) 255 + evlist->nr_mmaps = evlist->threads->nr; 256 + evlist->mmap = zalloc(evlist->nr_mmaps * sizeof(struct perf_mmap)); 251 257 return evlist->mmap != NULL ? 0 : -ENOMEM; 252 258 } 253 259 254 260 static int __perf_evlist__mmap(struct perf_evlist *evlist, struct perf_evsel *evsel, 255 - int cpu, int prot, int mask, int fd) 261 + int idx, int prot, int mask, int fd) 256 262 { 257 - evlist->mmap[cpu].prev = 0; 258 - evlist->mmap[cpu].mask = mask; 259 - evlist->mmap[cpu].base = mmap(NULL, evlist->mmap_len, prot, 263 + evlist->mmap[idx].prev = 0; 264 + evlist->mmap[idx].mask = mask; 265 + evlist->mmap[idx].base = mmap(NULL, evlist->mmap_len, prot, 260 266 MAP_SHARED, fd, 0); 261 - if (evlist->mmap[cpu].base == MAP_FAILED) { 262 - if (evlist->cpus->map[cpu] == -1 && evsel->attr.inherit) 267 + if (evlist->mmap[idx].base == MAP_FAILED) { 268 + if (evlist->cpus->map[idx] == -1 && evsel->attr.inherit) 263 269 ui__warning("Inherit is not allowed on per-task " 264 270 "events using mmap.\n"); 265 271 return -1; ··· 273 267 274 268 perf_evlist__add_pollfd(evlist, fd); 275 269 return 0; 270 + } 271 + 272 + static int perf_evlist__mmap_per_cpu(struct perf_evlist *evlist, int prot, int mask) 273 + { 274 + struct perf_evsel *evsel; 275 + int cpu, thread; 276 + 277 + for (cpu = 0; cpu < evlist->cpus->nr; cpu++) { 278 + int output = -1; 279 + 280 + for (thread = 0; thread < evlist->threads->nr; thread++) { 281 + list_for_each_entry(evsel, &evlist->entries, node) { 282 + int fd = FD(evsel, cpu, thread); 283 + 284 + if (output == -1) { 285 + output = fd; 286 + if (__perf_evlist__mmap(evlist, evsel, cpu, 287 + prot, mask, output) < 0) 288 + goto out_unmap; 289 + } else { 290 + if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, output) != 0) 291 + goto out_unmap; 292 + } 293 + 294 + if ((evsel->attr.read_format & PERF_FORMAT_ID) && 295 + perf_evlist__id_add_fd(evlist, evsel, cpu, thread, fd) < 0) 296 + goto out_unmap; 297 + } 298 + } 299 + } 300 + 301 + return 0; 302 + 303 + out_unmap: 304 + for (cpu = 0; cpu < evlist->cpus->nr; cpu++) { 305 + if (evlist->mmap[cpu].base != NULL) { 306 + munmap(evlist->mmap[cpu].base, evlist->mmap_len); 307 + evlist->mmap[cpu].base = NULL; 308 + } 309 + } 310 + return -1; 311 + } 312 + 313 + static int perf_evlist__mmap_per_thread(struct perf_evlist *evlist, int prot, int mask) 314 + { 315 + struct perf_evsel *evsel; 316 + int thread; 317 + 318 + for (thread = 0; thread < evlist->threads->nr; thread++) { 319 + int output = -1; 320 + 321 + list_for_each_entry(evsel, &evlist->entries, node) { 322 + int fd = FD(evsel, 0, thread); 323 + 324 + if (output == -1) { 325 + output = fd; 326 + if (__perf_evlist__mmap(evlist, evsel, thread, 327 + prot, mask, output) < 0) 328 + goto out_unmap; 329 + } else { 330 + if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, output) != 0) 331 + goto out_unmap; 332 + } 333 + 334 + if ((evsel->attr.read_format & PERF_FORMAT_ID) && 335 + perf_evlist__id_add_fd(evlist, evsel, 0, thread, fd) < 0) 336 + goto out_unmap; 337 + } 338 + } 339 + 340 + return 0; 341 + 342 + out_unmap: 343 + for (thread = 0; thread < evlist->threads->nr; thread++) { 344 + if (evlist->mmap[thread].base != NULL) { 345 + munmap(evlist->mmap[thread].base, evlist->mmap_len); 346 + evlist->mmap[thread].base = NULL; 347 + } 348 + } 349 + return -1; 276 350 } 277 351 278 352 /** perf_evlist__mmap - Create per cpu maps to receive events ··· 373 287 int perf_evlist__mmap(struct perf_evlist *evlist, int pages, bool overwrite) 374 288 { 375 289 unsigned int page_size = sysconf(_SC_PAGE_SIZE); 376 - int mask = pages * page_size - 1, cpu; 377 - struct perf_evsel *first_evsel, *evsel; 290 + int mask = pages * page_size - 1; 291 + struct perf_evsel *evsel; 378 292 const struct cpu_map *cpus = evlist->cpus; 379 293 const struct thread_map *threads = evlist->threads; 380 - int thread, prot = PROT_READ | (overwrite ? 0 : PROT_WRITE); 294 + int prot = PROT_READ | (overwrite ? 0 : PROT_WRITE); 381 295 382 296 if (evlist->mmap == NULL && perf_evlist__alloc_mmap(evlist) < 0) 383 297 return -ENOMEM; ··· 387 301 388 302 evlist->overwrite = overwrite; 389 303 evlist->mmap_len = (pages + 1) * page_size; 390 - first_evsel = list_entry(evlist->entries.next, struct perf_evsel, node); 391 304 392 305 list_for_each_entry(evsel, &evlist->entries, node) { 393 306 if ((evsel->attr.read_format & PERF_FORMAT_ID) && 394 307 evsel->sample_id == NULL && 395 308 perf_evsel__alloc_id(evsel, cpus->nr, threads->nr) < 0) 396 309 return -ENOMEM; 397 - 398 - for (cpu = 0; cpu < cpus->nr; cpu++) { 399 - for (thread = 0; thread < threads->nr; thread++) { 400 - int fd = FD(evsel, cpu, thread); 401 - 402 - if (evsel->idx || thread) { 403 - if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, 404 - FD(first_evsel, cpu, 0)) != 0) 405 - goto out_unmap; 406 - } else if (__perf_evlist__mmap(evlist, evsel, cpu, 407 - prot, mask, fd) < 0) 408 - goto out_unmap; 409 - 410 - if ((evsel->attr.read_format & PERF_FORMAT_ID) && 411 - perf_evlist__id_add_fd(evlist, evsel, cpu, thread, fd) < 0) 412 - goto out_unmap; 413 - } 414 - } 415 310 } 416 311 417 - return 0; 312 + if (evlist->cpus->map[0] == -1) 313 + return perf_evlist__mmap_per_thread(evlist, prot, mask); 418 314 419 - out_unmap: 420 - for (cpu = 0; cpu < cpus->nr; cpu++) { 421 - if (evlist->mmap[cpu].base != NULL) { 422 - munmap(evlist->mmap[cpu].base, evlist->mmap_len); 423 - evlist->mmap[cpu].base = NULL; 424 - } 425 - } 426 - return -1; 315 + return perf_evlist__mmap_per_cpu(evlist, prot, mask); 427 316 } 428 317 429 318 int perf_evlist__create_maps(struct perf_evlist *evlist, pid_t target_pid, ··· 409 348 if (evlist->threads == NULL) 410 349 return -1; 411 350 412 - if (target_tid != -1) 351 + if (cpu_list == NULL && target_tid != -1) 413 352 evlist->cpus = cpu_map__dummy_new(); 414 353 else 415 354 evlist->cpus = cpu_map__new(cpu_list);
+2 -1
tools/perf/util/evlist.h
··· 17 17 struct hlist_head heads[PERF_EVLIST__HLIST_SIZE]; 18 18 int nr_entries; 19 19 int nr_fds; 20 + int nr_mmaps; 20 21 int mmap_len; 21 22 bool overwrite; 22 23 union perf_event event_copy; ··· 47 46 48 47 struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id); 49 48 50 - union perf_event *perf_evlist__read_on_cpu(struct perf_evlist *self, int cpu); 49 + union perf_event *perf_evlist__mmap_read(struct perf_evlist *self, int idx); 51 50 52 51 int perf_evlist__alloc_mmap(struct perf_evlist *evlist); 53 52 int perf_evlist__mmap(struct perf_evlist *evlist, int pages, bool overwrite);
+1 -1
tools/perf/util/python.c
··· 680 680 &cpu, &sample_id_all)) 681 681 return NULL; 682 682 683 - event = perf_evlist__read_on_cpu(evlist, cpu); 683 + event = perf_evlist__mmap_read(evlist, cpu); 684 684 if (event != NULL) { 685 685 struct perf_evsel *first; 686 686 PyObject *pyevent = pyrf_event__new(event);