struct pnp_option * pnp_register_independent_option(struct pnp_dev *dev) { struct pnp_option *option; if (!dev) return NULL; option = pnp_build_option(PNP_RES_PRIORITY_PREFERRED); /* this should never happen but if it does we'll try to continue */ if (dev->independent) pnp_err("independent resource already registered"); dev->independent = option; return option; }
static struct pnp_option *quirk_isapnp_mpu_options(struct pnp_dev *dev) { struct pnp_option *head = NULL; struct pnp_option *prev = NULL; struct pnp_option *res; /* * Build a functional IRQ-less variant of each MPU option. */ for (res = dev->dependent; res; res = res->next) { struct pnp_option *curr; struct pnp_port *port; struct pnp_port *copy; port = res->port; if (!port || !res->irq) continue; copy = pnp_alloc(sizeof *copy); if (!copy) break; copy->min = port->min; copy->max = port->max; copy->align = port->align; copy->size = port->size; copy->flags = port->flags; curr = pnp_build_option(PNP_RES_PRIORITY_FUNCTIONAL); if (!curr) { kfree(copy); break; } curr->port = copy; if (prev) prev->next = curr; else head = curr; prev = curr; } if (head) dev_info(&dev->dev, "adding IRQ-less MPU options\n"); return head; }
struct pnp_option * pnp_register_dependent_option(struct pnp_dev *dev, int priority) { struct pnp_option *option; if (!dev) return NULL; option = pnp_build_option(priority); if (dev->dependent) { struct pnp_option *parent = dev->dependent; while (parent->next) parent = parent->next; parent->next = option; } else dev->dependent = option; return option; }