linux-stable/drivers
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
..
accessibility
acpi cpuidle: remove en_core_tk_irqen flag 2013-04-23 13:45:22 +02:00
amba ARM: 7675/1: amba: tegra-ahb: Fix build error w/ PM_SLEEP w/o PM_RUNTIME 2013-03-15 17:20:02 +00:00
ata Simple stuff. See one-line summaries. 2013-03-23 12:33:36 -07:00
atm hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
auxdisplay
base ACPI and power management fixes for 3.9-rc6 2013-04-04 15:56:28 -07:00
bcma Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless into for-davem 2013-03-01 13:52:03 -05:00
block loop: prevent bdev freeing while device in use 2013-04-01 15:48:47 -07:00
bluetooth Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth 2013-03-18 15:17:11 -04:00
bus
cdrom
char One reversion, a tiny leak fix, and a cc:stable locking fix, in two parts. 2013-04-01 16:17:52 -07:00
clk Merge branch 'acpi-lpss' into linux-next 2013-04-08 12:31:30 +02:00
clocksource ImgTec Meta architecture changes for v3.9-rc1 2013-03-03 12:06:09 -08:00
connector proc connector: reject unprivileged listener bumps 2013-02-27 13:08:35 -05:00
cpufreq cpufreq: Correct header guards typo 2013-04-02 15:14:29 +02:00
cpuidle cpuidle: make a single register function for all 2013-04-23 13:45:22 +02:00
crypto Revert "crypto: caam - add IPsec ESN support" 2013-03-21 17:36:03 +08:00
dca dca: convert to idr_alloc() 2013-02-27 19:10:15 -08:00
devfreq
dio
dma Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2013-04-03 10:48:22 -07:00
edac EDAC: Merge mci.mem_is_per_rank with mci.csbased 2013-03-16 06:32:30 +01:00
eisa EISA/PCI: Init EISA early, before PNP 2013-04-01 12:02:05 -06:00
extcon extcon: max77693: Initialize register of MUIC device to bring up it without platform data 2013-03-13 17:38:57 +09:00
firewire firewire: convert to idr_alloc() 2013-02-27 19:10:15 -08:00
firmware efivars: Fix check for CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE 2013-03-22 20:08:01 +00:00
gpio Two GPIO fixes for the v3.9 series: 2013-04-04 08:40:14 -07:00
gpu Merge branch 'acpi-hotplug' into linux-next 2013-04-08 12:31:23 +02:00
hid HID: magicmouse: fix race between input_register() and probe() 2013-04-04 09:49:56 +02:00
hsi hsi: fix kernel-doc warnings 2013-03-01 13:39:00 -08:00
hv Drivers: hv: vmbus: Use the new infrastructure for delivering VMBUS interrupts 2013-02-27 10:15:53 -08:00
hwmon hwmon: (lm75.h) Update header inclusion 2013-03-18 21:19:49 +01:00
hwspinlock
i2c ACPI / I2C: Use parent's ACPI_HANDLE() in acpi_i2c_register_devices() 2013-04-02 15:30:41 +02:00
ide Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
idle cpuidle: remove en_core_tk_irqen flag 2013-04-23 13:45:22 +02:00
iio First round of iio fixes post the 3.9 merge window. 2013-03-06 05:48:24 +08:00
infiniband firmware,IB/qib: revert firmware file move 2013-04-05 12:19:39 -07:00
input arm-soc: bug fixes for 3.9-rc3 2013-03-18 08:17:14 -07:00
iommu IOMMU fixes for Linux v3.9-rc4 2013-03-27 09:25:11 -07:00
ipack Char/Misc driver patches for 3.9-rc1 2013-02-21 13:57:13 -08:00
irqchip irqchip: fix typo when moving gic_raise_softirq() 2013-03-04 17:15:33 -08:00
isdn isdn: hisax: netjet requires VIRT_TO_BUS 2013-03-17 12:01:10 -04:00
leds Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds 2013-02-26 09:29:02 -08:00
lguest All trivial, thanks to the stuff which didn't quite make it time. 2013-02-26 14:49:12 -08:00
macintosh Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2013-02-23 17:09:55 -08:00
mailbox mailbox, pl320-ipc: remove __init from probe function 2013-03-04 14:23:11 +01:00
md dm cache: reduce bio front_pad size in writeback mode 2013-04-05 15:36:34 +01:00
media Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid 2013-04-04 08:40:45 -07:00
memory
memstick memstick: move the dereference below the NULL test 2013-02-27 19:10:23 -08:00
message
mfd mfd: twl4030-madc: Remove __exit_p annotation 2013-03-15 07:42:22 +01:00
misc VMCI: Fix process-to-process DRGAMs. 2013-03-15 12:58:12 -07:00
mmc Merge branches 'devel-stable', 'fixes' and 'mmci' into for-linus 2013-03-03 00:32:50 +00:00
mtd MTD fixes for 3.9 2013-03-18 08:27:41 -07:00
net ixgbe: fix registration order of driver and DCA nofitication 2013-04-05 00:49:13 -04:00
nfc NFC: microread: Fix build failure due to a new MEI bus API 2013-04-01 00:52:42 +02:00
ntb
nubus
of Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-02-21 17:40:58 -08:00
oprofile fs: Limit sys_mount to only request filesystem modules. 2013-03-03 19:36:31 -08:00
parisc Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
parport Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2013-02-21 17:54:03 -08:00
pci PCI/PM: Disable runtime PM of PCIe ports 2013-04-03 15:54:59 -06:00
pcmcia Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-02-21 17:40:58 -08:00
pinctrl Here are a few pinctrl fixes for the v3.9 rc series: 2013-03-24 10:11:29 -07:00
platform ACPI: Set length even for TYPE_END_TAG acpi resource 2013-03-24 01:00:38 +01:00
pnp ACPI: Set length even for TYPE_END_TAG acpi resource 2013-03-24 01:00:38 +01:00
power power: convert to idr_alloc() 2013-02-27 19:10:18 -08:00
pps drivers/pps/clients/pps-gpio.c: use devm_kzalloc 2013-02-27 19:10:23 -08:00
ps3
ptp
pwm pwm: Changes for v3.9-rc1 2013-02-26 09:34:29 -08:00
rapidio
regulator Merge remote-tracking branch 'regulator/fix/twl' into tmp 2013-03-05 10:12:43 +08:00
remoteproc remoteproc: convert to idr_alloc() 2013-02-27 19:10:18 -08:00
rpmsg rpmsg: convert to idr_alloc() 2013-02-27 19:10:18 -08:00
rtc Revert "drivers/rtc/rtc-at91rm9200.c: use a variable for storing IMR" 2013-04-05 09:36:53 -07:00
s390 s390/3270: fix minor_start issue 2013-03-21 13:35:39 +01:00
sbus Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
scsi libfcoe: Fix fcoe_sysfs VN2VN mode 2013-03-25 16:04:22 -07:00
sfi
sh
sn
spi spi: Fixes for v3.9 2013-04-05 10:04:41 -07:00
ssb Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into mips-for-linux-next 2013-02-22 10:07:30 +01:00
staging staging: comedi: s626: fix continuous acquisition 2013-03-25 11:35:38 -07:00
target target: Fix RESERVATION_CONFLICT status regression for iscsi-target special case 2013-03-28 23:42:47 -07:00
tc
thermal thermal: exynos_thermal: return a proper error code while thermal_zone_device_register fail. 2013-03-11 23:09:29 +08:00
tty TTY/serial fixes for 3.9-rc4 2013-03-28 15:53:33 -07:00
uio uio: convert to idr_alloc() 2013-02-27 19:10:19 -08:00
usb USB / PM: Don't try to hide PM QoS flags from usb_port_device_release() 2013-04-02 01:25:09 +02:00
uwb
vfio vfio: include <linux/slab.h> for kmalloc 2013-03-15 12:58:20 -06:00
vhost Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2013-03-30 13:13:05 -07:00
video Fix uvesafb crash bug and typoed flag name in fbmon's new videomode code 2013-04-05 09:15:46 -07:00
virt
virtio All trivial, thanks to the stuff which didn't quite make it time. 2013-02-26 14:49:12 -08:00
vlynq
vme
w1 w1: fix oops when w1_search is called from netlink connector 2013-03-12 16:20:46 -07:00
watchdog watchdog: sp5100_tco: Set the AcpiMmioSel bitmask value to 1 instead of 2 2013-03-22 23:21:55 +01:00
xen Bug-fixes: 2013-03-27 12:56:25 -07:00
zorro new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
Kconfig Char/Misc driver patches for 3.9-rc1 2013-02-21 13:57:13 -08:00
Makefile Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2013-02-23 17:09:55 -08:00