Drop the const qualifier from the static global cur_profile pointer declaration. This is a preparation patch for passing the cur_profile pointer as parameter to the profile_get() and profile_set() callbacks so that drivers dynamically allocating their driver-data struct, with their platform_profile_handler struct embedded, can use this pointer to get to their driver-data. Note this also requires dropping the const from the pprof platform_profile_register() function argument. Dropping this const is not a problem, non of the queued up consumers of platform_profile_register() actually pass in a const pointer. Link: https://lore.kernel.org/linux-acpi/5e7a4d87-52ef-e487-9cc2-8e7094beaa08@redhat.com/ Link: https://lore.kernel.org/r/20210114073429.176462-2-jiaxun.yang@flygoat.com Suggested-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> [ hdegoede@redhat.com: Also remove const from platform_profile_register() ] Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
39 lines
1 KiB
C
39 lines
1 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* Platform profile sysfs interface
|
|
*
|
|
* See Documentation/ABI/testing/sysfs-platform_profile.rst for more
|
|
* information.
|
|
*/
|
|
|
|
#ifndef _PLATFORM_PROFILE_H_
|
|
#define _PLATFORM_PROFILE_H_
|
|
|
|
#include <linux/bitops.h>
|
|
|
|
/*
|
|
* If more options are added please update profile_names
|
|
* array in platform-profile.c and sysfs-platform-profile.rst
|
|
* documentation.
|
|
*/
|
|
|
|
enum platform_profile_option {
|
|
PLATFORM_PROFILE_LOW_POWER,
|
|
PLATFORM_PROFILE_COOL,
|
|
PLATFORM_PROFILE_QUIET,
|
|
PLATFORM_PROFILE_BALANCED,
|
|
PLATFORM_PROFILE_PERFORMANCE,
|
|
PLATFORM_PROFILE_LAST, /*must always be last */
|
|
};
|
|
|
|
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 platform_profile_register(struct platform_profile_handler *pprof);
|
|
int platform_profile_remove(void);
|
|
void platform_profile_notify(void);
|
|
|
|
#endif /*_PLATFORM_PROFILE_H_*/
|