Skip to contentSkip to conversation

drm/imx/dcss: Use device_get_match_data()

PATCH In review Fabio Estevam 3 participants 3 messages Mar 15, 2021 – Mar 22, 2021

Subsystems (4)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/1 drm/imx/dcss: Use device_get_match_data()

The retrieval of driver data can be a bit simplified by using device_get_match_data(), so switch to it.

---
 drivers/gpu/drm/imx/dcss/dcss-dev.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/gpu/drm/imx/dcss/dcss-dev.c +1 -8
index c849533ca83e..de0f02de94c4 100644
@@ -168,13 +168,6 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output)
 	int ret;
 	struct resource *res;
 	struct dcss_dev *dcss;
-	const struct dcss_type_data *devtype;
-
-	devtype = of_device_get_match_data(dev);
-	if (!devtype) {
-		dev_err(dev, "no device match found\n");
-		return ERR_PTR(-ENODEV);
-	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res) {
@@ -187,7 +180,7 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output)
 		return ERR_PTR(-ENOMEM);
 
 	dcss->dev = dev;
-	dcss->devtype = devtype;
+	dcss->devtype = device_get_match_data(dev);
 	dcss->hdmi_output = hdmi_output;
 
 	ret = dcss_clks_init(dcss);
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi Fabio,

Quoted 4 lines · Fabio Estevam

The retrieval of driver data can be a bit simplified by using device_get_match_data(), so switch to it.

Quoted 34 lines
---
 drivers/gpu/drm/imx/dcss/dcss-dev.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/gpu/drm/imx/dcss/dcss-dev.c +1 -8
index c849533ca83e..de0f02de94c4 100644
@@ -168,13 +168,6 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output)
 	int ret;
 	struct resource *res;
 	struct dcss_dev *dcss;
-	const struct dcss_type_data *devtype;
-
-	devtype = of_device_get_match_data(dev);
-	if (!devtype) {
-		dev_err(dev, "no device match found\n");
-		return ERR_PTR(-ENODEV);
-	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res) {
@@ -187,7 +180,7 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output)
 		return ERR_PTR(-ENOMEM);
 
 	dcss->dev = dev;
-	dcss->devtype = devtype;
+	dcss->devtype = device_get_match_data(dev);
 	dcss->hdmi_output = hdmi_output;
 
 	ret = dcss_clks_init(dcss);
Signature · 1 line
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
In reply to Fabio Estevam

Hi Fabio,

Quoted 14 lines · Fabio Estevam

The retrieval of driver data can be a bit simplified by using device_get_match_data(), so switch to it.

---
 drivers/gpu/drm/imx/dcss/dcss-dev.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/gpu/drm/imx/dcss/dcss-dev.c +0 -0
index c849533ca83e..de0f02de94c4 100644

drivers/gpu/drm/imx/dcss/dcss-dev.c struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output) · line 173

Quoted 6 lines
drivers/gpu/drm/imx/dcss/dcss-dev.c +0 -3
@@ -168,13 +168,6 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output)
        int ret;
        struct resource *res;
        struct dcss_dev *dcss;
-       const struct dcss_type_data *devtype;
-
-       devtype = of_device_get_match_data(dev);

It looks like this is the only user of linux/of_device.h in this file? If so, remove linux/of_device.h and include linux/platform_device.h?

Regards,
Liu Ying

Quoted 19 lines
drivers/gpu/drm/imx/dcss/dcss-dev.c +1 -6
-       if (!devtype) {
-               dev_err(dev, "no device match found\n");
-               return ERR_PTR(-ENODEV);
-       }
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (!res) {
@@ -187,7 +180,7 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output)
                return ERR_PTR(-ENOMEM);
 
        dcss->dev = dev;
-       dcss->devtype = devtype;
+       dcss->devtype = device_get_match_data(dev);
        dcss->hdmi_output = hdmi_output;
 
        ret = dcss_clks_init(dcss);
--

2.17.1

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel