'\" t .\" Title: nand_check_erased_buf .\" Author: .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: April 2019 .\" Manual: Internal Functions Provided .\" Source: Kernel Hackers Manual 4.9.168 .\" Language: English .\" .TH "NAND_CHECK_ERASED_BU" "9" "April 2019" "Kernel Hackers Manual 4\&.9\&." "Internal Functions Provided" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" nand_check_erased_buf \- check if a buffer contains (almost) only 0xff data .SH "SYNOPSIS" .HP \w'int\ nand_check_erased_buf('u .BI "int nand_check_erased_buf(void\ *\ " "buf" ", int\ " "len" ", int\ " "bitflips_threshold" ");" .SH "ARGUMENTS" .PP \fIbuf\fR .RS 4 buffer to test .RE .PP \fIlen\fR .RS 4 buffer length .RE .PP \fIbitflips_threshold\fR .RS 4 maximum number of bitflips .RE .SH "DESCRIPTION" .PP Check if a buffer contains only 0xff, which means the underlying region has been erased and is ready to be programmed\&. The bitflips_threshold specify the maximum number of bitflips before considering the region is not erased\&. .SH "NOTE" .PP The logic of this function has been extracted from the memweight implementation, except that nand_check_erased_buf function exit before testing the whole buffer if the number of bitflips exceed the bitflips_threshold value\&. .PP Returns a positive number of bitflips less than or equal to bitflips_threshold, or \-ERROR_CODE for bitflips in excess of the threshold\&. .SH "AUTHOR" .PP \fBThomas Gleixner\fR <\&tglx@linutronix.de\&> .RS 4 Author. .RE .SH "COPYRIGHT" .br