diff options
author | Dan Streetman <ddstreet@ieee.org> | 2015-05-28 22:21:31 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2015-06-03 04:51:23 +0200 |
commit | 3e648cbeb31be5cb84b9ec19822e2b85417f07c4 (patch) | |
tree | 4832384e797c3164b3d4321e49f13dd5a8c74c9d /drivers/crypto/nx/nx-842.h | |
parent | crypto: cryptd - Convert to new AEAD interface (diff) | |
download | linux-3e648cbeb31be5cb84b9ec19822e2b85417f07c4.tar.xz linux-3e648cbeb31be5cb84b9ec19822e2b85417f07c4.zip |
crypto: nx - prevent nx 842 load if no hw driver
Change the nx-842 common driver to wait for loading of both platform
drivers, and fail loading if the platform driver pointer is not set.
Add an independent platform driver pointer, that the platform drivers
set if they find they are able to load (i.e. if they find their platform
devicetree node(s)).
The problem is currently, the main nx-842 driver will stay loaded even
if there is no platform driver and thus no possible way it can do any
compression or decompression. This allows the crypto 842-nx driver
to load even if it won't actually work. For crypto compression users
(e.g. zswap) that expect an available crypto compression driver to
actually work, this is bad. This patch fixes that, so the 842-nx crypto
compression driver won't load if it doesn't have the driver and hardware
available to perform the compression.
Signed-off-by: Dan Streetman <ddstreet@ieee.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/nx/nx-842.h')
-rw-r--r-- | drivers/crypto/nx/nx-842.h | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/crypto/nx/nx-842.h b/drivers/crypto/nx/nx-842.h index 84b15b7448bb..1730f4da1cf6 100644 --- a/drivers/crypto/nx/nx-842.h +++ b/drivers/crypto/nx/nx-842.h @@ -105,6 +105,7 @@ static inline unsigned long nx842_get_pa(void *addr) #define SET_FIELD(v, m, val) (((v) & ~(m)) | (((val) << MASK_LSH(m)) & (m))) struct nx842_driver { + char *name; struct module *owner; struct nx842_constraints *constraints; @@ -117,15 +118,10 @@ struct nx842_driver { void *wrkmem); }; -void nx842_register_driver(struct nx842_driver *driver); -void nx842_unregister_driver(struct nx842_driver *driver); - - -/* To allow the main nx-compress module to load platform module */ -#define NX842_POWERNV_MODULE_NAME "nx-compress-powernv" -#define NX842_POWERNV_COMPAT_NAME "ibm,power-nx" -#define NX842_PSERIES_MODULE_NAME "nx-compress-pseries" -#define NX842_PSERIES_COMPAT_NAME "ibm,compression" - +struct nx842_driver *nx842_platform_driver(void); +bool nx842_platform_driver_set(struct nx842_driver *driver); +void nx842_platform_driver_unset(struct nx842_driver *driver); +bool nx842_platform_driver_get(void); +void nx842_platform_driver_put(void); #endif /* __NX_842_H__ */ |