static void pcmcia_bus_rescan(struct pcmcia_socket *skt) { int no_devices=0; unsigned long flags; /* must be called with skt_sem held */ spin_lock_irqsave(&pcmcia_dev_list_lock, flags); if (list_empty(&skt->devices_list)) no_devices=1; spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); /* if no devices were added for this socket yet because of * missing resource information or other trouble, we need to * do this now. */ if (no_devices) { int ret = pcmcia_card_add(skt); if (ret) return; } /* some device information might have changed because of a CIS * update or because we can finally read it correctly... so * determine it again, overwriting old values if necessary. */ bus_for_each_dev(&pcmcia_bus_type, NULL, NULL, pcmcia_requery); /* we re-scan all devices, not just the ones connected to this * socket. This does not matter, though. */ bus_rescan_devices(&pcmcia_bus_type); }
/* * This workers main task is to wait for OP_OPR_ALIVE * from TOP FW until ALIVE_MSG_TIMOUT timeout is elapsed. * When OP_OPR_ALIVE received it will issue * a call to "bus_rescan_devices". */ static void iwmct_rescan_worker(struct work_struct *ws) { struct iwmct_priv *priv; int ret; priv = container_of(ws, struct iwmct_priv, bus_rescan_worker); LOG_INFO(priv, FW_MSG, "Calling bus_rescan\n"); ret = bus_rescan_devices(priv->func->dev.bus); if (ret < 0) LOG_INFO(priv, INIT, "bus_rescan_devices FAILED!!!\n"); }
/* * test_bus_rescan * make test call to bus_rescan_devices which * will rescan the bus and attempt to match devices * to drivers, will return 0 for no matches or * the number of matches made, check that the * value returned is not negative */ static int test_bus_rescan() { int count = 0; count = bus_rescan_devices(&test_bus_type); if (count == 0) printk("tbase: found no device/driver matches\n"); else if (count > 0) printk("tbase; found match\n"); else { printk("tbase: bus rescan failed\n"); return count; } return 0; }
static ssize_t pcmcia_store_allow_func_id_match(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct pcmcia_device *p_dev = to_pcmcia_dev(dev); if (!count) return -EINVAL; down(&p_dev->socket->skt_sem); p_dev->allow_func_id_match = 1; up(&p_dev->socket->skt_sem); bus_rescan_devices(&pcmcia_bus_type); return count; }