tty: make fp of tty_ldisc_ops::receive_buf{,2} const
authorJiri Slaby <jslaby@suse.cz>
Wed, 5 May 2021 09:19:04 +0000 (11:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 May 2021 14:57:16 +0000 (16:57 +0200)
Char pointer (cp) passed to tty_ldisc_ops::receive_buf{,2} is const.
There is no reason for flag pointer (fp) not to be too. So switch it in
the definition and all uses.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: William Hubbs <w.d.hubbs@gmail.com>
Cc: Chris Brannon <chris@the-brannons.com>
Cc: Kirk Reiser <kirk@reisers.ca>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Andreas Koensgen <ajk@comnets.uni-bremen.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://lore.kernel.org/r/20210505091928.22010-12-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 files changed:
drivers/accessibility/speakup/spk_ttyio.c
drivers/bluetooth/hci_ldisc.c
drivers/input/serio/serport.c
drivers/misc/ti-st/st_core.c
drivers/net/caif/caif_serial.c
drivers/net/can/slcan.c
drivers/net/hamradio/6pack.c
drivers/net/hamradio/mkiss.c
drivers/net/ppp/ppp_async.c
drivers/net/ppp/ppp_synctty.c
drivers/net/slip/slip.c
drivers/tty/n_gsm.c
drivers/tty/n_hdlc.c
drivers/tty/n_null.c
drivers/tty/n_tty.c
drivers/tty/tty_buffer.c
include/linux/tty.h
include/linux/tty_ldisc.h
net/nfc/nci/uart.c
sound/soc/codecs/cx20442.c
sound/soc/ti/ams-delta.c

index 2e39fcf492d8bd8d1b0e09a5887714ba38645b15..b7fd094700d96fa64edbdce47f8dfb72f74998e8 100644 (file)
@@ -72,7 +72,8 @@ static void spk_ttyio_ldisc_close(struct tty_struct *tty)
 }
 
 static int spk_ttyio_receive_buf2(struct tty_struct *tty,
-                                 const unsigned char *cp, char *fp, int count)
+                                 const unsigned char *cp,
+                                 const char *fp, int count)
 {
        struct spk_ldisc_data *ldisc_data = tty->disc_data;
        struct spk_synth *synth = ldisc_data->synth;
index 71a4ca505e09e6b339d56940663ccd892a733ed1..e785851a92c142f30ef483a8146cad5ee55ac931 100644 (file)
@@ -593,7 +593,7 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty)
  * Return Value:    None
  */
 static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data,
