* [PATCH] Kconfig: nand: Make MTD_NAND_FSL_ELBC depend on FSL_SOC
@ 2016-07-21 21:59 Andrey Smirnov
2016-07-21 21:59 ` [PATCH] Kconfig: nand: Remove redundant dependency on MTD_NAND Andrey Smirnov
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Andrey Smirnov @ 2016-07-21 21:59 UTC (permalink / raw)
To: linux-mtd
Cc: Andrey Smirnov, Boris Brezillon, Richard Weinberger,
David Woodhouse, Brian Norris, linux-kernel
MTD_NAND_FSL_ELBC selects FSL_LBC that in turn depends on FSL_SOC, so
depending on PPC instead of FSL_SOC leads to this message:
warning: (MPC836x_RDK && MTD_NAND_FSL_ELBC &&
MTD_NAND_FSL_UPM) selects FSL_LBC which has unmet direct
dependencies (FSL_SOC)
when doing
make ARCH=powerpc \
CROSS_COMPILE=powerpc-e500v2-linux-gnuspe- \
allmodconfig"
Changing dependency to FSL_SOC fixes that.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/mtd/nand/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index bcb519b..e528747 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -426,7 +426,7 @@ config MTD_NAND_ORION
config MTD_NAND_FSL_ELBC
tristate "NAND support for Freescale eLBC controllers"
- depends on PPC
+ depends on FSL_SOC
select FSL_LBC
help
Various Freescale chips, including the 8313, include a NAND Flash
--
2.5.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] Kconfig: nand: Remove redundant dependency on MTD_NAND
2016-07-21 21:59 [PATCH] Kconfig: nand: Make MTD_NAND_FSL_ELBC depend on FSL_SOC Andrey Smirnov
@ 2016-07-21 21:59 ` Andrey Smirnov
2016-07-21 21:59 ` [PATCH v3 1/2] mtd: nand: Error out if cmd_ctrl() is missing Andrey Smirnov
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Andrey Smirnov @ 2016-07-21 21:59 UTC (permalink / raw)
To: linux-mtd
Cc: Andrey Smirnov, Boris Brezillon, Richard Weinberger,
David Woodhouse, Brian Norris, linux-kernel
Config MTD_NAND_FSL_IFC is already located inside 'if MTD_NAND'
statment, so there's no need to explicitly specify it as a dependency.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/mtd/nand/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index e528747..756f39e 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -436,7 +436,7 @@ config MTD_NAND_FSL_ELBC
config MTD_NAND_FSL_IFC
tristate "NAND support for Freescale IFC controller"
- depends on MTD_NAND && FSL_SOC
+ depends on FSL_SOC
select FSL_IFC
select MEMORY
help
--
2.5.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 1/2] mtd: nand: Error out if cmd_ctrl() is missing
2016-07-21 21:59 [PATCH] Kconfig: nand: Make MTD_NAND_FSL_ELBC depend on FSL_SOC Andrey Smirnov
2016-07-21 21:59 ` [PATCH] Kconfig: nand: Remove redundant dependency on MTD_NAND Andrey Smirnov
@ 2016-07-21 21:59 ` Andrey Smirnov
2016-07-21 21:59 ` [PATCH v3 2/2] mtd: nand: Get rid of needless 'goto' Andrey Smirnov
2016-08-14 8:57 ` [PATCH] Kconfig: nand: Make MTD_NAND_FSL_ELBC depend on FSL_SOC Boris Brezillon
3 siblings, 0 replies; 5+ messages in thread
From: Andrey Smirnov @ 2016-07-21 21:59 UTC (permalink / raw)
To: linux-mtd
Cc: Andrey Smirnov, Boris Brezillon, Richard Weinberger,
David Woodhouse, Brian Norris, linux-kernel
If no user specified chip->select_chip() function is provided, code in
nand_base.c will automatically set this hook to nand_select_chip(),
which in turn depends on chip->cmd_ctrl() hook being valid. Not
providing both of those functions in NAND controller driver (for example
by mistake) will result in a bit cryptic segfault. Same is true for
chip->cmdfunc().
To avoid the above scenario add a check in nand_scan_dent and error out
if cmd_ctrl() is not provided.
Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Suggested-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
Changes since v2:
- Check moved to nand_scan_ident
drivers/mtd/nand/nand_base.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index ce7b2ca..93f5432 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3997,6 +3997,15 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
if (!mtd->name && mtd->dev.parent)
mtd->name = dev_name(mtd->dev.parent);
+ if ((!chip->cmdfunc || !chip->select_chip) && !chip->cmd_ctrl) {
+ /*
+ * Default functions assigned for chip_select() and
+ * cmdfunc() both expect cmd_ctrl() to be populated,
+ * so we need to check that that's the case
+ */
+ pr_err("chip.cmd_ctrl() callback is not provided");
+ return -EINVAL;
+ }
/* Set the default functions */
nand_set_defaults(chip, chip->options & NAND_BUSWIDTH_16);
--
2.5.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 2/2] mtd: nand: Get rid of needless 'goto'
2016-07-21 21:59 [PATCH] Kconfig: nand: Make MTD_NAND_FSL_ELBC depend on FSL_SOC Andrey Smirnov
2016-07-21 21:59 ` [PATCH] Kconfig: nand: Remove redundant dependency on MTD_NAND Andrey Smirnov
2016-07-21 21:59 ` [PATCH v3 1/2] mtd: nand: Error out if cmd_ctrl() is missing Andrey Smirnov
@ 2016-07-21 21:59 ` Andrey Smirnov
2016-08-14 8:57 ` [PATCH] Kconfig: nand: Make MTD_NAND_FSL_ELBC depend on FSL_SOC Boris Brezillon
3 siblings, 0 replies; 5+ messages in thread
From: Andrey Smirnov @ 2016-07-21 21:59 UTC (permalink / raw)
To: linux-mtd
Cc: Andrey Smirnov, Boris Brezillon, Richard Weinberger,
David Woodhouse, Brian Norris, linux-kernel
Using "goto" and "switch" statement only makes it harder to follow
control flow and doesn't bring any advantages. Rewrite the code to avoid
using "goto".
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
No changes since v2.
drivers/mtd/nand/nand_base.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 93f5432..777152b 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2122,7 +2122,7 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
static int nand_read_oob(struct mtd_info *mtd, loff_t from,
struct mtd_oob_ops *ops)
{
- int ret = -ENOTSUPP;
+ int ret;
ops->retlen = 0;
@@ -2133,24 +2133,18 @@ static int nand_read_oob(struct mtd_info *mtd, loff_t from,
return -EINVAL;
}
- nand_get_device(mtd, FL_READING);
-
- switch (ops->mode) {
- case MTD_OPS_PLACE_OOB:
- case MTD_OPS_AUTO_OOB:
- case MTD_OPS_RAW:
- break;
+ if (ops->mode != MTD_OPS_PLACE_OOB &&
+ ops->mode != MTD_OPS_AUTO_OOB &&
+ ops->mode != MTD_OPS_RAW)
+ return -ENOTSUPP;
- default:
- goto out;
- }
+ nand_get_device(mtd, FL_READING);
if (!ops->datbuf)
ret = nand_do_read_oob(mtd, from, ops);
else
ret = nand_do_read_ops(mtd, from, ops);
-out:
nand_release_device(mtd);
return ret;
}
--
2.5.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Kconfig: nand: Make MTD_NAND_FSL_ELBC depend on FSL_SOC
2016-07-21 21:59 [PATCH] Kconfig: nand: Make MTD_NAND_FSL_ELBC depend on FSL_SOC Andrey Smirnov
` (2 preceding siblings ...)
2016-07-21 21:59 ` [PATCH v3 2/2] mtd: nand: Get rid of needless 'goto' Andrey Smirnov
@ 2016-08-14 8:57 ` Boris Brezillon
3 siblings, 0 replies; 5+ messages in thread
From: Boris Brezillon @ 2016-08-14 8:57 UTC (permalink / raw)
To: Andrey Smirnov
Cc: linux-mtd, Richard Weinberger, David Woodhouse, Brian Norris,
linux-kernel
On Thu, 21 Jul 2016 14:59:18 -0700
Andrey Smirnov <andrew.smirnov@gmail.com> wrote:
> MTD_NAND_FSL_ELBC selects FSL_LBC that in turn depends on FSL_SOC, so
> depending on PPC instead of FSL_SOC leads to this message:
>
> warning: (MPC836x_RDK && MTD_NAND_FSL_ELBC &&
> MTD_NAND_FSL_UPM) selects FSL_LBC which has unmet direct
> dependencies (FSL_SOC)
>
> when doing
>
> make ARCH=powerpc \
> CROSS_COMPILE=powerpc-e500v2-linux-gnuspe- \
> allmodconfig"
>
> Changing dependency to FSL_SOC fixes that.
Applied the whole series.
Thanks,
Boris
>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
> drivers/mtd/nand/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
> index bcb519b..e528747 100644
> --- a/drivers/mtd/nand/Kconfig
> +++ b/drivers/mtd/nand/Kconfig
> @@ -426,7 +426,7 @@ config MTD_NAND_ORION
>
> config MTD_NAND_FSL_ELBC
> tristate "NAND support for Freescale eLBC controllers"
> - depends on PPC
> + depends on FSL_SOC
> select FSL_LBC
> help
> Various Freescale chips, including the 8313, include a NAND Flash
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-08-14 8:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-21 21:59 [PATCH] Kconfig: nand: Make MTD_NAND_FSL_ELBC depend on FSL_SOC Andrey Smirnov
2016-07-21 21:59 ` [PATCH] Kconfig: nand: Remove redundant dependency on MTD_NAND Andrey Smirnov
2016-07-21 21:59 ` [PATCH v3 1/2] mtd: nand: Error out if cmd_ctrl() is missing Andrey Smirnov
2016-07-21 21:59 ` [PATCH v3 2/2] mtd: nand: Get rid of needless 'goto' Andrey Smirnov
2016-08-14 8:57 ` [PATCH] Kconfig: nand: Make MTD_NAND_FSL_ELBC depend on FSL_SOC Boris Brezillon
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.