habanalabs: Cancel pr_fmt() definition dependency on includes order
authorTomer Tayar <ttayar@habana.ai>
Wed, 10 Apr 2019 12:18:46 +0000 (15:18 +0300)
committerOded Gabbay <oded.gabbay@gmail.com>
Wed, 10 Apr 2019 12:18:46 +0000 (15:18 +0300)
pr_fmt() should be defined before including linux/printk.h, either
directly or indirectly, in order to avoid redefinition of the macro.
Currently the macro definition is in habanalabs.h, which is included in
many files, and that makes the addition/reorder of includes to be prone
to compilation errors.
This patch cancels this dependency by defining the macro only in the few
source files that use it.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
drivers/misc/habanalabs/device.c
drivers/misc/habanalabs/habanalabs.h
drivers/misc/habanalabs/habanalabs_drv.c

index 25bfb093ff26fe47dccb277725fc2a5af13e9b70..a88f7be23c7fd0f6a194c5edfb1fdb26b68dad53 100644 (file)
@@ -5,6 +5,8 @@
  * All Rights Reserved.
  */
 
+#define pr_fmt(fmt)                    "habanalabs: " fmt
+
 #include "habanalabs.h"
 
 #include <linux/pci.h>
index 2f02bb55f66aa2ef8896b7cac524af0e3e724286..86bd5298efd6df1e8d7e0653ab64f5fad8470e60 100644 (file)
@@ -11,8 +11,6 @@
 #include "include/armcp_if.h"
 #include "include/qman_if.h"
 
-#define pr_fmt(fmt)                    "habanalabs: " fmt
-
 #include <linux/cdev.h>
 #include <linux/iopoll.h>
 #include <linux/irqreturn.h>
index 1667df7ca64c53515e448ab0d7e1d1acbe3ec8f6..5f4d155be767bfe1a20da4184581c54d8a1809a8 100644 (file)
@@ -6,6 +6,8 @@
  *
  */
 
+#define pr_fmt(fmt)            "habanalabs: " fmt
+
 #include "habanalabs.h"
 
 #include <linux/pci.h>