Skip to content

Commit 4af6bc1

Browse files
krzkstorulf
authored andcommitted
pmdomain: core: constify of_phandle_args in add device and subdomain
Pointer to of_phandle_args is not modified by of_genpd_add_device() and of_genpd_add_subdomain(), so it can be made pointer to const for code safety and readability. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20240208202822.631449-2-krzysztof.kozlowski@linaro.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 4d08246 commit 4af6bc1

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

drivers/pmdomain/core.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2526,7 +2526,7 @@ EXPORT_SYMBOL_GPL(of_genpd_del_provider);
25262526
* on failure.
25272527
*/
25282528
static struct generic_pm_domain *genpd_get_from_provider(
2529-
struct of_phandle_args *genpdspec)
2529+
const struct of_phandle_args *genpdspec)
25302530
{
25312531
struct generic_pm_domain *genpd = ERR_PTR(-ENOENT);
25322532
struct of_genpd_provider *provider;
@@ -2557,7 +2557,7 @@ static struct generic_pm_domain *genpd_get_from_provider(
25572557
* Looks-up an I/O PM domain based upon phandle args provided and adds
25582558
* the device to the PM domain. Returns a negative error code on failure.
25592559
*/
2560-
int of_genpd_add_device(struct of_phandle_args *genpdspec, struct device *dev)
2560+
int of_genpd_add_device(const struct of_phandle_args *genpdspec, struct device *dev)
25612561
{
25622562
struct generic_pm_domain *genpd;
25632563
int ret;
@@ -2591,8 +2591,8 @@ EXPORT_SYMBOL_GPL(of_genpd_add_device);
25912591
* provided and adds the subdomain to the parent PM domain. Returns a
25922592
* negative error code on failure.
25932593
*/
2594-
int of_genpd_add_subdomain(struct of_phandle_args *parent_spec,
2595-
struct of_phandle_args *subdomain_spec)
2594+
int of_genpd_add_subdomain(const struct of_phandle_args *parent_spec,
2595+
const struct of_phandle_args *subdomain_spec)
25962596
{
25972597
struct generic_pm_domain *parent, *subdomain;
25982598
int ret;
@@ -2629,8 +2629,8 @@ EXPORT_SYMBOL_GPL(of_genpd_add_subdomain);
26292629
* provided and removes the subdomain from the parent PM domain. Returns a
26302630
* negative error code on failure.
26312631
*/
2632-
int of_genpd_remove_subdomain(struct of_phandle_args *parent_spec,
2633-
struct of_phandle_args *subdomain_spec)
2632+
int of_genpd_remove_subdomain(const struct of_phandle_args *parent_spec,
2633+
const struct of_phandle_args *subdomain_spec)
26342634
{
26352635
struct generic_pm_domain *parent, *subdomain;
26362636
int ret;

include/linux/pm_domain.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,11 @@ int of_genpd_add_provider_simple(struct device_node *np,
364364
int of_genpd_add_provider_onecell(struct device_node *np,
365365
struct genpd_onecell_data *data);
366366
void of_genpd_del_provider(struct device_node *np);
367-
int of_genpd_add_device(struct of_phandle_args *args, struct device *dev);
368-
int of_genpd_add_subdomain(struct of_phandle_args *parent_spec,
369-
struct of_phandle_args *subdomain_spec);
370-
int of_genpd_remove_subdomain(struct of_phandle_args *parent_spec,
371-
struct of_phandle_args *subdomain_spec);
367+
int of_genpd_add_device(const struct of_phandle_args *args, struct device *dev);
368+
int of_genpd_add_subdomain(const struct of_phandle_args *parent_spec,
369+
const struct of_phandle_args *subdomain_spec);
370+
int of_genpd_remove_subdomain(const struct of_phandle_args *parent_spec,
371+
const struct of_phandle_args *subdomain_spec);
372372
struct generic_pm_domain *of_genpd_remove_last(struct device_node *np);
373373
int of_genpd_parse_idle_states(struct device_node *dn,
374374
struct genpd_power_state **states, int *n);
@@ -393,20 +393,20 @@ static inline int of_genpd_add_provider_onecell(struct device_node *np,
393393

394394
static inline void of_genpd_del_provider(struct device_node *np) {}
395395

396-
static inline int of_genpd_add_device(struct of_phandle_args *args,
396+
static inline int of_genpd_add_device(const struct of_phandle_args *args,
397397
struct device *dev)
398398
{
399399
return -ENODEV;
400400
}
401401

402-
static inline int of_genpd_add_subdomain(struct of_phandle_args *parent_spec,
403-
struct of_phandle_args *subdomain_spec)
402+
static inline int of_genpd_add_subdomain(const struct of_phandle_args *parent_spec,
403+
const struct of_phandle_args *subdomain_spec)
404404
{
405405
return -ENODEV;
406406
}
407407

408-
static inline int of_genpd_remove_subdomain(struct of_phandle_args *parent_spec,
409-
struct of_phandle_args *subdomain_spec)
408+
static inline int of_genpd_remove_subdomain(const struct of_phandle_args *parent_spec,
409+
const struct of_phandle_args *subdomain_spec)
410410
{
411411
return -ENODEV;
412412
}

0 commit comments

Comments
 (0)