Re: [PATCH 07/10] serdev: add serdev_device_wait_until_sent

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

 



On Tue, Mar 7, 2017 at 9:55 AM, Sebastian Reichel <sre@xxxxxxxxxx> wrote:
> Hi,
>
> On Tue, Mar 07, 2017 at 09:34:49AM -0600, Rob Herring wrote:
>> On Sat, Mar 4, 2017 at 5:58 AM, Sebastian Reichel <sre@xxxxxxxxxx> wrote:
>> > Add method, which waits until the transmission buffer has been sent.
>> >
>> > Signed-off-by: Sebastian Reichel <sre@xxxxxxxxxx>
>> > ---
>> >  drivers/tty/serdev/core.c           | 11 +++++++++++
>> >  drivers/tty/serdev/serdev-ttyport.c | 15 ++++++++++++++-
>> >  include/linux/serdev.h              |  3 +++
>> >  3 files changed, 28 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
>> > index f4c6c90add78..a63b74031e22 100644
>> > --- a/drivers/tty/serdev/core.c
>> > +++ b/drivers/tty/serdev/core.c
>> > @@ -173,6 +173,17 @@ void serdev_device_set_flow_control(struct serdev_device *serdev, bool enable)
>> >  }
>> >  EXPORT_SYMBOL_GPL(serdev_device_set_flow_control);
>> >
>> > +void serdev_device_wait_until_sent(struct serdev_device *serdev, long timeout)
>> > +{
>> > +       struct serdev_controller *ctrl = serdev->ctrl;
>> > +
>> > +       if (!ctrl || !ctrl->ops->wait_until_sent)
>> > +               return;
>> > +
>> > +       ctrl->ops->wait_until_sent(ctrl, timeout);
>> > +}
>> > +EXPORT_SYMBOL_GPL(serdev_device_wait_until_sent);
>> > +
>> >  static int serdev_drv_probe(struct device *dev)
>> >  {
>> >         const struct serdev_device_driver *sdrv = to_serdev_device_driver(dev->driver);
>> > diff --git a/drivers/tty/serdev/serdev-ttyport.c b/drivers/tty/serdev/serdev-ttyport.c
>> > index d05393594f15..db2bc601e554 100644
>> > --- a/drivers/tty/serdev/serdev-ttyport.c
>> > +++ b/drivers/tty/serdev/serdev-ttyport.c
>> > @@ -14,6 +14,7 @@
>> >  #include <linux/serdev.h>
>> >  #include <linux/tty.h>
>> >  #include <linux/tty_driver.h>
>> > +#include <linux/poll.h>
>> >
>> >  #define SERPORT_ACTIVE         1
>> >
>> > @@ -47,10 +48,13 @@ static void ttyport_write_wakeup(struct tty_port *port)
>> >         struct serport *serport = serdev_controller_get_drvdata(ctrl);
>> >
>> >         if (!test_and_clear_bit(TTY_DO_WRITE_WAKEUP, &port->tty->flags))
>> > -               return;
>> > +               goto out;
>> >
>> >         if (test_bit(SERPORT_ACTIVE, &serport->flags))
>> >                 serdev_controller_write_wakeup(ctrl);
>> > +
>> > +out:
>> > +       wake_up_interruptible_poll(&port->tty->write_wait, POLLOUT);
>>
>> Shouldn't this be separate patch?
>
> That change is needed for tty_wait_until_sent to work correctly, which
> starts with a wait_event_interruptible_timeout() on write_wait.

Okay.

Acked-by: Rob Herring <robh@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux