18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#include <linux/mtd/mtd.h> 38c2ecf20Sopenharmony_ci#include <linux/sched/signal.h> 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_cistatic inline int mtdtest_relax(void) 68c2ecf20Sopenharmony_ci{ 78c2ecf20Sopenharmony_ci cond_resched(); 88c2ecf20Sopenharmony_ci if (signal_pending(current)) { 98c2ecf20Sopenharmony_ci pr_info("aborting test due to pending signal!\n"); 108c2ecf20Sopenharmony_ci return -EINTR; 118c2ecf20Sopenharmony_ci } 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci return 0; 148c2ecf20Sopenharmony_ci} 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ciint mtdtest_erase_eraseblock(struct mtd_info *mtd, unsigned int ebnum); 178c2ecf20Sopenharmony_ciint mtdtest_scan_for_bad_eraseblocks(struct mtd_info *mtd, unsigned char *bbt, 188c2ecf20Sopenharmony_ci unsigned int eb, int ebcnt); 198c2ecf20Sopenharmony_ciint mtdtest_erase_good_eraseblocks(struct mtd_info *mtd, unsigned char *bbt, 208c2ecf20Sopenharmony_ci unsigned int eb, int ebcnt); 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciint mtdtest_read(struct mtd_info *mtd, loff_t addr, size_t size, void *buf); 238c2ecf20Sopenharmony_ciint mtdtest_write(struct mtd_info *mtd, loff_t addr, size_t size, 248c2ecf20Sopenharmony_ci const void *buf); 25