Bug 5012 - moxa tty driver name is wrong and conflicts with legacy ptys
Summary: moxa tty driver name is wrong and conflicts with legacy ptys
Status: CLOSED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Serial (show other bugs)
Hardware: i386 Linux
: P2 high
Assignee: Russell King
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-06 11:46 UTC by Sergey Vlasov
Modified: 2005-09-03 08:27 UTC (History)
2 users (show)

See Also:
Kernel Version: 2.6.12
Subsystem:
Regression: ---
Bisected commit-id:


Attachments
linux-2.6.12-alt-moxa-name-fix.patch (782 bytes, patch)
2005-08-06 12:02 UTC, Sergey Vlasov
Details | Diff

Description Sergey Vlasov 2005-08-06 11:46:22 UTC
drivers/char/moxa.c contains:

        moxaDriver->name = "ttya";

However, Documentation/devices.txt shows a different name for this driver:

172 char	Moxa Intellio serial card
		  0 = /dev/ttyMX0	First Moxa port
		  1 = /dev/ttyMX1	Second Moxa port
		    ...
		127 = /dev/ttyMX127	128th Moxa port

(there is also /dev/moxactl, but it is a separate issue)

An even worse problem is that the "ttya" name conflicts with the legacy pty
driver - pty slaves with numbers 176...185 have names "ttya0"..."ttya9". 
Therefore, if CONFIG_LEGACY_PTYS is enabled in the kernel configuration (it is
enabled in i386 defconfig), and CONFIG_LEGACY_PTY_COUNT is sufficiently large
(i386 defconfig has 256), names of the first 10 ports of moxa driver clash with
legacy pty slaves; 2.6.12 seems to be silent about this and just ignores
duplicate registrations.  So these 10 ports do not appear in sysfs properly and
cannot be used normally in an udev-based system.

I suggest changing the driver name to "ttyMX" to fix this problem; this will
also make udev create correct device names for these devices with the default
configuration.
Comment 1 Sergey Vlasov 2005-08-06 12:02:52 UTC
Created attachment 5528 [details]
linux-2.6.12-alt-moxa-name-fix.patch
Comment 2 Andrew Morton 2005-08-06 13:15:22 UTC
What you suggest sounds sensible, but I worry about
back-compatibility.  Perhaps Greg&Alan could comment?
Comment 3 Greg Kroah-Hartman 2005-08-06 13:22:03 UTC
If you are using udev, there is no backwards compatibility issues.  It and sysfs
are the only things that use the name field (devfs has a different field.)

So I don't see any problems with this patch.
Comment 4 Russell King 2005-08-10 10:18:14 UTC
Please note that moxa does not fall within my area, and therefore I'm going to
ignore this bug.  My policy is to reject bugs assigned to me which are not
relevant things I look after when they have no activity for at least one month.

Therefore, if someone else is working on this bug, please ensure that it is
assigned to them, thanks.
Comment 5 Russell King 2005-08-28 10:09:43 UTC
Ok, not quite a month, but no activity from anyone... Sorry.
Comment 6 Alan 2005-08-28 13:36:39 UTC
Sorry forgot to update this earlier.

Having dug into this I believe the patch is correct and should be applied. It
never used to matter until the 2.6 and udev world. Now its important the data is
fixed.

Distribution practice appears not to include shipping ttys for this card by
default and older systems would use makedev rules for it.

I believe therefore Russell it should be applied. Sorry for the delay

PS: I sent Andrew all the tty buffer changes, but no reply. Will chase him soon
see if osdl.org's buggy 'spam filter' ate them.
Comment 7 Russell King 2005-09-03 08:27:04 UTC
Applied, thanks.

Note You need to log in before you can comment on or make changes to this bug.