Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2eaa03b5 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

ARM / PXA: Use struct syscore_ops for "core" power management



Replace sysdev classes and struct sys_device objects used for "core"
power management by the PXA platform code with struct syscore_ops
objects that are simpler.

This reduces the code size and the kernel memory footprint.  It also
is necessary for removing sysdevs entirely from the kernel in the
future.

Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 90533980
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@

#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/sysdev.h>
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <linux/bitops.h>
+4 −14
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/sysdev.h>
#include <linux/syscore_ops.h>

#include <mach/pxa2xx-regs.h>

@@ -33,32 +33,22 @@ const struct clkops clk_pxa2xx_cken_ops = {
#ifdef CONFIG_PM
static uint32_t saved_cken;

static int pxa2xx_clock_suspend(struct sys_device *d, pm_message_t state)
static int pxa2xx_clock_suspend(void)
{
	saved_cken = CKEN;
	return 0;
}

static int pxa2xx_clock_resume(struct sys_device *d)
static void pxa2xx_clock_resume(void)
{
	CKEN = saved_cken;
	return 0;
}
#else
#define pxa2xx_clock_suspend	NULL
#define pxa2xx_clock_resume	NULL
#endif

struct sysdev_class pxa2xx_clock_sysclass = {
	.name		= "pxa2xx-clock",
struct syscore_ops pxa2xx_clock_syscore_ops = {
	.suspend	= pxa2xx_clock_suspend,
	.resume		= pxa2xx_clock_resume,
};

static int __init pxa2xx_clock_init(void)
{
	if (cpu_is_pxa2xx())
		return sysdev_class_register(&pxa2xx_clock_sysclass);
	return 0;
}
postcore_initcall(pxa2xx_clock_init);
+4 −13
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/syscore_ops.h>

#include <mach/smemc.h>
#include <mach/pxa3xx-regs.h>
@@ -182,7 +183,7 @@ const struct clkops clk_pxa3xx_pout_ops = {
static uint32_t cken[2];
static uint32_t accr;

static int pxa3xx_clock_suspend(struct sys_device *d, pm_message_t state)
static int pxa3xx_clock_suspend(void)
{
	cken[0] = CKENA;
	cken[1] = CKENB;
@@ -190,28 +191,18 @@ static int pxa3xx_clock_suspend(struct sys_device *d, pm_message_t state)
	return 0;
}

static int pxa3xx_clock_resume(struct sys_device *d)
static void pxa3xx_clock_resume(void)
{
	ACCR = accr;
	CKENA = cken[0];
	CKENB = cken[1];
	return 0;
}
#else
#define pxa3xx_clock_suspend	NULL
#define pxa3xx_clock_resume	NULL
#endif

struct sysdev_class pxa3xx_clock_sysclass = {
	.name		= "pxa3xx-clock",
struct syscore_ops pxa3xx_clock_syscore_ops = {
	.suspend	= pxa3xx_clock_suspend,
	.resume		= pxa3xx_clock_resume,
};

static int __init pxa3xx_clock_init(void)
{
	if (cpu_is_pxa3xx() || cpu_is_pxa95x())
		return sysdev_class_register(&pxa3xx_clock_sysclass);
	return 0;
}
postcore_initcall(pxa3xx_clock_init);
+4 −3
Original line number Diff line number Diff line
#include <linux/clkdev.h>
#include <linux/sysdev.h>
#include <linux/syscore_ops.h>

struct clkops {
	void			(*enable)(struct clk *);
@@ -54,7 +54,7 @@ extern const struct clkops clk_pxa2xx_cken_ops;
void clk_pxa2xx_cken_enable(struct clk *clk);
void clk_pxa2xx_cken_disable(struct clk *clk);

extern struct sysdev_class pxa2xx_clock_sysclass;
extern struct syscore_ops pxa2xx_clock_syscore_ops;

#if defined(CONFIG_PXA3xx) || defined(CONFIG_PXA95x)
#define DEFINE_PXA3_CKEN(_name, _cken, _rate, _delay)	\
@@ -74,5 +74,6 @@ extern const struct clkops clk_pxa3xx_smemc_ops;
extern void clk_pxa3xx_cken_enable(struct clk *);
extern void clk_pxa3xx_cken_disable(struct clk *);

extern struct sysdev_class pxa3xx_clock_sysclass;
extern struct syscore_ops pxa3xx_clock_syscore_ops;

#endif
+0 −1
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@
 */

#include <linux/platform_device.h>
#include <linux/sysdev.h>
#include <linux/irq.h>
#include <linux/gpio.h>
#include <linux/delay.h>
Loading