aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/base.h4
-rw-r--r--drivers/base/bus.c3
-rw-r--r--drivers/base/memory.c2
-rw-r--r--drivers/base/power/resume.c3
-rw-r--r--drivers/base/power/shutdown.c2
-rw-r--r--drivers/base/power/suspend.c3
-rw-r--r--drivers/base/power/sysfs.c24
-rw-r--r--drivers/base/sys.c3
8 files changed, 30 insertions, 14 deletions
diff --git a/drivers/base/base.h b/drivers/base/base.h
index e3b548d46cff..5735b38582d0 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -19,6 +19,10 @@ extern void bus_remove_driver(struct device_driver *);
19extern void driver_detach(struct device_driver * drv); 19extern void driver_detach(struct device_driver * drv);
20extern int driver_probe_device(struct device_driver *, struct device *); 20extern int driver_probe_device(struct device_driver *, struct device *);
21 21
22extern void sysdev_shutdown(void);
23extern int sysdev_suspend(pm_message_t state);
24extern int sysdev_resume(void);
25
22static inline struct class_device *to_class_dev(struct kobject *obj) 26static inline struct class_device *to_class_dev(struct kobject *obj)
23{ 27{
24 return container_of(obj, struct class_device, kobj); 28 return container_of(obj, struct class_device, kobj);
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 29f6af554e71..c3141565d59d 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -133,6 +133,8 @@ static struct kobj_type ktype_bus = {
133decl_subsys(bus, &ktype_bus, NULL); 133decl_subsys(bus, &ktype_bus, NULL);
134 134
135 135
136#ifdef CONFIG_HOTPLUG
137
136/* Manually detach a device from its associated driver. */ 138/* Manually detach a device from its associated driver. */
137static int driver_helper(struct device *dev, void *data) 139static int driver_helper(struct device *dev, void *data)
138{ 140{
@@ -193,6 +195,7 @@ static ssize_t driver_bind(struct device_driver *drv,
193} 195}
194static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind); 196static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind);
195 197
198#endif
196 199
197static struct device * next_device(struct klist_iter * i) 200static struct device * next_device(struct klist_iter * i)
198{ 201{
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index d1a05224627e..105a0d61eb1f 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -303,7 +303,7 @@ static int block_size_init(void)
303 */ 303 */
304#ifdef CONFIG_ARCH_MEMORY_PROBE 304#ifdef CONFIG_ARCH_MEMORY_PROBE
305static ssize_t 305static ssize_t
306memory_probe_store(struct class *class, const char __user *buf, size_t count) 306memory_probe_store(struct class *class, const char *buf, size_t count)
307{ 307{
308 u64 phys_addr; 308 u64 phys_addr;
309 int ret; 309 int ret;
diff --git a/drivers/base/power/resume.c b/drivers/base/power/resume.c
index 0a7aa07b9a2a..317edbf0feca 100644
--- a/drivers/base/power/resume.c
+++ b/drivers/base/power/resume.c
@@ -9,10 +9,9 @@
9 */ 9 */
10 10
11#include <linux/device.h> 11#include <linux/device.h>
12#include "../base.h"
12#include "power.h" 13#include "power.h"
13 14
14extern int sysdev_resume(void);
15
16 15
17/** 16/**
18 * resume_device - Restore state for one device. 17 * resume_device - Restore state for one device.
diff --git a/drivers/base/power/shutdown.c b/drivers/base/power/shutdown.c
index c2475f3134ea..8826a5b6673e 100644
--- a/drivers/base/power/shutdown.c
+++ b/drivers/base/power/shutdown.c
@@ -12,6 +12,7 @@
12#include <linux/device.h> 12#include <linux/device.h>
13#include <asm/semaphore.h> 13#include <asm/semaphore.h>
14 14
15#include "../base.h"
15#include "power.h" 16#include "power.h"
16 17
17#define to_dev(node) container_of(node, struct device, kobj.entry) 18#define to_dev(node) container_of(node, struct device, kobj.entry)
@@ -28,7 +29,6 @@ extern struct subsystem devices_subsys;
28 * they only get one called once when interrupts are disabled. 29 * they only get one called once when interrupts are disabled.
29 */ 30 */
30 31
31extern int sysdev_shutdown(void);
32 32
33/** 33/**
34 * device_shutdown - call ->shutdown() on each device to shutdown. 34 * device_shutdown - call ->shutdown() on each device to shutdown.
diff --git a/drivers/base/power/suspend.c b/drivers/base/power/suspend.c
index 50501764d050..8660779fb288 100644
--- a/drivers/base/power/suspend.c
+++ b/drivers/base/power/suspend.c
@@ -9,10 +9,9 @@
9 */ 9 */
10 10
11#include <linux/device.h> 11#include <linux/device.h>
12#include "../base.h"
12#include "power.h" 13#include "power.h"
13 14
14extern int sysdev_suspend(pm_message_t state);
15
16/* 15/*
17 * The entries in the dpm_active list are in a depth first order, simply 16 * The entries in the dpm_active list are in a depth first order, simply
18 * because children are guaranteed to be discovered after parents, and 17 * because children are guaranteed to be discovered after parents, and
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c
index f3a0c562bcb5..40d7242a07c1 100644
--- a/drivers/base/power/sysfs.c
+++ b/drivers/base/power/sysfs.c
@@ -27,22 +27,30 @@
27 27
28static ssize_t state_show(struct device * dev, struct device_attribute *attr, char * buf) 28static ssize_t state_show(struct device * dev, struct device_attribute *attr, char * buf)
29{ 29{
30 return sprintf(buf, "%u\n", dev->power.power_state.event); 30 if (dev->power.power_state.event)
31 return sprintf(buf, "2\n");
32 else
33 return sprintf(buf, "0\n");
31} 34}
32 35
33static ssize_t state_store(struct device * dev, struct device_attribute *attr, const char * buf, size_t n) 36static ssize_t state_store(struct device * dev, struct device_attribute *attr, const char * buf, size_t n)
34{ 37{
35 pm_message_t state; 38 pm_message_t state;
36 char * rest; 39 int error = -EINVAL;
37 int error = 0;
38 40
39 state.event = simple_strtoul(buf, &rest, 10); 41 state.event = PM_EVENT_SUSPEND;
40 if (*rest) 42 /* Older apps expected to write "3" here - confused with PCI D3 */
41 return -EINVAL; 43 if ((n == 1) && !strcmp(buf, "3"))
42 if (state.event)
43 error = dpm_runtime_suspend(dev, state); 44 error = dpm_runtime_suspend(dev, state);
44 else 45
46 if ((n == 1) && !strcmp(buf, "2"))
47 error = dpm_runtime_suspend(dev, state);
48
49 if ((n == 1) && !strcmp(buf, "0")) {
45 dpm_runtime_resume(dev); 50 dpm_runtime_resume(dev);
51 error = 0;
52 }
53
46 return error ? error : n; 54 return error ? error : n;
47} 55}
48 56
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 66ed8f2fece5..6fc23ab127bd 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -21,8 +21,11 @@
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/string.h> 22#include <linux/string.h>
23#include <linux/pm.h> 23#include <linux/pm.h>
24#include <linux/device.h>
24#include <asm/semaphore.h> 25#include <asm/semaphore.h>
25 26
27#include "base.h"
28
26extern struct subsystem devices_subsys; 29extern struct subsystem devices_subsys;
27 30
28#define to_sysdev(k) container_of(k, struct sys_device, kobj) 31#define to_sysdev(k) container_of(k, struct sys_device, kobj)