History

mfd: mfd-core: Remove mfd_clone_cell()

Providing a subsystem-level API helper seems over-kill just to save a few lines of C-code. Previous commits saw us convert mfd_clone_cell()'s only user over to use a more traditional style of MFD child-device registration. Now we can remove the superfluous helper from the MFD API.

Lee Jones committed 7 years ago

Commit ead1c831 parent b195e102 files · +0 −51Browse files

Unified · Split

2 files
  1. drivers/mfd/mfd-core.c +0 −33
  2. include/linux/mfd/core.h +0 −18
drivers/mfd/mfd-core.c+0−33
@@ -392,38 +392,5 @@ int devm_mfd_add_devices(struct device *dev, int id, · 391 unmodified lines
392}392}
393EXPORT_SYMBOL(devm_mfd_add_devices);393EXPORT_SYMBOL(devm_mfd_add_devices);
394 394
395int mfd_clone_cell(const char *cell, const char **clones, size_t n_clones)
396{
397 struct mfd_cell cell_entry;
398 struct device *dev;
399 struct platform_device *pdev;
400 int i;
401
402 /* fetch the parent cell's device (should already be registered!) */
403 dev = bus_find_device_by_name(&platform_bus_type, NULL, cell);
404 if (!dev) {
405 printk(KERN_ERR "failed to find device for cell %s\n", cell);
406 return -ENODEV;
407 }
408 pdev = to_platform_device(dev);
409 memcpy(&cell_entry, mfd_get_cell(pdev), sizeof(cell_entry));
410
411 WARN_ON(!cell_entry.enable);
412
413 for (i = 0; i < n_clones; i++) {
414 cell_entry.name = clones[i];
415 /* don't give up if a single call fails; just report error */
416 if (mfd_add_device(pdev->dev.parent, -1, &cell_entry,
417 cell_entry.usage_count, NULL, 0, NULL))
418 dev_err(dev, "failed to create platform device '%s'\n",
419 clones[i]);
420 }
421
422 put_device(dev);
423
424 return 0;
425}
426EXPORT_SYMBOL(mfd_clone_cell);
427
428MODULE_LICENSE("GPL");395MODULE_LICENSE("GPL");
429MODULE_AUTHOR("Ian Molton, Dmitry Baryshkov");396MODULE_AUTHOR("Ian Molton, Dmitry Baryshkov");
include/linux/mfd/core.h+0−18
@@ -115,24 +115,6 @@ struct mfd_cell { · 114 unmodified lines
115extern int mfd_cell_enable(struct platform_device *pdev);115extern int mfd_cell_enable(struct platform_device *pdev);
116extern int mfd_cell_disable(struct platform_device *pdev);116extern int mfd_cell_disable(struct platform_device *pdev);
117 117
118/*
119 * "Clone" multiple platform devices for a single cell. This is to be used
120 * for devices that have multiple users of a cell. For example, if an mfd
121 * driver wants the cell "foo" to be used by a GPIO driver, an MTD driver,
122 * and a platform driver, the following bit of code would be use after first
123 * calling mfd_add_devices():
124 *
125 * const char *fclones[] = { "foo-gpio", "foo-mtd" };
126 * err = mfd_clone_cells("foo", fclones, ARRAY_SIZE(fclones));
127 *
128 * Each driver (MTD, GPIO, and platform driver) would then register
129 * platform_drivers for "foo-mtd", "foo-gpio", and "foo", respectively.
130 * The cell's .enable/.disable hooks should be used to deal with hardware
131 * resource contention.
132 */
133extern int mfd_clone_cell(const char *cell, const char **clones,
134 size_t n_clones);
135
136/*118/*
137 * Given a platform device that's been created by mfd_add_devices(), fetch119 * Given a platform device that's been created by mfd_add_devices(), fetch
138 * the mfd_cell that created it.120 * the mfd_cell that created it.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t