Changes in uspace/drv/audio/sb16/main.c [f9b2cb4c:cccd60c3] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/sb16/main.c
rf9b2cb4c rcccd60c3 37 37 #include <ddf/log.h> 38 38 #include <device/hw_res_parsed.h> 39 #include <devman.h>40 39 #include <assert.h> 41 40 #include <stdio.h> … … 51 50 static int sb_get_res(ddf_dev_t *device, addr_range_t **pp_sb_regs, 52 51 addr_range_t **pp_mpu_regs, int *irq, int *dma8, int *dma16); 53 static int sb_enable_interrupt s(ddf_dev_t *device);52 static int sb_enable_interrupt(ddf_dev_t *device, int irq); 54 53 55 54 static driver_ops_t sb_driver_ops = { … … 94 93 irq_cmd_t irq_cmds[irq_cmd_count]; 95 94 irq_pio_range_t irq_ranges[1]; 95 int irq_cap; 96 96 97 97 sb16_t *soft_state = ddf_dev_data_alloc(device, sizeof(sb16_t)); … … 123 123 }; 124 124 125 rc = register_interrupt_handler(device, irq, irq_handler, &irq_code); 126 if (rc != EOK) { 125 irq_cap = register_interrupt_handler(device, irq, irq_handler, 126 &irq_code); 127 if (irq_cap < 0) { 128 rc = irq_cap; 127 129 ddf_log_error("Failed to register irq handler: %s.", 128 130 str_error(rc)); … … 132 134 handler_regd = true; 133 135 134 rc = sb_enable_interrupt s(device);136 rc = sb_enable_interrupt(device, irq); 135 137 if (rc != EOK) { 136 138 ddf_log_error("Failed to enable interrupts: %s.", … … 168 170 error: 169 171 if (handler_regd) 170 unregister_interrupt_handler(device, irq );172 unregister_interrupt_handler(device, irq_cap); 171 173 return rc; 172 174 } … … 177 179 assert(device); 178 180 179 async_sess_t *parent_sess = devman_parent_device_connect( 180 ddf_dev_get_handle(device), IPC_FLAG_BLOCKING); 181 if (!parent_sess) 181 async_sess_t *parent_sess = ddf_dev_parent_sess_get(device); 182 if (parent_sess == NULL) 182 183 return ENOMEM; 183 184 … … 185 186 hw_res_list_parsed_init(&hw_res); 186 187 const int ret = hw_res_get_list_parsed(parent_sess, &hw_res, 0); 187 async_hangup(parent_sess);188 188 if (ret != EOK) { 189 189 return ret; … … 242 242 } 243 243 244 int sb_enable_interrupts(ddf_dev_t *device) 245 { 246 async_sess_t *parent_sess = devman_parent_device_connect( 247 ddf_dev_get_handle(device), IPC_FLAG_BLOCKING); 248 if (!parent_sess) 244 static int sb_enable_interrupt(ddf_dev_t *device, int irq) 245 { 246 async_sess_t *parent_sess = ddf_dev_parent_sess_get(device); 247 if (parent_sess == NULL) 249 248 return ENOMEM; 250 249 251 bool enabled = hw_res_enable_interrupt(parent_sess); 252 async_hangup(parent_sess); 253 254 return enabled ? EOK : EIO; 250 return hw_res_enable_interrupt(parent_sess, irq); 255 251 } 256 252
Note:
See TracChangeset
for help on using the changeset viewer.