Lines Matching +full:num +full:- +full:ids
1 // SPDX-License-Identifier: GPL-2.0-or-later
43 sdio_config_attr(class, "0x%02x\n", func->class);
44 sdio_config_attr(vendor, "0x%04x\n", func->vendor);
45 sdio_config_attr(device, "0x%04x\n", func->device);
46 sdio_config_attr(revision, "%u.%u\n", func->major_rev, func->minor_rev);
47 sdio_config_attr(modalias, "sdio:c%02Xv%04Xd%04X\n", func->class, func->vendor, func->device);
49 #define sdio_info_attr(num) \ argument
50 static ssize_t info##num##_show(struct device *dev, struct device_attribute *attr, char *buf) \
54 if (num > func->num_info) \
55 return -ENODATA; \
56 if (!func->info[num - 1][0]) \
58 return sysfs_emit(buf, "%s\n", func->info[num - 1]); \
60 static DEVICE_ATTR_RO(info##num)
84 if (id->class != (__u8)SDIO_ANY_ID && id->class != func->class) in sdio_match_one()
86 if (id->vendor != (__u16)SDIO_ANY_ID && id->vendor != func->vendor) in sdio_match_one()
88 if (id->device != (__u16)SDIO_ANY_ID && id->device != func->device) in sdio_match_one()
96 const struct sdio_device_id *ids; in sdio_match_device() local
98 ids = sdrv->id_table; in sdio_match_device()
100 if (ids) { in sdio_match_device()
101 while (ids->class || ids->vendor || ids->device) { in sdio_match_device()
102 if (sdio_match_one(func, ids)) in sdio_match_device()
103 return ids; in sdio_match_device()
104 ids++; in sdio_match_device()
129 "SDIO_CLASS=%02X", func->class)) in sdio_bus_uevent()
130 return -ENOMEM; in sdio_bus_uevent()
133 "SDIO_ID=%04X:%04X", func->vendor, func->device)) in sdio_bus_uevent()
134 return -ENOMEM; in sdio_bus_uevent()
137 "SDIO_REVISION=%u.%u", func->major_rev, func->minor_rev)) in sdio_bus_uevent()
138 return -ENOMEM; in sdio_bus_uevent()
140 for (i = 0; i < func->num_info; i++) { in sdio_bus_uevent()
141 if (add_uevent_var(env, "SDIO_INFO%u=%s", i+1, func->info[i])) in sdio_bus_uevent()
142 return -ENOMEM; in sdio_bus_uevent()
147 func->class, func->vendor, func->device)) in sdio_bus_uevent()
148 return -ENOMEM; in sdio_bus_uevent()
155 struct sdio_driver *drv = to_sdio_driver(dev->driver); in sdio_bus_probe()
162 return -ENODEV; in sdio_bus_probe()
168 atomic_inc(&func->card->sdio_funcs_probed); in sdio_bus_probe()
176 if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD) { in sdio_bus_probe()
185 if (mmc_card_removed(func->card)) in sdio_bus_probe()
186 ret = -ENOMEDIUM; in sdio_bus_probe()
193 ret = drv->probe(func, id); in sdio_bus_probe()
200 atomic_dec(&func->card->sdio_funcs_probed); in sdio_bus_probe()
201 if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD) in sdio_bus_probe()
209 struct sdio_driver *drv = to_sdio_driver(dev->driver); in sdio_bus_remove()
212 /* Make sure card is powered before invoking ->remove() */ in sdio_bus_remove()
213 if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD) in sdio_bus_remove()
216 drv->remove(func); in sdio_bus_remove()
217 atomic_dec(&func->card->sdio_funcs_probed); in sdio_bus_remove()
219 if (func->irq_handler) { in sdio_bus_remove()
221 drv->name); in sdio_bus_remove()
228 if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD) in sdio_bus_remove()
232 if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD) in sdio_bus_remove()
268 * __sdio_register_driver - register a function driver
274 drv->drv.name = drv->name; in __sdio_register_driver()
275 drv->drv.bus = &sdio_bus_type; in __sdio_register_driver()
276 drv->drv.owner = owner; in __sdio_register_driver()
278 return driver_register(&drv->drv); in __sdio_register_driver()
283 * sdio_unregister_driver - unregister a function driver
288 drv->drv.bus = &sdio_bus_type; in sdio_unregister_driver()
289 driver_unregister(&drv->drv); in sdio_unregister_driver()
297 if (!(func->card->quirks & MMC_QUIRK_NONSTD_SDIO)) in sdio_release_func()
304 put_device(&func->card->dev); in sdio_release_func()
306 kfree(func->info); in sdio_release_func()
307 kfree(func->tmpbuf); in sdio_release_func()
320 return ERR_PTR(-ENOMEM); in sdio_alloc_func()
326 func->tmpbuf = kmalloc(4, GFP_KERNEL); in sdio_alloc_func()
327 if (!func->tmpbuf) { in sdio_alloc_func()
329 return ERR_PTR(-ENOMEM); in sdio_alloc_func()
332 func->card = card; in sdio_alloc_func()
334 device_initialize(&func->dev); in sdio_alloc_func()
340 get_device(&func->card->dev); in sdio_alloc_func()
342 func->dev.parent = &card->dev; in sdio_alloc_func()
343 func->dev.bus = &sdio_bus_type; in sdio_alloc_func()
344 func->dev.release = sdio_release_func; in sdio_alloc_func()
352 struct mmc_host *host = func->card->host; in sdio_acpi_set_handle()
353 u64 addr = ((u64)host->slotno << 16) | func->num; in sdio_acpi_set_handle()
355 acpi_preset_companion(&func->dev, ACPI_COMPANION(host->parent), addr); in sdio_acpi_set_handle()
363 struct mmc_host *host = func->card->host; in sdio_set_of_node()
365 func->dev.of_node = mmc_of_find_child_device(host, func->num); in sdio_set_of_node()
375 dev_set_name(&func->dev, "%s:%d", mmc_card_id(func->card), func->num); in sdio_add_func()
379 device_enable_async_suspend(&func->dev); in sdio_add_func()
380 ret = device_add(&func->dev); in sdio_add_func()
396 device_del(&func->dev); in sdio_remove_func()
398 of_node_put(func->dev.of_node); in sdio_remove_func()
399 put_device(&func->dev); in sdio_remove_func()