[MTD] partitioning utility predicates
Move mtd_has_partitions() and mtd_has_cmdlinepart() inlines from a DaVinci-specific driver to the <linux/mtd/partitions.h> header. Use those to eliminate #ifdefs in two drivers which had their own definitions of mtd_has_partitions(). Quite a lot of other MTD drivers could benefit from using use one or both of these to remove #ifdeffery. Maybe some Janitors would like to help. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
committed by
David Woodhouse
parent
7ed8c7d440
commit
a4b6d516a6
@@ -65,12 +65,6 @@
|
|||||||
#define FAST_READ_DUMMY_BYTE 0
|
#define FAST_READ_DUMMY_BYTE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_MTD_PARTITIONS
|
|
||||||
#define mtd_has_partitions() (1)
|
|
||||||
#else
|
|
||||||
#define mtd_has_partitions() (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
struct m25p {
|
struct m25p {
|
||||||
@@ -708,12 +702,13 @@ static int __devinit m25p_probe(struct spi_device *spi)
|
|||||||
struct mtd_partition *parts = NULL;
|
struct mtd_partition *parts = NULL;
|
||||||
int nr_parts = 0;
|
int nr_parts = 0;
|
||||||
|
|
||||||
#ifdef CONFIG_MTD_CMDLINE_PARTS
|
if (mtd_has_cmdlinepart()) {
|
||||||
static const char *part_probes[] = { "cmdlinepart", NULL, };
|
static const char *part_probes[]
|
||||||
|
= { "cmdlinepart", NULL, };
|
||||||
|
|
||||||
nr_parts = parse_mtd_partitions(&flash->mtd,
|
nr_parts = parse_mtd_partitions(&flash->mtd,
|
||||||
part_probes, &parts, 0);
|
part_probes, &parts, 0);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
if (nr_parts <= 0 && data && data->parts) {
|
if (nr_parts <= 0 && data && data->parts) {
|
||||||
parts = data->parts;
|
parts = data->parts;
|
||||||
|
@@ -98,12 +98,6 @@ struct dataflash {
|
|||||||
struct mtd_info mtd;
|
struct mtd_info mtd;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_MTD_PARTITIONS
|
|
||||||
#define mtd_has_partitions() (1)
|
|
||||||
#else
|
|
||||||
#define mtd_has_partitions() (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ......................................................................... */
|
/* ......................................................................... */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -682,11 +676,13 @@ add_dataflash_otp(struct spi_device *spi, char *name,
|
|||||||
struct mtd_partition *parts;
|
struct mtd_partition *parts;
|
||||||
int nr_parts = 0;
|
int nr_parts = 0;
|
||||||
|
|
||||||
#ifdef CONFIG_MTD_CMDLINE_PARTS
|
if (mtd_has_cmdlinepart()) {
|
||||||
static const char *part_probes[] = { "cmdlinepart", NULL, };
|
static const char *part_probes[]
|
||||||
|
= { "cmdlinepart", NULL, };
|
||||||
|
|
||||||
nr_parts = parse_mtd_partitions(device, part_probes, &parts, 0);
|
nr_parts = parse_mtd_partitions(device,
|
||||||
#endif
|
part_probes, &parts, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (nr_parts <= 0 && pdata && pdata->parts) {
|
if (nr_parts <= 0 && pdata && pdata->parts) {
|
||||||
parts = pdata->parts;
|
parts = pdata->parts;
|
||||||
|
@@ -38,19 +38,6 @@
|
|||||||
#include <asm/mach-types.h>
|
#include <asm/mach-types.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_MTD_PARTITIONS
|
|
||||||
static inline int mtd_has_partitions(void) { return 1; }
|
|
||||||
#else
|
|
||||||
static inline int mtd_has_partitions(void) { return 0; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_MTD_CMDLINE_PARTS
|
|
||||||
static inline int mtd_has_cmdlinepart(void) { return 1; }
|
|
||||||
#else
|
|
||||||
static inline int mtd_has_cmdlinepart(void) { return 0; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a device driver for the NAND flash controller found on the
|
* This is a device driver for the NAND flash controller found on the
|
||||||
* various DaVinci family chips. It handles up to four SoC chipselects,
|
* various DaVinci family chips. It handles up to four SoC chipselects,
|
||||||
|
@@ -76,4 +76,16 @@ int __devinit of_mtd_parse_partitions(struct device *dev,
|
|||||||
struct device_node *node,
|
struct device_node *node,
|
||||||
struct mtd_partition **pparts);
|
struct mtd_partition **pparts);
|
||||||
|
|
||||||
|
#ifdef CONFIG_MTD_PARTITIONS
|
||||||
|
static inline int mtd_has_partitions(void) { return 1; }
|
||||||
|
#else
|
||||||
|
static inline int mtd_has_partitions(void) { return 0; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_MTD_CMDLINE_PARTS
|
||||||
|
static inline int mtd_has_cmdlinepart(void) { return 1; }
|
||||||
|
#else
|
||||||
|
static inline int mtd_has_cmdlinepart(void) { return 0; }
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user