Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 27776
b: refs/heads/master
c: 52239da
h: refs/heads/master
v: v3
  • Loading branch information
David Woodhouse committed May 14, 2006
1 parent c068fc7 commit b028de2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0d4e30d26a279f1b6a008a233a6835ad2af571e4
refs/heads/master: 52239da1b06ff445bf71d35e04d8ce74e4c6fe7b
17 changes: 11 additions & 6 deletions trunk/drivers/mtd/nand/nand_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2312,6 +2312,15 @@ static void nand_resume(struct mtd_info *mtd)

}

/* module_text_address() isn't exported, and it's mostly a pointless
test if this is a module _anyway_ -- they'd have to try _really_ hard
to call us from in-kernel code if the core NAND support is modular. */
#ifdef MODULE
#define caller_is_module() (1)
#else
#define caller_is_module() module_text_address((unsigned long)__builtin_return_address(0))
#endif

/**
* nand_scan - [NAND Interface] Scan for the NAND device
* @mtd: MTD device structure
Expand All @@ -2330,12 +2339,8 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
int i, nand_maf_id, nand_dev_id, busw, maf_id;
struct nand_chip *this = mtd->priv;

/* module_text_address() isn't exported. But if _this_ is a module,
it's a fairly safe bet that its caller is a module too... and
that means the call to module_text_address() gets optimised out
without having to resort to ifdefs */
if (!mtd->owner && (THIS_MODULE ||
module_text_address((unsigned long)__builtin_return_address(0)))) {
/* Many callers got this wrong, so check for it for a while... */
if (!mtd->owner && caller_is_module()) {
printk(KERN_CRIT "nand_scan() called with NULL mtd->owner!\n");
BUG();
}
Expand Down

0 comments on commit b028de2

Please sign in to comment.