linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] staging: comedi: use __func__ instead of hardcoded function name
@ 2017-04-29 16:47 Dhiru Kholia
  2017-04-29 17:21 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Dhiru Kholia @ 2017-04-29 16:47 UTC (permalink / raw)
  To: LKML; +Cc: Ian Abbott, H Hartley Sweeten

This coding style issue was found by checkpatch.pl script. Using
__func__ instead of hardcoded function name should help in future
refactoring of this code.

Signed-off-by: Dhiru Kholia <dhiru.kholia@gmail.com>
---
 drivers/staging/comedi/drivers/quatech_daqp_cs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
index 802f51e..ea194aa 100644
--- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c
+++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
@@ -248,7 +248,7 @@ static irqreturn_t daqp_interrupt(int irq, void *dev_id)
 
 	if (loop_limit <= 0) {
 		dev_warn(dev->class_dev,
-			 "loop_limit reached in daqp_interrupt()\n");
+			 "loop_limit reached in %s()\n", __func__);
 		s->async->events |= COMEDI_CB_ERROR;
 	}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] staging: comedi: use __func__ instead of hardcoded function name
  2017-04-29 16:47 [PATCH 1/1] staging: comedi: use __func__ instead of hardcoded function name Dhiru Kholia
@ 2017-04-29 17:21 ` Joe Perches
  2017-04-30 10:17   ` Dhiru Kholia
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2017-04-29 17:21 UTC (permalink / raw)
  To: Dhiru Kholia, LKML; +Cc: Ian Abbott, H Hartley Sweeten

On Sat, 2017-04-29 at 22:17 +0530, Dhiru Kholia wrote:
> This coding style issue was found by checkpatch.pl script. Using
> __func__ instead of hardcoded function name should help in future
> refactoring of this code.
> 
> Signed-off-by: Dhiru Kholia <dhiru.kholia@gmail.com>
> ---
>  drivers/staging/comedi/drivers/quatech_daqp_cs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
> index 802f51e..ea194aa 100644
> --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c
> +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
> @@ -248,7 +248,7 @@ static irqreturn_t daqp_interrupt(int irq, void *dev_id)
>  
>  	if (loop_limit <= 0) {
>  		dev_warn(dev->class_dev,
> -			 "loop_limit reached in daqp_interrupt()\n");
> +			 "loop_limit reached in %s()\n", __func__);

More common would be:
		dev_warn(dev->class_dev, "%s: loop limit reached\n", __func__);

It also seems that the loop_limit test, a loop count,
is sensitive on the cpu frequency and perhaps should
be some timer based limit instead.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] staging: comedi: use __func__ instead of hardcoded function name
  2017-04-29 17:21 ` Joe Perches
@ 2017-04-30 10:17   ` Dhiru Kholia
  0 siblings, 0 replies; 3+ messages in thread
From: Dhiru Kholia @ 2017-04-30 10:17 UTC (permalink / raw)
  To: Joe Perches; +Cc: LKML, Ian Abbott, H Hartley Sweeten

On Sat, Apr 29, 2017 at 10:21:33AM -0700, Joe Perches wrote:
> On Sat, 2017-04-29 at 22:17 +0530, Dhiru Kholia wrote:
> > This coding style issue was found by checkpatch.pl script. Using
> > __func__ instead of hardcoded function name should help in future
> > refactoring of this code.
> > 
> >  	if (loop_limit <= 0) {
> >  		dev_warn(dev->class_dev,
> > -			 "loop_limit reached in daqp_interrupt()\n");
> > +			 "loop_limit reached in %s()\n", __func__);
> 
> More common would be:
> 		dev_warn(dev->class_dev, "%s: loop limit reached\n", __func__);

Thanks for the feedback, Joe. I have sent out a v2 of this patch with
this suggestion applied.
 
> It also seems that the loop_limit test, a loop count,
> is sensitive on the cpu frequency and perhaps should
> be some timer based limit instead.

I am not familiar with this code at all. I am doing this patch as part
of "The Eudyptula Challenge" (http://eudyptula-challenge.org/).

Thanks,
Dhiru

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-30 10:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-29 16:47 [PATCH 1/1] staging: comedi: use __func__ instead of hardcoded function name Dhiru Kholia
2017-04-29 17:21 ` Joe Perches
2017-04-30 10:17   ` Dhiru Kholia

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).