Ignore:
Timestamp:
2010-11-25T13:42:50Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8df8415
Parents:
a93d79a (diff), eb667613 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    ra93d79a r8fb1bf82  
    103103        netif_device_t * device;
    104104        dpeth_t * dep;
    105         packet_t received;
     105        packet_t *received;
    106106        device_id_t device_id;
    107107        int phone;
     
    127127                dep->received_count = 0;
    128128                fibril_rwlock_write_unlock(&netif_globals.lock);
    129                 nil_received_msg(phone, device_id, received, NULL);
     129                nil_received_msg(phone, device_id, received, SERVICE_NONE);
    130130        }else{
    131131                fibril_rwlock_write_unlock(&netif_globals.lock);
     
    157157}
    158158
    159 int netif_get_device_stats(device_id_t device_id, device_stats_ref stats){
    160         ERROR_DECLARE;
    161 
     159int netif_get_device_stats(device_id_t device_id, device_stats_t *stats)
     160{
    162161        netif_device_t * device;
    163162        eth_stat_t * de_stat;
     163        int rc;
    164164
    165165        if(! stats){
    166166                return EBADMEM;
    167167        }
    168         ERROR_PROPAGATE(find_device(device_id, &device));
     168        rc = find_device(device_id, &device);
     169        if (rc != EOK)
     170                return rc;
    169171        de_stat = &((dpeth_t *) device->specific)->de_stat;
    170172        null_device_stats(stats);
     
    184186}
    185187
    186 int netif_get_addr_message(device_id_t device_id, measured_string_ref address){
    187         ERROR_DECLARE;
    188 
    189         netif_device_t * device;
     188int netif_get_addr_message(device_id_t device_id, measured_string_t *address){
     189        netif_device_t * device;
     190        int rc;
    190191
    191192        if(! address){
    192193                return EBADMEM;
    193194        }
    194         ERROR_PROPAGATE(find_device(device_id, &device));
     195        rc = find_device(device_id, &device);
     196        if (rc != EOK)
     197                return rc;
    195198        address->value = (char *) (&((dpeth_t *) device->specific)->de_address);
    196199        address->length = CONVERT_SIZE(ether_addr_t, char, 1);
     
    201204
    202205int netif_probe_message(device_id_t device_id, int irq, uintptr_t io){
    203         ERROR_DECLARE;
    204 
    205         netif_device_t * device;
    206         dpeth_t * dep;
     206        netif_device_t * device;
     207        dpeth_t * dep;
     208        int rc;
    207209
    208210        device = (netif_device_t *) malloc(sizeof(netif_device_t));
     
    224226        dep->de_mode = DEM_DISABLED;
    225227        //TODO address?
    226         if(ERROR_OCCURRED(pio_enable((void *) io, DP8390_IO_SIZE, (void **) &dep->de_base_port))
    227                 || ERROR_OCCURRED(do_probe(dep))){
     228        rc = pio_enable((void *) io, DP8390_IO_SIZE, (void **) &dep->de_base_port);
     229        if (rc != EOK) {
    228230                free(dep);
    229231                free(device);
    230                 return ERROR_CODE;
    231         }
    232         if(ERROR_OCCURRED(netif_device_map_add(&netif_globals.device_map, device->device_id, device))){
     232                return rc;
     233        }       
     234        rc = do_probe(dep);
     235        if (rc != EOK) {
    233236                free(dep);
    234237                free(device);
    235                 return ERROR_CODE;
    236         }
    237         return EOK;
    238 }
    239 
    240 int netif_send_message(device_id_t device_id, packet_t packet, services_t sender){
    241         ERROR_DECLARE;
    242 
    243         netif_device_t * device;
    244         dpeth_t * dep;
    245         packet_t next;
    246 
    247         ERROR_PROPAGATE(find_device(device_id, &device));
     238                return rc;
     239        }
     240        rc = netif_device_map_add(&netif_globals.device_map, device->device_id, device);
     241        if (rc != EOK){
     242                free(dep);
     243                free(device);
     244                return rc;
     245        }
     246        return EOK;
     247}
     248
     249int netif_send_message(device_id_t device_id, packet_t *packet, services_t sender){
     250        netif_device_t * device;
     251        dpeth_t * dep;
     252        packet_t *next;
     253        int rc;
     254
     255        rc = find_device(device_id, &device);
     256        if (rc != EOK)
     257                return rc;
    248258        if(device->state != NETIF_ACTIVE){
    249259                netif_pq_release(packet_get_id(packet));
     
    263273
    264274int netif_start_message(netif_device_t * device){
    265         ERROR_DECLARE;
    266 
    267         dpeth_t * dep;
     275        dpeth_t * dep;
     276        int rc;
    268277
    269278        if(device->state != NETIF_ACTIVE){
     
    271280                dp8390_cmds[0].addr = (void *) (uintptr_t) (dep->de_dp8390_port + DP_ISR);
    272281                dp8390_cmds[2].addr = dp8390_cmds[0].addr;
    273                 ERROR_PROPAGATE(ipc_register_irq(dep->de_irq, device->device_id, device->device_id, &dp8390_code));
    274                 if(ERROR_OCCURRED(do_init(dep, DL_BROAD_REQ))){
     282                rc = ipc_register_irq(dep->de_irq, device->device_id, device->device_id, &dp8390_code);
     283                if (rc != EOK)
     284                        return rc;
     285                rc = do_init(dep, DL_BROAD_REQ);
     286                if (rc != EOK) {
    275287                        ipc_unregister_irq(dep->de_irq, device->device_id);
    276                         return ERROR_CODE;
     288                        return rc;
    277289                }
    278290                return change_state(device, NETIF_ACTIVE);
     
    350362int main(int argc, char *argv[])
    351363{
    352         ERROR_DECLARE;
     364        int rc;
    353365       
    354366        /* Start the module */
    355         if (ERROR_OCCURRED(netif_module_start(netif_client_connection)))
    356                 return ERROR_CODE;
    357        
    358         return EOK;
     367        rc = netif_module_start(netif_client_connection);
     368        return rc;
    359369}
    360370
Note: See TracChangeset for help on using the changeset viewer.