mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 23:13:01 +02:00
mmc: crypto: add mmc_from_crypto_profile()
Add a helper function that encapsulates a container_of expression. For now there is just one user but soon there will be more. Signed-off-by: Eric Biggers <ebiggers@google.com> Message-ID: <20241213041958.202565-7-ebiggers@kernel.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
parent
f2d3630f1c
commit
08a7ead324
|
@ -25,10 +25,7 @@ static const struct cqhci_crypto_alg_entry {
|
||||||
static inline struct cqhci_host *
|
static inline struct cqhci_host *
|
||||||
cqhci_host_from_crypto_profile(struct blk_crypto_profile *profile)
|
cqhci_host_from_crypto_profile(struct blk_crypto_profile *profile)
|
||||||
{
|
{
|
||||||
struct mmc_host *mmc =
|
return mmc_from_crypto_profile(profile)->cqe_private;
|
||||||
container_of(profile, struct mmc_host, crypto_profile);
|
|
||||||
|
|
||||||
return mmc->cqe_private;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cqhci_crypto_program_key(struct cqhci_host *cq_host,
|
static int cqhci_crypto_program_key(struct cqhci_host *cq_host,
|
||||||
|
|
|
@ -590,6 +590,14 @@ static inline struct mmc_host *mmc_from_priv(void *priv)
|
||||||
return container_of(priv, struct mmc_host, private);
|
return container_of(priv, struct mmc_host, private);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_MMC_CRYPTO
|
||||||
|
static inline struct mmc_host *
|
||||||
|
mmc_from_crypto_profile(struct blk_crypto_profile *profile)
|
||||||
|
{
|
||||||
|
return container_of(profile, struct mmc_host, crypto_profile);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define mmc_host_is_spi(host) ((host)->caps & MMC_CAP_SPI)
|
#define mmc_host_is_spi(host) ((host)->caps & MMC_CAP_SPI)
|
||||||
|
|
||||||
#define mmc_dev(x) ((x)->parent)
|
#define mmc_dev(x) ((x)->parent)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user