1. 25 Nov, 2014 1 commit
    • Greg Kroah-Hartman's avatar
      greybus: uart-gb: clean up send_line_coding · 9f240f20
      Greg Kroah-Hartman authored
      We always pass the same option to send_line_coding() for the line_coding
      structure, which is already in the struct gb_tty variable, so just
      remove the second parameter as it's not needed.
      
      This logic came from the cdc-acm.c driver, where it's also not needed
      anymore, I'll go fix up that later on when I get a chance.
      Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
      9f240f20
  2. 24 Nov, 2014 8 commits
  3. 22 Nov, 2014 9 commits
    • Alex Elder's avatar
      greybus: rework synchronous operation completion · 10c69399
      Alex Elder authored
      The only time we need a completion signaled on a request is when the
      request provided no callback function.  In that case, we wait for
      a completion on behalf of the caller.
      
      If an interrupt occurs, we attempt to cancel the message that's
      been sent, but we don't actually complete the operation as required.
      
      Instead of simply waiting for the completion, put in place a
      special callback function for the synchronous operation.  The
      only job the callback has is to signal completion, allowing the
      waiter to know it's done.
      
      This means gb_operation_complete() will always have a non-null
      callback pointer, so it becomes a simple wrapper, and we can get rid
      of it and invoke the callback directly, in gb_operation_work().
      
      Be defensive by checking for a null callback pointer, and reset
      it to NULL once it's been called.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
      10c69399
    • Alex Elder's avatar
      greybus: kill gb_operation_wait() · 2cf72a23
      Alex Elder authored
      When a caller wants an operation to complete synchronously, there is
      generally no need for any other threads to wait for the operation's
      completion.  So here's no need for gb_operation_wait() to be
      available for synchronous requests.  At the moment, all operations
      are done synchronously.
      
      Knowing that, get rid of the public gb_operation_wait() function,
      and open-code it in gb_operation_request_send().  The public wait
      function can be re-implemented when it's really needed.
      
      With that function gone, the only waiter for the completion of an
      operation is the submitter itself, and only then if it's
      synchronous.  So rather than complete_all(), we can simply use
      complete() to signal the submitter.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
      2cf72a23
    • Alex Elder's avatar
      greybus: cancel whole operation on interrupt · 7035833f
      Alex Elder authored
      Cancel the operation--not just the request message--if waiting
      for a synchronous operation to complete is interrupted.  Return
      the operation result (which in that case will be -EINTR).  The
      cancelation will result in the normal operation completion path
      being taken before returning.
      
      Make gb_operation_wait() private, since it's only ever used for
      for synchronous operations.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
      7035833f
    • Alex Elder's avatar
      greybus: cancel operation on timeout · f68c05c0
      Alex Elder authored
      If an operation times out, we need to cancel whatever message it
      has in-flight.  Do that instead of completing the operation, in the
      timeout handler.  When the in-flight request message is canceled its
      completion function will lead to the proper completion of the
      operation.
      
      Change gb_operation_cancel() so it takes the errno that it's
      supposed to assign as the result of the operation.
      
      Note that we want to preserve the original -ETIMEDOUT error, so
      don't overwrite the operation result value if it has already been
      set.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
      f68c05c0
    • Alex Elder's avatar
      greybus: minor tweak in gb_connection_recv_response() · 0e3d0e8f
      Alex Elder authored
      Any time we queue work on the operation work queue we need to have
      set the operation errno first.
      
      This patch moves the assignment of that field to be immediately
      prior to the queue_work() call in gb_connection_recv_response(),
      so it is easier to see at a glance that this has been done.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
      0e3d0e8f
    • Alex Elder's avatar
      greybus: add a reference to pending operations · deb4b9ef
      Alex Elder authored
      Grab an extra reference to an operation before sending it.  Drop
      that reference at the end of its completion handling.
      
      It turns out gb_operation_get() got deleted along the way, so this
      re-introduces it.  We're assuming we only get a reference when
      there's at least one in existence so we don't need a semaphore to
      protect it.  Emphasize this by *not* returning a pointer to
      the referenced operation.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
      deb4b9ef
    • Alex Elder's avatar
      greybus: handle data send errors in workqueue · 583c3117
      Alex Elder authored
      The data sent callback can execute in atomic context.  If an error
      occurred, we shouldn't be completing the operation right then and
      there.  Instead, hand it off to the operation workqueue to complete
      the operation.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
      583c3117
    • Alex Elder's avatar
      greybus: abandon incoming requests for now · ee637a9b
      Alex Elder authored
      Change the operation "receive workqueue" to be just the operation
      "workqueue".  All it does is complete an operation in non-atomic
      context.  This is all that's required for an outgoing request.
      
      Similarly, ignore any notion that a response will only exist
      for outgoing requests in gb_operation_cancel().
      
      I'm doing this in the interest of getting the outgoing request path
      verified without the encumbrance of any preconceptions about how
      incoming requests need to work.  When I finally turn my full
      attenion to incoming requests I'll adapt the code as needed.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
      ee637a9b
    • Alex Elder's avatar
      greybus: use errno for operation result · 23383def
      Alex Elder authored
      An in-core operation structure tracks the progress of an operation.
      Currently it holds a result field that was intended to take the
      status value that arrives in an operation response message header.
      
      But operations can fail for reasons other than that, and it's
      inconvenient to try to represent those using the operation status
      codes.
      
      So change the operation->result field to be an int, and switch to
      storing negative errno values in it.  Rename it "errno" to make
      it obvious how to interpret the value.
      
      This patch makes another change, which simplifies the protocol drivers
      a lot.  It's being done as part of this patch because it affects all
      the same code as the above change does.  If desired I can split this
      into two separate patches.
      
      If a caller makes a synchronous gb_operation_request_send() request
      (i.e., no callback function is supplied), and the operation request
      and response messages were transferred successfully, have
      gb_operation_request_send() return the result of the request (i.e.,
      operation->errno).  This allows the caller (or more generally, any
      caller of gb_request_wait() to avoid having to look at this field
      for every successful send.
      
      Any caller that does an asynchronous request will of course need
      to look at request->errno in the callback function to see the
      result of the operation.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
      23383def
  4. 21 Nov, 2014 10 commits
  5. 20 Nov, 2014 12 commits