cpufreq: acpi-cpufreq: Make read and write operations more efficient
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 2 Mar 2016 02:05:22 +0000 (03:05 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 3 Mar 2016 02:57:50 +0000 (03:57 +0100)
commited757a2c7bf7aa99d219b78349b4a0334851dc38
treefd0b8c92d3ad63bd968ad2f81b979c25a1435ba0
parentc5e29ea7ac144113f60dc540d7bb00cea5056b10
cpufreq: acpi-cpufreq: Make read and write operations more efficient

Setting a new CPU frequency and reading the current request value
in the ACPI cpufreq driver involves each at least two switch
instructions (there's more if the policy is shared).  One of
them is present in drv_read/write() that prepares a command
structure and the other happens in subsequent do_drv_read/write()
when that structure is interpreted.  However, all of those switches
may be avoided by using function pointers.

To that end, add two function pointers to struct acpi_cpufreq_data
to represent read and write operations on the frequency register
and set them up during policy intitialization to point to the pair
of routines suitable for the given processor (Intel/AMD MSR access
or I/O port access).  Then, use those pointers in do_drv_read/write()
and modify drv_read/write() to prepare the command structure for
them without any checks.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/acpi-cpufreq.c
This page took 0.024735 seconds and 5 git commands to generate.