Changeset a35b458 in mainline for uspace/lib/nic/src/nic_driver.c


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/nic/src/nic_driver.c

    r3061bc1 ra35b458  
    6868        nic_globals.frame_cache_size = 0;
    6969        fibril_mutex_initialize(&nic_globals.lock);
    70        
     70
    7171        char buffer[256];
    7272        snprintf(buffer, 256, "drv/" DEVICE_CATEGORY_NIC "/%s", name);
    73        
     73
    7474        return EOK;
    7575}
     
    247247        ddf_dev_t *dev = nic_data->dev;
    248248        async_sess_t *parent_sess;
    249        
     249
    250250        /* Connect to the parent's driver. */
    251251        parent_sess = ddf_dev_parent_sess_get(dev);
    252252        if (parent_sess == NULL)
    253253                return EIO;
    254        
     254
    255255        return hw_res_get_list_parsed(parent_sess, resources, 0);
    256256}
     
    277277                if (!frame)
    278278                        return NULL;
    279                
     279
    280280                link_initialize(&frame->link);
    281281        }
     
    327327        nic_frame_list_t *frames;
    328328        fibril_mutex_lock(&nic_globals.lock);
    329        
     329
    330330        if (nic_globals.frame_list_cache_size > 0) {
    331331                frames =
     
    338338        } else {
    339339                fibril_mutex_unlock(&nic_globals.lock);
    340                
     340
    341341                frames = malloc(sizeof (nic_frame_list_t));
    342342                if (frames != NULL)
    343343                        list_initialize(frames);
    344344        }
    345        
     345
    346346        return frames;
    347347}
     
    426426{
    427427        assert(nic_data);
    428        
     428
    429429        if (address->address[0] & 1)
    430430                return EINVAL;
    431        
     431
    432432        fibril_rwlock_write_lock(&nic_data->main_lock);
    433        
     433
    434434        /* Notify NIL layer (and uppper) if bound - not in add_device */
    435435        if (nic_data->client_session != NULL) {
     
    442442                }
    443443        }
    444        
     444
    445445        fibril_rwlock_write_lock(&nic_data->rxc_lock);
    446        
     446
    447447        /*
    448448         * The initial address (all zeroes) shouldn't be
     
    452452        errno_t rc = nic_rxc_set_addr(&nic_data->rx_control,
    453453            &nic_data->mac, address);
    454        
     454
    455455        /* For the first time also record the default MAC */
    456456        if (MAC_IS_ZERO(nic_data->default_mac.address)) {
     
    458458                memcpy(&nic_data->default_mac, address, sizeof(nic_address_t));
    459459        }
    460        
     460
    461461        fibril_rwlock_write_unlock(&nic_data->rxc_lock);
    462        
     462
    463463        if ((rc != EOK) && (rc != ENOENT)) {
    464464                fibril_rwlock_write_unlock(&nic_data->main_lock);
    465465                return rc;
    466466        }
    467        
     467
    468468        memcpy(&nic_data->mac, address, sizeof(nic_address_t));
    469        
     469
    470470        fibril_rwlock_write_unlock(&nic_data->main_lock);
    471        
     471
    472472        return EOK;
    473473}
     
    593593        if (nic_data == NULL)
    594594                return NULL;
    595        
     595
    596596        /* Force zero to all uninitialized fields (e.g. added in future) */
    597597        if (nic_rxc_init(&nic_data->rx_control) != EOK) {
    598598                return NULL;
    599599        }
    600        
     600
    601601        if (nic_wol_virtues_init(&nic_data->wol_virtues) != EOK) {
    602602                return NULL;
    603603        }
    604        
     604
    605605        nic_data->dev = NULL;
    606606        nic_data->fun = NULL;
     
    614614        nic_data->on_stopping = NULL;
    615615        nic_data->specific = NULL;
    616        
     616
    617617        fibril_rwlock_initialize(&nic_data->main_lock);
    618618        fibril_rwlock_initialize(&nic_data->stats_lock);
    619619        fibril_rwlock_initialize(&nic_data->rxc_lock);
    620620        fibril_rwlock_initialize(&nic_data->wv_lock);
    621        
     621
    622622        memset(&nic_data->mac, 0, sizeof(nic_address_t));
    623623        memset(&nic_data->default_mac, 0, sizeof(nic_address_t));
    624624        memset(&nic_data->stats, 0, sizeof(nic_device_stats_t));
    625        
     625
    626626        return nic_data;
    627627}
     
    642642        if (!nic_data)
    643643                return NULL;
    644        
     644
    645645        nic_data->dev = device;
    646        
     646
    647647        return nic_data;
    648648}
     
    943943        if (count == 0)
    944944                return;
    945        
     945
    946946        fibril_rwlock_write_lock(&nic_data->stats_lock);
    947947        nic_data->stats.send_errors += count;
     
    10791079                        }
    10801080                        async_usleep(wait);
    1081                        
     1081
    10821082                        /* Check if the period was not reset */
    10831083                        if (info->run != run)
    10841084                                break;
    10851085                }
    1086                
     1086
    10871087                /* Provide polling if the period finished */
    10881088                fibril_rwlock_read_lock(&nic->main_lock);
Note: See TracChangeset for help on using the changeset viewer.