Ignore:
File:
1 edited

Legend:

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

    rcccd60c3 rf9b2cb4c  
    3737#include <ddf/log.h>
    3838#include <device/hw_res_parsed.h>
     39#include <devman.h>
    3940#include <assert.h>
    4041#include <stdio.h>
     
    5051static int sb_get_res(ddf_dev_t *device, addr_range_t **pp_sb_regs,
    5152    addr_range_t **pp_mpu_regs, int *irq, int *dma8, int *dma16);
    52 static int sb_enable_interrupt(ddf_dev_t *device, int irq);
     53static int sb_enable_interrupts(ddf_dev_t *device);
    5354
    5455static driver_ops_t sb_driver_ops = {
     
    9394        irq_cmd_t irq_cmds[irq_cmd_count];
    9495        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         irq_cap = register_interrupt_handler(device, irq, irq_handler,
    126             &irq_code);
    127         if (irq_cap < 0) {
    128                 rc = irq_cap;
     125        rc = register_interrupt_handler(device, irq, irq_handler, &irq_code);
     126        if (rc != EOK) {
    129127                ddf_log_error("Failed to register irq handler: %s.",
    130128                    str_error(rc));
     
    134132        handler_regd = true;
    135133
    136         rc = sb_enable_interrupt(device, irq);
     134        rc = sb_enable_interrupts(device);
    137135        if (rc != EOK) {
    138136                ddf_log_error("Failed to enable interrupts: %s.",
     
    170168error:
    171169        if (handler_regd)
    172                 unregister_interrupt_handler(device, irq_cap);
     170                unregister_interrupt_handler(device, irq);
    173171        return rc;
    174172}
     
    179177        assert(device);
    180178
    181         async_sess_t *parent_sess = ddf_dev_parent_sess_get(device);
    182         if (parent_sess == NULL)
     179        async_sess_t *parent_sess = devman_parent_device_connect(
     180            ddf_dev_get_handle(device), IPC_FLAG_BLOCKING);
     181        if (!parent_sess)
    183182                return ENOMEM;
    184183
     
    186185        hw_res_list_parsed_init(&hw_res);
    187186        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 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)
     244int 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)
    248249                return ENOMEM;
    249250
    250         return hw_res_enable_interrupt(parent_sess, irq);
     251        bool enabled = hw_res_enable_interrupt(parent_sess);
     252        async_hangup(parent_sess);
     253
     254        return enabled ? EOK : EIO;
    251255}
    252256
Note: See TracChangeset for help on using the changeset viewer.