LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/5] staging: comedi: 8255.[ch]: reformat comments
@ 2015-01-26 13:25 Ian Abbott
  2015-01-26 13:25 ` [PATCH 1/5] staging: comedi: 8255.c: reformat copyright comment Ian Abbott
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Ian Abbott @ 2015-01-26 13:25 UTC (permalink / raw)
  To: driverdev-devel
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, linux-kernel

Reformat comments to usual style and add kerneldoc to exported
functions.

1) staging: comedi: 8255.c: reformat copyright comment
2) staging: comedi: 8255.c: reformat comedi driver comment
3) staging: comedi: 8255.c: document subdev_8255_init() and _mm_init()
4) staging: comedi: 8255.c: reformat remaining block comments
5) staging: comedi: 8255.h: reformat copyright comment

 drivers/staging/comedi/drivers/8255.c | 174 ++++++++++++++++++++--------------
 drivers/staging/comedi/drivers/8255.h |  32 +++----
 2 files changed, 117 insertions(+), 89 deletions(-)

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

* [PATCH 1/5] staging: comedi: 8255.c: reformat copyright comment
  2015-01-26 13:25 [PATCH 0/5] staging: comedi: 8255.[ch]: reformat comments Ian Abbott
@ 2015-01-26 13:25 ` Ian Abbott
  2015-01-26 13:25 ` [PATCH 2/5] staging: comedi: 8255.c: reformat comedi driver comment Ian Abbott
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ian Abbott @ 2015-01-26 13:25 UTC (permalink / raw)
  To: driverdev-devel
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, linux-kernel

Use the usual block comment style.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 drivers/staging/comedi/drivers/8255.c | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c
index 34d4d8b..ed1f065 100644
--- a/drivers/staging/comedi/drivers/8255.c
+++ b/drivers/staging/comedi/drivers/8255.c
@@ -1,20 +1,21 @@
 /*
-    comedi/drivers/8255.c
-    Driver for 8255
-
-    COMEDI - Linux Control and Measurement Device Interface
-    Copyright (C) 1998 David A. Schleef <ds@schleef.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
+ * comedi/drivers/8255.c
+ * Driver for 8255
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 1998 David A. Schleef <ds@schleef.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
 
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-*/
 /*
 Driver: 8255
 Description: generic 8255 support
-- 
2.1.4


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

* [PATCH 2/5] staging: comedi: 8255.c: reformat comedi driver comment
  2015-01-26 13:25 [PATCH 0/5] staging: comedi: 8255.[ch]: reformat comments Ian Abbott
  2015-01-26 13:25 ` [PATCH 1/5] staging: comedi: 8255.c: reformat copyright comment Ian Abbott
@ 2015-01-26 13:25 ` Ian Abbott
  2015-01-26 13:25 ` [PATCH 3/5] staging: comedi: 8255.c: document subdev_8255_init() and _mm_init() Ian Abbott
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ian Abbott @ 2015-01-26 13:25 UTC (permalink / raw)
  To: driverdev-devel
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, linux-kernel

Use the usual block comment style.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 drivers/staging/comedi/drivers/8255.c | 61 +++++++++++++++++------------------
 1 file changed, 30 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c
