Its initial calculation in cpufreq_statistic_init() is entirely unused,
as do_get_pm_info() recalculates it before use. That re-calculation can
then be done right where the output field is set, eliminating the need
for the internal field. In turn the struct pointer there can then be
constified.

Signed-off-by: Jan Beulich <jbeul...@suse.com>

--- a/xen/drivers/acpi/pmstat.c
+++ b/xen/drivers/acpi/pmstat.c
@@ -144,7 +144,6 @@ int cpufreq_statistic_init(unsigned int
     }
 
     pxpt->u.total = count;
-    pxpt->u.usable = count - pmpt->perf.platform_limit;
 
     for ( i = 0; i < count; i++ )
         pxpt->u.pt[i].freq = pmpt->perf.states[i].core_frequency;
@@ -257,7 +256,7 @@ int do_get_pm_info(struct xen_sysctl_get
     case PMSTAT_get_pxstat:
     {
         uint32_t ct;
-        struct pm_px *pxpt;
+        const struct pm_px *pxpt;
         spinlock_t *cpufreq_statistic_lock = 
                    &per_cpu(cpufreq_statistic_lock, op->cpuid);
 
@@ -270,8 +269,6 @@ int do_get_pm_info(struct xen_sysctl_get
             return -ENODATA;
         }
 
-        pxpt->u.usable = pmpt->perf.state_count - pmpt->perf.platform_limit;
-
         cpufreq_residency_update(op->cpuid, pxpt->u.cur);
 
         /*
@@ -296,7 +293,7 @@ int do_get_pm_info(struct xen_sysctl_get
         }
 
         op->u.getpx.total = pxpt->u.total;
-        op->u.getpx.usable = pxpt->u.usable;
+        op->u.getpx.usable = pmpt->perf.state_count - 
pmpt->perf.platform_limit;
         op->u.getpx.last = pxpt->u.last;
         op->u.getpx.cur = pxpt->u.cur;
 
--- a/xen/include/acpi/cpufreq/processor_perf.h
+++ b/xen/include/acpi/cpufreq/processor_perf.h
@@ -51,7 +51,6 @@ extern struct processor_pminfo *processo
 
 struct px_stat {
     uint8_t total;        /* total Px states */
-    uint8_t usable;       /* usable Px states */
     uint8_t last;         /* last Px state */
     uint8_t cur;          /* current Px state */
     uint64_t *trans_pt;   /* Px transition table */

Reply via email to