remarkable-linux/drivers/tty
Johannes Berg 59ae1d127a networking: introduce and use skb_put_data()
A common pattern with skb_put() is to just want to memcpy()
some data into the new space, introduce skb_put_data() for
this.

An spatch similar to the one for skb_put_zero() converts many
of the places using it:

    @@
    identifier p, p2;
    expression len, skb, data;
    type t, t2;
    @@
    (
    -p = skb_put(skb, len);
    +p = skb_put_data(skb, data, len);
    |
    -p = (t)skb_put(skb, len);
    +p = skb_put_data(skb, data, len);
    )
    (
    p2 = (t2)p;
    -memcpy(p2, data, len);
    |
    -memcpy(p, data, len);
    )

    @@
    type t, t2;
    identifier p, p2;
    expression skb, data;
    @@
    t *p;
    ...
    (
    -p = skb_put(skb, sizeof(t));
    +p = skb_put_data(skb, data, sizeof(t));
    |
    -p = (t *)skb_put(skb, sizeof(t));
    +p = skb_put_data(skb, data, sizeof(t));
    )
    (
    p2 = (t2)p;
    -memcpy(p2, data, sizeof(*p));
    |
    -memcpy(p, data, sizeof(*p));
    )

    @@
    expression skb, len, data;
    @@
    -memcpy(skb_put(skb, len), data, len);
    +skb_put_data(skb, data, len);

(again, manually post-processed to retain some comments)

Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-16 11:48:37 -04:00
..
hvc
ipwireless networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
serdev tty/serdev: add serdev registration interface 2017-05-18 17:38:24 +02:00
serial serial: altera_uart: call iounmap() at driver remove 2017-05-25 14:36:37 +02:00
vt
amiserial.c
bfin_jtag_comm.c
cyclades.c Annotate hardware config module parameters in drivers/tty/ 2017-04-20 12:02:32 +01:00
ehv_bytechan.c tty: ehv_bytechan: clean up init error handling 2017-05-18 16:43:55 +02:00
goldfish.c
isicom.c
Kconfig
Makefile tty: split job control support into a file of its own 2017-04-18 18:01:52 +02:00
metag_da.c
mips_ejtag_fdc.c
moxa.c Annotate hardware config module parameters in drivers/tty/ 2017-04-20 12:02:32 +01:00
moxa.h
mxser.c Annotate hardware config module parameters in drivers/tty/ 2017-04-20 12:02:32 +01:00
mxser.h
n_gsm.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
n_hdlc.c format-security: move static strings to const 2017-05-08 17:15:14 -07:00
n_r3964.c
n_tracerouter.c
n_tracesink.c
n_tracesink.h
n_tty.c
nozomi.c
pty.c
rocket.c Annotate hardware config module parameters in drivers/tty/ 2017-04-20 12:02:32 +01:00
rocket.h
rocket_int.h
synclink.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
synclink_gt.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
synclinkmp.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
sysrq.c oom: improve oom disable handling 2017-05-03 15:52:10 -07:00
tty_audit.c
tty_baudrate.c tty: move baudrate handling code to a file of its own 2017-04-18 18:01:52 +02:00
tty_buffer.c
tty_io.c tty: fix comment for __tty_alloc_driver() 2017-04-24 13:15:39 +02:00
tty_ioctl.c tty: move baudrate handling code to a file of its own 2017-04-18 18:01:52 +02:00
tty_jobctrl.c tty: split job control support into a file of its own 2017-04-18 18:01:52 +02:00
tty_ldisc.c
tty_ldsem.c
tty_mutex.c
tty_port.c Revert "tty: fix port buffer locking" 2017-06-04 10:23:25 +02:00