index ed1f065..fafe40b 100644
--- a/drivers/staging/comedi/drivers/8255.c
+++ b/drivers/staging/comedi/drivers/8255.c
@@ -17,37 +17,36 @@
  */
 
 /*
-Driver: 8255
-Description: generic 8255 support
-Devices: [standard] 8255 (8255)
-Author: ds
-Status: works
-Updated: Fri,  7 Jun 2002 12:56:45 -0700
-
-The classic in digital I/O.  The 8255 appears in Comedi as a single
-digital I/O subdevice with 24 channels.  The channel 0 corresponds
-to the 8255's port A, bit 0; channel 23 corresponds to port C, bit
-7.  Direction configuration is done in blocks, with channels 0-7,
-8-15, 16-19, and 20-23 making up the 4 blocks.  The only 8255 mode
-supported is mode 0.
-
-You should enable compilation this driver if you plan to use a board
-that has an 8255 chip.  For multifunction boards, the main driver will
-configure the 8255 subdevice automatically.
-
-This driver also works independently with ISA and PCI cards that
-directly map the 8255 registers to I/O ports, including cards with
-multiple 8255 chips.  To configure the driver for such a card, the
-option list should be a list of the I/O port bases for each of the
-8255 chips.  For example,
-
-  comedi_config /dev/comedi0 8255 0x200,0x204,0x208,0x20c
-
-Note that most PCI 8255 boards do NOT work with this driver, and
-need a separate driver as a wrapper.  For those that do work, the
-I/O port base address can be found in the output of 'lspci -v'.
-
-*/
+ * Driver: 8255
+ * Description: generic 8255 support
+ * Devices: [standard] 8255 (8255)
+ * Author: ds
+ * Status: works
+ * Updated: Fri,  7 Jun 2002 12:56:45 -0700
+ *
+ * The classic in digital I/O.  The 8255 appears in Comedi as a single
+ * digital I/O subdevice with 24 channels.  The channel 0 corresponds
+ * to the 8255's port A, bit 0; channel 23 corresponds to port C, bit
+ * 7.  Direction configuration is done in blocks, with channels 0-7,
+ * 8-15, 16-19, and 20-23 making up the 4 blocks.  The only 8255 mode
+ * supported is mode 0.
+ *
+ * You should enable compilation this driver if you plan to use a board
+ * that has an 8255 chip.  For multifunction boards, the main driver will
+ * configure the 8255 subdevice automatically.
+ *
+ * This driver also works independently with ISA and PCI cards that
+ * directly map the 8255 registers to I/O ports, including cards with
+ * multiple 8255 chips.  To configure the driver for such a card, the
+ * option list should be a list of the I/O port bases for each of the
+ * 8255 chips.  For example,
+ *
+ *   comedi_config /dev/comedi0 8255 0x200,0x204,0x208,0x20c
+ *
+ * Note that most PCI 8255 boards do NOT work with this driver, and
+ * need a separate driver as a wrapper.  For those that do work, the
+ * I/O port base address can be found in the output of 'lspci -v'.
+ */
 
 /*
    This file contains an exported subdevice for driving an 8255.
-- 
2.1.4


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

* [PATCH 3/5] staging: comedi: 8255.c: document subdev_8255_init() and _mm_init()
  2015-01-26 13:25 [PATCH 0/5] staging: comedi: 8255.[ch]: reformat comments Ian Abbott
  2015-01-26 13:25 ` [PATCH 1/5] staging: comedi: 8255.c: reformat copyright comment Ian Abbott
  2015-01-26 13:25 ` [PATCH 2/5] staging: comedi: 8255.c: reformat comedi driver comment Ian Abbott
@ 2015-01-26 13:25 ` Ian Abbott
  2015-01-26 13:25 ` [PATCH 4/5] staging: comedi: 8255.c: reformat remaining block comments Ian Abbott
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ian Abbott @ 2015-01-26 13:25 UTC (permalink / raw)
  To: driverdev-devel
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, linux-kernel

Add kerneldoc comments for the subdev_8255_init() and
subdev_8255_mm_init() functions and remove the other comment about how
to use this module in a comedi driver.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 drivers/staging/comedi/drivers/8255.c | 79 ++++++++++++++++++++++++-----------
 1 file changed, 54 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c
index fafe40b..1476157 100644
--- a/drivers/staging/comedi/drivers/8255.c
+++ b/drivers/staging/comedi/drivers/8255.c
@@ -48,31 +48,6 @@
  * I/O port base address can be found in the output of 'lspci -v'.
  */
 
-/*
-   This file contains an exported subdevice for driving an 8255.
-
-   To use this subdevice as part of another driver, you need to
-   set up the subdevice in the attach function of the driver by
-   calling:
-
-     subdev_8255_init(device, subdevice, io_function, iobase)
-
-   device and subdevice are pointers to the device and subdevice
-   structures.  io_function will be called to provide the
-   low-level input/output to the device, i.e., actual register
-   access.  io_function will be called with the value of iobase
-   as the last parameter.  If the 8255 device is mapped as 4
-   consecutive I/O ports, you can use NULL for io_function
-   and the I/O port base for iobase, and an internal function will
-   handle the register access.
-
-   In addition, if the main driver handles interrupts, you can
-   enable commands on the subdevice by calling subdev_8255_init_irq()
-   instead.  Then, when you get an interrupt that is likely to be
-   from the 8255, you should call subdev_8255_interrupt(), which
-   will copy the latched value to a Comedi buffer.
- */
-
 #include <linux/module.h>
 #include "../comedidev.h"
 
