mtd: remove mtd_probe() function
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> Reviewed-by: Pali Rohár <pali@kernel.org> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Tested-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: 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: Patrick Delaunay <patrick.delaunay@st.com>
This commit is contained in:
		
							parent
							
								
									2d1a9a6b26
								
							
						
					
					
						commit
						69e57c4753
					
				| 
						 | 
					@ -9,21 +9,6 @@
 | 
				
			||||||
#include <errno.h>
 | 
					#include <errno.h>
 | 
				
			||||||
#include <mtd.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.
 | 
					 * Implement a MTD uclass which should include most flash drivers.
 | 
				
			||||||
 * The uclass private is pointed to mtd_info.
 | 
					 * The uclass private is pointed to mtd_info.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,6 +9,7 @@
 | 
				
			||||||
#include <malloc.h>
 | 
					#include <malloc.h>
 | 
				
			||||||
#include <dm/device.h>
 | 
					#include <dm/device.h>
 | 
				
			||||||
#include <dm/uclass-internal.h>
 | 
					#include <dm/uclass-internal.h>
 | 
				
			||||||
 | 
					#include <dm/uclass.h>
 | 
				
			||||||
#include <linux/err.h>
 | 
					#include <linux/err.h>
 | 
				
			||||||
#include <linux/mtd/mtd.h>
 | 
					#include <linux/mtd/mtd.h>
 | 
				
			||||||
#include <linux/mtd/partitions.h>
 | 
					#include <linux/mtd/partitions.h>
 | 
				
			||||||
| 
						 | 
					@ -106,13 +107,9 @@ int mtd_search_alternate_name(const char *mtdname, char *altname,
 | 
				
			||||||
static void mtd_probe_uclass_mtd_devs(void)
 | 
					static void mtd_probe_uclass_mtd_devs(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct udevice *dev;
 | 
						struct udevice *dev;
 | 
				
			||||||
	int idx = 0;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Probe devices with DM compliant drivers */
 | 
						uclass_foreach_dev_probe(UCLASS_MTD, dev)
 | 
				
			||||||
	while (!uclass_find_device(UCLASS_MTD, idx, &dev) && dev) {
 | 
							;
 | 
				
			||||||
		mtd_probe(dev);
 | 
					 | 
				
			||||||
		idx++;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
static void mtd_probe_uclass_mtd_devs(void) { }
 | 
					static void mtd_probe_uclass_mtd_devs(void) { }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <linux/mtd/mtd.h>
 | 
					#include <linux/mtd/mtd.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int mtd_probe(struct udevice *dev);
 | 
					 | 
				
			||||||
int mtd_probe_devices(void);
 | 
					int mtd_probe_devices(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void board_mtdparts_default(const char **mtdids, const char **mtdparts);
 | 
					void board_mtdparts_default(const char **mtdids, const char **mtdparts);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue