aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/attribute_container.h28
-rw-r--r--include/linux/bsg.h2
-rw-r--r--include/linux/device.h35
-rw-r--r--include/linux/enclosure.h11
-rw-r--r--include/linux/hw_random.h10
-rw-r--r--include/linux/iscsi_ibft.h50
-rw-r--r--include/linux/kernel.h6
-rw-r--r--include/linux/leds.h10
-rw-r--r--include/linux/libata.h2
-rw-r--r--include/linux/memory.h4
-rw-r--r--include/linux/memstick.h2
-rw-r--r--include/linux/miscdevice.h10
-rw-r--r--include/linux/pm.h43
-rw-r--r--include/linux/pm_wakeup.h90
-rw-r--r--include/linux/raid_class.h12
-rw-r--r--include/linux/sysfs.h9
-rw-r--r--include/linux/transport_class.h6
-rw-r--r--include/rdma/ib_verbs.h2
-rw-r--r--include/scsi/scsi_device.h10
-rw-r--r--include/scsi/scsi_host.h7
-rw-r--r--include/scsi/scsi_transport.h2
-rw-r--r--include/scsi/scsi_transport_fc.h14
-rw-r--r--include/scsi/scsi_transport_sas.h12
-rw-r--r--include/scsi/sd.h4
24 files changed, 218 insertions, 163 deletions
diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h
index 574b201b99d8..794ad74b1d61 100644
--- a/include/linux/attribute_container.h
+++ b/include/linux/attribute_container.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * class_container.h - a generic container for all classes 2 * attribute_container.h - a generic container for all classes
3 * 3 *
4 * Copyright (c) 2005 - James Bottomley <James.Bottomley@steeleye.com> 4 * Copyright (c) 2005 - James Bottomley <James.Bottomley@steeleye.com>
5 * 5 *
@@ -18,7 +18,7 @@ struct attribute_container {
18 struct klist containers; 18 struct klist containers;
19 struct class *class; 19 struct class *class;
20 struct attribute_group *grp; 20 struct attribute_group *grp;
21 struct class_device_attribute **attrs; 21 struct device_attribute **attrs;
22 int (*match)(struct attribute_container *, struct device *); 22 int (*match)(struct attribute_container *, struct device *);
23#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01 23#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01
24 unsigned long flags; 24 unsigned long flags;
@@ -41,31 +41,31 @@ int __must_check attribute_container_unregister(struct attribute_container *cont
41void attribute_container_create_device(struct device *dev, 41void attribute_container_create_device(struct device *dev,
42 int (*fn)(struct attribute_container *, 42 int (*fn)(struct attribute_container *,
43 struct device *, 43 struct device *,
44 struct class_device *)); 44 struct device *));
45void attribute_container_add_device(struct device *dev, 45void attribute_container_add_device(struct device *dev,
46 int (*fn)(struct attribute_container *, 46 int (*fn)(struct attribute_container *,
47 struct device *, 47 struct device *,
48 struct class_device *)); 48 struct device *));
49void attribute_container_remove_device(struct device *dev, 49void attribute_container_remove_device(struct device *dev,
50 void (*fn)(struct attribute_container *, 50 void (*fn)(struct attribute_container *,
51 struct device *, 51 struct device *,
52 struct class_device *)); 52 struct device *));
53void attribute_container_device_trigger(struct device *dev, 53void attribute_container_device_trigger(struct device *dev,
54 int (*fn)(struct attribute_container *, 54 int (*fn)(struct attribute_container *,
55 struct device *, 55 struct device *,
56 struct class_device *)); 56 struct device *));
57void attribute_container_trigger(struct device *dev, 57void attribute_container_trigger(struct device *dev,
58 int (*fn)(struct attribute_container *, 58 int (*fn)(struct attribute_container *,
59 struct device *)); 59 struct device *));
60int attribute_container_add_attrs(struct class_device *classdev); 60int attribute_container_add_attrs(struct device *classdev);
61int attribute_container_add_class_device(struct class_device *classdev); 61int attribute_container_add_class_device(struct device *classdev);
62int attribute_container_add_class_device_adapter(struct attribute_container *cont, 62int attribute_container_add_class_device_adapter(struct attribute_container *cont,
63 struct device *dev, 63 struct device *dev,
64 struct class_device *classdev); 64 struct device *classdev);
65void attribute_container_remove_attrs(struct class_device *classdev); 65void attribute_container_remove_attrs(struct device *classdev);
66void attribute_container_class_device_del(struct class_device *classdev); 66void attribute_container_class_device_del(struct device *classdev);
67struct attribute_container *attribute_container_classdev_to_container(struct class_device *); 67struct attribute_container *attribute_container_classdev_to_container(struct device *);
68struct class_device *attribute_container_find_class_device(struct attribute_container *, struct device *); 68struct device *attribute_container_find_class_device(struct attribute_container *, struct device *);
69struct class_device_attribute **attribute_container_classdev_to_attrs(const struct class_device *classdev); 69struct device_attribute **attribute_container_classdev_to_attrs(const struct device *classdev);
70 70
71#endif 71#endif
diff --git a/include/linux/bsg.h b/include/linux/bsg.h
index 60e377b520f8..e8406c55c6d3 100644
--- a/include/linux/bsg.h
+++ b/include/linux/bsg.h
@@ -55,7 +55,7 @@ struct sg_io_v4 {
55 55
56#if defined(CONFIG_BLK_DEV_BSG) 56#if defined(CONFIG_BLK_DEV_BSG)
57struct bsg_class_device { 57struct bsg_class_device {
58 struct class_device *class_dev; 58 struct device *class_dev;
59 struct device *dev; 59 struct device *dev;
60 int minor; 60 int minor;
61 struct request_queue *queue; 61 struct request_queue *queue;
diff --git a/include/linux/device.h b/include/linux/device.h
index c79b93e56fa0..1a060265acea 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -429,7 +429,6 @@ struct device {
429 struct kobject kobj; 429 struct kobject kobj;
430 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 430 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
431 struct device_type *type; 431 struct device_type *type;
432 unsigned is_registered:1;
433 unsigned uevent_suppress:1; 432 unsigned uevent_suppress:1;
434 433
435 struct semaphore sem; /* semaphore to synchronize calls to 434 struct semaphore sem; /* semaphore to synchronize calls to
@@ -475,6 +474,9 @@ struct device {
475 void (*release)(struct device *dev); 474 void (*release)(struct device *dev);
476}; 475};
477 476
477/* Get the wakeup routines, which depend on struct device */
478#include <linux/pm_wakeup.h>
479
478#ifdef CONFIG_NUMA 480#ifdef CONFIG_NUMA
479static inline int dev_to_node(struct device *dev) 481static inline int dev_to_node(struct device *dev)
480{ 482{
@@ -506,7 +508,7 @@ static inline void dev_set_drvdata(struct device *dev, void *data)
506 508
507static inline int device_is_registered(struct device *dev) 509static inline int device_is_registered(struct device *dev)
508{ 510{
509 return dev->is_registered; 511 return dev->kobj.state_in_sysfs;
510} 512}
511 513
512void driver_init(void); 514void driver_init(void);
@@ -543,20 +545,6 @@ extern struct device *device_create(struct class *cls, struct device *parent,
543 dev_t devt, const char *fmt, ...) 545 dev_t devt, const char *fmt, ...)
544 __attribute__((format(printf, 4, 5))); 546 __attribute__((format(printf, 4, 5)));
545extern void device_destroy(struct class *cls, dev_t devt); 547extern void device_destroy(struct class *cls, dev_t devt);
546#ifdef CONFIG_PM_SLEEP
547extern void destroy_suspended_device(struct class *cls, dev_t devt);
548extern void device_pm_schedule_removal(struct device *);
549#else /* !CONFIG_PM_SLEEP */
550static inline void destroy_suspended_device(struct class *cls, dev_t devt)
551{
552 device_destroy(cls, devt);
553}
554
555static inline void device_pm_schedule_removal(struct device *dev)
556{
557 device_unregister(dev);
558}
559#endif /* !CONFIG_PM_SLEEP */
560 548
561/* 549/*
562 * Platform "fixup" functions - allow the platform to have their say 550 * Platform "fixup" functions - allow the platform to have their say
@@ -608,21 +596,16 @@ extern const char *dev_driver_string(struct device *dev);
608#define dev_dbg(dev, format, arg...) \ 596#define dev_dbg(dev, format, arg...) \
609 dev_printk(KERN_DEBUG , dev , format , ## arg) 597 dev_printk(KERN_DEBUG , dev , format , ## arg)
610#else 598#else
611static inline int __attribute__ ((format (printf, 2, 3))) 599#define dev_dbg(dev, format, arg...) \
612dev_dbg(struct device *dev, const char *fmt, ...) 600 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
613{
614 return 0;
615}
616#endif 601#endif
617 602
618#ifdef VERBOSE_DEBUG 603#ifdef VERBOSE_DEBUG
619#define dev_vdbg dev_dbg 604#define dev_vdbg dev_dbg
620#else 605#else
621static inline int __attribute__ ((format (printf, 2, 3))) 606
622dev_vdbg(struct device *dev, const char *fmt, ...) 607#define dev_vdbg(dev, format, arg...) \
623{ 608 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
624 return 0;
625}
626#endif 609#endif
627 610
628/* Create alias, so I can be autoloaded. */ 611/* Create alias, so I can be autoloaded. */
diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h
index a5978f18ca40..4332442b1b57 100644
--- a/include/linux/enclosure.h
+++ b/include/linux/enclosure.h
@@ -82,7 +82,8 @@ struct enclosure_component_callbacks {
82 82
83struct enclosure_component { 83struct enclosure_component {
84 void *scratch; 84 void *scratch;
85 struct class_device cdev; 85 struct device cdev;
86 struct device *dev;
86 enum enclosure_component_type type; 87 enum enclosure_component_type type;
87 int number; 88 int number;
88 int fault; 89 int fault;
@@ -94,20 +95,20 @@ struct enclosure_component {
94struct enclosure_device { 95struct enclosure_device {
95 void *scratch; 96 void *scratch;
96 struct list_head node; 97 struct list_head node;
97 struct class_device cdev; 98 struct device edev;
98 struct enclosure_component_callbacks *cb; 99 struct enclosure_component_callbacks *cb;
99 int components; 100 int components;
100 struct enclosure_component component[0]; 101 struct enclosure_component component[0];
101}; 102};
102 103
103static inline struct enclosure_device * 104static inline struct enclosure_device *
104to_enclosure_device(struct class_device *dev) 105to_enclosure_device(struct device *dev)
105{ 106{
106 return container_of(dev, struct enclosure_device, cdev); 107 return container_of(dev, struct enclosure_device, edev);
107} 108}
108 109
109static inline struct enclosure_component * 110static inline struct enclosure_component *
110to_enclosure_component(struct class_device *dev) 111to_enclosure_component(struct device *dev)
111{ 112{
112 return container_of(dev, struct enclosure_component, cdev); 113 return container_of(dev, struct enclosure_component, cdev);
113} 114}
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
index 42131820bb89..85d11916e9ea 100644
--- a/include/linux/hw_random.h
+++ b/include/linux/hw_random.h
@@ -44,15 +44,7 @@ struct hwrng {
44/** Register a new Hardware Random Number Generator driver. */ 44/** Register a new Hardware Random Number Generator driver. */
45extern int hwrng_register(struct hwrng *rng); 45extern int hwrng_register(struct hwrng *rng);
46/** Unregister a Hardware Random Number Generator driver. */ 46/** Unregister a Hardware Random Number Generator driver. */
47extern void __hwrng_unregister(struct hwrng *rng, bool suspended); 47extern void hwrng_unregister(struct hwrng *rng);
48static inline void hwrng_unregister(struct hwrng *rng)
49{
50 __hwrng_unregister(rng, false);
51}
52static inline void hwrng_unregister_suspended(struct hwrng *rng)
53{
54 __hwrng_unregister(rng, true);
55}
56 48
57#endif /* __KERNEL__ */ 49#endif /* __KERNEL__ */
58#endif /* LINUX_HWRANDOM_H_ */ 50#endif /* LINUX_HWRANDOM_H_ */
diff --git a/include/linux/iscsi_ibft.h b/include/linux/iscsi_ibft.h
new file mode 100644
index 000000000000..6092487e2950
--- /dev/null
+++ b/include/linux/iscsi_ibft.h
@@ -0,0 +1,50 @@
1/*
2 * Copyright 2007 Red Hat, Inc.
3 * by Peter Jones <pjones@redhat.com>
4 * Copyright 2007 IBM, Inc.
5 * by Konrad Rzeszutek <konradr@linux.vnet.ibm.com>
6 * Copyright 2008
7 * by Konrad Rzeszutek <ketuzsezr@darnok.org>
8 *
9 * This code exposes the iSCSI Boot Format Table to userland via sysfs.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License v2.0 as published by
13 * the Free Software Foundation
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 */
20
21#ifndef ISCSI_IBFT_H
22#define ISCSI_IBFT_H
23
24struct ibft_table_header {
25 char signature[4];
26 u32 length;
27 u8 revision;
28 u8 checksum;
29 char oem_id[6];
30 char oem_table_id[8];
31 char reserved[24];
32} __attribute__((__packed__));
33
34/*
35 * Logical location of iSCSI Boot Format Table.
36 * If the value is NULL there is no iBFT on the machine.
37 */
38extern struct ibft_table_header *ibft_addr;
39
40/*
41 * Routine used to find and reserve the iSCSI Boot Format Table. The
42 * mapped address is set in the ibft_addr variable.
43 */
44#ifdef CONFIG_ISCSI_IBFT_FIND
45extern void __init reserve_ibft_region(void);
46#else
47static inline void reserve_ibft_region(void) { }
48#endif
49
50#endif /* ISCSI_IBFT_H */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 2df44e773270..cd6d02cf854d 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -293,10 +293,8 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
293#define pr_debug(fmt, arg...) \ 293#define pr_debug(fmt, arg...) \
294 printk(KERN_DEBUG fmt, ##arg) 294 printk(KERN_DEBUG fmt, ##arg)
295#else 295#else
296static inline int __attribute__ ((format (printf, 1, 2))) pr_debug(const char * fmt, ...) 296#define pr_debug(fmt, arg...) \
297{ 297 ({ if (0) printk(KERN_DEBUG fmt, ##arg); 0; })
298 return 0;
299}
300#endif 298#endif
301 299
302/* 300/*
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 0201f6f51cea..b07e3d400bd6 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -59,15 +59,7 @@ struct led_classdev {
59 59
60extern int led_classdev_register(struct device *parent, 60extern int led_classdev_register(struct device *parent,
61 struct led_classdev *led_cdev); 61 struct led_classdev *led_cdev);
62extern void __led_classdev_unregister(struct led_classdev *led_cdev, bool sus); 62extern void led_classdev_unregister(struct led_classdev *lcd);
63static inline void led_classdev_unregister(struct led_classdev *lcd)
64{
65 __led_classdev_unregister(lcd, false);
66}
67static inline void led_classdev_unregister_suspended(struct led_classdev *lcd)
68{
69 __led_classdev_unregister(lcd, true);
70}
71extern void led_classdev_suspend(struct led_classdev *led_cdev); 63extern void led_classdev_suspend(struct led_classdev *led_cdev);
72extern void led_classdev_resume(struct led_classdev *led_cdev); 64extern void led_classdev_resume(struct led_classdev *led_cdev);
73 65
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 165734a2dd47..07ed56f7a767 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -443,7 +443,7 @@ enum link_pm {
443 MAX_PERFORMANCE, 443 MAX_PERFORMANCE,
444 MEDIUM_POWER, 444 MEDIUM_POWER,
445}; 445};
446extern struct class_device_attribute class_device_attr_link_power_management_policy; 446extern struct device_attribute dev_attr_link_power_management_policy;
447 447
448#ifdef CONFIG_ATA_SFF 448#ifdef CONFIG_ATA_SFF
449struct ata_ioports { 449struct ata_ioports {
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 54d7866d9c0e..f80e0e331cb7 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -18,7 +18,7 @@
18#include <linux/sysdev.h> 18#include <linux/sysdev.h>
19#include <linux/node.h> 19#include <linux/node.h>
20#include <linux/compiler.h> 20#include <linux/compiler.h>
21#include <linux/semaphore.h> 21#include <linux/mutex.h>
22 22
23struct memory_block { 23struct memory_block {
24 unsigned long phys_index; 24 unsigned long phys_index;
@@ -29,7 +29,7 @@ struct memory_block {
29 * created long after the critical areas during 29 * created long after the critical areas during
30 * initialization. 30 * initialization.
31 */ 31 */
32 struct semaphore state_sem; 32 struct mutex state_mutex;
33 int phys_device; /* to which fru does this belong? */ 33 int phys_device; /* to which fru does this belong? */
34 void *hw; /* optional pointer to fw/hw data */ 34 void *hw; /* optional pointer to fw/hw data */
35 int (*phys_callback)(struct memory_block *); 35 int (*phys_callback)(struct memory_block *);
diff --git a/include/linux/memstick.h b/include/linux/memstick.h
index 3e686ec6a967..37a5cdb03918 100644
--- a/include/linux/memstick.h
+++ b/include/linux/memstick.h
@@ -276,7 +276,7 @@ struct memstick_host {
276#define MEMSTICK_CAP_PAR8 4 276#define MEMSTICK_CAP_PAR8 4
277 277
278 struct work_struct media_checker; 278 struct work_struct media_checker;
279 struct class_device cdev; 279 struct device dev;
280 280
281 struct memstick_dev *card; 281 struct memstick_dev *card;
282 unsigned int retries; 282 unsigned int retries;
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 24b30b9b4f8a..26433ec520b3 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -43,15 +43,7 @@ struct miscdevice {
43}; 43};
44 44
45extern int misc_register(struct miscdevice * misc); 45extern int misc_register(struct miscdevice * misc);
46extern int __misc_deregister(struct miscdevice *misc, bool suspended); 46extern int misc_deregister(struct miscdevice *misc);
47static inline int misc_deregister(struct miscdevice *misc)
48{
49 return __misc_deregister(misc, false);
50}
51static inline int misc_deregister_suspended(struct miscdevice *misc)
52{
53 return __misc_deregister(misc, true);
54}
55 47
56#define MODULE_ALIAS_MISCDEV(minor) \ 48#define MODULE_ALIAS_MISCDEV(minor) \
57 MODULE_ALIAS("char-major-" __stringify(MISC_MAJOR) \ 49 MODULE_ALIAS("char-major-" __stringify(MISC_MAJOR) \
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 015b735811b4..1de72cbbe0d1 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -183,8 +183,9 @@ typedef struct pm_message {
183struct dev_pm_info { 183struct dev_pm_info {
184 pm_message_t power_state; 184 pm_message_t power_state;
185 unsigned can_wakeup:1; 185 unsigned can_wakeup:1;
186#ifdef CONFIG_PM_SLEEP
187 unsigned should_wakeup:1; 186 unsigned should_wakeup:1;
187 bool sleeping:1; /* Owned by the PM core */
188#ifdef CONFIG_PM_SLEEP
188 struct list_head entry; 189 struct list_head entry;
189#endif 190#endif
190}; 191};
@@ -197,11 +198,6 @@ extern void device_resume(void);
197extern int device_suspend(pm_message_t state); 198extern int device_suspend(pm_message_t state);
198extern int device_prepare_suspend(pm_message_t state); 199extern int device_prepare_suspend(pm_message_t state);
199 200
200#define device_set_wakeup_enable(dev,val) \
201 ((dev)->power.should_wakeup = !!(val))
202#define device_may_wakeup(dev) \
203 (device_can_wakeup(dev) && (dev)->power.should_wakeup)
204
205extern void __suspend_report_result(const char *function, void *fn, int ret); 201extern void __suspend_report_result(const char *function, void *fn, int ret);
206 202
207#define suspend_report_result(fn, ret) \ 203#define suspend_report_result(fn, ret) \
@@ -209,20 +205,6 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
209 __suspend_report_result(__FUNCTION__, fn, ret); \ 205 __suspend_report_result(__FUNCTION__, fn, ret); \
210 } while (0) 206 } while (0)
211 207
212/*
213 * Platform hook to activate device wakeup capability, if that's not already
214 * handled by enable_irq_wake() etc.
215 * Returns zero on success, else negative errno
216 */
217extern int (*platform_enable_wakeup)(struct device *dev, int is_on);
218
219static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
220{
221 if (platform_enable_wakeup)
222 return (*platform_enable_wakeup)(dev, is_on);
223 return 0;
224}
225
226#else /* !CONFIG_PM_SLEEP */ 208#else /* !CONFIG_PM_SLEEP */
227 209
228static inline int device_suspend(pm_message_t state) 210static inline int device_suspend(pm_message_t state)
@@ -230,29 +212,10 @@ static inline int device_suspend(pm_message_t state)
230 return 0; 212 return 0;
231} 213}
232 214
233#define device_set_wakeup_enable(dev,val) do{}while(0) 215#define suspend_report_result(fn, ret) do {} while (0)
234#define device_may_wakeup(dev) (0)
235
236#define suspend_report_result(fn, ret) do { } while (0)
237
238static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
239{
240 return 0;
241}
242 216
243#endif /* !CONFIG_PM_SLEEP */ 217#endif /* !CONFIG_PM_SLEEP */
244 218
245/* changes to device_may_wakeup take effect on the next pm state change.
246 * by default, devices should wakeup if they can.
247 */
248#define device_can_wakeup(dev) \
249 ((dev)->power.can_wakeup)
250#define device_init_wakeup(dev,val) \
251 do { \
252 device_can_wakeup(dev) = !!(val); \
253 device_set_wakeup_enable(dev,val); \
254 } while(0)
255
256/* 219/*
257 * Global Power Management flags 220 * Global Power Management flags
258 * Used to keep APM and ACPI from both being active 221 * Used to keep APM and ACPI from both being active
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
new file mode 100644
index 000000000000..f0d0b2cb8d20
--- /dev/null
+++ b/include/linux/pm_wakeup.h
@@ -0,0 +1,90 @@
1/*
2 * pm_wakeup.h - Power management wakeup interface
3 *
4 * Copyright (C) 2008 Alan Stern
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef _LINUX_PM_WAKEUP_H
22#define _LINUX_PM_WAKEUP_H
23
24#ifndef _DEVICE_H_
25# error "please don't include this file directly"
26#endif
27
28#ifdef CONFIG_PM
29
30/* changes to device_may_wakeup take effect on the next pm state change.
31 * by default, devices should wakeup if they can.
32 */
33static inline void device_init_wakeup(struct device *dev, int val)
34{
35 dev->power.can_wakeup = dev->power.should_wakeup = !!val;
36}
37
38static inline int device_can_wakeup(struct device *dev)
39{
40 return dev->power.can_wakeup;
41}
42
43static inline void device_set_wakeup_enable(struct device *dev, int val)
44{
45 dev->power.should_wakeup = !!val;
46}
47
48static inline int device_may_wakeup(struct device *dev)
49{
50 return dev->power.can_wakeup & dev->power.should_wakeup;
51}
52
53/*
54 * Platform hook to activate device wakeup capability, if that's not already
55 * handled by enable_irq_wake() etc.
56 * Returns zero on success, else negative errno
57 */
58extern int (*platform_enable_wakeup)(struct device *dev, int is_on);
59
60static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
61{
62 if (platform_enable_wakeup)
63 return (*platform_enable_wakeup)(dev, is_on);
64 return 0;
65}
66
67#else /* !CONFIG_PM */
68
69/* For some reason the next two routines work even without CONFIG_PM */
70static inline void device_init_wakeup(struct device *dev, int val)
71{
72 dev->power.can_wakeup = !!val;
73}
74
75static inline int device_can_wakeup(struct device *dev)
76{
77 return dev->power.can_wakeup;
78}
79
80#define device_set_wakeup_enable(dev, val) do {} while (0)
81#define device_may_wakeup(dev) 0
82
83static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
84{
85 return 0;
86}
87
88#endif /* !CONFIG_PM */
89
90#endif /* _LINUX_PM_WAKEUP_H */
diff --git a/include/linux/raid_class.h b/include/linux/raid_class.h
index d22ad392242a..6b537f1ac96c 100644
--- a/include/linux/raid_class.h
+++ b/include/linux/raid_class.h
@@ -53,20 +53,20 @@ struct raid_data {
53#define DEFINE_RAID_ATTRIBUTE(type, attr) \ 53#define DEFINE_RAID_ATTRIBUTE(type, attr) \
54static inline void \ 54static inline void \
55raid_set_##attr(struct raid_template *r, struct device *dev, type value) { \ 55raid_set_##attr(struct raid_template *r, struct device *dev, type value) { \
56 struct class_device *cdev = \ 56 struct device *device = \
57 attribute_container_find_class_device(&r->raid_attrs.ac, dev);\ 57 attribute_container_find_class_device(&r->raid_attrs.ac, dev);\
58 struct raid_data *rd; \ 58 struct raid_data *rd; \
59 BUG_ON(!cdev); \ 59 BUG_ON(!device); \
60 rd = class_get_devdata(cdev); \ 60 rd = dev_get_drvdata(device); \
61 rd->attr = value; \ 61 rd->attr = value; \
62} \ 62} \
63static inline type \ 63static inline type \
64raid_get_##attr(struct raid_template *r, struct device *dev) { \ 64raid_get_##attr(struct raid_template *r, struct device *dev) { \
65 struct class_device *cdev = \ 65 struct device *device = \
66 attribute_container_find_class_device(&r->raid_attrs.ac, dev);\ 66 attribute_container_find_class_device(&r->raid_attrs.ac, dev);\
67 struct raid_data *rd; \ 67 struct raid_data *rd; \
68 BUG_ON(!cdev); \ 68 BUG_ON(!device); \
69 rd = class_get_devdata(cdev); \ 69 rd = dev_get_drvdata(device); \
70 return rd->attr; \ 70 return rd->attr; \
71} 71}
72 72
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 802710438a9e..03378e3515b3 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -131,7 +131,6 @@ static inline int sysfs_create_dir(struct kobject *kobj)
131 131
132static inline void sysfs_remove_dir(struct kobject *kobj) 132static inline void sysfs_remove_dir(struct kobject *kobj)
133{ 133{
134 ;
135} 134}
136 135
137static inline int sysfs_rename_dir(struct kobject *kobj, const char *new_name) 136static inline int sysfs_rename_dir(struct kobject *kobj, const char *new_name)
@@ -160,7 +159,6 @@ static inline int sysfs_chmod_file(struct kobject *kobj,
160static inline void sysfs_remove_file(struct kobject *kobj, 159static inline void sysfs_remove_file(struct kobject *kobj,
161 const struct attribute *attr) 160 const struct attribute *attr)
162{ 161{
163 ;
164} 162}
165 163
166static inline int sysfs_create_bin_file(struct kobject *kobj, 164static inline int sysfs_create_bin_file(struct kobject *kobj,
@@ -169,10 +167,9 @@ static inline int sysfs_create_bin_file(struct kobject *kobj,
169 return 0; 167 return 0;
170} 168}
171 169
172static inline int sysfs_remove_bin_file(struct kobject *kobj, 170static inline void sysfs_remove_bin_file(struct kobject *kobj,
173 struct bin_attribute *attr) 171 struct bin_attribute *attr)
174{ 172{
175 return 0;
176} 173}
177 174
178static inline int sysfs_create_link(struct kobject *kobj, 175static inline int sysfs_create_link(struct kobject *kobj,
@@ -183,7 +180,6 @@ static inline int sysfs_create_link(struct kobject *kobj,
183 180
184static inline void sysfs_remove_link(struct kobject *kobj, const char *name) 181static inline void sysfs_remove_link(struct kobject *kobj, const char *name)
185{ 182{
186 ;
187} 183}
188 184
189static inline int sysfs_create_group(struct kobject *kobj, 185static inline int sysfs_create_group(struct kobject *kobj,
@@ -195,7 +191,6 @@ static inline int sysfs_create_group(struct kobject *kobj,
195static inline void sysfs_remove_group(struct kobject *kobj, 191static inline void sysfs_remove_group(struct kobject *kobj,
196 const struct attribute_group *grp) 192 const struct attribute_group *grp)
197{ 193{
198 ;
199} 194}
200 195
201static inline int sysfs_add_file_to_group(struct kobject *kobj, 196static inline int sysfs_add_file_to_group(struct kobject *kobj,
diff --git a/include/linux/transport_class.h b/include/linux/transport_class.h
index 6696cf79c4f7..eaec1ea9558e 100644
--- a/include/linux/transport_class.h
+++ b/include/linux/transport_class.h
@@ -17,11 +17,11 @@ struct transport_container;
17struct transport_class { 17struct transport_class {
18 struct class class; 18 struct class class;
19 int (*setup)(struct transport_container *, struct device *, 19 int (*setup)(struct transport_container *, struct device *,
20 struct class_device *); 20 struct device *);
21 int (*configure)(struct transport_container *, struct device *, 21 int (*configure)(struct transport_container *, struct device *,
22 struct class_device *); 22 struct device *);
23 int (*remove)(struct transport_container *, struct device *, 23 int (*remove)(struct transport_container *, struct device *,
24 struct class_device *); 24 struct device *);
25}; 25};
26 26
27#define DECLARE_TRANSPORT_CLASS(cls, nm, su, rm, cfg) \ 27#define DECLARE_TRANSPORT_CLASS(cls, nm, su, rm, cfg) \
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 95bf4bac44cb..2dcbecce3f61 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1051,7 +1051,7 @@ struct ib_device {
1051 struct ib_dma_mapping_ops *dma_ops; 1051 struct ib_dma_mapping_ops *dma_ops;
1052 1052
1053 struct module *owner; 1053 struct module *owner;
1054 struct class_device class_dev; 1054 struct device dev;
1055 struct kobject *ports_parent; 1055 struct kobject *ports_parent;
1056 struct list_head port_list; 1056 struct list_head port_list;
1057 1057
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index ab7acbe80960..b8b19e2f57bb 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -156,8 +156,8 @@ struct scsi_device {
156 156
157 int timeout; 157 int timeout;
158 158
159 struct device sdev_gendev; 159 struct device sdev_gendev,
160 struct class_device sdev_classdev; 160 sdev_dev;
161 161
162 struct execute_work ew; /* used to get process context on put */ 162 struct execute_work ew; /* used to get process context on put */
163 163
@@ -167,9 +167,9 @@ struct scsi_device {
167#define to_scsi_device(d) \ 167#define to_scsi_device(d) \
168 container_of(d, struct scsi_device, sdev_gendev) 168 container_of(d, struct scsi_device, sdev_gendev)
169#define class_to_sdev(d) \ 169#define class_to_sdev(d) \
170 container_of(d, struct scsi_device, sdev_classdev) 170 container_of(d, struct scsi_device, sdev_dev)
171#define transport_class_to_sdev(class_dev) \ 171#define transport_class_to_sdev(class_dev) \
172 to_scsi_device(class_dev->dev) 172 to_scsi_device(class_dev->parent)
173 173
174#define sdev_printk(prefix, sdev, fmt, a...) \ 174#define sdev_printk(prefix, sdev, fmt, a...) \
175 dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a) 175 dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a)
@@ -220,7 +220,7 @@ static inline struct scsi_target *scsi_target(struct scsi_device *sdev)
220 return to_scsi_target(sdev->sdev_gendev.parent); 220 return to_scsi_target(sdev->sdev_gendev.parent);
221} 221}
222#define transport_class_to_starget(class_dev) \ 222#define transport_class_to_starget(class_dev) \
223 to_scsi_target(class_dev->dev) 223 to_scsi_target(class_dev->parent)
224 224
225#define starget_printk(prefix, starget, fmt, a...) \ 225#define starget_printk(prefix, starget, fmt, a...) \
226 dev_printk(prefix, &(starget)->dev, fmt, ##a) 226 dev_printk(prefix, &(starget)->dev, fmt, ##a)
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 49132862bfaa..d967d6dc7a28 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -470,7 +470,7 @@ struct scsi_host_template {
470 /* 470 /*
471 * Pointer to the sysfs class properties for this host, NULL terminated. 471 * Pointer to the sysfs class properties for this host, NULL terminated.
472 */ 472 */
473 struct class_device_attribute **shost_attrs; 473 struct device_attribute **shost_attrs;
474 474
475 /* 475 /*
476 * Pointer to the SCSI device properties for this host, NULL terminated. 476 * Pointer to the SCSI device properties for this host, NULL terminated.
@@ -655,8 +655,7 @@ struct Scsi_Host {
655 enum scsi_host_state shost_state; 655 enum scsi_host_state shost_state;
656 656
657 /* ldm bits */ 657 /* ldm bits */
658 struct device shost_gendev; 658 struct device shost_gendev, shost_dev;
659 struct class_device shost_classdev;
660 659
661 /* 660 /*
662 * List of hosts per template. 661 * List of hosts per template.
@@ -683,7 +682,7 @@ struct Scsi_Host {
683}; 682};
684 683
685#define class_to_shost(d) \ 684#define class_to_shost(d) \
686 container_of(d, struct Scsi_Host, shost_classdev) 685 container_of(d, struct Scsi_Host, shost_dev)
687 686
688#define shost_printk(prefix, shost, fmt, a...) \ 687#define shost_printk(prefix, shost, fmt, a...) \
689 dev_printk(prefix, &(shost)->shost_gendev, fmt, ##a) 688 dev_printk(prefix, &(shost)->shost_gendev, fmt, ##a)
diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h
index 0dfef752f0e2..490bd13a634c 100644
--- a/include/scsi/scsi_transport.h
+++ b/include/scsi/scsi_transport.h
@@ -80,7 +80,7 @@ struct scsi_transport_template {
80}; 80};
81 81
82#define transport_class_to_shost(tc) \ 82#define transport_class_to_shost(tc) \
83 dev_to_shost((tc)->dev) 83 dev_to_shost((tc)->parent)
84 84
85 85
86/* Private area maintenance. The driver requested allocations come 86/* Private area maintenance. The driver requested allocations come
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 4769efd4db24..06f72bab9df0 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -163,8 +163,8 @@ enum fc_tgtid_binding_type {
163 163
164 164
165/* Macro for use in defining Virtual Port attributes */ 165/* Macro for use in defining Virtual Port attributes */
166#define FC_VPORT_ATTR(_name,_mode,_show,_store) \ 166#define FC_VPORT_ATTR(_name,_mode,_show,_store) \
167struct class_device_attribute class_device_attr_vport_##_name = \ 167struct device_attribute dev_attr_vport_##_name = \
168 __ATTR(_name,_mode,_show,_store) 168 __ATTR(_name,_mode,_show,_store)
169 169
170 170
@@ -234,8 +234,8 @@ struct fc_vport {
234 234
235#define dev_to_vport(d) \ 235#define dev_to_vport(d) \
236 container_of(d, struct fc_vport, dev) 236 container_of(d, struct fc_vport, dev)
237#define transport_class_to_vport(classdev) \ 237#define transport_class_to_vport(dev) \
238 dev_to_vport(classdev->dev) 238 dev_to_vport(dev->parent)
239#define vport_to_shost(v) \ 239#define vport_to_shost(v) \
240 (v->shost) 240 (v->shost)
241#define vport_to_shost_channel(v) \ 241#define vport_to_shost_channel(v) \
@@ -271,7 +271,7 @@ struct fc_rport_identifiers {
271 271
272/* Macro for use in defining Remote Port attributes */ 272/* Macro for use in defining Remote Port attributes */
273#define FC_RPORT_ATTR(_name,_mode,_show,_store) \ 273#define FC_RPORT_ATTR(_name,_mode,_show,_store) \
274struct class_device_attribute class_device_attr_rport_##_name = \ 274struct device_attribute dev_attr_rport_##_name = \
275 __ATTR(_name,_mode,_show,_store) 275 __ATTR(_name,_mode,_show,_store)
276 276
277 277
@@ -341,8 +341,8 @@ struct fc_rport { /* aka fc_starget_attrs */
341 341
342#define dev_to_rport(d) \ 342#define dev_to_rport(d) \
343 container_of(d, struct fc_rport, dev) 343 container_of(d, struct fc_rport, dev)
344#define transport_class_to_rport(classdev) \ 344#define transport_class_to_rport(dev) \
345 dev_to_rport(classdev->dev) 345 dev_to_rport(dev->parent)
346#define rport_to_shost(r) \ 346#define rport_to_shost(r) \
347 dev_to_shost(r->dev.parent) 347 dev_to_shost(r->dev.parent)
348 348
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
index 09125fa95b93..61ad3594aad6 100644
--- a/include/scsi/scsi_transport_sas.h
+++ b/include/scsi/scsi_transport_sas.h
@@ -80,8 +80,8 @@ struct sas_phy {
80 80
81#define dev_to_phy(d) \ 81#define dev_to_phy(d) \
82 container_of((d), struct sas_phy, dev) 82 container_of((d), struct sas_phy, dev)
83#define transport_class_to_phy(cdev) \ 83#define transport_class_to_phy(dev) \
84 dev_to_phy((cdev)->dev) 84 dev_to_phy((dev)->parent)
85#define phy_to_shost(phy) \ 85#define phy_to_shost(phy) \
86 dev_to_shost((phy)->dev.parent) 86 dev_to_shost((phy)->dev.parent)
87 87
@@ -96,8 +96,8 @@ struct sas_rphy {
96 96
97#define dev_to_rphy(d) \ 97#define dev_to_rphy(d) \
98 container_of((d), struct sas_rphy, dev) 98 container_of((d), struct sas_rphy, dev)
99#define transport_class_to_rphy(cdev) \ 99#define transport_class_to_rphy(dev) \
100 dev_to_rphy((cdev)->dev) 100 dev_to_rphy((dev)->parent)
101#define rphy_to_shost(rphy) \ 101#define rphy_to_shost(rphy) \
102 dev_to_shost((rphy)->dev.parent) 102 dev_to_shost((rphy)->dev.parent)
103#define target_to_rphy(targ) \ 103#define target_to_rphy(targ) \
@@ -152,8 +152,8 @@ struct sas_port {
152 152
153#define dev_to_sas_port(d) \ 153#define dev_to_sas_port(d) \
154 container_of((d), struct sas_port, dev) 154 container_of((d), struct sas_port, dev)
155#define transport_class_to_sas_port(cdev) \ 155#define transport_class_to_sas_port(dev) \
156 dev_to_sas_port((cdev)->dev) 156 dev_to_sas_port((dev)->parent)
157 157
158struct sas_phy_linkrates { 158struct sas_phy_linkrates {
159 enum sas_linkrate maximum_linkrate; 159 enum sas_linkrate maximum_linkrate;
diff --git a/include/scsi/sd.h b/include/scsi/sd.h
index 8ea9f7358ac1..4f032d48cb6e 100644
--- a/include/scsi/sd.h
+++ b/include/scsi/sd.h
@@ -34,7 +34,7 @@
34struct scsi_disk { 34struct scsi_disk {
35 struct scsi_driver *driver; /* always &sd_template */ 35 struct scsi_driver *driver; /* always &sd_template */
36 struct scsi_device *device; 36 struct scsi_device *device;
37 struct class_device cdev; 37 struct device dev;
38 struct gendisk *disk; 38 struct gendisk *disk;
39 unsigned int openers; /* protected by BKL for now, yuck */ 39 unsigned int openers; /* protected by BKL for now, yuck */
40 sector_t capacity; /* size in 512-byte sectors */ 40 sector_t capacity; /* size in 512-byte sectors */
@@ -46,7 +46,7 @@ struct scsi_disk {
46 unsigned RCD : 1; /* state of disk RCD bit, unused */ 46 unsigned RCD : 1; /* state of disk RCD bit, unused */
47 unsigned DPOFUA : 1; /* state of disk DPOFUA bit */ 47 unsigned DPOFUA : 1; /* state of disk DPOFUA bit */
48}; 48};
49#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,cdev) 49#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev)
50 50
51#define sd_printk(prefix, sdsk, fmt, a...) \ 51#define sd_printk(prefix, sdsk, fmt, a...) \
52 (sdsk)->disk ? \ 52 (sdsk)->disk ? \