Changeset 984a9ba in mainline for uspace/lib/drv/generic/remote_pci.c


Ignore:
Timestamp:
2018-07-05T09:34:09Z (6 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63d46341
Parents:
76f566d
Message:

do not expose the call capability handler from the async framework

Keep the call capability handler encapsulated within the async framework
and do not expose it explicitly via its API. Use the pointer to
ipc_call_t as the sole object identifying an IPC call in the code that
uses the async framework.

This plugs a major leak in the abstraction and also simplifies both the
async framework (slightly) and all IPC servers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_pci.c

    r76f566d r984a9ba  
    124124}
    125125
    126 static void remote_config_space_read_8(ddf_fun_t *, void *, cap_call_handle_t, ipc_call_t *);
    127 static void remote_config_space_read_16(ddf_fun_t *, void *, cap_call_handle_t, ipc_call_t *);
    128 static void remote_config_space_read_32(ddf_fun_t *, void *, cap_call_handle_t, ipc_call_t *);
    129 
    130 static void remote_config_space_write_8(ddf_fun_t *, void *, cap_call_handle_t, ipc_call_t *);
    131 static void remote_config_space_write_16(ddf_fun_t *, void *, cap_call_handle_t, ipc_call_t *);
    132 static void remote_config_space_write_32(ddf_fun_t *, void *, cap_call_handle_t, ipc_call_t *);
     126static void remote_config_space_read_8(ddf_fun_t *, void *, ipc_call_t *);
     127static void remote_config_space_read_16(ddf_fun_t *, void *, ipc_call_t *);
     128static void remote_config_space_read_32(ddf_fun_t *, void *, ipc_call_t *);
     129
     130static void remote_config_space_write_8(ddf_fun_t *, void *, ipc_call_t *);
     131static void remote_config_space_write_16(ddf_fun_t *, void *, ipc_call_t *);
     132static void remote_config_space_write_32(ddf_fun_t *, void *, ipc_call_t *);
    133133
    134134/** Remote USB interface operations. */
     
    150150};
    151151
    152 void remote_config_space_read_8(ddf_fun_t *fun, void *iface, cap_call_handle_t chandle, ipc_call_t *call)
     152void remote_config_space_read_8(ddf_fun_t *fun, void *iface, ipc_call_t *call)
    153153{
    154154        assert(iface);
    155155        pci_dev_iface_t *pci_iface = (pci_dev_iface_t *)iface;
    156156        if (pci_iface->config_space_read_8 == NULL) {
    157                 async_answer_0(chandle, ENOTSUP);
     157                async_answer_0(call, ENOTSUP);
    158158                return;
    159159        }
     
    162162        errno_t ret = pci_iface->config_space_read_8(fun, address, &value);
    163163        if (ret != EOK) {
    164                 async_answer_0(chandle, ret);
    165         } else {
    166                 async_answer_1(chandle, EOK, value);
    167         }
    168 }
    169 
    170 void remote_config_space_read_16(ddf_fun_t *fun, void *iface, cap_call_handle_t chandle, ipc_call_t *call)
     164                async_answer_0(call, ret);
     165        } else {
     166                async_answer_1(call, EOK, value);
     167        }
     168}
     169
     170void remote_config_space_read_16(ddf_fun_t *fun, void *iface, ipc_call_t *call)
    171171{
    172172        assert(iface);
    173173        pci_dev_iface_t *pci_iface = (pci_dev_iface_t *)iface;
    174174        if (pci_iface->config_space_read_16 == NULL) {
    175                 async_answer_0(chandle, ENOTSUP);
     175                async_answer_0(call, ENOTSUP);
    176176                return;
    177177        }
     
    180180        errno_t ret = pci_iface->config_space_read_16(fun, address, &value);
    181181        if (ret != EOK) {
    182                 async_answer_0(chandle, ret);
    183         } else {
    184                 async_answer_1(chandle, EOK, value);
    185         }
    186 }
    187 void remote_config_space_read_32(ddf_fun_t *fun, void *iface, cap_call_handle_t chandle, ipc_call_t *call)
     182                async_answer_0(call, ret);
     183        } else {
     184                async_answer_1(call, EOK, value);
     185        }
     186}
     187void remote_config_space_read_32(ddf_fun_t *fun, void *iface, ipc_call_t *call)
    188188{
    189189        assert(iface);
    190190        pci_dev_iface_t *pci_iface = (pci_dev_iface_t *)iface;
    191191        if (pci_iface->config_space_read_32 == NULL) {
    192                 async_answer_0(chandle, ENOTSUP);
     192                async_answer_0(call, ENOTSUP);
    193193                return;
    194194        }
     
    197197        errno_t ret = pci_iface->config_space_read_32(fun, address, &value);
    198198        if (ret != EOK) {
    199                 async_answer_0(chandle, ret);
    200         } else {
    201                 async_answer_1(chandle, EOK, value);
    202         }
    203 }
    204 
    205 void remote_config_space_write_8(ddf_fun_t *fun, void *iface, cap_call_handle_t chandle, ipc_call_t *call)
     199                async_answer_0(call, ret);
     200        } else {
     201                async_answer_1(call, EOK, value);
     202        }
     203}
     204
     205void remote_config_space_write_8(ddf_fun_t *fun, void *iface, ipc_call_t *call)
    206206{
    207207        assert(iface);
    208208        pci_dev_iface_t *pci_iface = (pci_dev_iface_t *)iface;
    209209        if (pci_iface->config_space_write_8 == NULL) {
    210                 async_answer_0(chandle, ENOTSUP);
     210                async_answer_0(call, ENOTSUP);
    211211                return;
    212212        }
     
    215215        errno_t ret = pci_iface->config_space_write_8(fun, address, value);
    216216        if (ret != EOK) {
    217                 async_answer_0(chandle, ret);
    218         } else {
    219                 async_answer_0(chandle, EOK);
    220         }
    221 }
    222 
    223 void remote_config_space_write_16(ddf_fun_t *fun, void *iface, cap_call_handle_t chandle, ipc_call_t *call)
     217                async_answer_0(call, ret);
     218        } else {
     219                async_answer_0(call, EOK);
     220        }
     221}
     222
     223void remote_config_space_write_16(ddf_fun_t *fun, void *iface, ipc_call_t *call)
    224224{
    225225        assert(iface);
    226226        pci_dev_iface_t *pci_iface = (pci_dev_iface_t *)iface;
    227227        if (pci_iface->config_space_write_16 == NULL) {
    228                 async_answer_0(chandle, ENOTSUP);
     228                async_answer_0(call, ENOTSUP);
    229229                return;
    230230        }
     
    233233        errno_t ret = pci_iface->config_space_write_16(fun, address, value);
    234234        if (ret != EOK) {
    235                 async_answer_0(chandle, ret);
    236         } else {
    237                 async_answer_0(chandle, EOK);
    238         }
    239 }
    240 
    241 void remote_config_space_write_32(ddf_fun_t *fun, void *iface, cap_call_handle_t chandle, ipc_call_t *call)
     235                async_answer_0(call, ret);
     236        } else {
     237                async_answer_0(call, EOK);
     238        }
     239}
     240
     241void remote_config_space_write_32(ddf_fun_t *fun, void *iface, ipc_call_t *call)
    242242{
    243243        assert(iface);
    244244        pci_dev_iface_t *pci_iface = (pci_dev_iface_t *)iface;
    245245        if (pci_iface->config_space_write_32 == NULL) {
    246                 async_answer_0(chandle, ENOTSUP);
     246                async_answer_0(call, ENOTSUP);
    247247                return;
    248248        }
     
    251251        errno_t ret = pci_iface->config_space_write_32(fun, address, value);
    252252        if (ret != EOK) {
    253                 async_answer_0(chandle, ret);
    254         } else {
    255                 async_answer_0(chandle, EOK);
    256         }
    257 }
    258 
     253                async_answer_0(call, ret);
     254        } else {
     255                async_answer_0(call, EOK);
     256        }
     257}
    259258
    260259/**
    261260 * @}
    262261 */
    263 
Note: See TracChangeset for help on using the changeset viewer.