All of lore.kernel.org
 help / color / mirror / Atom feed
From: ahern.michael.t@gmail.com
To: gregkh@suse.de, u.kleine-koenig@pengutronix.de, julia@diku.dk,
	nikai@nikai.net, morgan.gatti@gmail.com
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	mah <ahern.michael.t@gmail.com>
Subject: [PATCH 3/5] Coding style in unioxx5.c KERN_ facility level and coding style warnings as reported by checkpatch.pl Signed-off-by: Michael Ahern <ahern.michael.t@gmail.com>
Date: Mon, 10 Jan 2011 10:03:14 +1100	[thread overview]
Message-ID: <1294614196-6665-3-git-send-email-ahern.michael.t@gmail.com> (raw)
In-Reply-To: <1294614196-6665-1-git-send-email-ahern.michael.t@gmail.com>

From: mah <ahern.michael.t@gmail.com>

---
 drivers/staging/comedi/drivers/unioxx5.c |   65 +++++++++++++++++++----------
 1 files changed, 42 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/comedi/drivers/unioxx5.c b/drivers/staging/comedi/drivers/unioxx5.c
index 598884e..334f036 100644
--- a/drivers/staging/comedi/drivers/unioxx5.c
+++ b/drivers/staging/comedi/drivers/unioxx5.c
@@ -72,13 +72,17 @@ Devices: [Fastwel] UNIOxx-5 (unioxx5),
 #define ALL_2_INPUT  0		/* config all digital channels to input */
 #define ALL_2_OUTPUT 1		/* config all digital channels to output */
 
