Changeset 2c2cbcf in mainline for uspace/lib/usb/src


Ignore:
Timestamp:
2011-04-17T10:46:16Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5ab4a48
Parents:
a91fbb1
Message:

usb_pipe_start_long_transfer returns void (#196)

Location:
uspace/lib/usb/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/src/devdrv.c

    ra91fbb1 r2c2cbcf  
    236236
    237237        /* It is worth to start a long transfer. */
    238         rc = usb_pipe_start_long_transfer(ctrl_pipe);
    239         if (rc != EOK) {
    240                 return rc;
    241         }
     238        usb_pipe_start_long_transfer(ctrl_pipe);
    242239
    243240        /* Get the device descriptor. */
  • uspace/lib/usb/src/pipepriv.c

    ra91fbb1 r2c2cbcf  
    7777 *
    7878 * @param pipe The USB pipe.
     79 * @param hide_failure Whether to hide failure when adding reference
     80 *      (use soft refcount).
    7981 * @return Error code.
    8082 * @retval EOK Currently always.
    8183 */
    82 int pipe_add_ref(usb_pipe_t *pipe)
     84int pipe_add_ref(usb_pipe_t *pipe, bool hide_failure)
    8385{
    84 another_try:
    8586        pipe_acquire(pipe);
    8687
     
    8990                int phone = devman_device_connect(pipe->wire->hc_handle, 0);
    9091                if (phone < 0) {
    91                         // TODO: treat some error as non-recoverable
    92                         // and return error from here
     92                        if (hide_failure) {
     93                                pipe->refcount_soft++;
     94                                phone = EOK;
     95                        }
    9396                        pipe_release(pipe);
    94                         goto another_try;
     97                        return phone;
    9598                }
    9699                /*
     
    114117{
    115118        pipe_acquire(pipe);
     119        if (pipe->refcount_soft > 0) {
     120                pipe->refcount_soft--;
     121                pipe_release(pipe);
     122                return;
     123        }
    116124        assert(pipe->refcount > 0);
    117125        pipe->refcount--;
  • uspace/lib/usb/src/pipepriv.h

    ra91fbb1 r2c2cbcf  
    3737
    3838#include <usb/pipes.h>
     39#include <bool.h>
    3940
    4041void pipe_acquire(usb_pipe_t *);
     
    4445void pipe_end_transaction(usb_pipe_t *);
    4546
    46 int pipe_add_ref(usb_pipe_t *);
     47int pipe_add_ref(usb_pipe_t *, bool);
    4748void pipe_drop_ref(usb_pipe_t *);
    4849
  • uspace/lib/usb/src/pipes.c

    ra91fbb1 r2c2cbcf  
    297297 * @return Error code.
    298298 */
    299 int usb_pipe_start_long_transfer(usb_pipe_t *pipe)
    300 {
    301         return pipe_add_ref(pipe);
     299void usb_pipe_start_long_transfer(usb_pipe_t *pipe)
     300{
     301        (void) pipe_add_ref(pipe, true);
    302302}
    303303
  • uspace/lib/usb/src/pipesinit.c

    ra91fbb1 r2c2cbcf  
    365365        pipe->direction = direction;
    366366        pipe->refcount = 0;
     367        pipe->refcount_soft = 0;
    367368        pipe->auto_reset_halt = false;
    368369
     
    419420        int rc;
    420421
    421         rc = usb_pipe_start_long_transfer(pipe);
    422         if (rc != EOK) {
    423                 return rc;
    424         }
    425 
     422        usb_pipe_start_long_transfer(pipe);
    426423
    427424        uint8_t dev_descr_start[CTRL_PIPE_MIN_PACKET_SIZE];
  • uspace/lib/usb/src/pipesio.c

    ra91fbb1 r2c2cbcf  
    173173
    174174        int rc;
    175         rc = pipe_add_ref(pipe);
     175        rc = pipe_add_ref(pipe, false);
    176176        if (rc != EOK) {
    177177                return rc;
     
    296296        int rc;
    297297
    298         rc = pipe_add_ref(pipe);
     298        rc = pipe_add_ref(pipe, false);
    299299        if (rc != EOK) {
    300300                return rc;
     
    447447        int rc;
    448448
    449         rc = pipe_add_ref(pipe);
     449        rc = pipe_add_ref(pipe, false);
    450450        if (rc != EOK) {
    451451                return rc;
     
    579579        int rc;
    580580
    581         rc = pipe_add_ref(pipe);
     581        rc = pipe_add_ref(pipe, false);
    582582        if (rc != EOK) {
    583583                return rc;
Note: See TracChangeset for help on using the changeset viewer.