Re: [PATCH 09/10] serdev: add serdev_device_set_rts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxx> wrote:
> > Add function to enable/disable RTS line.
> >
> > Signed-off-by: Sebastian Reichel <sre@xxxxxxxxxx>
> > ---
> 
> > +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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux