All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Behún" <marek.behun@nic.cz>
To: u-boot@lists.denx.de
Subject: [PATCH u-boot-dm + u-boot-spi v2 6/7] mtd: remove mtd_probe function
Date: Tue,  9 Feb 2021 15:44:51 +0100	[thread overview]
Message-ID: <20210209144452.31134-7-marek.behun@nic.cz> (raw)
In-Reply-To: <20210209144452.31134-1-marek.behun@nic.cz>

The device_probe() function does the same thing as mtd_probe() and
mtd_probe() is only used in mtd_probe_uclass_mtd_devs(), where the
probing can be made simpler by using uclass_foreach_dev_probe macro.

Signed-off-by: Marek Beh?n <marek.behun@nic.cz>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Priyanka Jain <priyanka.jain@nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Heiko Schocher <hs@denx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
---
 drivers/mtd/mtd-uclass.c | 15 ---------------
 drivers/mtd/mtd_uboot.c  |  9 +++------
 include/mtd.h            |  1 -
 3 files changed, 3 insertions(+), 22 deletions(-)

diff --git a/drivers/mtd/mtd-uclass.c b/drivers/mtd/mtd-uclass.c
index 9f5f672ba3..4ab84de553 100644
--- a/drivers/mtd/mtd-uclass.c
+++ b/drivers/mtd/mtd-uclass.c
@@ -9,21 +9,6 @@
 #include <errno.h>
 #include <mtd.h>
 
-/**
- * mtd_probe - Probe the device @dev if not already done
- *
- * @dev: U-Boot device to probe
- *
- * @return 0 on success, an error otherwise.
- */
-int mtd_probe(struct udevice *dev)
-{
-	if (device_active(dev))
-		return 0;
-
-	return device_probe(dev);
-}
-
 /*
  * Implement a MTD uclass which should include most flash drivers.
  * The uclass private is pointed to mtd_info.
diff --git a/drivers/mtd/mtd_uboot.c b/drivers/mtd/mtd_uboot.c
index 7fb72eb1f4..865e9ae4cb 100644
--- a/drivers/mtd/mtd_uboot.c
+++ b/drivers/mtd/mtd_uboot.c
@@ -9,6 +9,7 @@
 #include <malloc.h>
 #include <dm/device.h>
 #include <dm/uclass-internal.h>
+#include <dm/uclass.h>
 #include <linux/err.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
@@ -105,13 +106,9 @@ int mtd_search_alternate_name(const char *mtdname, char *altname,
 static void mtd_probe_uclass_mtd_devs(void)
 {
 	struct udevice *dev;
-	int idx = 0;
 
-	/* Probe devices with DM compliant drivers */
-	while (!uclass_find_device(UCLASS_MTD, idx, &dev) && dev) {
-		mtd_probe(dev);
-		idx++;
-	}
+	uclass_foreach_dev_probe(UCLASS_MTD, dev)
+		;
 }
 #else
 static void mtd_probe_uclass_mtd_devs(void) { }
diff --git a/include/mtd.h b/include/mtd.h
index b0f8693386..b569331edb 100644
--- a/include/mtd.h
+++ b/include/mtd.h
@@ -8,7 +8,6 @@
 
 #include <linux/mtd/mtd.h>
 
-int mtd_probe(struct udevice *dev);
 int mtd_probe_devices(void);
 
 void board_mtdparts_default(const char **mtdids, const char **mtdparts);
-- 
2.26.2

  parent reply	other threads:[~2021-02-09 14:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09 14:44 [PATCH u-boot-dm + u-boot-spi v2 0/7] Support SPI NORs and OF partitions in `mtd list` Marek Behún
2021-02-09 14:44 ` [PATCH u-boot-dm + u-boot-spi v2 1/7] dm: core: add test for ofnode_get_addr_size_index() Marek Behún
2021-02-10  5:10   ` Simon Glass
2021-02-25 14:14     ` Marek Behún
2021-02-09 14:44 ` [PATCH u-boot-dm + u-boot-spi v2 2/7] dm: core: add non-translating version of ofnode_get_addr_size_index() Marek Behún
2021-02-10  5:10   ` Simon Glass
2021-02-09 14:44 ` [PATCH u-boot-dm + u-boot-spi v2 3/7] mtd: add support for parsing partitions defined in OF Marek Behún
2021-02-10  9:54   ` Pali Rohár
2021-02-09 14:44 ` [PATCH u-boot-dm + u-boot-spi v2 4/7] mtd: spi-nor: allow registering multiple MTDs when DM is enabled Marek Behún
2021-02-10  9:33   ` Pali Rohár
2021-02-09 14:44 ` [PATCH u-boot-dm + u-boot-spi v2 5/7] mtd: spi-nor: fill-in mtd->dev member Marek Behún
2021-02-10  9:31   ` Pali Rohár
2021-02-09 14:44 ` Marek Behún [this message]
2021-02-10  9:29   ` [PATCH u-boot-dm + u-boot-spi v2 6/7] mtd: remove mtd_probe function Pali Rohár
2021-02-09 14:44 ` [PATCH u-boot-dm + u-boot-spi v2 7/7] mtd: probe SPI NOR devices in mtd_probe_devices() Marek Behún
2021-02-10  9:26   ` Pali Rohár
2021-02-10 13:48 ` [PATCH u-boot-dm + u-boot-spi v2 0/7] Support SPI NORs and OF partitions in `mtd list` Patrice CHOTARD
2021-02-10 14:14   ` Marek Behun
2021-02-10 14:31     ` Patrice CHOTARD
2021-02-10 14:49       ` Marek Behun
2021-02-10 14:52       ` Marek Behun

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=20210209144452.31134-7-marek.behun@nic.cz \
    --to=marek.behun@nic.cz \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.