]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit8bdb5c0eae4957cecc7bfbac95d623b94291a7b3
treefd0b8c92d3ad63bd968ad2f81b979c25a1435ba0
parent2686bea8e92b32f65ef8731abb35f878e6c2a9d0
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