Changes in uspace/drv/char/msim-con/main.c [7de5f12:676e833] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/char/msim-con/main.c
r7de5f12 r676e833 35 35 #include <ddf/driver.h> 36 36 #include <ddf/log.h> 37 #include <device/hw_res_parsed.h>38 37 #include <errno.h> 39 38 #include <stdio.h> … … 62 61 }; 63 62 64 static int msim_con_get_res(ddf_dev_t *dev, msim_con_res_t *res)65 {66 async_sess_t *parent_sess;67 hw_res_list_parsed_t hw_res;68 int rc;69 70 parent_sess = ddf_dev_parent_sess_get(dev);71 if (parent_sess == NULL)72 return ENOMEM;73 74 hw_res_list_parsed_init(&hw_res);75 rc = hw_res_get_list_parsed(parent_sess, &hw_res, 0);76 if (rc != EOK)77 return rc;78 79 if (hw_res.mem_ranges.count != 1) {80 rc = EINVAL;81 goto error;82 }83 84 res->base = RNGABS(hw_res.mem_ranges.ranges[0]);85 86 if (hw_res.irqs.count != 1) {87 rc = EINVAL;88 goto error;89 }90 91 res->irq = hw_res.irqs.irqs[0];92 93 return EOK;94 error:95 hw_res_list_parsed_clean(&hw_res);96 return rc;97 }98 99 63 static int msim_con_dev_add(ddf_dev_t *dev) 100 64 { 101 65 msim_con_t *msim_con; 102 msim_con_res_t res;103 int rc;104 66 105 67 ddf_msg(LVL_DEBUG, "msim_con_dev_add(%p)", dev); 106 107 68 msim_con = ddf_dev_data_alloc(dev, sizeof(msim_con_t)); 108 69 if (msim_con == NULL) { … … 113 74 msim_con->dev = dev; 114 75 115 rc = msim_con_get_res(dev, &res); 116 if (rc != EOK) { 117 ddf_msg(LVL_ERROR, "Failed getting hardware resource list.\n"); 118 return EIO; 119 } 120 121 return msim_con_add(msim_con, &res); 76 return msim_con_add(msim_con); 122 77 } 123 78
Note:
See TracChangeset
for help on using the changeset viewer.