diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-01-30 07:58:32 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-03-26 19:20:01 -0400 |
commit | 3c3c10bba1e4ccb75b41442e45c1a072f6cded19 (patch) | |
tree | 5c929e46cd0b6fcf8a42db7637cf45dbf69fe126 /include/linux/mtd/mtd.h | |
parent | a6c22850d20273896e7c8ee996730ccf2ba60a22 (diff) |
mtd: add leading underscore to all mtd functions
This patch renames all MTD functions by adding a "_" prefix:
mtd->erase -> mtd->_erase
mtd->read_oob -> mtd->_read_oob
...
The reason is that we are re-working the MTD API and from now on it is
an error to use MTD function pointers directly - we have a corresponding
API call for every pointer. By adding a leading "_" we achieve the following:
1. Make sure we convert every direct pointer users
2. A leading "_" suggests that this interface is internal and it becomes
less likely that people will use them directly
3. Make sure all the out-of-tree modules stop compiling and the owners
spot the big API change and amend them.
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'include/linux/mtd/mtd.h')
-rw-r--r-- | include/linux/mtd/mtd.h | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index d43dc25af82e..e2e545616b2a 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -174,52 +174,52 @@ struct mtd_info { | |||
174 | * Do not call via these pointers, use corresponding mtd_*() | 174 | * Do not call via these pointers, use corresponding mtd_*() |
175 | * wrappers instead. | 175 | * wrappers instead. |
176 | */ | 176 | */ |
177 | int (*erase) (struct mtd_info *mtd, struct erase_info *instr); | 177 | int (*_erase) (struct mtd_info *mtd, struct erase_info *instr); |
178 | int (*point) (struct mtd_info *mtd, loff_t from, size_t len, | 178 | int (*_point) (struct mtd_info *mtd, loff_t from, size_t len, |
179 | size_t *retlen, void **virt, resource_size_t *phys); | 179 | size_t *retlen, void **virt, resource_size_t *phys); |
180 | void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); | 180 | void (*_unpoint) (struct mtd_info *mtd, loff_t from, size_t len); |
181 | unsigned long (*get_unmapped_area) (struct mtd_info *mtd, | 181 | unsigned long (*_get_unmapped_area) (struct mtd_info *mtd, |
182 | unsigned long len, | 182 | unsigned long len, |
183 | unsigned long offset, | 183 | unsigned long offset, |
184 | unsigned long flags); | 184 | unsigned long flags); |
185 | int (*read) (struct mtd_info *mtd, loff_t from, size_t len, | 185 | int (*_read) (struct mtd_info *mtd, loff_t from, size_t len, |
186 | size_t *retlen, u_char *buf); | 186 | size_t *retlen, u_char *buf); |
187 | int (*write) (struct mtd_info *mtd, loff_t to, size_t len, | 187 | int (*_write) (struct mtd_info *mtd, loff_t to, size_t len, |
188 | size_t *retlen, const u_char *buf); | 188 | size_t *retlen, const u_char *buf); |
189 | int (*panic_write) (struct mtd_info *mtd, loff_t to, size_t len, | 189 | int (*_panic_write) (struct mtd_info *mtd, loff_t to, size_t len, |
190 | size_t *retlen, const u_char *buf); | 190 | size_t *retlen, const u_char *buf); |
191 | int (*read_oob) (struct mtd_info *mtd, loff_t from, | 191 | int (*_read_oob) (struct mtd_info *mtd, loff_t from, |
192 | struct mtd_oob_ops *ops); | ||
193 | int (*write_oob) (struct mtd_info *mtd, loff_t to, | ||
194 | struct mtd_oob_ops *ops); | 192 | struct mtd_oob_ops *ops); |
195 | int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, | 193 | int (*_write_oob) (struct mtd_info *mtd, loff_t to, |
196 | size_t len); | 194 | struct mtd_oob_ops *ops); |
197 | int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, | 195 | int (*_get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, |
198 | size_t len, size_t *retlen, u_char *buf); | 196 | size_t len); |
199 | int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, | 197 | int (*_read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, |
200 | size_t len); | 198 | size_t len, size_t *retlen, u_char *buf); |
201 | int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, | 199 | int (*_get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, |
202 | size_t len, size_t *retlen, u_char *buf); | 200 | size_t len); |
203 | int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t to, size_t len, | 201 | int (*_read_user_prot_reg) (struct mtd_info *mtd, loff_t from, |
204 | size_t *retlen, u_char *buf); | 202 | size_t len, size_t *retlen, u_char *buf); |
205 | int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, | 203 | int (*_write_user_prot_reg) (struct mtd_info *mtd, loff_t to, |
206 | size_t len); | 204 | size_t len, size_t *retlen, u_char *buf); |
207 | int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, | 205 | int (*_lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, |
206 | size_t len); | ||
207 | int (*_writev) (struct mtd_info *mtd, const struct kvec *vecs, | ||
208 | unsigned long count, loff_t to, size_t *retlen); | 208 | unsigned long count, loff_t to, size_t *retlen); |
209 | void (*sync) (struct mtd_info *mtd); | 209 | void (*_sync) (struct mtd_info *mtd); |
210 | int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); | 210 | int (*_lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); |
211 | int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); | 211 | int (*_unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); |
212 | int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len); | 212 | int (*_is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len); |
213 | int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); | 213 | int (*_block_isbad) (struct mtd_info *mtd, loff_t ofs); |
214 | int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); | 214 | int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs); |
215 | int (*suspend) (struct mtd_info *mtd); | 215 | int (*_suspend) (struct mtd_info *mtd); |
216 | void (*resume) (struct mtd_info *mtd); | 216 | void (*_resume) (struct mtd_info *mtd); |
217 | /* | 217 | /* |
218 | * If the driver is something smart, like UBI, it may need to maintain | 218 | * If the driver is something smart, like UBI, it may need to maintain |
219 | * its own reference counting. The below functions are only for driver. | 219 | * its own reference counting. The below functions are only for driver. |
220 | */ | 220 | */ |
221 | int (*get_device) (struct mtd_info *mtd); | 221 | int (*_get_device) (struct mtd_info *mtd); |
222 | void (*put_device) (struct mtd_info *mtd); | 222 | void (*_put_device) (struct mtd_info *mtd); |
223 | 223 | ||
224 | /* Backing device capabilities for this device | 224 | /* Backing device capabilities for this device |
225 | * - provides mmap capabilities | 225 | * - provides mmap capabilities |
@@ -249,7 +249,7 @@ struct mtd_info { | |||
249 | */ | 249 | */ |
250 | static inline int mtd_erase(struct mtd_info *mtd, struct erase_info *instr) | 250 | static inline int mtd_erase(struct mtd_info *mtd, struct erase_info *instr) |
251 | { | 251 | { |
252 | return mtd->erase(mtd, instr); | 252 | return mtd->_erase(mtd, instr); |
253 | } | 253 | } |
254 | 254 | ||
255 | /* | 255 | /* |
@@ -259,15 +259,15 @@ static inline int mtd_point(struct mtd_info *mtd, loff_t from, size_t len, | |||
259 | size_t *retlen, void **virt, resource_size_t *phys) | 259 | size_t *retlen, void **virt, resource_size_t *phys) |
260 | { | 260 | { |
261 | *retlen = 0; | 261 | *retlen = 0; |
262 | if (!mtd->point) | 262 | if (!mtd->_point) |
263 | return -EOPNOTSUPP; | 263 | return -EOPNOTSUPP; |
264 | return mtd->point(mtd, from, len, retlen, virt, phys); | 264 | return mtd->_point(mtd, from, len, retlen, virt, phys); |
265 | } | 265 | } |
266 | 266 | ||
267 | /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ | 267 | /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ |
268 | static inline void mtd_unpoint(struct mtd_info *mtd, loff_t from, size_t len) | 268 | static inline void mtd_unpoint(struct mtd_info *mtd, loff_t from, size_t len) |
269 | { | 269 | { |
270 | return mtd->unpoint(mtd, from, len); | 270 | return mtd->_unpoint(mtd, from, len); |
271 | } | 271 | } |
272 | 272 | ||
273 | /* | 273 | /* |
@@ -280,24 +280,24 @@ static inline unsigned long mtd_get_unmapped_area(struct mtd_info *mtd, | |||
280 | unsigned long offset, | 280 | unsigned long offset, |
281 | unsigned long flags) | 281 | unsigned long flags) |
282 | { | 282 | { |
283 | if (!mtd->get_unmapped_area) | 283 | if (!mtd->_get_unmapped_area) |
284 | return -EOPNOTSUPP; | 284 | return -EOPNOTSUPP; |
285 | return mtd->get_unmapped_area(mtd, len, offset, flags); | 285 | return mtd->_get_unmapped_area(mtd, len, offset, flags); |
286 | } | 286 | } |
287 | 287 | ||
288 | static inline int mtd_read(struct mtd_info *mtd, loff_t from, size_t len, | 288 | static inline int mtd_read(struct mtd_info *mtd, loff_t from, size_t len, |
289 | size_t *retlen, u_char *buf) | 289 | size_t *retlen, u_char *buf) |
290 | { | 290 | { |
291 | return mtd->read(mtd, from, len, retlen, buf); | 291 | return mtd->_read(mtd, from, len, retlen, buf); |
292 | } | 292 | } |
293 | 293 | ||
294 | static inline int mtd_write(struct mtd_info *mtd, loff_t to, size_t len, | 294 | static inline int mtd_write(struct mtd_info *mtd, loff_t to, size_t len, |
295 | size_t *retlen, const u_char *buf) | 295 | size_t *retlen, const u_char *buf) |
296 | { | 296 | { |
297 | *retlen = 0; | 297 | *retlen = 0; |
298 | if (!mtd->write) | 298 | if (!mtd->_write) |
299 | return -EROFS; | 299 | return -EROFS; |
300 | return mtd->write(mtd, to, len, retlen, buf); | 300 | return mtd->_write(mtd, to, len, retlen, buf); |
301 | } | 301 | } |
302 | 302 | ||
303 | /* | 303 | /* |
@@ -311,27 +311,27 @@ static inline int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
311 | size_t *retlen, const u_char *buf) | 311 | size_t *retlen, const u_char *buf) |
312 | { | 312 | { |
313 | *retlen = 0; | 313 | *retlen = 0; |
314 | if (!mtd->panic_write) | 314 | if (!mtd->_panic_write) |
315 | return -EOPNOTSUPP; | 315 | return -EOPNOTSUPP; |
316 | return mtd->panic_write(mtd, to, len, retlen, buf); | 316 | return mtd->_panic_write(mtd, to, len, retlen, buf); |
317 | } | 317 | } |
318 | 318 | ||
319 | static inline int mtd_read_oob(struct mtd_info *mtd, loff_t from, | 319 | static inline int mtd_read_oob(struct mtd_info *mtd, loff_t from, |
320 | struct mtd_oob_ops *ops) | 320 | struct mtd_oob_ops *ops) |
321 | { | 321 | { |
322 | ops->retlen = ops->oobretlen = 0; | 322 | ops->retlen = ops->oobretlen = 0; |
323 | if (!mtd->read_oob) | 323 | if (!mtd->_read_oob) |
324 | return -EOPNOTSUPP; | 324 | return -EOPNOTSUPP; |
325 | return mtd->read_oob(mtd, from, ops); | 325 | return mtd->_read_oob(mtd, from, ops); |
326 | } | 326 | } |
327 | 327 | ||
328 | static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to, | 328 | static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to, |
329 | struct mtd_oob_ops *ops) | 329 | struct mtd_oob_ops *ops) |
330 | { | 330 | { |
331 | ops->retlen = ops->oobretlen = 0; | 331 | ops->retlen = ops->oobretlen = 0; |
332 | if (!mtd->write_oob) | 332 | if (!mtd->_write_oob) |
333 | return -EOPNOTSUPP; | 333 | return -EOPNOTSUPP; |
334 | return mtd->write_oob(mtd, to, ops); | 334 | return mtd->_write_oob(mtd, to, ops); |
335 | } | 335 | } |
336 | 336 | ||
337 | /* | 337 | /* |
@@ -342,9 +342,9 @@ static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to, | |||
342 | static inline int mtd_get_fact_prot_info(struct mtd_info *mtd, | 342 | static inline int mtd_get_fact_prot_info(struct mtd_info *mtd, |
343 | struct otp_info *buf, size_t len) | 343 | struct otp_info *buf, size_t len) |
344 | { | 344 | { |
345 | if (!mtd->get_fact_prot_info) | 345 | if (!mtd->_get_fact_prot_info) |
346 | return -EOPNOTSUPP; | 346 | return -EOPNOTSUPP; |
347 | return mtd->get_fact_prot_info(mtd, buf, len); | 347 | return mtd->_get_fact_prot_info(mtd, buf, len); |
348 | } | 348 | } |
349 | 349 | ||
350 | static inline int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, | 350 | static inline int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, |
@@ -352,18 +352,18 @@ static inline int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, | |||
352 | u_char *buf) | 352 | u_char *buf) |
353 | { | 353 | { |
354 | *retlen = 0; | 354 | *retlen = 0; |
355 | if (!mtd->read_fact_prot_reg) | 355 | if (!mtd->_read_fact_prot_reg) |
356 | return -EOPNOTSUPP; | 356 | return -EOPNOTSUPP; |
357 | return mtd->read_fact_prot_reg(mtd, from, len, retlen, buf); | 357 | return mtd->_read_fact_prot_reg(mtd, from, len, retlen, buf); |
358 | } | 358 | } |
359 | 359 | ||
360 | static inline int mtd_get_user_prot_info(struct mtd_info *mtd, | 360 | static inline int mtd_get_user_prot_info(struct mtd_info *mtd, |
361 | struct otp_info *buf, | 361 | struct otp_info *buf, |
362 | size_t len) | 362 | size_t len) |
363 | { | 363 | { |
364 | if (!mtd->get_user_prot_info) | 364 | if (!mtd->_get_user_prot_info) |
365 | return -EOPNOTSUPP; | 365 | return -EOPNOTSUPP; |
366 | return mtd->get_user_prot_info(mtd, buf, len); | 366 | return mtd->_get_user_prot_info(mtd, buf, len); |
367 | } | 367 | } |
368 | 368 | ||
369 | static inline int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from, | 369 | static inline int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from, |
@@ -371,9 +371,9 @@ static inline int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from, | |||
371 | u_char *buf) | 371 | u_char *buf) |
372 | { | 372 | { |
373 | *retlen = 0; | 373 | *retlen = 0; |
374 | if (!mtd->read_user_prot_reg) | 374 | if (!mtd->_read_user_prot_reg) |
375 | return -EOPNOTSUPP; | 375 | return -EOPNOTSUPP; |
376 | return mtd->read_user_prot_reg(mtd, from, len, retlen, buf); | 376 | return mtd->_read_user_prot_reg(mtd, from, len, retlen, buf); |
377 | } | 377 | } |
378 | 378 | ||
379 | static inline int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, | 379 | static inline int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, |
@@ -381,17 +381,17 @@ static inline int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, | |||
381 | u_char *buf) | 381 | u_char *buf) |
382 | { | 382 | { |
383 | *retlen = 0; | 383 | *retlen = 0; |
384 | if (!mtd->write_user_prot_reg) | 384 | if (!mtd->_write_user_prot_reg) |
385 | return -EOPNOTSUPP; | 385 | return -EOPNOTSUPP; |
386 | return mtd->write_user_prot_reg(mtd, to, len, retlen, buf); | 386 | return mtd->_write_user_prot_reg(mtd, to, len, retlen, buf); |
387 | } | 387 | } |
388 | 388 | ||
389 | static inline int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from, | 389 | static inline int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from, |
390 | size_t len) | 390 | size_t len) |
391 | { | 391 | { |
392 | if (!mtd->lock_user_prot_reg) | 392 | if (!mtd->_lock_user_prot_reg) |
393 | return -EOPNOTSUPP; | 393 | return -EOPNOTSUPP; |
394 | return mtd->lock_user_prot_reg(mtd, from, len); | 394 | return mtd->_lock_user_prot_reg(mtd, from, len); |
395 | } | 395 | } |
396 | 396 | ||
397 | int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, | 397 | int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, |
@@ -399,55 +399,55 @@ int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, | |||
399 | 399 | ||
400 | static inline void mtd_sync(struct mtd_info *mtd) | 400 | static inline void mtd_sync(struct mtd_info *mtd) |
401 | { | 401 | { |
402 | if (mtd->sync) | 402 | if (mtd->_sync) |
403 | mtd->sync(mtd); | 403 | mtd->_sync(mtd); |
404 | } | 404 | } |
405 | 405 | ||
406 | /* Chip-supported device locking */ | 406 | /* Chip-supported device locking */ |
407 | static inline int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | 407 | static inline int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) |
408 | { | 408 | { |
409 | if (!mtd->lock) | 409 | if (!mtd->_lock) |
410 | return -EOPNOTSUPP; | 410 | return -EOPNOTSUPP; |
411 | return mtd->lock(mtd, ofs, len); | 411 | return mtd->_lock(mtd, ofs, len); |
412 | } | 412 | } |
413 | 413 | ||
414 | static inline int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | 414 | static inline int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) |
415 | { | 415 | { |
416 | if (!mtd->unlock) | 416 | if (!mtd->_unlock) |
417 | return -EOPNOTSUPP; | 417 | return -EOPNOTSUPP; |
418 | return mtd->unlock(mtd, ofs, len); | 418 | return mtd->_unlock(mtd, ofs, len); |
419 | } | 419 | } |
420 | 420 | ||
421 | static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) | 421 | static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) |
422 | { | 422 | { |
423 | if (!mtd->is_locked) | 423 | if (!mtd->_is_locked) |
424 | return -EOPNOTSUPP; | 424 | return -EOPNOTSUPP; |
425 | return mtd->is_locked(mtd, ofs, len); | 425 | return mtd->_is_locked(mtd, ofs, len); |
426 | } | 426 | } |
427 | 427 | ||
428 | static inline int mtd_suspend(struct mtd_info *mtd) | 428 | static inline int mtd_suspend(struct mtd_info *mtd) |
429 | { | 429 | { |
430 | return mtd->suspend ? mtd->suspend(mtd) : 0; | 430 | return mtd->_suspend ? mtd->_suspend(mtd) : 0; |
431 | } | 431 | } |
432 | 432 | ||
433 | static inline void mtd_resume(struct mtd_info *mtd) | 433 | static inline void mtd_resume(struct mtd_info *mtd) |
434 | { | 434 | { |
435 | if (mtd->resume) | 435 | if (mtd->_resume) |
436 | mtd->resume(mtd); | 436 | mtd->_resume(mtd); |
437 | } | 437 | } |
438 | 438 | ||
439 | static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs) | 439 | static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs) |
440 | { | 440 | { |
441 | if (!mtd->block_isbad) | 441 | if (!mtd->_block_isbad) |
442 | return 0; | 442 | return 0; |
443 | return mtd->block_isbad(mtd, ofs); | 443 | return mtd->_block_isbad(mtd, ofs); |
444 | } | 444 | } |
445 | 445 | ||
446 | static inline int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs) | 446 | static inline int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs) |
447 | { | 447 | { |
448 | if (!mtd->block_markbad) | 448 | if (!mtd->_block_markbad) |
449 | return -EOPNOTSUPP; | 449 | return -EOPNOTSUPP; |
450 | return mtd->block_markbad(mtd, ofs); | 450 | return mtd->_block_markbad(mtd, ofs); |
451 | } | 451 | } |
452 | 452 | ||
453 | static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) | 453 | static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) |
@@ -482,12 +482,12 @@ static inline uint32_t mtd_mod_by_ws(uint64_t sz, struct mtd_info *mtd) | |||
482 | 482 | ||
483 | static inline int mtd_has_oob(const struct mtd_info *mtd) | 483 | static inline int mtd_has_oob(const struct mtd_info *mtd) |
484 | { | 484 | { |
485 | return mtd->read_oob && mtd->write_oob; | 485 | return mtd->_read_oob && mtd->_write_oob; |
486 | } | 486 | } |
487 | 487 | ||
488 | static inline int mtd_can_have_bb(const struct mtd_info *mtd) | 488 | static inline int mtd_can_have_bb(const struct mtd_info *mtd) |
489 | { | 489 | { |
490 | return !!mtd->block_isbad; | 490 | return !!mtd->_block_isbad; |
491 | } | 491 | } |
492 | 492 | ||
493 | /* Kernel-side ioctl definitions */ | 493 | /* Kernel-side ioctl definitions */ |