From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] More Driver Core patches for 2.6.10-rc1
Date: Fri, 12 Nov 2004 15:00:06 -0800 [thread overview]
Message-ID: <1100300406618@kroah.com> (raw)
In-Reply-To: <20041112225850.GA6550@kroah.com>
ChangeSet 1.2093, 2004/11/12 11:41:25-08:00, david-b@pacbell.net
[PATCH] driver core: shrink struct device a bit
This patch removes two fields from "struct device" that are duplicated
in "struct dev_pm_info": power_state (which should probably vanish)
and "saved_state". There were only two "real" uses of saved_state;
both are now switched over to use dev_pm_info.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
arch/arm/common/locomo.c | 3 ---
arch/arm/common/sa1111.c | 23 +++++++++++++++--------
arch/arm/mach-sa1100/neponset.c | 23 +++++++++++++++--------
include/linux/device.h | 5 -----
4 files changed, 30 insertions(+), 24 deletions(-)
diff -Nru a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
--- a/arch/arm/common/locomo.c 2004-11-12 14:53:41 -08:00
+++ b/arch/arm/common/locomo.c 2004-11-12 14:53:41 -08:00
@@ -627,9 +627,6 @@
if (lchip) {
__locomo_remove(lchip);
dev_set_drvdata(dev, NULL);
-
- kfree(dev->saved_state);
- dev->saved_state = NULL;
}
return 0;
diff -Nru a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
--- a/arch/arm/common/sa1111.c 2004-11-12 14:53:41 -08:00
+++ b/arch/arm/common/sa1111.c 2004-11-12 14:53:41 -08:00
@@ -797,6 +797,8 @@
unsigned int wakeen1;
};
+#ifdef CONFIG_PM
+
static int sa1111_suspend(struct device *dev, u32 state, u32 level)
{
struct sa1111 *sachip = dev_get_drvdata(dev);
@@ -808,11 +810,10 @@
if (level != SUSPEND_DISABLE)
return 0;
- dev->saved_state = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL);
- if (!dev->saved_state)
+ save = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL);
+ if (!save)
return -ENOMEM;
-
- save = (struct sa1111_save_data *)dev->saved_state;
+ dev->power.saved_state = save;
spin_lock_irqsave(&sachip->lock, flags);
@@ -870,7 +871,7 @@
if (level != RESUME_ENABLE)
return 0;
- save = (struct sa1111_save_data *)dev->saved_state;
+ save = (struct sa1111_save_data *)dev->power.saved_state;
if (!save)
return 0;
@@ -915,12 +916,18 @@
spin_unlock_irqrestore(&sachip->lock, flags);
- dev->saved_state = NULL;
+ dev->power.saved_state = NULL;
kfree(save);
return 0;
}
+#else /* !CONFIG_PM */
+#define sa1111_resume NULL
+#define sa1111_suspend NULL
+#endif /* !CONFIG_PM */
+
+
static int sa1111_probe(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
@@ -943,8 +950,8 @@
__sa1111_remove(sachip);
dev_set_drvdata(dev, NULL);
- kfree(dev->saved_state);
- dev->saved_state = NULL;
+ kfree(dev->power.saved_state);
+ dev->power.saved_state = NULL;
}
return 0;
diff -Nru a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
--- a/arch/arm/mach-sa1100/neponset.c 2004-11-12 14:53:41 -08:00
+++ b/arch/arm/mach-sa1100/neponset.c 2004-11-12 14:53:41 -08:00
@@ -173,6 +173,8 @@
return 0;
}
+#ifdef CONFIG_PM
+
/*
* LDM power management.
*/
@@ -184,12 +186,12 @@
if (level == SUSPEND_SAVE_STATE ||
level == SUSPEND_DISABLE ||
level == SUSPEND_POWER_DOWN) {
- if (!dev->saved_state)
- dev->saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL);
- if (!dev->saved_state)
+ if (!dev->power.saved_state)
+ dev->power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL);
+ if (!dev->power.saved_state)
return -ENOMEM;
- *(unsigned int *)dev->saved_state = NCR_0;
+ *(unsigned int *)dev->power.saved_state = NCR_0;
}
return 0;
@@ -198,15 +200,20 @@
static int neponset_resume(struct device *dev, u32 level)
{
if (level == RESUME_RESTORE_STATE || level == RESUME_ENABLE) {
- if (dev->saved_state) {
- NCR_0 = *(unsigned int *)dev->saved_state;
- kfree(dev->saved_state);
- dev->saved_state = NULL;
+ if (dev->power.saved_state) {
+ NCR_0 = *(unsigned int *)dev->power.saved_state;
+ kfree(dev->power.saved_state);
+ dev->power.saved_state = NULL;
}
}
return 0;
}
+
+#else
+#define neponset_suspend NULL
+#define neponset_resume NULL
+#endif
static struct device_driver neponset_device_driver = {
.name = "neponset",
diff -Nru a/include/linux/device.h b/include/linux/device.h
--- a/include/linux/device.h 2004-11-12 14:53:41 -08:00
+++ b/include/linux/device.h 2004-11-12 14:53:41 -08:00
@@ -268,12 +268,7 @@
void *platform_data; /* Platform specific data (e.g. ACPI,
BIOS data relevant to device) */
struct dev_pm_info power;
- u32 power_state; /* Current operating state. In
- ACPI-speak, this is D0-D3, D0
- being fully functional, and D3
- being off. */
- unsigned char *saved_state; /* saved device state */
u32 detach_state; /* State to enter when device is
detached from its driver. */
next prev parent reply other threads:[~2004-11-13 2:41 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-12 22:58 [BK PATCH] " Greg KH
2004-11-12 23:00 ` Greg KH [this message]
2004-11-12 23:00 ` [PATCH] " Greg KH
2004-11-12 23:00 ` Greg KH
2004-11-12 23:00 ` Greg KH
2004-11-12 23:00 ` Greg KH
2004-11-12 23:00 ` Greg KH
2004-11-12 23:00 ` Greg KH
2004-11-12 23:00 ` Greg KH
2004-11-12 23:00 ` Greg KH
[not found] ` <20041113000052.GC346@electric-eye.fr.zoreil.com>
[not found] ` <200411130020.17494.lists@kenneth.aafloy.net>
2004-11-13 0:44 ` Greg KH
2004-11-13 20:51 ` [BK PATCH] " Linus Torvalds
2004-11-13 21:10 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2004-11-05 0:35 [BK PATCH] More USB " Greg KH
2004-11-05 0:48 ` [PATCH] More Driver Core " Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` Greg KH
2004-11-05 0:48 ` 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=1100300406618@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome