mtd: rawnand: Add a helper to clarify the interface configuration
[ Upstream commit 961965c45c706175b24227868b1c12d72775e446 ] Name it nand_interface_is_sdr() which will make even more sense when nand_interface_is_nvddr() will be introduced. Use it when relevant. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210505213750.257417-2-miquel.raynal@bootlin.com Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
ae1e2bc7bf
commit
c91e5215a4
@@ -1246,7 +1246,7 @@ static int atmel_smc_nand_prepare_smcconf(struct atmel_nand *nand,
|
|||||||
nc = to_nand_controller(nand->base.controller);
|
nc = to_nand_controller(nand->base.controller);
|
||||||
|
|
||||||
/* DDR interface not supported. */
|
/* DDR interface not supported. */
|
||||||
if (conf->type != NAND_SDR_IFACE)
|
if (!nand_interface_is_sdr(conf))
|
||||||
return -ENOTSUPP;
|
return -ENOTSUPP;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -499,6 +499,15 @@ struct nand_interface_config {
|
|||||||
} timings;
|
} timings;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nand_interface_is_sdr - get the interface type
|
||||||
|
* @conf: The data interface
|
||||||
|
*/
|
||||||
|
static bool nand_interface_is_sdr(const struct nand_interface_config *conf)
|
||||||
|
{
|
||||||
|
return conf->type == NAND_SDR_IFACE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nand_get_sdr_timings - get SDR timing from data interface
|
* nand_get_sdr_timings - get SDR timing from data interface
|
||||||
* @conf: The data interface
|
* @conf: The data interface
|
||||||
@@ -506,7 +515,7 @@ struct nand_interface_config {
|
|||||||
static inline const struct nand_sdr_timings *
|
static inline const struct nand_sdr_timings *
|
||||||
nand_get_sdr_timings(const struct nand_interface_config *conf)
|
nand_get_sdr_timings(const struct nand_interface_config *conf)
|
||||||
{
|
{
|
||||||
if (conf->type != NAND_SDR_IFACE)
|
if (!nand_interface_is_sdr(conf))
|
||||||
return ERR_PTR(-EINVAL);
|
return ERR_PTR(-EINVAL);
|
||||||
|
|
||||||
return &conf->timings.sdr;
|
return &conf->timings.sdr;
|
||||||
|
Reference in New Issue
Block a user