The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Valdis.Kletnieks@vt.edu
To: Ravishankar karkala Mallikarjunayya  <ravishankar.km@greenturtles.in>
Cc: gregkh@suse.de, wfp5p@virginia.edu, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 30/30] Staging: comedi: fix printk issue in jr3_pci.c
Date: Wed, 14 Dec 2011 21:25:17 -0500	[thread overview]
Message-ID: <12715.1323915917@turing-police.cc.vt.edu> (raw)
In-Reply-To: Your message of "Mon, 12 Dec 2011 12:52:19 +0530." <1323674539-19307-1-git-send-email-ravishankar.km@greenturtles.in>

[-- 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 --]

  reply	other threads:[~2011-12-15  2:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2011-12-15  2:45   ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12715.1323915917@turing-police.cc.vt.edu \
    --to=valdis.kletnieks@vt.edu \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ravishankar.km@greenturtles.in \
    --cc=wfp5p@virginia.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox