* [PATCH 0/2] ACPI: platform-profile enhancements
@ 2021-01-14 7:30 Jiaxun Yang
2021-01-14 7:30 ` [PATCH 1/2] ACPI: platform-profile: Drop const qualifier for cur_profile Jiaxun Yang
2021-01-14 7:30 ` [PATCH 2/2] ACPI: platform-profile: Introduce object pointers to callbacks Jiaxun Yang
0 siblings, 2 replies; 3+ messages in thread
From: Jiaxun Yang @ 2021-01-14 7:30 UTC (permalink / raw)
To: linux-acpi; +Cc: hdegoede, linux-pm, rjw, Jiaxun Yang
Replacing b417d9c7404df67b9be0104585fefb2ca8d36677 at pm/bleeding-edge.
Jiaxun Yang (2):
ACPI: platform-profile: Drop const qualifier for cur_profile
ACPI: platform-profile: Introduce object pointers to callbacks
drivers/acpi/platform_profile.c | 6 +++---
include/linux/platform_profile.h | 6 ++++--
2 files changed, 7 insertions(+), 5 deletions(-)
--
2.30.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] ACPI: platform-profile: Drop const qualifier for cur_profile
2021-01-14 7:30 [PATCH 0/2] ACPI: platform-profile enhancements Jiaxun Yang
@ 2021-01-14 7:30 ` Jiaxun Yang
2021-01-14 7:30 ` [PATCH 2/2] ACPI: platform-profile: Introduce object pointers to callbacks Jiaxun Yang
1 sibling, 0 replies; 3+ messages in thread
From: Jiaxun Yang @ 2021-01-14 7:30 UTC (permalink / raw)
To: linux-acpi; +Cc: hdegoede, linux-pm, rjw, Jiaxun Yang
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;
static DEFINE_MUTEX(profile_lock);
static const char * const profile_names[] = {
--
2.30.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] ACPI: platform-profile: Introduce object pointers to callbacks
2021-01-14 7:30 [PATCH 0/2] ACPI: platform-profile enhancements Jiaxun Yang
2021-01-14 7:30 ` [PATCH 1/2] ACPI: platform-profile: Drop const qualifier for cur_profile Jiaxun Yang
@ 2021-01-14 7:30 ` Jiaxun Yang
1 sibling, 0 replies; 3+ messages in thread
From: Jiaxun Yang @ 2021-01-14 7:30 UTC (permalink / raw)
To: linux-acpi; +Cc: hdegoede, linux-pm, rjw, Jiaxun Yang
Add a object pointer to handler callbacks to avoid having
global variables everywhere.
Link: https://lore.kernel.org/linux-acpi/6a29f338-d9e4-150c-81dd-2ffb54f5bc35@redhat.com/
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Suggested-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/acpi/platform_profile.c | 4 ++--
include/linux/platform_profile.h | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c
index 9dddf44b43d4..6398b40e6d31 100644
--- a/drivers/acpi/platform_profile.c
+++ b/drivers/acpi/platform_profile.c
@@ -64,7 +64,7 @@ static ssize_t platform_profile_show(struct device *dev,
return -ENODEV;
}
- err = cur_profile->profile_get(&profile);
+ err = cur_profile->profile_get(cur_profile, &profile);
mutex_unlock(&profile_lock);
if (err)
return err;
@@ -104,7 +104,7 @@ static ssize_t platform_profile_store(struct device *dev,
return -EOPNOTSUPP;
}
- err = cur_profile->profile_set(i);
+ err = cur_profile->profile_set(cur_profile, i);
mutex_unlock(&profile_lock);
if (err)
return err;
diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h
index 3623d7108421..43f4583b5259 100644
--- a/include/linux/platform_profile.h
+++ b/include/linux/platform_profile.h
@@ -28,8 +28,10 @@ enum platform_profile_option {
struct platform_profile_handler {
unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)];
- int (*profile_get)(enum platform_profile_option *profile);
- int (*profile_set)(enum platform_profile_option profile);
+ int (*profile_get)(struct platform_profile_handler *pprof,
+ enum platform_profile_option *profile);
+ int (*profile_set)(struct platform_profile_handler *pprof,
+ enum platform_profile_option profile);
};
int platform_profile_register(const struct platform_profile_handler *pprof);
--
2.30.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-14 7:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-14 7:30 [PATCH 0/2] ACPI: platform-profile enhancements Jiaxun Yang
2021-01-14 7:30 ` [PATCH 1/2] ACPI: platform-profile: Drop const qualifier for cur_profile Jiaxun Yang
2021-01-14 7:30 ` [PATCH 2/2] ACPI: platform-profile: Introduce object pointers to callbacks Jiaxun Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).