mirror of
https://github.com/torvalds/linux.git
synced 2024-12-31 23:31:29 +00:00
memory: brcmstb: dpfe: Remove need for dpfe_dev
We can hook sysfs objects to the parent platform device that we are created from, no need to have a synthetic dpfe_dev just for that. This incidentally removes the need for having an index, since we are guaranteed to have an unique path in the sysfs hiearchy. Acked-by: Markus Mayer <mmayer@broadcom.com> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
This commit is contained in:
parent
60cc43fc88
commit
b1d0973e9a
@ -176,7 +176,6 @@ struct private_data {
|
|||||||
void __iomem *dmem;
|
void __iomem *dmem;
|
||||||
void __iomem *imem;
|
void __iomem *imem;
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
unsigned int index;
|
|
||||||
struct mutex lock;
|
struct mutex lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -674,10 +673,8 @@ static int brcmstb_dpfe_probe(struct platform_device *pdev)
|
|||||||
{
|
{
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
struct private_data *priv;
|
struct private_data *priv;
|
||||||
struct device *dpfe_dev;
|
|
||||||
struct init_data init;
|
struct init_data init;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
u32 index;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||||
@ -687,11 +684,6 @@ static int brcmstb_dpfe_probe(struct platform_device *pdev)
|
|||||||
mutex_init(&priv->lock);
|
mutex_init(&priv->lock);
|
||||||
platform_set_drvdata(pdev, priv);
|
platform_set_drvdata(pdev, priv);
|
||||||
|
|
||||||
/* Cell index is optional; default to 0 if not present. */
|
|
||||||
ret = of_property_read_u32(dev->of_node, "cell-index", &index);
|
|
||||||
if (ret)
|
|
||||||
index = 0;
|
|
||||||
|
|
||||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dpfe-cpu");
|
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dpfe-cpu");
|
||||||
priv->regs = devm_ioremap_resource(dev, res);
|
priv->regs = devm_ioremap_resource(dev, res);
|
||||||
if (IS_ERR(priv->regs)) {
|
if (IS_ERR(priv->regs)) {
|
||||||
@ -715,37 +707,22 @@ static int brcmstb_dpfe_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
ret = brcmstb_dpfe_download_firmware(pdev, &init);
|
ret = brcmstb_dpfe_download_firmware(pdev, &init);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err;
|
return ret;
|
||||||
|
|
||||||
dpfe_dev = devm_kzalloc(dev, sizeof(*dpfe_dev), GFP_KERNEL);
|
ret = sysfs_create_groups(&pdev->dev.kobj, dpfe_groups);
|
||||||
if (!dpfe_dev) {
|
if (!ret)
|
||||||
ret = -ENOMEM;
|
dev_info(dev, "registered.\n");
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
priv->dev = dpfe_dev;
|
|
||||||
priv->index = index;
|
|
||||||
|
|
||||||
dpfe_dev->parent = dev;
|
|
||||||
dpfe_dev->groups = dpfe_groups;
|
|
||||||
dpfe_dev->of_node = dev->of_node;
|
|
||||||
dev_set_drvdata(dpfe_dev, priv);
|
|
||||||
dev_set_name(dpfe_dev, "dpfe%u", index);
|
|
||||||
|
|
||||||
ret = device_register(dpfe_dev);
|
|
||||||
if (ret)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
dev_info(dev, "registered.\n");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
err:
|
|
||||||
dev_err(dev, "failed to initialize -- error %d\n", ret);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int brcmstb_dpfe_remove(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
sysfs_remove_groups(&pdev->dev.kobj, dpfe_groups);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct of_device_id brcmstb_dpfe_of_match[] = {
|
static const struct of_device_id brcmstb_dpfe_of_match[] = {
|
||||||
{ .compatible = "brcm,dpfe-cpu", },
|
{ .compatible = "brcm,dpfe-cpu", },
|
||||||
{}
|
{}
|
||||||
@ -758,6 +735,7 @@ static struct platform_driver brcmstb_dpfe_driver = {
|
|||||||
.of_match_table = brcmstb_dpfe_of_match,
|
.of_match_table = brcmstb_dpfe_of_match,
|
||||||
},
|
},
|
||||||
.probe = brcmstb_dpfe_probe,
|
.probe = brcmstb_dpfe_probe,
|
||||||
|
.remove = brcmstb_dpfe_remove,
|
||||||
.resume = brcmstb_dpfe_resume,
|
.resume = brcmstb_dpfe_resume,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user