Skip to contentSkip to conversation

Staging: crystalhd: Replace the BCMLOG_ERR macro with pr_err

PATCH In review Jorgyano Vieira 3 participants 8 messages Feb 18, 2012 – Feb 25, 2012 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 3/3 Staging: crystalhd: Replace the BCMLOG_ERR macro with pr_err

Replace the usage of BCMLOG_ERR with pr_err and remove the macro definition. Also added pr_fmt to identify the driver error messages.

---
 drivers/staging/crystalhd/crystalhd_cmds.c |   68 ++++++++--------
 drivers/staging/crystalhd/crystalhd_hw.c   |  119 ++++++++++++++--------------
 drivers/staging/crystalhd/crystalhd_lnx.c  |   96 +++++++++++-----------
 drivers/staging/crystalhd/crystalhd_lnx.h  |    4 +-
 drivers/staging/crystalhd/crystalhd_misc.c |   70 ++++++++--------
 drivers/staging/crystalhd/crystalhd_misc.h |   10 +--
 6 files changed, 181 insertions(+), 186 deletions(-)
drivers/staging/crystalhd/crystalhd_cmds.c +34 -34
index 3735ed3..46fac01 100644
@@ -75,12 +75,12 @@ static enum BC_STATUS bc_cproc_notify_mode(struct crystalhd_cmd *ctx,
 	int rc = 0, i = 0;
 
 	if (!ctx || !idata) {
-		BCMLOG_ERR("Invalid Arg!!\n");
+		pr_err("%s: Invalid Arg!!\n", __func__);
 		return BC_STS_INV_ARG;
 	}
 
 	if (ctx->user[idata->u_id].mode != DTS_MODE_INV) {
-		BCMLOG_ERR("Close the handle first..\n");
+		pr_err("Close the handle first..\n");
 		return BC_STS_ERR_USAGE;
 	}
 	if (idata->udata.u.NotifyMode.Mode == DTS_MONITOR_MODE) {
@@ -88,14 +88,14 @@ static enum BC_STATUS bc_cproc_notify_mode(struct crystalhd_cmd *ctx,
 		return BC_STS_SUCCESS;
 	}
 	if (ctx->state != BC_LINK_INVALID) {
-		BCMLOG_ERR("Link invalid state %d\n", ctx->state);
+		pr_err("%s: Link invalid state %d\n", __func__, ctx->state);
 		return BC_STS_ERR_USAGE;
 	}
 	/* Check for duplicate playback sessions..*/
 	for (i = 0; i < BC_LINK_MAX_OPENS; i++) {
 		if (ctx->user[i].mode == DTS_DIAG_MODE ||
 		    ctx->user[i].mode == DTS_PLAYBACK_MODE) {
-			BCMLOG_ERR("multiple playback sessions are not "
+			pr_err("multiple playback sessions are not "
 				   "supported..\n");
 			return BC_STS_ERR_USAGE;
 		}
@@ -116,7 +116,7 @@ static enum BC_STATUS bc_cproc_get_version(struct crystalhd_cmd *ctx,
 {
 
 	if (!ctx || !idata) {
-		BCMLOG_ERR("Invalid Arg!!\n");
+		pr_err("%s: Invalid Arg!!\n", __func__);
 		return BC_STS_INV_ARG;
 	}
 	idata->udata.u.VerInfo.DriverMajor = crystalhd_kmod_major;
@@ -130,7 +130,7 @@ static enum BC_STATUS bc_cproc_get_hwtype(struct crystalhd_cmd *ctx,
 					struct crystalhd_ioctl_data *idata)
 {
 	if (!ctx || !idata) {
-		BCMLOG_ERR("Invalid Arg!!\n");
+		pr_err("%s: Invalid Arg!!\n", __func__);
 		return BC_STS_INV_ARG;
 	}
 
@@ -198,7 +198,7 @@ static enum BC_STATUS bc_cproc_mem_rd(struct crystalhd_cmd *ctx,
 		return BC_STS_INV_ARG;
 
 	if (idata->udata.u.devMem.NumDwords > (idata->add_cdata_sz / 4)) {
-		BCMLOG_ERR("insufficient buffer\n");
+		pr_err("%s: insufficient buffer\n", __func__);
 		return BC_STS_INV_ARG;
 	}
 	sts = crystalhd_mem_rd(ctx->adp, idata->udata.u.devMem.StartOff,
@@ -217,7 +217,7 @@ static enum BC_STATUS bc_cproc_mem_wr(struct crystalhd_cmd *ctx,
 		return BC_STS_INV_ARG;
 
 	if (idata->udata.u.devMem.NumDwords > (idata->add_cdata_sz / 4)) {
-		BCMLOG_ERR("insufficient buffer\n");
+		pr_err("%s: insufficient buffer\n", __func__);
 		return BC_STS_INV_ARG;
 	}
 
@@ -250,7 +250,7 @@ static enum BC_STATUS bc_cproc_cfg_rd(struct crystalhd_cmd *ctx,
 	for (ix = 0; ix < cnt; ix++) {
 		sts = crystalhd_pci_cfg_rd(ctx->adp, off, len, &temp[ix]);
 		if (sts != BC_STS_SUCCESS) {
-			BCMLOG_ERR("config read : %d\n", sts);
+			pr_err("config read : %d\n", sts);
 			return sts;
 		}
 		off += len;
@@ -282,7 +282,7 @@ static enum BC_STATUS bc_cproc_cfg_wr(struct crystalhd_cmd *ctx,
 	for (ix = 0; ix < cnt; ix++) {
 		sts = crystalhd_pci_cfg_wr(ctx->adp, off, len, temp[ix]);
 		if (sts != BC_STS_SUCCESS) {
-			BCMLOG_ERR("config write : %d\n", sts);
+			pr_err("config write : %d\n", sts);
 			return sts;
 		}
 		off += len;
@@ -297,12 +297,12 @@ static enum BC_STATUS bc_cproc_download_fw(struct crystalhd_cmd *ctx,
 	enum BC_STATUS sts = BC_STS_SUCCESS;
 
 	if (!ctx || !idata || !idata->add_cdata || !idata->add_cdata_sz) {
-		BCMLOG_ERR("Invalid Arg!!\n");
+		pr_err("%s: Invalid Arg!!\n", __func__);
 		return BC_STS_INV_ARG;
 	}
 
 	if (ctx->state != BC_LINK_INVALID) {
-		BCMLOG_ERR("Link invalid state %d\n", ctx->state);
+		pr_err("%s: Link invalid state %d\n", __func__, ctx->state);
 		return BC_STS_ERR_USAGE;
 	}
 
@@ -310,7 +310,7 @@ static enum BC_STATUS bc_cproc_download_fw(struct crystalhd_cmd *ctx,
 				  idata->add_cdata_sz);
 
 	if (sts != BC_STS_SUCCESS) {
-		BCMLOG_ERR("Firmware Download Failure!! - %d\n", sts);
+		pr_err("Firmware Download Failure!! - %d\n", sts);
 	} else
 		ctx->state |= BC_LINK_INIT;
 
@@ -337,7 +337,7 @@ static enum BC_STATUS bc_cproc_do_fw_cmd(struct crystalhd_cmd *ctx,
 	uint32_t *cmd;
 
 	if (!(ctx->state & BC_LINK_INIT)) {
-		BCMLOG_ERR("Link invalid state %d\n", ctx->state);
+		pr_err("%s: Link invalid state %d\n", __func__, ctx->state);
 		return BC_STS_ERR_USAGE;
 	}
 
@@ -377,7 +377,7 @@ static void bc_proc_in_completion(struct crystalhd_dio_req *dio_hnd,
 				  wait_queue_head_t *event, enum BC_STATUS sts)
 {
 	if (!dio_hnd || !event) {
-		BCMLOG_ERR("Invalid Arg!!\n");
+		pr_err("%s: Invalid Arg!!\n", __func__);
 		return;
 	}
 	if (sts == BC_STS_IO_USER_ABORT)
@@ -418,7 +418,7 @@ static enum BC_STATUS bc_cproc_hw_txdma(struct crystalhd_cmd *ctx,
 	int rc = 0;
 
 	if (!ctx || !idata || !dio) {
-		BCMLOG_ERR("Invalid Arg!!\n");
+		pr_err("%s: Invalid Arg!!\n", __func__);
 		return BC_STS_INV_ARG;
 	}
 
@@ -477,14 +477,14 @@ static enum BC_STATUS bc_cproc_check_inbuffs(bool pin, void *ubuff, uint32_t ub_
 					uint32_t uv_off, bool en_422)
 {
 	if (!ubuff || !ub_sz) {
-		BCMLOG_ERR("%s->Invalid Arg %p %x\n",
+		pr_err("%s->Invalid Arg %p %x\n",
 			((pin) ? "TX" : "RX"), ubuff, ub_sz);
 		return BC_STS_INV_ARG;
 	}
 
 	/* Check for alignment */
 	if (((uintptr_t)ubuff) & 0x03) {
-		BCMLOG_ERR("%s-->Un-aligned address not implemented yet.. %p\n",
+		pr_err("%s-->Un-aligned address not implemented yet.. %p\n",
 				((pin) ? "TX" : "RX"), ubuff);
 		return BC_STS_NOT_IMPL;
 	}
@@ -492,12 +492,12 @@ static enum BC_STATUS bc_cproc_check_inbuffs(bool pin, void *ubuff, uint32_t ub_
 		return BC_STS_SUCCESS;
 
 	if (!en_422 && !uv_off) {
-		BCMLOG_ERR("Need UV offset for 420 mode.\n");
+		pr_err("Need UV offset for 420 mode.\n");
 		return BC_STS_INV_ARG;
 	}
 
 	if (en_422 && uv_off) {
-		BCMLOG_ERR("UV offset in 422 mode ??\n");
+		pr_err("UV offset in 422 mode ??\n");
 		return BC_STS_INV_ARG;
 	}
 
@@ -513,7 +513,7 @@ static enum BC_STATUS bc_cproc_proc_input(struct crystalhd_cmd *ctx,
 	enum BC_STATUS sts = BC_STS_SUCCESS;
 
 	if (!ctx || !idata) {
-		BCMLOG_ERR("Invalid Arg!!\n");
+		pr_err("%s: Invalid Arg!!\n", __func__);
 		return BC_STS_INV_ARG;
 	}
 
@@ -526,7 +526,7 @@ static enum BC_STATUS bc_cproc_proc_input(struct crystalhd_cmd *ctx,
 
 	sts = crystalhd_map_dio(ctx->adp, ubuff, ub_sz, 0, 0, 1, &dio_hnd);
 	if (sts != BC_STS_SUCCESS) {
-		BCMLOG_ERR("dio map - %d\n", sts);
+		pr_err("%s: dio map - %d\n", __func__, sts);
 		return sts;
 	}
 
@@ -550,7 +550,7 @@ static enum BC_STATUS bc_cproc_add_cap_buff(struct crystalhd_cmd *ctx,
 	enum BC_STATUS sts = BC_STS_SUCCESS;
 
 	if (!ctx || !idata) {
-		BCMLOG_ERR("Invalid Arg!!\n");
+		pr_err("%s: Invalid Arg!!\n", __func__);
 		return BC_STS_INV_ARG;
 	}
 
@@ -566,7 +566,7 @@ static enum BC_STATUS bc_cproc_add_cap_buff(struct crystalhd_cmd *ctx,
 	sts = crystalhd_map_dio(ctx->adp, ubuff, ub_sz, uv_off,
 			      en_422, 0, &dio_hnd);
 	if (sts != BC_STS_SUCCESS) {
-		BCMLOG_ERR("dio map - %d\n", sts);
+		pr_err("%s: dio map - %d\n", __func__, sts);
 		return sts;
 	}
 
@@ -606,7 +606,7 @@ static enum BC_STATUS bc_cproc_fetch_frame(struct crystalhd_cmd *ctx,
 	struct BC_DEC_OUT_BUFF *frame;
 
 	if (!ctx || !idata) {
-		BCMLOG_ERR("Invalid Arg!!\n");
+		pr_err("%s: Invalid Arg!!\n", __func__);
 		return BC_STS_INV_ARG;
 	}
 
@@ -658,7 +658,7 @@ static enum BC_STATUS bc_cproc_flush_cap_buffs(struct crystalhd_cmd *ctx,
 	uint32_t count;
 
 	if (!ctx || !idata) {
-		BCMLOG_ERR("Invalid Arg!!\n");
+		pr_err("%s: Invalid Arg!!\n", __func__);
 		return BC_STS_INV_ARG;
 	}
 
@@ -691,7 +691,7 @@ static enum BC_STATUS bc_cproc_get_stats(struct crystalhd_cmd *ctx,
 	struct crystalhd_hw_stats	hw_stats;
 
 	if (!ctx || !idata) {
-		BCMLOG_ERR("Invalid Arg!!\n");
+		pr_err("%s: Invalid Arg!!\n", __func__);
 		return BC_STS_INV_ARG;
 	}
 
@@ -732,7 +732,7 @@ static enum BC_STATUS bc_cproc_chg_clk(struct crystalhd_cmd *ctx,
 	enum BC_STATUS sts = BC_STS_SUCCESS;
 
 	if (!ctx || !idata) {
-		BCMLOG_ERR("Invalid Arg!!\n");
+		pr_err("%s: Invalid Arg!!\n", __func__);
 		return BC_STS_INV_ARG;
 	}
 
@@ -805,7 +805,7 @@ enum BC_STATUS crystalhd_suspend(struct crystalhd_cmd *ctx,
 	enum BC_STATUS sts = BC_STS_SUCCESS;
 
 	if (!ctx || !idata) {
-		BCMLOG_ERR("Invalid Parameters\n");
+		pr_err("%s: Invalid Parameters\n", __func__);
 		return BC_STS_ERROR;
 	}
 
@@ -885,7 +885,7 @@ enum BC_STATUS crystalhd_user_open(struct crystalhd_cmd *ctx,
 	struct crystalhd_user *uc;
 
 	if (!ctx || !user_ctx) {
-		BCMLOG_ERR("Invalid arg..\n");
+		pr_err("%s: Invalid arg..\n", __func__);
 		return BC_STS_INV_ARG;
 	}
 
@@ -958,7 +958,7 @@ enum BC_STATUS __devinit crystalhd_setup_cmd_context(struct crystalhd_cmd *ctx,
 	int i = 0;
 
 	if (!ctx || !adp) {
-		BCMLOG_ERR("Invalid arg!!\n");
+		pr_err("%s: Invalid arg!!\n", __func__);
 		return BC_STS_INV_ARG;
 	}
 
@@ -1016,12 +1016,12 @@ crystalhd_cmd_proc crystalhd_get_cmd_proc(struct crystalhd_cmd *ctx, uint32_t cm
 	unsigned int i, tbl_sz;
 
 	if (!ctx) {
-		BCMLOG_ERR("Invalid arg.. Cmd[%d]\n", cmd);
+		pr_err("Invalid arg.. Cmd[%d]\n", cmd);
 		return NULL;
 	}
 
 	if ((cmd != BCM_IOC_GET_DRV_STAT) && (ctx->state & BC_LINK_SUSPEND)) {
-		BCMLOG_ERR("Invalid State [suspend Set].. Cmd[%d]\n", cmd);
+		pr_err("Invalid State [suspend Set].. Cmd[%d]\n", cmd);
 		return NULL;
 	}
 
@@ -1054,7 +1054,7 @@ crystalhd_cmd_proc crystalhd_get_cmd_proc(struct crystalhd_cmd *ctx, uint32_t cm
 bool crystalhd_cmd_interrupt(struct crystalhd_cmd *ctx)
 {
 	if (!ctx) {
-		BCMLOG_ERR("Invalid arg..\n");
+		pr_err("%s: Invalid arg..\n", __func__);
 		return 0;
 	}
 
drivers/staging/crystalhd/crystalhd_hw.c +60 -59

461 lines not on this page · raw message

drivers/staging/crystalhd/crystalhd_lnx.c +48 -48

371 lines not on this page · raw message

drivers/staging/crystalhd/crystalhd_lnx.h +2 -2
index a2b5a56..6570c46 100644
@@ -27,6 +27,8 @@
 #ifndef _CRYSTALHD_LNX_H_
 #define _CRYSTALHD_LNX_H_
 
+#include "crystalhd_cmds.h"
+
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -48,8 +50,6 @@
 #include <asm/system.h>
 #include <linux/uaccess.h>
 
-#include "crystalhd_cmds.h"
-
 #define CRYSTAL_HD_NAME		"Broadcom Crystal HD Decoder (BCM70012) Driver"
 
 
drivers/staging/crystalhd/crystalhd_misc.c +35 -35

275 lines not on this page · raw message

drivers/staging/crystalhd/crystalhd_misc.h +2 -8
index d2f7256..77e4cb2 100644
@@ -28,6 +28,8 @@
 #ifndef _CRYSTALHD_MISC_H_
 #define _CRYSTALHD_MISC_H_
 
+#define pr_fmt(fmt)	KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -209,12 +211,4 @@ do {					\
 		printk(fmt, ##args);	\
 } while (0)
 
-
-#define BCMLOG_ERR(fmt, args...)				\
-do {								\
-	if (g_linklog_level & BCMLOG_ERROR)			\
-		printk(KERN_ERR "*ERR*:%s:%d: "fmt,		\
-				__FILE__, __LINE__, ##args);	\
-} while (0)
-
 #endif
Signature · 1 line
1.7.2.5
#1 lore raw
Quoted 2 lines · Jorgyano Vieira

Replace the usage of BCMLOG_ERR with pr_err and remove the macro definition. Also added pr_fmt to identify the driver error messages.

Hi Jorgyano.

Couple of generic comments.

o Please look for and fix spelling errors at the same time.
o Coalesce formats, don't worry about 80 columns for that.
o pr_fmt needs to be #defined before any #include that might directly or indirectly #include kernel.h/printk.h use 'strings <path>/built-in.o | grep "^<.>"' to verify.
o [kv][kzm]alloc failures don't need specific OOM messages as the generic function does a dump_stack
o argument alignment could be after the open parenthesis.

for example...

drivers/staging/crystalhd/crystalhd_cmds.c static enum BC_STATUS bc_cproc_notify_mode(struct crystalhd_cmd *ctx, · line 98

Quoted 5 lines
drivers/staging/crystalhd/crystalhd_cmds.c +1 -1
 	for (i = 0; i < BC_LINK_MAX_OPENS; i++) {
 		if (ctx->user[i].mode == DTS_DIAG_MODE ||
 		    ctx->user[i].mode == DTS_PLAYBACK_MODE) {
-			BCMLOG_ERR("multiple playback sessions are not "
+			pr_err("multiple playback sessions are not "

[]

drivers/staging/crystalhd/crystalhd_hw.c static enum BC_STATUS crystalhd_hw_fill_desc(struct crystalhd_dio_req *ioreq, · line 772

Quoted 8 lines
drivers/staging/crystalhd/crystalhd_hw.c +1 -1
@@ -766,7 +767,7 @@ static enum BC_STATUS crystalhd_hw_fill_desc(struct crystalhd_dio_req *ioreq,
 	crystalhd_hw_dump_desc(desc, last_desc_ix, 1);
 
 	if (count != xfr_sz) {
-		BCMLOG_ERR("interal error sz curr:%x exp:%x\n", count, xfr_sz);
+		pr_err("interal error sz curr:%x exp:%x\n", count, xfr_sz);
 		return BC_STS_ERROR;
 	}

[]

Quoted 10 lines
drivers/staging/crystalhd/crystalhd_hw.c +1 -1
@@ -1950,7 +1951,7 @@ enum BC_STATUS crystalhd_hw_setup_dma_rings(struct crystalhd_hw *hw)
 	for (i = 0; i < BC_RX_LIST_CNT; i++) {
 		rpkt = kzalloc(sizeof(*rpkt), GFP_KERNEL);
 		if (!rpkt) {
-			BCMLOG_ERR("Insufficient Memory For RX\n");
+			pr_err("Insufficient Memory For RX\n");
 			crystalhd_hw_free_dma_rings(hw);
 			return BC_STS_INSUFF_RES;
 		}

drivers/staging/crystalhd/crystalhd_hw.c enum BC_STATUS crystalhd_hw_setup_dma_rings(struct crystalhd_hw *hw) · line 1966

Quoted 8 lines
drivers/staging/crystalhd/crystalhd_hw.c +1 -1
@@ -1959,7 +1960,7 @@ enum BC_STATUS crystalhd_hw_setup_dma_rings(struct crystalhd_hw *hw)
 		if (mem) {
 			memset(mem, 0, mem_len);
 		} else {
-			BCMLOG_ERR("Insufficient Memory For RX\n");
+			pr_err("Insufficient Memory For RX\n");
 			crystalhd_hw_free_dma_rings(hw);
 			kfree(rpkt);
 			return BC_STS_INSUFF_RES;

[]

drivers/staging/crystalhd/crystalhd_lnx.c static int chd_dec_release_cdata(struct crystalhd_adp *adp, · line 183

Quoted 9 lines
drivers/staging/crystalhd/crystalhd_lnx.c +1 -1
@@ -177,7 +177,7 @@ static int chd_dec_release_cdata(struct crystalhd_adp *adp,
 		rc = crystalhd_user_data(ua_off, io->add_cdata,
 					io->add_cdata_sz, 1);
 		if (rc) {
-			BCMLOG_ERR("failed to push add_cdata sz:%x ua_off:%x\n",
+			pr_err("failed to push add_cdata sz:%x ua_off:%x\n",
 				   io->add_cdata_sz, (unsigned int)ua_off);
 			return -ENODATA;
 		}

[]

Quoted 9 lines
drivers/staging/crystalhd/crystalhd_misc.c +1 -1
@@ -383,7 +383,7 @@ void *bc_kern_dma_alloc(struct crystalhd_adp *adp, uint32_t sz,
 	void *temp = NULL;
 
 	if (!adp || !sz || !phy_addr) {
-		BCMLOG_ERR("Invalide Arg..\n");
+		pr_err("%s: Invalide Arg..\n", __func__);
 		return temp;
 	}
 
#2 lore raw
Quoted 5 lines · Joe Perches
Quoted 2 lines · Jorgyano Vieira

Replace the usage of BCMLOG_ERR with pr_err and remove the macro definition. Also added pr_fmt to identify the driver error messages.

Hi Jorgyano.

Hi Joe,

Quoted 4 lines

Couple of generic comments.

o Please look for and fix spelling errors at the same time.

People are blamed for doing more-then-one-thing-per-patch, so I prefer send only one big patch fixing all spelling errors and coding style on further work.

Quoted 4 lines

o Coalesce formats, don't worry about 80 columns for that.
o pr_fmt needs to be #defined before any #include that might directly or indirectly #include kernel.h/printk.h use 'strings <path>/built-in.o | grep "^<.>"' to verify.

yes, I take care of this:--- a/drivers/staging/crystalhd/crystalhd_misc.h +++ b/drivers/staging/crystalhd/crystalhd_misc.h
@@ -28,6 +28,8 @@
#ifndef _CRYSTALHD_MISC_H_
#define _CRYSTALHD_MISC_H_

+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>

Quoted 2 lines

o [kv][kzm]alloc failures don't need specific OOM messages as the generic function does a dump_stack

You are right, this code really have some unnecessary messages, perhaps it could be done on further patch, all at once.
The main idea on this patch is just replace convert the old macro to pr_err.

Quoted 1 line

o argument alignment could be after the open parenthesis.

yes, it could be done together with the coding style issues.

there is a lot of work to do on this driver.

Many thanks for your comments.

regards,
Jorgyano Vieira

#3 lore raw

drivers/staging/crystalhd/crystalhd_misc.h line 32

Quoted 11 lines · Jorgyano vieira
Quoted 3 lines

o pr_fmt needs to be #defined before any #include that might directly or indirectly #include kernel.h/printk.h use 'strings <path>/built-in.o | grep "^<.>"' to verify.

yes, I take care of this:--- a/drivers/staging/crystalhd/crystalhd_misc.h +++ b/drivers/staging/crystalhd/crystalhd_misc.h

drivers/staging/crystalhd/crystalhd_misc.h +2 -0
@@ -28,6 +28,8 @@
 #ifndef _CRYSTALHD_MISC_H_
 #define _CRYSTALHD_MISC_H_
 
+#define pr_fmt(fmt)    KBUILD_MODNAME ": " fmt
+

Maybe.

$ grep -rP --include=*.[ch] -m1 "^[ \t]*#[ \t]*include" drivers/staging/crystalhd/
drivers/staging/crystalhd/crystalhd_cmds.h:#include "crystalhd_misc.h"
drivers/staging/crystalhd/crystalhd_lnx.c:#include <linux/mutex.h>
drivers/staging/crystalhd/crystalhd_cmds.c:#include "crystalhd_cmds.h"
drivers/staging/crystalhd/bc_dts_types.h:#include <stdint.h>
drivers/staging/crystalhd/bc_dts_glob_lnx.h:#include <stdio.h>
drivers/staging/crystalhd/crystalhd_misc.c:#include <linux/slab.h>
drivers/staging/crystalhd/crystalhd_misc.h:#include <linux/module.h>
drivers/staging/crystalhd/crystalhd_lnx.h:#include <linux/module.h>
drivers/staging/crystalhd/crystalhd_hw.h:#include "crystalhd_misc.h"
drivers/staging/crystalhd/crystalhd_hw.c:#include <linux/pci.h>

so lnx, cmds, misc, and hw.c are/were suspect.

cheers, Joe

#4 lore raw
Quoted 27 lines · Joe Perches

drivers/staging/crystalhd/crystalhd_misc.h line 32

Quoted 11 lines · Jorgyano vieira
Quoted 3 lines

o pr_fmt needs to be #defined before any #include that might directly or indirectly #include kernel.h/printk.h use 'strings <path>/built-in.o | grep "^<.>"' to verify.

yes, I take care of this:--- a/drivers/staging/crystalhd/crystalhd_misc.h +++ b/drivers/staging/crystalhd/crystalhd_misc.h

drivers/staging/crystalhd/crystalhd_misc.h +2 -0
@@ -28,6 +28,8 @@
  #ifndef _CRYSTALHD_MISC_H_
  #define _CRYSTALHD_MISC_H_
 
+#define pr_fmt(fmt)    KBUILD_MODNAME ": " fmt
+

Maybe.

$ grep -rP --include=*.[ch] -m1 "^[ \t]*#[ \t]*include" drivers/staging/crystalhd/
drivers/staging/crystalhd/crystalhd_cmds.h:#include "crystalhd_misc.h"
drivers/staging/crystalhd/crystalhd_lnx.c:#include <linux/mutex.h>
drivers/staging/crystalhd/crystalhd_cmds.c:#include "crystalhd_cmds.h"
drivers/staging/crystalhd/bc_dts_types.h:#include <stdint.h>
drivers/staging/crystalhd/bc_dts_glob_lnx.h:#include <stdio.h>
drivers/staging/crystalhd/crystalhd_misc.c:#include <linux/slab.h>
drivers/staging/crystalhd/crystalhd_misc.h:#include <linux/module.h>
drivers/staging/crystalhd/crystalhd_lnx.h:#include <linux/module.h>
drivers/staging/crystalhd/crystalhd_hw.h:#include "crystalhd_misc.h"
drivers/staging/crystalhd/crystalhd_hw.c:#include <linux/pci.h>
Quoted 2 lines

so lnx, cmds, misc, and hw.c are/were suspect.

this is the output after the patch:

$ grep -rP --include=*.[ch] -m1 "^[ \t]*#[ \t]*include"
drivers/staging/crystalhd/
drivers/staging/crystalhd/crystalhd_misc.c:#include "crystalhd_misc.h"
drivers/staging/crystalhd/crystalhd_cmds.c:#include "crystalhd_cmds.h"
drivers/staging/crystalhd/crystalhd_lnx.c:#include "crystalhd_lnx.h"
drivers/staging/crystalhd/crystalhd_hw.h:#include "crystalhd_misc.h"
drivers/staging/crystalhd/bc_dts_glob_lnx.h:#include <stdio.h>
drivers/staging/crystalhd/crystalhd_cmds.h:#include "crystalhd_misc.h"
drivers/staging/crystalhd/crystalhd_misc.h:#include <linux/module.h>
drivers/staging/crystalhd/bc_dts_types.h:#include <stdint.h>
drivers/staging/crystalhd/crystalhd_hw.c:#include "crystalhd_hw.h"
drivers/staging/crystalhd/crystalhd_lnx.h:#include "crystalhd_cmds.h"
#5 lore raw
Quoted 2 lines · Jorgyano vieira

this is the output after the patch:

$ grep -rP --include=*.[ch] -m1 "^[ \t]*#[ \t]*include"

[]

Quoted 1 line

drivers/staging/crystalhd/crystalhd_lnx.c:#include "crystalhd_lnx.h"

So this is still 2 layers indirected.

It might make more sense to have a
#include "crystalhd.h"
have pr_fmt be the first #define in that and have
crystalhd.h be the first #include in everything.

maintainer
#6 lore raw
In reply to Jorgyano Vieira
Quoted 18 lines · Jorgyano Vieira

Replace the usage of BCMLOG_ERR with pr_err and remove the macro definition. Also added pr_fmt to identify the driver error messages.

---
 drivers/staging/crystalhd/crystalhd_cmds.c |   68 ++++++++--------
 drivers/staging/crystalhd/crystalhd_hw.c   |  119 ++++++++++++++--------------
 drivers/staging/crystalhd/crystalhd_lnx.c  |   96 +++++++++++-----------
 drivers/staging/crystalhd/crystalhd_lnx.h  |    4 +-
 drivers/staging/crystalhd/crystalhd_misc.c |   70 ++++++++--------
 drivers/staging/crystalhd/crystalhd_misc.h |   10 +--
 6 files changed, 181 insertions(+), 186 deletions(-)
drivers/staging/crystalhd/crystalhd_cmds.c +0 -0
index 3735ed3..46fac01 100644

drivers/staging/crystalhd/crystalhd_cmds.c static enum BC_STATUS bc_cproc_notify_mode(struct crystalhd_cmd *ctx, · line 78

Quoted 5 lines
drivers/staging/crystalhd/crystalhd_cmds.c +1 -1
@@ -75,12 +75,12 @@ static enum BC_STATUS bc_cproc_notify_mode(struct crystalhd_cmd *ctx,
 	int rc = 0, i = 0;
 
 	if (!ctx || !idata) {
-		BCMLOG_ERR("Invalid Arg!!\n");
+		pr_err("%s: Invalid Arg!!\n", __func__);

This is nice, but, as this is a driver, I really prefer the use of dev_err() instead, which allows us to properly identify the device and driver that spit out the error message. Care to redo this patch in that style instead?

thanks,

greg k-h

#7 lore raw
Quoted 8 lines · Greg KH

This is nice, but, as this is a driver, I really prefer the use of dev_err() instead, which allows us to properly identify the device and driver that spit out the error message.  Care to redo this patch in that style instead?

thanks,

greg k-h

sure, I can do this.
but first, there is something wrong about the structure dependencies on the headers:
now, the usage of the dev_err() breaks the build.
for example:
dev_err(&ctx->adp->pdev->dev, " ..."); on crystalhd_cmds.c returns
the error: dereferencing pointer to incomplete type.

I will fix this and send it all on another series.

Signature · 2 lines
Regards,
Jorgyano Vieira