-/* 'private' structure for each subdevice */
+/* 'private' unioxx5 structure for each subdevice
+	usp_module_type - 12 modules. each can be 70L or 73L
+	usp_extra_data  - for saving previous written value for analog modules
+	usp_prev_wr_val	- previous written value
+	usp_prev_cn_val - previous channel value */
 struct unioxx5_subd_priv {
 	int usp_iobase;
-	unsigned char usp_module_type[12];	/* 12 modules. each can be 70L or 73L */
-	unsigned char usp_extra_data[12][4];	/* for saving previous written value for analog modules */
-	unsigned char usp_prev_wr_val[3];	/* previous written value */
-	unsigned char usp_prev_cn_val[3];	/* previous channel value */
+	unsigned char usp_module_type[12];	/* see comment above */
+	unsigned char usp_extra_data[12][4];	/* see comment above */
+	unsigned char usp_prev_wr_val[3];	/* see comment above */
+	unsigned char usp_prev_cn_val[3];	/* see comment above */
 };
 
 static int unioxx5_attach(struct comedi_device *dev,
@@ -99,7 +103,8 @@ static int __unioxx5_digital_write(struct unioxx5_subd_priv *usp,
 				   unsigned int *data, int channel, int minor);
 static int __unioxx5_digital_read(struct unioxx5_subd_priv *usp,
 				  unsigned int *data, int channel, int minor);
-/* static void __unioxx5_digital_config(struct unioxx5_subd_priv* usp, int mode); */
+/* static void __unioxx5_digital_config(struct unioxx5_subd_priv* usp,
+					int mode); */
 static int __unioxx5_analog_write(struct unioxx5_subd_priv *usp,
 				  unsigned int *data, int channel, int minor);
 static int __unioxx5_analog_read(struct unioxx5_subd_priv *usp,
@@ -139,8 +144,10 @@ static int unioxx5_attach(struct comedi_device *dev,
 	dev->iobase = iobase;
 	iobase += UNIOXX5_SUBDEV_BASE;
 
-	/* defining number of subdevices and getting they types (it must be 'g01')  */
-	for (i = n_subd = 0, ba = iobase; i < 4; i++, ba += UNIOXX5_SUBDEV_ODDS) {
+	/* defining number of subdevices and getting types (it must be 'g01') */
+	for (i = n_subd = 0, ba = iobase; i < 4;
+		i++, ba += UNIOXX5_SUBDEV_ODDS) {
+
 		id = inb(ba + 0xE);
 		num = inb(ba + 0xF);
 
@@ -169,7 +176,7 @@ static int unioxx5_attach(struct comedi_device *dev,
 			return -1;
 	}
 
-	printk("attached\n");
+	printk(KERN_INFO "attached\n");
 	return 0;
 }
 
@@ -181,7 +188,8 @@ static int unioxx5_subdev_read(struct comedi_device *dev,
 	int channel, type;
 
 	channel = CR_CHAN(insn->chanspec);
-	type = usp->usp_module_type[channel / 2];	/* defining module type(analog or digital) */
+	/* defining module type(analog or digital) */
+	type = usp->usp_module_type[channel / 2];
 
 	if (type == MODULE_DIGITAL) {
 		if (!__unioxx5_digital_read(usp, data, channel, dev->minor))
@@ -202,7 +210,8 @@ static int unioxx5_subdev_write(struct comedi_device *dev,
 	int channel, type;
 
 	channel = CR_CHAN(insn->chanspec);
-	type = usp->usp_module_type[channel / 2];	/* defining module type(analog or digital) */
+	/* defining module type(analog or digital) */
+	type = usp->usp_module_type[channel / 2];
 
 	if (type == MODULE_DIGITAL) {
 		if (!__unioxx5_digital_write(usp, data, channel, dev->minor))
@@ -259,11 +268,16 @@ static int unioxx5_insn_config(struct comedi_device *dev,
 	/*                                                        *\
 	 * sets channels buffer to 1(after this we are allowed to *
 	 * change channel type on input or output)                *
+	 *
+	outb(flags, ...) - changes type of _one_ channel
+	outb(0, ...)	 - sets channels bank to 0(allows directly input/output)
+	usp-> ... flags  - saves written value
+	 *
 	 \*                                                        */
 	outb(1, usp->usp_iobase + 0);
-	outb(flags, usp->usp_iobase + channel_offset);	/* changes type of _one_ channel */
-	outb(0, usp->usp_iobase + 0);	/* sets channels bank to 0(allows directly input/output) */
-	usp->usp_prev_cn_val[channel_offset - 1] = flags;	/* saves written value */
+	outb(flags, usp->usp_iobase + channel_offset);	/* see comment above */
+	outb(0, usp->usp_iobase + 0);				/* see above */
+	usp->usp_prev_cn_val[channel_offset - 1] = flags;	/* see above */
 
 	return 0;
 }
@@ -304,14 +318,14 @@ static int __unioxx5_subdev_init(struct comedi_subdevice *subdev,
 	}
 
 	usp->usp_iobase = subdev_iobase;
-	printk("comedi%d: |", minor);
+	printk(KERN_ERR "comedi%d: |", minor);
 
 	/* defining modules types */
 	for (i = 0; i < 12; i++) {
 		to = 10000;
 
 		__unioxx5_analog_config(usp, i * 2);
-		outb(i + 1, subdev_iobase + 5);	/* sends channel number to card */
+		outb(i + 1, subdev_iobase + 5);	/* sends channel num to card */
 		outb('H', subdev_iobase + 6);	/* requests EEPROM world */
 		while (!(inb(subdev_iobase + 0) & TxBE))
 			;	/* waits while writting will be allowed */
@@ -346,9 +360,9 @@ static int __unioxx5_subdev_init(struct comedi_subdevice *subdev,
 	subdev->range_table = &range_digital;
 	subdev->insn_read = unioxx5_subdev_read;
 	subdev->insn_write = unioxx5_subdev_write;
-	subdev->insn_config = unioxx5_insn_config;	/* for digital modules only!!! */
+	subdev->insn_config = unioxx5_insn_config; /* 4 digital modules only */
 
-	printk("subdevice configured\n");
+	printk(KERN_INFO "subdevice configured\n");
 
 	return 0;
 }
@@ -367,7 +381,8 @@ static int __unioxx5_digital_write(struct unioxx5_subd_priv *usp,
 		return 0;
 	}
 
-	val = usp->usp_prev_wr_val[channel_offset - 1];	/* getting previous written value */
+	/* getting previous written value */
+	val = usp->usp_prev_wr_val[channel_offset - 1];
 
 	if (*data)
 		val |= mask;
@@ -375,7 +390,7 @@ static int __unioxx5_digital_write(struct unioxx5_subd_priv *usp,
 		val &= ~mask;
 
 	outb(val, usp->usp_iobase + channel_offset);
-	usp->usp_prev_wr_val[channel_offset - 1] = val;	/* saving new written value */
+	usp->usp_prev_wr_val[channel_offset - 1] = val;	/* save new value */
 
 	return 1;
 }
@@ -397,8 +412,9 @@ static int __unioxx5_digital_read(struct unioxx5_subd_priv *usp,
 	*data = inb(usp->usp_iobase + channel_offset);
 	*data &= mask;
 
+	/* this operation is created for correct readed value to 0 or 1 */
 	if (channel_offset > 1)
-		channel -= 2 << channel_offset;	/* this operation is created for correct readed value to 0 or 1 */
+		channel -= 2 << channel_offset;
 
 	*data >>= channel;
 	return 1;
@@ -444,7 +460,9 @@ static int __unioxx5_analog_write(struct unioxx5_subd_priv *usp,
 	usp->usp_extra_data[module][i] = (unsigned char)((*data & 0xFF00) >> 8);
 
 	/* while(!((inb(usp->usp_iobase + 0)) & TxBE)); */
-	outb(module + 1, usp->usp_iobase + 5);	/* sending module number to card(1 .. 12) */
+
+	/* sends module number to card(1 .. 12) */
+	outb(module + 1, usp->usp_iobase + 5);
 	outb('W', usp->usp_iobase + 6);	/* sends (W)rite command to module */
 
 	/* sending for bytes to module(one byte per cycle iteration) */
@@ -475,7 +493,8 @@ static int __unioxx5_analog_read(struct unioxx5_subd_priv *usp,
 	}
 
 	__unioxx5_analog_config(usp, channel);
-	outb(module_no + 1, usp->usp_iobase + 5);	/* sends module number to card(1 .. 12) */
+	/* sends module number to card(1 .. 12) */
+	outb(module_no + 1, usp->usp_iobase + 5);
 	outb('V', usp->usp_iobase + 6);	/* sends to module (V)erify command */
 	control = inb(usp->usp_iobase);	/* get control register byte */
 
-- 
1.7.0.4


  parent reply	other threads:[~2011-01-09 23:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-09 23:03 [PATCH 1/5] Staging: comedi: fix line-length coding style issue in usbduxfast.c ahern.michael.t
2011-01-09 23:03 ` [PATCH 2/5] Staging: comedi: whitespace ahern.michael.t
2011-01-09 23:03 ` ahern.michael.t [this message]
2011-01-10  6:39   ` [PATCH 3/5] Coding style in unioxx5.c KERN_ facility level and coding style warnings as reported by checkpatch.pl Signed-off-by: Michael Ahern <ahern.michael.t@gmail.com> Greg KH
2011-01-09 23:03 ` [PATCH 4/5] Coding style in serial2002 Patch that resolves braces and KERN_ warnings by checkpatch.pl Signed-off-by: Michael Ahern ahern.michael.t
2011-01-09 23:56   ` Joe Perches
2011-01-09 23:03 ` [PATCH 5/5] Coding style in s626 Patch that resolves line length warnings by checkpatch.pl Signed-off-by: Michael Ahern <ahern.michael.t@gmail.com> ahern.michael.t
2011-01-10  6:39   ` Greg KH
2011-01-10  6:36 ` [PATCH 1/5] Staging: comedi: fix line-length coding style issue in usbduxfast.c Greg KH

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=1294614196-6665-3-git-send-email-ahern.michael.t@gmail.com \
    --to=ahern.michael.t@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=julia@diku.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=morgan.gatti@gmail.com \
    --cc=nikai@nikai.net \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 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.