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

Configure Feed

Select the types of activity you want to include in your feed.

tty: use pr_warn_ratelimited() for deprecated serial flags

Use pr_warn_ratelimited() when warning about deprecated serial flags
instead of open coding.

Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20210407095208.31838-5-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Johan Hovold and committed by
Greg Kroah-Hartman
1b7bc6b1 8871de06

+6 -12
+6 -12
drivers/tty/tty_io.c
··· 2626 2626 2627 2627 static int tty_tiocsserial(struct tty_struct *tty, struct serial_struct __user *ss) 2628 2628 { 2629 - static DEFINE_RATELIMIT_STATE(depr_flags, 2630 - DEFAULT_RATELIMIT_INTERVAL, 2631 - DEFAULT_RATELIMIT_BURST); 2632 2629 char comm[TASK_COMM_LEN]; 2633 2630 struct serial_struct v; 2634 2631 int flags; ··· 2635 2638 2636 2639 flags = v.flags & ASYNC_DEPRECATED; 2637 2640 2638 - if (flags && __ratelimit(&depr_flags)) 2639 - pr_warn("%s: '%s' is using deprecated serial flags (with no effect): %.8x\n", 2640 - __func__, get_task_comm(comm, current), flags); 2641 + if (flags) 2642 + pr_warn_ratelimited("%s: '%s' is using deprecated serial flags (with no effect): %.8x\n", 2643 + __func__, get_task_comm(comm, current), flags); 2641 2644 if (!tty->ops->set_serial) 2642 2645 return -ENOTTY; 2643 2646 return tty->ops->set_serial(tty, &v); ··· 2838 2841 static int compat_tty_tiocsserial(struct tty_struct *tty, 2839 2842 struct serial_struct32 __user *ss) 2840 2843 { 2841 - static DEFINE_RATELIMIT_STATE(depr_flags, 2842 - DEFAULT_RATELIMIT_INTERVAL, 2843 - DEFAULT_RATELIMIT_BURST); 2844 2844 char comm[TASK_COMM_LEN]; 2845 2845 struct serial_struct32 v32; 2846 2846 struct serial_struct v; ··· 2854 2860 2855 2861 flags = v.flags & ASYNC_DEPRECATED; 2856 2862 2857 - if (flags && __ratelimit(&depr_flags)) 2858 - pr_warn("%s: '%s' is using deprecated serial flags (with no effect): %.8x\n", 2859 - __func__, get_task_comm(comm, current), flags); 2863 + if (flags) 2864 + pr_warn_ratelimited("%s: '%s' is using deprecated serial flags (with no effect): %.8x\n", 2865 + __func__, get_task_comm(comm, current), flags); 2860 2866 if (!tty->ops->set_serial) 2861 2867 return -ENOTTY; 2862 2868 return tty->ops->set_serial(tty, &v);