-                                char *flags, int count)
+                                const char *flags, int count)
 {
        struct hci_uart *hu = tty->disc_data;
 
index 33e9d9bfd036f3dd4a3afc2e9f22b7c911e0ab45..ff37153155929a5d6a8b2df024af66d31079877b 100644 (file)
@@ -114,7 +114,8 @@ static void serport_ldisc_close(struct tty_struct *tty)
  * 'interrupt' routine.
  */
 
-static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count)
+static void serport_ldisc_receive(struct tty_struct *tty,
+               const unsigned char *cp, const char *fp, int count)
 {
        struct serport *serport = (struct serport*) tty->disc_data;
        unsigned long flags;
index 071844b58073929e3a7247dbfebfbfff0a7f480b..239a75502cd621af5c5e25e5d65ef49012289d5f 100644 (file)
@@ -798,7 +798,7 @@ static void st_tty_close(struct tty_struct *tty)
 }
 
 static void st_tty_receive(struct tty_struct *tty, const unsigned char *data,
-                          char *tty_flags, int count)
+                          const char *tty_flags, int count)
 {
 #ifdef VERBOSE
        print_hex_dump(KERN_DEBUG, ">in>", DUMP_PREFIX_NONE,
index da6fffb4d5a8eb689bd1a74e81d3659e883135bc..fb3ca4e11fe52f7b13dac27f3a08cae8788dd1e7 100644 (file)
@@ -159,7 +159,7 @@ static inline void debugfs_tx(struct ser_device *ser, const u8 *data, int size)
 #endif
 
 static void ldisc_receive(struct tty_struct *tty, const u8 *data,
-                       char *flags, int count)
+                       const char *flags, int count)
 {
        struct sk_buff *skb = NULL;
        struct ser_device *ser;
index 31ba6664503d3558e917d188cdaf02f58be1a369..7dc3e79cb5c40d45656f4e88c37e313336cdf899 100644 (file)
@@ -467,7 +467,8 @@ static void slc_setup(struct net_device *dev)
  */
 
 static void slcan_receive_buf(struct tty_struct *tty,
-                             const unsigned char *cp, char *fp, int count)
+                             const unsigned char *cp, const char *fp,
+                             int count)
 {
        struct slcan *sl = (struct slcan *) tty->disc_data;
 
index 80f41945709f98edfa6f9e9c6241ec7bc6407dcd..c0a80f04dd8ee0a8a85b9d143d4ac866cd9e09e7 100644 (file)
@@ -428,7 +428,7 @@ out:
  * and sent on to some IP layer for further processing.
  */
 static void sixpack_receive_buf(struct tty_struct *tty,
-       const unsigned char *cp, char *fp, int count)
+       const unsigned char *cp, const char *fp, int count)
 {
        struct sixpack *sp;
        int count1;
index 65154224d5b840c50486941000ad36a5f3bcc2be..fc05ded481785eefe09893cd4d82cd2c09e8440a 100644 (file)
@@ -871,7 +871,7 @@ static int mkiss_ioctl(struct tty_struct *tty, struct file *file,
  * and sent on to the AX.25 layer for further processing.
  */
 static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp,
-       char *fp, int count)
+       const char *fp, int count)
 {
        struct mkiss *ax = mkiss_get(tty);
 
index 8b41aa3fb64eaa409cc8fee66f143225233c5d06..9f08bd19551f7ae2ab986890df689984068e90c2 100644 (file)
@@ -98,7 +98,7 @@ static int ppp_async_send(struct ppp_channel *chan, struct sk_buff *skb);
 static int ppp_async_push(struct asyncppp *ap);
 static void ppp_async_flush_output(struct asyncppp *ap);
 static void ppp_async_input(struct asyncppp *ap, const unsigned char *buf,
-                           char *flags, int count);
+                           const char *flags, int count);
 static int ppp_async_ioctl(struct ppp_channel *chan, unsigned int cmd,
                           unsigned long arg);
 static void ppp_async_process(struct tasklet_struct *t);
@@ -340,7 +340,7 @@ ppp_asynctty_poll(struct tty_struct *tty, struct file *file, poll_table *wait)
 /* May sleep, don't call from interrupt level or with interrupts disabled */
 static void
 ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf,
-                 char *cflags, int count)
+                 const char *cflags, int count)
 {
        struct asyncppp *ap = ap_get(tty);
        unsigned long flags;
@@ -829,7 +829,7 @@ process_input_packet(struct asyncppp *ap)
 
 static void
 ppp_async_input(struct asyncppp *ap, const unsigned char *buf,
-               char *flags, int count)
+               const char *flags, int count)
 {
        struct sk_buff *skb;
        int c, i, j, n, s, f;
index 576b6a93bf23b2426c24b1dcae8a5cd3e2b373cc..c82c4e6df4cbc46129824bda9207232125600e05 100644 (file)
@@ -94,7 +94,7 @@ static void ppp_sync_process(struct tasklet_struct *t);
 static int ppp_sync_push(struct syncppp *ap);
 static void ppp_sync_flush_output(struct syncppp *ap);
 static void ppp_sync_input(struct syncppp *ap, const unsigned char *buf,
-                          char *flags, int count);
+                          const char *flags, int count);
 
 static const struct ppp_channel_ops sync_ops = {
        .start_xmit = ppp_sync_send,
@@ -333,7 +333,7 @@ ppp_sync_poll(struct tty_struct *tty, struct file *file, poll_table *wait)
 /* May sleep, don't call from interrupt level or with interrupts disabled */
 static void
 ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf,
-                 char *cflags, int count)
+                 const char *cflags, int count)
 {
        struct syncppp *ap = sp_get(tty);
        unsigned long flags;
@@ -665,7 +665,7 @@ ppp_sync_flush_output(struct syncppp *ap)
  */
 static void
 ppp_sync_input(struct syncppp *ap, const unsigned char *buf,
-               char *flags, int count)
+               const char *flags, int count)
 {
        struct sk_buff *skb;
        unsigned char *p;
index 1ab124eba8eb5d0f7f51d4c8e4195e6cc8060bec..4dda49e617456ca3c0d3f19c3503f015e439c084 100644 (file)
@@ -685,7 +685,7 @@ static void sl_setup(struct net_device *dev)
  */
 
 static void slip_receive_buf(struct tty_struct *tty, const unsigned char *cp,
-                                                       char *fp, int count)
+               const char *fp, int count)
 {
        struct slip *sl = tty->disc_data;
 
index 5fea02cfb0ccf73e06e135ce54457a9c0b329637..477403ecc4456148ffd580ddb8907f60f448691d 100644 (file)
@@ -2424,7 +2424,7 @@ static void gsmld_detach_gsm(struct tty_struct *tty, struct gsm_mux *gsm)
 }
 
 static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp,
