mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/2] mtd: mtdram: discard superfluous code
Date: Mon,  7 Feb 2022 08:56:29 +0100	[thread overview]
Message-ID: <20220207075630.1014476-1-a.fatoum@pengutronix.de> (raw)

We don't need to get the exact same resource, we just requested.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/mtd/devices/mtdram.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/mtd/devices/mtdram.c b/drivers/mtd/devices/mtdram.c
index ee1cbf792dbb..c9371b16d0f5 100644
--- a/drivers/mtd/devices/mtdram.c
+++ b/drivers/mtd/devices/mtdram.c
@@ -16,11 +16,6 @@
 #include <malloc.h>
 #include <of.h>
 
-struct mtdram_priv_data {
-	struct mtd_info mtd;
-	void *base;
-};
-
 static int ram_erase(struct mtd_info *mtd, struct erase_info *instr)
 {
 	memset((char *)mtd->priv + instr->addr, 0xff, instr->len);
@@ -44,10 +39,8 @@ static int ram_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retle
 static int mtdram_probe(struct device_d *dev)
 {
 	struct resource *iores;
-	void __iomem *base;
 	int device_id;
 	struct mtd_info *mtd;
-	struct resource *res;
 	loff_t size;
 	int ret = 0;
 
@@ -70,11 +63,9 @@ static int mtdram_probe(struct device_d *dev)
 		ret = PTR_ERR(iores);
 		goto nobase;
 	}
-	base = IOMEM(iores->start);
 
-	res = dev_get_resource(dev, IORESOURCE_MEM, 0);
-	size = (unsigned long) resource_size(res);
-	mtd->priv = base;
+	mtd->priv = IOMEM(iores->start);
+	size = (unsigned long) resource_size(iores);
 
 	mtd->type = MTD_RAM;
 	mtd->writesize = 1;
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


             reply	other threads:[~2022-02-07  7:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-07  7:56 Ahmad Fatoum [this message]
2022-02-07  7:56 ` [PATCH 2/2] mtd: mtdram: add physically mapped ROM (mtd-rom) support Ahmad Fatoum
2022-02-07  8:11 ` [PATCH 1/2] mtd: mtdram: discard superfluous code Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220207075630.1014476-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox