From: Rob Herring <robh@kernel.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>,
Chris Healy <cphealy@gmail.com>,
Guenter Roeck <linux@roeck-us.net>,
"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] serdev: Add serdev_device_write subroutine
Date: Fri, 31 Mar 2017 11:38:22 -0500 [thread overview]
Message-ID: <CAL_JsqLE-+P5W3YmzDR-s++qCMijaspGFpzQYuz=2=_2ny6ubw@mail.gmail.com> (raw)
In-Reply-To: <CAHp75VdPg3K2+TYN7UTKi3aiq5NVn4gRnM+SwpE9uYwO89G_bQ@mail.gmail.com>
On Fri, Mar 31, 2017 at 9:35 AM, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Fri, Mar 31, 2017 at 4:22 PM, Rob Herring <robh@kernel.org> wrote:
>> On Thu, Mar 30, 2017 at 5:00 PM, Andrey Smirnov
>> <andrew.smirnov@gmail.com> wrote:
>
>>> +int serdev_device_write(struct serdev_device *serdev,
>>> + const unsigned char *buf, size_t count,
>>> + unsigned long timeout)
>>> {
>>> struct serdev_controller *ctrl = serdev->ctrl;
>>> + int ret;
>>>
>>> + if (!ctrl || !ctrl->ops->write_buf ||
>>> + (timeout && !serdev->ops->write_wakeup))
>>> return -EINVAL;
>>>
>>> + mutex_lock(&serdev->write_lock);
>>> + do {
>>> + reinit_completion(&serdev->write_comp);
>>> +
>>> + ret = ctrl->ops->write_buf(ctrl, buf, count);
>>> + if (ret < 0)
>>> + break;
>>> +
>>> + buf += ret;
>>> + count -= ret;
>>> +
>>> + } while (count &&
>>> + (timeout = wait_for_completion_timeout(&serdev->write_comp,
>>> + timeout)));
>>
>> Need to test for timeout < 0 here and return timeout when < 0.
>
> It can't be the case since the variable is of unsigned type.
Oh right, that's only the interruptible version. NM
Reviewed-by: Rob Herring <robh@kernel.org>
Rob
prev parent reply other threads:[~2017-03-31 16:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-30 22:00 [PATCH v3] serdev: Add serdev_device_write subroutine Andrey Smirnov
2017-03-31 11:43 ` Andy Shevchenko
2017-03-31 13:22 ` Rob Herring
2017-03-31 14:35 ` Andy Shevchenko
2017-03-31 16:38 ` Rob Herring [this message]
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='CAL_JsqLE-+P5W3YmzDR-s++qCMijaspGFpzQYuz=2=_2ny6ubw@mail.gmail.com' \
--to=robh@kernel.org \
--cc=andrew.smirnov@gmail.com \
--cc=andy.shevchenko@gmail.com \
--cc=cphealy@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@roeck-us.net \
/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;
as well as URLs for NNTP newsgroup(s).