Ignore:
Timestamp:
2010-04-06T11:41:48Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
14f1db0
Parents:
4dd8529
Message:

more compact network startup messages (usually one line instead of multiple lines)
pass module name as an argument to nil_message() and friends
deeper cstyle changes (replace forward prototypes with proper extern declarations and static functions, change doxygen comments, stick more closely to the 80-column rule, no argument names in header files, spacing, comments, etc.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hw/netif/dp8390/dp8390_module.c

    r4dd8529 r24ab58b3  
    5959/** DP8390 module name.
    6060 */
    61 #define NAME    "dp8390 network interface"
     61#define NAME  "dp8390"
    6262
    6363/** Returns the device from the interrupt call.
     
    302302}
    303303
    304 int change_state(device_ref device, device_state_t state){
    305         device->state = state;
    306         printf("State changed to %s\n", (state == NETIF_ACTIVE) ? "ACTIVE" : "STOPPED");
    307         return state;
     304int change_state(device_ref device, device_state_t state)
     305{
     306        if (device->state != state) {
     307                device->state = state;
     308               
     309                printf("%s: State changed to %s\n", NAME,
     310                    (state == NETIF_ACTIVE) ? "active" : "stopped");
     311               
     312                return state;
     313        }
     314       
     315        return EOK;
    308316}
    309317
     
    346354               
    347355                /* Process the message */
    348                 int res = netif_module_message(callid, &call, &answer, &answer_count);
     356                int res = netif_module_message(NAME, callid, &call, &answer,
     357                    &answer_count);
    349358               
    350359                /* End if said to either by the message or the processing result */
     
    370379        ERROR_DECLARE;
    371380       
    372         /* Print the module label */
    373         printf("Task %d - %s\n", task_get_id(), NAME);
     381        /* Start the module */
     382        if (ERROR_OCCURRED(netif_module_start(netif_client_connection)))
     383                return ERROR_CODE;
    374384       
    375         /* Start the module */
    376         if (ERROR_OCCURRED(netif_module_start(netif_client_connection))) {
    377                 printf(" - ERROR %i\n", ERROR_CODE);
    378                 return ERROR_CODE;
    379         }
    380        
    381385        return EOK;
    382386}
Note: See TracChangeset for help on using the changeset viewer.