static const struct pnp_card_device_id *match_card(struct pnp_card_driver *drv, struct pnp_card *card) { const struct pnp_card_device_id *drv_id = drv->id_table; while (*drv_id->id) { if (compare_pnp_id(card->id, drv_id->id)) { int i = 0; for (;;) { int found; struct pnp_dev *dev; if (i == PNP_MAX_DEVICES || !*drv_id->devs[i].id) return drv_id; found = 0; card_for_each_dev(card, dev) { if (compare_pnp_id(dev->id, drv_id->devs[i].id)) { found = 1; break; } } if (!found) break; i++; } } drv_id++; }
static __init int add_rtc_cmos(void) { #ifdef CONFIG_PNP static const char *ids[] __initconst = { "PNP0b00", "PNP0b01", "PNP0b02", }; struct pnp_dev *dev; struct pnp_id *id; int i; pnp_for_each_dev(dev) { for (id = dev->id; id; id = id->next) { for (i = 0; i < ARRAY_SIZE(ids); i++) { if (compare_pnp_id(id, ids[i]) != 0) return 0; } } } #endif if (of_have_populated_dt()) return 0; if (mrst_identify_cpu()) return -ENODEV; platform_device_register(&rtc_device); dev_info(&rtc_device.dev, "registered platform RTC device (no PNP device found)\n"); return 0; }
static int __init acpi_pnp_match(struct device *dev, void *_pnp) { struct acpi_device *acpi = to_acpi_device(dev); struct pnp_dev *pnp = _pnp; /* true means it matched */ return acpi->flags.hardware_id && !acpi_get_physical_device(acpi->handle) && compare_pnp_id(pnp->id, acpi->pnp.hardware_id); }
void pnp_fixup_device(struct pnp_dev *dev) { int i = 0; while (*pnp_fixups[i].id) { if (compare_pnp_id(dev->id, pnp_fixups[i].id)) { pnp_dbg("Calling quirk for %s", dev->dev.bus_id); pnp_fixups[i].quirk_function(dev); } i++; } }
static const struct pnp_device_id * match_device(struct pnp_driver *drv, struct pnp_dev *dev) { const struct pnp_device_id *drv_id = drv->id_table; if (!drv_id) return NULL; while (*drv_id->id) { if (compare_pnp_id(dev->id, drv_id->id)) return drv_id; drv_id++; } return NULL; }
void pnp_fixup_device(struct pnp_dev *dev) { struct pnp_fixup *f; for (f = pnp_fixups; *f->id; f++) { if (!compare_pnp_id(dev->id, f->id)) continue; #ifdef DEBUG dev_dbg(&dev->dev, "%s: calling ", f->id); print_fn_descriptor_symbol("%s\n", f->quirk_function); #endif f->quirk_function(dev); } }
static __init int add_rtc_cmos(void) { #ifdef CONFIG_PNP static const char * const ids[] __initconst = { "PNP0b00", "PNP0b01", "PNP0b02", }; struct pnp_dev *dev; struct pnp_id *id; int i; pnp_for_each_dev(dev) { for (id = dev->id; id; id = id->next) { for (i = 0; i < ARRAY_SIZE(ids); i++) { if (compare_pnp_id(id, ids[i]) != 0) return 0; } } } #endif if (of_have_populated_dt()) return 0; /* Intel MID platforms don't have ioport rtc */ if (intel_mid_identify_cpu()) return -ENODEV; #ifdef CONFIG_ACPI if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC) { /* This warning can likely go away again in a year or two. */ pr_info("ACPI: not registering RTC platform device\n"); return -ENODEV; } #endif if (paravirt_enabled() && !paravirt_has(RTC)) return -ENODEV; platform_device_register(&rtc_device); dev_info(&rtc_device.dev, "registered platform RTC device (no PNP device found)\n"); return 0; }
static __init int add_rtc_cmos(void) { int ret; #ifdef CONFIG_PNP static const char * const const ids[] __initconst = { "PNP0b00", "PNP0b01", "PNP0b02", }; struct pnp_dev *dev; struct pnp_id *id; int i; pnp_for_each_dev(dev) { for (id = dev->id; id; id = id->next) { for (i = 0; i < ARRAY_SIZE(ids); i++) { if (compare_pnp_id(id, ids[i]) != 0) return 0; } } } #endif if (of_have_populated_dt()) return 0; /* Intel MID platforms don't have ioport rtc * except Tangier platform, which doesn't have vRTC */ if (intel_mid_identify_cpu() && intel_mid_identify_cpu() != INTEL_MID_CPU_CHIP_TANGIER) return -ENODEV; ret = handle_mrfl_dev_ioapic(RTC_IRQ); if (ret) return ret; platform_device_register(&rtc_device); dev_info(&rtc_device.dev, "registered platform RTC device (no PNP device found)\n"); return 0; }