* [PATCH 00/10] tty: minor cleanups
@ 2023-07-31 8:02 Jiri Slaby (SUSE)
2023-07-31 8:02 ` [PATCH 01/10] serial: move WARN_ON() in uart_write() to the condition Jiri Slaby (SUSE)
` (10 more replies)
0 siblings, 11 replies; 16+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-31 8:02 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE)
This is another round of minor cleanups in the tty/serial/related
drivers.
Jiri Slaby (SUSE) (10):
serial: move WARN_ON() in uart_write() to the condition
Bluetooth: rfcomm: remove casts from tty->driver_data
tty: hvsi: remove an extra variable from hvsi_write()
input: serport: remove casts from tty->disc_data
can: slcan: remove casts from tty->disc_data
serial: altera_jtaguart: switch status to u32
speakup: switch to unsigned iterator in spk_ttyio_receive_buf2()
misc: ti-st: remove forward declarations and make st_int_recv() static
misc: ti-st: remove ptr from recv functions
misc: ti-st: don't check for tty data == NULL
drivers/accessibility/speakup/spk_ttyio.c | 2 +-
drivers/input/serio/serport.c | 10 +++++-----
drivers/misc/ti-st/st_core.c | 11 +++--------
drivers/misc/ti-st/st_kim.c | 9 +--------
drivers/net/can/slcan/slcan-core.c | 8 ++++----
drivers/tty/hvc/hvsi.c | 3 +--
drivers/tty/serial/altera_jtaguart.c | 2 +-
drivers/tty/serial/serial_core.c | 8 ++------
net/bluetooth/rfcomm/tty.c | 22 +++++++++++-----------
9 files changed, 29 insertions(+), 46 deletions(-)
--
2.41.0
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 01/10] serial: move WARN_ON() in uart_write() to the condition
2023-07-31 8:02 [PATCH 00/10] tty: minor cleanups Jiri Slaby (SUSE)
@ 2023-07-31 8:02 ` Jiri Slaby (SUSE)
2023-07-31 8:02 ` [PATCH 02/10] Bluetooth: rfcomm: remove casts from tty->driver_data Jiri Slaby (SUSE)
` (9 subsequent siblings)
10 siblings, 0 replies; 16+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-31 8:02 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE)
uart code currently does the following in uart_write() and
uart_flush_buffer():
if (cond) {
WARN_ON(1);
return;
}
It can be rewritten to more obvious and more readable:
if (WARN_ON(cond))
return;
Do so.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
drivers/tty/serial/serial_core.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 306ea1a560e6..e31c9b6bd8ab 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -593,10 +593,8 @@ static int uart_write(struct tty_struct *tty,
* This means you called this function _after_ the port was
* closed. No cookie for you.
*/
- if (!state) {
- WARN_ON(1);
+ if (WARN_ON(!state))
return -EL3HLT;
- }
port = uart_port_lock(state, flags);
circ = &state->xmit;
@@ -659,10 +657,8 @@ static void uart_flush_buffer(struct tty_struct *tty)
* This means you called this function _after_ the port was
* closed. No cookie for you.
*/
- if (!state) {
- WARN_ON(1);
+ if (WARN_ON(!state))
return;
- }
pr_debug("uart_flush_buffer(%d) called\n", tty->index);
--
2.41.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 02/10] Bluetooth: rfcomm: remove casts from tty->driver_data
2023-07-31 8:02 [PATCH 00/10] tty: minor cleanups Jiri Slaby (SUSE)
2023-07-31 8:02 ` [PATCH 01/10] serial: move WARN_ON() in uart_write() to the condition Jiri Slaby (SUSE)
@ 2023-07-31 8:02 ` Jiri Slaby (SUSE)
2023-07-31 8:02 ` [PATCH 03/10] tty: hvsi: remove an extra variable from hvsi_write() Jiri Slaby (SUSE)
` (8 subsequent siblings)
10 siblings, 0 replies; 16+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-31 8:02 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE), Marcel Holtmann,
Johan Hedberg, Luiz Augusto von Dentz, linux-bluetooth
tty->driver_data is 'void *', so there is no need to cast from that.
Therefore remove the casts and assign the pointer directly.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
---
net/bluetooth/rfcomm/tty.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index 5697df9d4394..d73eec146529 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -771,7 +771,7 @@ static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp)
static void rfcomm_tty_close(struct tty_struct *tty, struct file *filp)
{
- struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
+ struct rfcomm_dev *dev = tty->driver_data;
BT_DBG("tty %p dev %p dlc %p opened %d", tty, dev, dev->dlc,
dev->port.count);
@@ -781,7 +781,7 @@ static void rfcomm_tty_close(struct tty_struct *tty, struct file *filp)
static int rfcomm_tty_write(struct tty_struct *tty, const unsigned char *buf, int count)
{
- struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
+ struct rfcomm_dev *dev = tty->driver_data;
struct rfcomm_dlc *dlc = dev->dlc;
struct sk_buff *skb;
int sent = 0, size;
@@ -810,7 +810,7 @@ static int rfcomm_tty_write(struct tty_struct *tty, const unsigned char *buf, in
static unsigned int rfcomm_tty_write_room(struct tty_struct *tty)
{
- struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
+ struct rfcomm_dev *dev = tty->driver_data;
int room = 0;
if (dev && dev->dlc)
@@ -864,7 +864,7 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty,
u8 baud, data_bits, stop_bits, parity, x_on, x_off;
u16 changes = 0;
- struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
+ struct rfcomm_dev *dev = tty->driver_data;
BT_DBG("tty %p termios %p", tty, old);
@@ -996,7 +996,7 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty,
static void rfcomm_tty_throttle(struct tty_struct *tty)
{
- struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
+ struct rfcomm_dev *dev = tty->driver_data;
BT_DBG("tty %p dev %p", tty, dev);
@@ -1005,7 +1005,7 @@ static void rfcomm_tty_throttle(struct tty_struct *tty)
static void rfcomm_tty_unthrottle(struct tty_struct *tty)
{
- struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
+ struct rfcomm_dev *dev = tty->driver_data;
BT_DBG("tty %p dev %p", tty, dev);
@@ -1014,7 +1014,7 @@ static void rfcomm_tty_unthrottle(struct tty_struct *tty)
static unsigned int rfcomm_tty_chars_in_buffer(struct tty_struct *tty)
{
- struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
+ struct rfcomm_dev *dev = tty->driver_data;
BT_DBG("tty %p dev %p", tty, dev);
@@ -1029,7 +1029,7 @@ static unsigned int rfcomm_tty_chars_in_buffer(struct tty_struct *tty)
static void rfcomm_tty_flush_buffer(struct tty_struct *tty)
{
- struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
+ struct rfcomm_dev *dev = tty->driver_data;
BT_DBG("tty %p dev %p", tty, dev);
@@ -1052,7 +1052,7 @@ static void rfcomm_tty_wait_until_sent(struct tty_struct *tty, int timeout)
static void rfcomm_tty_hangup(struct tty_struct *tty)
{
- struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
+ struct rfcomm_dev *dev = tty->driver_data;
BT_DBG("tty %p dev %p", tty, dev);
@@ -1061,7 +1061,7 @@ static void rfcomm_tty_hangup(struct tty_struct *tty)
static int rfcomm_tty_tiocmget(struct tty_struct *tty)
{
- struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
+ struct rfcomm_dev *dev = tty->driver_data;
BT_DBG("tty %p dev %p", tty, dev);
@@ -1070,7 +1070,7 @@ static int rfcomm_tty_tiocmget(struct tty_struct *tty)
static int rfcomm_tty_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear)
{
- struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data;
+ struct rfcomm_dev *dev = tty->driver_data;
struct rfcomm_dlc *dlc = dev->dlc;
u8 v24_sig;
--
2.41.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 03/10] tty: hvsi: remove an extra variable from hvsi_write()
2023-07-31 8:02 [PATCH 00/10] tty: minor cleanups Jiri Slaby (SUSE)
2023-07-31 8:02 ` [PATCH 01/10] serial: move WARN_ON() in uart_write() to the condition Jiri Slaby (SUSE)
2023-07-31 8:02 ` [PATCH 02/10] Bluetooth: rfcomm: remove casts from tty->driver_data Jiri Slaby (SUSE)
@ 2023-07-31 8:02 ` Jiri Slaby (SUSE)
2023-07-31 8:02 ` [PATCH 04/10] input: serport: remove casts from tty->disc_data Jiri Slaby (SUSE)
` (7 subsequent siblings)
10 siblings, 0 replies; 16+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-31 8:02 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE), linuxppc-dev
'source' is the same as 'buf'. Rename the parameter ('buf') to
'source' and drop the local variable.
Likely, the two were introduced to have a different type. But 'char' and
'unsigned char' are the same in the kernel for a long time.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Cc: linuxppc-dev@lists.ozlabs.org
---
drivers/tty/hvc/hvsi.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c
index a200d01eceed..c1b8a4fd8b1e 100644
--- a/drivers/tty/hvc/hvsi.c
+++ b/drivers/tty/hvc/hvsi.c
@@ -905,10 +905,9 @@ static unsigned int hvsi_chars_in_buffer(struct tty_struct *tty)
}
static int hvsi_write(struct tty_struct *tty,
- const unsigned char *buf, int count)
+ const unsigned char *source, int count)
{
struct hvsi_struct *hp = tty->driver_data;
- const char *source = buf;
unsigned long flags;
int total = 0;
int origcount = count;
--
2.41.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 04/10] input: serport: remove casts from tty->disc_data
2023-07-31 8:02 [PATCH 00/10] tty: minor cleanups Jiri Slaby (SUSE)
` (2 preceding siblings ...)
2023-07-31 8:02 ` [PATCH 03/10] tty: hvsi: remove an extra variable from hvsi_write() Jiri Slaby (SUSE)
@ 2023-07-31 8:02 ` Jiri Slaby (SUSE)
2023-07-31 16:18 ` Dmitry Torokhov
2023-07-31 8:02 ` [PATCH 05/10] can: slcan: " Jiri Slaby (SUSE)
` (6 subsequent siblings)
10 siblings, 1 reply; 16+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-31 8:02 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE), Dmitry Torokhov,
linux-input
tty->disc_data is 'void *', so there is no need to cast from that.
Therefore remove the casts and assign the pointer directly.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org
---
drivers/input/serio/serport.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c
index 7f7ef0e3a749..a5d8953f5904 100644
--- a/drivers/input/serio/serport.c
+++ b/drivers/input/serio/serport.c
@@ -103,7 +103,7 @@ static int serport_ldisc_open(struct tty_struct *tty)
static void serport_ldisc_close(struct tty_struct *tty)
{
- struct serport *serport = (struct serport *) tty->disc_data;
+ struct serport *serport = tty->disc_data;
kfree(serport);
}
@@ -117,7 +117,7 @@ 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)
{
- struct serport *serport = (struct serport*) tty->disc_data;
+ struct serport *serport = tty->disc_data;
unsigned long flags;
unsigned int ch_flags = 0;
int i;
@@ -161,7 +161,7 @@ static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file,
unsigned char *kbuf, size_t nr,
void **cookie, unsigned long offset)
{
- struct serport *serport = (struct serport*) tty->disc_data;
+ struct serport *serport = tty->disc_data;
struct serio *serio;
if (test_and_set_bit(SERPORT_BUSY, &serport->flags))
@@ -245,7 +245,7 @@ static int serport_ldisc_compat_ioctl(struct tty_struct *tty,
static void serport_ldisc_hangup(struct tty_struct *tty)
{
- struct serport *serport = (struct serport *) tty->disc_data;
+ struct serport *serport = tty->disc_data;
unsigned long flags;
spin_lock_irqsave(&serport->lock, flags);
@@ -257,7 +257,7 @@ static void serport_ldisc_hangup(struct tty_struct *tty)
static void serport_ldisc_write_wakeup(struct tty_struct * tty)
{
- struct serport *serport = (struct serport *) tty->disc_data;
+ struct serport *serport = tty->disc_data;
unsigned long flags;
spin_lock_irqsave(&serport->lock, flags);
--
2.41.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 05/10] can: slcan: remove casts from tty->disc_data
2023-07-31 8:02 [PATCH 00/10] tty: minor cleanups Jiri Slaby (SUSE)
` (3 preceding siblings ...)
2023-07-31 8:02 ` [PATCH 04/10] input: serport: remove casts from tty->disc_data Jiri Slaby (SUSE)
@ 2023-07-31 8:02 ` Jiri Slaby (SUSE)
2023-07-31 8:16 ` Marc Kleine-Budde
2023-07-31 8:02 ` [PATCH 06/10] serial: altera_jtaguart: switch status to u32 Jiri Slaby (SUSE)
` (5 subsequent siblings)
10 siblings, 1 reply; 16+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-31 8:02 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE), Dario Binacchi,
Wolfgang Grandegger, Marc Kleine-Budde, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-can, netdev
tty->disc_data is 'void *', so there is no need to cast from that.
Therefore remove the casts and assign the pointer directly.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Cc: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.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: linux-can@vger.kernel.org
Cc: netdev@vger.kernel.org
---
drivers/net/can/slcan/slcan-core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c
index f4db77007c13..371af9d17b14 100644
--- a/drivers/net/can/slcan/slcan-core.c
+++ b/drivers/net/can/slcan/slcan-core.c
@@ -583,7 +583,7 @@ static void slcan_transmit(struct work_struct *work)
*/
static void slcan_write_wakeup(struct tty_struct *tty)
{
- struct slcan *sl = (struct slcan *)tty->disc_data;
+ struct slcan *sl = tty->disc_data;
schedule_work(&sl->tx_work);
}
@@ -778,7 +778,7 @@ static void slcan_receive_buf(struct tty_struct *tty,
const unsigned char *cp, const char *fp,
int count)
{
- struct slcan *sl = (struct slcan *)tty->disc_data;
+ struct slcan *sl = tty->disc_data;
if (!netif_running(sl->dev))
return;
@@ -862,7 +862,7 @@ static int slcan_open(struct tty_struct *tty)
*/
static void slcan_close(struct tty_struct *tty)
{
- struct slcan *sl = (struct slcan *)tty->disc_data;
+ struct slcan *sl = tty->disc_data;
unregister_candev(sl->dev);
@@ -886,7 +886,7 @@ static void slcan_close(struct tty_struct *tty)
static int slcan_ioctl(struct tty_struct *tty, unsigned int cmd,
unsigned long arg)
{
- struct slcan *sl = (struct slcan *)tty->disc_data;
+ struct slcan *sl = tty->disc_data;
unsigned int tmp;
switch (cmd) {
--
2.41.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 06/10] serial: altera_jtaguart: switch status to u32
2023-07-31 8:02 [PATCH 00/10] tty: minor cleanups Jiri Slaby (SUSE)
` (4 preceding siblings ...)
2023-07-31 8:02 ` [PATCH 05/10] can: slcan: " Jiri Slaby (SUSE)
@ 2023-07-31 8:02 ` Jiri Slaby (SUSE)
2023-08-08 14:34 ` Tobias Klauser
2023-07-31 8:02 ` [PATCH 07/10] speakup: switch to unsigned iterator in spk_ttyio_receive_buf2() Jiri Slaby (SUSE)
` (4 subsequent siblings)
10 siblings, 1 reply; 16+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-31 8:02 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE), Tobias Klauser
'status' is assigned a result from readl(). There is no need for the
variable to be 'unsigned long'. readl() returns 32bit values.
Provided, this is a Nios II driver (32-bit), there is no change in
semantics. This only makes the type explicit.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Cc: Tobias Klauser <tklauser@distanz.ch>
---
drivers/tty/serial/altera_jtaguart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c
index 6203ca1de769..5fab4c978891 100644
--- a/drivers/tty/serial/altera_jtaguart.c
+++ b/drivers/tty/serial/altera_jtaguart.c
@@ -110,7 +110,7 @@ static void altera_jtaguart_set_termios(struct uart_port *port,
static void altera_jtaguart_rx_chars(struct uart_port *port)
{
- unsigned long status;
+ u32 status;
u8 ch;
while ((status = readl(port->membase + ALTERA_JTAGUART_DATA_REG)) &
--
2.41.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 07/10] speakup: switch to unsigned iterator in spk_ttyio_receive_buf2()
2023-07-31 8:02 [PATCH 00/10] tty: minor cleanups Jiri Slaby (SUSE)
` (5 preceding siblings ...)
2023-07-31 8:02 ` [PATCH 06/10] serial: altera_jtaguart: switch status to u32 Jiri Slaby (SUSE)
@ 2023-07-31 8:02 ` Jiri Slaby (SUSE)
2023-07-31 8:02 ` [PATCH 08/10] misc: ti-st: remove forward declarations and make st_int_recv() static Jiri Slaby (SUSE)
` (3 subsequent siblings)
10 siblings, 0 replies; 16+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-31 8:02 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE), William Hubbs,
Chris Brannon, Kirk Reiser, Samuel Thibault, speakup
Now, that spk_ttyio_receive_buf2() receives an unsigned count, the
iterator can/should be unsigned too. Switch to that to be explicit.
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: speakup@linux-speakup.org
---
drivers/accessibility/speakup/spk_ttyio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/accessibility/speakup/spk_ttyio.c b/drivers/accessibility/speakup/spk_ttyio.c
index 07373b3debd1..5d4bafe118ec 100644
--- a/drivers/accessibility/speakup/spk_ttyio.c
+++ b/drivers/accessibility/speakup/spk_ttyio.c
@@ -79,7 +79,7 @@ static int spk_ttyio_receive_buf2(struct tty_struct *tty,
struct spk_synth *synth = ldisc_data->synth;
if (synth->read_buff_add) {
- int i;
+ unsigned int i;
for (i = 0; i < count; i++)
synth->read_buff_add(cp[i]);
--
2.41.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 08/10] misc: ti-st: remove forward declarations and make st_int_recv() static
2023-07-31 8:02 [PATCH 00/10] tty: minor cleanups Jiri Slaby (SUSE)
` (6 preceding siblings ...)
2023-07-31 8:02 ` [PATCH 07/10] speakup: switch to unsigned iterator in spk_ttyio_receive_buf2() Jiri Slaby (SUSE)
@ 2023-07-31 8:02 ` Jiri Slaby (SUSE)
2023-07-31 8:02 ` [PATCH 09/10] misc: ti-st: remove ptr from recv functions Jiri Slaby (SUSE)
` (2 subsequent siblings)
10 siblings, 0 replies; 16+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-31 8:02 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE), Arnd Bergmann
st_kim_recv() is already declared in linux/ti_wilink_st.h. Given that is
already included in st_core.c, drop the re-declaration from there.
st_int_recv() is used only in st_core.c and the forward declaration is
not needed. So drop the declaration and make the function static.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
---
drivers/misc/ti-st/st_core.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c
index 01d2257deea4..389901276ce3 100644
--- a/drivers/misc/ti-st/st_core.c
+++ b/drivers/misc/ti-st/st_core.c
@@ -16,8 +16,6 @@
#include <linux/ti_wilink_st.h>
-extern void st_kim_recv(void *, const unsigned char *, long);
-void st_int_recv(void *, const unsigned char *, long);
/*
* function pointer pointing to either,
* st_kim_recv during registration to receive fw download responses
@@ -225,7 +223,7 @@ static inline void st_wakeup_ack(struct st_data_s *st_gdata,
* HCI-Events, ACL, SCO, 4 types of HCI-LL PM packets
* CH-8 packets from FM, CH-9 packets from GPS cores.
*/
-void st_int_recv(void *disc_data,
+static void st_int_recv(void *disc_data,
const unsigned char *data, long count)
{
char *ptr;
--
2.41.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 09/10] misc: ti-st: remove ptr from recv functions
2023-07-31 8:02 [PATCH 00/10] tty: minor cleanups Jiri Slaby (SUSE)
` (7 preceding siblings ...)
2023-07-31 8:02 ` [PATCH 08/10] misc: ti-st: remove forward declarations and make st_int_recv() static Jiri Slaby (SUSE)
@ 2023-07-31 8:02 ` Jiri Slaby (SUSE)
2023-07-31 8:02 ` [PATCH 10/10] misc: ti-st: don't check for tty data == NULL Jiri Slaby (SUSE)
2023-07-31 8:15 ` [PATCH 00/10] tty: minor cleanups Marc Kleine-Budde
10 siblings, 0 replies; 16+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-31 8:02 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE), Arnd Bergmann
ptr is the same as data, so use ptr directly as a parameter and drop the
useless local variable.
Likely, the two were introduced to have a different type. But 'char' and
'unsigned char' are the same in the kernel for a long time.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
---
drivers/misc/ti-st/st_core.c | 4 +---
drivers/misc/ti-st/st_kim.c | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c
index 389901276ce3..e2add50b191c 100644
--- a/drivers/misc/ti-st/st_core.c
+++ b/drivers/misc/ti-st/st_core.c
@@ -224,9 +224,8 @@ static inline void st_wakeup_ack(struct st_data_s *st_gdata,
* CH-8 packets from FM, CH-9 packets from GPS cores.
*/
static void st_int_recv(void *disc_data,
- const unsigned char *data, long count)
+ const unsigned char *ptr, long count)
{
- char *ptr;
struct st_proto_s *proto;
unsigned short payload_len = 0;
int len = 0;
@@ -235,7 +234,6 @@ static void st_int_recv(void *disc_data,
struct st_data_s *st_gdata = (struct st_data_s *)disc_data;
unsigned long flags;
- ptr = (char *)data;
/* tty_receive sent null ? */
if (unlikely(ptr == NULL) || (st_gdata == NULL)) {
pr_err(" received null from TTY ");
diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index f2f6cab97c08..8c801897ffa2 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -128,15 +128,13 @@ static inline int kim_check_data_len(struct kim_data_s *kim_gdata, int len)
* tty_receive and hence the logic
*/
static void kim_int_recv(struct kim_data_s *kim_gdata,
- const unsigned char *data, long count)
+ const unsigned char *ptr, long count)
{
- const unsigned char *ptr;
int len = 0;
unsigned char *plen;
pr_debug("%s", __func__);
/* Decode received bytes here */
- ptr = data;
if (unlikely(ptr == NULL)) {
pr_err(" received null from TTY ");
return;
--
2.41.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 10/10] misc: ti-st: don't check for tty data == NULL
2023-07-31 8:02 [PATCH 00/10] tty: minor cleanups Jiri Slaby (SUSE)
` (8 preceding siblings ...)
2023-07-31 8:02 ` [PATCH 09/10] misc: ti-st: remove ptr from recv functions Jiri Slaby (SUSE)
@ 2023-07-31 8:02 ` Jiri Slaby (SUSE)
2023-07-31 8:15 ` [PATCH 00/10] tty: minor cleanups Marc Kleine-Budde
10 siblings, 0 replies; 16+ messages in thread
From: Jiri Slaby (SUSE) @ 2023-07-31 8:02 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE), Arnd Bergmann
tty data passed to tty_ldisc_ops::receive_buf() are never NULL. Remove
this check.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
---
drivers/misc/ti-st/st_core.c | 3 +--
drivers/misc/ti-st/st_kim.c | 5 -----
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c
index e2add50b191c..3b2145722bd7 100644
--- a/drivers/misc/ti-st/st_core.c
+++ b/drivers/misc/ti-st/st_core.c
@@ -234,8 +234,7 @@ static void st_int_recv(void *disc_data,
struct st_data_s *st_gdata = (struct st_data_s *)disc_data;
unsigned long flags;
- /* tty_receive sent null ? */
- if (unlikely(ptr == NULL) || (st_gdata == NULL)) {
+ if (st_gdata == NULL) {
pr_err(" received null from TTY ");
return;
}
diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index 8c801897ffa2..5431a89924aa 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -135,11 +135,6 @@ static void kim_int_recv(struct kim_data_s *kim_gdata,
pr_debug("%s", __func__);
/* Decode received bytes here */
- if (unlikely(ptr == NULL)) {
- pr_err(" received null from TTY ");
- return;
- }
-
while (count) {
if (kim_gdata->rx_count) {
len = min_t(unsigned int, kim_gdata->rx_count, count);
--
2.41.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 00/10] tty: minor cleanups
2023-07-31 8:02 [PATCH 00/10] tty: minor cleanups Jiri Slaby (SUSE)
` (9 preceding siblings ...)
2023-07-31 8:02 ` [PATCH 10/10] misc: ti-st: don't check for tty data == NULL Jiri Slaby (SUSE)
@ 2023-07-31 8:15 ` Marc Kleine-Budde
2023-07-31 8:21 ` Jiri Slaby
10 siblings, 1 reply; 16+ messages in thread
From: Marc Kleine-Budde @ 2023-07-31 8:15 UTC (permalink / raw)
To: Jiri Slaby (SUSE); +Cc: gregkh, linux-serial, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 428 bytes --]
On 31.07.2023 10:02:34, Jiri Slaby (SUSE) wrote:
> can: slcan: remove casts from tty->disc_data
You can do the same for drivers/net/can/can327.c
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 05/10] can: slcan: remove casts from tty->disc_data
2023-07-31 8:02 ` [PATCH 05/10] can: slcan: " Jiri Slaby (SUSE)
@ 2023-07-31 8:16 ` Marc Kleine-Budde
0 siblings, 0 replies; 16+ messages in thread
From: Marc Kleine-Budde @ 2023-07-31 8:16 UTC (permalink / raw)
To: Jiri Slaby (SUSE)
Cc: gregkh, linux-serial, linux-kernel, Dario Binacchi,
Wolfgang Grandegger, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, linux-can, netdev
[-- Attachment #1: Type: text/plain, Size: 968 bytes --]
On 31.07.2023 10:02:39, Jiri Slaby (SUSE) wrote:
> tty->disc_data is 'void *', so there is no need to cast from that.
> Therefore remove the casts and assign the pointer directly.
>
> Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
> Cc: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> Cc: Wolfgang Grandegger <wg@grandegger.com>
> Cc: Marc Kleine-Budde <mkl@pengutronix.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: linux-can@vger.kernel.org
> Cc: netdev@vger.kernel.org
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 00/10] tty: minor cleanups
2023-07-31 8:15 ` [PATCH 00/10] tty: minor cleanups Marc Kleine-Budde
@ 2023-07-31 8:21 ` Jiri Slaby
0 siblings, 0 replies; 16+ messages in thread
From: Jiri Slaby @ 2023-07-31 8:21 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: gregkh, linux-serial, linux-kernel
On 31. 07. 23, 10:15, Marc Kleine-Budde wrote:
> On 31.07.2023 10:02:34, Jiri Slaby (SUSE) wrote:
>> can: slcan: remove casts from tty->disc_data
>
> You can do the same for drivers/net/can/can327.c
OK. And in net/nfc/nci/uart.c and that all should be it.
thanks,
--
js
suse labs
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 04/10] input: serport: remove casts from tty->disc_data
2023-07-31 8:02 ` [PATCH 04/10] input: serport: remove casts from tty->disc_data Jiri Slaby (SUSE)
@ 2023-07-31 16:18 ` Dmitry Torokhov
0 siblings, 0 replies; 16+ messages in thread
From: Dmitry Torokhov @ 2023-07-31 16:18 UTC (permalink / raw)
To: Jiri Slaby (SUSE); +Cc: gregkh, linux-serial, linux-kernel, linux-input
On Mon, Jul 31, 2023 at 10:02:38AM +0200, Jiri Slaby (SUSE) wrote:
> tty->disc_data is 'void *', so there is no need to cast from that.
> Therefore remove the casts and assign the pointer directly.
>
> Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: linux-input@vger.kernel.org
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 06/10] serial: altera_jtaguart: switch status to u32
2023-07-31 8:02 ` [PATCH 06/10] serial: altera_jtaguart: switch status to u32 Jiri Slaby (SUSE)
@ 2023-08-08 14:34 ` Tobias Klauser
0 siblings, 0 replies; 16+ messages in thread
From: Tobias Klauser @ 2023-08-08 14:34 UTC (permalink / raw)
To: Jiri Slaby (SUSE); +Cc: gregkh, linux-serial, linux-kernel
On 2023-07-31 at 10:02:40 +0200, Jiri Slaby (SUSE) <jirislaby@kernel.org> wrote:
> 'status' is assigned a result from readl(). There is no need for the
> variable to be 'unsigned long'. readl() returns 32bit values.
>
> Provided, this is a Nios II driver (32-bit), there is no change in
> semantics. This only makes the type explicit.
>
> Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
> Cc: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Tobias Klauser <tklauser@distanz.ch>
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2023-08-08 16:36 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-31 8:02 [PATCH 00/10] tty: minor cleanups Jiri Slaby (SUSE)
2023-07-31 8:02 ` [PATCH 01/10] serial: move WARN_ON() in uart_write() to the condition Jiri Slaby (SUSE)
2023-07-31 8:02 ` [PATCH 02/10] Bluetooth: rfcomm: remove casts from tty->driver_data Jiri Slaby (SUSE)
2023-07-31 8:02 ` [PATCH 03/10] tty: hvsi: remove an extra variable from hvsi_write() Jiri Slaby (SUSE)
2023-07-31 8:02 ` [PATCH 04/10] input: serport: remove casts from tty->disc_data Jiri Slaby (SUSE)
2023-07-31 16:18 ` Dmitry Torokhov
2023-07-31 8:02 ` [PATCH 05/10] can: slcan: " Jiri Slaby (SUSE)
2023-07-31 8:16 ` Marc Kleine-Budde
2023-07-31 8:02 ` [PATCH 06/10] serial: altera_jtaguart: switch status to u32 Jiri Slaby (SUSE)
2023-08-08 14:34 ` Tobias Klauser
2023-07-31 8:02 ` [PATCH 07/10] speakup: switch to unsigned iterator in spk_ttyio_receive_buf2() Jiri Slaby (SUSE)
2023-07-31 8:02 ` [PATCH 08/10] misc: ti-st: remove forward declarations and make st_int_recv() static Jiri Slaby (SUSE)
2023-07-31 8:02 ` [PATCH 09/10] misc: ti-st: remove ptr from recv functions Jiri Slaby (SUSE)
2023-07-31 8:02 ` [PATCH 10/10] misc: ti-st: don't check for tty data == NULL Jiri Slaby (SUSE)
2023-07-31 8:15 ` [PATCH 00/10] tty: minor cleanups Marc Kleine-Budde
2023-07-31 8:21 ` Jiri Slaby
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).