Changeset b7fd2a0 in mainline for uspace/drv/char/pl050/pl050.c


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/char/pl050/pl050.c

    r36f0738 rb7fd2a0  
    5151};
    5252
    53 static int pl050_dev_add(ddf_dev_t *);
    54 static int pl050_fun_online(ddf_fun_t *);
    55 static int pl050_fun_offline(ddf_fun_t *);
     53static errno_t pl050_dev_add(ddf_dev_t *);
     54static errno_t pl050_fun_online(ddf_fun_t *);
     55static errno_t pl050_fun_offline(ddf_fun_t *);
    5656static void pl050_char_conn(ipc_callid_t, ipc_call_t *, void *);
    57 static int pl050_read(chardev_srv_t *, void *, size_t, size_t *);
    58 static int pl050_write(chardev_srv_t *, const void *, size_t, size_t *);
     57static errno_t pl050_read(chardev_srv_t *, void *, size_t, size_t *);
     58static errno_t pl050_write(chardev_srv_t *, const void *, size_t, size_t *);
    5959
    6060static driver_ops_t driver_ops = {
     
    158158}
    159159
    160 static int pl050_init(pl050_t *pl050)
     160static errno_t pl050_init(pl050_t *pl050)
    161161{
    162162        hw_res_list_parsed_t res;
    163163        void *regs;
    164         int rc;
     164        errno_t rc;
    165165
    166166        fibril_mutex_initialize(&pl050->buf_lock);
     
    237237}
    238238
    239 static int pl050_read(chardev_srv_t *srv, void *buffer, size_t size,
     239static errno_t pl050_read(chardev_srv_t *srv, void *buffer, size_t size,
    240240    size_t *nread)
    241241{
     
    263263}
    264264
    265 static int pl050_write(chardev_srv_t *srv, const void *data, size_t size,
     265static errno_t pl050_write(chardev_srv_t *srv, const void *data, size_t size,
    266266    size_t *nwritten)
    267267{
     
    294294
    295295/** Add device. */
    296 static int pl050_dev_add(ddf_dev_t *dev)
     296static errno_t pl050_dev_add(ddf_dev_t *dev)
    297297{
    298298        ddf_fun_t *fun_a;
    299299        pl050_t *pl050 = NULL;
    300300        const char *mname;
    301         int rc;
     301        errno_t rc;
    302302
    303303        ddf_msg(LVL_DEBUG, "pl050_dev_add()");
     
    363363}
    364364
    365 static int pl050_fun_online(ddf_fun_t *fun)
     365static errno_t pl050_fun_online(ddf_fun_t *fun)
    366366{
    367367        ddf_msg(LVL_DEBUG, "pl050_fun_online()");
     
    369369}
    370370
    371 static int pl050_fun_offline(ddf_fun_t *fun)
     371static errno_t pl050_fun_offline(ddf_fun_t *fun)
    372372{
    373373        ddf_msg(LVL_DEBUG, "pl050_fun_offline()");
     
    377377int main(int argc, char *argv[])
    378378{
    379         int rc;
     379        errno_t rc;
    380380
    381381        printf(NAME ": HelenOS pl050 serial device driver\n");
Note: See TracChangeset for help on using the changeset viewer.