staging: gdm724x: Clarify naming of packet_type<->tty index symbols
This driver was using "packet_type" for packet types and for the mapping of TTY indices to packet types. Fix the confusion by renaming the symbols. Fixes sparse warning: drivers/staging/gdm724x/gdm_mux.c:146:24: warning: symbol 'packet_type' shadows an earlier one Signed-off-by: Misha Gusarov <dottedmag@dottedmag.net> Link: https://lore.kernel.org/r/20201024202221.60726-1-dottedmag@dottedmag.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e0071d318f
commit
01a050e8e4
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "gdm_mux.h"
|
#include "gdm_mux.h"
|
||||||
|
|
||||||
static u16 packet_type[TTY_MAX_COUNT] = {0xF011, 0xF010};
|
static u16 packet_type_for_tty_index[TTY_MAX_COUNT] = {0xF011, 0xF010};
|
||||||
|
|
||||||
#define USB_DEVICE_CDC_DATA(vid, pid) \
|
#define USB_DEVICE_CDC_DATA(vid, pid) \
|
||||||
.match_flags = \
|
.match_flags = \
|
||||||
|
@ -38,12 +38,12 @@ static const struct usb_device_id id_table[] = {
|
||||||
|
|
||||||
MODULE_DEVICE_TABLE(usb, id_table);
|
MODULE_DEVICE_TABLE(usb, id_table);
|
||||||
|
|
||||||
static int packet_type_to_index(u16 packetType)
|
static int packet_type_to_tty_index(u16 packet_type)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < TTY_MAX_COUNT; i++) {
|
for (i = 0; i < TTY_MAX_COUNT; i++) {
|
||||||
if (packet_type[i] == packetType)
|
if (packet_type_for_tty_index[i] == packet_type)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ static int up_to_host(struct mux_rx *r)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
index = packet_type_to_index(packet_type);
|
index = packet_type_to_tty_index(packet_type);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
pr_err("invalid index %d\n", index);
|
pr_err("invalid index %d\n", index);
|
||||||
break;
|
break;
|
||||||
|
@ -372,7 +372,7 @@ static int gdm_mux_send(void *priv_dev, void *data, int len, int tty_index,
|
||||||
mux_header->start_flag = __cpu_to_le32(START_FLAG);
|
mux_header->start_flag = __cpu_to_le32(START_FLAG);
|
||||||
mux_header->seq_num = __cpu_to_le32(seq_num++);
|
mux_header->seq_num = __cpu_to_le32(seq_num++);
|
||||||
mux_header->payload_size = __cpu_to_le32((u32)len);
|
mux_header->payload_size = __cpu_to_le32((u32)len);
|
||||||
mux_header->packet_type = __cpu_to_le16(packet_type[tty_index]);
|
mux_header->packet_type = __cpu_to_le16(packet_type_for_tty_index[tty_index]);
|
||||||
|
|
||||||
memcpy(t->buf + MUX_HEADER_SIZE, data, len);
|
memcpy(t->buf + MUX_HEADER_SIZE, data, len);
|
||||||
memset(t->buf + MUX_HEADER_SIZE + len, 0,
|
memset(t->buf + MUX_HEADER_SIZE + len, 0,
|
||||||
|
|
Loading…
Reference in New Issue