Changeset 27ed734c in mainline


Ignore:
Timestamp:
2011-10-31T13:06:57Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5e07cbc0
Parents:
d25e0a4
Message:

usb: Rename get_address ⇒ get_my_address and remove redundant handle parameter.

If you want to know what address the device uses ask the device not host controller.

Location:
uspace
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/ohci.c

    rd25e0a4 r27ed734c  
    7676}
    7777/*----------------------------------------------------------------------------*/
    78 /** Get address of the device identified by handle.
    79  *
    80  * @param[in] dev DDF instance of the device to use.
    81  * @param[in] iid (Unused).
    82  * @param[in] call Pointer to the call that represents interrupt.
    83  */
    84 static int usb_iface_get_address(
    85     ddf_fun_t *fun, devman_handle_t handle, usb_address_t *address)
     78/** Get USB address assigned to root hub.
     79 *
     80 * @param[in] fun Root hub function.
     81 * @param[out] address Store the address here.
     82 * @return Error code.
     83 */
     84static int rh_get_my_address(ddf_fun_t *fun, usb_address_t *address)
    8685{
    8786        assert(fun);
    88         assert(handle == 0);
    8987
    9088        if (address != NULL) {
     
    10199 * @return Error code.
    102100 */
    103 static int usb_iface_get_hc_handle(
     101static int rh_get_hc_handle(
    104102    ddf_fun_t *fun, devman_handle_t *handle)
    105103{
     
    115113/** Root hub USB interface */
    116114static usb_iface_t usb_iface = {
    117         .get_hc_handle = usb_iface_get_hc_handle,
    118         .get_address = usb_iface_get_address
     115        .get_hc_handle = rh_get_hc_handle,
     116        .get_my_address = rh_get_my_address,
    119117};
    120118/*----------------------------------------------------------------------------*/
  • uspace/drv/bus/usb/usbmid/usbmid.c

    rd25e0a4 r27ed734c  
    6363static usb_iface_t child_usb_iface = {
    6464        .get_hc_handle = usb_iface_get_hc_handle_device_impl,
    65         .get_address = usb_iface_get_address_forward_impl,
    66         .get_interface = usb_iface_get_interface_impl
     65        .get_my_address = usb_iface_get_my_address_forward_impl,
     66        .get_interface = usb_iface_get_interface_impl,
    6767};
    6868
  • uspace/drv/bus/usb/vhc/connhost.c

    rd25e0a4 r27ed734c  
    479479}
    480480
    481 static int tell_address(ddf_fun_t *fun, devman_handle_t handle,
    482     usb_address_t *address)
     481static int tell_address(ddf_fun_t *fun, usb_address_t *address)
    483482{
    484483        UNSUPPORTED("tell_address");
     
    497496}
    498497
    499 static int tell_address_rh(ddf_fun_t *root_hub_fun, devman_handle_t handle,
    500     usb_address_t *address)
     498static int tell_address_rh(ddf_fun_t *root_hub_fun, usb_address_t *address)
    501499{
    502500        VHC_DATA(vhc, root_hub_fun);
    503501
    504         if (handle == 0) {
    505                 handle = root_hub_fun->handle;
    506         }
     502        devman_handle_t handle = root_hub_fun->handle;
    507503
    508504        usb_log_debug("tell_address_rh(handle=%" PRIun ")\n", handle);
     
    532528usb_iface_t vhc_usb_iface = {
    533529        .get_hc_handle = usb_iface_get_hc_handle_hc_impl,
    534         .get_address = tell_address
     530        .get_my_address = tell_address
    535531};
    536532
    537533usb_iface_t rh_usb_iface = {
    538534        .get_hc_handle = usb_iface_get_hc_handle_rh_impl,
    539         .get_address = tell_address_rh
     535        .get_my_address = tell_address_rh
    540536};
    541537
  • uspace/lib/drv/generic/remote_usb.c

    rd25e0a4 r27ed734c  
    4040
    4141
    42 static void remote_usb_get_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     42static void remote_usb_get_my_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    4343static void remote_usb_get_interface(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    4444static void remote_usb_get_hc_handle(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     
    4747/** Remote USB interface operations. */
    4848static remote_iface_func_ptr_t remote_usb_iface_ops [] = {
    49         remote_usb_get_address,
    50         remote_usb_get_interface,
    51         remote_usb_get_hc_handle
     49        [IPC_M_USB_GET_MY_ADDRESS] = remote_usb_get_my_address,
     50        [IPC_M_USB_GET_INTERFACE] = remote_usb_get_interface,
     51        [IPC_M_USB_GET_HOST_CONTROLLER_HANDLE] = remote_usb_get_hc_handle,
    5252};
    5353
     
    6161
    6262
    63 void remote_usb_get_address(ddf_fun_t *fun, void *iface,
     63void remote_usb_get_my_address(ddf_fun_t *fun, void *iface,
    6464    ipc_callid_t callid, ipc_call_t *call)
    6565{
    6666        usb_iface_t *usb_iface = (usb_iface_t *) iface;
    6767
    68         if (usb_iface->get_address == NULL) {
     68        if (usb_iface->get_my_address == NULL) {
    6969                async_answer_0(callid, ENOTSUP);
    7070                return;
    7171        }
    7272
    73         devman_handle_t handle = DEV_IPC_GET_ARG1(*call);
    74 
    7573        usb_address_t address;
    76         int rc = usb_iface->get_address(fun, handle, &address);
     74        int rc = usb_iface->get_my_address(fun, &address);
    7775        if (rc != EOK) {
    7876                async_answer_0(callid, rc);
  • uspace/lib/drv/include/usb_iface.h

    rd25e0a4 r27ed734c  
    6565         * handle must be resolved by its parent.
    6666         */
    67         IPC_M_USB_GET_ADDRESS,
     67        IPC_M_USB_GET_MY_ADDRESS,
    6868
    6969        /** Tell interface number given device can use.
     
    9090/** USB device communication interface. */
    9191typedef struct {
    92         int (*get_address)(ddf_fun_t *, devman_handle_t, usb_address_t *);
     92        int (*get_my_address)(ddf_fun_t *, usb_address_t *);
    9393        int (*get_interface)(ddf_fun_t *, devman_handle_t, int *);
    9494        int (*get_hc_handle)(ddf_fun_t *, devman_handle_t *);
  • uspace/lib/usb/include/usb/ddfiface.h

    rd25e0a4 r27ed734c  
    4040
    4141int usb_iface_get_hc_handle_device_impl(ddf_fun_t *, devman_handle_t *);
    42 int usb_iface_get_address_forward_impl(ddf_fun_t *, devman_handle_t,
    43     usb_address_t *);
     42int usb_iface_get_my_address_forward_impl(ddf_fun_t *, usb_address_t *);
    4443extern usb_iface_t usb_iface_hub_impl;
    4544
    46 int usb_iface_get_address_from_device_data(ddf_fun_t *, devman_handle_t,
    47     usb_address_t *);
     45int usb_iface_get_my_address_from_device_data(ddf_fun_t *, usb_address_t *);
    4846extern usb_iface_t usb_iface_hub_child_impl;
    4947
    5048int usb_iface_get_hc_handle_hc_impl(ddf_fun_t *, devman_handle_t *);
    51 
    5249
    5350#endif
  • uspace/lib/usb/include/usb/hc.h

    rd25e0a4 r27ed734c  
    6262    devman_handle_t *);
    6363
    64 usb_address_t usb_hc_get_address_by_handle(devman_handle_t);
     64usb_address_t usb_get_address_by_handle(devman_handle_t);
    6565
    6666int usb_hc_find(devman_handle_t, devman_handle_t *);
  • uspace/lib/usb/src/ddfiface.c

    rd25e0a4 r27ed734c  
    4444
    4545/** DDF interface for USB device, implementation for typical hub. */
    46 usb_iface_t  usb_iface_hub_impl = {
     46usb_iface_t usb_iface_hub_impl = {
    4747        .get_hc_handle = usb_iface_get_hc_handle_device_impl,
    48         .get_address = usb_iface_get_address_forward_impl,
     48        .get_my_address = usb_iface_get_my_address_forward_impl,
    4949};
    5050
    5151/** DDF interface for USB device, implementation for child of a typical hub. */
    52 usb_iface_t  usb_iface_hub_child_impl = {
     52usb_iface_t usb_iface_hub_child_impl = {
    5353        .get_hc_handle = usb_iface_get_hc_handle_device_impl,
    54         .get_address = usb_iface_get_address_from_device_data,
     54        .get_my_address = usb_iface_get_my_address_from_device_data,
    5555};
    5656
     
    9292 * @return Error code.
    9393 */
    94 int usb_iface_get_address_forward_impl(ddf_fun_t *fun, devman_handle_t handle,
     94int usb_iface_get_my_address_forward_impl(ddf_fun_t *fun,
    9595    usb_address_t *address)
    9696{
    9797        assert(fun);
    98         assert(handle == 0);
    9998
    10099        async_sess_t *parent_sess =
     
    107106
    108107        sysarg_t addr;
    109         int rc = async_req_2_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
    110             IPC_M_USB_GET_ADDRESS, handle, &addr);
     108        int rc = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
     109            IPC_M_USB_GET_MY_ADDRESS, &addr);
    111110
    112111        async_exchange_end(exch);
     
    133132 * @return Error code.
    134133 */
    135 int usb_iface_get_address_from_device_data(ddf_fun_t *fun,
    136     devman_handle_t handle, usb_address_t *address)
     134int usb_iface_get_my_address_from_device_data(ddf_fun_t *fun,
     135    usb_address_t *address)
    137136{
    138137        assert(fun);
    139         assert(handle == 0);
    140138        assert(fun->driver_data);
    141139        usb_hub_attached_device_t *device = fun->driver_data;
  • uspace/lib/usb/src/hc.c

    rd25e0a4 r27ed734c  
    174174 * @return USB address or negative error code.
    175175 */
    176 usb_address_t usb_hc_get_address_by_handle(devman_handle_t dev_handle)
     176usb_address_t usb_get_address_by_handle(devman_handle_t dev_handle)
    177177{
    178178        async_sess_t *parent_sess =
     
    185185       
    186186        sysarg_t address;
    187         int rc = async_req_2_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
    188             IPC_M_USB_GET_ADDRESS,
    189             dev_handle, &address);
     187        int rc = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
     188            IPC_M_USB_GET_MY_ADDRESS, &address);
    190189       
    191190        async_exchange_end(exch);
  • uspace/lib/usb/src/resolve.c

    rd25e0a4 r27ed734c  
    200200                /* Try to get its address. */
    201201                if (!found_addr) {
    202                         dev_addr = usb_hc_get_address_by_handle(tmp_handle);
     202                        dev_addr = usb_get_address_by_handle(tmp_handle);
    203203                        if (dev_addr >= 0) {
    204204                                found_addr = true;
  • uspace/lib/usbdev/src/pipes.c

    rd25e0a4 r27ed734c  
    5656        async_exch_t *exch = async_exchange_begin(sess);
    5757       
    58         /*
    59          * We are sending special value as a handle - zero - to get
    60          * handle of the parent function (that handle was used
    61          * when registering our device @p dev.
    62          */
    6358        sysarg_t address;
    64         int rc = async_req_2_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
    65             IPC_M_USB_GET_ADDRESS, 0, &address);
     59        int rc = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
     60            IPC_M_USB_GET_MY_ADDRESS, &address);
    6661       
    6762        async_exchange_end(exch);
Note: See TracChangeset for help on using the changeset viewer.