Changeset a35b458 in mainline for uspace/drv/nic/ar9271/htc.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/drv/nic/ar9271/htc.c

    r3061bc1 ra35b458  
    7070        htc_vif_msg_t vif_msg;
    7171        htc_sta_msg_t sta_msg;
    72        
     72
    7373        memset(&vif_msg, 0, sizeof(htc_vif_msg_t));
    7474        memset(&sta_msg, 0, sizeof(htc_sta_msg_t));
    75        
     75
    7676        nic_address_t addr;
    7777        nic_t *nic =
    7878            nic_get_from_ddf_dev(ieee80211_get_ddf_dev(htc_device->ieee80211_dev));
    7979        nic_query_address(nic, &addr);
    80        
     80
    8181        memcpy(&vif_msg.addr, &addr.address, ETH_ADDR);
    8282        memcpy(&sta_msg.addr, &addr.address, ETH_ADDR);
    83        
     83
    8484        ieee80211_operating_mode_t op_mode =
    8585            ieee80211_query_current_op_mode(htc_device->ieee80211_dev);
    86        
     86
    8787        switch (op_mode) {
    8888        case IEEE80211_OPMODE_ADHOC:
     
    9999                break;
    100100        }
    101        
     101
    102102        vif_msg.index = 0;
    103103        vif_msg.rts_thres = host2uint16_t_be(HTC_RTS_THRESHOLD);
    104        
     104
    105105        wmi_send_command(htc_device, WMI_VAP_CREATE, (uint8_t *) &vif_msg,
    106106            sizeof(vif_msg), NULL);
    107        
     107
    108108        sta_msg.is_vif_sta = 1;
    109109        sta_msg.max_ampdu = host2uint16_t_be(0xFFFF);
    110110        sta_msg.sta_index = 0;
    111111        sta_msg.vif_index = 0;
    112        
     112
    113113        wmi_send_command(htc_device, WMI_NODE_CREATE, (uint8_t *) &sta_msg,
    114114            sizeof(sta_msg), NULL);
    115        
     115
    116116        /* Write first 4 bytes of MAC address. */
    117117        uint32_t id0;
     
    119119        id0 = host2uint32_t_le(id0);
    120120        wmi_reg_write(htc_device, AR9271_STATION_ID0, id0);
    121        
     121
    122122        /* Write last 2 bytes of MAC address (and preserve existing data). */
    123123        uint32_t id1;
    124124        wmi_reg_read(htc_device, AR9271_STATION_ID1, &id1);
    125        
     125
    126126        uint16_t id1_addr;
    127127        memcpy(&id1_addr, &addr.address[4], 2);
    128128        id1 = (id1 & ~AR9271_STATION_ID1_MASK) | host2uint16_t_le(id1_addr);
    129129        wmi_reg_write(htc_device, AR9271_STATION_ID1, id1);
    130        
     130
    131131        return EOK;
    132132}
     
    136136{
    137137        memset(header, 0, sizeof(htc_frame_header_t));
    138        
     138
    139139        header->endpoint_id = endpoint_id;
    140140        header->payload_length =
     
    158158        htc_config_frame_header((htc_frame_header_t *) buffer, buffer_size,
    159159            endpoint_id);
    160        
     160
    161161        ath_t *ath_device = htc_device->ath_device;
    162        
     162
    163163        return ath_device->ops->send_ctrl_message(ath_device, buffer,
    164164            buffer_size);
     
    181181        htc_config_frame_header((htc_frame_header_t *) buffer, buffer_size,
    182182            endpoint_id);
    183        
     183
    184184        ath_t *ath_device = htc_device->ath_device;
    185        
     185
    186186        return ath_device->ops->send_data_message(ath_device, buffer,
    187187            buffer_size);
     
    203203{
    204204        ath_t *ath_device = htc_device->ath_device;
    205        
     205
    206206        return ath_device->ops->read_data_message(ath_device, buffer,
    207207            buffer_size, transferred_size);
     
    223223{
    224224        ath_t *ath_device = htc_device->ath_device;
    225        
     225
    226226        return ath_device->ops->read_ctrl_message(ath_device, buffer,
    227227            buffer_size, transferred_size);
     
    246246        void *buffer = malloc(buffer_size);
    247247        memset(buffer, 0, buffer_size);
    248        
     248
    249249        /* Fill service message structure. */
    250250        htc_service_msg_t *service_message = (htc_service_msg_t *)
     
    259259            wmi_service_to_upload_pipe(service_id);
    260260        service_message->connection_flags = 0;
    261        
     261
    262262        /* Send HTC message. */
    263263        errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
     
    268268                return rc;
    269269        }
    270        
     270
    271271        free(buffer);
    272        
     272
    273273        buffer_size = htc_device->ath_device->ctrl_response_length;
    274274        buffer = malloc(buffer_size);
    275        
     275
    276276        /* Read response from device. */
    277277        rc = htc_read_control_message(htc_device, buffer, buffer_size, NULL);
     
    282282                return rc;
    283283        }
    284        
     284
    285285        htc_service_resp_msg_t *response_message = (htc_service_resp_msg_t *)
    286286            ((void *) buffer + sizeof(htc_frame_header_t));
    287        
     287
    288288        /*
    289289         * If service was successfully connected,
     
    299299                rc = EINVAL;
    300300        }
    301        
     301
    302302        free(buffer);
    303        
     303
    304304        return rc;
    305305}
     
    319319        htc_config_msg_t *config_message = (htc_config_msg_t *)
    320320            ((void *) buffer + sizeof(htc_frame_header_t));
    321        
     321
    322322        config_message->message_id =
    323323            host2uint16_t_be(HTC_MESSAGE_CONFIG);
     
    325325        config_message->credits = 33;
    326326        config_message->pipe_id = 1;
    327        
     327
    328328        /* Send HTC message. */
    329329        errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
     
    335335                return rc;
    336336        }
    337        
     337
    338338        free(buffer);
    339        
     339
    340340        buffer_size = htc_device->ath_device->ctrl_response_length;
    341341        buffer = malloc(buffer_size);
    342        
     342
    343343        /* Check response from device. */
    344344        rc = htc_read_control_message(htc_device, buffer, buffer_size, NULL);
     
    347347                    "Error: %s\n", str_error_name(rc));
    348348        }
    349        
     349
    350350        free(buffer);
    351        
     351
    352352        return rc;
    353353}
     
    368368            (htc_setup_complete_msg_t *)
    369369            ((void *) buffer + sizeof(htc_frame_header_t));
    370        
     370
    371371        complete_message->message_id =
    372372            host2uint16_t_be(HTC_MESSAGE_SETUP_COMPLETE);
    373        
     373
    374374        /* Send HTC message. */
    375375        errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
     
    378378                usb_log_error("Failed to send HTC setup complete message. "
    379379                    "Error: %s\n", str_error_name(rc));
    380        
     380
    381381        free(buffer);
    382        
     382
    383383        return rc;
    384384}
     
    398398        size_t buffer_size = htc_device->ath_device->ctrl_response_length;
    399399        void *buffer = malloc(buffer_size);
    400        
     400
    401401        /* Read response from device. */
    402402        errno_t rc = htc_read_control_message(htc_device, buffer, buffer_size,
     
    408408                return rc;
    409409        }
    410        
     410
    411411        uint16_t *message_id = (uint16_t *) ((void *) buffer +
    412412            sizeof(htc_frame_header_t));
     
    415415        else
    416416                rc = EINVAL;
    417        
     417
    418418        free(buffer);
    419        
     419
    420420        return rc;
    421421}
     
    435435        fibril_mutex_initialize(&htc_device->rx_lock);
    436436        fibril_mutex_initialize(&htc_device->tx_lock);
    437        
     437
    438438        htc_device->endpoints.ctrl_endpoint = 0;
    439        
     439
    440440        htc_device->ath_device = ath_device;
    441441        htc_device->ieee80211_dev = ieee80211_dev;
    442        
     442
    443443        return EOK;
    444444}
     
    460460                return rc;
    461461        }
    462        
     462
    463463        /*
    464464         * HTC services initialization start.
     
    470470                return rc;
    471471        }
    472        
     472
    473473        rc = htc_connect_service(htc_device, WMI_BEACON_SERVICE,
    474474            &htc_device->endpoints.beacon_endpoint);
     
    477477                return rc;
    478478        }
    479        
     479
    480480        rc = htc_connect_service(htc_device, WMI_CAB_SERVICE,
    481481            &htc_device->endpoints.cab_endpoint);
     
    484484                return rc;
    485485        }
    486        
     486
    487487        rc = htc_connect_service(htc_device, WMI_UAPSD_SERVICE,
    488488            &htc_device->endpoints.uapsd_endpoint);
     
    491491                return rc;
    492492        }
    493        
     493
    494494        rc = htc_connect_service(htc_device, WMI_MGMT_SERVICE,
    495495            &htc_device->endpoints.mgmt_endpoint);
     
    498498                return rc;
    499499        }
    500        
     500
    501501        rc = htc_connect_service(htc_device, WMI_DATA_BE_SERVICE,
    502502            &htc_device->endpoints.data_be_endpoint);
     
    506506                return rc;
    507507        }
    508        
     508
    509509        rc = htc_connect_service(htc_device, WMI_DATA_BK_SERVICE,
    510510            &htc_device->endpoints.data_bk_endpoint);
     
    514514                return rc;
    515515        }
    516        
     516
    517517        rc = htc_connect_service(htc_device, WMI_DATA_VIDEO_SERVICE,
    518518            &htc_device->endpoints.data_video_endpoint);
     
    521521                return rc;
    522522        }
    523        
     523
    524524        rc = htc_connect_service(htc_device, WMI_DATA_VOICE_SERVICE,
    525525            &htc_device->endpoints.data_voice_endpoint);
     
    528528                return rc;
    529529        }
    530        
     530
    531531        /*
    532532         * HTC services initialization end.
    533533         */
    534        
     534
    535535        /* Credits initialization message. */
    536536        rc = htc_config_credits(htc_device);
     
    539539                return rc;
    540540        }
    541        
     541
    542542        /* HTC setup complete confirmation message. */
    543543        rc = htc_complete_setup(htc_device);
     
    546546                return rc;
    547547        }
    548        
     548
    549549        usb_log_info("HTC services initialization finished successfully.\n");
    550        
     550
    551551        return EOK;
    552552}
Note: See TracChangeset for help on using the changeset viewer.