@@ -218,6 +193,33 @@ static int __subdev_8255_init(struct comedi_device *dev,
 	return 0;
 }
 
+/**
+ * subdev_8255_init - initialize DIO subdevice for driving I/O mapped 8255
+ * @dev: comedi device owning subdevice
+ * @s: comedi subdevice to initialize
+ * @io: (optional) register I/O call-back function
+ * @regbase: offset of 8255 registers from dev->iobase, or call-back context
+ *
+ * Initializes a comedi subdevice as a DIO subdevice driving an 8255 chip.
+ *
+ * If the optional I/O call-back function is provided, its prototype is of
+ * the following form:
+ *
+ *   int my_8255_callback(struct comedi_device *dev,
+ *                        struct comedi_subdevice *s, int dir, int port,
+ *                        int data, unsigned long regbase);
+ *
+ * where 'dev', 's', and 'regbase' match the values passed to this function,
+ * 'port' is the 8255 port number 0 to 3 (including the control port), 'dir'
+ * is the direction (0 for read, 1 for write) and 'data' is the value to be
+ * written.  It should return 0 if writing or the value read if reading.
+ *
+ * If the optional I/O call-back function is not provided, an internal
+ * call-back function is used which uses consecutive I/O port addresses
+ * starting at dev->iobase + regbase.
+ *
+ * Return: -ENOMEM if failed to allocate memory, zero on success.
+ */
 int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
 		     int (*io)(struct comedi_device *,
 			       int, int, int, unsigned long),
@@ -227,6 +229,33 @@ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
 }
 EXPORT_SYMBOL_GPL(subdev_8255_init);
 
+/**
+ * subdev_8255_mm_init - initialize DIO subdevice for driving mmio-mapped 8255
+ * @dev: comedi device owning subdevice
+ * @s: comedi subdevice to initialize
+ * @io: (optional) register I/O call-back function
+ * @regbase: offset of 8255 registers from dev->mmio, or call-back context
+ *
+ * Initializes a comedi subdevice as a DIO subdevice driving an 8255 chip.
+ *
+ * If the optional I/O call-back function is provided, its prototype is of
+ * the following form:
+ *
+ *   int my_8255_callback(struct comedi_device *dev,
+ *                        struct comedi_subdevice *s, int dir, int port,
+ *                        int data, unsigned long regbase);
+ *
+ * where 'dev', 's', and 'regbase' match the values passed to this function,
+ * 'port' is the 8255 port number 0 to 3 (including the control port), 'dir'
+ * is the direction (0 for read, 1 for write) and 'data' is the value to be
+ * written.  It should return 0 if writing or the value read if reading.
+ *
+ * If the optional I/O call-back function is not provided, an internal
+ * call-back function is used which uses consecutive MMIO virtual addresses
+ * starting at dev->mmio + regbase.
+ *
+ * Return: -ENOMEM if failed to allocate memory, zero on success.
+ */
 int subdev_8255_mm_init(struct comedi_device *dev, struct comedi_subdevice *s,
 			int (*io)(struct comedi_device *,
 				  int, int, int, unsigned long),
-- 
2.1.4


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

* [PATCH 4/5] staging: comedi: 8255.c: reformat remaining block comments
  2015-01-26 13:25 [PATCH 0/5] staging: comedi: 8255.[ch]: reformat comments Ian Abbott
                   ` (2 preceding siblings ...)
  2015-01-26 13:25 ` [PATCH 3/5] staging: comedi: 8255.c: document subdev_8255_init() and _mm_init() Ian Abbott
@ 2015-01-26 13:25 ` Ian Abbott
  2015-01-26 13:25 ` [PATCH 5/5] staging: comedi: 8255.h: reformat copyright comment Ian Abbott
  2015-01-26 17:14 ` [PATCH 0/5] staging: comedi: 8255.[ch]: reformat comments Hartley Sweeten
  5 siblings, 0 replies; 7+ messages in thread
From: Ian Abbott @ 2015-01-26 13:25 UTC (permalink / raw)
  To: driverdev-devel
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, linux-kernel

Use the usual block comment formatting style.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 drivers/staging/comedi/drivers/8255.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c
index 1476157..c2f15de 100644
--- a/drivers/staging/comedi/drivers/8255.c
+++ b/drivers/staging/comedi/drivers/8255.c
@@ -264,10 +264,9 @@ int subdev_8255_mm_init(struct comedi_device *dev, struct comedi_subdevice *s,
 	return __subdev_8255_init(dev, s, io, regbase, true);
 }
 EXPORT_SYMBOL_GPL(subdev_8255_mm_init);
-/*
-
-   Start of the 8255 standalone device
 
+/*
+ * Start of the 8255 standalone device
  */
 
 static int dev_8255_attach(struct comedi_device *dev,
-- 
2.1.4


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

* [PATCH 5/5] staging: comedi: 8255.h: reformat copyright comment
  2015-01-26 13:25 [PATCH 0/5] staging: comedi: 8255.[ch]: reformat comments Ian Abbott
                   ` (3 preceding siblings ...)
  2015-01-26 13:25 ` [PATCH 4/5] staging: comedi: 8255.c: reformat remaining block comments Ian Abbott
@ 2015-01-26 13:25 ` Ian Abbott
  2015-01-26 17:14 ` [PATCH 0/5] staging: comedi: 8255.[ch]: reformat comments Hartley Sweeten
  5 siblings, 0 replies; 7+ messages in thread
From: Ian Abbott @ 2015-01-26 13:25 UTC (permalink / raw)
  To: driverdev-devel
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, linux-kernel

Use the usual block comment style.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 drivers/staging/comedi/drivers/8255.h | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/comedi/drivers/8255.h b/drivers/staging/comedi/drivers/8255.h
index 5985c8e..934b940 100644
--- a/drivers/staging/comedi/drivers/8255.h
+++ b/drivers/staging/comedi/drivers/8255.h
@@ -1,20 +1,20 @@
 /*
-    module/8255.h
-    Header file for 8255
-
-    COMEDI - Linux Control and Measurement Device Interface
-    Copyright (C) 1998 David A. Schleef <ds@schleef.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-*/
+ * module/8255.h
+ * Header file for 8255
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 1998 David A. Schleef <ds@schleef.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
 
 #ifndef _8255_H
 #define _8255_H
-- 
2.1.4


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

* RE: [PATCH 0/5] staging: comedi: 8255.[ch]: reformat comments
  2015-01-26 13:25 [PATCH 0/5] staging: comedi: 8255.[ch]: reformat comments Ian Abbott
                   ` (4 preceding siblings ...)
  2015-01-26 13:25 ` [PATCH 5/5] staging: comedi: 8255.h: reformat copyright comment Ian Abbott
@ 2015-01-26 17:14 ` Hartley Sweeten
  5 siblings, 0 replies; 7+ messages in thread
From: Hartley Sweeten @ 2015-01-26 17:14 UTC (permalink / raw)
  To: Ian Abbott, driverdev-devel; +Cc: Greg Kroah-Hartman, linux-kernel

On Monday, January 26, 2015 6:25 AM, Ian Abbott wrote:
> Reformat comments to usual style and add kerneldoc to exported
> functions.
>
> 1) staging: comedi: 8255.c: reformat copyright comment
> 2) staging: comedi: 8255.c: reformat comedi driver comment
> 3) staging: comedi: 8255.c: document subdev_8255_init() and _mm_init()
 >4) staging: comedi: 8255.c: reformat remaining block comments
> 5) staging: comedi: 8255.h: reformat copyright comment
>
> drivers/staging/comedi/drivers/8255.c | 174 ++++++++++++++++++++--------------
> drivers/staging/comedi/drivers/8255.h |  32 +++----
> 2 files changed, 117 insertions(+), 89 deletions(-)

Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>


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

end of thread, other threads:[~2015-01-26 17:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-26 13:25 [PATCH 0/5] staging: comedi: 8255.[ch]: reformat comments Ian Abbott
2015-01-26 13:25 ` [PATCH 1/5] staging: comedi: 8255.c: reformat copyright comment Ian Abbott
2015-01-26 13:25 ` [PATCH 2/5] staging: comedi: 8255.c: reformat comedi driver comment Ian Abbott
2015-01-26 13:25 ` [PATCH 3/5] staging: comedi: 8255.c: document subdev_8255_init() and _mm_init() Ian Abbott
2015-01-26 13:25 ` [PATCH 4/5] staging: comedi: 8255.c: reformat remaining block comments Ian Abbott
2015-01-26 13:25 ` [PATCH 5/5] staging: comedi: 8255.h: reformat copyright comment Ian Abbott
2015-01-26 17:14 ` [PATCH 0/5] staging: comedi: 8255.[ch]: reformat comments Hartley Sweeten

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