[intel-sgx-kernel-dev] intel_sgx: use a common macro for kernel log format
diff mbox

Message ID 1490794312-24176-1-git-send-email-sean.j.christopherson@intel.com
State New
Headers show

Commit Message

Sean Christopherson March 29, 2017, 1:31 p.m. UTC
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 drivers/platform/x86/intel_sgx.h | 30 ++++++++++--------------------
 1 file changed, 10 insertions(+), 20 deletions(-)

Comments

Jarkko Sakkinen April 4, 2017, 6:01 p.m. UTC | #1
On Wed, Mar 29, 2017 at 06:31:52AM -0700, Sean Christopherson wrote:
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>

Thanks, I'll just apply this.

/Jarkko

> ---
>  drivers/platform/x86/intel_sgx.h | 30 ++++++++++--------------------
>  1 file changed, 10 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel_sgx.h b/drivers/platform/x86/intel_sgx.h
> index adb5b17..5326eb8 100644
> --- a/drivers/platform/x86/intel_sgx.h
> +++ b/drivers/platform/x86/intel_sgx.h
> @@ -175,26 +175,16 @@ extern bool sgx_has_sgx2;
>  extern const struct vm_operations_struct sgx_vm_ops;
>  extern atomic_t sgx_nr_pids;
>  
> -#define sgx_dbg(encl, fmt, ...)						\
> -	pr_debug_ratelimited("intel_sgx: [%d:0x%p] " fmt,		\
> -			     pid_nr((encl)->tgid_ctx->tgid),		\
> -			     (void *)(encl)->base, ##__VA_ARGS__)
> -#define sgx_info(encl, fmt, ...)					\
> -	pr_info_ratelimited("intel_sgx: [%d:0x%p] " fmt,		\
> -			    pid_nr((encl)->tgid_ctx->tgid),		\
> -			    (void *)(encl)->base, ##__VA_ARGS__)
> -#define sgx_warn(encl, fmt, ...)					\
> -	pr_warn_ratelimited("intel_sgx: [%d:0x%p] " fmt,		\
> -			    pid_nr((encl)->tgid_ctx->tgid),		\
> -			    (void *)(encl)->base, ##__VA_ARGS__)
> -#define sgx_err(encl, fmt, ...)						\
> -	pr_err_ratelimited("intel_sgx: [%d:0x%p] " fmt,			\
> -			   pid_nr((encl)->tgid_ctx->tgid),		\
> -			   (void *)(encl)->base, ##__VA_ARGS__)
> -#define sgx_crit(encl, fmt, ...)					\
> -	pr_crit_ratelimited("intel_sgx: [%d:0x%p] " fmt,		\
> -			   pid_nr((encl)->tgid_ctx->tgid),		\
> -			   (void *)(encl)->base, ##__VA_ARGS__)
> +#define sgx_pr_ratelimited(level, encl, fmt, ...)			  \
> +	pr_ ## level ## _ratelimited("intel_sgx: [%d:0x%p] " fmt,	  \
> +				     pid_nr((encl)->tgid_ctx->tgid),	  \
> +				     (void *)(encl)->base, ##__VA_ARGS__)
> +
> +#define sgx_dbg(encl, fmt, ...) sgx_pr_ratelimited(debug, encl, fmt, ##__VA_ARGS__)
> +#define sgx_info(encl, fmt, ...) sgx_pr_ratelimited(info, encl, fmt, ##__VA_ARGS__)
> +#define sgx_warn(encl, fmt, ...) sgx_pr_ratelimited(warn, encl, fmt, ##__VA_ARGS__)
> +#define sgx_err(encl, fmt, ...) sgx_pr_ratelimited(err, encl, fmt, ##__VA_ARGS__)
> +#define sgx_crit(encl, fmt, ...) sgx_pr_ratelimited(crit, encl, fmt, ##__VA_ARGS__)
>  
>  long sgx_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
>  #ifdef CONFIG_COMPAT
> -- 
> 2.7.4
> 
> _______________________________________________
> intel-sgx-kernel-dev mailing list
> intel-sgx-kernel-dev@lists.01.org
> https://lists.01.org/mailman/listinfo/intel-sgx-kernel-dev

Patch
diff mbox

diff --git a/drivers/platform/x86/intel_sgx.h b/drivers/platform/x86/intel_sgx.h
index adb5b17..5326eb8 100644
--- a/drivers/platform/x86/intel_sgx.h
+++ b/drivers/platform/x86/intel_sgx.h
@@ -175,26 +175,16 @@  extern bool sgx_has_sgx2;
 extern const struct vm_operations_struct sgx_vm_ops;
 extern atomic_t sgx_nr_pids;
 
-#define sgx_dbg(encl, fmt, ...)						\
-	pr_debug_ratelimited("intel_sgx: [%d:0x%p] " fmt,		\
-			     pid_nr((encl)->tgid_ctx->tgid),		\
-			     (void *)(encl)->base, ##__VA_ARGS__)
-#define sgx_info(encl, fmt, ...)					\
-	pr_info_ratelimited("intel_sgx: [%d:0x%p] " fmt,		\
-			    pid_nr((encl)->tgid_ctx->tgid),		\
-			    (void *)(encl)->base, ##__VA_ARGS__)
-#define sgx_warn(encl, fmt, ...)					\
-	pr_warn_ratelimited("intel_sgx: [%d:0x%p] " fmt,		\
-			    pid_nr((encl)->tgid_ctx->tgid),		\
-			    (void *)(encl)->base, ##__VA_ARGS__)
-#define sgx_err(encl, fmt, ...)						\
-	pr_err_ratelimited("intel_sgx: [%d:0x%p] " fmt,			\
-			   pid_nr((encl)->tgid_ctx->tgid),		\
-			   (void *)(encl)->base, ##__VA_ARGS__)
-#define sgx_crit(encl, fmt, ...)					\
-	pr_crit_ratelimited("intel_sgx: [%d:0x%p] " fmt,		\
-			   pid_nr((encl)->tgid_ctx->tgid),		\
-			   (void *)(encl)->base, ##__VA_ARGS__)
+#define sgx_pr_ratelimited(level, encl, fmt, ...)			  \
+	pr_ ## level ## _ratelimited("intel_sgx: [%d:0x%p] " fmt,	  \
+				     pid_nr((encl)->tgid_ctx->tgid),	  \
+				     (void *)(encl)->base, ##__VA_ARGS__)
+
+#define sgx_dbg(encl, fmt, ...) sgx_pr_ratelimited(debug, encl, fmt, ##__VA_ARGS__)
+#define sgx_info(encl, fmt, ...) sgx_pr_ratelimited(info, encl, fmt, ##__VA_ARGS__)
+#define sgx_warn(encl, fmt, ...) sgx_pr_ratelimited(warn, encl, fmt, ##__VA_ARGS__)
+#define sgx_err(encl, fmt, ...) sgx_pr_ratelimited(err, encl, fmt, ##__VA_ARGS__)
+#define sgx_crit(encl, fmt, ...) sgx_pr_ratelimited(crit, encl, fmt, ##__VA_ARGS__)
 
 long sgx_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
 #ifdef CONFIG_COMPAT