Changeset 98abd40 in mainline for uspace/drv/char/i8042/main.c


Ignore:
Timestamp:
2013-07-06T21:57:22Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c8bb1633, cdc8a391
Parents:
b8e72fd1 (diff), 507c6f3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/char/i8042/main.c

    rb8e72fd1 r98abd40  
    4545#include <async.h>
    4646#include "i8042.h"
    47 
    48 #define CHECK_RET_RETURN(ret, message...) \
    49         do { \
    50                 if (ret != EOK) { \
    51                         ddf_msg(LVL_ERROR, message); \
    52                         return ret; \
    53                 } \
    54         } while (0)
    5547
    5648/** Get address of I/O registers.
     
    112104static int i8042_dev_add(ddf_dev_t *device)
    113105{
    114         if (!device)
    115                 return EINVAL;
    116        
    117106        uintptr_t io_regs = 0;
    118107        size_t io_size = 0;
    119108        int kbd = 0;
    120109        int mouse = 0;
     110        int rc;
    121111       
    122         int ret = get_my_registers(device, &io_regs, &io_size, &kbd, &mouse);
    123         CHECK_RET_RETURN(ret, "Failed to get registers: %s.",
    124             str_error(ret));
     112        if (!device)
     113                return EINVAL;
     114       
     115        rc = get_my_registers(device, &io_regs, &io_size, &kbd, &mouse);
     116        if (rc != EOK) {
     117                ddf_msg(LVL_ERROR, "Failed to get registers: %s.",
     118                    str_error(rc));
     119                return rc;
     120        }
     121       
    125122        ddf_msg(LVL_DEBUG, "I/O regs at %p (size %zuB), IRQ kbd %d, IRQ mouse %d.",
    126123            (void *) io_regs, io_size, kbd, mouse);
    127124       
    128125        i8042_t *i8042 = ddf_dev_data_alloc(device, sizeof(i8042_t));
    129         ret = (i8042 == NULL) ? ENOMEM : EOK;
    130         CHECK_RET_RETURN(ret, "Failed to allocate i8042 driver instance.");
     126        if (i8042 == NULL) {
     127                ddf_msg(LVL_ERROR, "Out of memory.");
     128                return ENOMEM;
     129        }
    131130       
    132         ret = i8042_init(i8042, (void *) io_regs, io_size, kbd, mouse, device);
    133         CHECK_RET_RETURN(ret, "Failed to initialize i8042 driver: %s.",
    134             str_error(ret));
     131        rc = i8042_init(i8042, (void *) io_regs, io_size, kbd, mouse, device);
     132        if (rc != EOK) {
     133                ddf_msg(LVL_ERROR, "Failed to initialize i8042 driver: %s.",
     134                    str_error(rc));
     135                return rc;
     136        }
    135137       
    136138        ddf_msg(LVL_NOTE, "Controlling '%s' (%" PRIun ").",
Note: See TracChangeset for help on using the changeset viewer.