aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdcore.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/mtdcore.c')
-rw-r--r--drivers/mtd/mtdcore.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index f7e7890e5bc..a9d24694982 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: mtdcore.c,v 1.47 2005/11/07 11:14:20 gleixner Exp $
3 *
4 * Core registration and callback routines for MTD 2 * Core registration and callback routines for MTD
5 * drivers and users. 3 * drivers and users.
6 * 4 *
@@ -53,7 +51,7 @@ int add_mtd_device(struct mtd_info *mtd)
53 51
54 for (i=0; i < MAX_MTD_DEVICES; i++) 52 for (i=0; i < MAX_MTD_DEVICES; i++)
55 if (!mtd_table[i]) { 53 if (!mtd_table[i]) {
56 struct list_head *this; 54 struct mtd_notifier *not;
57 55
58 mtd_table[i] = mtd; 56 mtd_table[i] = mtd;
59 mtd->index = i; 57 mtd->index = i;
@@ -72,10 +70,8 @@ int add_mtd_device(struct mtd_info *mtd)
72 DEBUG(0, "mtd: Giving out device %d to %s\n",i, mtd->name); 70 DEBUG(0, "mtd: Giving out device %d to %s\n",i, mtd->name);
73 /* No need to get a refcount on the module containing 71 /* No need to get a refcount on the module containing
74 the notifier, since we hold the mtd_table_mutex */ 72 the notifier, since we hold the mtd_table_mutex */
75 list_for_each(this, &mtd_notifiers) { 73 list_for_each_entry(not, &mtd_notifiers, list)
76 struct mtd_notifier *not = list_entry(this, struct mtd_notifier, list);
77 not->add(mtd); 74 not->add(mtd);
78 }
79 75
80 mutex_unlock(&mtd_table_mutex); 76 mutex_unlock(&mtd_table_mutex);
81 /* We _know_ we aren't being removed, because 77 /* We _know_ we aren't being removed, because
@@ -113,14 +109,12 @@ int del_mtd_device (struct mtd_info *mtd)
113 mtd->index, mtd->name, mtd->usecount); 109 mtd->index, mtd->name, mtd->usecount);
114 ret = -EBUSY; 110 ret = -EBUSY;
115 } else { 111 } else {
116 struct list_head *this; 112 struct mtd_notifier *not;
117 113
118 /* No need to get a refcount on the module containing 114 /* No need to get a refcount on the module containing
119 the notifier, since we hold the mtd_table_mutex */ 115 the notifier, since we hold the mtd_table_mutex */
120 list_for_each(this, &mtd_notifiers) { 116 list_for_each_entry(not, &mtd_notifiers, list)
121 struct mtd_notifier *not = list_entry(this, struct mtd_notifier, list);
122 not->remove(mtd); 117 not->remove(mtd);
123 }
124 118
125 mtd_table[mtd->index] = NULL; 119 mtd_table[mtd->index] = NULL;
126 120