mtd: ftl: use swap() in copy_erase_unit()
authorFabian Frederick <fabf@skynet.be>
Wed, 10 Jun 2015 16:31:06 +0000 (18:31 +0200)
committerBrian Norris <computersforpeace@gmail.com>
Sat, 19 Dec 2015 00:56:07 +0000 (16:56 -0800)
Use kernel.h macro definition.

Thanks to Julia Lawall for Coccinelle scripting support.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/ftl.c

index dabf08450d0b39c579ae42185489ac7408f1714f..9fb3b0dcdac20cd653387c6d382a0f92daec68c7 100644 (file)
@@ -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;