Changeset c48f6ab in mainline for uspace/lib/usbdev/src/pipes.c


Ignore:
Timestamp:
2011-11-30T20:14:37Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1f5c9c96
Parents:
fb48a0e (diff), f9776ae5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

USB branch

Mostly cleanups.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbdev/src/pipes.c

    rfb48a0e rc48f6ab  
    5454static usb_address_t get_my_address(async_sess_t *sess, const ddf_dev_t *dev)
    5555{
     56        assert(sess);
    5657        async_exch_t *exch = async_exchange_begin(sess);
    57        
    58         sysarg_t address;
    59         int rc = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
    60             IPC_M_USB_GET_MY_ADDRESS, &address);
    61        
     58        if (!exch)
     59                return ENOMEM;
     60
     61        usb_address_t address;
     62        const int ret = usb_get_my_address(exch, &address);
     63
    6264        async_exchange_end(exch);
    63        
    64         if (rc != EOK)
    65                 return rc;
    66        
    67         return (usb_address_t) address;
     65
     66        return (ret == EOK) ? address : ret;
    6867}
    6968
     
    7170 *
    7271 * @param device Device in question.
    73  * @return Interface number (negative code means any).
     72 * @return Error code (ENOTSUP means any).
    7473 */
    7574int usb_device_get_assigned_interface(const ddf_dev_t *device)
     
    8079            IPC_FLAG_BLOCKING);
    8180        if (!parent_sess)
    82                 return -1;
    83        
     81                return ENOMEM;
     82
    8483        async_exch_t *exch = async_exchange_begin(parent_sess);
    85        
    86         sysarg_t iface_no;
    87         int rc = async_req_2_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
    88             IPC_M_USB_GET_INTERFACE, device->handle, &iface_no);
    89        
    90         async_exchange_end(exch);
    91         async_hangup(parent_sess);
    92        
    93         if (rc != EOK)
    94                 return -1;
    95        
    96         return (int) iface_no;
     84        if (!exch) {
     85                async_hangup(parent_sess);
     86                return ENOMEM;
     87        }
     88
     89        int iface_no;
     90        const int ret = usb_get_my_interface(exch, &iface_no);
     91
     92        return ret == EOK ? iface_no : ret;
    9793}
    9894
Note: See TracChangeset for help on using the changeset viewer.