mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Ralf Baechle <ralf@linux-mips.org>
Subject: [34/38] MIPS: PM: Use struct syscore_ops instead of sysdevs for PM (v2)
Date: Tue, 11 Oct 2011 10:55:44 -0600	[thread overview]
Message-ID: <20111011165713.554867291@pistachio.kroah.org> (raw)
In-Reply-To: <20111011165903.GA30976@kroah.com>

3.0-stable review patch.  If anyone has any objections, please let us know.

------------------

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

commit bd7100099a46b59f433dd15ad60adbb4d4f3d625 upstream.

Convert some MIPS 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>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-and-tested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: linux-kernel@vger.kernel.org
Cc: "Rafael J.  Wysocki" <rjw@sisk.pl>
Patchwork: http://patchwork.linux-mips.org/patch/2431/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 arch/mips/jz4740/gpio.c |   52 ++++++++++++++++++++----------------------------
 1 file changed, 22 insertions(+), 30 deletions(-)

--- a/arch/mips/jz4740/gpio.c
+++ b/arch/mips/jz4740/gpio.c
@@ -18,7 +18,7 @@
 #include <linux/init.h>
 
 #include <linux/spinlock.h>
-#include <linux/sysdev.h>
+#include <linux/syscore_ops.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
 #include <linux/delay.h>
@@ -86,7 +86,6 @@ struct jz_gpio_chip {
 	spinlock_t lock;
 
 	struct gpio_chip gpio_chip;
-	struct sys_device sysdev;
 };
 
 static struct jz_gpio_chip jz4740_gpio_chips[];
@@ -459,49 +458,47 @@ static struct jz_gpio_chip jz4740_gpio_c
 	JZ4740_GPIO_CHIP(D),
 };
 
-static inline struct jz_gpio_chip *sysdev_to_chip(struct sys_device *dev)
+static void jz4740_gpio_suspend_chip(struct jz_gpio_chip *chip)
 {
-	return container_of(dev, struct jz_gpio_chip, sysdev);
+	chip->suspend_mask = readl(chip->base + JZ_REG_GPIO_MASK);
+	writel(~(chip->wakeup), chip->base + JZ_REG_GPIO_MASK_SET);
+	writel(chip->wakeup, chip->base + JZ_REG_GPIO_MASK_CLEAR);
 }
 
-static int jz4740_gpio_suspend(struct sys_device *dev, pm_message_t state)
+static int jz4740_gpio_suspend(void)
 {
-	struct jz_gpio_chip *chip = sysdev_to_chip(dev);
+	int i;
 
-	chip->suspend_mask = readl(chip->base + JZ_REG_GPIO_MASK);
-	writel(~(chip->wakeup), chip->base + JZ_REG_GPIO_MASK_SET);
-	writel(chip->wakeup, chip->base + JZ_REG_GPIO_MASK_CLEAR);
+	for (i = 0; i < ARRAY_SIZE(jz4740_gpio_chips); i++)
+		jz4740_gpio_suspend_chip(&jz4740_gpio_chips[i]);
 
 	return 0;
 }
 
-static int jz4740_gpio_resume(struct sys_device *dev)
+static void jz4740_gpio_resume_chip(struct jz_gpio_chip *chip)
 {
-	struct jz_gpio_chip *chip = sysdev_to_chip(dev);
 	uint32_t mask = chip->suspend_mask;
 
 	writel(~mask, chip->base + JZ_REG_GPIO_MASK_CLEAR);
 	writel(mask, chip->base + JZ_REG_GPIO_MASK_SET);
+}
 
-	return 0;
+static void jz4740_gpio_resume(void)
+{
+	int i;
+
+	for (i = ARRAY_SIZE(jz4740_gpio_chips) - 1; i >= 0 ; i--)
+		jz4740_gpio_resume_chip(&jz4740_gpio_chips[i]);
 }
 
