mtd: ftl: use swap() in copy_erase_unit()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue Jan 12 15:59:28 PST 2016


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=6166a76f5ef7619faa28b38d7817e5fe0e509942
Commit:     6166a76f5ef7619faa28b38d7817e5fe0e509942
Parent:     fdd9d27c8a47ea81daeaddfe6c0156ae7cf68096
Author:     Fabian Frederick <fabf at skynet.be>
AuthorDate: Wed Jun 10 18:31:06 2015 +0200
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Fri Dec 18 16:56:07 2015 -0800

    mtd: ftl: use swap() in copy_erase_unit()
    
    Use kernel.h macro definition.
    
    Thanks to Julia Lawall for Coccinelle scripting support.
    
    Signed-off-by: Fabian Frederick <fabf at skynet.be>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/ftl.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index dabf084..9fb3b0d 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -571,12 +571,8 @@ static int copy_erase_unit(partition_t *part, uint16_t srcunit,
 
 
     /* Update the maps and usage stats*/
-    i = xfer->EraseCount;
-    xfer->EraseCount = eun->EraseCount;
-    eun->EraseCount = i;
-    i = xfer->Offset;
-    xfer->Offset = eun->Offset;
-    eun->Offset = i;
+    swap(xfer->EraseCount, eun->EraseCount);
+    swap(xfer->Offset, eun->Offset);
     part->FreeTotal -= eun->Free;
     part->FreeTotal += free;
     eun->Free = free;



More information about the linux-mtd-cvs mailing list