Changeset 8a64320e in mainline for uspace/drv/nic/ar9271/htc.c


Ignore:
Timestamp:
2015-04-23T23:40:14Z (10 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
dcba819
Parents:
09044cb
Message:

pre-merge coding style cleanup and code review

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/nic/ar9271/htc.c

    r09044cb r8a64320e  
    3636#include <byteorder.h>
    3737#include <errno.h>
    38 
    3938#include "wmi.h"
    4039#include "htc.h"
     
    4241#include "ar9271.h"
    4342
    44 /**
    45  * HTC download pipes mapping.
    46  *
     43/** HTC download pipes mapping.
     44 *
    4745 * @param service_id Identification of WMI service.
    48  * 
     46 *
    4947 * @return Number of pipe used for this service.
     48 *
    5049 */
    5150static inline uint8_t wmi_service_to_download_pipe(wmi_services_t service_id)
     
    5453}
    5554
    56 /**
    57  * HTC upload pipes mapping.
    58  *
     55/** HTC upload pipes mapping.
     56 *
    5957 * @param service_id Identification of WMI service.
    60  * 
     58 *
    6159 * @return Number of pipe used for this service.
     60 *
    6261 */
    6362static inline uint8_t wmi_service_to_upload_pipe(wmi_services_t service_id)
     
    7574       
    7675        nic_address_t addr;
    77         nic_t *nic =
    78                 nic_get_from_ddf_dev(
    79                         ieee80211_get_ddf_dev(htc_device->ieee80211_dev)
    80                 );
     76        nic_t *nic =
     77            nic_get_from_ddf_dev(ieee80211_get_ddf_dev(htc_device->ieee80211_dev));
    8178        nic_query_address(nic, &addr);
    8279       
     
    8481        memcpy(&sta_msg.addr, &addr.address, ETH_ADDR);
    8582       
    86         ieee80211_operating_mode_t op_mode = 
    87                 ieee80211_query_current_op_mode(htc_device->ieee80211_dev);
    88        
    89         switch(op_mode) {
    90                 case IEEE80211_OPMODE_ADHOC:
    91                         vif_msg.op_mode = HTC_OPMODE_ADHOC;
    92                         break;
    93                 case IEEE80211_OPMODE_AP:
    94                         vif_msg.op_mode = HTC_OPMODE_AP;
    95                         break;
    96                 case IEEE80211_OPMODE_MESH:
    97                         vif_msg.op_mode = HTC_OPMODE_MESH;
    98                         break;
    99                 case IEEE80211_OPMODE_STATION:
    100                         vif_msg.op_mode = HTC_OPMODE_STATION;
    101                         break;
     83        ieee80211_operating_mode_t op_mode =
     84            ieee80211_query_current_op_mode(htc_device->ieee80211_dev);
     85       
     86        switch (op_mode) {
     87        case IEEE80211_OPMODE_ADHOC:
     88                vif_msg.op_mode = HTC_OPMODE_ADHOC;
     89                break;
     90        case IEEE80211_OPMODE_AP:
     91                vif_msg.op_mode = HTC_OPMODE_AP;
     92                break;
     93        case IEEE80211_OPMODE_MESH:
     94                vif_msg.op_mode = HTC_OPMODE_MESH;
     95                break;
     96        case IEEE80211_OPMODE_STATION:
     97                vif_msg.op_mode = HTC_OPMODE_STATION;
     98                break;
    10299        }
    103100       
     
    105102        vif_msg.rts_thres = host2uint16_t_be(HTC_RTS_THRESHOLD);
    106103       
    107         wmi_send_command(htc_device, WMI_VAP_CREATE, (uint8_t *) &vif_msg, 
    108                 sizeof(vif_msg), NULL);
     104        wmi_send_command(htc_device, WMI_VAP_CREATE, (uint8_t *) &vif_msg,
     105            sizeof(vif_msg), NULL);
    109106       
    110107        sta_msg.is_vif_sta = 1;
     
    113110        sta_msg.vif_index = 0;
    114111       
    115         wmi_send_command(htc_device, WMI_NODE_CREATE, (uint8_t *) &sta_msg, 
    116                 sizeof(sta_msg), NULL);
     112        wmi_send_command(htc_device, WMI_NODE_CREATE, (uint8_t *) &sta_msg,
     113            sizeof(sta_msg), NULL);
    117114       
    118115        /* Write first 4 bytes of MAC address. */
     
    121118        id0 = host2uint32_t_le(id0);
    122119        wmi_reg_write(htc_device, AR9271_STATION_ID0, id0);
    123 
     120       
    124121        /* Write last 2 bytes of MAC address (and preserve existing data). */
    125122        uint32_t id1;
    126123        wmi_reg_read(htc_device, AR9271_STATION_ID1, &id1);
    127 
     124       
    128125        uint16_t id1_addr;
    129126        memcpy(&id1_addr, &addr.address[4], 2);
     
    134131}
    135132
    136 static void htc_config_frame_header(htc_frame_header_t *header, 
    137         size_t buffer_size, uint8_t endpoint_id)
     133static void htc_config_frame_header(htc_frame_header_t *header,
     134    size_t buffer_size, uint8_t endpoint_id)
    138135{
    139136        memset(header, 0, sizeof(htc_frame_header_t));
    140137       
    141138        header->endpoint_id = endpoint_id;
    142         header->payload_length =
    143                 host2uint16_t_be(buffer_size - sizeof(htc_frame_header_t));
    144 }
    145 
    146 /**
    147  * Send control HTC message to USB device.
    148  *
    149  * @param htc_device HTC device structure.
    150  * @param buffer Buffer with data to be sent to USB device (without HTC frame
    151  *              header).
     139        header->payload_length =
     140            host2uint16_t_be(buffer_size - sizeof(htc_frame_header_t));
     141}
     142
     143/** Send control HTC message to USB device.
     144 *
     145 * @param htc_device  HTC device structure.
     146 * @param buffer      Buffer with data to be sent to USB device
     147 *                    (without HTC frame header).
    152148 * @param buffer_size Size of buffer (including HTC frame header).
    153149 * @param endpoint_id Destination endpoint.
    154  *
    155  * @return EOK if succeed, negative error code otherwise.
    156  */
    157 int htc_send_control_message(htc_device_t *htc_device, void *buffer,
    158         size_t buffer_size, uint8_t endpoint_id)
     150 *
     151 * @return EOK if succeed, negative error code otherwise.
     152 *
     153 */
     154int htc_send_control_message(htc_device_t *htc_device, void *buffer,
     155    size_t buffer_size, uint8_t endpoint_id)
    159156{
    160157        htc_config_frame_header((htc_frame_header_t *) buffer, buffer_size,
    161                 endpoint_id);
     158            endpoint_id);
    162159       
    163160        ath_t *ath_device = htc_device->ath_device;
    164161       
    165         return ath_device->ops->send_ctrl_message(ath_device, buffer,
    166                 buffer_size);
    167 }
    168 
    169 /**
    170  * Send data HTC message to USB device.
    171  *
    172  * @param htc_device HTC device structure.
    173  * @param buffer Buffer with data to be sent to USB device (without HTC frame
    174  *              header).
     162        return ath_device->ops->send_ctrl_message(ath_device, buffer,
     163            buffer_size);
     164}
     165
     166/** Send data HTC message to USB device.
     167 *
     168 * @param htc_device  HTC device structure.
     169 * @param buffer      Buffer with data to be sent to USB device
     170 *                    (without HTC frame header).
    175171 * @param buffer_size Size of buffer (including HTC frame header).
    176172 * @param endpoint_id Destination endpoint.
    177  *
    178  * @return EOK if succeed, negative error code otherwise.
    179  */
    180 int htc_send_data_message(htc_device_t *htc_device, void *buffer,
    181         size_t buffer_size, uint8_t endpoint_id)
     173 *
     174 * @return EOK if succeed, negative error code otherwise.
     175 *
     176 */
     177int htc_send_data_message(htc_device_t *htc_device, void *buffer,
     178    size_t buffer_size, uint8_t endpoint_id)
    182179{
    183180        htc_config_frame_header((htc_frame_header_t *) buffer, buffer_size,
    184                 endpoint_id);
     181            endpoint_id);
    185182       
    186183        ath_t *ath_device = htc_device->ath_device;
    187184       
    188         return ath_device->ops->send_data_message(ath_device, buffer, 
    189                 buffer_size);
    190 }
    191 
    192 /**
    193  * Read HTC data message from USB device.
    194  *
    195  * @param htc_device HTC device structure.
    196  * @param buffer Buffer where data from USB device will be stored.
    197  * @param buffer_size Size of buffer.
     185        return ath_device->ops->send_data_message(ath_device, buffer,
     186            buffer_size);
     187}
     188
     189/** Read HTC data message from USB device.
     190 *
     191 * @param htc_device       HTC device structure.
     192 * @param buffer           Buffer where data from USB device
     193 *                         will be stored.
     194 * @param buffer_size      Size of buffer.
    198195 * @param transferred_size Real size of read data.
    199  *
    200  * @return EOK if succeed, negative error code otherwise.
    201  */
    202 int htc_read_data_message(htc_device_t *htc_device, void *buffer,
    203         size_t buffer_size, size_t *transferred_size)
     196 *
     197 * @return EOK if succeed, negative error code otherwise.
     198 *
     199 */
     200int htc_read_data_message(htc_device_t *htc_device, void *buffer,
     201    size_t buffer_size, size_t *transferred_size)
    204202{
    205203        ath_t *ath_device = htc_device->ath_device;
    206204       
    207         return ath_device->ops->read_data_message(ath_device, buffer, 
    208                 buffer_size, transferred_size);
    209 }
    210 
    211 /**
    212  * Read HTC control message from USB device.
    213  *
    214  * @param htc_device HTC device structure.
    215  * @param buffer Buffer where data from USB device will be stored.
    216  * @param buffer_size Size of buffer.
     205        return ath_device->ops->read_data_message(ath_device, buffer,
     206            buffer_size, transferred_size);
     207}
     208
     209/** Read HTC control message from USB device.
     210 *
     211 * @param htc_device       HTC device structure.
     212 * @param buffer           Buffer where data from USB device
     213 *                         will be stored.
     214 * @param buffer_size      Size of buffer.
    217215 * @param transferred_size Real size of read data.
    218  *
    219  * @return EOK if succeed, negative error code otherwise.
    220  */
    221 int htc_read_control_message(htc_device_t *htc_device, void *buffer,
    222         size_t buffer_size, size_t *transferred_size)
     216 *
     217 * @return EOK if succeed, negative error code otherwise.
     218 *
     219 */
     220int htc_read_control_message(htc_device_t *htc_device, void *buffer,
     221    size_t buffer_size, size_t *transferred_size)
    223222{
    224223        ath_t *ath_device = htc_device->ath_device;
    225224       
    226         return ath_device->ops->read_ctrl_message(ath_device, buffer,
    227                 buffer_size, transferred_size);
    228 }
    229 
    230 /**
    231  * Initialize HTC service.
    232  *
    233  * @param htc_device HTC device structure.
    234  * @param service_id Identification of WMI service.
    235  * @param response_endpoint_no HTC endpoint to be used for this service.
    236  *
    237  * @return EOK if succeed, EINVAL when failed to connect service,
    238  * negative error code otherwise.
    239  */
    240 static int htc_connect_service(htc_device_t *htc_device,
     225        return ath_device->ops->read_ctrl_message(ath_device, buffer,
     226            buffer_size, transferred_size);
     227}
     228
     229/** Initialize HTC service.
     230 *
     231 * @param htc_device           HTC device structure.
     232 * @param service_id           Identification of WMI service.
     233 * @param response_endpoint_no HTC endpoint to be used for
     234 *                             this service.
     235 *
     236 * @return EOK if succeed, EINVAL when failed to connect service,
     237 *         negative error code otherwise.
     238 *
     239 */
     240static int htc_connect_service(htc_device_t *htc_device,
    241241    wmi_services_t service_id, int *response_endpoint_no)
    242242{
    243         size_t buffer_size = sizeof(htc_frame_header_t) + 
    244                 sizeof(htc_service_msg_t);
     243        size_t buffer_size = sizeof(htc_frame_header_t) +
     244            sizeof(htc_service_msg_t);
    245245        void *buffer = malloc(buffer_size);
    246246        memset(buffer, 0, buffer_size);
     
    248248        /* Fill service message structure. */
    249249        htc_service_msg_t *service_message = (htc_service_msg_t *)
    250                 ((void *) buffer + sizeof(htc_frame_header_t));
    251         service_message->service_id = 
    252                 host2uint16_t_be(service_id);
    253         service_message->message_id = 
    254                 host2uint16_t_be(HTC_MESSAGE_CONNECT_SERVICE);
    255         service_message->download_pipe_id = 
    256                 wmi_service_to_download_pipe(service_id);
    257         service_message->upload_pipe_id = 
    258                 wmi_service_to_upload_pipe(service_id);
     250            ((void *) buffer + sizeof(htc_frame_header_t));
     251        service_message->service_id =
     252            host2uint16_t_be(service_id);
     253        service_message->message_id =
     254            host2uint16_t_be(HTC_MESSAGE_CONNECT_SERVICE);
     255        service_message->download_pipe_id =
     256            wmi_service_to_download_pipe(service_id);
     257        service_message->upload_pipe_id =
     258            wmi_service_to_upload_pipe(service_id);
    259259        service_message->connection_flags = 0;
    260260       
    261261        /* Send HTC message. */
    262262        int rc = htc_send_control_message(htc_device, buffer, buffer_size,
    263                 htc_device->endpoints.ctrl_endpoint);
    264         if(rc != EOK) {
     263            htc_device->endpoints.ctrl_endpoint);
     264        if (rc != EOK) {
    265265                free(buffer);
    266266                usb_log_error("Failed to send HTC message. Error: %d\n", rc);
     
    275275        /* Read response from device. */
    276276        rc = htc_read_control_message(htc_device, buffer, buffer_size, NULL);
    277         if(rc != EOK) {
     277        if (rc != EOK) {
    278278                free(buffer);
    279279                usb_log_error("Failed to receive HTC service connect response. "
    280                         "Error: %d\n", rc);
     280                    "Error: %d\n", rc);
    281281                return rc;
    282282        }
    283283       
    284284        htc_service_resp_msg_t *response_message = (htc_service_resp_msg_t *)
    285                 ((void *) buffer + sizeof(htc_frame_header_t));
    286 
    287         /* If service was successfully connected, write down HTC endpoint number
    288          * that will be used for communication. */
    289         if(response_message->status == HTC_SERVICE_SUCCESS) {
     285            ((void *) buffer + sizeof(htc_frame_header_t));
     286       
     287        /*
     288         * If service was successfully connected,
     289         * write down HTC endpoint number that will
     290         * be used for communication.
     291         */
     292        if (response_message->status == HTC_SERVICE_SUCCESS) {
    290293                *response_endpoint_no = response_message->endpoint_id;
    291294                rc = EOK;
    292295        } else {
    293296                usb_log_error("Failed to connect HTC service. "
    294                         "Message status: %d\n", response_message->status);
     297                    "Message status: %d\n", response_message->status);
    295298                rc = EINVAL;
    296         }
     299        }
    297300       
    298301        free(buffer);
     
    301304}
    302305
    303 /**
    304  * HTC credits initialization message.
    305  *
     306/** HTC credits initialization message.
     307 *
    306308 * @param htc_device HTC device structure.
    307  *
    308  * @return EOK if succeed, negative error code otherwise.
     309 *
     310 * @return EOK if succeed, negative error code otherwise.
     311 *
    309312 */
    310313static int htc_config_credits(htc_device_t *htc_device)
    311314{
    312         size_t buffer_size = sizeof(htc_frame_header_t) + 
    313                 sizeof(htc_config_msg_t);
     315        size_t buffer_size = sizeof(htc_frame_header_t) +
     316            sizeof(htc_config_msg_t);
    314317        void *buffer = malloc(buffer_size);
    315318        htc_config_msg_t *config_message = (htc_config_msg_t *)
    316                 ((void *) buffer + sizeof(htc_frame_header_t));
     319            ((void *) buffer + sizeof(htc_frame_header_t));
    317320       
    318321        config_message->message_id =
    319                 host2uint16_t_be(HTC_MESSAGE_CONFIG);
     322            host2uint16_t_be(HTC_MESSAGE_CONFIG);
    320323        /* Magic number to initialize device. */
    321324        config_message->credits = 33;
    322325        config_message->pipe_id = 1;
    323 
     326       
    324327        /* Send HTC message. */
    325328        int rc = htc_send_control_message(htc_device, buffer, buffer_size,
    326                 htc_device->endpoints.ctrl_endpoint);
    327         if(rc != EOK) {
     329            htc_device->endpoints.ctrl_endpoint);
     330        if (rc != EOK) {
    328331                free(buffer);
    329332                usb_log_error("Failed to send HTC config message. "
    330                         "Error: %d\n", rc);
     333                    "Error: %d\n", rc);
    331334                return rc;
    332335        }
     
    336339        buffer_size = htc_device->ath_device->ctrl_response_length;
    337340        buffer = malloc(buffer_size);
    338 
     341       
    339342        /* Check response from device. */
    340343        rc = htc_read_control_message(htc_device, buffer, buffer_size, NULL);
    341         if(rc != EOK) {
     344        if (rc != EOK) {
    342345                usb_log_error("Failed to receive HTC config response message. "
    343                         "Error: %d\n", rc);
     346                    "Error: %d\n", rc);
    344347        }
    345348       
    346349        free(buffer);
    347 
     350       
    348351        return rc;
    349352}
    350353
    351 /**
    352  * HTC setup complete confirmation message.
    353  *
     354/** HTC setup complete confirmation message.
     355 *
    354356 * @param htc_device HTC device structure.
    355  *
    356  * @return EOK if succeed, negative error code otherwise.
     357 *
     358 * @return EOK if succeed, negative error code otherwise.
     359 *
    357360 */
    358361static int htc_complete_setup(htc_device_t *htc_device)
    359362{
    360         size_t buffer_size = sizeof(htc_frame_header_t) + 
    361                 sizeof(htc_setup_complete_msg_t);
     363        size_t buffer_size = sizeof(htc_frame_header_t) +
     364            sizeof(htc_setup_complete_msg_t);
    362365        void *buffer = malloc(buffer_size);
    363         htc_setup_complete_msg_t *complete_message = 
    364                 (htc_setup_complete_msg_t *)
    365                 ((void *) buffer + sizeof(htc_frame_header_t));
    366        
    367         complete_message->message_id = 
    368                 host2uint16_t_be(HTC_MESSAGE_SETUP_COMPLETE);
    369 
     366        htc_setup_complete_msg_t *complete_message =
     367            (htc_setup_complete_msg_t *)
     368            ((void *) buffer + sizeof(htc_frame_header_t));
     369       
     370        complete_message->message_id =
     371            host2uint16_t_be(HTC_MESSAGE_SETUP_COMPLETE);
     372       
    370373        /* Send HTC message. */
    371         int rc = htc_send_control_message(htc_device, buffer, buffer_size, 
    372                 htc_device->endpoints.ctrl_endpoint);
    373         if(rc != EOK) {
     374        int rc = htc_send_control_message(htc_device, buffer, buffer_size,
     375            htc_device->endpoints.ctrl_endpoint);
     376        if (rc != EOK)
    374377                usb_log_error("Failed to send HTC setup complete message. "
    375                         "Error: %d\n", rc);
    376         }
     378                    "Error: %d\n", rc);
    377379       
    378380        free(buffer);
    379 
     381       
    380382        return rc;
    381383}
    382384
    383 /**
    384  * Try to fetch ready message from device.
     385/** Try to fetch ready message from device.
     386 *
    385387 * Checks that firmware was successfully loaded on device side.
    386  * 
     388 *
    387389 * @param htc_device HTC device structure.
    388  *
    389  * @return EOK if succeed, EINVAL if response error, negative error code
    390  * otherwise.
     390 *
     391 * @return EOK if succeed, EINVAL if response error,
     392 *         negative error code otherwise.
     393 *
    391394 */
    392395static int htc_check_ready(htc_device_t *htc_device)
     
    394397        size_t buffer_size = htc_device->ath_device->ctrl_response_length;
    395398        void *buffer = malloc(buffer_size);
    396 
     399       
    397400        /* Read response from device. */
    398         int rc = htc_read_control_message(htc_device, buffer, buffer_size, 
    399                 NULL);
    400         if(rc != EOK) {
     401        int rc = htc_read_control_message(htc_device, buffer, buffer_size,
     402            NULL);
     403        if (rc != EOK) {
    401404                free(buffer);
    402405                usb_log_error("Failed to receive HTC check ready message. "
    403                         "Error: %d\n", rc);
    404                 return rc;
    405         }
    406 
    407         uint16_t *message_id = (uint16_t *) ((void *) buffer + 
    408                 sizeof(htc_frame_header_t));
    409         if(uint16_t_be2host(*message_id) == HTC_MESSAGE_READY) {
     406                    "Error: %d\n", rc);
     407                return rc;
     408        }
     409       
     410        uint16_t *message_id = (uint16_t *) ((void *) buffer +
     411            sizeof(htc_frame_header_t));
     412        if (uint16_t_be2host(*message_id) == HTC_MESSAGE_READY)
    410413                rc = EOK;
    411         } else {
     414        else
    412415                rc = EINVAL;
    413         }
    414416       
    415417        free(buffer);
     
    418420}
    419421
    420 /**
    421  * Initialize HTC device structure.
    422  *
    423  * @param ath_device Atheros WiFi device connected with this HTC device.
     422/** Initialize HTC device structure.
     423 *
     424 * @param ath_device Atheros WiFi device connected
     425 *                   with this HTC device.
    424426 * @param htc_device HTC device structure to be initialized.
    425  *
    426  * @return EOK if succeed, negative error code otherwise.
    427  */
    428 int htc_device_init(ath_t *ath_device, ieee80211_dev_t *ieee80211_dev,
    429         htc_device_t *htc_device)
     427 *
     428 * @return EOK if succeed, negative error code otherwise.
     429 *
     430 */
     431int htc_device_init(ath_t *ath_device, ieee80211_dev_t *ieee80211_dev,
     432    htc_device_t *htc_device)
    430433{
    431434        fibril_mutex_initialize(&htc_device->rx_lock);
     
    440443}
    441444
    442 /**
    443  * HTC communication initalization.
    444  *
     445/** HTC communication initalization.
     446 *
    445447 * @param htc_device HTC device structure.
    446  *
    447  * @return EOK if succeed, negative error code otherwise.
     448 *
     449 * @return EOK if succeed, negative error code otherwise.
     450 *
    448451 */
    449452int htc_init(htc_device_t *htc_device)
     
    451454        /* First check ready message in device. */
    452455        int rc = htc_check_ready(htc_device);
    453         if(rc != EOK) {
     456        if (rc != EOK) {
    454457                usb_log_error("Device is not in ready state after loading "
    455                         "firmware.\n");
    456                 return rc;
    457         }
    458 
    459         /* 
     458                    "firmware.\n");
     459                return rc;
     460        }
     461       
     462        /*
    460463         * HTC services initialization start.
    461          *
    462464         */
    463        
    464465        rc = htc_connect_service(htc_device, WMI_CONTROL_SERVICE,
    465466            &htc_device->endpoints.wmi_endpoint);
    466         if(rc != EOK) {
     467        if (rc != EOK) {
    467468                usb_log_error("Error while initalizing WMI service.\n");
    468469                return rc;
    469470        }
    470 
     471       
    471472        rc = htc_connect_service(htc_device, WMI_BEACON_SERVICE,
    472473            &htc_device->endpoints.beacon_endpoint);
    473         if(rc != EOK) {
     474        if (rc != EOK) {
    474475                usb_log_error("Error while initalizing beacon service.\n");
    475476                return rc;
    476477        }
    477 
     478       
    478479        rc = htc_connect_service(htc_device, WMI_CAB_SERVICE,
    479480            &htc_device->endpoints.cab_endpoint);
    480         if(rc != EOK) {
     481        if (rc != EOK) {
    481482                usb_log_error("Error while initalizing CAB service.\n");
    482483                return rc;
    483484        }
    484 
     485       
    485486        rc = htc_connect_service(htc_device, WMI_UAPSD_SERVICE,
    486487            &htc_device->endpoints.uapsd_endpoint);
    487         if(rc != EOK) {
     488        if (rc != EOK) {
    488489                usb_log_error("Error while initalizing UAPSD service.\n");
    489490                return rc;
    490491        }
    491 
     492       
    492493        rc = htc_connect_service(htc_device, WMI_MGMT_SERVICE,
    493494            &htc_device->endpoints.mgmt_endpoint);
    494         if(rc != EOK) {
     495        if (rc != EOK) {
    495496                usb_log_error("Error while initalizing MGMT service.\n");
    496497                return rc;
     
    499500        rc = htc_connect_service(htc_device, WMI_DATA_BE_SERVICE,
    500501            &htc_device->endpoints.data_be_endpoint);
    501         if(rc != EOK) {
     502        if (rc != EOK) {
    502503                usb_log_error("Error while initalizing data best effort "
    503504                    "service.\n");
    504505                return rc;
    505506        }
    506 
     507       
    507508        rc = htc_connect_service(htc_device, WMI_DATA_BK_SERVICE,
    508509            &htc_device->endpoints.data_bk_endpoint);
    509         if(rc != EOK) {
     510        if (rc != EOK) {
    510511                usb_log_error("Error while initalizing data background "
    511512                    "service.\n");
    512513                return rc;
    513514        }
    514 
     515       
    515516        rc = htc_connect_service(htc_device, WMI_DATA_VIDEO_SERVICE,
    516517            &htc_device->endpoints.data_video_endpoint);
    517         if(rc != EOK) {
     518        if (rc != EOK) {
    518519                usb_log_error("Error while initalizing data video service.\n");
    519520                return rc;
     
    522523        rc = htc_connect_service(htc_device, WMI_DATA_VOICE_SERVICE,
    523524            &htc_device->endpoints.data_voice_endpoint);
    524         if(rc != EOK) {
     525        if (rc != EOK) {
    525526                usb_log_error("Error while initalizing data voice service.\n");
    526527                return rc;
    527528        }
    528 
    529         /* 
     529       
     530        /*
    530531         * HTC services initialization end.
    531          *
    532532         */
    533 
     533       
    534534        /* Credits initialization message. */
    535535        rc = htc_config_credits(htc_device);
    536         if(rc != EOK) {
     536        if (rc != EOK) {
    537537                usb_log_error("Failed to send HTC config message.\n");
    538538                return rc;
    539539        }
    540 
     540       
    541541        /* HTC setup complete confirmation message. */
    542542        rc = htc_complete_setup(htc_device);
    543         if(rc != EOK) {
     543        if (rc != EOK) {
    544544                usb_log_error("Failed to send HTC complete setup message.\n");
    545545                return rc;
    546546        }
    547 
     547       
    548548        usb_log_info("HTC services initialization finished successfully.\n");
    549549       
Note: See TracChangeset for help on using the changeset viewer.