Changeset a35b458 in mainline for uspace/drv/char/i8042/i8042.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (6 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:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

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

    r3061bc1 ra35b458  
    130130        i8042_t *controller = ddf_dev_data_get(dev);
    131131        errno_t rc;
    132        
     132
    133133        const uint8_t status = IPC_GET_ARG1(*call);
    134134        const uint8_t data = IPC_GET_ARG2(*call);
    135        
     135
    136136        i8042_port_t *port = (status & i8042_AUX_DATA) ?
    137137            controller->aux : controller->kbd;
    138        
     138
    139139        fibril_mutex_lock(&port->buf_lock);
    140        
     140
    141141        rc = circ_buf_push(&port->cbuf, &data);
    142142        if (rc != EOK)
     
    169169        ddf_fun_t *aux_fun;
    170170        i8042_regs_t *ar;
    171        
     171
    172172        errno_t rc;
    173173        bool kbd_bound = false;
    174174        bool aux_bound = false;
    175        
     175
    176176        if (regs->size < sizeof(i8042_regs_t)) {
    177177                rc = EINVAL;
    178178                goto error;
    179179        }
    180        
     180
    181181        if (pio_enable_range(regs, (void **) &dev->regs) != 0) {
    182182                rc = EIO;
    183183                goto error;
    184184        }
    185        
     185
    186186        kbd_fun = ddf_fun_create(ddf_dev, fun_inner, "ps2a");
    187187        if (kbd_fun == NULL) {
     
    189189                goto error;
    190190        };
    191        
     191
    192192        dev->kbd = ddf_fun_data_alloc(kbd_fun, sizeof(i8042_port_t));
    193193        if (dev->kbd == NULL) {
     
    195195                goto error;
    196196        }
    197        
     197
    198198        dev->kbd->fun = kbd_fun;
    199199        dev->kbd->ctl = dev;
     
    203203        fibril_mutex_initialize(&dev->kbd->buf_lock);
    204204        fibril_condvar_initialize(&dev->kbd->buf_cv);
    205        
     205
    206206        rc = ddf_fun_add_match_id(dev->kbd->fun, "char/xtkbd", 90);
    207207        if (rc != EOK)
    208208                goto error;
    209        
     209
    210210        aux_fun = ddf_fun_create(ddf_dev, fun_inner, "ps2b");
    211211        if (aux_fun == NULL) {
     
    213213                goto error;
    214214        }
    215        
     215
    216216        dev->aux = ddf_fun_data_alloc(aux_fun, sizeof(i8042_port_t));
    217217        if (dev->aux == NULL) {
     
    219219                goto error;
    220220        }
    221        
     221
    222222        dev->aux->fun = aux_fun;
    223223        dev->aux->ctl = dev;
     
    227227        fibril_mutex_initialize(&dev->aux->buf_lock);
    228228        fibril_condvar_initialize(&dev->aux->buf_cv);
    229        
     229
    230230        rc = ddf_fun_add_match_id(dev->aux->fun, "char/ps2mouse", 90);
    231231        if (rc != EOK)
    232232                goto error;
    233        
     233
    234234        ddf_fun_set_conn_handler(dev->kbd->fun, i8042_char_conn);
    235235        ddf_fun_set_conn_handler(dev->aux->fun, i8042_char_conn);
    236        
     236
    237237        circ_buf_init(&dev->kbd->cbuf, dev->kbd->buf_data, BUFFER_SIZE, 1);
    238238        circ_buf_init(&dev->aux->cbuf, dev->aux->buf_data, BUFFER_SIZE, 1);
    239239        fibril_mutex_initialize(&dev->write_guard);
    240        
     240
    241241        rc = ddf_fun_bind(dev->kbd->fun);
    242242        if (rc != EOK) {
     
    246246        }
    247247        kbd_bound = true;
    248        
     248
    249249        rc = ddf_fun_bind(dev->aux->fun);
    250250        if (rc != EOK) {
     
    254254        }
    255255        aux_bound = true;
    256        
     256
    257257        /* Disable kbd and aux */
    258258        wait_ready(dev);
     
    260260        wait_ready(dev);
    261261        pio_write_8(&dev->regs->data, i8042_KBD_DISABLE | i8042_AUX_DISABLE);
    262        
     262
    263263        /* Flush all current IO */
    264264        while (pio_read_8(&dev->regs->status) & i8042_OUTPUT_FULL)
     
    280280                .cmds = cmds
    281281        };
    282        
     282
    283283        int irq_kbd_cap;
    284284        rc = register_interrupt_handler(ddf_dev, irq_kbd,
     
    289289                goto error;
    290290        }
    291        
     291
    292292        int irq_mouse_cap;
    293293        rc = register_interrupt_handler(ddf_dev, irq_mouse,
     
    298298                goto error;
    299299        }
    300        
     300
    301301        /* Enable interrupts */
    302302        async_sess_t *parent_sess = ddf_dev_parent_sess_get(ddf_dev);
    303303        assert(parent_sess != NULL);
    304        
     304
    305305        rc = hw_res_enable_interrupt(parent_sess, irq_kbd);
    306306        if (rc != EOK) {
     
    318318                goto error;
    319319        }
    320        
     320
    321321        /* Enable port interrupts. */
    322322        wait_ready(dev);
     
    325325        pio_write_8(&dev->regs->data, i8042_KBD_IE | i8042_KBD_TRANSLATE |
    326326            i8042_AUX_IE);
    327        
     327
    328328        return EOK;
    329329error:
     
    356356        i8042_t *i8042 = port->ctl;
    357357        const char *dp = (const char *)data;
    358        
     358
    359359        fibril_mutex_lock(&i8042->write_guard);
    360        
     360
    361361        for (size_t i = 0; i < size; ++i) {
    362362                if (port == i8042->aux) {
     
    365365                            i8042_CMD_WRITE_AUX);
    366366                }
    367                
     367
    368368                wait_ready(i8042);
    369369                pio_write_8(&i8042->regs->data, dp[i]);
    370370        }
    371        
     371
    372372        fibril_mutex_unlock(&i8042->write_guard);
    373373        *nwr = size;
     
    392392        uint8_t *destp = (uint8_t *)dest;
    393393        errno_t rc;
    394        
     394
    395395        fibril_mutex_lock(&port->buf_lock);
    396        
     396
    397397        while (circ_buf_nused(&port->cbuf) == 0)
    398398                fibril_condvar_wait(&port->buf_cv, &port->buf_lock);
Note: See TracChangeset for help on using the changeset viewer.