Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/audio/sb16/main.c

    rf9b2cb4c rcccd60c3  
    3737#include <ddf/log.h>
    3838#include <device/hw_res_parsed.h>
    39 #include <devman.h>
    4039#include <assert.h>
    4140#include <stdio.h>
     
    5150static int sb_get_res(ddf_dev_t *device, addr_range_t **pp_sb_regs,
    5251    addr_range_t **pp_mpu_regs, int *irq, int *dma8, int *dma16);
    53 static int sb_enable_interrupts(ddf_dev_t *device);
     52static int sb_enable_interrupt(ddf_dev_t *device, int irq);
    5453
    5554static driver_ops_t sb_driver_ops = {
     
    9493        irq_cmd_t irq_cmds[irq_cmd_count];
    9594        irq_pio_range_t irq_ranges[1];
     95        int irq_cap;
    9696
    9797        sb16_t *soft_state = ddf_dev_data_alloc(device, sizeof(sb16_t));
     
    123123        };
    124124
    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;
    127129                ddf_log_error("Failed to register irq handler: %s.",
    128130                    str_error(rc));
     
    132134        handler_regd = true;
    133135
    134         rc = sb_enable_interrupts(device);
     136        rc = sb_enable_interrupt(device, irq);
    135137        if (rc != EOK) {
    136138                ddf_log_error("Failed to enable interrupts: %s.",
     
    168170error:
    169171        if (handler_regd)
    170                 unregister_interrupt_handler(device, irq);
     172                unregister_interrupt_handler(device, irq_cap);
    171173        return rc;
    172174}
     
    177179        assert(device);
    178180
    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)
    182183                return ENOMEM;
    183184
     
    185186        hw_res_list_parsed_init(&hw_res);
    186187        const int ret = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
    187         async_hangup(parent_sess);
    188188        if (ret != EOK) {
    189189                return ret;
     
    242242}
    243243
    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)
     244static 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)
    249248                return ENOMEM;
    250249
    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);
    255251}
    256252
Note: See TracChangeset for help on using the changeset viewer.