From: Florian Fainelli <florian@openwrt.org>
To: linux-kernel@vger.kernel.org
Cc: alan@lxorguk.ukuu.org.uk, gregkh@suse.de
Subject: Best way to do kernel only ldisc without user-space ldisc attaching?
Date: Tue, 13 Apr 2010 10:56:19 +0200 [thread overview]
Message-ID: <201004131056.19984.florian@openwrt.org> (raw)
Hello,
I have a line discpline driver for a custom protocol over an UART. This driver
implements the following callbacks: open/close, receive_buf/write_wakeup.
So far, I have an ugly hack, which opens the /dev/tty<N> in the kernel, and
directly uses the f_op and unlocked_ioctl functions to do the ldisc number to
TTY device binding:
[snip]
struct file *f;
filp_open("/dev/ttyS1", 0, 0);
f->f_op->unlocked_ioctl(f, TCFLSH, 0x2);
memset(&tio, 0, sizeof(tio));
tio.c_cflag = my_flags;
tio.c_iflag = IGNPAR | ICRNL;
f->f_op->unlocked_ioctl(f, TCSETS, (long unsigned int)&tio);
f->f_op->unlocked_ioctl(f, TIOCSETD, (long unsigned int)&ldisc_nr);
set_fs(oldfs);
[snip]
This prevents me from rmmoding the module. However, I would like to avoid an
user-space program from having to bind the TTY device to the ldisc number if
possible.
Thank you very much for your answer.
--
Florian
reply other threads:[~2010-04-13 8:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201004131056.19984.florian@openwrt.org \
--to=florian@openwrt.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox