mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
x86_energy_perf_policy: Cleanup: Define HWP_WINDOW_MAX_USEC
Define HWP_WINDOW_MAX_USEC Doing so pointed out that it should be unsigned, so change associated code that touches it to use unsigned. Assisted-by: GitHub-Copilot:Claude-Sonnet-4.6 Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
parent
d865b3810b
commit
22d8ec33a7
|
|
@ -34,6 +34,9 @@
|
|||
#define OPTARG_BALANCE_PERFORMANCE (INT_MAX - 4)
|
||||
#define OPTARG_PERFORMANCE (INT_MAX - 5)
|
||||
|
||||
/* Maximum HWP activity window duration in microseconds */
|
||||
#define HWP_WINDOW_MAX_USEC 1270000000U
|
||||
|
||||
struct msr_hwp_cap {
|
||||
unsigned char highest;
|
||||
unsigned char guaranteed;
|
||||
|
|
@ -259,7 +262,7 @@ int parse_cmdline_hwp_desired(int i)
|
|||
return i;
|
||||
}
|
||||
|
||||
int parse_cmdline_hwp_window(int i)
|
||||
unsigned int parse_cmdline_hwp_window(unsigned int i)
|
||||
{
|
||||
unsigned int exponent;
|
||||
|
||||
|
|
@ -273,13 +276,13 @@ int parse_cmdline_hwp_window(int i)
|
|||
case OPTARG_PERFORMANCE:
|
||||
return 0;
|
||||
}
|
||||
if (i < 0 || i > 1270000000) {
|
||||
fprintf(stderr, "--hwp-window: 0 for auto; 1 - 1270000000 usec for window duration\n");
|
||||
if (i > HWP_WINDOW_MAX_USEC) {
|
||||
fprintf(stderr, "--hwp-window: 0 for auto; 1 - %u usec for window duration\n", HWP_WINDOW_MAX_USEC);
|
||||
usage();
|
||||
}
|
||||
for (exponent = 0;; ++exponent) {
|
||||
if (debug)
|
||||
printf("%d 10^%d\n", i, exponent);
|
||||
printf("%u 10^%d\n", i, exponent);
|
||||
|
||||
if (i <= 127)
|
||||
break;
|
||||
|
|
@ -287,7 +290,7 @@ int parse_cmdline_hwp_window(int i)
|
|||
i = i / 10;
|
||||
}
|
||||
if (debug)
|
||||
fprintf(stderr, "%d*10^%d: 0x%x\n", i, exponent, (exponent << 7) | i);
|
||||
fprintf(stderr, "%u*10^%d: 0x%x\n", i, exponent, (exponent << 7) | i);
|
||||
|
||||
return (exponent << 7) | i;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user