[PATCH v2 01/10] fs: give erase() a new erase_type parameter

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Aug 1 03:54:51 PDT 2024


On 01.08.24 12:51, Sascha Hauer wrote:
> On Wed, Jul 31, 2024 at 10:05:01AM +0200, Ahmad Fatoum wrote:
>> diff --git a/drivers/usb/gadget/function/dfu.c b/drivers/usb/gadget/function/dfu.c
>> index a41ff22dcebc..208e0cd23c29 100644
>> --- a/drivers/usb/gadget/function/dfu.c
>> +++ b/drivers/usb/gadget/function/dfu.c
>> @@ -208,7 +208,7 @@ static void dfu_do_write(struct dfu_work *dw)
>>  
>>  	if (prog_erase && (dfu_written + wlen) > dfu_erased) {
>>  		size = roundup(wlen, dfu_mtdinfo.erasesize);
>> -		ret = erase(dfufd, size, dfu_erased);
>> +		ret = erase(dfufd, size, dfu_erased, ERASE_TO_WRITE);
>>  		dfu_erased += size;
>>  		if (ret && ret != -ENOSYS) {
>>  			perror("erase");
>> @@ -333,7 +333,7 @@ static void dfu_do_copy(struct dfu_work *dw)
>>  		return;
>>  	}
>>  
>> -	ret = erase(fd, ERASE_SIZE_ALL, 0);
>> +	ret = erase_flash(fd, ERASE_SIZE_ALL, 0);
> 
> Fixed this to:
> 
> 	ret = erase(fd, ERASE_SIZE_ALL, 0, ERASE_TO_WRITE);
> 
> Or should it be ERASE_TO_CLEAR instead?

Sorry, that this slipped through. It should be ERASE_TO_WRITE
to minimize impact on existing users.

ERASE_TO_CLEAR should be used for explicit erase operations.

Thanks,
Ahmad

> 
> Sascha
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list