[POC][PATCH 12/83] drivers/tty: get rid of pointless casts

From: Al Viro
Date: Mon Dec 21 2015 - 19:10:58 EST


From: Al Viro <viro@xxxxxxxxxxxxxxxxxx>

Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
---
drivers/tty/amiserial.c | 10 +++++-----
drivers/tty/cyclades.c | 10 +++++-----
drivers/tty/mxser.c | 8 ++++----
drivers/tty/rocket.c | 8 ++++----
drivers/tty/serial/crisv10.c | 10 +++++-----
drivers/tty/serial/serial_core.c | 6 +++---
drivers/tty/tty_port.c | 2 +-
7 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index ec87a8c..43605c9 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -518,23 +518,23 @@ static int startup(struct tty_struct *tty, struct serial_state *info)
struct tty_port *port = &info->tport;
unsigned long flags;
int retval=0;
- unsigned long page;
+ unsigned char *page;

- page = (unsigned long)get_zeroed_page(GFP_KERNEL);
+ page = get_zeroed_page(GFP_KERNEL);
if (!page)
return -ENOMEM;

local_irq_save(flags);

if (port->flags & ASYNC_INITIALIZED) {
- free_page((void *)page);
+ free_page(page);
goto errout;
}

if (info->xmit.buf)
- free_page((void *)page);
+ free_page(page);
else
- info->xmit.buf = (unsigned char *) page;
+ info->xmit.buf = page;

#ifdef SERIAL_DEBUG_OPEN
printk("starting up ttys%d ...", info->line);
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index 7e3bee8..fa4edc1 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -1268,12 +1268,12 @@ static int cy_startup(struct cyclades_port *info, struct tty_struct *tty)
unsigned long flags;
int retval = 0;
int channel;
- unsigned long page;
+ unsigned char *page;

card = info->card;
channel = info->line - card->first_line;

- page = (unsigned long)get_zeroed_page(GFP_KERNEL);
+ page = get_zeroed_page(GFP_KERNEL);
if (!page)
return -ENOMEM;

@@ -1288,9 +1288,9 @@ static int cy_startup(struct cyclades_port *info, struct tty_struct *tty)
}

if (info->port.xmit_buf)
- free_page((void *)page);
+ free_page(page);
else
- info->port.xmit_buf = (unsigned char *)page;
+ info->port.xmit_buf = page;

spin_unlock_irqrestore(&card->card_lock, flags);

@@ -1383,7 +1383,7 @@ static int cy_startup(struct cyclades_port *info, struct tty_struct *tty)

errout:
spin_unlock_irqrestore(&card->card_lock, flags);
- free_page((void *)page);
+ free_page(page);
return retval;
} /* startup */

diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index b730857..ee78fc2 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -862,10 +862,10 @@ static void mxser_check_modem_status(struct tty_struct *tty,
static int mxser_activate(struct tty_port *port, struct tty_struct *tty)
{
struct mxser_port *info = container_of(port, struct mxser_port, port);
- unsigned long page;
+ unsigned char *page;
unsigned long flags;

- page = __get_free_page(GFP_KERNEL);
+ page = (unsigned char *)__get_free_page(GFP_KERNEL);
if (!page)
return -ENOMEM;

@@ -873,11 +873,11 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty)

if (!info->ioaddr || !info->type) {
set_bit(TTY_IO_ERROR, &tty->flags);
- free_page((void *)page);
+ free_page(page);
spin_unlock_irqrestore(&info->slock, flags);
return 0;
}
- info->port.xmit_buf = (unsigned char *) page;
+ info->port.xmit_buf = page;

/*
* Clear the FIFO buffers and disable them
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
index 2ed96e3..78f0330 100644
--- a/drivers/tty/rocket.c
+++ b/drivers/tty/rocket.c
@@ -884,14 +884,14 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
struct tty_port *port;
int retval;
CHANNEL_t *cp;
- unsigned long page;
+ unsigned char *page;

info = rp_table[tty->index];
if (info == NULL)
return -ENXIO;
port = &info->port;

- page = __get_free_page(GFP_KERNEL);
+ page = (unsigned char *)__get_free_page(GFP_KERNEL);
if (!page)
return -ENOMEM;

@@ -899,9 +899,9 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
* We must not sleep from here until the port is marked fully in use.
*/
if (info->xmit_buf)
- free_page((void *)page);
+ free_page(page);
else
- info->xmit_buf = (unsigned char *) page;
+ info->xmit_buf = page;

tty->driver_data = info;
tty_port_tty_set(port, tty);
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c
index 82a868d..8cc4d1f 100644
--- a/drivers/tty/serial/crisv10.c
+++ b/drivers/tty/serial/crisv10.c
@@ -2590,10 +2590,10 @@ static int
startup(struct e100_serial * info)
{
unsigned long flags;
- unsigned long xmit_page;
+ unsigned char *xmit_page;
int i;

- xmit_page = (unsigned long)get_zeroed_page(GFP_KERNEL);
+ xmit_page = get_zeroed_page(GFP_KERNEL);
if (!xmit_page)
return -ENOMEM;

@@ -2603,14 +2603,14 @@ startup(struct e100_serial * info)

if (info->port.flags & ASYNC_INITIALIZED) {
local_irq_restore(flags);
- free_page((void *)xmit_page);
+ free_page(xmit_page);
return 0;
}

if (info->xmit.buf)
- free_page((void *)xmit_page);
+ free_page(xmit_page);
else
- info->xmit.buf = (unsigned char *) xmit_page;
+ info->xmit.buf = xmit_page;

#ifdef SERIAL_DEBUG_OPEN
printk("starting up ttyS%d (xmit_buf 0x%p)...\n", info->line, info->xmit.buf);
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 3cdd727..a16d25e 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -135,7 +135,7 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,
int init_hw)
{
struct uart_port *uport = state->uart_port;
- unsigned long page;
+ unsigned char *page;
int retval = 0;

if (uport->type == PORT_UNKNOWN)
@@ -152,11 +152,11 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,
*/
if (!state->xmit.buf) {
/* This is protected by the per port mutex */
- page = (unsigned long)get_zeroed_page(GFP_KERNEL);
+ page = get_zeroed_page(GFP_KERNEL);
if (!page)
return -ENOMEM;

- state->xmit.buf = (unsigned char *) page;
+ state->xmit.buf = page;
uart_circ_clear(&state->xmit);
}

diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index 3fe48c7..ad4bee7 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -101,7 +101,7 @@ int tty_port_alloc_xmit_buf(struct tty_port *port)
/* We may sleep in get_zeroed_page() */
mutex_lock(&port->buf_mutex);
if (port->xmit_buf == NULL)
- port->xmit_buf = (unsigned char *)get_zeroed_page(GFP_KERNEL);
+ port->xmit_buf = get_zeroed_page(GFP_KERNEL);
mutex_unlock(&port->buf_mutex);
if (port->xmit_buf == NULL)
return -ENOMEM;
--
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/