Changes in uspace/drv/char/ps2mouse/ps2mouse.c [56fd7cf:9d58539] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/char/ps2mouse/ps2mouse.c
r56fd7cf r9d58539 35 35 #include <bool.h> 36 36 #include <errno.h> 37 #include <devman.h> 37 38 #include <ddf/log.h> 38 39 #include <io/keycode.h> … … 113 114 int ps2_mouse_init(ps2_mouse_t *mouse, ddf_dev_t *dev) 114 115 { 116 assert(mouse); 117 assert(dev); 115 118 mouse->client_sess = NULL; 116 mouse->parent_sess = ddf_dev_parent_sess_create(dev, EXCHANGE_SERIALIZE); 119 mouse->parent_sess = devman_parent_device_connect(EXCHANGE_SERIALIZE, 120 dev->handle, IPC_FLAG_BLOCKING); 117 121 if (!mouse->parent_sess) 118 122 return ENOMEM; … … 120 124 mouse->mouse_fun = ddf_fun_create(dev, fun_exposed, "mouse"); 121 125 if (!mouse->mouse_fun) { 126 async_hangup(mouse->parent_sess); 122 127 return ENOMEM; 123 128 } 124 ddf_fun_set_ops(mouse->mouse_fun, &mouse_ops); 129 mouse->mouse_fun->ops = &mouse_ops; 130 mouse->mouse_fun->driver_data = mouse; 125 131 126 132 int ret = ddf_fun_bind(mouse->mouse_fun); 127 133 if (ret != EOK) { 134 async_hangup(mouse->parent_sess); 135 mouse->mouse_fun->driver_data = NULL; 128 136 ddf_fun_destroy(mouse->mouse_fun); 129 137 return ENOMEM; … … 132 140 ret = ddf_fun_add_to_category(mouse->mouse_fun, "mouse"); 133 141 if (ret != EOK) { 142 async_hangup(mouse->parent_sess); 134 143 ddf_fun_unbind(mouse->mouse_fun); 144 mouse->mouse_fun->driver_data = NULL; 135 145 ddf_fun_destroy(mouse->mouse_fun); 136 146 return ENOMEM; … … 151 161 ddf_msg(LVL_ERROR, "Failed to enable data reporting."); 152 162 async_exchange_end(exch); 163 async_hangup(mouse->parent_sess); 153 164 ddf_fun_unbind(mouse->mouse_fun); 165 mouse->mouse_fun->driver_data = NULL; 154 166 ddf_fun_destroy(mouse->mouse_fun); 155 167 return EIO; … … 161 173 ddf_msg(LVL_ERROR, "Failed to confirm data reporting: %hhx.", 162 174 report); 175 async_hangup(mouse->parent_sess); 163 176 ddf_fun_unbind(mouse->mouse_fun); 177 mouse->mouse_fun->driver_data = NULL; 164 178 ddf_fun_destroy(mouse->mouse_fun); 165 179 return EIO; … … 168 182 mouse->polling_fibril = fibril_create(polling_f, mouse); 169 183 if (!mouse->polling_fibril) { 184 async_hangup(mouse->parent_sess); 170 185 ddf_fun_unbind(mouse->mouse_fun); 186 mouse->mouse_fun->driver_data = NULL; 171 187 ddf_fun_destroy(mouse->mouse_fun); 172 188 return ENOMEM; … … 352 368 ipc_callid_t icallid, ipc_call_t *icall) 353 369 { 370 if (fun == NULL || fun->driver_data == NULL) { 371 ddf_msg(LVL_ERROR, "%s: Missing parameter.", __FUNCTION__); 372 async_answer_0(icallid, EINVAL); 373 return; 374 } 375 354 376 const sysarg_t method = IPC_GET_IMETHOD(*icall); 355 ps2_mouse_t *mouse = ddf_dev_data_get(ddf_fun_get_dev(fun));377 ps2_mouse_t *mouse = fun->driver_data; 356 378 357 379 switch (method) {
Note:
See TracChangeset
for help on using the changeset viewer.