aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/genhd.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 6fc532424062..e4e18c509ac5 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -15,9 +15,11 @@
15 15
16#ifdef CONFIG_BLOCK 16#ifdef CONFIG_BLOCK
17 17
18#define kobj_to_dev(k) container_of(k, struct device, kobj) 18#define kobj_to_dev(k) container_of((k), struct device, kobj)
19#define dev_to_disk(device) container_of(device, struct gendisk, dev) 19#define dev_to_disk(device) container_of((device), struct gendisk, __dev)
20#define dev_to_part(device) container_of(device, struct hd_struct, dev) 20#define dev_to_part(device) container_of((device), struct hd_struct, __dev)
21#define disk_to_dev(disk) (&((disk)->__dev))
22#define part_to_dev(part) (&((part)->__dev))
21 23
22extern struct device_type part_type; 24extern struct device_type part_type;
23extern struct kobject *block_depr; 25extern struct kobject *block_depr;
@@ -88,7 +90,7 @@ struct disk_stats {
88struct hd_struct { 90struct hd_struct {
89 sector_t start_sect; 91 sector_t start_sect;
90 sector_t nr_sects; 92 sector_t nr_sects;
91 struct device dev; 93 struct device __dev;
92 struct kobject *holder_dir; 94 struct kobject *holder_dir;
93 int policy, partno; 95 int policy, partno;
94#ifdef CONFIG_FAIL_MAKE_REQUEST 96#ifdef CONFIG_FAIL_MAKE_REQUEST
@@ -139,7 +141,7 @@ struct gendisk {
139 141
140 int flags; 142 int flags;
141 struct device *driverfs_dev; // FIXME: remove 143 struct device *driverfs_dev; // FIXME: remove
142 struct device dev; 144 struct device __dev;
143 struct kobject *holder_dir; 145 struct kobject *holder_dir;
144 struct kobject *slave_dir; 146 struct kobject *slave_dir;
145 147
@@ -163,7 +165,7 @@ struct gendisk {
163static inline struct gendisk *part_to_disk(struct hd_struct *part) 165static inline struct gendisk *part_to_disk(struct hd_struct *part)
164{ 166{
165 if (likely(part)) 167 if (likely(part))
166 return dev_to_disk((part)->dev.parent); 168 return dev_to_disk(part_to_dev(part)->parent);
167 return NULL; 169 return NULL;
168} 170}
169 171
@@ -174,12 +176,12 @@ static inline int disk_max_parts(struct gendisk *disk)
174 176
175static inline dev_t disk_devt(struct gendisk *disk) 177static inline dev_t disk_devt(struct gendisk *disk)
176{ 178{
177 return disk->dev.devt; 179 return disk_to_dev(disk)->devt;
178} 180}
179 181
180static inline dev_t part_devt(struct hd_struct *part) 182static inline dev_t part_devt(struct hd_struct *part)
181{ 183{
182 return part->dev.devt; 184 return part_to_dev(part)->devt;
183} 185}
184 186
185extern struct hd_struct *disk_get_part(struct gendisk *disk, int partno); 187extern struct hd_struct *disk_get_part(struct gendisk *disk, int partno);
@@ -187,7 +189,7 @@ extern struct hd_struct *disk_get_part(struct gendisk *disk, int partno);
187static inline void disk_put_part(struct hd_struct *part) 189static inline void disk_put_part(struct hd_struct *part)
188{ 190{
189 if (likely(part)) 191 if (likely(part))
190 put_device(&part->dev); 192 put_device(part_to_dev(part));
191} 193}
192 194
193/* 195/*