Changeset b7fd2a0 in mainline for uspace/drv/intctl


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/intctl
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/intctl/apic/apic.c

    r36f0738 rb7fd2a0  
    140140}
    141141
    142 static int apic_enable_irq(apic_t *apic, sysarg_t irq)
     142static errno_t apic_enable_irq(apic_t *apic, sysarg_t irq)
    143143{
    144144        io_redirection_reg_t reg;
     
    207207
    208208/** Add APIC device. */
    209 int apic_add(apic_t *apic, apic_res_t *res)
     209errno_t apic_add(apic_t *apic, apic_res_t *res)
    210210{
    211211        sysarg_t have_apic;
    212212        ddf_fun_t *fun_a = NULL;
    213213        void *regs;
    214         int rc;
     214        errno_t rc;
    215215       
    216216        if ((sysinfo_get_value("apic", &have_apic) != EOK) || (!have_apic)) {
     
    254254
    255255/** Remove APIC device */
    256 int apic_remove(apic_t *apic)
     256errno_t apic_remove(apic_t *apic)
    257257{
    258258        return ENOTSUP;
     
    260260
    261261/** APIC device gone */
    262 int apic_gone(apic_t *apic)
     262errno_t apic_gone(apic_t *apic)
    263263{
    264264        return ENOTSUP;
  • uspace/drv/intctl/apic/apic.h

    r36f0738 rb7fd2a0  
    5252} apic_t;
    5353
    54 extern int apic_add(apic_t *, apic_res_t *);
    55 extern int apic_remove(apic_t *);
    56 extern int apic_gone(apic_t *);
     54extern errno_t apic_add(apic_t *, apic_res_t *);
     55extern errno_t apic_remove(apic_t *);
     56extern errno_t apic_gone(apic_t *);
    5757
    5858#endif
  • uspace/drv/intctl/apic/main.c

    r36f0738 rb7fd2a0  
    4343#define NAME  "apic"
    4444
    45 static int apic_dev_add(ddf_dev_t *dev);
    46 static int apic_dev_remove(ddf_dev_t *dev);
    47 static int apic_dev_gone(ddf_dev_t *dev);
    48 static int apic_fun_online(ddf_fun_t *fun);
    49 static int apic_fun_offline(ddf_fun_t *fun);
     45static errno_t apic_dev_add(ddf_dev_t *dev);
     46static errno_t apic_dev_remove(ddf_dev_t *dev);
     47static errno_t apic_dev_gone(ddf_dev_t *dev);
     48static errno_t apic_fun_online(ddf_fun_t *fun);
     49static errno_t apic_fun_offline(ddf_fun_t *fun);
    5050
    5151static driver_ops_t driver_ops = {
     
    6262};
    6363
    64 static int apic_get_res(ddf_dev_t *dev, apic_res_t *res)
     64static errno_t apic_get_res(ddf_dev_t *dev, apic_res_t *res)
    6565{
    6666        async_sess_t *parent_sess;
    6767        hw_res_list_parsed_t hw_res;
    68         int rc;
     68        errno_t rc;
    6969
    7070        parent_sess = ddf_dev_parent_sess_get(dev);
     
    9090}
    9191
    92 static int apic_dev_add(ddf_dev_t *dev)
     92static errno_t apic_dev_add(ddf_dev_t *dev)
    9393{
    9494        apic_t *apic;
    9595        apic_res_t apic_res;
    96         int rc;
     96        errno_t rc;
    9797
    9898        ddf_msg(LVL_DEBUG, "apic_dev_add(%p)", dev);
     
    114114}
    115115
    116 static int apic_dev_remove(ddf_dev_t *dev)
     116static errno_t apic_dev_remove(ddf_dev_t *dev)
    117117{
    118118        apic_t *apic = (apic_t *)ddf_dev_data_get(dev);
     
    123123}
    124124
    125 static int apic_dev_gone(ddf_dev_t *dev)
     125static errno_t apic_dev_gone(ddf_dev_t *dev)
    126126{
    127127        apic_t *apic = (apic_t *)ddf_dev_data_get(dev);
     
    132132}
    133133
    134 static int apic_fun_online(ddf_fun_t *fun)
     134static errno_t apic_fun_online(ddf_fun_t *fun)
    135135{
    136136        ddf_msg(LVL_DEBUG, "apic_fun_online()");
     
    138138}
    139139
    140 static int apic_fun_offline(ddf_fun_t *fun)
     140static errno_t apic_fun_offline(ddf_fun_t *fun)
    141141{
    142142        ddf_msg(LVL_DEBUG, "apic_fun_offline()");
  • uspace/drv/intctl/i8259/i8259.c

    r36f0738 rb7fd2a0  
    6464#define PIC_MAX_IRQ  15
    6565
    66 static int pic_enable_irq(i8259_t *i8259, sysarg_t irq)
     66static errno_t pic_enable_irq(i8259_t *i8259, sysarg_t irq)
    6767{
    6868        if (irq > PIC_MAX_IRQ)
     
    136136
    137137/** Add i8259 device. */
    138 int i8259_add(i8259_t *i8259, i8259_res_t *res)
     138errno_t i8259_add(i8259_t *i8259, i8259_res_t *res)
    139139{
    140140        sysarg_t have_i8259;
     
    142142        ioport8_t *regs1;
    143143        ddf_fun_t *fun_a = NULL;
    144         int rc;
     144        errno_t rc;
    145145       
    146146        if ((sysinfo_get_value("i8259", &have_i8259) != EOK) || (!have_i8259)) {
     
    187187
    188188/** Remove i8259 device */
    189 int i8259_remove(i8259_t *i8259)
     189errno_t i8259_remove(i8259_t *i8259)
    190190{
    191191        return ENOTSUP;
     
    193193
    194194/** i8259 device gone */
    195 int i8259_gone(i8259_t *i8259)
     195errno_t i8259_gone(i8259_t *i8259)
    196196{
    197197        return ENOTSUP;
  • uspace/drv/intctl/i8259/i8259.h

    r36f0738 rb7fd2a0  
    5252} i8259_t;
    5353
    54 extern int i8259_add(i8259_t *, i8259_res_t *);
    55 extern int i8259_remove(i8259_t *);
    56 extern int i8259_gone(i8259_t *);
     54extern errno_t i8259_add(i8259_t *, i8259_res_t *);
     55extern errno_t i8259_remove(i8259_t *);
     56extern errno_t i8259_gone(i8259_t *);
    5757
    5858#endif
  • uspace/drv/intctl/i8259/main.c

    r36f0738 rb7fd2a0  
    4343#define NAME  "i8259"
    4444
    45 static int i8259_dev_add(ddf_dev_t *dev);
    46 static int i8259_dev_remove(ddf_dev_t *dev);
    47 static int i8259_dev_gone(ddf_dev_t *dev);
    48 static int i8259_fun_online(ddf_fun_t *fun);
    49 static int i8259_fun_offline(ddf_fun_t *fun);
     45static errno_t i8259_dev_add(ddf_dev_t *dev);
     46static errno_t i8259_dev_remove(ddf_dev_t *dev);
     47static errno_t i8259_dev_gone(ddf_dev_t *dev);
     48static errno_t i8259_fun_online(ddf_fun_t *fun);
     49static errno_t i8259_fun_offline(ddf_fun_t *fun);
    5050
    5151static driver_ops_t driver_ops = {
     
    6262};
    6363
    64 static int i8259_get_res(ddf_dev_t *dev, i8259_res_t *res)
     64static errno_t i8259_get_res(ddf_dev_t *dev, i8259_res_t *res)
    6565{
    6666        async_sess_t *parent_sess;
    6767        hw_res_list_parsed_t hw_res;
    68         int rc;
     68        errno_t rc;
    6969
    7070        parent_sess = ddf_dev_parent_sess_get(dev);
     
    9191}
    9292
    93 static int i8259_dev_add(ddf_dev_t *dev)
     93static errno_t i8259_dev_add(ddf_dev_t *dev)
    9494{
    9595        i8259_t *i8259;
    9696        i8259_res_t i8259_res;
    97         int rc;
     97        errno_t rc;
    9898
    9999        ddf_msg(LVL_DEBUG, "i8259_dev_add(%p)", dev);
     
    115115}
    116116
    117 static int i8259_dev_remove(ddf_dev_t *dev)
     117static errno_t i8259_dev_remove(ddf_dev_t *dev)
    118118{
    119119        i8259_t *i8259 = (i8259_t *)ddf_dev_data_get(dev);
     
    124124}
    125125
    126 static int i8259_dev_gone(ddf_dev_t *dev)
     126static errno_t i8259_dev_gone(ddf_dev_t *dev)
    127127{
    128128        i8259_t *i8259 = (i8259_t *)ddf_dev_data_get(dev);
     
    133133}
    134134
    135 static int i8259_fun_online(ddf_fun_t *fun)
     135static errno_t i8259_fun_online(ddf_fun_t *fun)
    136136{
    137137        ddf_msg(LVL_DEBUG, "i8259_fun_online()");
     
    139139}
    140140
    141 static int i8259_fun_offline(ddf_fun_t *fun)
     141static errno_t i8259_fun_offline(ddf_fun_t *fun)
    142142{
    143143        ddf_msg(LVL_DEBUG, "i8259_fun_offline()");
  • uspace/drv/intctl/icp-ic/icp-ic.c

    r36f0738 rb7fd2a0  
    5252};
    5353
    54 static int icpic_enable_irq(icpic_t *icpic, sysarg_t irq)
     54static errno_t icpic_enable_irq(icpic_t *icpic, sysarg_t irq)
    5555{
    5656        if (irq > icpic_max_irq)
     
    112112
    113113/** Add icp-ic device. */
    114 int icpic_add(icpic_t *icpic, icpic_res_t *res)
     114errno_t icpic_add(icpic_t *icpic, icpic_res_t *res)
    115115{
    116116        ddf_fun_t *fun_a = NULL;
    117117        void *regs;
    118         int rc;
     118        errno_t rc;
    119119
    120120        rc = pio_enable((void *)res->base, sizeof(icpic_regs_t), &regs);
     
    153153
    154154/** Remove icp-ic device */
    155 int icpic_remove(icpic_t *icpic)
     155errno_t icpic_remove(icpic_t *icpic)
    156156{
    157157        return ENOTSUP;
     
    159159
    160160/** icp-ic device gone */
    161 int icpic_gone(icpic_t *icpic)
     161errno_t icpic_gone(icpic_t *icpic)
    162162{
    163163        return ENOTSUP;
  • uspace/drv/intctl/icp-ic/icp-ic.h

    r36f0738 rb7fd2a0  
    5353} icpic_t;
    5454
    55 extern int icpic_add(icpic_t *, icpic_res_t *);
    56 extern int icpic_remove(icpic_t *);
    57 extern int icpic_gone(icpic_t *);
     55extern errno_t icpic_add(icpic_t *, icpic_res_t *);
     56extern errno_t icpic_remove(icpic_t *);
     57extern errno_t icpic_gone(icpic_t *);
    5858
    5959#endif
  • uspace/drv/intctl/icp-ic/main.c

    r36f0738 rb7fd2a0  
    4343#define NAME  "icp-ic"
    4444
    45 static int icpic_dev_add(ddf_dev_t *dev);
    46 static int icpic_dev_remove(ddf_dev_t *dev);
    47 static int icpic_dev_gone(ddf_dev_t *dev);
    48 static int icpic_fun_online(ddf_fun_t *fun);
    49 static int icpic_fun_offline(ddf_fun_t *fun);
     45static errno_t icpic_dev_add(ddf_dev_t *dev);
     46static errno_t icpic_dev_remove(ddf_dev_t *dev);
     47static errno_t icpic_dev_gone(ddf_dev_t *dev);
     48static errno_t icpic_fun_online(ddf_fun_t *fun);
     49static errno_t icpic_fun_offline(ddf_fun_t *fun);
    5050
    5151static driver_ops_t driver_ops = {
     
    6262};
    6363
    64 static int icpic_get_res(ddf_dev_t *dev, icpic_res_t *res)
     64static errno_t icpic_get_res(ddf_dev_t *dev, icpic_res_t *res)
    6565{
    6666        async_sess_t *parent_sess;
    6767        hw_res_list_parsed_t hw_res;
    68         int rc;
     68        errno_t rc;
    6969
    7070        parent_sess = ddf_dev_parent_sess_get(dev);
     
    9090}
    9191
    92 static int icpic_dev_add(ddf_dev_t *dev)
     92static errno_t icpic_dev_add(ddf_dev_t *dev)
    9393{
    9494        icpic_t *icpic;
    9595        icpic_res_t icpic_res;
    96         int rc;
     96        errno_t rc;
    9797
    9898        ddf_msg(LVL_DEBUG, "icpic_dev_add(%p)", dev);
     
    114114}
    115115
    116 static int icpic_dev_remove(ddf_dev_t *dev)
     116static errno_t icpic_dev_remove(ddf_dev_t *dev)
    117117{
    118118        icpic_t *icpic = (icpic_t *)ddf_dev_data_get(dev);
     
    123123}
    124124
    125 static int icpic_dev_gone(ddf_dev_t *dev)
     125static errno_t icpic_dev_gone(ddf_dev_t *dev)
    126126{
    127127        icpic_t *icpic = (icpic_t *)ddf_dev_data_get(dev);
     
    132132}
    133133
    134 static int icpic_fun_online(ddf_fun_t *fun)
     134static errno_t icpic_fun_online(ddf_fun_t *fun)
    135135{
    136136        ddf_msg(LVL_DEBUG, "icpic_fun_online()");
     
    138138}
    139139
    140 static int icpic_fun_offline(ddf_fun_t *fun)
     140static errno_t icpic_fun_offline(ddf_fun_t *fun)
    141141{
    142142        ddf_msg(LVL_DEBUG, "icpic_fun_offline()");
  • uspace/drv/intctl/obio/main.c

    r36f0738 rb7fd2a0  
    4343#define NAME  "obio"
    4444
    45 static int obio_dev_add(ddf_dev_t *dev);
    46 static int obio_dev_remove(ddf_dev_t *dev);
    47 static int obio_dev_gone(ddf_dev_t *dev);
    48 static int obio_fun_online(ddf_fun_t *fun);
    49 static int obio_fun_offline(ddf_fun_t *fun);
     45static errno_t obio_dev_add(ddf_dev_t *dev);
     46static errno_t obio_dev_remove(ddf_dev_t *dev);
     47static errno_t obio_dev_gone(ddf_dev_t *dev);
     48static errno_t obio_fun_online(ddf_fun_t *fun);
     49static errno_t obio_fun_offline(ddf_fun_t *fun);
    5050
    5151static driver_ops_t driver_ops = {
     
    6262};
    6363
    64 static int obio_get_res(ddf_dev_t *dev, obio_res_t *res)
     64static errno_t obio_get_res(ddf_dev_t *dev, obio_res_t *res)
    6565{
    6666        async_sess_t *parent_sess;
    6767        hw_res_list_parsed_t hw_res;
    68         int rc;
     68        errno_t rc;
    6969
    7070        parent_sess = ddf_dev_parent_sess_get(dev);
     
    9090}
    9191
    92 static int obio_dev_add(ddf_dev_t *dev)
     92static errno_t obio_dev_add(ddf_dev_t *dev)
    9393{
    9494        obio_t *obio;
    9595        obio_res_t obio_res;
    96         int rc;
     96        errno_t rc;
    9797
    9898        ddf_msg(LVL_DEBUG, "obio_dev_add(%p)", dev);
     
    114114}
    115115
    116 static int obio_dev_remove(ddf_dev_t *dev)
     116static errno_t obio_dev_remove(ddf_dev_t *dev)
    117117{
    118118        obio_t *obio = (obio_t *)ddf_dev_data_get(dev);
     
    123123}
    124124
    125 static int obio_dev_gone(ddf_dev_t *dev)
     125static errno_t obio_dev_gone(ddf_dev_t *dev)
    126126{
    127127        obio_t *obio = (obio_t *)ddf_dev_data_get(dev);
     
    132132}
    133133
    134 static int obio_fun_online(ddf_fun_t *fun)
     134static errno_t obio_fun_online(ddf_fun_t *fun)
    135135{
    136136        ddf_msg(LVL_DEBUG, "obio_fun_online()");
     
    138138}
    139139
    140 static int obio_fun_offline(ddf_fun_t *fun)
     140static errno_t obio_fun_offline(ddf_fun_t *fun)
    141141{
    142142        ddf_msg(LVL_DEBUG, "obio_fun_offline()");
  • uspace/drv/intctl/obio/obio.c

    r36f0738 rb7fd2a0  
    114114
    115115/** Add OBIO device. */
    116 int obio_add(obio_t *obio, obio_res_t *res)
     116errno_t obio_add(obio_t *obio, obio_res_t *res)
    117117{
    118118        ddf_fun_t *fun_a = NULL;
    119         int rc;
     119        errno_t rc;
    120120
    121121        rc = pio_enable((void *)res->base, OBIO_SIZE, (void **) &obio->regs);
     
    155155
    156156/** Remove OBIO device */
    157 int obio_remove(obio_t *obio)
     157errno_t obio_remove(obio_t *obio)
    158158{
    159159        return ENOTSUP;
     
    161161
    162162/** OBIO device gone */
    163 int obio_gone(obio_t *obio)
     163errno_t obio_gone(obio_t *obio)
    164164{
    165165        return ENOTSUP;
  • uspace/drv/intctl/obio/obio.h

    r36f0738 rb7fd2a0  
    5252} obio_t;
    5353
    54 extern int obio_add(obio_t *, obio_res_t *);
    55 extern int obio_remove(obio_t *);
    56 extern int obio_gone(obio_t *);
     54extern errno_t obio_add(obio_t *, obio_res_t *);
     55extern errno_t obio_remove(obio_t *);
     56extern errno_t obio_gone(obio_t *);
    5757
    5858#endif
Note: See TracChangeset for help on using the changeset viewer.