Daniel Lezcano
4c637b2175
cpuidle: make a single register function for all
...
The usual scheme to initialize a cpuidle driver on a SMP is:
cpuidle_register_driver(drv);
for_each_possible_cpu(cpu) {
device = &per_cpu(cpuidle_dev, cpu);
cpuidle_register_device(device);
}
This code is duplicated in each cpuidle driver.
On UP systems, it is done this way:
cpuidle_register_driver(drv);
device = &per_cpu(cpuidle_dev, cpu);
cpuidle_register_device(device);
On UP, the macro 'for_each_cpu' does one iteration:
#define for_each_cpu(cpu, mask) \
for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
Hence, the initialization loop is the same for UP than SMP.
Beside, we saw different bugs / mis-initialization / return code unchecked in
the different drivers, the code is duplicated including bugs. After fixing all
these ones, it appears the initialization pattern is the same for everyone.
Please note, some drivers are doing dev->state_count = drv->state_count. This is
not necessary because it is done by the cpuidle_enable_device function in the
cpuidle framework. This is true, until you have the same states for all your
devices. Otherwise, the 'low level' API should be used instead with the specific
initialization for the driver.
Let's add a wrapper function doing this initialization with a cpumask parameter
for the coupled idle states and use it for all the drivers.
That will save a lot of LOC, consolidate the code, and the modifications in the
future could be done in a single place. Another benefit is the consolidation of
the cpuidle_device variable which is now in the cpuidle framework and no longer
spread accross the different arch specific drivers.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-04-23 13:45:22 +02:00
..
ABI
Merge branch 'acpi-lpss' into linux-next
2013-04-08 12:31:30 +02:00
accounting
doc: Remove unnecessary declarations from Documentation/accounting/getdelays.c
2012-11-26 14:22:21 +01:00
acpi
ACPI / Documentation: refer to correct file for acpi_platform_device_ids[] table
2013-02-13 13:43:02 +01:00
aoe
aoe: allow user to disable target failure timeout
2012-12-17 17:15:25 -08:00
arm
fbdev changes for 3.8:
2012-12-15 13:03:48 -08:00
arm64
arm64: Add simple earlyprintk support
2013-01-22 17:51:01 +00:00
auxdisplay
backlight
backlight: lp855x_bl: support new LP8557 device
2013-02-21 17:22:25 -08:00
blackfin
block
cfq-iosched: enable full blkcg hierarchy support
2013-01-09 08:05:11 -08:00
blockdev
nbd: update documentation and link to mailinglist
2013-02-27 19:10:22 -08:00
bus-devices
cdrom
cgroups
Merge branch 'for-3.9/core' of git://git.kernel.dk/linux-block
2013-02-28 12:52:24 -08:00
connector
console
cpu-freq
cpufreq: Update Documentation for cpus and related_cpus
2013-02-02 00:01:16 +01:00
cpuidle
cpuidle: make a single register function for all
2013-04-23 13:45:22 +02:00
cris
crypto
development-process
device-mapper
md updates for 3.9
2013-03-05 17:22:08 -08:00
devicetree
This is the first batch of MFD fixes for 3.9.
2013-03-15 17:34:01 -07:00
DocBook
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
2013-02-25 16:46:44 -08:00
driver-model
lib: devres: Introduce devm_ioremap_resource()
2013-01-22 09:41:43 -08:00
dvb
[media] get_dvb_firmware: Fix the location of firmware for Terratec HTC
2013-01-01 11:18:26 -02:00
early-userspace
EDID
drm: Load EDID: Explain better how to write your own EDID firmware
2013-01-20 19:22:19 +10:00
extcon
fault-injection
fb
filesystems
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
2013-02-26 20:16:07 -08:00
firmware_class
frv
hid
HID: remove x bit from sensor doc
2012-12-14 08:48:59 +01:00
hwmon
hwmon: (lm75) Fix tcn75 prefix
2013-03-18 21:19:49 +01:00
i2c
i2c: Fix my e-mail address in drivers and documentation
2013-03-22 11:18:34 +01:00
i2o
ia64
ide
infiniband
input
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
2013-03-11 07:49:37 -07:00
ioctl
wanrouter: completely decouple obsolete code from kernel.
2013-01-31 19:20:33 -05:00
isdn
ja_JP
kbuild
Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
2013-02-27 12:28:30 -08:00
kdump
ko_KR
laptops
Documentation/laptops: remove depends on CONFIG_EXPERIMENTAL
2013-01-21 14:52:42 -08:00
leds
Documentation: leds: update LP55xx family devices
2013-02-06 15:59:30 -08:00
m68k
make
memory-devices
metag
metag: Basic documentation
2013-03-02 20:09:50 +00:00
mips
misc-devices
mmc
mmc: core: Extend sysfs to ext_csd parameters for RPMB support
2012-12-06 13:54:48 -05:00
mn10300
mtd
namespaces
userns: Recommend use of memory control groups.
2013-01-26 22:20:06 -08:00
netlabel
networking
ipvs: add backup_only flag to avoid loops
2013-03-19 21:21:51 +09:00
nfc
NFC: Update pn544 documentation
2013-01-10 01:27:46 +01:00
parisc
PCI
PCI/MSI: Enable multiple MSIs with pci_enable_msi_block_auto()
2013-01-24 17:25:13 +01:00
pcmcia
power
PM / OPP: improve introductory documentation
2013-03-04 14:23:11 +01:00
powerpc
powerpc: Documentation for transactional memory on powerpc
2013-02-15 17:02:25 +11:00
pps
prctl
pti
ptp
rapidio
RCU
s390
scheduler
scsi
[SCSI] megaraid_sas: Version and Changelog update
2013-02-22 15:37:15 +00:00
security
Documentation: fix Documentation/security/00-INDEX
2012-12-17 17:15:22 -08:00
serial
tty: Update serial core API documentation
2013-01-15 21:57:44 -08:00
sh
sound
Revert "ALSA: hda - Allow power_save_controller option override DCAPS"
2013-04-04 15:35:39 +02:00
spi
Documentation: remove __dev* attributes.
2013-01-03 15:57:16 -08:00
sysctl
Documentation/sysctl/kernel.txt: document /proc/sys/shmall
2013-01-04 16:11:46 -08:00
target
thermal
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
2013-02-28 19:48:26 -08:00
timers
trace
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
2013-03-11 07:54:29 -07:00
usb
vDSO
video4linux
[media] radio-si470x doc: add info about v4l2-ctl and sox+alsa
2013-02-13 17:33:20 -02:00
virtual
Merge tag 'kvm-3.9-1' of git://git.kernel.org/pub/scm/virt/kvm/kvm
2013-02-24 13:07:18 -08:00
vm
ksm: add some comments
2013-02-23 17:50:23 -08:00
w1
w1: w1_therm: Add force-pullup option for "broken" sensors
2013-02-18 13:55:24 -08:00
watchdog
watchdog: core: dt: add support for the timeout-sec dt property
2013-03-01 12:48:36 +01:00
wimax
x86
Merge branch 'x86/microcode' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
2013-02-22 19:22:52 -08:00
xtensa
xtensa: initialize atomctl SR
2012-12-18 21:10:22 -08:00
zh_CN
Driver core patches for 3.9-rc1
2013-02-21 12:05:51 -08:00
.gitignore
00-INDEX
ImgTec Meta architecture changes for v3.9-rc1
2013-03-03 12:06:09 -08:00
applying-patches.txt
atomic_ops.txt
Documentation: Memory barrier semantics of atomic_xchg()
2013-01-08 14:14:55 -08:00
bad_memory.txt
basic_profiling.txt
binfmt_misc.txt
braille-console.txt
bt8xxgpio.txt
btmrvl.txt
BUG-HUNTING
bus-virt-phys-mapping.txt
cachetlb.txt
Changes
circular-buffers.txt
clk.txt
coccinelle.txt
coccicheck: Allow the user to give a V= (verbose) argument
2013-02-22 11:39:13 +01:00
CodingStyle
Documentation: remove depends on CONFIG_EXPERIMENTAL
2013-01-11 11:38:03 -08:00
cpu-hotplug.txt
cpu-load.txt
cputopology.txt
crc32.txt
dcdbas.txt
debugging-modules.txt
debugging-via-ohci1394.txt
dell_rbu.txt
devices.txt
digsig.txt
DMA-API-HOWTO.txt
Documentation/DMA-API-HOWTO.txt: fix typo
2013-02-27 19:10:23 -08:00
DMA-API.txt
DMA-attributes.txt
common: DMA-mapping: add DMA_ATTR_FORCE_CONTIGUOUS attribute
2012-11-29 03:30:34 -08:00
dma-buf-sharing.txt
dma-buf: implement vmap refcounting in the interface logic
2013-02-27 15:13:36 +05:30
DMA-ISA-LPC.txt
dmaengine.txt
dontdiff
dynamic-debug-howto.txt
dynamic_debug: dynamic hex dump
2013-01-17 12:19:09 -08:00
edac.txt
eisa.txt
email-clients.txt
flexible-arrays.txt
futex-requeue-pi.txt
gcov.txt
gpio.txt
highuid.txt
HOWTO
HOWTO: fix double words typo
2012-12-10 15:54:27 +01:00
hw_random.txt
hwspinlock.txt
init.txt
initrd.txt
Intel-IOMMU.txt
intel_txt.txt
Documentation: remove depends on CONFIG_EXPERIMENTAL
2013-01-11 11:38:03 -08:00
io-mapping.txt
io_ordering.txt
iostats.txt
IPMI.txt
ipmi: add options to disable openfirmware and PCI scanning
2013-02-27 19:10:21 -08:00
IRQ-affinity.txt
IRQ-domain.txt
irqdomain: update documentation
2012-12-05 23:52:10 +00:00
IRQ.txt
irqflags-tracing.txt
isapnp.txt
java.txt
kernel-doc-nano-HOWTO.txt
Kernel-doc: Convention: Use a "Return" section to describe return values
2012-11-27 21:08:57 +01:00
kernel-docs.txt
kernel-parameters.txt
ImgTec Meta architecture changes for v3.9-rc1
2013-03-03 12:06:09 -08:00
kmemcheck.txt
kmemleak.txt
kobject.txt
kprobes.txt
kref.txt
kref: Add kref_get_unless_zero documentation
2012-11-28 18:36:06 +10:00
ldm.txt
local_ops.txt
lockdep-design.txt
lockstat.txt
locking/stat: Fix a typo
2013-02-19 08:42:37 +01:00
lockup-watchdogs.txt
logo.gif
logo.txt
magic-number.txt
wanrouter: completely decouple obsolete code from kernel.
2013-01-31 19:20:33 -05:00
Makefile
ManagementStyle
md.txt
media-framework.txt
[media] Documentation/media-framework.txt: fix a sentence
2013-02-08 13:27:13 -02:00
memory-barriers.txt
Documentation: Memory barrier semantics of atomic_xchg()
2013-01-08 14:14:55 -08:00
memory-hotplug.txt
hotplug: update nodemasks management
2012-12-12 17:38:33 -08:00
mono.txt
mutex-design.txt
nommu-mmap.txt
numastat.txt
oops-tracing.txt
padata.txt
parport-lowlevel.txt
parport.txt
percpu-rw-semaphore.txt
pi-futex.txt
pinctrl.txt
drivers/pinctrl: grab default handles from device core
2013-01-23 16:39:51 +01:00
pnp.txt
preempt-locking.txt
printk-formats.txt
Randy has moved
2013-03-08 15:05:34 -08:00
pwm.txt
ramoops.txt
rbtree.txt
remoteproc.txt
rfkill.txt
robust-futex-ABI.txt
robust-futexes.txt
rpmsg.txt
Documentation: remove __dev* attributes.
2013-01-03 15:57:16 -08:00
rt-mutex-design.txt
rt-mutex.txt
rtc.txt
SAK.txt
SecurityBugs
serial-console.txt
sgi-ioc4.txt
sgi-visws.txt
SM501.txt
smsc_ece1099.txt
sparse.txt
Documentation/sparse.txt: document context annotations for lock checking
2012-12-17 17:15:23 -08:00
spinlocks.txt
stable_api_nonsense.txt
stable_kernel_rules.txt
static-keys.txt
SubmitChecklist
SubmittingDrivers
SubmittingPatches
Randy has moved
2013-03-08 15:05:34 -08:00
svga.txt
sysfs-rules.txt
sysrq.txt
unaligned-memory-access.txt
unicode.txt
unshare.txt
vfio.txt
VGA-softcursor.txt
vgaarbiter.txt
video-output.txt
vme_api.txt
volatile-considered-harmful.txt
workqueue.txt
xz.txt
zorro.txt