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

tty: remove buf parameter from tty_name()

tty_name no longer uses the buf parameter, so remove it along with all
the 64 byte stack buffers that used to be passed in.

Mostly generated by the coccinelle script

@depends on patch@
identifier buf;
constant C;
expression tty;
@@
- char buf[C];
<+...
- tty_name(tty, buf)
+ tty_name(tty)
...+>

allmodconfig compiles, so I'm fairly confident the stack buffers
weren't used for other purposes as well.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Rasmus Villemoes and committed by
Greg Kroah-Hartman
429b4749 917162c9

+28 -57
+2 -3
drivers/input/serio/serport.c
··· 167 167 { 168 168 struct serport *serport = (struct serport*) tty->disc_data; 169 169 struct serio *serio; 170 - char name[64]; 171 170 172 171 if (test_and_set_bit(SERPORT_BUSY, &serport->flags)) 173 172 return -EBUSY; ··· 176 177 return -ENOMEM; 177 178 178 179 strlcpy(serio->name, "Serial port", sizeof(serio->name)); 179 - snprintf(serio->phys, sizeof(serio->phys), "%s/serio0", tty_name(tty, name)); 180 + snprintf(serio->phys, sizeof(serio->phys), "%s/serio0", tty_name(tty)); 180 181 serio->id = serport->id; 181 182 serio->id.type = SERIO_RS232; 182 183 serio->write = serport_serio_write; ··· 186 187 serio->dev.parent = tty->dev; 187 188 188 189 serio_register_port(serport->serio); 189 - printk(KERN_INFO "serio: Serial port %s\n", tty_name(tty, name)); 190 + printk(KERN_INFO "serio: Serial port %s\n", tty_name(tty)); 190 191 191 192 wait_event_interruptible(serport->wait, test_bit(SERPORT_DEAD, &serport->flags)); 192 193 serio_unregister_port(serport->serio);
+2 -6
drivers/tty/amiserial.c
··· 966 966 struct serial_state *info = tty->driver_data; 967 967 unsigned long flags; 968 968 #ifdef SERIAL_DEBUG_THROTTLE 969 - char buf[64]; 970 - 971 - printk("throttle %s: %d....\n", tty_name(tty, buf), 969 + printk("throttle %s: %d....\n", tty_name(tty), 972 970 tty->ldisc.chars_in_buffer(tty)); 973 971 #endif 974 972 ··· 989 991 struct serial_state *info = tty->driver_data; 990 992 unsigned long flags; 991 993 #ifdef SERIAL_DEBUG_THROTTLE 992 - char buf[64]; 993 - 994 - printk("unthrottle %s: %d....\n", tty_name(tty, buf), 994 + printk("unthrottle %s: %d....\n", tty_name(tty), 995 995 tty->ldisc.chars_in_buffer(tty)); 996 996 #endif 997 997
+2 -6
drivers/tty/cyclades.c
··· 2861 2861 unsigned long flags; 2862 2862 2863 2863 #ifdef CY_DEBUG_THROTTLE 2864 - char buf[64]; 2865 - 2866 - printk(KERN_DEBUG "cyc:throttle %s: %ld...ttyC%d\n", tty_name(tty, buf), 2864 + printk(KERN_DEBUG "cyc:throttle %s: %ld...ttyC%d\n", tty_name(tty), 2867 2865 tty->ldisc.chars_in_buffer(tty), info->line); 2868 2866 #endif 2869 2867 ··· 2900 2902 unsigned long flags; 2901 2903 2902 2904 #ifdef CY_DEBUG_THROTTLE 2903 - char buf[64]; 2904 - 2905 2905 printk(KERN_DEBUG "cyc:unthrottle %s: %ld...ttyC%d\n", 2906 - tty_name(tty, buf), tty_chars_in_buffer(tty), info->line); 2906 + tty_name(tty), tty_chars_in_buffer(tty), info->line); 2907 2907 #endif 2908 2908 2909 2909 if (serial_paranoia_check(info, tty->name, "cy_unthrottle"))
+1 -2
drivers/tty/n_gsm.c
··· 2274 2274 const unsigned char *dp; 2275 2275 char *f; 2276 2276 int i; 2277 - char buf[64]; 2278 2277 char flags = TTY_NORMAL; 2279 2278 2280 2279 if (debug & 4) ··· 2295 2296 break; 2296 2297 default: 2297 2298 WARN_ONCE(1, "%s: unknown flag %d\n", 2298 - tty_name(tty, buf), flags); 2299 + tty_name(tty), flags); 2299 2300 break; 2300 2301 } 2301 2302 }
+2 -5
drivers/tty/n_tty.c
··· 1179 1179 static void n_tty_receive_overrun(struct tty_struct *tty) 1180 1180 { 1181 1181 struct n_tty_data *ldata = tty->disc_data; 1182 - char buf[64]; 1183 1182 1184 1183 ldata->num_overrun++; 1185 1184 if (time_after(jiffies, ldata->overrun_time + HZ) || 1186 1185 time_after(ldata->overrun_time, jiffies)) { 1187 1186 printk(KERN_WARNING "%s: %d input overrun(s)\n", 1188 - tty_name(tty, buf), 1187 + tty_name(tty), 1189 1188 ldata->num_overrun); 1190 1189 ldata->overrun_time = jiffies; 1191 1190 ldata->num_overrun = 0; ··· 1459 1460 static void 1460 1461 n_tty_receive_char_flagged(struct tty_struct *tty, unsigned char c, char flag) 1461 1462 { 1462 - char buf[64]; 1463 - 1464 1463 switch (flag) { 1465 1464 case TTY_BREAK: 1466 1465 n_tty_receive_break(tty); ··· 1472 1475 break; 1473 1476 default: 1474 1477 printk(KERN_ERR "%s: unknown flag %d\n", 1475 - tty_name(tty, buf), flag); 1478 + tty_name(tty), flag); 1476 1479 break; 1477 1480 } 1478 1481 }
+2 -6
drivers/tty/serial/crisv10.c
··· 3216 3216 { 3217 3217 struct e100_serial *info = (struct e100_serial *)tty->driver_data; 3218 3218 #ifdef SERIAL_DEBUG_THROTTLE 3219 - char buf[64]; 3220 - 3221 - printk("throttle %s: %lu....\n", tty_name(tty, buf), 3219 + printk("throttle %s: %lu....\n", tty_name(tty), 3222 3220 (unsigned long)tty->ldisc.chars_in_buffer(tty)); 3223 3221 #endif 3224 3222 DFLOW(DEBUG_LOG(info->line,"rs_throttle %lu\n", tty->ldisc.chars_in_buffer(tty))); ··· 3236 3238 { 3237 3239 struct e100_serial *info = (struct e100_serial *)tty->driver_data; 3238 3240 #ifdef SERIAL_DEBUG_THROTTLE 3239 - char buf[64]; 3240 - 3241 - printk("unthrottle %s: %lu....\n", tty_name(tty, buf), 3241 + printk("unthrottle %s: %lu....\n", tty_name(tty), 3242 3242 (unsigned long)tty->ldisc.chars_in_buffer(tty)); 3243 3243 #endif 3244 3244 DFLOW(DEBUG_LOG(info->line,"rs_unthrottle ldisc %d\n", tty->ldisc.chars_in_buffer(tty)));
+1 -3
drivers/tty/serial/serial_core.c
··· 894 894 * need to rate-limit; it's CAP_SYS_ADMIN only. 895 895 */ 896 896 if (uport->flags & UPF_SPD_MASK) { 897 - char buf[64]; 898 - 899 897 dev_notice(uport->dev, 900 898 "%s sets custom speed on %s. This is deprecated.\n", 901 899 current->comm, 902 - tty_name(port->tty, buf)); 900 + tty_name(port->tty)); 903 901 } 904 902 uart_change_speed(tty, state, NULL); 905 903 }
+11 -17
drivers/tty/tty_io.c
··· 235 235 /** 236 236 * tty_name - return tty naming 237 237 * @tty: tty structure 238 - * @buf: unused 239 238 * 240 239 * Convert a tty structure into a name. The name reflects the kernel 241 240 * naming policy and if udev is in use may not reflect user space ··· 242 243 * Locking: none 243 244 */ 244 245 245 - const char *tty_name(const struct tty_struct *tty, char *buf) 246 + const char *tty_name(const struct tty_struct *tty) 246 247 { 247 248 if (!tty) /* Hmm. NULL pointer. That's fun. */ 248 249 return "NULL tty"; ··· 767 768 void tty_hangup(struct tty_struct *tty) 768 769 { 769 770 #ifdef TTY_DEBUG_HANGUP 770 - char buf[64]; 771 - printk(KERN_DEBUG "%s hangup...\n", tty_name(tty, buf)); 771 + printk(KERN_DEBUG "%s hangup...\n", tty_name(tty)); 772 772 #endif 773 773 schedule_work(&tty->hangup_work); 774 774 } ··· 786 788 void tty_vhangup(struct tty_struct *tty) 787 789 { 788 790 #ifdef TTY_DEBUG_HANGUP 789 - char buf[64]; 790 - 791 - printk(KERN_DEBUG "%s vhangup...\n", tty_name(tty, buf)); 791 + printk(KERN_DEBUG "%s vhangup...\n", tty_name(tty)); 792 792 #endif 793 793 __tty_hangup(tty, 0); 794 794 } ··· 825 829 static void tty_vhangup_session(struct tty_struct *tty) 826 830 { 827 831 #ifdef TTY_DEBUG_HANGUP 828 - char buf[64]; 829 - 830 - printk(KERN_DEBUG "%s vhangup session...\n", tty_name(tty, buf)); 832 + printk(KERN_DEBUG "%s vhangup session...\n", tty_name(tty)); 831 833 #endif 832 834 __tty_hangup(tty, 1); 833 835 } ··· 1761 1767 struct tty_struct *o_tty = NULL; 1762 1768 int do_sleep, final; 1763 1769 int idx; 1764 - char buf[64]; 1765 1770 long timeout = 0; 1766 1771 int once = 1; 1767 1772 ··· 1784 1791 1785 1792 #ifdef TTY_DEBUG_HANGUP 1786 1793 printk(KERN_DEBUG "%s: %s (tty count=%d)...\n", __func__, 1787 - tty_name(tty, buf), tty->count); 1794 + tty_name(tty), tty->count); 1788 1795 #endif 1789 1796 1790 1797 if (tty->ops->close) ··· 1835 1842 if (once) { 1836 1843 once = 0; 1837 1844 printk(KERN_WARNING "%s: %s: read/write wait queue active!\n", 1838 - __func__, tty_name(tty, buf)); 1845 + __func__, tty_name(tty)); 1839 1846 } 1840 1847 schedule_timeout_killable(timeout); 1841 1848 if (timeout < 120 * HZ) ··· 1847 1854 if (o_tty) { 1848 1855 if (--o_tty->count < 0) { 1849 1856 printk(KERN_WARNING "%s: bad pty slave count (%d) for %s\n", 1850 - __func__, o_tty->count, tty_name(o_tty, buf)); 1857 + __func__, o_tty->count, tty_name(o_tty)); 1851 1858 o_tty->count = 0; 1852 1859 } 1853 1860 } 1854 1861 if (--tty->count < 0) { 1855 1862 printk(KERN_WARNING "%s: bad tty->count (%d) for %s\n", 1856 - __func__, tty->count, tty_name(tty, buf)); 1863 + __func__, tty->count, tty_name(tty)); 1857 1864 tty->count = 0; 1858 1865 } 1859 1866 ··· 1896 1903 return 0; 1897 1904 1898 1905 #ifdef TTY_DEBUG_HANGUP 1899 - printk(KERN_DEBUG "%s: %s: final close\n", __func__, tty_name(tty, buf)); 1906 + printk(KERN_DEBUG "%s: %s: final close\n", __func__, tty_name(tty)); 1900 1907 #endif 1901 1908 /* 1902 1909 * Ask the line discipline code to release its structures ··· 1907 1914 tty_flush_works(tty); 1908 1915 1909 1916 #ifdef TTY_DEBUG_HANGUP 1910 - printk(KERN_DEBUG "%s: %s: freeing structure...\n", __func__, tty_name(tty, buf)); 1917 + printk(KERN_DEBUG "%s: %s: freeing structure...\n", __func__, 1918 + tty_name(tty)); 1911 1919 #endif 1912 1920 /* 1913 1921 * The release_tty function takes care of the details of clearing
+1 -3
drivers/tty/tty_ioctl.c
··· 211 211 void tty_wait_until_sent(struct tty_struct *tty, long timeout) 212 212 { 213 213 #ifdef TTY_DEBUG_WAIT_UNTIL_SENT 214 - char buf[64]; 215 - 216 - printk(KERN_DEBUG "%s wait until sent...\n", tty_name(tty, buf)); 214 + printk(KERN_DEBUG "%s wait until sent...\n", tty_name(tty)); 217 215 #endif 218 216 if (!timeout) 219 217 timeout = MAX_SCHEDULE_TIMEOUT;
+3 -5
drivers/tty/tty_ldisc.c
··· 22 22 #undef LDISC_DEBUG_HANGUP 23 23 24 24 #ifdef LDISC_DEBUG_HANGUP 25 - #define tty_ldisc_debug(tty, f, args...) ({ \ 26 - char __b[64]; \ 27 - printk(KERN_DEBUG "%s: %s: " f, __func__, tty_name(tty, __b), ##args); \ 25 + #define tty_ldisc_debug(tty, f, args...) ({ \ 26 + printk(KERN_DEBUG "%s: %s: " f, __func__, tty_name(tty), ##args); \ 28 27 }) 29 28 #else 30 29 #define tty_ldisc_debug(tty, f, args...) ··· 482 483 483 484 static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old) 484 485 { 485 - char buf[64]; 486 486 struct tty_ldisc *new_ldisc; 487 487 int r; 488 488 ··· 502 504 if (r < 0) 503 505 panic("Couldn't open N_TTY ldisc for " 504 506 "%s --- error %d.", 505 - tty_name(tty, buf), r); 507 + tty_name(tty), r); 506 508 } 507 509 } 508 510
+1 -1
include/linux/tty.h
··· 421 421 422 422 extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, 423 423 const char *routine); 424 - extern const char *tty_name(const struct tty_struct *tty, char *buf); 424 + extern const char *tty_name(const struct tty_struct *tty); 425 425 extern void tty_wait_until_sent(struct tty_struct *tty, long timeout); 426 426 extern int tty_check_change(struct tty_struct *tty); 427 427 extern void __stop_tty(struct tty_struct *tty);