-                             char *fp, int count)
+                             const char *fp, int count)
 {
        struct gsm_mux *gsm = tty->disc_data;
        char flags = TTY_NORMAL;
index b0f33e8ac819ac1ad33af23cd753fad53dbc48fb..62b1d1a6e0f1ca72c3ea5df186245746abc19887 100644 (file)
@@ -358,7 +358,7 @@ static void n_hdlc_tty_wakeup(struct tty_struct *tty)
  * interpreted as one HDLC frame.
  */
 static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data,
-                              char *flags, int count)
+                              const char *flags, int count)
 {
        register struct n_hdlc *n_hdlc = tty->disc_data;
        register struct n_hdlc_buf *buf;
index b8f67b5f1ef88023c511d61aefd4f81b31923683..2ff373d2f98d27c10e4b15c0729175eb6e46096a 100644 (file)
@@ -33,7 +33,7 @@ static ssize_t n_null_write(struct tty_struct *tty, struct file *file,
 }
 
 static void n_null_receivebuf(struct tty_struct *tty,
-                                const unsigned char *cp, char *fp,
+                                const unsigned char *cp, const char *fp,
                                 int cnt)
 {
 }
index 0d93be26c67859c3cdeeb12cc660cf8cceb6226b..c32318da519078689bdac8f102fa357ce90d6a01 100644 (file)
@@ -1474,7 +1474,7 @@ n_tty_receive_char_lnext(struct tty_struct *tty, unsigned char c, char flag)
 
 static void
 n_tty_receive_buf_real_raw(struct tty_struct *tty, const unsigned char *cp,
-                          char *fp, int count)
+                          const char *fp, int count)
 {
        struct n_tty_data *ldata = tty->disc_data;
        size_t n, head;
@@ -1494,7 +1494,7 @@ n_tty_receive_buf_real_raw(struct tty_struct *tty, const unsigned char *cp,
 
 static void
 n_tty_receive_buf_raw(struct tty_struct *tty, const unsigned char *cp,
-                     char *fp, int count)
+                     const char *fp, int count)
 {
        struct n_tty_data *ldata = tty->disc_data;
        char flag = TTY_NORMAL;
@@ -1511,7 +1511,7 @@ n_tty_receive_buf_raw(struct tty_struct *tty, const unsigned char *cp,
 
 static void
 n_tty_receive_buf_closing(struct tty_struct *tty, const unsigned char *cp,
-                         char *fp, int count)
+                         const char *fp, int count)
 {
        char flag = TTY_NORMAL;
 
@@ -1524,7 +1524,7 @@ n_tty_receive_buf_closing(struct tty_struct *tty, const unsigned char *cp,
 }
 
 static void n_tty_receive_buf_standard(struct tty_struct *tty,
-               const unsigned char *cp, char *fp, int count)
+               const unsigned char *cp, const char *fp, int count)
 {
        struct n_tty_data *ldata = tty->disc_data;
        char flag = TTY_NORMAL;
@@ -1562,7 +1562,7 @@ static void n_tty_receive_buf_standard(struct tty_struct *tty,
 }
 
 static void __receive_buf(struct tty_struct *tty, const unsigned char *cp,
-                         char *fp, int count)
+                         const char *fp, int count)
 {
        struct n_tty_data *ldata = tty->disc_data;
        bool preops = I_ISTRIP(tty) || (I_IUCLC(tty) && L_IEXTEN(tty));
@@ -1629,7 +1629,7 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp,
  */
 static int
 n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp,
-                        char *fp, int count, int flow)
+                        const char *fp, int count, int flow)
 {
        struct n_tty_data *ldata = tty->disc_data;
        int room, n, rcvd = 0, overflow;
@@ -1698,13 +1698,13 @@ n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp,
 }
 
 static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
-                             char *fp, int count)
+                             const char *fp, int count)
 {
        n_tty_receive_buf_common(tty, cp, fp, count, 0);
 }
 
 static int n_tty_receive_buf2(struct tty_struct *tty, const unsigned char *cp,
-                             char *fp, int count)
+                             const char *fp, int count)
 {
        return n_tty_receive_buf_common(tty, cp, fp, count, 1);
 }
