[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170307211838.f267lj4nhs5j644i@earth>
Date: Tue, 7 Mar 2017 22:18:38 +0100
From: Sebastian Reichel <sre@...nel.org>
To: Rob Herring <robh+dt@...nel.org>
Cc: Marcel Holtmann <marcel@...tmann.org>,
Gustavo Padovan <gustavo@...ovan.org>,
Johan Hedberg <johan.hedberg@...il.com>,
Tony Lindgren <tony@...mide.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>,
Mark Rutland <mark.rutland@....com>,
"open list:BLUETOOTH DRIVERS" <linux-bluetooth@...r.kernel.org>,
"linux-serial@...r.kernel.org" <linux-serial@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [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@...nel.org> wrote:
> > Add function to enable/disable RTS line.
> >
> > Signed-off-by: Sebastian Reichel <sre@...nel.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
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists