Changeset cccd60c3 in mainline for uspace/drv/bus/isa/isa.c


Ignore:
Timestamp:
2017-10-10T06:51:02Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c46bfbc
Parents:
2bdf92a5
Message:

hw_res_enable_interrupt should allow enabling individual interrupts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/isa/isa.c

    r2bdf92a5 rcccd60c3  
    115115}
    116116
    117 static bool isa_fun_enable_interrupt(ddf_fun_t *fnode)
    118 {
    119         /* This is an old ugly way, copied from pci driver */
    120         assert(fnode);
     117static int isa_fun_enable_interrupt(ddf_fun_t *fnode, int irq)
     118{
    121119        isa_fun_t *fun = isa_fun(fnode);
    122         assert(fun);
    123 
    124120        const hw_resource_list_t *res = &fun->hw_resources;
    125         assert(res);
     121        bool found;
     122
     123        /* Check that specified irq really belongs to the function */
     124        found = false;
    126125        for (size_t i = 0; i < res->count; ++i) {
    127                 if (res->resources[i].type == INTERRUPT) {
    128                         int rc = irc_enable_interrupt(
    129                             res->resources[i].res.interrupt.irq);
    130 
    131                         if (rc != EOK)
    132                                 return false;
    133                 }
    134         }
    135 
    136         return true;
     126                if (res->resources[i].type == INTERRUPT &&
     127                    res->resources[i].res.interrupt.irq == irq) {
     128                        found = true;
     129                        break;
     130                }
     131        }
     132
     133        if (!found)
     134                return EINVAL;
     135
     136        return irc_enable_interrupt(irq);
    137137}
    138138
Note: See TracChangeset for help on using the changeset viewer.