Changeset b7fd2a0 in mainline for uspace/drv/platform


Ignore:
Timestamp:
2018-01-13T03:10:29Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a53ed3a
Parents:
36f0738
Message:

Use errno_t in all uspace and kernel code.

Change type of every variable, parameter and return value that holds an
<errno.h> constant to either errno_t (the usual case), or sys_errno_t
(some places in kernel). This is for the purpose of self-documentation,
as well as for type-checking with a bit of type definition hackery.

Although this is a massive commit, it is a simple text replacement, and thus
is very easy to verify. Simply do the following:

`
git checkout <this commit's hash>
git reset HEAD
git add .
tools/srepl '\berrno_t\b' int
git add .
tools/srepl '\bsys_errno_t\b' sysarg_t
git reset
git diff
`

While this doesn't ensure that the replacements are correct, it does ensure
that the commit doesn't do anything except those replacements. Since errno_t
is typedef'd to int in the usual case (and sys_errno_t to sysarg_t), even if
incorrect, this commit cannot change behavior.

Location:
uspace/drv/platform
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/platform/amdm37x/amdm37x.c

    r36f0738 rb7fd2a0  
    5353
    5454
    55 int amdm37x_init(amdm37x_t *device, bool trace)
     55errno_t amdm37x_init(amdm37x_t *device, bool trace)
    5656{
    5757        assert(device);
    58         int ret = EOK;
     58        errno_t ret = EOK;
    5959
    6060        ret = pio_enable((void*)USBHOST_CM_BASE_ADDRESS, USBHOST_CM_SIZE,
     
    358358 * Select mode than can operate in FS/LS.
    359359 */
    360 int amdm37x_usb_tll_init(amdm37x_t *device)
     360errno_t amdm37x_usb_tll_init(amdm37x_t *device)
    361361{
    362362        /* Check access */
  • uspace/drv/platform/amdm37x/amdm37x.h

    r36f0738 rb7fd2a0  
    6666} amdm37x_t;
    6767
    68 int amdm37x_init(amdm37x_t *device, bool trace_io);
    69 int amdm37x_usb_tll_init(amdm37x_t *device);
     68errno_t amdm37x_init(amdm37x_t *device, bool trace_io);
     69errno_t amdm37x_usb_tll_init(amdm37x_t *device);
    7070void amdm37x_setup_dpll_on_autoidle(amdm37x_t *device);
    7171void amdm37x_usb_clocks_set(amdm37x_t *device, bool enabled);
  • uspace/drv/platform/amdm37x/main.c

    r36f0738 rb7fd2a0  
    150150
    151151static hw_resource_list_t *amdm37x_get_resources(ddf_fun_t *fnode);
    152 static int amdm37x_enable_interrupt(ddf_fun_t *fun, int);
     152static errno_t amdm37x_enable_interrupt(ddf_fun_t *fun, int);
    153153
    154154static hw_res_ops_t fun_hw_res_ops = {
     
    161161};
    162162
    163 static int amdm37x_add_fun(ddf_dev_t *dev, const amdm37x_fun_t *fun)
     163static errno_t amdm37x_add_fun(ddf_dev_t *dev, const amdm37x_fun_t *fun)
    164164{
    165165        assert(dev);
     
    174174       
    175175        /* Add match id */
    176         int ret = ddf_fun_add_match_id(fnode,
     176        errno_t ret = ddf_fun_add_match_id(fnode,
    177177            fun->match_id.id, fun->match_id.score);
    178178        if (ret != EOK) {
     
    212212 *
    213213 */
    214 static int amdm37x_dev_add(ddf_dev_t *dev)
     214static errno_t amdm37x_dev_add(ddf_dev_t *dev)
    215215{
    216216        assert(dev);
     
    218218        if (!device)
    219219                return ENOMEM;
    220         int ret = amdm37x_init(device, DEBUG_CM);
     220        errno_t ret = amdm37x_init(device, DEBUG_CM);
    221221        if (ret != EOK) {
    222222                ddf_msg(LVL_FATAL, "Failed to setup hw access!.\n");
     
    265265}
    266266
    267 static int amdm37x_enable_interrupt(ddf_fun_t *fun, int irq)
     267static errno_t amdm37x_enable_interrupt(ddf_fun_t *fun, int irq)
    268268{
    269269        //TODO: Implement
  • uspace/drv/platform/icp/icp.c

    r36f0738 rb7fd2a0  
    6262} icp_fun_t;
    6363
    64 static int icp_dev_add(ddf_dev_t *dev);
     64static errno_t icp_dev_add(ddf_dev_t *dev);
    6565
    6666static driver_ops_t icp_ops = {
     
    178178}
    179179
    180 static int icp_fun_enable_interrupt(ddf_fun_t *fnode, int irq)
     180static errno_t icp_fun_enable_interrupt(ddf_fun_t *fnode, int irq)
    181181{
    182182        icp_fun_t *fun = icp_fun(fnode);
     
    188188}
    189189
    190 static int icp_fun_disable_interrupt(ddf_fun_t *fnode, int irq)
     190static errno_t icp_fun_disable_interrupt(ddf_fun_t *fnode, int irq)
    191191{
    192192        icp_fun_t *fun = icp_fun(fnode);
     
    198198}
    199199
    200 static int icp_fun_clear_interrupt(ddf_fun_t *fnode, int irq)
     200static errno_t icp_fun_clear_interrupt(ddf_fun_t *fnode, int irq)
    201201{
    202202        icp_fun_t *fun = icp_fun(fnode);
     
    231231};
    232232
    233 static int icp_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id,
     233static errno_t icp_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id,
    234234    icp_fun_t *fun_proto)
    235235{
     
    237237
    238238        ddf_fun_t *fnode = NULL;
    239         int rc;
     239        errno_t rc;
    240240
    241241        /* Create new device. */
     
    275275}
    276276
    277 static int icp_add_functions(ddf_dev_t *dev)
    278 {
    279         int rc;
     277static errno_t icp_add_functions(ddf_dev_t *dev)
     278{
     279        errno_t rc;
    280280
    281281        rc = icp_add_fun(dev, "intctl", "integratorcp/intctl",
     
    296296
    297297/** Add device. */
    298 static int icp_dev_add(ddf_dev_t *dev)
     298static errno_t icp_dev_add(ddf_dev_t *dev)
    299299{
    300300        ddf_msg(LVL_NOTE, "icp_dev_add, device handle = %d",
     
    311311int main(int argc, char *argv[])
    312312{
    313         int rc;
     313        errno_t rc;
    314314
    315315        printf(NAME ": HelenOS IntegratorCP platform driver\n");
  • uspace/drv/platform/mac/mac.c

    r36f0738 rb7fd2a0  
    132132       
    133133        ddf_fun_t *fnode = NULL;
    134         int rc;
     134        errno_t rc;
    135135       
    136136        /* Create new device. */
     
    176176 *
    177177 */
    178 static int mac_dev_add(ddf_dev_t *dev)
    179 {
    180         int rc;
     178static errno_t mac_dev_add(ddf_dev_t *dev)
     179{
     180        errno_t rc;
    181181        uintptr_t cuda_physical;
    182182        sysarg_t cuda_inr;
     
    227227}
    228228
    229 static int mac_enable_interrupt(ddf_fun_t *fun, int irq)
     229static errno_t mac_enable_interrupt(ddf_fun_t *fun, int irq)
    230230{
    231231        /* TODO */
  • uspace/drv/platform/malta/malta.c

    r36f0738 rb7fd2a0  
    7777} malta_fun_t;
    7878
    79 static int malta_dev_add(ddf_dev_t *dev);
     79static errno_t malta_dev_add(ddf_dev_t *dev);
    8080static void malta_init(void);
    8181
     
    143143}
    144144
    145 static int malta_enable_interrupt(ddf_fun_t *fun, int irq)
     145static errno_t malta_enable_interrupt(ddf_fun_t *fun, int irq)
    146146{
    147147        /* TODO */
     
    177177       
    178178        ddf_fun_t *fnode = NULL;
    179         int rc;
     179        errno_t rc;
    180180       
    181181        /* Create new device. */
     
    223223 * @return              Zero on success, error number otherwise.
    224224 */
    225 static int malta_dev_add(ddf_dev_t *dev)
     225static errno_t malta_dev_add(ddf_dev_t *dev)
    226226{
    227227        ioport32_t *gt;
    228228        uint32_t val;
    229         int ret;
     229        errno_t ret;
    230230
    231231        ddf_msg(LVL_DEBUG, "malta_dev_add, device handle = %d",
  • uspace/drv/platform/msim/msim.c

    r36f0738 rb7fd2a0  
    6262} msim_fun_t;
    6363
    64 static int msim_dev_add(ddf_dev_t *dev);
     64static errno_t msim_dev_add(ddf_dev_t *dev);
    6565static void msim_init(void);
    6666
     
    152152}
    153153
    154 static int msim_enable_interrupt(ddf_fun_t *fun, int irq)
     154static errno_t msim_enable_interrupt(ddf_fun_t *fun, int irq)
    155155{
    156156        /* Nothing to do. */
     
    186186       
    187187        ddf_fun_t *fnode = NULL;
    188         int rc;
     188        errno_t rc;
    189189       
    190190        /* Create new device. */
     
    238238 * @return Zero on success or non-zero error code.
    239239 */
    240 static int msim_dev_add(ddf_dev_t *dev)
     240static errno_t msim_dev_add(ddf_dev_t *dev)
    241241{
    242242        ddf_msg(LVL_DEBUG, "msim_dev_add, device handle = %d",
  • uspace/drv/platform/pc/pc.c

    r36f0738 rb7fd2a0  
    5959} pc_fun_t;
    6060
    61 static int pc_dev_add(ddf_dev_t *dev);
     61static errno_t pc_dev_add(ddf_dev_t *dev);
    6262static void pc_init(void);
    6363
     
    125125}
    126126
    127 static int pc_enable_interrupt(ddf_fun_t *fun, int irq)
     127static errno_t pc_enable_interrupt(ddf_fun_t *fun, int irq)
    128128{
    129129        /* TODO */
     
    159159       
    160160        ddf_fun_t *fnode = NULL;
    161         int rc;
     161        errno_t rc;
    162162       
    163163        /* Create new device. */
     
    205205 * @return              Zero on success, error number otherwise.
    206206 */
    207 static int pc_dev_add(ddf_dev_t *dev)
     207static errno_t pc_dev_add(ddf_dev_t *dev)
    208208{
    209209        ddf_msg(LVL_DEBUG, "pc_dev_add, device handle = %d",
  • uspace/drv/platform/ski/ski.c

    r36f0738 rb7fd2a0  
    4646#define NAME "ski"
    4747
    48 static int ski_dev_add(ddf_dev_t *dev);
     48static errno_t ski_dev_add(ddf_dev_t *dev);
    4949
    5050static driver_ops_t ski_ops = {
     
    5757};
    5858
    59 static int ski_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id)
     59static errno_t ski_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id)
    6060{
    6161        ddf_msg(LVL_NOTE, "Adding function '%s'.", name);
    6262
    6363        ddf_fun_t *fnode = NULL;
    64         int rc;
     64        errno_t rc;
    6565
    6666        /* Create new device. */
     
    9494}
    9595
    96 static int ski_add_functions(ddf_dev_t *dev)
     96static errno_t ski_add_functions(ddf_dev_t *dev)
    9797{
    98         int rc;
     98        errno_t rc;
    9999
    100100        rc = ski_add_fun(dev, "console", "ski/console");
     
    106106
    107107/** Add device. */
    108 static int ski_dev_add(ddf_dev_t *dev)
     108static errno_t ski_dev_add(ddf_dev_t *dev)
    109109{
    110110        ddf_msg(LVL_NOTE, "ski_dev_add, device handle = %d",
     
    121121int main(int argc, char *argv[])
    122122{
    123         int rc;
     123        errno_t rc;
    124124
    125125        printf(NAME ": Ski platform driver\n");
  • uspace/drv/platform/sun4u/sun4u.c

    r36f0738 rb7fd2a0  
    7777} sun4u_fun_t;
    7878
    79 static int sun4u_dev_add(ddf_dev_t *dev);
     79static errno_t sun4u_dev_add(ddf_dev_t *dev);
    8080static void sun4u_init(void);
    8181
     
    159159}
    160160
    161 static int sun4u_enable_interrupt(ddf_fun_t *fun, int irq)
     161static errno_t sun4u_enable_interrupt(ddf_fun_t *fun, int irq)
    162162{
    163163        /* TODO */
     
    193193       
    194194        ddf_fun_t *fnode = NULL;
    195         int rc;
     195        errno_t rc;
    196196       
    197197        /* Create new device. */
     
    242242 * @return              Zero on success, error number otherwise.
    243243 */
    244 static int sun4u_dev_add(ddf_dev_t *dev)
     244static errno_t sun4u_dev_add(ddf_dev_t *dev)
    245245{
    246246        ddf_msg(LVL_DEBUG, "sun4u_dev_add, device handle = %d",
  • uspace/drv/platform/sun4v/sun4v.c

    r36f0738 rb7fd2a0  
    5555} sun4v_fun_t;
    5656
    57 static int sun4v_dev_add(ddf_dev_t *dev);
     57static errno_t sun4v_dev_add(ddf_dev_t *dev);
    5858
    5959static driver_ops_t sun4v_ops = {
     
    114114}
    115115
    116 static int sun4v_enable_interrupt(ddf_fun_t *fun, int irq)
     116static errno_t sun4v_enable_interrupt(ddf_fun_t *fun, int irq)
    117117{
    118118        return EOK;
     
    138138static ddf_dev_ops_t sun4v_fun_ops;
    139139
    140 static int sun4v_add_fun(ddf_dev_t *dev, const char *name,
     140static errno_t sun4v_add_fun(ddf_dev_t *dev, const char *name,
    141141    const char *str_match_id, sun4v_fun_t *fun_proto)
    142142{
     
    144144
    145145        ddf_fun_t *fnode = NULL;
    146         int rc;
     146        errno_t rc;
    147147
    148148        /* Create new device. */
     
    188188}
    189189
    190 static int sun4v_add_functions(ddf_dev_t *dev)
    191 {
    192         int rc;
     190static errno_t sun4v_add_functions(ddf_dev_t *dev)
     191{
     192        errno_t rc;
    193193
    194194        rc = sun4v_add_fun(dev, "console", "sun4v/console", &console_data);
     
    200200
    201201/** Add device. */
    202 static int sun4v_dev_add(ddf_dev_t *dev)
     202static errno_t sun4v_dev_add(ddf_dev_t *dev)
    203203{
    204204        ddf_msg(LVL_DEBUG, "sun4v_dev_add, device handle = %d",
     
    213213}
    214214
    215 static int sun4v_init(void)
    216 {
    217         int rc;
     215static errno_t sun4v_init(void)
     216{
     217        errno_t rc;
    218218        sysarg_t paddr;
    219219
     
    247247int main(int argc, char *argv[])
    248248{
    249         int rc;
     249        errno_t rc;
    250250
    251251        printf(NAME ": Sun4v platform driver\n");
Note: See TracChangeset for help on using the changeset viewer.