n_gsm: Constify u8 and unsigned char usage

In order to prepare for adding serdev driver support, let's constify
the use of u8 and unsigned char for n_gsm.

Note that gsm_control_modem() gsm_control_rls() read the data for tty
control characters and then call gsm_control_reply() that allocates a
new reply and copies the data.

Cc: linux-serial@vger.kernel.org
Cc: Alan Cox <alan@llwyncelyn.cymru>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Johan Hovold <johan@kernel.org>
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Tony Lindgren 2019-01-13 17:25:27 -08:00 committed by Greg Kroah-Hartman
parent 3384104082
commit 4feb7a4a12

View File

@ -143,8 +143,8 @@ struct gsm_dlci {
struct sk_buff *skb; /* Frame being sent */ struct sk_buff *skb; /* Frame being sent */
struct sk_buff_head skb_list; /* Queued frames */ struct sk_buff_head skb_list; /* Queued frames */
/* Data handling callback */ /* Data handling callback */
void (*data)(struct gsm_dlci *dlci, u8 *data, int len); void (*data)(struct gsm_dlci *dlci, const u8 *data, int len);
void (*prev_data)(struct gsm_dlci *dlci, u8 *data, int len); void (*prev_data)(struct gsm_dlci *dlci, const u8 *data, int len);
struct net_device *net; /* network interface, if created */ struct net_device *net; /* network interface, if created */
}; };
@ -988,7 +988,7 @@ static void gsm_dlci_data_kick(struct gsm_dlci *dlci)
* Encode up and queue a UI/UIH frame containing our response. * Encode up and queue a UI/UIH frame containing our response.
*/ */
static void gsm_control_reply(struct gsm_mux *gsm, int cmd, u8 *data, static void gsm_control_reply(struct gsm_mux *gsm, int cmd, const u8 *data,
int dlen) int dlen)
{ {
struct gsm_msg *msg; struct gsm_msg *msg;
@ -1073,14 +1073,14 @@ static void gsm_process_modem(struct tty_struct *tty, struct gsm_dlci *dlci,
* and if need be stuff a break message down the tty. * and if need be stuff a break message down the tty.
*/ */
static void gsm_control_modem(struct gsm_mux *gsm, u8 *data, int clen) static void gsm_control_modem(struct gsm_mux *gsm, const u8 *data, int clen)
{ {
unsigned int addr = 0; unsigned int addr = 0;
unsigned int modem = 0; unsigned int modem = 0;
unsigned int brk = 0; unsigned int brk = 0;
struct gsm_dlci *dlci; struct gsm_dlci *dlci;
int len = clen; int len = clen;
u8 *dp = data; const u8 *dp = data;
struct tty_struct *tty; struct tty_struct *tty;
while (gsm_read_ea(&addr, *dp++) == 0) { while (gsm_read_ea(&addr, *dp++) == 0) {
@ -1134,13 +1134,13 @@ static void gsm_control_modem(struct gsm_mux *gsm, u8 *data, int clen)
* this into the uplink tty if present * this into the uplink tty if present
*/ */
static void gsm_control_rls(struct gsm_mux *gsm, u8 *data, int clen) static void gsm_control_rls(struct gsm_mux *gsm, const u8 *data, int clen)
{ {
struct tty_port *port; struct tty_port *port;
unsigned int addr = 0; unsigned int addr = 0;
u8 bits; u8 bits;
int len = clen; int len = clen;
u8 *dp = data; const u8 *dp = data;
while (gsm_read_ea(&addr, *dp++) == 0) { while (gsm_read_ea(&addr, *dp++) == 0) {
len--; len--;
@ -1189,7 +1189,7 @@ static void gsm_dlci_begin_close(struct gsm_dlci *dlci);
*/ */
static void gsm_control_message(struct gsm_mux *gsm, unsigned int command, static void gsm_control_message(struct gsm_mux *gsm, unsigned int command,
u8 *data, int clen) const u8 *data, int clen)
{ {
u8 buf[1]; u8 buf[1];
unsigned long flags; unsigned long flags;
@ -1261,7 +1261,7 @@ static void gsm_control_message(struct gsm_mux *gsm, unsigned int command,
*/ */
static void gsm_control_response(struct gsm_mux *gsm, unsigned int command, static void gsm_control_response(struct gsm_mux *gsm, unsigned int command,
u8 *data, int clen) const u8 *data, int clen)
{ {
struct gsm_control *ctrl; struct gsm_control *ctrl;
unsigned long flags; unsigned long flags;
@ -1553,7 +1553,7 @@ static void gsm_dlci_begin_close(struct gsm_dlci *dlci)
* open we shovel the bits down it, if not we drop them. * open we shovel the bits down it, if not we drop them.
*/ */
static void gsm_dlci_data(struct gsm_dlci *dlci, u8 *data, int clen) static void gsm_dlci_data(struct gsm_dlci *dlci, const u8 *data, int clen)
{ {
/* krefs .. */ /* krefs .. */
struct tty_port *port = &dlci->port; struct tty_port *port = &dlci->port;
@ -1603,7 +1603,7 @@ static void gsm_dlci_data(struct gsm_dlci *dlci, u8 *data, int clen)
* and we divide up the work accordingly. * and we divide up the work accordingly.
*/ */
static void gsm_dlci_command(struct gsm_dlci *dlci, u8 *data, int len) static void gsm_dlci_command(struct gsm_dlci *dlci, const u8 *data, int len)
{ {
/* See what command is involved */ /* See what command is involved */
unsigned int command = 0; unsigned int command = 0;
@ -2702,7 +2702,7 @@ static void gsm_mux_net_tx_timeout(struct net_device *net)
} }
static void gsm_mux_rx_netchar(struct gsm_dlci *dlci, static void gsm_mux_rx_netchar(struct gsm_dlci *dlci,
unsigned char *in_buf, int size) const unsigned char *in_buf, int size)
{ {
struct net_device *net = dlci->net; struct net_device *net = dlci->net;
struct sk_buff *skb; struct sk_buff *skb;