linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Warning about not setting tty->port: what to set it to?
@ 2013-01-11 20:34 Grant Edwards
  2013-01-14 16:51 ` Grant Edwards
  0 siblings, 1 reply; 2+ messages in thread
From: Grant Edwards @ 2013-01-11 20:34 UTC (permalink / raw)
  To: linux-serial

I maintain a serial card driver which, starting with kernel 3.7,
produces this warning when a port is opened:

 tty_init_dev: ttyXYZ driver does not set tty->port. This will crash the kernel later. Fix the driver!

The driver still seems to work fine, but apparently I shouldn't expect
it to continue to do so.  

What am I supposed to set tty->port _to_ ?

Obviously, it's supposed to point to an instance of the type (struct tty_port).

Is there somewhere in particular I'm supposed to get that structure
instance from?

Am I supposed to allocate/clear one when the port is opened and free
it when the port is closed?  Or does the contents the structure
pointed to by tty->port need to be preserved?

Am I expected to do anything with the contents of that structure?

Or am I just providing some storage space for use by the tty layer
code?

-- 
Grant Edwards               grant.b.edwards        Yow! I'm young ... I'm
                                  at               HEALTHY ... I can HIKE
                              gmail.com            THRU CAPT GROGAN'S LUMBAR
                                                   REGIONS!


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Warning about not setting tty->port: what to set it to?
  2013-01-11 20:34 Warning about not setting tty->port: what to set it to? Grant Edwards
@ 2013-01-14 16:51 ` Grant Edwards
  0 siblings, 0 replies; 2+ messages in thread
From: Grant Edwards @ 2013-01-14 16:51 UTC (permalink / raw)
  To: linux-serial

On 2013-01-11, Grant Edwards <grant.b.edwards@gmail.com> wrote:

> I maintain a serial card driver which, starting with kernel 3.7,
> produces this warning when a port is opened:
>
>  tty_init_dev: ttyXYZ driver does not set tty->port. This will crash the kernel later. Fix the driver!

I've been looking at 3.7.2 in-kernel tty drivers to try to figure out
what to do about this, and I don't understand how the in-kernel
drivers are avoiding the same problem I'm seeing.

I've looked at three other tty drivers: amiserial.c, rocket.c,
cyclades.c:

Based on some examination/experimentation, it seems the check for
tty->port is done during driver "installation" and occurs _before_ a
tty driver's open() function is called().

But, amiserial.c doesn't set tty->port until the open() function is
called.  How does the amiserial driver avoid the warning and stack
trace?

AFAICT, the rocket.c and cyclades.c drivers don't set tty->port at
all.

What am I missing?

-- 
Grant Edwards               grant.b.edwards        Yow! When this load is
                                  at               DONE I think I'll wash it
                              gmail.com            AGAIN ...


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-14 16:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-11 20:34 Warning about not setting tty->port: what to set it to? Grant Edwards
2013-01-14 16:51 ` Grant Edwards

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).