Skip to content

Commit dcb3e13

Browse files
vapierDavid Woodhouse
authored andcommitted
[MTD] physmap: make physmap compat explicit
The current method for always showing physmap compat address, size, and width is a bit confusing. If length is set to 0, then the address and width are still shown but silently unused. The physmap code itself already has logic which sets compat based on length, so just pull that out and into the Kconfig to make everything clear. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Cc: Bryan Wu <Bryan.Wu@analog.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent c4956ed commit dcb3e13

2 files changed

Lines changed: 18 additions & 15 deletions

File tree

‎drivers/mtd/maps/Kconfig‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,20 @@ config MTD_PHYSMAP
2323
To compile this driver as a module, choose M here: the
2424
module will be called physmap.
2525

26+
config MTD_PHYSMAP_COMPAT
27+
bool "Physmap compat support"
28+
depends on MTD_PHYSMAP
29+
default n
30+
help
31+
Setup a simple mapping via the Kconfig options. Normally the
32+
physmap configuration options are done via your board's
33+
resource file.
34+
35+
If unsure, say N here.
36+
2637
config MTD_PHYSMAP_START
2738
hex "Physical start address of flash mapping"
28-
depends on MTD_PHYSMAP
39+
depends on MTD_PHYSMAP_COMPAT
2940
default "0x8000000"
3041
help
3142
This is the physical memory location at which the flash chips
@@ -37,7 +48,7 @@ config MTD_PHYSMAP_START
3748

3849
config MTD_PHYSMAP_LEN
3950
hex "Physical length of flash mapping"
40-
depends on MTD_PHYSMAP
51+
depends on MTD_PHYSMAP_COMPAT
4152
default "0"
4253
help
4354
This is the total length of the mapping of the flash chips on
@@ -51,7 +62,7 @@ config MTD_PHYSMAP_LEN
5162

5263
config MTD_PHYSMAP_BANKWIDTH
5364
int "Bank width in octets"
54-
depends on MTD_PHYSMAP
65+
depends on MTD_PHYSMAP_COMPAT
5566
default "2"
5667
help
5768
This is the total width of the data bus of the flash devices

‎drivers/mtd/maps/physmap.c‎

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,7 @@ static struct platform_driver physmap_flash_driver = {
251251
};
252252

253253

254-
#ifdef CONFIG_MTD_PHYSMAP_LEN
255-
#if CONFIG_MTD_PHYSMAP_LEN != 0
256-
#warning using PHYSMAP compat code
257-
#define PHYSMAP_COMPAT
258-
#endif
259-
#endif
260-
261-
#ifdef PHYSMAP_COMPAT
254+
#ifdef CONFIG_MTD_PHYSMAP_COMPAT
262255
static struct physmap_flash_data physmap_flash_data = {
263256
.width = CONFIG_MTD_PHYSMAP_BANKWIDTH,
264257
};
@@ -302,7 +295,7 @@ static int __init physmap_init(void)
302295
int err;
303296

304297
err = platform_driver_register(&physmap_flash_driver);
305-
#ifdef PHYSMAP_COMPAT
298+
#ifdef CONFIG_MTD_PHYSMAP_COMPAT
306299
if (err == 0)
307300
platform_device_register(&physmap_flash);
308301
#endif
@@ -312,7 +305,7 @@ static int __init physmap_init(void)
312305

313306
static void __exit physmap_exit(void)
314307
{
315-
#ifdef PHYSMAP_COMPAT
308+
#ifdef CONFIG_MTD_PHYSMAP_COMPAT
316309
platform_device_unregister(&physmap_flash);
317310
#endif
318311
platform_driver_unregister(&physmap_flash_driver);
@@ -326,8 +319,7 @@ MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
326319
MODULE_DESCRIPTION("Generic configurable MTD map driver");
327320

328321
/* legacy platform drivers can't hotplug or coldplg */
329-
#ifndef PHYSMAP_COMPAT
322+
#ifndef CONFIG_MTD_PHYSMAP_COMPAT
330323
/* work with hotplug and coldplug */
331324
MODULE_ALIAS("platform:physmap-flash");
332325
#endif
333-

0 commit comments

Comments
 (0)