From patchwork Fri Nov 13 07:02:22 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 38345 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DAE23B7BB7 for ; Fri, 13 Nov 2009 18:05:38 +1100 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1N8qBc-0006Md-OZ; Fri, 13 Nov 2009 07:03:12 +0000 Received: from mail-yx0-f202.google.com ([209.85.210.202]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1N8qBW-00064U-0e for linux-mtd@lists.infradead.org; Fri, 13 Nov 2009 07:03:10 +0000 Received: by yxe40 with SMTP id 40so2895136yxe.28 for ; Thu, 12 Nov 2009 23:03:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=DgYki0BV90MzRXlFESocCTgCmhOUoHoIzbOR8FU59b4=; b=wFvBqtYgpUdLVOThwlJgN+GtzxSVsN5xbjNVdb5HbeIzrVhfRar4AtZTlEzFEgZUBM TsR9NRimY8+jcINwaNh4K3W4QRG8XPtLUqJA0ojmEFtjuINom3UuI/GtLA2zVJvfl9/3 0q9Jhby1AD5N/rk1xGQgaWcT2W3GehOnINsWU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=oaxaFrawbJdWLBtD9+awRlxTgZhXr6aPgWiiSNjgFQQONmdNK0HX6C91fz2gQ5Iyqe g13VhTGSn71z2N+rRt8WuvdGYAK9mOOtayDajTjUy+9XAh+rQMwMMXEqN1hh6BrMHPVo 1QIRWd2dkF7F0hmUi2fputVZMR6KxUm9xQAAs= Received: by 10.100.74.21 with SMTP id w21mr4215055ana.165.1258095783952; Thu, 12 Nov 2009 23:03:03 -0800 (PST) Received: from localhost ([220.110.185.192]) by mx.google.com with ESMTPS id 9sm105736yxf.23.2009.11.12.23.03.02 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 12 Nov 2009 23:03:03 -0800 (PST) From: Akinobu Mita To: linux-mtd@lists.infradead.org Subject: [PATCH] mtd: alauda: Use hweight8 Date: Fri, 13 Nov 2009 16:02:22 +0900 Message-Id: <1258095742-13221-1-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 1.6.5.1 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20091113_020306_381020_C984DC48 X-CRM114-Status: GOOD ( 14.83 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.2.5 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- _SUMMARY_ Cc: Artem Bityutskiy , David Woodhouse , Akinobu Mita X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Akinobu Mita Cc: David Woodhouse Cc: Artem Bityutskiy Cc: linux-mtd@lists.infradead.org --- drivers/mtd/nand/alauda.c | 11 +---------- 1 files changed, 1 insertions(+), 10 deletions(-) diff --git a/drivers/mtd/nand/alauda.c b/drivers/mtd/nand/alauda.c index 6d96491..2d67732 100644 --- a/drivers/mtd/nand/alauda.c +++ b/drivers/mtd/nand/alauda.c @@ -372,15 +372,6 @@ static int alauda_read_oob(struct mtd_info *mtd, loff_t from, void *oob) return __alauda_read_page(mtd, from, ignore_buf, oob); } -static int popcount8(u8 c) -{ - int ret = 0; - - for ( ; c; c>>=1) - ret += c & 1; - return ret; -} - static int alauda_isbad(struct mtd_info *mtd, loff_t ofs) { u8 oob[16]; @@ -391,7 +382,7 @@ static int alauda_isbad(struct mtd_info *mtd, loff_t ofs) return err; /* A block is marked bad if two or more bits are zero */ - return popcount8(oob[5]) >= 7 ? 0 : 1; + return hweight8(oob[5]) >= 7 ? 0 : 1; } static int alauda_bounce_read(struct mtd_info *mtd, loff_t from, size_t len,