Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1613036

Re: [PATCH v2] serdev: Replace serdev_device_write_buf with serdev_device_write

From Andrey Smirnov <andrew.smirnov@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] serdev: Replace serdev_device_write_buf with serdev_device_write
Date 2017-03-30 14:50 +0200
Message-ID <tqHGy-6sD-29@gated-at.bofh.it> (permalink)
References <tq1R0-1HW-13@gated-at.bofh.it> <tq2N5-2mE-27@gated-at.bofh.it> <tqmC5-83f-5@gated-at.bofh.it> <tqn58-8fs-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Mar 29, 2017 at 7:43 AM, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Wed, Mar 29, 2017 at 5:16 PM, Andrey Smirnov
> <andrew.smirnov@gmail.com> wrote:
>> On Tue, Mar 28, 2017 at 10:07 AM, Andy Shevchenko
>> <andy.shevchenko@gmail.com> wrote:
>>> On Tue, Mar 28, 2017 at 7:01 PM, Andrey Smirnov
>>> <andrew.smirnov@gmail.com> wrote:
>
>>> So, what I would see if no one objects is patch series of two:
>>> 1) introduction of new API
>>> 2) removing old one.
>>>
>>> It will benefit for easier review and any potential code anthropologist.
>>>
>>
>> Second version of the patch preserves the old API an just
>> re-implements it in terms of a new one. I am not sure I see the
>> benefit in splitting it into two patches, but I'll leave it up to Rob
>> to decide.
>
> Sure. At least I posted benefits I see from splitting.
>
> + bisectability (in case we have to revert your new API by some reason
> it will be easier, hope will be not the case, though...)
>
>>>> +       } while (count &&
>>>> +                (timeout = wait_for_completion_timeout(&serdev->write_comp,
>>>> +                                                       timeout)));
>>>
>>> So, would it be better to support interrupts here and return a
>>> corresponding error code to the user?
>>>
>>
>> I don't have a use-case for that and as far as I can tell, neither SPI
>> nor I2C slave device API offer such functionality universally, so I am
>> inclined to say no. Since the change from wait_for_completion to
>> wait_for_completion_timeout was made per Rob's request, I'd leave it
>> up to him to decided about this change as well.
>
> OK.
>
>>> Besides that question, readability might be better if you use
>>> temporary variable and pack above on one line:
>>>
>>> unsigned long to = timeout;
>>>
>>> } while (count && (to = ...(to)));
>>>
>>
>> Even if you shorten 'timeout' to 'to', formatted as a single line,
>> it'd still exceed line length limitations.
>
> How many? If we are talking about 2-3 characters, that's okay to leave
> them on one line.

Even so, at this point we are definitely in "personal preference"
territory and I'd rather avoid line wrapping.

>
>>>> + * @write_lock Mutext used to esure exclusive access to the bus when
>>>> + *             writing data with serdev_device_write()
>>>
>>> checkpatch.pl has integrated spellchecker AFAIU.
>>
>> My bad, forgot to enable it as a git hook, will fix.
>>
>>> Moreover, can you try harder to make that description shorter?
>>>
>>
>> I am all ears for suggestions alternative phrasing, otherwise, no,
>> that's about as hard as I try.
>
> First of all, "used to" is (closer) equivalent to was.
> Second, Mutex is one letter longer than Lock (here is important that
> is just a kind of lock).
> Third, "exclusive" is implied by Mutex / Lock word.
> Fourth, "access to the bus when writing data" too verbose.
>
> So, my suggestion is (two variants):
> a) "Lock to serialize bus access when writing data."
> b) "Lock to serialize access when writing data with serdev_device_write()."
>

I'll use option "a". Option "b" still exceeds line limit, and I'd
rather not have that.

Thanks,
Andrey Smirnov

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] serdev: Replace serdev_device_write_buf with serdev_device_write Andrey Smirnov <andrew.smirnov@gmail.com> - 2017-03-28 18:10 +0200
  Re: [PATCH v2] serdev: Replace serdev_device_write_buf with serdev_device_write Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-03-28 19:10 +0200
    Re: [PATCH v2] serdev: Replace serdev_device_write_buf with serdev_device_write Andrey Smirnov <andrew.smirnov@gmail.com> - 2017-03-29 16:20 +0200
      Re: [PATCH v2] serdev: Replace serdev_device_write_buf with serdev_device_write Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-03-29 16:50 +0200
        Re: [PATCH v2] serdev: Replace serdev_device_write_buf with serdev_device_write Andrey Smirnov <andrew.smirnov@gmail.com> - 2017-03-30 14:50 +0200
      Re: [PATCH v2] serdev: Replace serdev_device_write_buf with serdev_device_write Rob Herring <robh@kernel.org> - 2017-03-29 23:30 +0200
        Re: [PATCH v2] serdev: Replace serdev_device_write_buf with serdev_device_write Andrey Smirnov <andrew.smirnov@gmail.com> - 2017-03-30 14:50 +0200

csiph-web