@@ -677,7 +677,7 @@ void __put_mtd_device(struct mtd_info *mtd)
BUG_ON(mtd->usecount < 0);
if (mtd->put_device)
- mtd->put_device(mtd);
+ mtd_put_device(mtd);
module_put(mtd->owner);
}
@@ -503,7 +503,7 @@ static void logfs_kill_sb(struct super_block *sb)
logfs_cleanup_rw(sb);
if (super->s_erase_page)
__free_page(super->s_erase_page);
- super->s_devops->put_device(super);
+ mtd_put_device(super);
logfs_mempool_destroy(super->s_btree_pool);
logfs_mempool_destroy(super->s_alias_pool);
kfree(super);
@@ -522,14 +522,14 @@ static struct dentry *logfs_get_sb_device(struct logfs_super *super,
err = -EINVAL;
sb = sget(type, logfs_sb_test, logfs_sb_set, super);
if (IS_ERR(sb)) {
- super->s_devops->put_device(super);
+ mtd_put_device(super);
kfree(super);
return ERR_CAST(sb);
}
if (sb->s_root) {
/* Device is already in use */
- super->s_devops->put_device(super);
+ mtd_put_device(super);
kfree(super);
return dget(sb->s_root);
}
@@ -215,6 +215,7 @@ struct mtd_info {
int (*suspend) (struct mtd_info *mtd);
void (*resume) (struct mtd_info *mtd);
int (*get_device) (struct mtd_info *mtd);
+ void (*put_device) (struct mtd_info *mtd);
/* Backing device capabilities for this device
* - provides mmap capabilities
@@ -233,12 +234,6 @@ struct mtd_info {
struct module *owner;
struct device dev;
int usecount;
-
- /* If the driver is something smart, like UBI, it may need to maintain
- * its own reference counting. The below functions are only for driver.
- * The driver may register its callbacks. These callbacks are not
- * supposed to be called by MTD users */
- void (*put_device) (struct mtd_info *mtd);
};
/*
@@ -414,11 +409,22 @@ static inline int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs)
return mtd->block_markbad(mtd, ofs);
}
+/*
+ * If the driver is something smart, like UBI, it may need to maintain its own
+ * reference counting. The below functions are only for driver. The driver may
+ * register its callbacks. These callbacks are not supposed to be called by MTD
+ * users.
+ */
static inline int mtd_get_device(struct mtd_info *mtd)
{
return mtd->get_device(mtd);
}
+static inline void mtd_put_device(struct mtd_info *mtd)
+{
+ return mtd->put_device(mtd);
+}
+
static inline struct mtd_info *dev_to_mtd(struct device *dev)
{
return dev ? dev_get_drvdata(dev) : NULL;