powercap: dtpm: constify OF match table
PATCH 1/1 powercap: dtpm: constify OF match table
dtpm_create_hierarchy() only passes the OF match table to of_machine_get_match_data(), which already takes a const struct of_device_id pointer. The DTPM code does not modify the table.
Make the DTPM API const-correct and mark the Rockchip match table const as well. This documents the read-only contract and allows the table to live in read-only init data.
No functional change.
Signed-off-by Can Peng <[email protected]>
--- drivers/powercap/dtpm.c | 2 +- drivers/soc/rockchip/dtpm.c | 2 +- include/linux/dtpm.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/powercap/dtpm.c +1 -1
@@ -546,7 +546,7 @@ static int dtpm_for_each_child(const struct dtpm_node *hierarchy,* Return: zero on success, a negative value in case of error. Errors * are reported back from the underlying functions. */ -int dtpm_create_hierarchy (struct of_device_id *dtpm_match_table) +int dtpm_create_hierarchy (const struct of_device_id *dtpm_match_table) {const struct dtpm_node *hierarchy;int i, ret;
drivers/soc/rockchip/dtpm.c +1 -1
@@ -41,7 +41,7 @@ static struct dtpm_node __initdata rk3399_hierarchy[] = { [9] = { /* sentinel */ } }; -static struct of_device_id __initdata rockchip_dtpm_match_table[] = { +static const struct of_device_id rockchip_dtpm_match_table[]__initconst = { { .compatible ="rockchip,rk3399" , .data = rk3399_hierarchy }, {}, };
include/linux/dtpm.h +1 -1
@@ -67,7 +67,7 @@ void dtpm_unregister(struct dtpm *dtpm);int dtpm_register (const char *name,struct dtpm *dtpm,struct dtpm *parent); -int dtpm_create_hierarchy (struct of_device_id *dtpm_match_table); +int dtpm_create_hierarchy (const struct of_device_id *dtpm_match_table);void dtpm_destroy_hierarchy (void );#endif
Signature · 1 line
2.53.0