diff options
author | Paul Mackerras <paulus@samba.org> | 2009-04-21 23:02:09 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2009-04-21 23:02:09 -0400 |
commit | 5bd3ef84d73c2ea7b4babbad060909753c4828d4 (patch) | |
tree | fdf2bafb48ae1ed03175f6c77a7548a181e69ee9 /include/linux/mtd/mtd.h | |
parent | 0658c16056660886ea2f35c4f038be70a94b1532 (diff) | |
parent | 6d25b688ecc488753af3c9e6f6a9a575b863cf37 (diff) |
Merge branch 'merge' of git://git.secretlab.ca/git/linux-2.6 into merge
Diffstat (limited to 'include/linux/mtd/mtd.h')
-rw-r--r-- | include/linux/mtd/mtd.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 3aa5d77c2cdb..5675b63a0631 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/uio.h> | 12 | #include <linux/uio.h> |
13 | #include <linux/notifier.h> | 13 | #include <linux/notifier.h> |
14 | #include <linux/device.h> | ||
14 | 15 | ||
15 | #include <linux/mtd/compatmac.h> | 16 | #include <linux/mtd/compatmac.h> |
16 | #include <mtd/mtd-abi.h> | 17 | #include <mtd/mtd-abi.h> |
@@ -162,6 +163,20 @@ struct mtd_info { | |||
162 | /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ | 163 | /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ |
163 | void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); | 164 | void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); |
164 | 165 | ||
166 | /* Allow NOMMU mmap() to directly map the device (if not NULL) | ||
167 | * - return the address to which the offset maps | ||
168 | * - return -ENOSYS to indicate refusal to do the mapping | ||
169 | */ | ||
170 | unsigned long (*get_unmapped_area) (struct mtd_info *mtd, | ||
171 | unsigned long len, | ||
172 | unsigned long offset, | ||
173 | unsigned long flags); | ||
174 | |||
175 | /* Backing device capabilities for this device | ||
176 | * - provides mmap capabilities | ||
177 | */ | ||
178 | struct backing_dev_info *backing_dev_info; | ||
179 | |||
165 | 180 | ||
166 | int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 181 | int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); |
167 | int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); | 182 | int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); |
@@ -223,6 +238,7 @@ struct mtd_info { | |||
223 | void *priv; | 238 | void *priv; |
224 | 239 | ||
225 | struct module *owner; | 240 | struct module *owner; |
241 | struct device dev; | ||
226 | int usecount; | 242 | int usecount; |
227 | 243 | ||
228 | /* If the driver is something smart, like UBI, it may need to maintain | 244 | /* If the driver is something smart, like UBI, it may need to maintain |
@@ -233,6 +249,11 @@ struct mtd_info { | |||
233 | void (*put_device) (struct mtd_info *mtd); | 249 | void (*put_device) (struct mtd_info *mtd); |
234 | }; | 250 | }; |
235 | 251 | ||
252 | static inline struct mtd_info *dev_to_mtd(struct device *dev) | ||
253 | { | ||
254 | return dev ? container_of(dev, struct mtd_info, dev) : NULL; | ||
255 | } | ||
256 | |||
236 | static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) | 257 | static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) |
237 | { | 258 | { |
238 | if (mtd->erasesize_shift) | 259 | if (mtd->erasesize_shift) |