lkml.org 
[lkml]   [2008]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 2/2] add device function for usb serial console
On Thu, 13 Nov 2008 09:53:37 +0800
Kevin Hao <kexin.hao@windriver.com> wrote:

> Add device funtion for usb serial console, so we can open /dev/console
> when we use a usb serial device as console.
>
> Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
> ---
> drivers/usb/serial/console.c | 13 +++++++++++++
> 1 files changed, 13 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
> index 5b95009..1dbb203 100644
> --- a/drivers/usb/serial/console.c
> +++ b/drivers/usb/serial/console.c
> @@ -241,12 +241,25 @@ static void usb_console_write(struct console *co,
> }
> }
>
> +static struct tty_driver *usb_console_device(struct console *co, int *index)
> +{
> + struct tty_driver **p = (struct tty_driver **)co->data;

co->data is already void*, hence this cast is unneeded. It is also
undesirable because it defeats typechecking.

> +
> + if (!*p)
> + return NULL;
> +
> + *index = co->index;
> + return (struct tty_driver *)(*p);

And *p already has type `struct tty_driver *'.

> +}
> +
> static struct console usbcons = {
> .name = "ttyUSB",
> .write = usb_console_write,
> + .device = usb_console_device,
> .setup = usb_console_setup,
> .flags = CON_PRINTBUFFER,
> .index = -1,
> + .data = &usb_serial_tty_driver,
> };
>


--- a/drivers/usb/serial/console.c~usb-serial-console-add-device-function-fix
+++ a/drivers/usb/serial/console.c
@@ -243,13 +243,13 @@ static void usb_console_write(struct con

static struct tty_driver *usb_console_device(struct console *co, int *index)
{
- struct tty_driver **p = (struct tty_driver **)co->data;
+ struct tty_driver **p = co->data;

if (!*p)
return NULL;

*index = co->index;
- return (struct tty_driver *)(*p);
+ return *p;
}

static struct console usbcons = {
_


\
 
 \ /
  Last update: 2008-11-14 23:39    [W:0.075 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site