diff mbox

[1/1,linux-next] mtd/ftl: use swap() in copy_erase_unit()

Message ID 1433953867-23429-1-git-send-email-fabf@skynet.be
State Accepted
Commit 6166a76f5ef7619faa28b38d7817e5fe0e509942
Headers show

Commit Message

Fabian Frederick June 10, 2015, 4:31 p.m. UTC
Use kernel.h macro definition.

Thanks to Julia Lawall for Coccinelle scripting support.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 drivers/mtd/ftl.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Brian Norris Dec. 19, 2015, 12:56 a.m. UTC | #1
Garbage collecting old patches...
On Wed, Jun 10, 2015 at 06:31:06PM +0200, Fabian Frederick wrote:
> Use kernel.h macro definition.
> 
> Thanks to Julia Lawall for Coccinelle scripting support.
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

Applied to l2-mtd.git
diff mbox

Patch

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;