Lines Matching refs:ubi
22 void ubi_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len) in ubi_dump_flash() argument
27 loff_t addr = (loff_t)pnum * ubi->peb_size + offset; in ubi_dump_flash()
32 err = mtd_read(ubi->mtd, addr, len, &read, buf); in ubi_dump_flash()
34 ubi_err(ubi, "err %d while reading %d bytes from PEB %d:%d, read %zd bytes", in ubi_dump_flash()
39 ubi_msg(ubi, "dumping %d bytes of data from PEB %d, offset %d", in ubi_dump_flash()
253 struct ubi_device *ubi; in dfs_file_read() local
258 ubi = ubi_get_device(ubi_num); in dfs_file_read()
259 if (!ubi) in dfs_file_read()
261 d = &ubi->dbg; in dfs_file_read()
306 ubi_put_device(ubi); in dfs_file_read()
316 struct ubi_device *ubi; in dfs_file_write() local
322 ubi = ubi_get_device(ubi_num); in dfs_file_write()
323 if (!ubi) in dfs_file_write()
325 d = &ubi->dbg; in dfs_file_write()
374 ubi_put_device(ubi); in dfs_file_write()
394 struct ubi_device *ubi = s->private; in eraseblk_count_seq_start() local
396 if (*pos < ubi->peb_count) in eraseblk_count_seq_start()
407 struct ubi_device *ubi = s->private; in eraseblk_count_seq_next() local
411 if (*pos < ubi->peb_count) in eraseblk_count_seq_next()
423 struct ubi_device *ubi = s->private; in eraseblk_count_seq_show() local
433 err = ubi_io_is_bad(ubi, *block_number); in eraseblk_count_seq_show()
437 spin_lock(&ubi->wl_lock); in eraseblk_count_seq_show()
439 wl = ubi->lookuptbl[*block_number]; in eraseblk_count_seq_show()
443 spin_unlock(&ubi->wl_lock); in eraseblk_count_seq_show()
481 struct ubi_device *ubi = s->private; in eraseblk_count_release() local
483 ubi_put_device(ubi); in eraseblk_count_release()
503 int ubi_debugfs_init_dev(struct ubi_device *ubi) in ubi_debugfs_init_dev() argument
505 unsigned long ubi_num = ubi->ubi_num; in ubi_debugfs_init_dev()
506 struct ubi_debug_info *d = &ubi->dbg; in ubi_debugfs_init_dev()
513 ubi->ubi_num); in ubi_debugfs_init_dev()
568 void ubi_debugfs_exit_dev(struct ubi_device *ubi) in ubi_debugfs_exit_dev() argument
571 debugfs_remove_recursive(ubi->dbg.dfs_dir); in ubi_debugfs_exit_dev()
581 int ubi_dbg_power_cut(struct ubi_device *ubi, int caller) in ubi_dbg_power_cut() argument
585 if ((ubi->dbg.emulate_power_cut & caller) == 0) in ubi_dbg_power_cut()
588 if (ubi->dbg.power_cut_counter == 0) { in ubi_dbg_power_cut()
589 ubi->dbg.power_cut_counter = ubi->dbg.power_cut_min; in ubi_dbg_power_cut()
591 if (ubi->dbg.power_cut_max > ubi->dbg.power_cut_min) { in ubi_dbg_power_cut()
592 range = ubi->dbg.power_cut_max - ubi->dbg.power_cut_min; in ubi_dbg_power_cut()
593 ubi->dbg.power_cut_counter += prandom_u32_max(range); in ubi_dbg_power_cut()
598 ubi->dbg.power_cut_counter--; in ubi_dbg_power_cut()
599 if (ubi->dbg.power_cut_counter) in ubi_dbg_power_cut()
602 ubi_msg(ubi, "XXXXXXXXXXXXXXX emulating a power cut XXXXXXXXXXXXXXXX"); in ubi_dbg_power_cut()
603 ubi_ro_mode(ubi); in ubi_dbg_power_cut()