index 9733469a14b2ccacdbc2401ac6de5cf16529edb5..55b1f1711341df811d49c6b2dd0e1fb89a53f3d8 100644 (file)
@@ -455,7 +455,7 @@ EXPORT_SYMBOL_GPL(tty_prepare_flip_string);
  *     Returns the number of bytes processed
  */
 int tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p,
-                         char *f, int count)
+                         const char *f, int count)
 {
        if (ld->ops->receive_buf2)
                count = ld->ops->receive_buf2(ld->tty, p, f, count);
@@ -472,7 +472,7 @@ static int
 receive_buf(struct tty_port *port, struct tty_buffer *head, int count)
 {
        unsigned char *p = char_buf_ptr(head, head->read);
-       char          *f = NULL;
+       const char *f = NULL;
        int n;
 
        if (~head->flags & TTYB_NORMAL)
index e5d6b1f288235506280bc0c1b0f9cb38321ae906..5aad2220266cae91b73851ab3213a7cb51ec8f79 100644 (file)
@@ -628,7 +628,7 @@ extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
 extern int tty_unregister_ldisc(int disc);
 extern int tty_set_ldisc(struct tty_struct *tty, int disc);
 extern int tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p,
-                                char *f, int count);
+                                const char *f, int count);
 
 /* n_tty.c */
 extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops);
index 31284b55bd4f148953c43c243caebb44509d4899..c20ca6a75b4c3c324418bb3d6114ae44e578b917 100644 (file)
@@ -201,11 +201,11 @@ struct tty_ldisc_ops {
         * The following routines are called from below.
         */
        void    (*receive_buf)(struct tty_struct *, const unsigned char *cp,
-                              char *fp, int count);
+                              const char *fp, int count);
        void    (*write_wakeup)(struct tty_struct *);
        void    (*dcd_change)(struct tty_struct *, unsigned int);
        int     (*receive_buf2)(struct tty_struct *, const unsigned char *cp,
-                               char *fp, int count);
+                               const char *fp, int count);
 
        struct  module *owner;
 
index 1248faf4d6dfac0ab89cdf3df4f8f455a2e84056..98102ef64004c09c9f2207fac1bc5f90c8c980eb 100644 (file)
@@ -308,7 +308,7 @@ static int nci_uart_default_recv_buf(struct nci_uart *nu, const u8 *data,
  * Return Value:    None
  */
 static void nci_uart_tty_receive(struct tty_struct *tty, const u8 *data,
-                                char *flags, int count)
+                                const char *flags, int count)
 {
        struct nci_uart *nu = (void *)tty->disc_data;
 
index 61dfa86d444d81ee439f8b7311b98b95f28e08ad..ec8d6e74b46726fe14779fd08931aea3c312a89f 100644 (file)
@@ -259,8 +259,8 @@ static int v253_hangup(struct tty_struct *tty)
 }
 
 /* Line discipline .receive_buf() */
-static void v253_receive(struct tty_struct *tty,
-                               const unsigned char *cp, char *fp, int count)
+static void v253_receive(struct tty_struct *tty, const unsigned char *cp,
+               const char *fp, int count)
 {
        struct snd_soc_component *component = tty->disc_data;
        struct cx20442_priv *cx20442;
index aba0017e870b8d8c5a6d852b6ac733ffb70441b1..55a6736a378e51b088cfb365485577a7f3aa5e62 100644 (file)
@@ -337,8 +337,8 @@ static int cx81801_hangup(struct tty_struct *tty)
 }
 
 /* Line discipline .receive_buf() */
-static void cx81801_receive(struct tty_struct *tty,
-                               const unsigned char *cp, char *fp, int count)
+static void cx81801_receive(struct tty_struct *tty, const unsigned char *cp,
+               const char *fp, int count)
 {
        struct snd_soc_component *component = tty->disc_data;
        const unsigned char *c;