[lkml]   [2005]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH 00/10] usb-serial: Switches from spin lock to atomic_t.

    Hi, Greg,

    On Wed, Dec 07, 2005 at 09:56:14AM -0800, Greg KH wrote:
    > On Wed, Dec 07, 2005 at 03:13:32PM -0200, Eduardo Pereira Habkost wrote:
    > > I have a small question: in my view, this patch series is a small
    > > step towards implementing the usb-serial drivers The Right Way, as it
    > > removes a a bit of duplicated code.
    > It doesn't remove any "duplicated code", it only changes a spinlock to
    > an atomic_t for one single value (which I personally do not think is the
    > best thing to do, and based on the number of comments on this thread, I
    > think others also feel this way.)

    Every usb-serial driver currently has:

    if (port->write_urb_busy)
    port->write_urb_busy = 1;

    Having the same 5 lines on many usb-serial drivers looks like duplicated
    code to me. Maybe I am being too exigent. Anyway, this is unrelated to
    the atomic_t change, and we could do it without dropping ths spinlock.

    But I would like to know: would you would accept such change (that
    encapsulate this write_urb_busy logic without necessarily dropping the

    And, about the atomic_t: I've felt most people didn't liked the atomic_t
    approach for one of two reasons:

    1. The existence of write_urb_busy looks like a hack, and we've
    make it explicit when we isolated the code that uses write_urb_busy
    in a set of functions (the point of Arjan in his "square wheel"
    2. The whole discussion about atomic_t vs. spinlock efficiency

    I agree with (1), but I still don't see why using a spinlock to protect
    a single field is better than using atomic_t. Both in code readability
    and efficiency. Specially as the difference between each one (even which
    one is more efficient) is very arch-specific.

    Thank you very much for your advice,

    [unhandled content-type:application/pgp-signature]
     \ /
      Last update: 2005-12-07 20:09    [W:0.020 / U:9.112 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site