mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-18 13:14:01 +00:00
tty: make tty_ldisc_ops::*buf*() hooks operate on size_t
Count passed to tty_ldisc_ops::receive_buf*(), ::lookahead_buf(), and returned from ::receive_buf2() is expected to be size_t. So set it to size_t to unify with the rest of the code. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> 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: Eric Dumazet <edumazet@google.com> Cc: Jakub Kicinski <kuba@kernel.org> Cc: Paolo Abeni <pabeni@redhat.com> Cc: Max Staudt <max@enpas.org> Cc: Wolfgang Grandegger <wg@grandegger.com> Cc: Marc Kleine-Budde <mkl@pengutronix.de> Cc: Dario Binacchi <dario.binacchi@amarulasolutions.com> Cc: Andreas Koensgen <ajk@comnets.uni-bremen.de> Cc: Jeremy Kerr <jk@codeconstruct.com.au> Cc: Matt Johnston <matt@codeconstruct.com.au> Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.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> Acked-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230810091510.13006-16-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
73048bd55e
commit
e8161447bb
19 changed files with 38 additions and 35 deletions
|
@ -71,9 +71,9 @@ static void spk_ttyio_ldisc_close(struct tty_struct *tty)
|
|||
kfree(tty->disc_data);
|
||||
}
|
||||
|
||||
static int spk_ttyio_receive_buf2(struct tty_struct *tty,
|
||||
const unsigned char *cp,
|
||||
const char *fp, int count)
|
||||
static size_t spk_ttyio_receive_buf2(struct tty_struct *tty,
|
||||
const unsigned char *cp, const char *fp,
|
||||
size_t count)
|
||||
{
|
||||
struct spk_ldisc_data *ldisc_data = tty->disc_data;
|
||||
struct spk_synth *synth = ldisc_data->synth;
|
||||
|
|
|
@ -599,7 +599,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,
|
||||
const char *flags, int count)
|
||||
const char *flags, size_t count)
|
||||
{
|
||||
struct hci_uart *hu = tty->disc_data;
|
||||
|
||||
|
|
|
@ -115,7 +115,8 @@ static void serport_ldisc_close(struct tty_struct *tty)
|
|||
*/
|
||||
|
||||
static void serport_ldisc_receive(struct tty_struct *tty,
|
||||
const unsigned char *cp, const char *fp, int count)
|
||||
const unsigned char *cp, const char *fp,
|
||||
size_t count)
|
||||
{
|
||||
struct serport *serport = tty->disc_data;
|
||||
unsigned long flags;
|
||||
|
|
|
@ -792,7 +792,7 @@ static void st_tty_close(struct tty_struct *tty)
|
|||
}
|
||||
|
||||
static void st_tty_receive(struct tty_struct *tty, const unsigned char *data,
|
||||
const char *tty_flags, int count)
|
||||
const char *tty_flags, size_t count)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
print_hex_dump(KERN_DEBUG, ">in>", DUMP_PREFIX_NONE,
|
||||
|
|
|
@ -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,
|
||||
const char *flags, int count)
|
||||
const char *flags, size_t count)
|
||||
{
|
||||
struct sk_buff *skb = NULL;
|
||||
struct ser_device *ser;
|
||||
|
|
|
@ -886,7 +886,7 @@ static bool can327_is_valid_rx_char(u8 c)
|
|||
* functions may be called in parallel.
|
||||
*/
|
||||
static void can327_ldisc_rx(struct tty_struct *tty, const unsigned char *cp,
|
||||
const char *fp, int count)
|
||||
const char *fp, size_t count)
|
||||
{
|
||||
struct can327 *elm = tty->disc_data;
|
||||
size_t first_new_char_idx;
|
||||
|
@ -904,7 +904,7 @@ static void can327_ldisc_rx(struct tty_struct *tty, const unsigned char *cp,
|
|||
while (count--) {
|
||||
if (elm->rxfill >= CAN327_SIZE_RXBUF) {
|
||||
netdev_err(elm->dev,
|
||||
"Receive buffer overflowed. Bad chip or wiring? count = %i",
|
||||
"Receive buffer overflowed. Bad chip or wiring? count = %zu",
|
||||
count);
|
||||
goto uart_failure;
|
||||
}
|
||||
|
|
|
@ -776,7 +776,7 @@ static const struct net_device_ops slcan_netdev_ops = {
|
|||
*/
|
||||
static void slcan_receive_buf(struct tty_struct *tty,
|
||||
const unsigned char *cp, const char *fp,
|
||||
int count)
|
||||
size_t count)
|
||||
{
|
||||
struct slcan *sl = tty->disc_data;
|
||||
|
||||
|
|
|
@ -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, const char *fp, int count)
|
||||
const unsigned char *cp, const char *fp, size_t count)
|
||||
{
|
||||
struct sixpack *sp;
|
||||
int count1;
|
||||
|
|
|
@ -875,7 +875,7 @@ static int mkiss_ioctl(struct tty_struct *tty, unsigned int cmd,
|
|||
* and sent on to the AX.25 layer for further processing.
|
||||
*/
|
||||
static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp,
|
||||
const char *fp, int count)
|
||||
const char *fp, size_t count)
|
||||
{
|
||||
struct mkiss *ax = mkiss_get(tty);
|
||||
|
||||
|
|
|
@ -392,7 +392,7 @@ static void mctp_serial_push(struct mctp_serial *dev, unsigned char c)
|
|||
|
||||
static void mctp_serial_tty_receive_buf(struct tty_struct *tty,
|
||||
const unsigned char *c,
|
||||
const char *f, int len)
|
||||
const char *f, size_t len)
|
||||
{
|
||||
struct mctp_serial *dev = tty->disc_data;
|
||||
int i;
|
||||
|
|
|
@ -331,7 +331,7 @@ ppp_asynctty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
|
|||
/* 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,
|
||||
const char *cflags, int count)
|
||||
const char *cflags, size_t count)
|
||||
{
|
||||
struct asyncppp *ap = ap_get(tty);
|
||||
unsigned long flags;
|
||||
|
|
|
@ -324,7 +324,7 @@ ppp_synctty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
|
|||
/* 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,
|
||||
const char *cflags, int count)
|
||||
const char *cflags, size_t count)
|
||||
{
|
||||
struct syncppp *ap = sp_get(tty);
|
||||
unsigned long flags;
|
||||
|
|
|
@ -686,7 +686,7 @@ static void sl_setup(struct net_device *dev)
|
|||
*/
|
||||
|
||||
static void slip_receive_buf(struct tty_struct *tty, const unsigned char *cp,
|
||||
const char *fp, int count)
|
||||
const char *fp, size_t count)
|
||||
{
|
||||
struct slip *sl = tty->disc_data;
|
||||
|
||||
|
|
|
@ -3490,7 +3490,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,
|
||||
const char *fp, int count)
|
||||
const char *fp, size_t count)
|
||||
{
|
||||
struct gsm_mux *gsm = tty->disc_data;
|
||||
char flags = TTY_NORMAL;
|
||||
|
|
|
@ -370,12 +370,12 @@ 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,
|
||||
const char *flags, int count)
|
||||
const char *flags, size_t count)
|
||||
{
|
||||
register struct n_hdlc *n_hdlc = tty->disc_data;
|
||||
register struct n_hdlc_buf *buf;
|
||||
|
||||
pr_debug("%s() called count=%d\n", __func__, count);
|
||||
pr_debug("%s() called count=%zu\n", __func__, count);
|
||||
|
||||
if (count > maxframe) {
|
||||
pr_debug("rx count>maxframesize, data discarded\n");
|
||||
|
|
|
@ -1480,7 +1480,7 @@ n_tty_receive_char_lnext(struct tty_struct *tty, unsigned char c, char flag)
|
|||
|
||||
/* Caller must ensure count > 0 */
|
||||
static void n_tty_lookahead_flow_ctrl(struct tty_struct *tty, const unsigned char *cp,
|
||||
const unsigned char *fp, unsigned int count)
|
||||
const unsigned char *fp, size_t count)
|
||||
{
|
||||
struct n_tty_data *ldata = tty->disc_data;
|
||||
unsigned char flag = TTY_NORMAL;
|
||||
|
@ -1662,12 +1662,13 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp,
|
|||
* claims non-exclusive %termios_rwsem
|
||||
* publishes commit_head or canon_head
|
||||
*/
|
||||
static int
|
||||
static size_t
|
||||
n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp,
|
||||
const char *fp, int count, int flow)
|
||||
{
|
||||
struct n_tty_data *ldata = tty->disc_data;
|
||||
int room, n, rcvd = 0, overflow;
|
||||
size_t rcvd = 0;
|
||||
int room, n, overflow;
|
||||
|
||||
down_read(&tty->termios_rwsem);
|
||||
|
||||
|
@ -1744,13 +1745,14 @@ 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,
|
||||
const char *fp, int count)
|
||||
const char *fp, size_t 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,
|
||||
const char *fp, int count)
|
||||
static size_t n_tty_receive_buf2(struct tty_struct *tty,
|
||||
const unsigned char *cp, const char *fp,
|
||||
size_t count)
|
||||
{
|
||||
return n_tty_receive_buf_common(tty, cp, fp, count, 1);
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass,
|
|||
* Optional. Can sleep.
|
||||
*
|
||||
* @receive_buf: [DRV] ``void ()(struct tty_struct *tty,
|
||||
* const unsigned char *cp, const char *fp, int count)``
|
||||
* const unsigned char *cp, const char *fp, size_t count)``
|
||||
*
|
||||
* This function is called by the low-level tty driver to send characters
|
||||
* received by the hardware to the line discpline for processing. @cp is
|
||||
|
@ -191,8 +191,8 @@ int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass,
|
|||
*
|
||||
* Optional.
|
||||
*
|
||||
* @receive_buf2: [DRV] ``int ()(struct tty_struct *tty,
|
||||
* const unsigned char *cp, const char *fp, int count)``
|
||||
* @receive_buf2: [DRV] ``ssize_t ()(struct tty_struct *tty,
|
||||
* const unsigned char *cp, const char *fp, size_t count)``
|
||||
*
|
||||
* This function is called by the low-level tty driver to send characters
|
||||
* received by the hardware to the line discpline for processing. @cp is a
|
||||
|
@ -205,7 +205,7 @@ int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass,
|
|||
* Optional.
|
||||
*
|
||||
* @lookahead_buf: [DRV] ``void ()(struct tty_struct *tty,
|
||||
* const unsigned char *cp, const char *fp, int count)``
|
||||
* const unsigned char *cp, const char *fp, size_t count)``
|
||||
*
|
||||
* This function is called by the low-level tty driver for characters
|
||||
* not eaten by ->receive_buf() or ->receive_buf2(). It is useful for
|
||||
|
@ -256,13 +256,13 @@ struct tty_ldisc_ops {
|
|||
* The following routines are called from below.
|
||||
*/
|
||||
void (*receive_buf)(struct tty_struct *tty, const unsigned char *cp,
|
||||
const char *fp, int count);
|
||||
const char *fp, size_t count);
|
||||
void (*write_wakeup)(struct tty_struct *tty);
|
||||
void (*dcd_change)(struct tty_struct *tty, bool active);
|
||||
int (*receive_buf2)(struct tty_struct *tty, const unsigned char *cp,
|
||||
const char *fp, int count);
|
||||
size_t (*receive_buf2)(struct tty_struct *tty, const unsigned char *cp,
|
||||
const char *fp, size_t count);
|
||||
void (*lookahead_buf)(struct tty_struct *tty, const unsigned char *cp,
|
||||
const unsigned char *fp, unsigned int count);
|
||||
const unsigned char *fp, size_t count);
|
||||
|
||||
struct module *owner;
|
||||
};
|
||||
|
|
|
@ -296,7 +296,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,
|
||||
const char *flags, int count)
|
||||
const char *flags, size_t count)
|
||||
{
|
||||
struct nci_uart *nu = tty->disc_data;
|
||||
|
||||
|
|
|
@ -259,7 +259,7 @@ static void v253_hangup(struct tty_struct *tty)
|
|||
|
||||
/* Line discipline .receive_buf() */
|
||||
static void v253_receive(struct tty_struct *tty, const unsigned char *cp,
|
||||
const char *fp, int count)
|
||||
const char *fp, size_t count)
|
||||
{
|
||||
struct snd_soc_component *component = tty->disc_data;
|
||||
struct cx20442_priv *cx20442;
|
||||
|
|
Loading…
Add table
Reference in a new issue