Skip to contentSkip to conversation

drm/tilcdc: add const to of_device_id

PATCH Superseded Xiang wangx 3 participants 3 messages Dec 16, 2021

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/tilcdc: add const to of_device_id

struct of_device_id should normally be const.

---

Changes since v1
* add const in line 63

 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tilcdc/tilcdc_drv.c +2 -2
index 3ddb7c710a3d..7c36ecd82ebc 100644
@@ -60,7 +60,7 @@ void tilcdc_module_cleanup(struct tilcdc_module *mod)
 	list_del(&mod->list);
 }
 
-static struct of_device_id tilcdc_of_match[];
+static const struct of_device_id tilcdc_of_match[];
 
 static int tilcdc_atomic_check(struct drm_device *dev,
 			       struct drm_atomic_state *state)
@@ -587,7 +587,7 @@ static int tilcdc_pdev_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static struct of_device_id tilcdc_of_match[] = {
+static const struct of_device_id tilcdc_of_match[] = {
 		{ .compatible = "ti,am33xx-tilcdc", },
 		{ .compatible = "ti,da850-tilcdc", },
 		{ },
Signature · 1 line
2.34.1
#1 lore raw
Quoted 1 line · Xiang wangx

struct of_device_id should normally be const.

[]

drivers/gpu/drm/tilcdc/tilcdc_drv.c

Quoted 1 line
drivers/gpu/drm/tilcdc/tilcdc_drv.c +0 -0

[]

drivers/gpu/drm/tilcdc/tilcdc_drv.c void tilcdc_module_cleanup(struct tilcdc_module *mod) · line 63

Quoted 6 lines
drivers/gpu/drm/tilcdc/tilcdc_drv.c +1 -1
@@ -60,7 +60,7 @@ void tilcdc_module_cleanup(struct tilcdc_module *mod)
 	list_del(&mod->list);
 }
 
-static struct of_device_id tilcdc_of_match[];
+static const struct of_device_id tilcdc_of_match[];

This line could likely be removed instead.

$ git grep -w -n tilcdc_of_match
drivers/gpu/drm/tilcdc/tilcdc_drv.c:63:static struct of_device_id tilcdc_of_match[];
drivers/gpu/drm/tilcdc/tilcdc_drv.c:590:static struct of_device_id tilcdc_of_match[] = {
drivers/gpu/drm/tilcdc/tilcdc_drv.c:595:MODULE_DEVICE_TABLE(of, tilcdc_of_match);
drivers/gpu/drm/tilcdc/tilcdc_drv.c:603:                .of_match_table = tilcdc_of_match,
Quoted 9 lines
drivers/gpu/drm/tilcdc/tilcdc_drv.c +1 -1
@@ -587,7 +587,7 @@ static int tilcdc_pdev_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static struct of_device_id tilcdc_of_match[] = {
+static const struct of_device_id tilcdc_of_match[] = {
 		{ .compatible = "ti,am33xx-tilcdc", },
 		{ .compatible = "ti,da850-tilcdc", },
 		{ },
maintainer
#2 lore raw
Quoted 15 lines · Joe Perches
Quoted 1 line · Xiang wangx

struct of_device_id should normally be const.

[]

drivers/gpu/drm/tilcdc/tilcdc_drv.c

Quoted 1 line
drivers/gpu/drm/tilcdc/tilcdc_drv.c +0 -0

[]

drivers/gpu/drm/tilcdc/tilcdc_drv.c void tilcdc_module_cleanup(struct tilcdc_module · line 64

Quoted 7 lines
drivers/gpu/drm/tilcdc/tilcdc_drv.c +1 -1
@@ -60,7 +60,7 @@ void tilcdc_module_cleanup(struct tilcdc_module 
 *mod)
 	list_del(&mod->list);
 }
 
-static struct of_device_id tilcdc_of_match[];
+static const struct of_device_id tilcdc_of_match[];

This line could likely be removed instead.

Quoted 10 lines
$ git grep -w -n tilcdc_of_match
drivers/gpu/drm/tilcdc/tilcdc_drv.c:63:static struct of_device_id
tilcdc_of_match[];
drivers/gpu/drm/tilcdc/tilcdc_drv.c:590:static struct of_device_id
tilcdc_of_match[] = {
drivers/gpu/drm/tilcdc/tilcdc_drv.c:595:MODULE_DEVICE_TABLE(of,
tilcdc_of_match);
drivers/gpu/drm/tilcdc/tilcdc_drv.c:603:
.of_match_table = tilcdc_of_match,

Oh yes. It appears to have been there from day one and even then it was bogus.

Xiang Wang, could you produce one more version of the patch with the declaration removed.

Best regards,
Jyri

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/tilcdc/tilcdc_drv.c +1 -1
@@ -587,7 +587,7 @@ static int tilcdc_pdev_remove(struct 
 platform_device *pdev)
 	return 0;
 }
 
-static struct of_device_id tilcdc_of_match[] = {
+static const struct of_device_id tilcdc_of_match[] = {
 		{ .compatible = "ti,am33xx-tilcdc", },
 		{ .compatible = "ti,da850-tilcdc", },

{ },