diff options
author | Joel Fernandes <joelf@ti.com> | 2013-08-18 01:56:11 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2013-08-21 07:27:58 -0400 |
commit | 016af9b5c51e58ecda573f14dabe85a67363b20f (patch) | |
tree | d2e453bc373918595111ccc2ef52c4ad17c12557 | |
parent | 257aff515409f9455edff3a946344e71baf9e116 (diff) |
crypto: omap-aes - Add useful debug macros
When DEBUG is enabled, these macros can be used to print variables in integer
and hex format, and clearly display which registers, offsets and values are
being read/written , including printing the names of the offsets and their values.
Using statement expression macros in read path as,
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Joel Fernandes <joelf@ti.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | drivers/crypto/omap-aes.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c index 5f7980586850..e5b2120a12b9 100644 --- a/drivers/crypto/omap-aes.c +++ b/drivers/crypto/omap-aes.c | |||
@@ -13,7 +13,9 @@ | |||
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #define pr_fmt(fmt) "%s: " fmt, __func__ | 16 | #define pr_fmt(fmt) "%20s: " fmt, __func__ |
17 | #define prn(num) pr_debug(#num "=%d\n", num) | ||
18 | #define prx(num) pr_debug(#num "=%x\n", num) | ||
17 | 19 | ||
18 | #include <linux/err.h> | 20 | #include <linux/err.h> |
19 | #include <linux/module.h> | 21 | #include <linux/module.h> |
@@ -172,16 +174,36 @@ struct omap_aes_dev { | |||
172 | static LIST_HEAD(dev_list); | 174 | static LIST_HEAD(dev_list); |
173 | static DEFINE_SPINLOCK(list_lock); | 175 | static DEFINE_SPINLOCK(list_lock); |
174 | 176 | ||
177 | #ifdef DEBUG | ||
178 | #define omap_aes_read(dd, offset) \ | ||
179 | ({ \ | ||
180 | int _read_ret; \ | ||
181 | _read_ret = __raw_readl(dd->io_base + offset); \ | ||
182 | pr_debug("omap_aes_read(" #offset "=%#x)= %#x\n", \ | ||
183 | offset, _read_ret); \ | ||
184 | _read_ret; \ | ||
185 | }) | ||
186 | #else | ||
175 | static inline u32 omap_aes_read(struct omap_aes_dev *dd, u32 offset) | 187 | static inline u32 omap_aes_read(struct omap_aes_dev *dd, u32 offset) |
176 | { | 188 | { |
177 | return __raw_readl(dd->io_base + offset); | 189 | return __raw_readl(dd->io_base + offset); |
178 | } | 190 | } |
191 | #endif | ||
179 | 192 | ||
193 | #ifdef DEBUG | ||
194 | #define omap_aes_write(dd, offset, value) \ | ||
195 | do { \ | ||
196 | pr_debug("omap_aes_write(" #offset "=%#x) value=%#x\n", \ | ||
197 | offset, value); \ | ||
198 | __raw_writel(value, dd->io_base + offset); \ | ||
199 | } while (0) | ||
200 | #else | ||
180 | static inline void omap_aes_write(struct omap_aes_dev *dd, u32 offset, | 201 | static inline void omap_aes_write(struct omap_aes_dev *dd, u32 offset, |
181 | u32 value) | 202 | u32 value) |
182 | { | 203 | { |
183 | __raw_writel(value, dd->io_base + offset); | 204 | __raw_writel(value, dd->io_base + offset); |
184 | } | 205 | } |
206 | #endif | ||
185 | 207 | ||
186 | static inline void omap_aes_write_mask(struct omap_aes_dev *dd, u32 offset, | 208 | static inline void omap_aes_write_mask(struct omap_aes_dev *dd, u32 offset, |
187 | u32 value, u32 mask) | 209 | u32 value, u32 mask) |