Commit fea728c0 authored by Ezequiel Garcia's avatar Ezequiel Garcia Committed by Jacek Anaszewski

mtd: Hook I/O activity to the MTD LED trigger

Now that we've added the MTD LED trigger, we need
to call each I/O path to ledtrig_mtd_activity.
Signed-off-by: default avatarEzequiel Garcia <ezequiel@vanguardiasur.com.ar>
Acked-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: default avatarJacek Anaszewski <j.anaszewski@samsung.com>
parent 4c7e054f
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/kconfig.h> #include <linux/kconfig.h>
#include <linux/leds.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
...@@ -862,6 +863,7 @@ int mtd_erase(struct mtd_info *mtd, struct erase_info *instr) ...@@ -862,6 +863,7 @@ int mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
mtd_erase_callback(instr); mtd_erase_callback(instr);
return 0; return 0;
} }
ledtrig_mtd_activity();
return mtd->_erase(mtd, instr); return mtd->_erase(mtd, instr);
} }
EXPORT_SYMBOL_GPL(mtd_erase); EXPORT_SYMBOL_GPL(mtd_erase);
...@@ -925,6 +927,7 @@ int mtd_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, ...@@ -925,6 +927,7 @@ int mtd_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen,
if (!len) if (!len)
return 0; return 0;
ledtrig_mtd_activity();
/* /*
* In the absence of an error, drivers return a non-negative integer * In the absence of an error, drivers return a non-negative integer
* representing the maximum number of bitflips that were corrected on * representing the maximum number of bitflips that were corrected on
...@@ -949,6 +952,7 @@ int mtd_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, ...@@ -949,6 +952,7 @@ int mtd_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen,
return -EROFS; return -EROFS;
if (!len) if (!len)
return 0; return 0;
ledtrig_mtd_activity();
return mtd->_write(mtd, to, len, retlen, buf); return mtd->_write(mtd, to, len, retlen, buf);
} }
EXPORT_SYMBOL_GPL(mtd_write); EXPORT_SYMBOL_GPL(mtd_write);
...@@ -982,6 +986,8 @@ int mtd_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops) ...@@ -982,6 +986,8 @@ int mtd_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops)
ops->retlen = ops->oobretlen = 0; ops->retlen = ops->oobretlen = 0;
if (!mtd->_read_oob) if (!mtd->_read_oob)
return -EOPNOTSUPP; return -EOPNOTSUPP;
ledtrig_mtd_activity();
/* /*
* In cases where ops->datbuf != NULL, mtd->_read_oob() has semantics * In cases where ops->datbuf != NULL, mtd->_read_oob() has semantics
* similar to mtd->_read(), returning a non-negative integer * similar to mtd->_read(), returning a non-negative integer
...@@ -1005,6 +1011,7 @@ int mtd_write_oob(struct mtd_info *mtd, loff_t to, ...@@ -1005,6 +1011,7 @@ int mtd_write_oob(struct mtd_info *mtd, loff_t to,
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!(mtd->flags & MTD_WRITEABLE)) if (!(mtd->flags & MTD_WRITEABLE))
return -EROFS; return -EROFS;
ledtrig_mtd_activity();
return mtd->_write_oob(mtd, to, ops); return mtd->_write_oob(mtd, to, ops);
} }
EXPORT_SYMBOL_GPL(mtd_write_oob); EXPORT_SYMBOL_GPL(mtd_write_oob);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment