Changeset a35b458 in mainline for uspace/lib/c/generic/device


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 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.

Location:
uspace/lib/c/generic/device
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/device/hw_res.c

    r3061bc1 ra35b458  
    4242{
    4343        sysarg_t count = 0;
    44        
     44
    4545        async_exch_t *exch = async_exchange_begin(sess);
    46        
     46
    4747        errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    4848            HW_RES_GET_RESOURCE_LIST, &count);
    49        
     49
    5050        if (rc != EOK) {
    5151                async_exchange_end(exch);
    5252                return rc;
    5353        }
    54        
     54
    5555        size_t size = count * sizeof(hw_resource_t);
    5656        hw_resource_t *resources = (hw_resource_t *) malloc(size);
     
    6060                return ENOMEM;
    6161        }
    62        
     62
    6363        rc = async_data_read_start(exch, resources, size);
    6464        async_exchange_end(exch);
    65        
     65
    6666        if (rc != EOK) {
    6767                free(resources);
    6868                return rc;
    6969        }
    70        
     70
    7171        hw_resources->resources = resources;
    7272        hw_resources->count = count;
    73        
     73
    7474        return EOK;
    7575}
     
    7878{
    7979        async_exch_t *exch = async_exchange_begin(sess);
    80        
     80
    8181        errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    8282            HW_RES_ENABLE_INTERRUPT, irq);
    8383        async_exchange_end(exch);
    84        
     84
    8585        return rc;
    8686}
     
    8989{
    9090        async_exch_t *exch = async_exchange_begin(sess);
    91        
     91
    9292        errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    9393            HW_RES_DISABLE_INTERRUPT, irq);
    9494        async_exchange_end(exch);
    95        
     95
    9696        return rc;
    9797}
     
    100100{
    101101        async_exch_t *exch = async_exchange_begin(sess);
    102        
     102
    103103        errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    104104            HW_RES_CLEAR_INTERRUPT, irq);
    105105        async_exchange_end(exch);
    106        
     106
    107107        return rc;
    108108}
     
    126126{
    127127        async_exch_t *exch = async_exchange_begin(sess);
    128        
     128
    129129        const uint32_t packed = (channel & 0xffff) | (mode << 16);
    130130        const errno_t ret = async_req_4_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    131131            HW_RES_DMA_CHANNEL_SETUP, packed, pa, size);
    132        
     132
    133133        async_exchange_end(exch);
    134        
     134
    135135        return ret;
    136136}
     
    148148{
    149149        async_exch_t *exch = async_exchange_begin(sess);
    150        
     150
    151151        sysarg_t remain;
    152152        const errno_t ret = async_req_2_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    153153            HW_RES_DMA_CHANNEL_REMAIN, channel, &remain);
    154        
     154
    155155        async_exchange_end(exch);
    156        
     156
    157157        if (ret == EOK)
    158158                *rem = remain;
    159        
     159
    160160        return ret;
    161161}
  • uspace/lib/c/generic/device/hw_res_parsed.c

    r3061bc1 ra35b458  
    4343        assert(res);
    4444        assert((res->type == DMA_CHANNEL_8) || (res->type == DMA_CHANNEL_16));
    45        
     45
    4646        const unsigned channel = (res->type == DMA_CHANNEL_8) ?
    4747            res->res.dma_channel.dma8 : res->res.dma_channel.dma16;
    4848        const size_t count = out->dma_channels.count;
    4949        const int keep_duplicit = flags & HW_RES_KEEP_DUPLICIT;
    50        
     50
    5151        if (!keep_duplicit) {
    5252                for (size_t i = 0; i < count; ++i) {
     
    5555                }
    5656        }
    57        
     57
    5858        out->dma_channels.channels[count] = channel;
    5959        ++out->dma_channels.count;
     
    6464{
    6565        assert(res && (res->type == INTERRUPT));
    66        
     66
    6767        int irq = res->res.interrupt.irq;
    6868        size_t count = out->irqs.count;
    6969        int keep_duplicit = flags & HW_RES_KEEP_DUPLICIT;
    70        
     70
    7171        if (!keep_duplicit) {
    7272                for (size_t i = 0; i < count; i++) {
     
    7575                }
    7676        }
    77        
     77
    7878        out->irqs.irqs[count] = irq;
    7979        out->irqs.count++;
     
    105105
    106106        assert(res && (res->type == IO_RANGE));
    107        
     107
    108108        absolute = absolutize(res->res.io_range.address,
    109109            res->res.io_range.relative, win->io.base);
     
    112112        size = res->res.io_range.size;
    113113        endianness = res->res.io_range.endianness;
    114        
     114
    115115        if ((size == 0) && (!(flags & HW_RES_KEEP_ZERO_AREA)))
    116116                return;
    117        
     117
    118118        int keep_duplicit = flags & HW_RES_KEEP_DUPLICIT;
    119119        size_t count = out->io_ranges.count;
    120        
     120
    121121        if (!keep_duplicit) {
    122122                for (size_t i = 0; i < count; i++) {
     
    126126                        s_address = RNGABS(out->io_ranges.ranges[i]);
    127127                        s_size = RNGSZ(out->io_ranges.ranges[i]);
    128                        
     128
    129129                        if ((absolute == s_address) && (size == s_size))
    130130                                return;
    131131                }
    132132        }
    133        
     133
    134134        RNGABS(out->io_ranges.ranges[count]) = absolute;
    135135        RNGREL(out->io_ranges.ranges[count]) = relative;
     
    146146        uint64_t relative;
    147147        size_t size;
    148        
     148
    149149        assert(res && (res->type == MEM_RANGE));
    150        
     150
    151151        absolute = absolutize(res->res.mem_range.address,
    152152            res->res.mem_range.relative, win->mem.base);
     
    155155        size = res->res.mem_range.size;
    156156        endianness = res->res.mem_range.endianness;
    157        
     157
    158158        if ((size == 0) && (!(flags & HW_RES_KEEP_ZERO_AREA)))
    159159                return;
    160        
     160
    161161        int keep_duplicit = flags & HW_RES_KEEP_DUPLICIT;
    162162        size_t count = out->mem_ranges.count;
    163        
     163
    164164        if (!keep_duplicit) {
    165165                for (size_t i = 0; i < count; ++i) {
     
    169169                        s_address = RNGABS(out->mem_ranges.ranges[i]);;
    170170                        s_size = RNGSZ(out->mem_ranges.ranges[i]);
    171                        
     171
    172172                        if ((absolute == s_address) && (size == s_size))
    173173                                return;
    174174                }
    175175        }
    176        
     176
    177177        RNGABS(out->mem_ranges.ranges[count]) = absolute;
    178178        RNGREL(out->mem_ranges.ranges[count]) = relative;
     
    199199        if (!res || !out)
    200200                return EINVAL;
    201        
     201
    202202        size_t res_count = res->count;
    203203        hw_res_list_parsed_clean(out);
    204        
     204
    205205        out->irqs.irqs = calloc(res_count, sizeof(int));
    206206        out->dma_channels.channels = calloc(res_count, sizeof(int));
     
    212212                return ENOMEM;
    213213        }
    214        
     214
    215215        for (size_t i = 0; i < res_count; ++i) {
    216216                const hw_resource_t *resource = &res->resources[i];
    217                
     217
    218218                switch (resource->type) {
    219219                case INTERRUPT:
     
    235235                }
    236236        }
    237        
     237
    238238        return EOK;
    239239};
     
    261261        if (!hw_res_parsed)
    262262                return EBADMEM;
    263        
     263
    264264        hw_resource_list_t hw_resources;
    265265        hw_res_list_parsed_clean(hw_res_parsed);
     
    269269        if (rc != EOK)
    270270                return rc;
    271        
     271
    272272        rc = hw_res_get_resource_list(sess, &hw_resources);
    273273        if (rc != EOK)
     
    277277            flags);
    278278        hw_res_clean_resource_list(&hw_resources);
    279        
     279
    280280        return rc;
    281281};
  • uspace/lib/c/generic/device/led_dev.c

    r3061bc1 ra35b458  
    4242{
    4343        async_exch_t *exch = async_exchange_begin(sess);
    44        
     44
    4545        aid_t req = async_send_2(exch, DEV_IFACE_ID(LED_DEV_IFACE),
    4646            LED_DEV_COLOR_SET, (sysarg_t) pixel, NULL);
    47        
     47
    4848        async_exchange_end(exch);
    49        
     49
    5050        errno_t rc;
    5151        async_wait_for(req, &rc);
    52        
     52
    5353        return (errno_t) rc;
    5454}
  • uspace/lib/c/generic/device/pio_window.c

    r3061bc1 ra35b458  
    5151                return rc;
    5252        }
    53        
     53
    5454        rc = async_data_read_start(exch, pio_win, sizeof(*pio_win));
    5555        async_exchange_end(exch);
    56        
     56
    5757        return rc;
    5858}
Note: See TracChangeset for help on using the changeset viewer.