2020-08-17 09:00:29

by Allen Pais

[permalink] [raw]
Subject: [PATCH 0/4] tty: convert tasklets to use new tasklet_setup()

From: Allen Pais <[email protected]>

Commit 12cc923f1ccc ("tasklet: Introduce new initialization API")'
introduced a new tasklet initialization API. This series converts
all the tty drivers to use the new tasklet_setup() API

Allen Pais (4):
tty: ipwireless: convert tasklets to use new tasklet_setup() API
tty: atmel_serial: convert tasklets to use new tasklet_setup() API
tty: ifx6x60: convert tasklets to use new tasklet_setup() API
tty: timbuart: convert tasklets to use new tasklet_setup() API

drivers/tty/ipwireless/hardware.c | 6 +++---
drivers/tty/serial/atmel_serial.c | 20 ++++++++++----------
drivers/tty/serial/ifx6x60.c | 8 ++++----
drivers/tty/serial/timbuart.c | 6 +++---
4 files changed, 20 insertions(+), 20 deletions(-)

--
2.17.1


2020-08-17 09:00:35

by Allen Pais

[permalink] [raw]
Subject: [PATCH 1/4] tty: ipwireless: convert tasklets to use new tasklet_setup() API

From: Allen Pais <[email protected]>

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
---
drivers/tty/ipwireless/hardware.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/ipwireless/hardware.c b/drivers/tty/ipwireless/hardware.c
index 6bbf35682d53..f5d3e68f5750 100644
--- a/drivers/tty/ipwireless/hardware.c
+++ b/drivers/tty/ipwireless/hardware.c
@@ -1006,9 +1006,9 @@ static int send_pending_packet(struct ipw_hardware *hw, int priority_limit)
/*
* Send and receive all queued packets.
*/
-static void ipwireless_do_tasklet(unsigned long hw_)
+static void ipwireless_do_tasklet(struct tasklet_struct *t)
{
- struct ipw_hardware *hw = (struct ipw_hardware *) hw_;
+ struct ipw_hardware *hw = from_tasklet(hw, t, tasklet);
unsigned long flags;

spin_lock_irqsave(&hw->lock, flags);
@@ -1635,7 +1635,7 @@ struct ipw_hardware *ipwireless_hardware_create(void)
INIT_LIST_HEAD(&hw->rx_queue);
INIT_LIST_HEAD(&hw->rx_pool);
spin_lock_init(&hw->lock);
- tasklet_init(&hw->tasklet, ipwireless_do_tasklet, (unsigned long) hw);
+ tasklet_setup(&hw->tasklet, ipwireless_do_tasklet);
INIT_WORK(&hw->work_rx, ipw_receive_data_work);
timer_setup(&hw->setup_timer, ipwireless_setup_timer, 0);

--
2.17.1

2020-08-17 09:02:27

by Allen Pais

[permalink] [raw]
Subject: [PATCH 4/4] tty: timbuart: convert tasklets to use new tasklet_setup() API

From: Allen Pais <[email protected]>

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
---
drivers/tty/serial/timbuart.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/timbuart.c b/drivers/tty/serial/timbuart.c
index 19d38b504e27..2126e6e6dfd1 100644
--- a/drivers/tty/serial/timbuart.c
+++ b/drivers/tty/serial/timbuart.c
@@ -172,9 +172,9 @@ static void timbuart_handle_rx_port(struct uart_port *port, u32 isr, u32 *ier)
dev_dbg(port->dev, "%s - leaving\n", __func__);
}

-static void timbuart_tasklet(unsigned long arg)
+static void timbuart_tasklet(struct tasklet_struct *t)
{
- struct timbuart_port *uart = (struct timbuart_port *)arg;
+ struct timbuart_port *uart = from_tasklet(uart, t, tasklet);
u32 isr, ier = 0;

spin_lock(&uart->port.lock);
@@ -451,7 +451,7 @@ static int timbuart_probe(struct platform_device *dev)
}
uart->port.irq = irq;

- tasklet_init(&uart->tasklet, timbuart_tasklet, (unsigned long)uart);
+ tasklet_setup(&uart->tasklet, timbuart_tasklet);

err = uart_register_driver(&timbuart_driver);
if (err)
--
2.17.1

2020-08-17 09:03:09

by Allen Pais

[permalink] [raw]
Subject: [PATCH 3/4] tty: ifx6x60: convert tasklets to use new tasklet_setup() API

