Skip to content

Commit fea728c

Browse files
ezequielgarciajanaszewski
authored andcommitted
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: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
1 parent 4c7e054 commit fea728c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎drivers/mtd/mtdcore.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <linux/slab.h>
4141
#include <linux/reboot.h>
4242
#include <linux/kconfig.h>
43+
#include <linux/leds.h>
4344

4445
#include <linux/mtd/mtd.h>
4546
#include <linux/mtd/partitions.h>
@@ -862,6 +863,7 @@ int mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
862863
mtd_erase_callback(instr);
863864
return 0;
864865
}
866+
ledtrig_mtd_activity();
865867
return mtd->_erase(mtd, instr);
866868
}
867869
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,
925927
if (!len)
926928
return 0;
927929

930+
ledtrig_mtd_activity();
928931
/*
929932
* In the absence of an error, drivers return a non-negative integer
930933
* 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,
949952
return -EROFS;
950953
if (!len)
951954
return 0;
955+
ledtrig_mtd_activity();
952956
return mtd->_write(mtd, to, len, retlen, buf);
953957
}
954958
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)
982986
ops->retlen = ops->oobretlen = 0;
983987
if (!mtd->_read_oob)
984988
return -EOPNOTSUPP;
989+
990+
ledtrig_mtd_activity();
985991
/*
986992
* In cases where ops->datbuf != NULL, mtd->_read_oob() has semantics
987993
* similar to mtd->_read(), returning a non-negative integer
@@ -1005,6 +1011,7 @@ int mtd_write_oob(struct mtd_info *mtd, loff_t to,
10051011
return -EOPNOTSUPP;
10061012
if (!(mtd->flags & MTD_WRITEABLE))
10071013
return -EROFS;
1014+
ledtrig_mtd_activity();
10081015
return mtd->_write_oob(mtd, to, ops);
10091016
}
10101017
EXPORT_SYMBOL_GPL(mtd_write_oob);

0 commit comments

Comments
 (0)