lkml.org 
[lkml]   [2017]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 09/10] serdev: add serdev_device_set_rts
Hi Rob,

On Tue, Mar 07, 2017 at 10:07:56AM -0600, Rob Herring wrote:
> On Sat, Mar 4, 2017 at 5:58 AM, Sebastian Reichel <sre@kernel.org> wrote:
> > Add function to enable/disable RTS line.
> >
> > Signed-off-by: Sebastian Reichel <sre@kernel.org>
> > ---
>
> > +static void ttyport_set_rts(struct serdev_controller *ctrl, bool enable)
> > +{
> > + struct serport *serport = serdev_controller_get_drvdata(ctrl);
> > + struct tty_struct *tty = serport->tty;
> > + int status = tty->driver->ops->tiocmget(tty);
> > + unsigned int set = 0;
> > + unsigned int clear = 0;
> > +
> > + if (enable) {
> > + set |= (TIOCM_OUT2 | TIOCM_RTS);
> > + clear = ~set;
> > + set &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 |
> > + TIOCM_OUT2 | TIOCM_LOOP;
> > + clear &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 |
> > + TIOCM_OUT2 | TIOCM_LOOP;
> > + status = tty->driver->ops->tiocmset(tty, set, clear);
> > + } else {
> > + set &= ~(TIOCM_OUT2 | TIOCM_RTS);
> > + clear = ~set;
> > + set &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 |
> > + TIOCM_OUT2 | TIOCM_LOOP;
> > + clear &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 |
> > + TIOCM_OUT2 | TIOCM_LOOP;
> > + status = tty->driver->ops->tiocmset(tty, set, clear);
>
> The logic here can be greatly simplified. Here's a patch to the
> original version that I came up with, but haven't tested:

ah I totally forgot to clean that mess. I took that over from the
bluetooth code, since that got the nokia bluetooth chips working.
I will do this in the next revision.

-- Sebastian
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2017-03-07 22:19    [W:0.085 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site