* [PATCH 30/30] Staging: comedi: fix printk issue in jr3_pci.c
@ 2011-12-12 7:22 Ravishankar karkala Mallikarjunayya
2011-12-15 2:25 ` Valdis.Kletnieks
0 siblings, 1 reply; 3+ messages in thread
From: Ravishankar karkala Mallikarjunayya @ 2011-12-12 7:22 UTC (permalink / raw)
To: gregkh, wfp5p; +Cc: devel, linux-kernel, Ravishankar karkala Mallikarjunayya
This is a patch to the jr3_pci.c file that fixes up a
printk warning found by the checkpatch.pl tool.
Added KERN_facility levels for printks.
Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankar.km@greenturtles.in>
---
drivers/staging/comedi/drivers/jr3_pci.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c
index 2a97894..6a79ba1 100644
--- a/drivers/staging/comedi/drivers/jr3_pci.c
+++ b/drivers/staging/comedi/drivers/jr3_pci.c
@@ -593,24 +593,24 @@ static struct poll_delay_t jr3_pci_poll_subdevice(struct comedi_subdevice *s)
min_full_scale =
get_min_full_scales(channel);
printk("Obtained Min. Full Scales:\n");
- printk("%i ", (min_full_scale).fx);
- printk("%i ", (min_full_scale).fy);
- printk("%i ", (min_full_scale).fz);
- printk("%i ", (min_full_scale).mx);
- printk("%i ", (min_full_scale).my);
- printk("%i ", (min_full_scale).mz);
- printk("\n");
+ printk(KERN_DEBUG "%i ", (min_full_scale).fx);
+ printk(KERN_CONT "%i ", (min_full_scale).fy);
+ printk(KERN_CONT "%i ", (min_full_scale).fz);
+ printk(KERN_CONT "%i ", (min_full_scale).mx);
+ printk(KERN_CONT "%i ", (min_full_scale).my);
+ printk(KERN_CONT "%i ", (min_full_scale).mz);
+ printk(KERN_CONT "\n");
max_full_scale =
get_max_full_scales(channel);
printk("Obtained Max. Full Scales:\n");
- printk("%i ", (max_full_scale).fx);
- printk("%i ", (max_full_scale).fy);
- printk("%i ", (max_full_scale).fz);
- printk("%i ", (max_full_scale).mx);
- printk("%i ", (max_full_scale).my);
- printk("%i ", (max_full_scale).mz);
- printk("\n");
+ printk(KERN_DEBUG "%i ", (max_full_scale).fx);
+ printk(KERN_CONT "%i ", (max_full_scale).fy);
+ printk(KERN_CONT "%i ", (max_full_scale).fz);
+ printk(KERN_CONT "%i ", (max_full_scale).mx);
+ printk(KERN_CONT "%i ", (max_full_scale).my);
+ printk(KERN_CONT "%i ", (max_full_scale).mz);
+ printk(KERN_CONT "\n");
set_full_scales(channel,
max_full_scale);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 30/30] Staging: comedi: fix printk issue in jr3_pci.c
2011-12-12 7:22 [PATCH 30/30] Staging: comedi: fix printk issue in jr3_pci.c Ravishankar karkala Mallikarjunayya
@ 2011-12-15 2:25 ` Valdis.Kletnieks
2011-12-15 2:45 ` Joe Perches
0 siblings, 1 reply; 3+ messages in thread
From: Valdis.Kletnieks @ 2011-12-15 2:25 UTC (permalink / raw)
To: Ravishankar karkala Mallikarjunayya; +Cc: gregkh, wfp5p, devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2049 bytes --]
On Mon, 12 Dec 2011 12:52:19 +0530, Ravishankar karkala Mallikarjunayya said:
> This is a patch to the jr3_pci.c file that fixes up a
> printk warning found by the checkpatch.pl tool.
> diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c
> index 2a97894..6a79ba1 100644
> --- a/drivers/staging/comedi/drivers/jr3_pci.c
> +++ b/drivers/staging/comedi/drivers/jr3_pci.c
> @@ -593,24 +593,24 @@ static struct poll_delay_t jr3_pci_poll_subdevice(struct comedi_subdevice *s)
> min_full_scale =
> get_min_full_scales(channel);
> printk("Obtained Min. Full Scales:\n");
> - printk("%i ", (min_full_scale).fx);
> - printk("%i ", (min_full_scale).fy);
> - printk("%i ", (min_full_scale).fz);
> - printk("%i ", (min_full_scale).mx);
> - printk("%i ", (min_full_scale).my);
> - printk("%i ", (min_full_scale).mz);
> - printk("\n");
> + printk(KERN_DEBUG "%i ", (min_full_scale).fx);
> + printk(KERN_CONT "%i ", (min_full_scale).fy);
> + printk(KERN_CONT "%i ", (min_full_scale).fz);
> + printk(KERN_CONT "%i ", (min_full_scale).mx);
> + printk(KERN_CONT "%i ", (min_full_scale).my);
> + printk(KERN_CONT "%i ", (min_full_scale).mz);
> + printk(KERN_CONT "\n");
Is there a reason that as long as you were fixing this code, you didn't make it
one call to printk?
printk(KERN_DEBUG,"%i %i %i %i %i %i\n",
(min_full_scale).fx),
(min_full_scale).fy),
(min_full_scale).fz),
(min_full_scale).mx),
(min_full_scale).my),
(min_full_scale).mz));
Doing it this way helps guarantee that another CPU doesn't inject a printk into
the middle and split up your output.
Also, there should be at least a *short* text string in that printk saying what
it is. printk(KERN_DEBUG,"jr3_poll %i" or similar would be a start.
Otherwise you get a line with 6 integers in it.
Also, if you're indented that far to the right, that driver is probably in
serious need of some restructuring or refactoring.
[-- Attachment #2: Type: application/pgp-signature, Size: 227 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 30/30] Staging: comedi: fix printk issue in jr3_pci.c
2011-12-15 2:25 ` Valdis.Kletnieks
@ 2011-12-15 2:45 ` Joe Perches
0 siblings, 0 replies; 3+ messages in thread
From: Joe Perches @ 2011-12-15 2:45 UTC (permalink / raw)
To: Valdis.Kletnieks
Cc: Ravishankar karkala Mallikarjunayya, gregkh, wfp5p, devel,
linux-kernel
On Wed, 2011-12-14 at 21:25 -0500, Valdis.Kletnieks@vt.edu wrote:
> On Mon, 12 Dec 2011 12:52:19 +0530, Ravishankar karkala Mallikarjunayya said:
> > This is a patch to the jr3_pci.c file that fixes up a
> > printk warning found by the checkpatch.pl tool.
[]
> > diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c
[]
> > @@ -593,24 +593,24 @@ static struct poll_delay_t jr3_pci_poll_subdevice(struct comedi_subdevice *s)
[]
> > + printk(KERN_DEBUG "%i ", (min_full_scale).fx);
> > + printk(KERN_CONT "%i ", (min_full_scale).fy);
> > + printk(KERN_CONT "%i ", (min_full_scale).fz);
> > + printk(KERN_CONT "%i ", (min_full_scale).mx);
> > + printk(KERN_CONT "%i ", (min_full_scale).my);
> > + printk(KERN_CONT "%i ", (min_full_scale).mz);
> > + printk(KERN_CONT "\n");
> Is there a reason that as long as you were fixing this code, you didn't make it
> one call to printk?
> printk(KERN_DEBUG,"%i %i %i %i %i %i\n",
> (min_full_scale).fx),
> (min_full_scale).fy),
> (min_full_scale).fz),
> (min_full_scale).mx),
> (min_full_scale).my),
> (min_full_scale).mz));
> Doing it this way helps guarantee that another CPU doesn't inject a printk into
> the middle and split up your output.
> Also, there should be at least a *short* text string in that printk saying what
> it is. printk(KERN_DEBUG,"jr3_poll %i" or similar would be a start.
> Otherwise you get a line with 6 integers in it.
Use #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
and
pr_debug(etc...)
min_full_scale is a variable and doesn't need parenthesis.
It's also in my opinion an overly long name.
mfs = get_min_full_scales(channel);
pr_debug("Got MinFullScales: %i %i %i, %i %i %i\n",
msf.fx, msf.fy, msf.fz,
msf.mx, msf.my, msf.mz);
> Also, if you're indented that far to the right, that driver is probably in
> serious need of some restructuring or refactoring.
I think 5 tab indentation is a lot but 6 tabs is too many.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-12-15 2:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-12 7:22 [PATCH 30/30] Staging: comedi: fix printk issue in jr3_pci.c Ravishankar karkala Mallikarjunayya
2011-12-15 2:25 ` Valdis.Kletnieks
2011-12-15 2:45 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox