Message ID | 20210114073429.176462-2-jiaxun.yang@flygoat.com |
---|---|
State | New |
Headers | show |
Series | ACPI: platform-profile enhancements | expand |
On Thu, Jan 14, 2021 at 8:42 AM Jiaxun Yang <jiaxun.yang@flygoat.com> wrote: > > All planned uses of cur_profile have their platform_profile_handler > defined as const, so just drop const qualifier here to prevent build > error. > > Link: https://lore.kernel.org/linux-acpi/5e7a4d87-52ef-e487-9cc2-8e7094beaa08@redhat.com/ > Suggested-by: Hans de Goede <hdegoede@redhat.com> > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> > --- > drivers/acpi/platform_profile.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c > index 91be50a32cc8..9dddf44b43d4 100644 > --- a/drivers/acpi/platform_profile.c > +++ b/drivers/acpi/platform_profile.c > @@ -9,7 +9,7 @@ > #include <linux/platform_profile.h> > #include <linux/sysfs.h> > > -static const struct platform_profile_handler *cur_profile; > +static struct platform_profile_handler *cur_profile; I think that it's not just here, but also in the platform_profile_register() argument. > static DEFINE_MUTEX(profile_lock); > > static const char * const profile_names[] = { > -- > 2.30.0 >
Hi, On 1/14/21 1:16 PM, Rafael J. Wysocki wrote: > On Thu, Jan 14, 2021 at 8:42 AM Jiaxun Yang <jiaxun.yang@flygoat.com> wrote: >> >> All planned uses of cur_profile have their platform_profile_handler >> defined as const, so just drop const qualifier here to prevent build >> error. >> >> Link: https://lore.kernel.org/linux-acpi/5e7a4d87-52ef-e487-9cc2-8e7094beaa08@redhat.com/ >> Suggested-by: Hans de Goede <hdegoede@redhat.com> >> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> >> --- >> drivers/acpi/platform_profile.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c >> index 91be50a32cc8..9dddf44b43d4 100644 >> --- a/drivers/acpi/platform_profile.c >> +++ b/drivers/acpi/platform_profile.c >> @@ -9,7 +9,7 @@ >> #include <linux/platform_profile.h> >> #include <linux/sysfs.h> >> >> -static const struct platform_profile_handler *cur_profile; >> +static struct platform_profile_handler *cur_profile; > > I think that it's not just here, but also in the > platform_profile_register() argument. Correct, this needs to be fixed in platform_profile_register() too, both in drivers/acpi/platform_profile.c and in include/linux/platform_profile.h Otherwise we will get a compiler warning (or maybe even an error) about assigning a pointer pointing to const memory to a pointer not pointing to const mem. Regards, Hans > >> static DEFINE_MUTEX(profile_lock); >> >> static const char * const profile_names[] = { >> -- >> 2.30.0 >> >
diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 91be50a32cc8..9dddf44b43d4 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -9,7 +9,7 @@ #include <linux/platform_profile.h> #include <linux/sysfs.h> -static const struct platform_profile_handler *cur_profile; +static struct platform_profile_handler *cur_profile; static DEFINE_MUTEX(profile_lock); static const char * const profile_names[] = {
All planned uses of cur_profile have their platform_profile_handler defined as const, so just drop const qualifier here to prevent build error. Link: https://lore.kernel.org/linux-acpi/5e7a4d87-52ef-e487-9cc2-8e7094beaa08@redhat.com/ Suggested-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- drivers/acpi/platform_profile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)