diff options
Diffstat (limited to 'kernel/trace/trace_events.c')
-rw-r--r-- | kernel/trace/trace_events.c | 40 |
1 files changed, 6 insertions, 34 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 45f1099386b6..df394bc6d54b 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -414,10 +414,11 @@ static ssize_t | |||
414 | system_enable_read(struct file *filp, char __user *ubuf, size_t cnt, | 414 | system_enable_read(struct file *filp, char __user *ubuf, size_t cnt, |
415 | loff_t *ppos) | 415 | loff_t *ppos) |
416 | { | 416 | { |
417 | const char set_to_char[4] = { '?', '0', '1', 'X' }; | ||
417 | const char *system = filp->private_data; | 418 | const char *system = filp->private_data; |
418 | struct ftrace_event_call *call; | 419 | struct ftrace_event_call *call; |
419 | char buf[2]; | 420 | char buf[2]; |
420 | int set = -1; | 421 | int set = 0; |
421 | int ret; | 422 | int ret; |
422 | 423 | ||
423 | mutex_lock(&event_mutex); | 424 | mutex_lock(&event_mutex); |
@@ -433,47 +434,18 @@ system_enable_read(struct file *filp, char __user *ubuf, size_t cnt, | |||
433 | * or if all events or cleared, or if we have | 434 | * or if all events or cleared, or if we have |
434 | * a mixture. | 435 | * a mixture. |
435 | */ | 436 | */ |
436 | if (call->enabled) { | 437 | set |= (1 << !!call->enabled); |
437 | switch (set) { | 438 | |
438 | case -1: | ||
439 | set = 1; | ||
440 | break; | ||
441 | case 0: | ||
442 | set = 2; | ||
443 | break; | ||
444 | } | ||
445 | } else { | ||
446 | switch (set) { | ||
447 | case -1: | ||
448 | set = 0; | ||
449 | break; | ||
450 | case 1: | ||
451 | set = 2; | ||
452 | break; | ||
453 | } | ||
454 | } | ||
455 | /* | 439 | /* |
456 | * If we have a mixture, no need to look further. | 440 | * If we have a mixture, no need to look further. |
457 | */ | 441 | */ |
458 | if (set == 2) | 442 | if (set == 3) |
459 | break; | 443 | break; |
460 | } | 444 | } |
461 | mutex_unlock(&event_mutex); | 445 | mutex_unlock(&event_mutex); |
462 | 446 | ||
447 | buf[0] = set_to_char[set]; | ||
463 | buf[1] = '\n'; | 448 | buf[1] = '\n'; |
464 | switch (set) { | ||
465 | case 0: | ||
466 | buf[0] = '0'; | ||
467 | break; | ||
468 | case 1: | ||
469 | buf[0] = '1'; | ||
470 | break; | ||
471 | case 2: | ||
472 | buf[0] = 'X'; | ||
473 | break; | ||
474 | default: | ||
475 | buf[0] = '?'; | ||
476 | } | ||
477 | 449 | ||
478 | ret = simple_read_from_buffer(ubuf, cnt, ppos, buf, 2); | 450 | ret = simple_read_from_buffer(ubuf, cnt, ppos, buf, 2); |
479 | 451 | ||