Message ID | 20210125115957.3292-3-hdegoede@redhat.com |
---|---|
State | New |
Headers | show |
Series | ACPI: platform-profile: Introduce object pointers to callbacks | expand |
On Tue, Jan 26, 2021 at 6:58 AM Hans de Goede <hdegoede@redhat.com> wrote: > > From: Jiaxun Yang <jiaxun.yang@flygoat.com> > > Add an object pointer to handler callbacks to avoid the need for > drivers to have a global variable to get to their driver-data > struct. > > Link: https://lore.kernel.org/linux-acpi/6a29f338-d9e4-150c-81dd-2ffb54f5bc35@redhat.com/ > Link: https://lore.kernel.org/r/20210114073429.176462-3-jiaxun.yang@flygoat.com > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> > Suggested-by: Hans de Goede <hdegoede@redhat.com> > Signed-off-by: Hans de Goede <hdegoede@redhat.com> Applied on top of the previous platform-profile patches, thanks! > --- > Changes in v2 (Hans de Goede): > - Tweak the commit message wording a bit > --- > 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 f65c61db7921..80e9df427eb8 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 c797fdb3d91a..a26542d53058 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(struct platform_profile_handler *pprof); > -- > 2.29.2 >
On Wed, Jan 27, 2021 at 6:47 PM Rafael J. Wysocki <rafael@kernel.org> wrote: > > On Tue, Jan 26, 2021 at 6:58 AM Hans de Goede <hdegoede@redhat.com> wrote: > > > > From: Jiaxun Yang <jiaxun.yang@flygoat.com> > > > > Add an object pointer to handler callbacks to avoid the need for > > drivers to have a global variable to get to their driver-data > > struct. > > > > Link: https://lore.kernel.org/linux-acpi/6a29f338-d9e4-150c-81dd-2ffb54f5bc35@redhat.com/ > > Link: https://lore.kernel.org/r/20210114073429.176462-3-jiaxun.yang@flygoat.com > > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> > > Suggested-by: Hans de Goede <hdegoede@redhat.com> > > Signed-off-by: Hans de Goede <hdegoede@redhat.com> > > Applied on top of the previous platform-profile patches, thanks! And the entire acpi-platform-profile material is now available for you to pull in the git branch at: git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git \ acpi-platform which is not going to be rebased going forward. Thanks!
Hi, On 2/1/21 2:55 PM, Rafael J. Wysocki wrote: > On Wed, Jan 27, 2021 at 6:47 PM Rafael J. Wysocki <rafael@kernel.org> wrote: >> >> On Tue, Jan 26, 2021 at 6:58 AM Hans de Goede <hdegoede@redhat.com> wrote: >>> >>> From: Jiaxun Yang <jiaxun.yang@flygoat.com> >>> >>> Add an object pointer to handler callbacks to avoid the need for >>> drivers to have a global variable to get to their driver-data >>> struct. >>> >>> Link: https://lore.kernel.org/linux-acpi/6a29f338-d9e4-150c-81dd-2ffb54f5bc35@redhat.com/ >>> Link: https://lore.kernel.org/r/20210114073429.176462-3-jiaxun.yang@flygoat.com >>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> >>> Suggested-by: Hans de Goede <hdegoede@redhat.com> >>> Signed-off-by: Hans de Goede <hdegoede@redhat.com> >> >> Applied on top of the previous platform-profile patches, thanks! > > And the entire acpi-platform-profile material is now available for you > to pull in the git branch at: > > git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git \ > acpi-platform > > which is not going to be rebased going forward. Thank you. I've merged this into pdx86/for-next now. Regards, Hans
diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index f65c61db7921..80e9df427eb8 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 c797fdb3d91a..a26542d53058 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(struct platform_profile_handler *pprof);