Staging: crystalhd: Replace the BCMLOG_ERR macro with pr_err
PATCH 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.
--- drivers/staging/crystalhd/crystalhd_cmds.c | 68 ++++++++-------- drivers/staging/crystalhd/crystalhd_hw.c | 116 ++++++++++++++-------------- drivers/staging/crystalhd/crystalhd_lnx.c | 92 +++++++++++----------- drivers/staging/crystalhd/crystalhd_misc.c | 66 ++++++++-------- drivers/staging/crystalhd/crystalhd_misc.h | 8 -- 5 files changed, 171 insertions(+), 179 deletions(-)
drivers/staging/crystalhd/crystalhd_cmds.c +34 -34
@@ -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 ("Invalid Arg!!\n" );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 ("Link invalid state %d\n" , 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 ("Invalid Arg!!\n" );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 ("Invalid Arg!!\n" );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 ("insufficient buffer\n" );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 ("insufficient buffer\n" );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 ("Invalid Arg!!\n" );return BC_STS_INV_ARG ; }if (ctx->state !=BC_LINK_INVALID ) { -BCMLOG_ERR ("Link invalid state %d\n" , ctx->state); +pr_err ("Link invalid state %d\n" , 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 ("Link invalid state %d\n" , 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 ("Invalid Arg!!\n" );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 ("Invalid Arg!!\n" );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 ("Invalid Arg!!\n" );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 ("dio map - %d\n" , 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 ("Invalid Arg!!\n" );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 ("dio map - %d\n" , 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 ("Invalid Arg!!\n" );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 ("Invalid Arg!!\n" );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 ("Invalid Arg!!\n" );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 ("Invalid Arg!!\n" );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 ("Invalid Parameters\n" );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 ("Invalid arg..\n" );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 ("Invalid arg!!\n" );return BC_STS_INV_ARG ; }
@@ -1016,12 +1016,12 @@ crystalhd_cmd_proc crystalhd_get_cmd_proc(struct crystalhd_cmd *ctx, uint32_t cmunsigned 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 cmbool crystalhd_cmd_interrupt (struct crystalhd_cmd *ctx) {if (!ctx) { -BCMLOG_ERR ("Invalid arg..\n" ); +pr_err ("Invalid arg..\n" );return 0 ; }
drivers/staging/crystalhd/crystalhd_hw.c +58 -58
449 lines not on this page · raw message
drivers/staging/crystalhd/crystalhd_lnx.c +46 -46
358 lines not on this page · raw message
drivers/staging/crystalhd/crystalhd_misc.c +33 -33
262 lines not on this page · raw message
drivers/staging/crystalhd/crystalhd_misc.h +0 -8
@@ -209,12 +209,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
Quoted 2 lines · Jorgyano Vieira
Replace the usage of
BCMLOG_ERRwithpr_errand remove the macro definition.
This needs a pr_fmt line so we can tell where the errors are coming from.
#define pr_fmt(fmt) KBUILD_MODNAME ": %s:%d: " fmt, __func__, __LINE__
regards,
dan carpenter
Quoted 5 lines · Dan Carpenter
Quoted 1 line · Jorgyano Vieira
Replace the usage of
BCMLOG_ERRwithpr_errand remove the macro definition.This needs a
pr_fmtline so we can tell where the errors are coming from.
#definepr_fmt(fmt)KBUILD_MODNAME": %s:%d: " fmt,__func__,__LINE__
True.__func__ and __LINE__ are not generally useful though.
I suggest just
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Quoted 10 lines · Joe Perches
Quoted 5 lines · Dan Carpenter
Quoted 1 line · Jorgyano Vieira
Replace the usage of
BCMLOG_ERRwithpr_errand remove the macro definition.This needs a
pr_fmtline so we can tell where the errors are coming from.
#definepr_fmt(fmt)KBUILD_MODNAME": %s:%d: " fmt,__func__,__LINE__True.
__func__and__LINE__are not generally useful though.
If you don't know the function and line number, then how do you tell all the "Invalid args" printks apart?
regards,
dan carpenter
Quoted 11 lines · Dan Carpenter
Quoted 8 lines · Joe Perches
Quoted 5 lines · Dan Carpenter
Quoted 1 line · Jorgyano Vieira
Replace the usage of
BCMLOG_ERRwithpr_errand remove the macro definition.This needs a
pr_fmtline so we can tell where the errors are coming from.
#definepr_fmt(fmt)KBUILD_MODNAME": %s:%d: " fmt,__func__,__LINE__True.
__func__and__LINE__are not generally useful though.If you don't know the function and line number, then how do you tell all the "Invalid args" printks apart?
It's possible to add "%s...", __func__ to the necessary uses. Adding it to the generic is likely overkill.
But is it really necessary anyway?
Aren't those called via some specific notifier such that the output would make sense given some specific invalid input?
Quoted 3 lines
It's possible to add "%s...",
__func__to the necessary uses. Adding it to the generic is likely overkill.
I agree with that.
Quoted 5 lines
But is it really necessary anyway?
Aren't those called via some specific notifier such that the output would make sense given some specific invalid input?
Some messages like "Invalid Arg" and "Invalid len" really don't make sense as it is.
But I think that just adding __func__ to the necessary uses is enough. I will resend this patch.