From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: sander@van-ginkel.eu
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ptmx: adding handshake support
Date: Sun, 13 Apr 2008 23:35:03 +0100 [thread overview]
Message-ID: <20080413233503.22576c47@core> (raw)
In-Reply-To: <480229CB.2080108@van-ginkel.eu>
> + * Added support for MCR/MSR, used for serial over ethernet
> + * -- Sander van Ginkel <sander@van-ginkel.eu>
We've been trying to get rid of these long lists in the code and put them
in the git tree (git whatchanged/git blame show the info rather better)
> +
> + /* initialize the pointer in case something fails */
> +
> + tty->driver_data = NULL;
> + tty->link->driver_data = NULL;
Not needed
+ /* first time accessing this device, let's create it */
> +
> + mcrmsr = kmalloc(sizeof(*mcrmsr), GFP_KERNEL);
kzalloc will clear it for you...
> +static int pty_tiocmset(struct tty_struct *tty, struct file
> *file,unsigned int set, unsigned int clear)
> +{
> + unsigned int *mcrmsr;
> +
> + mcrmsr = tty->driver_data;
> + *mcrmsr=set;
> + tty->driver_data=mcrmsr;
Why this last assignment ?
> +
> + case VMCRMSR: /* Set all of the handshake line, even the normally
> read only */
> + {
> + if (copy_from_user(&value,(unsigned int *)arg,sizeof(unsigned
> int)))
> + return -EFAULT;
> +
> + *mcrmsr=value;
Ok - possibly we shouldn't allow people to set undefined bits but I'm not
sure it matters
> + tty->driver_data=mcrmsr;
Why ??
I am curious how this is handled by other Unix systems and if there is an
ioctl we can follow from other systems ?
Looks basically ok, coding style is wrong, some odd extra assignments but
I agree entirely with the idea of adding this functionality to keep
remote serial drivers in user space.
I'll try and find out if other Unixes have similar features we can use to
keep API consistency tidy it up and fold it at some point in the next
couple of weeks.
Alan
next prev parent reply other threads:[~2008-04-13 22:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-11 20:28 [PATCH] ptmx: adding handshake support sander van ginkel
2008-03-30 12:09 ` postmaster
2008-03-30 12:16 ` Alan Cox
2008-03-30 12:48 ` sander van ginkel
2008-04-13 15:42 ` sander van ginkel
2008-04-13 22:35 ` Alan Cox [this message]
2008-04-14 20:39 ` sander van ginkel
2008-04-14 20:02 ` Randy Dunlap
2008-04-29 18:01 ` Alan Cox
-- strict thread matches above, loose matches on Subject: below --
2008-03-11 21:19 sander van ginkel
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=20080413233503.22576c47@core \
--to=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=sander@van-ginkel.eu \
/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