From: Allen Pais <[email protected]>

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
---
drivers/tty/serial/ifx6x60.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 7d16fe41932f..37d5b8516880 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -725,10 +725,11 @@ static void ifx_spi_complete(void *ctx)
* Queue data for transmission if possible and then kick off the
* transfer.
*/
-static void ifx_spi_io(unsigned long data)
+static void ifx_spi_io(struct tasklet_struct *t)
{
int retval;
- struct ifx_spi_device *ifx_dev = (struct ifx_spi_device *) data;
+ struct ifx_spi_device *ifx_dev = from_tasklet(ifx_dev, t,
+ io_work_tasklet);

if (!test_and_set_bit(IFX_SPI_STATE_IO_IN_PROGRESS, &ifx_dev->flags) &&
test_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags)) {
@@ -1067,8 +1068,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
init_waitqueue_head(&ifx_dev->mdm_reset_wait);

spi_set_drvdata(spi, ifx_dev);
- tasklet_init(&ifx_dev->io_work_tasklet, ifx_spi_io,
- (unsigned long)ifx_dev);
+ tasklet_setup(&ifx_dev->io_work_tasklet, ifx_spi_io);

set_bit(IFX_SPI_STATE_PRESENT, &ifx_dev->flags);

--
2.17.1

2020-08-17 09:03:34

by Allen Pais

[permalink] [raw]
Subject: [PATCH 2/4] tty: atmel_serial: convert tasklets to use new tasklet_setup() API

From: Allen Pais <[email protected]>

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <[email protected]>
Signed-off-by: Allen Pais <[email protected]>
---
drivers/tty/serial/atmel_serial.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index e43471b33710..a9c47f56e994 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1722,10 +1722,11 @@ static int atmel_prepare_rx_pdc(struct uart_port *port)
/*
* tasklet handling tty stuff outside the interrupt handler.
*/
-static void atmel_tasklet_rx_func(unsigned long data)
+static void atmel_tasklet_rx_func(struct tasklet_struct *t)
{
- struct uart_port *port = (struct uart_port *)data;
- struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
+ struct atmel_uart_port *atmel_port = from_tasklet(atmel_port, t,
+ tasklet_rx);
+ struct uart_port *port = &atmel_port->uart;

/* The interrupt handler does not take the lock */
spin_lock(&port->lock);
@@ -1733,10 +1734,11 @@ static void atmel_tasklet_rx_func(unsigned long data)
spin_unlock(&port->lock);
}

-static void atmel_tasklet_tx_func(unsigned long data)
+static void atmel_tasklet_tx_func(struct tasklet_struct *t)
{
- struct uart_port *port = (struct uart_port *)data;
- struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
+ struct atmel_uart_port *atmel_port = from_tasklet(atmel_port, t,
+ tasklet_tx);
+ struct uart_port *port = &atmel_port->uart;

/* The interrupt handler does not take the lock */
spin_lock(&port->lock);
@@ -1911,10 +1913,8 @@ static int atmel_startup(struct uart_port *port)
}

atomic_set(&atmel_port->tasklet_shutdown, 0);
- tasklet_init(&atmel_port->tasklet_rx, atmel_tasklet_rx_func,
- (unsigned long)port);
- tasklet_init(&atmel_port->tasklet_tx, atmel_tasklet_tx_func,
- (unsigned long)port);
+ tasklet_setup(&atmel_port->tasklet_rx, atmel_tasklet_rx_func);
+ tasklet_setup(&atmel_port->tasklet_tx, atmel_tasklet_tx_func);

/*
* Initialize DMA (if necessary)
--
2.17.1

2020-08-26 14:34:36

by Richard Genoud

[permalink] [raw]
Subject: Re: [PATCH 2/4] tty: atmel_serial: convert tasklets to use new tasklet_setup() API

Le 17/08/2020 à 10:59, Allen Pais a écrit :
> From: Allen Pais <[email protected]>
>
> In preparation for unconditionally passing the
> struct tasklet_struct pointer to all tasklet
> callbacks, switch to using the new tasklet_setup()
> and from_tasklet() to pass the tasklet pointer explicitly.
>
> Signed-off-by: Romain Perier <[email protected]>
> Signed-off-by: Allen Pais <[email protected]>
Acked-by: Richard Genoud <[email protected]>

> ---
> drivers/tty/serial/atmel_serial.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index e43471b33710..a9c47f56e994 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -1722,10 +1722,11 @@ static int atmel_prepare_rx_pdc(struct uart_port *port)
> /*
> * tasklet handling tty stuff outside the interrupt handler.
> */
> -static void atmel_tasklet_rx_func(unsigned long data)
> +static void atmel_tasklet_rx_func(struct tasklet_struct *t)
> {
> - struct uart_port *port = (struct uart_port *)data;
> - struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
> + struct atmel_uart_port *atmel_port = from_tasklet(atmel_port, t,
> + tasklet_rx);
> + struct uart_port *port = &atmel_port->uart;
>
> /* The interrupt handler does not take the lock */
> spin_lock(&port->lock);
> @@ -1733,10 +1734,11 @@ static void atmel_tasklet_rx_func(unsigned long data)
> spin_unlock(&port->lock);
> }
>
> -static void atmel_tasklet_tx_func(unsigned long data)
> +static void atmel_tasklet_tx_func(struct tasklet_struct *t)
> {
> - struct uart_port *port = (struct uart_port *)data;
> - struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
> + struct atmel_uart_port *atmel_port = from_tasklet(atmel_port, t,
> + tasklet_tx);
> + struct uart_port *port = &atmel_port->uart;
>
> /* The interrupt handler does not take the lock */
> spin_lock(&port->lock);
> @@ -1911,10 +1913,8 @@ static int atmel_startup(struct uart_port *port)
> }
>
> atomic_set(&atmel_port->tasklet_shutdown, 0);
> - tasklet_init(&atmel_port->tasklet_rx, atmel_tasklet_rx_func,
> - (unsigned long)port);
> - tasklet_init(&atmel_port->tasklet_tx, atmel_tasklet_tx_func,
> - (unsigned long)port);
> + tasklet_setup(&atmel_port->tasklet_rx, atmel_tasklet_rx_func);
> + tasklet_setup(&atmel_port->tasklet_tx, atmel_tasklet_tx_func);
>
> /*
> * Initialize DMA (if necessary)
>

Thanks !