Received: by 10.223.164.202 with SMTP id h10csp459666wrb; Thu, 30 Nov 2017 13:17:19 -0800 (PST) X-Google-Smtp-Source: AGs4zMax9Ec/n7O1p2grE8p0i8hQZeQDJ2ttpIhWX2xleOebHMV+zUCBzgzXItTkQHi0F1KsD4bw X-Received: by 10.159.208.2 with SMTP id a2mr3984431plp.370.1512076639525; Thu, 30 Nov 2017 13:17:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512076639; cv=none; d=google.com; s=arc-20160816; b=mhjJN5QoHoattMbmBOzx/1bplaFgxqB2Gl1tR9OELUUm2ibtDbzPYm0ZKUcGCkUAOB +dXHed1aKJTaQfw+pCbLJ5+UbzPt4dq0Xj+1ppVrKHNXLCvgGD0npIIuh6snfYH4S+Lz 56wsVOPe4wzmveWuV9QTTxVjvPh++pcz0i9LWY6PqP8DRzGgB+nO4olJ7pULXjptVquH FsGxCNv+8bKRXlqyat0IBShJJ1TJ9LYiXNzDS7xsSvsg/nWYmnGgabXrVD4xh9Nkm4U4 PdUpg6N3XUFwi0AICpebC375tZM4B6/Qu7RddAq3ShEth3AsDZ7DA2nX4J1be6lvQco8 wvbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=mWURwjExuy++G/tJQYlwSO1nwfOw01fqnb0r66VnGdw=; b=MYJM9rmsTLGjkDU2veBgk+0P1vgXWLP80wVVB3qMfmuSVQbxu/8B91bov1lb963H0W 825VRU5S7HYn7BJu6irqIzUlXTg5g4r8AO/eWiQ+kmNiWdSeoxuys4CCB0wN4fU2tc4c /RZOx8YEuIYS42zaMOsqyJ9D06cIWGazVWi+SZUp79xWtVCRCUK/NJzQcfC3upt+t5+6 7OleuWVE9RSaoY6c0Hu3Pjblw5wQa22+/oUXHjisuFhRmvbFAUGLEMDzQB9jwWND8hB2 LOoPYzAF1DvWm+opQFZfOS3+44KvqIjQBAmKmOlPUVU40+3/7MU1ccbv8Sp28TrFzLWJ 6QhQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1si3709980plq.795.2017.11.30.13.17.03; Thu, 30 Nov 2017 13:17:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750945AbdK3VQv (ORCPT + 99 others); Thu, 30 Nov 2017 16:16:51 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:44979 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750708AbdK3VQu (ORCPT ); Thu, 30 Nov 2017 16:16:50 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id DC38E20741; Thu, 30 Nov 2017 22:16:43 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (unknown [91.160.177.164]) by mail.free-electrons.com (Postfix) with ESMTPSA id A4C5320411; Thu, 30 Nov 2017 22:16:43 +0100 (CET) Date: Thu, 30 Nov 2017 22:16:43 +0100 From: Boris Brezillon To: "Gustavo A. R. Silva" Cc: Han Xu , Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Cyrille Pitchen , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mtd: nand: gpmi: replace _manual_ swap with swap macro Message-ID: <20171130221643.65f79c58@bbrezillon> In-Reply-To: <20171103203147.GA28309@embeddedor.com> References: <20171103203147.GA28309@embeddedor.com> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 3 Nov 2017 15:31:47 -0500 "Gustavo A. R. Silva" wrote: > Make use of the swap macro and remove unnecessary variables swap. > This makes the code easier to read and maintain. > > This code was detected with the help of Coccinelle. Applied. Thanks, Boris > > Signed-off-by: Gustavo A. R. Silva > --- > drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 16 ++++------------ > 1 file changed, 4 insertions(+), 12 deletions(-) > > diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c > index 50f8d4a..9e365d4 100644 > --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c > +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c > @@ -1487,12 +1487,8 @@ static int gpmi_ecc_read_page_raw(struct mtd_info *mtd, > * See the layout description for a detailed explanation on why this > * is needed. > */ > - if (this->swap_block_mark) { > - u8 swap = tmp_buf[0]; > - > - tmp_buf[0] = tmp_buf[mtd->writesize]; > - tmp_buf[mtd->writesize] = swap; > - } > + if (this->swap_block_mark) > + swap(tmp_buf[0], tmp_buf[mtd->writesize]); > > /* > * Copy the metadata section into the oob buffer (this section is > @@ -1615,12 +1611,8 @@ static int gpmi_ecc_write_page_raw(struct mtd_info *mtd, > * See the layout description for a detailed explanation on why this > * is needed. > */ > - if (this->swap_block_mark) { > - u8 swap = tmp_buf[0]; > - > - tmp_buf[0] = tmp_buf[mtd->writesize]; > - tmp_buf[mtd->writesize] = swap; > - } > + if (this->swap_block_mark) > + swap(tmp_buf[0], tmp_buf[mtd->writesize]); > > chip->write_buf(mtd, tmp_buf, mtd->writesize + mtd->oobsize); > From 1583082906044937350@xxx Fri Nov 03 21:45:08 +0000 2017 X-GM-THRID: 1583078363686038112 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread