Lines Matching refs:func
35 struct sdio_func *func; \
37 func = dev_to_sdio_func (dev); \
42 sdio_config_attr(class, "0x%02x\n", func->class);
43 sdio_config_attr(vendor, "0x%04x\n", func->vendor);
44 sdio_config_attr(device, "0x%04x\n", func->device);
45 sdio_config_attr(revision, "%u.%u\n", func->major_rev, func->minor_rev);
46 sdio_config_attr(modalias, "sdio:c%02Xv%04Xd%04X\n", func->class, func->vendor, func->device);
51 struct sdio_func *func = dev_to_sdio_func(dev); \
53 if (num > func->num_info) \
55 if (!func->info[num-1][0]) \
57 return sprintf(buf, "%s\n", func->info[num-1]); \
80 static const struct sdio_device_id *sdio_match_one(struct sdio_func *func, in sdio_match_one() argument
83 if (id->class != (__u8)SDIO_ANY_ID && id->class != func->class) in sdio_match_one()
85 if (id->vendor != (__u16)SDIO_ANY_ID && id->vendor != func->vendor) in sdio_match_one()
87 if (id->device != (__u16)SDIO_ANY_ID && id->device != func->device) in sdio_match_one()
92 static const struct sdio_device_id *sdio_match_device(struct sdio_func *func, in sdio_match_device() argument
101 if (sdio_match_one(func, ids)) in sdio_match_device()
112 struct sdio_func *func = dev_to_sdio_func(dev); in sdio_bus_match() local
115 if (sdio_match_device(func, sdrv)) in sdio_bus_match()
124 struct sdio_func *func = dev_to_sdio_func(dev); in sdio_bus_uevent() local
128 "SDIO_CLASS=%02X", func->class)) in sdio_bus_uevent()
132 "SDIO_ID=%04X:%04X", func->vendor, func->device)) in sdio_bus_uevent()
136 "SDIO_REVISION=%u.%u", func->major_rev, func->minor_rev)) in sdio_bus_uevent()
139 for (i = 0; i < func->num_info; i++) { in sdio_bus_uevent()
140 if (add_uevent_var(env, "SDIO_INFO%u=%s", i+1, func->info[i])) in sdio_bus_uevent()
146 func->class, func->vendor, func->device)) in sdio_bus_uevent()
155 struct sdio_func *func = dev_to_sdio_func(dev); in sdio_bus_probe() local
159 id = sdio_match_device(func, drv); in sdio_bus_probe()
167 atomic_inc(&func->card->sdio_funcs_probed); in sdio_bus_probe()
175 if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD) { in sdio_bus_probe()
183 sdio_claim_host(func); in sdio_bus_probe()
184 if (mmc_card_removed(func->card)) in sdio_bus_probe()
187 ret = sdio_set_block_size(func, 0); in sdio_bus_probe()
188 sdio_release_host(func); in sdio_bus_probe()
192 ret = drv->probe(func, id); in sdio_bus_probe()
199 atomic_dec(&func->card->sdio_funcs_probed); in sdio_bus_probe()
200 if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD) in sdio_bus_probe()
209 struct sdio_func *func = dev_to_sdio_func(dev); in sdio_bus_remove() local
212 if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD) in sdio_bus_remove()
215 drv->remove(func); in sdio_bus_remove()
216 atomic_dec(&func->card->sdio_funcs_probed); in sdio_bus_remove()
218 if (func->irq_handler) { in sdio_bus_remove()
221 sdio_claim_host(func); in sdio_bus_remove()
222 sdio_release_irq(func); in sdio_bus_remove()
223 sdio_release_host(func); in sdio_bus_remove()
227 if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD) in sdio_bus_remove()
231 if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD) in sdio_bus_remove()
291 struct sdio_func *func = dev_to_sdio_func(dev); in sdio_release_func() local
293 sdio_free_func_cis(func); in sdio_release_func()
295 kfree(func->info); in sdio_release_func()
296 kfree(func->tmpbuf); in sdio_release_func()
297 kfree(func); in sdio_release_func()
305 struct sdio_func *func; in sdio_alloc_func() local
307 func = kzalloc(sizeof(struct sdio_func), GFP_KERNEL); in sdio_alloc_func()
308 if (!func) in sdio_alloc_func()
315 func->tmpbuf = kmalloc(4, GFP_KERNEL); in sdio_alloc_func()
316 if (!func->tmpbuf) { in sdio_alloc_func()
317 kfree(func); in sdio_alloc_func()
321 func->card = card; in sdio_alloc_func()
323 device_initialize(&func->dev); in sdio_alloc_func()
325 func->dev.parent = &card->dev; in sdio_alloc_func()
326 func->dev.bus = &sdio_bus_type; in sdio_alloc_func()
327 func->dev.release = sdio_release_func; in sdio_alloc_func()
329 return func; in sdio_alloc_func()
333 static void sdio_acpi_set_handle(struct sdio_func *func) in sdio_acpi_set_handle() argument
335 struct mmc_host *host = func->card->host; in sdio_acpi_set_handle()
336 u64 addr = ((u64)host->slotno << 16) | func->num; in sdio_acpi_set_handle()
338 acpi_preset_companion(&func->dev, ACPI_COMPANION(host->parent), addr); in sdio_acpi_set_handle()
341 static inline void sdio_acpi_set_handle(struct sdio_func *func) {} in sdio_acpi_set_handle() argument
344 static void sdio_set_of_node(struct sdio_func *func) in sdio_set_of_node() argument
346 struct mmc_host *host = func->card->host; in sdio_set_of_node()
348 func->dev.of_node = mmc_of_find_child_device(host, func->num); in sdio_set_of_node()
354 int sdio_add_func(struct sdio_func *func) in sdio_add_func() argument
358 dev_set_name(&func->dev, "%s:%d", mmc_card_id(func->card), func->num); in sdio_add_func()
360 sdio_set_of_node(func); in sdio_add_func()
361 sdio_acpi_set_handle(func); in sdio_add_func()
362 device_enable_async_suspend(&func->dev); in sdio_add_func()
363 ret = device_add(&func->dev); in sdio_add_func()
365 sdio_func_set_present(func); in sdio_add_func()
376 void sdio_remove_func(struct sdio_func *func) in sdio_remove_func() argument
378 if (!sdio_func_present(func)) in sdio_remove_func()
381 device_del(&func->dev); in sdio_remove_func()
382 of_node_put(func->dev.of_node); in sdio_remove_func()
383 put_device(&func->dev); in sdio_remove_func()