Commit d78055dc authored by Alan's avatar Alan Committed by Greg Kroah-Hartman

goldfish: clean up the checkpatch warnings

Mostly spacing changes, also making the operations structure const
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e0f682e0
...@@ -76,7 +76,7 @@ static irqreturn_t goldfish_tty_interrupt(int irq, void *dev_id) ...@@ -76,7 +76,7 @@ static irqreturn_t goldfish_tty_interrupt(int irq, void *dev_id)
u32 count; u32 count;
count = readl(base + GOLDFISH_TTY_BYTES_READY); count = readl(base + GOLDFISH_TTY_BYTES_READY);
if(count == 0) if (count == 0)
return IRQ_NONE; return IRQ_NONE;
count = tty_prepare_flip_string(&qtty->port, &buf, count); count = tty_prepare_flip_string(&qtty->port, &buf, count);
...@@ -92,24 +92,26 @@ static irqreturn_t goldfish_tty_interrupt(int irq, void *dev_id) ...@@ -92,24 +92,26 @@ static irqreturn_t goldfish_tty_interrupt(int irq, void *dev_id)
static int goldfish_tty_activate(struct tty_port *port, struct tty_struct *tty) static int goldfish_tty_activate(struct tty_port *port, struct tty_struct *tty)
{ {
struct goldfish_tty *qtty = container_of(port, struct goldfish_tty, port); struct goldfish_tty *qtty = container_of(port, struct goldfish_tty,
port);
writel(GOLDFISH_TTY_CMD_INT_ENABLE, qtty->base + GOLDFISH_TTY_CMD); writel(GOLDFISH_TTY_CMD_INT_ENABLE, qtty->base + GOLDFISH_TTY_CMD);
return 0; return 0;
} }
static void goldfish_tty_shutdown(struct tty_port *port) static void goldfish_tty_shutdown(struct tty_port *port)
{ {
struct goldfish_tty *qtty = container_of(port, struct goldfish_tty, port); struct goldfish_tty *qtty = container_of(port, struct goldfish_tty,
port);
writel(GOLDFISH_TTY_CMD_INT_DISABLE, qtty->base + GOLDFISH_TTY_CMD); writel(GOLDFISH_TTY_CMD_INT_DISABLE, qtty->base + GOLDFISH_TTY_CMD);
} }
static int goldfish_tty_open(struct tty_struct * tty, struct file * filp) static int goldfish_tty_open(struct tty_struct *tty, struct file *filp)
{ {
struct goldfish_tty *qtty = &goldfish_ttys[tty->index]; struct goldfish_tty *qtty = &goldfish_ttys[tty->index];
return tty_port_open(&qtty->port, tty, filp); return tty_port_open(&qtty->port, tty, filp);
} }
static void goldfish_tty_close(struct tty_struct * tty, struct file * filp) static void goldfish_tty_close(struct tty_struct *tty, struct file *filp)
{ {
tty_port_close(tty->port, tty, filp); tty_port_close(tty->port, tty, filp);
} }
...@@ -119,7 +121,8 @@ static void goldfish_tty_hangup(struct tty_struct *tty) ...@@ -119,7 +121,8 @@ static void goldfish_tty_hangup(struct tty_struct *tty)
tty_port_hangup(tty->port); tty_port_hangup(tty->port);
} }
static int goldfish_tty_write(struct tty_struct * tty, const unsigned char *buf, int count) static int goldfish_tty_write(struct tty_struct *tty, const unsigned char *buf,
int count)
{ {
goldfish_tty_do_write(tty->index, buf, count); goldfish_tty_do_write(tty->index, buf, count);
return count; return count;
...@@ -137,12 +140,14 @@ static int goldfish_tty_chars_in_buffer(struct tty_struct *tty) ...@@ -137,12 +140,14 @@ static int goldfish_tty_chars_in_buffer(struct tty_struct *tty)
return readl(base + GOLDFISH_TTY_BYTES_READY); return readl(base + GOLDFISH_TTY_BYTES_READY);
} }
static void goldfish_tty_console_write(struct console *co, const char *b, unsigned count) static void goldfish_tty_console_write(struct console *co, const char *b,
unsigned count)
{ {
goldfish_tty_do_write(co->index, b, count); goldfish_tty_do_write(co->index, b, count);
} }
static struct tty_driver *goldfish_tty_console_device(struct console *c, int *index) static struct tty_driver *goldfish_tty_console_device(struct console *c,
int *index)
{ {
*index = c->index; *index = c->index;
return goldfish_tty_driver; return goldfish_tty_driver;
...@@ -150,9 +155,9 @@ static struct tty_driver *goldfish_tty_console_device(struct console *c, int *in ...@@ -150,9 +155,9 @@ static struct tty_driver *goldfish_tty_console_device(struct console *c, int *in
static int goldfish_tty_console_setup(struct console *co, char *options) static int goldfish_tty_console_setup(struct console *co, char *options)
{ {
if((unsigned)co->index > goldfish_tty_line_count) if ((unsigned)co->index > goldfish_tty_line_count)
return -ENODEV; return -ENODEV;
if(goldfish_ttys[co->index].base == 0) if (goldfish_ttys[co->index].base == 0)
return -ENODEV; return -ENODEV;
return 0; return 0;
} }
...@@ -162,7 +167,7 @@ static struct tty_port_operations goldfish_port_ops = { ...@@ -162,7 +167,7 @@ static struct tty_port_operations goldfish_port_ops = {
.shutdown = goldfish_tty_shutdown .shutdown = goldfish_tty_shutdown
}; };
static struct tty_operations goldfish_tty_ops = { static const struct tty_operations goldfish_tty_ops = {
.open = goldfish_tty_open, .open = goldfish_tty_open,
.close = goldfish_tty_close, .close = goldfish_tty_close,
.hangup = goldfish_tty_hangup, .hangup = goldfish_tty_hangup,
...@@ -176,13 +181,14 @@ static int goldfish_tty_create_driver(void) ...@@ -176,13 +181,14 @@ static int goldfish_tty_create_driver(void)
int ret; int ret;
struct tty_driver *tty; struct tty_driver *tty;
goldfish_ttys = kzalloc(sizeof(*goldfish_ttys) * goldfish_tty_line_count, GFP_KERNEL); goldfish_ttys = kzalloc(sizeof(*goldfish_ttys) *
if(goldfish_ttys == NULL) { goldfish_tty_line_count, GFP_KERNEL);
if (goldfish_ttys == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto err_alloc_goldfish_ttys_failed; goto err_alloc_goldfish_ttys_failed;
} }
tty = alloc_tty_driver(goldfish_tty_line_count); tty = alloc_tty_driver(goldfish_tty_line_count);
if(tty == NULL) { if (tty == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto err_alloc_tty_driver_failed; goto err_alloc_tty_driver_failed;
} }
...@@ -191,10 +197,11 @@ static int goldfish_tty_create_driver(void) ...@@ -191,10 +197,11 @@ static int goldfish_tty_create_driver(void)
tty->type = TTY_DRIVER_TYPE_SERIAL; tty->type = TTY_DRIVER_TYPE_SERIAL;
tty->subtype = SERIAL_TYPE_NORMAL; tty->subtype = SERIAL_TYPE_NORMAL;
tty->init_termios = tty_std_termios; tty->init_termios = tty_std_termios;
tty->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; tty->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW |
TTY_DRIVER_DYNAMIC_DEV;
tty_set_operations(tty, &goldfish_tty_ops); tty_set_operations(tty, &goldfish_tty_ops);
ret = tty_register_driver(tty); ret = tty_register_driver(tty);
if(ret) if (ret)
goto err_tty_register_driver_failed; goto err_tty_register_driver_failed;
goldfish_tty_driver = tty; goldfish_tty_driver = tty;
...@@ -229,7 +236,7 @@ static int goldfish_tty_probe(struct platform_device *pdev) ...@@ -229,7 +236,7 @@ static int goldfish_tty_probe(struct platform_device *pdev)
u32 irq; u32 irq;
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if(r == NULL) if (r == NULL)
return -EINVAL; return -EINVAL;
base = ioremap(r->start, 0x1000); base = ioremap(r->start, 0x1000);
...@@ -237,18 +244,18 @@ static int goldfish_tty_probe(struct platform_device *pdev) ...@@ -237,18 +244,18 @@ static int goldfish_tty_probe(struct platform_device *pdev)
pr_err("goldfish_tty: unable to remap base\n"); pr_err("goldfish_tty: unable to remap base\n");
r = platform_get_resource(pdev, IORESOURCE_IRQ, 0); r = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if(r == NULL) if (r == NULL)
goto err_unmap; goto err_unmap;
irq = r->start; irq = r->start;
if(pdev->id >= goldfish_tty_line_count) if (pdev->id >= goldfish_tty_line_count)
goto err_unmap; goto err_unmap;
mutex_lock(&goldfish_tty_lock); mutex_lock(&goldfish_tty_lock);
if(goldfish_tty_current_line_count == 0) { if (goldfish_tty_current_line_count == 0) {
ret = goldfish_tty_create_driver(); ret = goldfish_tty_create_driver();
if(ret) if (ret)
goto err_create_driver_failed; goto err_create_driver_failed;
} }
goldfish_tty_current_line_count++; goldfish_tty_current_line_count++;
...@@ -262,14 +269,15 @@ static int goldfish_tty_probe(struct platform_device *pdev) ...@@ -262,14 +269,15 @@ static int goldfish_tty_probe(struct platform_device *pdev)
writel(GOLDFISH_TTY_CMD_INT_DISABLE, base + GOLDFISH_TTY_CMD); writel(GOLDFISH_TTY_CMD_INT_DISABLE, base + GOLDFISH_TTY_CMD);
ret = request_irq(irq, goldfish_tty_interrupt, IRQF_SHARED, "goldfish_tty", pdev); ret = request_irq(irq, goldfish_tty_interrupt, IRQF_SHARED,
if(ret) "goldfish_tty", pdev);
if (ret)
goto err_request_irq_failed; goto err_request_irq_failed;
ttydev = tty_port_register_device(&qtty->port, goldfish_tty_driver, ttydev = tty_port_register_device(&qtty->port, goldfish_tty_driver,
pdev->id, &pdev->dev); pdev->id, &pdev->dev);
if(IS_ERR(ttydev)) { if (IS_ERR(ttydev)) {
ret = PTR_ERR(ttydev); ret = PTR_ERR(ttydev);
goto err_tty_register_device_failed; goto err_tty_register_device_failed;
} }
...@@ -290,7 +298,7 @@ static int goldfish_tty_probe(struct platform_device *pdev) ...@@ -290,7 +298,7 @@ static int goldfish_tty_probe(struct platform_device *pdev)
free_irq(irq, pdev); free_irq(irq, pdev);
err_request_irq_failed: err_request_irq_failed:
goldfish_tty_current_line_count--; goldfish_tty_current_line_count--;
if(goldfish_tty_current_line_count == 0) if (goldfish_tty_current_line_count == 0)
goldfish_tty_delete_driver(); goldfish_tty_delete_driver();
err_create_driver_failed: err_create_driver_failed:
mutex_unlock(&goldfish_tty_lock); mutex_unlock(&goldfish_tty_lock);
...@@ -312,7 +320,7 @@ static int goldfish_tty_remove(struct platform_device *pdev) ...@@ -312,7 +320,7 @@ static int goldfish_tty_remove(struct platform_device *pdev)
qtty->base = 0; qtty->base = 0;
free_irq(qtty->irq, pdev); free_irq(qtty->irq, pdev);
goldfish_tty_current_line_count--; goldfish_tty_current_line_count--;
if(goldfish_tty_current_line_count == 0) if (goldfish_tty_current_line_count == 0)
goldfish_tty_delete_driver(); goldfish_tty_delete_driver();
mutex_unlock(&goldfish_tty_lock); mutex_unlock(&goldfish_tty_lock);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment