Changeset cccd60c3 in mainline for uspace/drv/bus/pci/pciintel/pci.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/pci/pciintel/pci.c

    r2bdf92a5 rcccd60c3  
    9999}
    100100
    101 static bool pciintel_enable_interrupt(ddf_fun_t *fnode)
    102 {
    103         /* This is an old ugly way */
    104         assert(fnode);
     101static int pciintel_enable_interrupt(ddf_fun_t *fnode, int irq)
     102{
    105103        pci_fun_t *dev_data = pci_fun(fnode);
    106104       
    107         size_t i = 0;
     105        size_t i;
    108106        hw_resource_list_t *res = &dev_data->hw_resources;
    109         for (; i < res->count; i++) {
     107        bool found = false;
     108       
     109        found = false;
     110        for (i = 0; i < res->count; i++) {
    110111                if (res->resources[i].type == INTERRUPT) {
    111                         int rc = irc_enable_interrupt(
    112                             res->resources[i].res.interrupt.irq);
    113                        
    114                         if (rc != EOK)
    115                                 return false;
     112                        found = true;
     113                        break;
    116114                }
    117115        }
    118116       
    119         return true;
     117        if (!found)
     118                return EINVAL;
     119       
     120        return irc_enable_interrupt(irq);
    120121}
    121122
Note: See TracChangeset for help on using the changeset viewer.