* [PATCH] staging: rtl8188eu: remove ASSERT and ODM_RT_ASSERT macros
@ 2021-05-24 22:45 Phillip Potter
2021-05-25 6:44 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Phillip Potter @ 2021-05-24 22:45 UTC (permalink / raw)
To: gregkh; +Cc: Larry.Finger, straube.linux, linux-staging, linux-kernel
Remove the ASSERT and ODM_RT_ASSERT macros from include/odm_debug.h
as they are unnecessary.
ASSERT does nothing, compiling to a single empty statement.
ODM_RT_ASSERT is used in only one place, in the ODM_RAStateCheck
function with hal/odm.c - it seems to have been intended as an
assertion of some kind, but given it is always called with false
here, there is little point in it not just being a pr_info() call.
Also, the lines relating to the file, function and line number are
not needed as the pr_info() with the function name and error message
is sufficient should anyone wish to track down this error at a source
level, within what is currently a relatively small function.
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
drivers/staging/rtl8188eu/hal/odm.c | 2 +-
drivers/staging/rtl8188eu/include/odm_debug.h | 13 -------------
2 files changed, 1 insertion(+), 14 deletions(-)
diff --git a/drivers/staging/rtl8188eu/hal/odm.c b/drivers/staging/rtl8188eu/hal/odm.c
index 4d659a812aed..b800d0c6dff5 100644
--- a/drivers/staging/rtl8188eu/hal/odm.c
+++ b/drivers/staging/rtl8188eu/hal/odm.c
@@ -824,7 +824,7 @@ bool ODM_RAStateCheck(struct odm_dm_struct *pDM_Odm, s32 RSSI, bool bForceUpdate
LowRSSIThreshForRA += GoUpGap;
break;
default:
- ODM_RT_ASSERT(pDM_Odm, false, ("wrong rssi level setting %d !", *pRATRState));
+ pr_info("%s(): wrong rssi level setting %d!\n", __func__, *pRATRState);
break;
}
diff --git a/drivers/staging/rtl8188eu/include/odm_debug.h b/drivers/staging/rtl8188eu/include/odm_debug.h
index 857c64b8d2f4..3c576a029c94 100644
--- a/drivers/staging/rtl8188eu/include/odm_debug.h
+++ b/drivers/staging/rtl8188eu/include/odm_debug.h
@@ -71,10 +71,6 @@
#define RT_PRINTK(fmt, args...) \
pr_info("%s(): " fmt, __func__, ## args);
-#ifndef ASSERT
- #define ASSERT(expr)
-#endif
-
#define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) \
if (((comp) & pDM_Odm->DebugComponents) && \
(level <= pDM_Odm->DebugLevel)) { \
@@ -82,15 +78,6 @@
RT_PRINTK fmt; \
}
-#define ODM_RT_ASSERT(pDM_Odm, expr, fmt) \
- if (!(expr)) { \
- pr_info("Assertion failed! %s at ......\n", #expr); \
- pr_info(" ......%s,%s,line=%d\n", __FILE__, \
- __func__, __LINE__); \
- RT_PRINTK fmt; \
- ASSERT(false); \
- }
-
void ODM_InitDebugSetting(struct odm_dm_struct *pDM_Odm);
#endif /* __ODM_DBG_H__ */
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: rtl8188eu: remove ASSERT and ODM_RT_ASSERT macros
2021-05-24 22:45 [PATCH] staging: rtl8188eu: remove ASSERT and ODM_RT_ASSERT macros Phillip Potter
@ 2021-05-25 6:44 ` Greg KH
2021-05-25 20:51 ` Phillip Potter
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2021-05-25 6:44 UTC (permalink / raw)
To: Phillip Potter; +Cc: Larry.Finger, straube.linux, linux-staging, linux-kernel
On Mon, May 24, 2021 at 11:45:32PM +0100, Phillip Potter wrote:
> Remove the ASSERT and ODM_RT_ASSERT macros from include/odm_debug.h
> as they are unnecessary.
>
> ASSERT does nothing, compiling to a single empty statement.
> ODM_RT_ASSERT is used in only one place, in the ODM_RAStateCheck
> function with hal/odm.c - it seems to have been intended as an
> assertion of some kind, but given it is always called with false
> here, there is little point in it not just being a pr_info() call.
>
> Also, the lines relating to the file, function and line number are
> not needed as the pr_info() with the function name and error message
> is sufficient should anyone wish to track down this error at a source
> level, within what is currently a relatively small function.
>
> Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
> ---
> drivers/staging/rtl8188eu/hal/odm.c | 2 +-
> drivers/staging/rtl8188eu/include/odm_debug.h | 13 -------------
> 2 files changed, 1 insertion(+), 14 deletions(-)
>
> diff --git a/drivers/staging/rtl8188eu/hal/odm.c b/drivers/staging/rtl8188eu/hal/odm.c
> index 4d659a812aed..b800d0c6dff5 100644
> --- a/drivers/staging/rtl8188eu/hal/odm.c
> +++ b/drivers/staging/rtl8188eu/hal/odm.c
> @@ -824,7 +824,7 @@ bool ODM_RAStateCheck(struct odm_dm_struct *pDM_Odm, s32 RSSI, bool bForceUpdate
> LowRSSIThreshForRA += GoUpGap;
> break;
> default:
> - ODM_RT_ASSERT(pDM_Odm, false, ("wrong rssi level setting %d !", *pRATRState));
> + pr_info("%s(): wrong rssi level setting %d!\n", __func__, *pRATRState);
I know you're just copying what the existing code does, but this really
should just be a dev_err() call instead. It's not "info", and as this
is a driver, dev_*() should be called instead.
So I'll take this one, but for future cleanups, consider changing the
pr_*() calls to the correct ones.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: rtl8188eu: remove ASSERT and ODM_RT_ASSERT macros
2021-05-25 6:44 ` Greg KH
@ 2021-05-25 20:51 ` Phillip Potter
0 siblings, 0 replies; 3+ messages in thread
From: Phillip Potter @ 2021-05-25 20:51 UTC (permalink / raw)
To: Greg KH; +Cc: Larry.Finger, straube.linux, linux-staging, linux-kernel
On Tue, May 25, 2021 at 08:44:44AM +0200, Greg KH wrote:
> On Mon, May 24, 2021 at 11:45:32PM +0100, Phillip Potter wrote:
> > Remove the ASSERT and ODM_RT_ASSERT macros from include/odm_debug.h
> > as they are unnecessary.
> >
> > ASSERT does nothing, compiling to a single empty statement.
> > ODM_RT_ASSERT is used in only one place, in the ODM_RAStateCheck
> > function with hal/odm.c - it seems to have been intended as an
> > assertion of some kind, but given it is always called with false
> > here, there is little point in it not just being a pr_info() call.
> >
> > Also, the lines relating to the file, function and line number are
> > not needed as the pr_info() with the function name and error message
> > is sufficient should anyone wish to track down this error at a source
> > level, within what is currently a relatively small function.
> >
> > Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
> > ---
> > drivers/staging/rtl8188eu/hal/odm.c | 2 +-
> > drivers/staging/rtl8188eu/include/odm_debug.h | 13 -------------
> > 2 files changed, 1 insertion(+), 14 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8188eu/hal/odm.c b/drivers/staging/rtl8188eu/hal/odm.c
> > index 4d659a812aed..b800d0c6dff5 100644
> > --- a/drivers/staging/rtl8188eu/hal/odm.c
> > +++ b/drivers/staging/rtl8188eu/hal/odm.c
> > @@ -824,7 +824,7 @@ bool ODM_RAStateCheck(struct odm_dm_struct *pDM_Odm, s32 RSSI, bool bForceUpdate
> > LowRSSIThreshForRA += GoUpGap;
> > break;
> > default:
> > - ODM_RT_ASSERT(pDM_Odm, false, ("wrong rssi level setting %d !", *pRATRState));
> > + pr_info("%s(): wrong rssi level setting %d!\n", __func__, *pRATRState);
>
> I know you're just copying what the existing code does, but this really
> should just be a dev_err() call instead. It's not "info", and as this
> is a driver, dev_*() should be called instead.
>
> So I'll take this one, but for future cleanups, consider changing the
> pr_*() calls to the correct ones.
>
> thanks,
>
> greg k-h
Dear Greg,
Thank you for this, I will make sure to bear this in mind for the
future.
Regards,
Phil
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-25 20:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24 22:45 [PATCH] staging: rtl8188eu: remove ASSERT and ODM_RT_ASSERT macros Phillip Potter
2021-05-25 6:44 ` Greg KH
2021-05-25 20:51 ` Phillip Potter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).