aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2014-04-19 06:20:42 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-07-04 13:05:57 -0400
commit84448288546d13d7e06fd6638fb78ddff559b399 (patch)
tree294401d051020aefbadf6dc3d057a642f0547b8c
parentb509cc802239a8b5ba7d1d2cc5adfb9d984b7ed8 (diff)
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>
-rw-r--r--drivers/gpu/drm/msm/msm_drv.c83
1 files changed, 35 insertions, 48 deletions
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 9a5d87db5c23..a322029983ce 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -905,12 +905,41 @@ static int compare_of(struct device *dev, void *data)
905{ 905{
906 return dev->of_node == data; 906 return dev->of_node == data;
907} 907}
908#else
909static int compare_dev(struct device *dev, void *data)
910{
911 return dev == data;
912}
913#endif
914
915static int msm_drm_bind(struct device *dev)
916{
917 return drm_platform_init(&msm_driver, to_platform_device(dev));
918}
919
920static void msm_drm_unbind(struct device *dev)
921{
922 drm_put_dev(platform_get_drvdata(to_platform_device(dev)));
923}
924
925static const struct component_master_ops msm_drm_ops = {
926 .bind = msm_drm_bind,
927 .unbind = msm_drm_unbind,
928};
929
930/*
931 * Platform driver:
932 */
908 933
909static int msm_drm_add_components(struct device *master, struct master *m) 934static int msm_pdev_probe(struct platform_device *pdev)
910{ 935{
911 struct device_node *np = master->of_node; 936 struct component_match *match = NULL;
937#ifdef CONFIG_OF
938 /* NOTE: the CONFIG_OF case duplicates the same code as exynos or imx
939 * (or probably any other).. so probably some room for some helpers
940 */
941 struct device_node *np = pdev->dev.of_node;
912 unsigned i; 942 unsigned i;
913 int ret;
914 943
915 for (i = 0; ; i++) { 944 for (i = 0; ; i++) {
916 struct device_node *node; 945 struct device_node *node;
@@ -919,22 +948,9 @@ static int msm_drm_add_components(struct device *master, struct master *m)
919 if (!node) 948 if (!node)
920 break; 949 break;
921 950
922 ret = component_master_add_child(m, compare_of, node); 951 component_match_add(&pdev->dev, &match, compare_of, node);
923 of_node_put(node);
924
925 if (ret)
926 return ret;
927 } 952 }
928 return 0;
929}
930#else 953#else
931static int compare_dev(struct device *dev, void *data)
932{
933 return dev == data;
934}
935
936static int msm_drm_add_components(struct device *master, struct master *m)
937{
938 /* For non-DT case, it kinda sucks. We don't actually have a way 954 /* For non-DT case, it kinda sucks. We don't actually have a way
939 * to know whether or not we are waiting for certain devices (or if 955 * to know whether or not we are waiting for certain devices (or if
940 * they are simply not present). But for non-DT we only need to 956 * 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)
958 return -EPROBE_DEFER; 974 return -EPROBE_DEFER;
959 } 975 }
960 976
961 ret = component_master_add_child(m, compare_dev, dev); 977 component_match_add(&pdev->dev, &match, compare_dev, dev);
962 if (ret) {
963 DBG("could not add child: %d", ret);
964 return ret;
965 }
966 } 978 }
967
968 return 0;
969}
970#endif 979#endif
971 980
972static int msm_drm_bind(struct device *dev)
973{
974 return drm_platform_init(&msm_driver, to_platform_device(dev));
975}
976
977static void msm_drm_unbind(struct device *dev)
978{
979 drm_put_dev(platform_get_drvdata(to_platform_device(dev)));
980}
981
982static const struct component_master_ops msm_drm_ops = {
983 .add_components = msm_drm_add_components,
984 .bind = msm_drm_bind,
985 .unbind = msm_drm_unbind,
986};
987
988/*
989 * Platform driver:
990 */
991
992static int msm_pdev_probe(struct platform_device *pdev)
993{
994 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 981 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
995 return component_master_add(&pdev->dev, &msm_drm_ops); 982 return component_master_add_with_match(&pdev->dev, &msm_drm_ops, match);
996} 983}
997 984
998static int msm_pdev_remove(struct platform_device *pdev) 985static int msm_pdev_remove(struct platform_device *pdev)