@@ -98,16 +98,13 @@ static int paranoid_check_ec_hdr(const struct ubi_device *ubi, int pnum,
9898static int paranoid_check_peb_vid_hdr (const struct ubi_device * ubi , int pnum );
9999static int paranoid_check_vid_hdr (const struct ubi_device * ubi , int pnum ,
100100 const struct ubi_vid_hdr * vid_hdr );
101- static int paranoid_check_all_ff (struct ubi_device * ubi , int pnum , int offset ,
102- int len );
103101static int paranoid_check_empty (struct ubi_device * ubi , int pnum );
104102#else
105103#define paranoid_check_not_bad (ubi , pnum ) 0
106104#define paranoid_check_peb_ec_hdr (ubi , pnum ) 0
107105#define paranoid_check_ec_hdr (ubi , pnum , ec_hdr ) 0
108106#define paranoid_check_peb_vid_hdr (ubi , pnum ) 0
109107#define paranoid_check_vid_hdr (ubi , pnum , vid_hdr ) 0
110- #define paranoid_check_all_ff (ubi , pnum , offset , len ) 0
111108#define paranoid_check_empty (ubi , pnum ) 0
112109#endif
113110
@@ -244,7 +241,7 @@ int ubi_io_write(struct ubi_device *ubi, const void *buf, int pnum, int offset,
244241 return err > 0 ? - EINVAL : err ;
245242
246243 /* The area we are writing to has to contain all 0xFF bytes */
247- err = paranoid_check_all_ff (ubi , pnum , offset , len );
244+ err = ubi_dbg_check_all_ff (ubi , pnum , offset , len );
248245 if (err )
249246 return err > 0 ? - EINVAL : err ;
250247
@@ -350,7 +347,7 @@ static int do_sync_erase(struct ubi_device *ubi, int pnum)
350347 return - EIO ;
351348 }
352349
353- err = paranoid_check_all_ff (ubi , pnum , 0 , ubi -> peb_size );
350+ err = ubi_dbg_check_all_ff (ubi , pnum , 0 , ubi -> peb_size );
354351 if (err )
355352 return err > 0 ? - EINVAL : err ;
356353
@@ -672,8 +669,7 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum,
672669 if (read_err != - EBADMSG &&
673670 check_pattern (ec_hdr , 0xFF , UBI_EC_HDR_SIZE )) {
674671 /* The physical eraseblock is supposedly empty */
675- err = paranoid_check_all_ff (ubi , pnum , 0 ,
676- ubi -> peb_size );
672+ err = ubi_dbg_check_all_ff (ubi , pnum , 0 , ubi -> peb_size );
677673 if (err )
678674 return err > 0 ? UBI_IO_BAD_EC_HDR : err ;
679675
@@ -1229,7 +1225,7 @@ static int paranoid_check_peb_vid_hdr(const struct ubi_device *ubi, int pnum)
12291225}
12301226
12311227/**
1232- * paranoid_check_all_ff - check that a region of flash is empty.
1228+ * ubi_dbg_check_all_ff - check that a region of flash is empty.
12331229 * @ubi: UBI device description object
12341230 * @pnum: the physical eraseblock number to check
12351231 * @offset: the starting offset within the physical eraseblock to check
@@ -1239,13 +1235,14 @@ static int paranoid_check_peb_vid_hdr(const struct ubi_device *ubi, int pnum)
12391235 * @offset of the physical eraseblock @pnum, %1 if not, and a negative error
12401236 * code if an error occurred.
12411237 */
1242- static int paranoid_check_all_ff (struct ubi_device * ubi , int pnum , int offset ,
1243- int len )
1238+ int ubi_dbg_check_all_ff (struct ubi_device * ubi , int pnum , int offset , int len )
12441239{
12451240 size_t read ;
12461241 int err ;
12471242 loff_t addr = (loff_t )pnum * ubi -> peb_size + offset ;
12481243
1244+ ubi_assert (!mutex_is_locked (& ubi -> dbg_buf_mutex ));
1245+
12491246 mutex_lock (& ubi -> dbg_buf_mutex );
12501247 err = ubi -> mtd -> read (ubi -> mtd , addr , len , & read , ubi -> dbg_peb_buf );
12511248 if (err && err != - EUCLEAN ) {
0 commit comments