From patchwork Fri Jan 27 14:24:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 138228 X-Patchwork-Delegate: benh@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 60E1F100961 for ; Sat, 28 Jan 2012 01:24:57 +1100 (EST) Received: from mail-pw0-f51.google.com (mail-pw0-f51.google.com [209.85.160.51]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 2217BB6EEC for ; Sat, 28 Jan 2012 01:24:45 +1100 (EST) Received: by pbaa7 with SMTP id a7so1767767pba.38 for ; Fri, 27 Jan 2012 06:24:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=u3fTLLtO65035j3wWOSkt92NIXHVSHiVm4NnZfcLan4=; b=mT2yxY8JsrKjrSQWxR4VE7ryPKqAlOwAmnl+0fn7UvIufnmOcIox4MHqXk7FLIHnea K9xvRN100Ymw2mp1bOF3t+Dyz3++4M3V4zHkoRaq2+dqEAO9XtcpA/NQUDQiR8jsBVMG c8GL0IeSpwjW9vx4XzRwzFh2zGcO+RzY7cefw= Received: by 10.68.209.6 with SMTP id mi6mr14545119pbc.87.1327674284088; Fri, 27 Jan 2012 06:24:44 -0800 (PST) Received: from localhost.localdomain (p2046-adsao01yokonib2-acca.kanagawa.ocn.ne.jp. [61.214.148.46]) by mx.google.com with ESMTPS id lk11sm20385743pbb.0.2012.01.27.06.24.40 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 27 Jan 2012 06:24:43 -0800 (PST) From: Akinobu Mita To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org Subject: [PATCH] powerpc: use string library Date: Fri, 27 Jan 2012 23:24:48 +0900 Message-Id: <1327674295-3700-1-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 1.7.4.4 Cc: linuxppc-dev@lists.ozlabs.org, Akinobu Mita X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org - Use memchr_inv to check if the data contains all 0xFF bytes. It is faster than looping for each byte. - Use memcmp to compare memory areas Signed-off-by: Akinobu Mita Cc: Benjamin Herrenschmidt Cc: linuxppc-dev@lists.ozlabs.org --- arch/powerpc/platforms/powermac/nvram.c | 42 ++++++++++++++----------------- 1 files changed, 19 insertions(+), 23 deletions(-) diff --git a/arch/powerpc/platforms/powermac/nvram.c b/arch/powerpc/platforms/powermac/nvram.c index 54d2271..da18b26 100644 --- a/arch/powerpc/platforms/powermac/nvram.c +++ b/arch/powerpc/platforms/powermac/nvram.c @@ -279,7 +279,7 @@ static u32 core99_check(u8* datas) static int sm_erase_bank(int bank) { - int stat, i; + int stat; unsigned long timeout; u8 __iomem *base = (u8 __iomem *)nvram_data + core99_bank*NVRAM_SIZE; @@ -301,11 +301,10 @@ static int sm_erase_bank(int bank) out_8(base, SM_FLASH_CMD_CLEAR_STATUS); out_8(base, SM_FLASH_CMD_RESET); - for (i=0; i