From patchwork Wed Sep 19 12:08:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 185009 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (unknown [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 152732C0083 for ; Wed, 19 Sep 2012 22:10:06 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TEJ4j-0006AB-HD; Wed, 19 Sep 2012 12:08:17 +0000 Received: from mail-bk0-f49.google.com ([209.85.214.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TEJ4a-00064i-CW for linux-mtd@lists.infradead.org; Wed, 19 Sep 2012 12:08:10 +0000 Received: by bkcji2 with SMTP id ji2so458944bkc.36 for ; Wed, 19 Sep 2012 05:08:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=FEdFX0kxkS/Mf2n9iVKOox3j3bYwnR9RIBnaoyzPCek=; b=kk7A3xl/6SwJw4uP+UXMI2izm8wlwrOFyXrp03BD3czf8uPW4YojY9G3P7of4OR4hu FGXA7V/YEQDTgCrssihve7KZ+6YiaX8U1Gn1WNCckN/Bj1oWOMwU5Yf39v7l8fbHx1hr tMm3SpipvJ44KDregpCgmJ8v7a16JAoOhsXEPmHKyDXpIlb8L8iSAVMtZaU++rFq/f2G s9P0ULzHU+djw/Q1spbudzo3zzpAb7YeI0LOHO5Qr96tI/X87uJEuP82gtAZ/FftKSnv rFljofFf9JQXb1/ucuxTV0t1azGiZgYPTDgit2LkuRevyk0+reSm5YJSfEdACGIE0XLR LmpQ== Received: by 10.204.157.10 with SMTP id z10mr1205925bkw.63.1348056486479; Wed, 19 Sep 2012 05:08:06 -0700 (PDT) Received: from localhost.localdomain (gw.bas.roche.com. [196.3.50.254]) by mx.google.com with ESMTPS id x13sm930210bkv.16.2012.09.19.05.08.04 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 19 Sep 2012 05:08:05 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: linux-mtd@lists.infradead.org, Artem Bityutskiy Subject: [PATCH RFC] bcm47xxsflash: just use memcpy for reading Date: Wed, 19 Sep 2012 14:08:14 +0200 Message-Id: <1348056494-30019-1-git-send-email-zajec5@gmail.com> X-Mailer: git-send-email 1.7.7 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.214.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (zajec5[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (zajec5[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Jonas Gorski X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 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 --- Still have to check it with aiaiai --- drivers/mtd/devices/bcm47xxsflash.c | 31 ++----------------------------- 1 files changed, 2 insertions(+), 29 deletions(-) diff --git a/drivers/mtd/devices/bcm47xxsflash.c b/drivers/mtd/devices/bcm47xxsflash.c index a328872..2f8dfd4 100644 --- a/drivers/mtd/devices/bcm47xxsflash.c +++ b/drivers/mtd/devices/bcm47xxsflash.c @@ -14,41 +14,14 @@ static int bcm47xxsflash_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) { struct bcma_sflash *sflash = mtd->priv; - size_t bytes_read = 0; - __iomem u8 *src = (__iomem u8 *)KSEG0ADDR(sflash->window + from); - int i; - size_t unaligned_before, unaligned_after; /* Check address range */ if ((from + len) > mtd->size) return -EINVAL; - unaligned_before = from & 0x3; - unaligned_after = (from + len) & 0x3; + memcpy(buf, (void *)KSEG0ADDR(sflash->window + from), len); - for (i = 0; i < unaligned_before; i++) { - *buf = readb(src); - buf++; - src++; - bytes_read++; - } - for (i = from - unaligned_before; i < from + len - unaligned_after; - i += 4) { - *(u32 *)buf = readl(src); - buf += 4; - src += 4; - bytes_read += 4; - } - for (i = 0; i < unaligned_after; i++) { - *buf = readb(src); - buf++; - src++; - bytes_read++; - } - - *retlen = bytes_read; - - return 0; + return len; } static void bcm47xxsflash_fill_mtd(struct bcma_sflash *sflash,