[PATCH] drivers/tty: don't use the byte channel handle as a parameter in ehv_bytechan.c

Subsystems: epapr hypervisor byte channel device driver, the rest, tty layer and serial drivers

STALE5433d

5 messages, 3 authors, 2011-09-23 · open the first message on its own page

[PATCH] drivers/tty: don't use the byte channel handle as a parameter in ehv_bytechan.c

From: Timur Tabi <hidden>
Date: 2011-09-20 18:27:06

The ePAPR hypervisor byte channel console driver only supports one byte
channel as a console, and the byte channel handle is stored in a global
variable.  It doesn't make any sense to pass that handle as a parameter
to the console functions, since these functions already have access to the
global variable.

This change also fixes this compilation warning on a 64-bit kernel:

  CC      drivers/tty/ehv_bytechan.o
drivers/tty/ehv_bytechan.c: In function 'ehv_bc_console_write':
drivers/tty/ehv_bytechan.c:289:24: warning: cast from pointer to integer of different size
drivers/tty/ehv_bytechan.c: In function 'ehv_bc_console_init':
drivers/tty/ehv_bytechan.c:355:24: warning: cast to pointer from integer of different size

This warning is because the driver is converting the integer byte channel
handle to/from the void* 'data' field of struct console.  Rather than fix
the warning, we just eliminate the code altogether.

Signed-off-by: Timur Tabi <redacted>
---
 drivers/tty/ehv_bytechan.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c
index e67f70b..b24e6f7 100644
--- a/drivers/tty/ehv_bytechan.c
+++ b/drivers/tty/ehv_bytechan.c
@@ -286,7 +286,6 @@ static int ehv_bc_console_byte_channel_send(unsigned int handle, const char *s,
 static void ehv_bc_console_write(struct console *co, const char *s,
 				 unsigned int count)
 {
-	unsigned int handle = (unsigned int)co->data;
 	char s2[EV_BYTE_CHANNEL_MAX_BYTES];
 	unsigned int i, j = 0;
 	char c;
@@ -299,14 +298,14 @@ static void ehv_bc_console_write(struct console *co, const char *s,
 
 		s2[j++] = c;
 		if (j >= (EV_BYTE_CHANNEL_MAX_BYTES - 1)) {
-			if (ehv_bc_console_byte_channel_send(handle, s2, j))
+			if (ehv_bc_console_byte_channel_send(stdout_bc, s2, j))
 				return;
 			j = 0;
 		}
 	}
 
 	if (j)
-		ehv_bc_console_byte_channel_send(handle, s2, j);
+		ehv_bc_console_byte_channel_send(stdout_bc, s2, j);
 }
 
 /*
@@ -352,8 +351,6 @@ static int __init ehv_bc_console_init(void)
 			   CONFIG_PPC_EARLY_DEBUG_EHV_BC_HANDLE);
 #endif
 
-	ehv_bc_console.data = (void *)stdout_bc;
-
 	/* add_preferred_console() must be called before register_console(),
 	   otherwise it won't work.  However, we don't want to enumerate all the
 	   byte channels here, either, since we only care about one. */
-- 
1.7.3.4

Re: [PATCH] drivers/tty: don't use the byte channel handle as a parameter in ehv_bytechan.c

From: Greg KH <hidden>
Date: 2011-09-22 23:08:49

On Tue, Sep 20, 2011 at 01:26:57PM -0500, Timur Tabi wrote:
The ePAPR hypervisor byte channel console driver only supports one byte
channel as a console, and the byte channel handle is stored in a global
variable.  It doesn't make any sense to pass that handle as a parameter
to the console functions, since these functions already have access to the
global variable.

This change also fixes this compilation warning on a 64-bit kernel:

  CC      drivers/tty/ehv_bytechan.o
drivers/tty/ehv_bytechan.c: In function 'ehv_bc_console_write':
drivers/tty/ehv_bytechan.c:289:24: warning: cast from pointer to integer of different size
drivers/tty/ehv_bytechan.c: In function 'ehv_bc_console_init':
drivers/tty/ehv_bytechan.c:355:24: warning: cast to pointer from integer of different size

This warning is because the driver is converting the integer byte channel
handle to/from the void* 'data' field of struct console.  Rather than fix
the warning, we just eliminate the code altogether.

Signed-off-by: Timur Tabi <redacted>
---
 drivers/tty/ehv_bytechan.c |    7 ++-----
This patch doesn't apply at all to my tty tree, what was it made
against?

confused,

greg k-h

Re: [PATCH] drivers/tty: don't use the byte channel handle as a parameter in ehv_bytechan.c

From: Timur Tabi <hidden>
Date: 2011-09-22 23:16:06

Greg KH wrote:
This patch doesn't apply at all to my tty tree, what was it made
against?
An internal repository that supposed to be in-sync with the latest and greatest.

What's the URL for your tty-next repo?

-- 
Timur Tabi
Linux kernel developer at Freescale

Re: [PATCH] drivers/tty: don't use the byte channel handle as a parameter in ehv_bytechan.c

From: Greg KH <hidden>
Date: 2011-09-22 23:28:36

On Thu, Sep 22, 2011 at 06:15:53PM -0500, Timur Tabi wrote:
Greg KH wrote:
quoted
This patch doesn't apply at all to my tty tree, what was it made
against?
An internal repository that supposed to be in-sync with the latest and greatest.

What's the URL for your tty-next repo?
There is no public one due to kernel.org being down.

Does your patch apply to linux-next?

Re: [PATCH] drivers/tty: don't use the byte channel handle as a parameter in ehv_bytechan.c

From: Tabi Timur-B04825 <hidden>
Date: 2011-09-23 01:12:38

Greg KH wrote:
quoted
quoted
quoted
 >  This patch doesn't apply at all to my tty tree, what was it made
 >  against?
 An internal repository that supposed to be in-sync with the latest an=
d greatest.
quoted
quoted
 What's the URL for your tty-next repo?
There is no public one due to kernel.org being down.

Does your patch apply to linux-next?
It does not, and I see why now.  Looks like the internal tree is not in=20
sync after all.

I will post a V2 shortly.

--=20
Timur Tabi
Linux kernel developer at Freescale=
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help