Skip to content

Commit be9a284

Browse files
Jiri Slaby (SUSE)gregkh
authored andcommitted
mctp: serial: propagage new tty types
In tty, u8 is now used for data, ssize_t for sizes (with possible negative error codes). Propagate these types (and use unsigned in next_chunk_len()) to mctp. Signed-off-by: Jiri Slaby (SUSE) <[email protected]> Reviewed-by: Jeremy Kerr <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Jeremy Kerr <[email protected]> Cc: Matt Johnston <[email protected]> Cc: David S. Miller <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Paolo Abeni <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 866025f commit be9a284

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

drivers/net/mctp/mctp-serial.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,18 @@ struct mctp_serial {
6464
u16 txfcs, rxfcs, rxfcs_rcvd;
6565
unsigned int txlen, rxlen;
6666
unsigned int txpos, rxpos;
67-
unsigned char txbuf[BUFSIZE],
67+
u8 txbuf[BUFSIZE],
6868
rxbuf[BUFSIZE];
6969
};
7070

71-
static bool needs_escape(unsigned char c)
71+
static bool needs_escape(u8 c)
7272
{
7373
return c == BYTE_ESC || c == BYTE_FRAME;
7474
}
7575

76-
static int next_chunk_len(struct mctp_serial *dev)
76+
static unsigned int next_chunk_len(struct mctp_serial *dev)
7777
{
78-
int i;
78+
unsigned int i;
7979

8080
/* either we have no bytes to send ... */
8181
if (dev->txpos == dev->txlen)
@@ -99,7 +99,7 @@ static int next_chunk_len(struct mctp_serial *dev)
9999
return i;
100100
}
101101

102-
static int write_chunk(struct mctp_serial *dev, unsigned char *buf, int len)
102+
static ssize_t write_chunk(struct mctp_serial *dev, u8 *buf, size_t len)
103103
{
104104
return dev->tty->ops->write(dev->tty, buf, len);
105105
}
@@ -108,9 +108,10 @@ static void mctp_serial_tx_work(struct work_struct *work)
108108
{
109109
struct mctp_serial *dev = container_of(work, struct mctp_serial,
110110
tx_work);
111-
unsigned char c, buf[3];
112111
unsigned long flags;
113-
int len, txlen;
112+
ssize_t txlen;
113+
unsigned int len;
114+
u8 c, buf[3];
114115

115116
spin_lock_irqsave(&dev->lock, flags);
116117

@@ -293,7 +294,7 @@ static void mctp_serial_rx(struct mctp_serial *dev)
293294
dev->netdev->stats.rx_bytes += dev->rxlen;
294295
}
295296

296-
static void mctp_serial_push_header(struct mctp_serial *dev, unsigned char c)
297+
static void mctp_serial_push_header(struct mctp_serial *dev, u8 c)
297298
{
298299
switch (dev->rxpos) {
299300
case 0:
@@ -323,7 +324,7 @@ static void mctp_serial_push_header(struct mctp_serial *dev, unsigned char c)
323324
}
324325
}
325326

326-
static void mctp_serial_push_trailer(struct mctp_serial *dev, unsigned char c)
327+
static void mctp_serial_push_trailer(struct mctp_serial *dev, u8 c)
327328
{
328329
switch (dev->rxpos) {
329330
case 0:
@@ -347,7 +348,7 @@ static void mctp_serial_push_trailer(struct mctp_serial *dev, unsigned char c)
347348
}
348349
}
349350

350-
static void mctp_serial_push(struct mctp_serial *dev, unsigned char c)
351+
static void mctp_serial_push(struct mctp_serial *dev, u8 c)
351352
{
352353
switch (dev->rxstate) {
353354
case STATE_IDLE:
@@ -394,7 +395,7 @@ static void mctp_serial_tty_receive_buf(struct tty_struct *tty, const u8 *c,
394395
const u8 *f, size_t len)
395396
{
396397
struct mctp_serial *dev = tty->disc_data;
397-
int i;
398+
size_t i;
398399

399400
if (!netif_running(dev->netdev))
400401
return;

0 commit comments

Comments
 (0)