staging: greybus: declare struct of_device_id as const
Subsystems (3)
v2 cover staging: greybus: declare struct of_device_id as const
Address the following checkpatch warning:
WARNING: struct of_device_id should be normally const
Change in v2:
* Explain in the commit message why the change is correct
Eva Rachel Retuya (2):
staging: greybus: arche-apb-ctrl: declare struct of_device_id as const
staging: greybus: arche-platform: declare struct of_device_id as const
drivers/staging/greybus/arche-apb-ctrl.c | 2 +- drivers/staging/greybus/arche-platform.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/2 staging: greybus: arche-apb-ctrl: declare struct of_device_id as const
Declare the 'arche_apb_ctrl_of_match' array as const. This array is only stored in the .of_match_table field of a device_driver structure, which is declared as const. This addresses the checkpatch warning:
WARNING: struct of_device_id should be normally const
--- drivers/staging/greybus/arche-apb-ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/greybus/arche-apb-ctrl.c +1 -1
@@ -495,7 +495,7 @@ static void arche_apb_ctrl_shutdown(struct platform_device *pdev) static SIMPLE_DEV_PM_OPS(arche_apb_ctrl_pm_ops, arche_apb_ctrl_suspend, arche_apb_ctrl_resume); -static struct of_device_id arche_apb_ctrl_of_match[] = { +static const struct of_device_id arche_apb_ctrl_of_match[] = { { .compatible ="usbffff,2" , }, { }, };
Signature · 1 line
2.7.4
PATCH v2 2/2 staging: greybus: arche-platform: declare struct of_device_id as const
In reply to Eva Rachel RetuyaDeclare the arrays 'arche_platform_of_match' and 'arche_combined_id' as const.
'arche_platform_of_match' is only stored in the .of_match_table field of a device_driver structure, which is declared as const.
'arche_combined_id' is passed to MODULE_DEVICE_TABLE. This macro does not modify the array and therefore the array can be declared as const. Checkpatch pointed out both issues.
WARNING: struct of_device_id should be normally const
---
This is not compile-tested. The header file 'linux/usb/usb3613.h' is required, which is not present in the kernel.
drivers/staging/greybus/arche-platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/greybus/arche-platform.c +2 -2
@@ -776,12 +776,12 @@ static SIMPLE_DEV_PM_OPS(arche_platform_pm_ops, arche_platform_suspend, arche_platform_resume); -static struct of_device_id arche_platform_of_match[] = { +static const struct of_device_id arche_platform_of_match[] = { { .compatible ="google,arche-platform" , },/* Use PID/VID of SVC device */ { }, }; -static struct of_device_id arche_combined_id[] = { +static const struct of_device_id arche_combined_id[] = { { .compatible ="google,arche-platform" , },/* Use PID/VID of SVC device */ { .compatible ="usbffff,2" , }, { },
Signature · 1 line
2.7.4