From patchwork Thu Sep 20 09:00:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 185363 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 0AA622C0098 for ; Thu, 20 Sep 2012 19:04:30 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TEcfE-0001Lz-2O; Thu, 20 Sep 2012 09:03:16 +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 1TEccQ-0008HS-8Z for linux-mtd@lists.infradead.org; Thu, 20 Sep 2012 09:00:23 +0000 Received: by bkcji2 with SMTP id ji2so959592bkc.36 for ; Thu, 20 Sep 2012 02:00:20 -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:mime-version :content-type:content-transfer-encoding; bh=b30k/RYeLIklNNgwRun/s5JiO7bx3vJDqpPhfPkPGJU=; b=yipS2YVmKiZa44g2Vg3deBxXW6dPj61QR+C+zL8w9Hrq1gzpd8uyCL8pv5Zp/wHEYn 0u4L2EmvtUf315C00MuPMJPqA539r4MdpucYCMK83WmgNYa7UDZNHUFGOueyoGWgiaiz J2XkgOg3dbVhMIs45FAt9TKX1XUQarNdoa6AmDZyTWe373WEKiZysHhL/qJEN+WTmtoP Wd250MxXJODr9KhCAyJFsSOrbjljxIRqfobIk7G1lGd/mW1RmkvxPjDmwkR3whoXkl36 j7z7g3p2YM32vNwiKk1GrSsJa5J2Lcj2LXsKkzE1IQVXVWAuKKWiiaTHVLLUmGy3G1tO 5/NA== Received: by 10.204.155.146 with SMTP id s18mr316801bkw.23.1348131620324; Thu, 20 Sep 2012 02:00:20 -0700 (PDT) Received: from localhost.localdomain (gw.bas.roche.com. [196.3.50.254]) by mx.google.com with ESMTPS id n17sm3518961bks.6.2012.09.20.02.00.19 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 20 Sep 2012 02:00:19 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: linux-mtd@lists.infradead.org, Artem Bityutskiy Subject: [PATCH] mtd: bcm47xxsflash: just use memcpy_fromio for reading Date: Thu, 20 Sep 2012 11:00:25 +0200 Message-Id: <1348131625-24349-1-git-send-email-zajec5@gmail.com> X-Mailer: git-send-email 1.7.7 MIME-Version: 1.0 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?= 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: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Rafał Miłecki --- It doesn't generate any errors on normal compilation, but I wasn't able to test it with "verify". This tool defeated me ;/ First I cloned dedekind/maintaining.git but it didn't run because or lacking aiaiai. So I've cloned dedekind/aiaiai.git. Then I had to move aiaiai to ~/git/aiaiai to let "verify" find it. So I was able to use verify: time ./verify ../l2-mtd/ mips-bcm47xx_defconfig < ../l2-mtd/0001-mtd-bcm47xxsflash-just-use-memcpy-for-reading.patch but it didn't work because patch was already applied. My bad, but... it took 2m17.277s to verify to realize that. And that magic commit/message wasn't helpful: Failed to apply patch(es) with git am on top of: 0f1afc8 Quick fixes - applied by aiaiai So I've removed patch from my tree, and tried again. This time it took 3m14.398s just to display: [2012-09-20 10:39:10] aiaiai-make-kernel: Program "aiaiai-locker" is required but not found in PATH I just wanted to add ~/git/aiaiai to my $PATH, but noticed it doesn't contain aiaiai-locker anyway... I gave up :| I appreciate your work on additional quality tools, but apart from good code it also need to be easy-usable to make ppl use it :| --- 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..dd650db 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_fromio(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,