Changeset bab6388 in mainline


Ignore:
Timestamp:
2011-02-13T20:23:37Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7df0477e
Parents:
68414f4a
Message:

Small additional cleanup.

Location:
uspace/drv
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/isa/isa.c

    r68414f4a rbab6388  
    341341        }
    342342
    343         val = skip_spaces(end); 
     343        val = skip_spaces(end);
    344344        get_match_id(&id, val);
    345345        if (id == NULL) {
  • uspace/drv/ns8250/ns8250.c

    r68414f4a rbab6388  
    133133static void ns8250_delete(ns8250_t *ns)
    134134{
     135        assert(ns != NULL);
    135136        free(ns);
    136137}
     
    405406 */
    406407static inline void ns8250_port_interrupts_enable(ioport8_t *port)
    407 {       
     408{
    408409        pio_write_8(port + 1, 0x1);     /* Interrupt when data received. */
    409410        pio_write_8(port + 4, 0xB);
     
    803804        }
    804805        fibril_mutex_unlock(&data->mutex);
    805 
     806       
    806807        return res;
    807808}
  • uspace/drv/pciintel/pci.c

    r68414f4a rbab6388  
    111111        pci_bus_t *bus;
    112112       
    113         bus = (pci_bus_t *) malloc(sizeof(pci_bus_t));
    114         if (bus != NULL) {
    115                 memset(bus, 0, sizeof(pci_bus_t));
    116                 fibril_mutex_initialize(&bus->conf_mutex);
    117         }
    118 
     113        bus = (pci_bus_t *) calloc(1, sizeof(pci_bus_t));
     114        if (bus == NULL)
     115                return NULL;
     116       
     117        fibril_mutex_initialize(&bus->conf_mutex);
    119118        return bus;
    120119}
     
    122121static void pci_bus_delete(pci_bus_t *bus)
    123122{
     123        assert(bus != NULL);
    124124        free(bus);
    125125}
     
    228228                add_match_id(&fun->fnode->match_ids, match_id);
    229229        }
    230 
     230       
    231231        /* TODO add more ids (with subsys ids, using class id etc.) */
    232232}
     
    266266 */
    267267int pci_read_bar(pci_fun_t *fun, int addr)
    268 {       
     268{
    269269        /* Value of the BAR */
    270270        uint32_t val, mask;
     
    369369        bool multi;
    370370        uint8_t header_type;
    371 
     371       
    372372        /* We need this early, before registering. */
    373373        fun->fnode = fnode;
     
    485485                async_hangup(dnode->parent_phone);
    486486                return rc;
    487         }       
     487        }
    488488       
    489489        printf(NAME ": conf_addr = %" PRIx64 ".\n",
     
    531531pci_fun_t *pci_fun_new(void)
    532532{
    533         pci_fun_t *res = (pci_fun_t *) malloc(sizeof(pci_fun_t));
    534        
    535         if (res != NULL)
    536                 memset(res, 0, sizeof(pci_fun_t));
     533        pci_fun_t *res;
     534       
     535        res = (pci_fun_t *) calloc(1, sizeof(pci_fun_t));
    537536        return res;
    538537}
     
    547546void pci_fun_delete(pci_fun_t *fun)
    548547{
    549         if (fun != NULL) {
    550                 hw_res_clean_resource_list(&fun->hw_resources);
    551                 free(fun);
    552         }
     548        assert(fun != NULL);
     549        hw_res_clean_resource_list(&fun->hw_resources);
     550        free(fun);
    553551}
    554552
  • uspace/drv/root/root.c

    r68414f4a rbab6388  
    148148        printf(NAME ": root_add_device, device handle=%" PRIun "\n",
    149149            dev->handle);
    150        
     150
    151151        /*
    152152         * Register virtual devices root.
     
    160160        if (EOK != res)
    161161                printf(NAME ": failed to add child device for platform.\n");
    162        
     162
    163163        return res;
    164164}
  • uspace/drv/rootvirt/rootvirt.c

    r68414f4a rbab6388  
    110110
    111111        printf(NAME ": add_device(handle=%d)\n", (int)dev->handle);
    112        
     112
    113113        /*
    114114         * Go through all virtual functions and try to add them.
  • uspace/drv/test1/test1.c

    r68414f4a rbab6388  
    3636#include "test1.h"
    3737
    38 static int add_device(device_t *dev);
     38static int test1_add_device(device_t *dev);
    3939
    4040static driver_ops_t driver_ops = {
    41         .add_device = &add_device
     41        .add_device = &test1_add_device
    4242};
    4343
    44 static driver_t the_driver = {
     44static driver_t test1_driver = {
    4545        .name = NAME,
    4646        .driver_ops = &driver_ops
     
    5555 * @param score Device match score.
    5656 */
    57 static void register_child_verbose(device_t *parent, const char *message,
     57static void register_fun_verbose(device_t *parent, const char *message,
    5858    const char *name, const char *match_id, int match_score)
    5959{
     
    8989 * @return Error code reporting success of the operation.
    9090 */
    91 static int add_device(device_t *dev)
     91static int test1_add_device(device_t *dev)
    9292{
    9393        function_t *fun_a;
     
    108108                add_function_to_class(fun_a, "virt-null");
    109109        } else if (str_cmp(dev->name, "test1") == 0) {
    110                 register_child_verbose(dev, "cloning myself ;-)", "clone",
     110                register_fun_verbose(dev, "cloning myself ;-)", "clone",
    111111                    "virtual&test1", 10);
    112112        } else if (str_cmp(dev->name, "clone") == 0) {
    113                 register_child_verbose(dev, "run by the same task", "child",
     113                register_fun_verbose(dev, "run by the same task", "child",
    114114                    "virtual&test1&child", 10);
    115115        }
     
    123123{
    124124        printf(NAME ": HelenOS test1 virtual device driver\n");
    125         return driver_main(&the_driver);
     125        return driver_main(&test1_driver);
    126126}
    127127
  • uspace/drv/test2/test2.c

    r68414f4a rbab6388  
    3838#define NAME "test2"
    3939
    40 static int add_device(device_t *dev);
     40static int test2_add_device(device_t *dev);
    4141
    4242static driver_ops_t driver_ops = {
    43         .add_device = &add_device
     43        .add_device = &test2_add_device
    4444};
    4545
    46 static driver_t the_driver = {
     46static driver_t test2_driver = {
    4747        .name = NAME,
    4848        .driver_ops = &driver_ops
     
    102102}
    103103
    104 static int add_device(device_t *dev)
     104static int test2_add_device(device_t *dev)
    105105{
    106         printf(NAME ": add_device(name=\"%s\", handle=%d)\n",
     106        printf(NAME ": test2_add_device(name=\"%s\", handle=%d)\n",
    107107            dev->name, (int) dev->handle);
    108108
     
    125125{
    126126        printf(NAME ": HelenOS test2 virtual device driver\n");
    127         return driver_main(&the_driver);
     127        return driver_main(&test2_driver);
    128128}
    129129
Note: See TracChangeset for help on using the changeset viewer.