mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-15 13:22:55 +00:00
mfd: accept pure device as a parent, not only platform_device
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com> Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
This commit is contained in:
parent
56edb58be1
commit
424f525a12
@ -15,7 +15,7 @@
|
|||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/mfd/core.h>
|
#include <linux/mfd/core.h>
|
||||||
|
|
||||||
static int mfd_add_device(struct platform_device *parent,
|
static int mfd_add_device(struct device *parent, int id,
|
||||||
const struct mfd_cell *cell,
|
const struct mfd_cell *cell,
|
||||||
struct resource *mem_base,
|
struct resource *mem_base,
|
||||||
int irq_base)
|
int irq_base)
|
||||||
@ -25,11 +25,11 @@ static int mfd_add_device(struct platform_device *parent,
|
|||||||
int ret = -ENOMEM;
|
int ret = -ENOMEM;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
pdev = platform_device_alloc(cell->name, parent->id);
|
pdev = platform_device_alloc(cell->name, id);
|
||||||
if (!pdev)
|
if (!pdev)
|
||||||
goto fail_alloc;
|
goto fail_alloc;
|
||||||
|
|
||||||
pdev->dev.parent = &parent->dev;
|
pdev->dev.parent = parent;
|
||||||
|
|
||||||
ret = platform_device_add_data(pdev,
|
ret = platform_device_add_data(pdev,
|
||||||
cell->platform_data, cell->data_size);
|
cell->platform_data, cell->data_size);
|
||||||
@ -75,7 +75,7 @@ fail_alloc:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mfd_add_devices(struct platform_device *parent,
|
int mfd_add_devices(struct device *parent, int id,
|
||||||
const struct mfd_cell *cells, int n_devs,
|
const struct mfd_cell *cells, int n_devs,
|
||||||
struct resource *mem_base,
|
struct resource *mem_base,
|
||||||
int irq_base)
|
int irq_base)
|
||||||
@ -84,7 +84,7 @@ int mfd_add_devices(struct platform_device *parent,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
for (i = 0; i < n_devs; i++) {
|
for (i = 0; i < n_devs; i++) {
|
||||||
ret = mfd_add_device(parent, cells + i, mem_base, irq_base);
|
ret = mfd_add_device(parent, id, cells + i, mem_base, irq_base);
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -102,9 +102,9 @@ static int mfd_remove_devices_fn(struct device *dev, void *unused)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mfd_remove_devices(struct platform_device *parent)
|
void mfd_remove_devices(struct device *parent)
|
||||||
{
|
{
|
||||||
device_for_each_child(&parent->dev, NULL, mfd_remove_devices_fn);
|
device_for_each_child(parent, NULL, mfd_remove_devices_fn);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(mfd_remove_devices);
|
EXPORT_SYMBOL(mfd_remove_devices);
|
||||||
|
|
||||||
|
@ -471,7 +471,7 @@ static int __devinit tc6393xb_probe(struct platform_device *dev)
|
|||||||
tc6393xb_cells[TC6393XB_CELL_NAND].data_size =
|
tc6393xb_cells[TC6393XB_CELL_NAND].data_size =
|
||||||
sizeof(tc6393xb_cells[TC6393XB_CELL_NAND]);
|
sizeof(tc6393xb_cells[TC6393XB_CELL_NAND]);
|
||||||
|
|
||||||
retval = mfd_add_devices(dev,
|
retval = mfd_add_devices(&dev->dev, dev->id,
|
||||||
tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells),
|
tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells),
|
||||||
iomem, tcpd->irq_base);
|
iomem, tcpd->irq_base);
|
||||||
|
|
||||||
@ -505,7 +505,7 @@ static int __devexit tc6393xb_remove(struct platform_device *dev)
|
|||||||
struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
|
struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
mfd_remove_devices(dev);
|
mfd_remove_devices(&dev->dev);
|
||||||
|
|
||||||
if (tc6393xb->irq)
|
if (tc6393xb->irq)
|
||||||
tc6393xb_detach_irq(dev);
|
tc6393xb_detach_irq(dev);
|
||||||
|
@ -45,11 +45,11 @@ struct mfd_cell {
|
|||||||
const struct resource *resources;
|
const struct resource *resources;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int mfd_add_devices(struct platform_device *parent,
|
extern int mfd_add_devices(struct device *parent, int id,
|
||||||
const struct mfd_cell *cells, int n_devs,
|
const struct mfd_cell *cells, int n_devs,
|
||||||
struct resource *mem_base,
|
struct resource *mem_base,
|
||||||
int irq_base);
|
int irq_base);
|
||||||
|
|
||||||
extern void mfd_remove_devices(struct platform_device *parent);
|
extern void mfd_remove_devices(struct device *parent);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user