* [PATCH] staging: comedi: Use '"%s:", __func__' instead of function name
@ 2018-02-18 11:10 Eisha Chen-yen-su
0 siblings, 0 replies; 3+ messages in thread
From: Eisha Chen-yen-su @ 2018-02-18 11:10 UTC (permalink / raw)
To: outreachy-kernel, gregkh; +Cc: abbotti, hsweeten, Eisha Chen-yen-su
The script "checkpatch.pl" pointed information out like the following:
WARNING: Prefer using '"%s...", __func__' to using 's626_ai_cmd',
this function's name, in a string.
Signed-off-by: Eisha Chen-yen-su <chenyensu0@gmail.com>
---
drivers/staging/comedi/drivers/s626.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c
index 0b3cfe934e14..ec54dc3e9ad6 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -1700,7 +1700,7 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
if (devpriv->ai_cmd_running) {
dev_err(dev->class_dev,
- "s626_ai_cmd: Another ai_cmd is running\n");
+ "%s: Another ai_cmd is running\n", __func__);
return -EBUSY;
}
/* disable interrupt */
--
2.14.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] staging: comedi: Use '"%s:", __func__' instead of function name
@ 2018-02-19 20:00 Eisha Chen-yen-su
2018-02-20 8:02 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Eisha Chen-yen-su @ 2018-02-19 20:00 UTC (permalink / raw)
To: outreachy-kernel, gregkh; +Cc: abbotti, hsweeten, Eisha Chen-yen-su
Replace all occurrences of functions' names in strings by a reference
to __func__, to improve robustness. Problem found with checkpatch.
Signed-off-by: Eisha Chen-yen-su <chenyensu0@gmail.com>
---
drivers/staging/comedi/drivers/jr3_pci.c | 2 +-
drivers/staging/comedi/drivers/ni_mio_common.c | 8 +++++---
drivers/staging/comedi/drivers/quatech_daqp_cs.c | 2 +-
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c
index 201f4f96c182..2578ae4b102f 100644
--- a/drivers/staging/comedi/drivers/jr3_pci.c
+++ b/drivers/staging/comedi/drivers/jr3_pci.c
@@ -295,7 +295,7 @@ static int jr3_pci_open(struct comedi_device *dev)
struct comedi_subdevice *s;
int i;
- dev_dbg(dev->class_dev, "jr3_pci_open\n");
+ dev_dbg(dev->class_dev, "%s\n", __func__);
for (i = 0; i < dev->n_subdevices; i++) {
s = &dev->subdevices[i];
spriv = s->private;
diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
index 5d610af6799f..d6eb55b41814 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -1965,7 +1965,8 @@ static void ni_cmd_set_mite_transfer(struct mite_ring *ring,
if (nbytes > sdev->async->prealloc_bufsz) {
if (cmd->stop_arg > 0)
dev_err(sdev->device->class_dev,
- "ni_cmd_set_mite_transfer: tried exact data transfer limits greater than buffer size\n");
+ "%s: tried exact data transfer limits greater than buffer size\n",
+ __func__);
/*
* we can only transfer up to the size of the buffer. In this
@@ -1978,7 +1979,8 @@ static void ni_cmd_set_mite_transfer(struct mite_ring *ring,
mite_init_ring_descriptors(ring, sdev, nbytes);
#else
dev_err(sdev->device->class_dev,
- "ni_cmd_set_mite_transfer: exact data transfer limits not implemented yet without DMA\n");
+ "%s: exact data transfer limits not implemented yet without DMA\n",
+ __func__);
#endif
}
@@ -4687,7 +4689,7 @@ static int cs5529_do_conversion(struct comedi_device *dev,
retval = cs5529_wait_for_idle(dev);
if (retval) {
dev_err(dev->class_dev,
- "timeout or signal in cs5529_do_conversion()\n");
+ "timeout or signal in %s()\n", __func__);
return -ETIME;
}
status = ni_ao_win_inw(dev, NI67XX_CAL_STATUS_REG);
diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
index 802f51e46405..ea194aa01a64 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.14.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: comedi: Use '"%s:", __func__' instead of function name
2018-02-19 20:00 [PATCH] staging: comedi: Use '"%s:", __func__' instead of function name Eisha Chen-yen-su
@ 2018-02-20 8:02 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2018-02-20 8:02 UTC (permalink / raw)
To: Eisha Chen-yen-su; +Cc: outreachy-kernel, abbotti, hsweeten
On Mon, Feb 19, 2018 at 09:00:48PM +0100, Eisha Chen-yen-su wrote:
> Replace all occurrences of functions' names in strings by a reference
> to __func__, to improve robustness. Problem found with checkpatch.
>
> Signed-off-by: Eisha Chen-yen-su <chenyensu0@gmail.com>
> ---
> drivers/staging/comedi/drivers/jr3_pci.c | 2 +-
> drivers/staging/comedi/drivers/ni_mio_common.c | 8 +++++---
> drivers/staging/comedi/drivers/quatech_daqp_cs.c | 2 +-
> 3 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c
> index 201f4f96c182..2578ae4b102f 100644
> --- a/drivers/staging/comedi/drivers/jr3_pci.c
> +++ b/drivers/staging/comedi/drivers/jr3_pci.c
> @@ -295,7 +295,7 @@ static int jr3_pci_open(struct comedi_device *dev)
> struct comedi_subdevice *s;
> int i;
>
> - dev_dbg(dev->class_dev, "jr3_pci_open\n");
> + dev_dbg(dev->class_dev, "%s\n", __func__);
A call like this should just be deleted, as it is a "tracing" call, and
we have an in-kernel function for that now. So just delete this line in
a separate patch.
> for (i = 0; i < dev->n_subdevices; i++) {
> s = &dev->subdevices[i];
> spriv = s->private;
> diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
> index 5d610af6799f..d6eb55b41814 100644
> --- a/drivers/staging/comedi/drivers/ni_mio_common.c
> +++ b/drivers/staging/comedi/drivers/ni_mio_common.c
> @@ -1965,7 +1965,8 @@ static void ni_cmd_set_mite_transfer(struct mite_ring *ring,
> if (nbytes > sdev->async->prealloc_bufsz) {
> if (cmd->stop_arg > 0)
> dev_err(sdev->device->class_dev,
> - "ni_cmd_set_mite_transfer: tried exact data transfer limits greater than buffer size\n");
> + "%s: tried exact data transfer limits greater than buffer size\n",
> + __func__);
>
> /*
> * we can only transfer up to the size of the buffer. In this
> @@ -1978,7 +1979,8 @@ static void ni_cmd_set_mite_transfer(struct mite_ring *ring,
> mite_init_ring_descriptors(ring, sdev, nbytes);
> #else
> dev_err(sdev->device->class_dev,
> - "ni_cmd_set_mite_transfer: exact data transfer limits not implemented yet without DMA\n");
> + "%s: exact data transfer limits not implemented yet without DMA\n",
> + __func__);
> #endif
> }
>
> @@ -4687,7 +4689,7 @@ static int cs5529_do_conversion(struct comedi_device *dev,
> retval = cs5529_wait_for_idle(dev);
> if (retval) {
> dev_err(dev->class_dev,
> - "timeout or signal in cs5529_do_conversion()\n");
> + "timeout or signal in %s()\n", __func__);
> return -ETIME;
> }
> status = ni_ao_win_inw(dev, NI67XX_CAL_STATUS_REG);
> diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
> index 802f51e46405..ea194aa01a64 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;
> }
>
The rest of these were fine, can you resend this patch as a 2-patch
series with the change I mention above being one patch, and the rest of
these changes being the other?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-02-20 8:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-19 20:00 [PATCH] staging: comedi: Use '"%s:", __func__' instead of function name Eisha Chen-yen-su
2018-02-20 8:02 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2018-02-18 11:10 Eisha Chen-yen-su
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.