-static struct sysdev_class jz4740_gpio_sysdev_class = {
-	.name = "gpio",
+static struct syscore_ops jz4740_gpio_syscore_ops = {
 	.suspend = jz4740_gpio_suspend,
 	.resume = jz4740_gpio_resume,
 };
 
-static int jz4740_gpio_chip_init(struct jz_gpio_chip *chip, unsigned int id)
+static void jz4740_gpio_chip_init(struct jz_gpio_chip *chip, unsigned int id)
 {
-	int ret, irq;
-
-	chip->sysdev.id = id;
-	chip->sysdev.cls = &jz4740_gpio_sysdev_class;
-	ret = sysdev_register(&chip->sysdev);
-
-	if (ret)
-		return ret;
+	int irq;
 
 	spin_lock_init(&chip->lock);
 
@@ -519,22 +516,17 @@ static int jz4740_gpio_chip_init(struct
 		irq_set_chip_and_handler(irq, &jz_gpio_irq_chip,
 					 handle_level_irq);
 	}
-
-	return 0;
 }
 
 static int __init jz4740_gpio_init(void)
 {
 	unsigned int i;
-	int ret;
-
-	ret = sysdev_class_register(&jz4740_gpio_sysdev_class);
-	if (ret)
-		return ret;
 
 	for (i = 0; i < ARRAY_SIZE(jz4740_gpio_chips); ++i)
 		jz4740_gpio_chip_init(&jz4740_gpio_chips[i], i);
 
+	register_syscore_ops(&jz4740_gpio_syscore_ops);
+
 	printk(KERN_INFO "JZ4740 GPIO initialized\n");
 
 	return 0;



  parent reply	other threads:[~2011-10-11 17:06 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-11 16:59 [00/38] 3.0.7-stable review Greg KH
2011-10-11 16:55 ` [01/38] PCI: Set PCI-E Max Payload Size on fabric Greg KH
2011-10-11 17:20   ` Benjamin LaHaise
2011-10-11 18:14     ` Bjorn Helgaas
2011-10-11 19:24       ` Greg KH
2011-10-11 19:47         ` Bjorn Helgaas
2011-10-11 19:56           ` Greg KH
2011-10-11 20:03             ` Benjamin LaHaise
2011-10-11 21:31               ` Greg KH
2011-10-11 20:22             ` Bjorn Helgaas
2011-10-11 21:32               ` Greg KH
2011-10-11 16:55 ` [02/38] PCI: export pcie_bus_configure_settings symbol Greg KH
2011-10-11 16:55 ` [03/38] PCI: Remove MRRS modification from MPS setting code Greg KH
2011-10-11 16:55 ` [04/38] pci: Dont crash when reading mpss from root complex Greg KH
2011-10-11 16:55 ` [05/38] Fix pointer dereference before call to pcie_bus_configure_settings Greg KH
2011-10-11 16:55 ` [06/38] PCI: Disable MPS configuration by default Greg KH
2011-10-11 16:55 ` [07/38] sparc64: Force the execute bit in OpenFirmwares translation entries Greg KH
2011-10-11 16:55 ` [08/38] sched/rt: Migrate equal priority tasks to available CPUs Greg KH
2011-10-11 16:55 ` [09/38] sched: Fix up wchan borkage Greg KH
2011-10-11 16:55 ` [10/38] ide-disk: Fix request requeuing Greg KH
2011-10-11 16:55 ` [11/38] posix-cpu-timers: Cure SMP wobbles Greg KH
2011-10-11 16:55 ` [12/38] lis3: fix regression of HP DriveGuard with 8bit chip Greg KH
2011-10-11 16:55 ` [13/38] ASoC: use a valid device for dev_err() in Zylonite Greg KH
2011-10-11 16:55 ` [14/38] ASoC: Fix setting update bits for WM8753_LADC and WM8753_RADC Greg KH
2011-10-11 16:55 ` [15/38] drm/radeon: Update AVIVO cursor coordinate origin before x/yorigin calculation Greg KH
2011-10-11 16:55 ` [16/38] drm/radeon/kms: Fix logic error in DP HPD handler Greg KH
2011-10-11 16:55 ` [17/38] drm/radeon/kms: fix regression in DP aux defer handling Greg KH
2011-10-11 16:55 ` [18/38] drm/radeon/kms: add retry limits for native DP aux defer Greg KH
2011-10-11 16:55 ` [19/38] drm/radeon/kms: fix channel_remap setup (v2) Greg KH
2011-10-11 16:55 ` [20/38] ptp: fix L2 event message recognition Greg KH
2011-10-11 16:55 ` [21/38] rt2x00: Serialize TX operations on a queue Greg KH
2011-10-11 16:55 ` [22/38] x86/PCI: use host bridge _CRS info on ASUS M2V-MX SE Greg KH
2011-10-11 16:55 ` [23/38] [SCSI] qla2xxx: Fix crash in qla2x00_abort_all_cmds() on unload Greg KH
2011-10-11 16:55 ` [24/38] [SCSI] libsas: fix panic when single phy is disabled on a wide port Greg KH
2011-10-11 16:55 ` [25/38] md: Avoid waking up a thread after it has been freed Greg KH
2011-10-11 16:55 ` [26/38] dm table: avoid crash if integrity profile changes Greg KH
2011-10-11 16:55 ` [27/38] mmc: mxs-mmc: fix clock rate setting Greg KH
2011-10-11 16:55 ` [28/38] exec: do not call request_module() twice from search_binary_handler() Greg KH
2011-10-11 16:55 ` [29/38] ARM: mach-ux500: enable fix for ARM errata 754322 Greg KH
2011-10-11 16:55 ` [30/38] drm/radeon/kms: retry aux transactions if there are status flags Greg KH
2011-10-11 16:55 ` [31/38] drm/radeon/kms: use hardcoded dig encoder to transmitter mapping for DCE4.1 Greg KH
2011-10-11 16:55 ` [32/38] ipv6: fix NULL dereference in udp6_ufo_fragment() Greg KH
2011-10-11 16:55 ` [33/38] ahci: Enable SB600 64bit DMA on Asus M3A Greg KH
2011-10-11 16:55 ` Greg KH [this message]
2011-10-11 16:55 ` [35/38] ftrace: Fix regression of :mod:module function enabling Greg KH
2011-10-11 16:55 ` [36/38] ftrace: Fix regression where ftrace breaks when modules are loaded Greg KH
2011-10-11 16:55 ` [37/38] ftrace: Fix warning when CONFIG_FUNCTION_TRACER is not defined Greg KH
2011-10-11 16:55 ` [38/38] e1000e: workaround for packet drop on 82579 at 100Mbps Greg KH
2011-10-11 17:00 ` [00/38] 3.0.7-stable review Greg KH
2011-10-17 15:05   ` Conny Seidel
2011-10-17 15:21     ` 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=20111011165713.554867291@pistachio.kroah.org \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    --cc=rjw@sisk.pl \
    --cc=stable-review@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®