Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Merge branch 'devel'
[palacios.git] / kitten / kernel / driver.c
1 #include <lwk/driver.h>
2 #include <lwk/string.h>
3
4 /**
5  * Searches for the specified driver name and calls its init() function.
6  *
7  * Returns 0 on success, -1 on failure.
8  */
9 int driver_init_by_name(const char *name)
10 {
11         unsigned int i;
12         struct driver_info * drvs       =       __start___driver_table;
13         unsigned int         num_drvs   =       __stop___driver_table
14                                                   - __start___driver_table;
15
16         for (i = 0; i < num_drvs; i++) {
17                 if (strcmp(name, drvs[i].name) == 0) {
18                         if (drvs[i].init_called)
19                                 return -1;
20                         drvs[i].init_called = 1;
21                         drvs[i].init();
22                         return 0;
23                 }
24         }
25         return -1;
26 }
27