linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Kevin Hilman <khilman@ti.com>, Guan Xuetao <gxt@mprc.pku.edu.cn>,
	Russell King <linux@arm.linux.org.uk>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Greg KH <gregkh@suse.de>, Ralf Baechle <ralf@linux-mips.org>,
	Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>,
	Ben Dooks <ben-linux@fluff.org>, Jiri Kosina <jkosina@suse.cz>,
	Kay Sievers <kay.sievers@suse.de>,
	Mike Frysinger <vapier@gentoo.org>,
	Linux PM mailing list <linux-pm@lists.linux-foundation.org>,
	linux-omap@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 11/14] PM / AVR32: Use struct syscore_ops instead of sysdevs for PM
Date: Sun, 17 Apr 2011 23:13:09 +0200	[thread overview]
Message-ID: <201104172313.09712.rjw@sisk.pl> (raw)
In-Reply-To: <201104172301.54115.rjw@sisk.pl>

From: Rafael J. Wysocki <rjw@sisk.pl>

Convert some AVR32 architecture's code to using struct syscore_ops
objects for power management instead of sysdev classes and sysdevs.

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

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/avr32/mach-at32ap/intc.c |   38 ++++++++++++--------------------------
 1 file changed, 12 insertions(+), 26 deletions(-)

Index: linux-2.6/arch/avr32/mach-at32ap/intc.c
===================================================================
--- linux-2.6.orig/arch/avr32/mach-at32ap/intc.c
+++ linux-2.6/arch/avr32/mach-at32ap/intc.c
@@ -12,7 +12,7 @@
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/platform_device.h>
-#include <linux/sysdev.h>
+#include <linux/syscore_ops.h>
 
 #include <asm/io.h>
 
