drm: msm: update to use component match support
Update MSM's DRM driver to use the component match support rather than add_components. Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
Родитель
b509cc8022
Коммит
8444828854
|
@ -905,12 +905,41 @@ static int compare_of(struct device *dev, void *data)
|
||||||
{
|
{
|
||||||
return dev->of_node == data;
|
return dev->of_node == data;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
static int msm_drm_add_components(struct device *master, struct master *m)
|
static int compare_dev(struct device *dev, void *data)
|
||||||
{
|
{
|
||||||
struct device_node *np = master->of_node;
|
return dev == data;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int msm_drm_bind(struct device *dev)
|
||||||
|
{
|
||||||
|
return drm_platform_init(&msm_driver, to_platform_device(dev));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void msm_drm_unbind(struct device *dev)
|
||||||
|
{
|
||||||
|
drm_put_dev(platform_get_drvdata(to_platform_device(dev)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct component_master_ops msm_drm_ops = {
|
||||||
|
.bind = msm_drm_bind,
|
||||||
|
.unbind = msm_drm_unbind,
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Platform driver:
|
||||||
|
*/
|
||||||
|
|
||||||
|
static int msm_pdev_probe(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct component_match *match = NULL;
|
||||||
|
#ifdef CONFIG_OF
|
||||||
|
/* NOTE: the CONFIG_OF case duplicates the same code as exynos or imx
|
||||||
|
* (or probably any other).. so probably some room for some helpers
|
||||||
|
*/
|
||||||
|
struct device_node *np = pdev->dev.of_node;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
int ret;
|
|
||||||
|
|
||||||
for (i = 0; ; i++) {
|
for (i = 0; ; i++) {
|
||||||
struct device_node *node;
|
struct device_node *node;
|
||||||
|
@ -919,22 +948,9 @@ static int msm_drm_add_components(struct device *master, struct master *m)
|
||||||
if (!node)
|
if (!node)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ret = component_master_add_child(m, compare_of, node);
|
component_match_add(&pdev->dev, &match, compare_of, node);
|
||||||
of_node_put(node);
|
|
||||||
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
static int compare_dev(struct device *dev, void *data)
|
|
||||||
{
|
|
||||||
return dev == data;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int msm_drm_add_components(struct device *master, struct master *m)
|
|
||||||
{
|
|
||||||
/* For non-DT case, it kinda sucks. We don't actually have a way
|
/* For non-DT case, it kinda sucks. We don't actually have a way
|
||||||
* to know whether or not we are waiting for certain devices (or if
|
* to know whether or not we are waiting for certain devices (or if
|
||||||
* they are simply not present). But for non-DT we only need to
|
* they are simply not present). But for non-DT we only need to
|
||||||
|
@ -958,41 +974,12 @@ static int msm_drm_add_components(struct device *master, struct master *m)
|
||||||
return -EPROBE_DEFER;
|
return -EPROBE_DEFER;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = component_master_add_child(m, compare_dev, dev);
|
component_match_add(&pdev->dev, &match, compare_dev, dev);
|
||||||
if (ret) {
|
|
||||||
DBG("could not add child: %d", ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int msm_drm_bind(struct device *dev)
|
|
||||||
{
|
|
||||||
return drm_platform_init(&msm_driver, to_platform_device(dev));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void msm_drm_unbind(struct device *dev)
|
|
||||||
{
|
|
||||||
drm_put_dev(platform_get_drvdata(to_platform_device(dev)));
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct component_master_ops msm_drm_ops = {
|
|
||||||
.add_components = msm_drm_add_components,
|
|
||||||
.bind = msm_drm_bind,
|
|
||||||
.unbind = msm_drm_unbind,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Platform driver:
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int msm_pdev_probe(struct platform_device *pdev)
|
|
||||||
{
|
|
||||||
pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
|
pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
|
||||||
return component_master_add(&pdev->dev, &msm_drm_ops);
|
return component_master_add_with_match(&pdev->dev, &msm_drm_ops, match);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int msm_pdev_remove(struct platform_device *pdev)
|
static int msm_pdev_remove(struct platform_device *pdev)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче