From: Jiaxun Yang <jiaxun.yang@flygoat.com>
To: platform-driver-x86@vger.kernel.org
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Len Brown <lenb@kernel.org>, Hans de Goede <hdegoede@redhat.com>,
Mark Gross <mgross@linux.intel.com>,
Ike Panhc <ike.pan@canonical.com>,
Mark Pearson <markpearson@lenovo.com>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] ACPI: platform-profile: Introduce data parameter to handler
Date: Fri, 1 Jan 2021 20:56:25 +0800 [thread overview]
Message-ID: <20210101125629.20974-2-jiaxun.yang@flygoat.com> (raw)
In-Reply-To: <20210101125629.20974-1-jiaxun.yang@flygoat.com>
Add a data parameter to handler callbacks to avoid having
global variables everywhere.
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
drivers/acpi/platform_profile.c | 4 ++--
include/linux/platform_profile.h | 5 +++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c
index 91be50a32cc8..60072f6e032d 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->data, &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->data, 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..272faf55875d 100644
--- a/include/linux/platform_profile.h
+++ b/include/linux/platform_profile.h
@@ -27,9 +27,10 @@ enum platform_profile_option {
};
struct platform_profile_handler {
+ void *data;
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)(void *data, enum platform_profile_option *profile);
+ int (*profile_set)(void *data, enum platform_profile_option profile);
};
int platform_profile_register(const struct platform_profile_handler *pprof);
--
2.30.0
next prev parent reply other threads:[~2021-01-01 12:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-01 12:56 [PATCH 0/2] IdeaPad platform profile support Jiaxun Yang
2021-01-01 12:56 ` Jiaxun Yang [this message]
2021-01-04 14:34 ` [PATCH 1/2] ACPI: platform-profile: Introduce data parameter to handler Hans de Goede
2021-01-01 12:56 ` [PATCH 2/2] platform/x86: ideapad-laptop: DYTC Platform profile support Jiaxun Yang
2021-01-04 14:34 ` [PATCH 0/2] IdeaPad platform " Hans de Goede
2021-01-04 20:33 ` Rafael J. Wysocki
2021-01-04 20:58 ` Hans de Goede
2021-01-04 21:58 ` [External] " Mark Pearson
2021-01-05 6:24 ` Jiaxun Yang
2021-01-05 16:53 ` Mark Pearson
2021-01-05 10:28 ` Hans de Goede
2021-01-05 17:18 ` Rafael J. Wysocki
2021-01-06 9:17 ` Hans de Goede
2021-01-07 13:50 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210101125629.20974-2-jiaxun.yang@flygoat.com \
--to=jiaxun.yang@flygoat.com \
--cc=hdegoede@redhat.com \
--cc=ike.pan@canonical.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=markpearson@lenovo.com \
--cc=mgross@linux.intel.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).