@@ -21,7 +21,6 @@
 struct intc {
 	void __iomem		*regs;
 	struct irq_chip		chip;
-	struct sys_device	sysdev;
 #ifdef CONFIG_PM
 	unsigned long		suspend_ipr;
 	unsigned long		saved_ipr[64];
@@ -146,9 +145,8 @@ void intc_set_suspend_handler(unsigned l
 	intc0.suspend_ipr = offset;
 }
 
-static int intc_suspend(struct sys_device *sdev, pm_message_t state)
+static int intc_suspend(void)
 {
-	struct intc *intc = container_of(sdev, struct intc, sysdev);
 	int i;
 
 	if (unlikely(!irqs_disabled())) {
@@ -156,28 +154,25 @@ static int intc_suspend(struct sys_devic
 		return -EINVAL;
 	}
 
-	if (unlikely(!intc->suspend_ipr)) {
+	if (unlikely(!intc0.suspend_ipr)) {
 		pr_err("intc_suspend: suspend_ipr not initialized\n");
 		return -EINVAL;
 	}
 
 	for (i = 0; i < 64; i++) {
-		intc->saved_ipr[i] = intc_readl(intc, INTPR0 + 4 * i);
-		intc_writel(intc, INTPR0 + 4 * i, intc->suspend_ipr);
+		intc0.saved_ipr[i] = intc_readl(&intc0, INTPR0 + 4 * i);
+		intc_writel(&intc0, INTPR0 + 4 * i, intc0.suspend_ipr);
 	}
 
 	return 0;
 }
 
-static int intc_resume(struct sys_device *sdev)
+static int intc_resume(void)
 {
-	struct intc *intc = container_of(sdev, struct intc, sysdev);
 	int i;
 
-	WARN_ON(!irqs_disabled());
-
 	for (i = 0; i < 64; i++)
-		intc_writel(intc, INTPR0 + 4 * i, intc->saved_ipr[i]);
+		intc_writel(&intc0, INTPR0 + 4 * i, intc0.saved_ipr[i]);
 
 	return 0;
 }
@@ -186,27 +181,18 @@ static int intc_resume(struct sys_device
 #define intc_resume	NULL
 #endif
 
-static struct sysdev_class intc_class = {
-	.name		= "intc",
+static struct syscore_ops intc_syscore_ops = {
 	.suspend	= intc_suspend,
 	.resume		= intc_resume,
 };
 
-static int __init intc_init_sysdev(void)
+static int __init intc_init_syscore(void)
 {
-	int ret;
-
-	ret = sysdev_class_register(&intc_class);
-	if (ret)
-		return ret;
+	register_syscore_ops(&intc_syscore_ops);
 
-	intc0.sysdev.id = 0;
-	intc0.sysdev.cls = &intc_class;
-	ret = sysdev_register(&intc0.sysdev);
-
-	return ret;
+	return 0;
 }
-device_initcall(intc_init_sysdev);
+device_initcall(intc_init_syscore);
 
 unsigned long intc_get_pending(unsigned int group)
 {

  parent reply	other threads:[~2011-04-17 21:43 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201103280125.11750.rjw@sisk.pl>
2011-04-17 21:01 ` [PATCH 0/14] Remove sysdev suspend/resume and shutdown operations Rafael J. Wysocki
2011-04-17 21:05   ` [PATCH 1/14] PM: Fix error code paths executed after failing syscore_suspend() Rafael J. Wysocki
2011-04-17 21:06   ` [PATCH 2/14] PM: Add missing syscore_suspend() and syscore_resume() calls Rafael J. Wysocki
2011-04-18  8:51     ` Ian Campbell
2011-04-17 21:07   ` [PATCH 3/14] ARM: Use struct syscore_ops instead of sysdevs for PM in common code Rafael J. Wysocki
2011-04-17 21:08   ` [PATCH 4/14] ARM / OMAP: Use struct syscore_ops for "core" power management Rafael J. Wysocki
2011-04-17 21:09   ` [PATCH 5/14] ARM / Integrator: Use struct syscore_ops for core PM Rafael J. Wysocki
2011-04-17 21:10   ` [PATCH 6/14] ARM / SA1100: Use struct syscore_ops for "core" power management Rafael J. Wysocki
2011-04-17 21:10   ` [PATCH 7/14] ARM / PXA: " Rafael J. Wysocki
2011-04-17 21:11   ` [PATCH 8/14] ARM / Samsung: " Rafael J. Wysocki
2011-04-17 21:49     ` Kukjin Kim
2011-04-17 21:11   ` [PATCH 9/14] PM / Blackfin: Use struct syscore_ops instead of sysdevs for PM Rafael J. Wysocki
2011-04-18  2:34     ` Mike Frysinger
2011-04-18 21:43       ` Rafael J. Wysocki
2011-04-17 21:12   ` [PATCH 10/14] PM / MIPS: " Rafael J. Wysocki
2011-04-18 10:12     ` Ralf Baechle
2011-04-18 20:03       ` Rafael J. Wysocki
2011-04-19  3:08     ` Lars-Peter Clausen
2011-04-17 21:13   ` Rafael J. Wysocki [this message]
2011-04-26 12:22     ` [PATCH 11/14] PM / AVR32: " Hans-Christian Egtvedt
2011-04-26 17:14       ` Rafael J. Wysocki
2011-04-17 21:13   ` [PATCH 12/14] PM / UNICORE32: " Rafael J. Wysocki
2011-04-19  8:02     ` Guan Xuetao
2011-04-17 21:14   ` [PATCH 13/14] PM / PowerPC: " Rafael J. Wysocki
2011-04-17 21:15   ` [PATCH 14/14] PM: Remove sysdev suspend, resume and shutdown operations Rafael J. Wysocki
2011-04-18  6:02   ` [PATCH 0/14] Remove sysdev suspend/resume " Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201104172313.09712.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=ben-linux@fluff.org \
    --cc=gregkh@suse.de \
    --cc=gxt@mprc.pku.edu.cn \
    --cc=hans-christian.egtvedt@atmel.com \
    --cc=jeremy.fitzhardinge@citrix.com \
    --cc=jkosina@suse.cz \
    --cc=kay.sievers@suse.de \
    --cc=khilman@ti.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=linux@arm.linux.org.uk \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=ralf@linux-mips.org \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).