2015-05-22 17:16:14

by Ian Abbott

[permalink] [raw]
Subject: [PATCH 0/6] staging: comedi: amplc_dio200*: minor source cleanups

A few coding style cleanups for the Comedi amplc_dio200* modules, and to
make the "amplc_dio200.h" header file self-reliant.

1) staging: comedi: amplc_dio200.h: reformat copyright comment
2) staging: comedi: amplc_dio200.h: make self-reliant
3) staging: comedi: amplc_dio200.c: reformat copyright comment
4) staging: comedi: amplc_dio200_common.c: reformat copyright comment
5) staging: comedi: amplc_dio200_common.c: fix up brace style
6) staging: comedi: amplc_dio200_pci.c: reformat copyright comment

drivers/staging/comedi/drivers/amplc_dio200.c | 37 ++++++++-------
drivers/staging/comedi/drivers/amplc_dio200.h | 44 +++++++++--------
.../staging/comedi/drivers/amplc_dio200_common.c | 55 ++++++++++++----------
drivers/staging/comedi/drivers/amplc_dio200_pci.c | 35 +++++++-------
4 files changed, 91 insertions(+), 80 deletions(-)


2015-05-22 17:17:38

by Ian Abbott

[permalink] [raw]
Subject: [PATCH 1/6] staging: comedi: amplc_dio200.h: reformat copyright comment

Reformat the copyright comment at the top of the file to use the
preferred block comment style.

Signed-off-by: Ian Abbott <[email protected]>
---
drivers/staging/comedi/drivers/amplc_dio200.h | 40 +++++++++++++--------------
1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_dio200.h b/drivers/staging/comedi/drivers/amplc_dio200.h
index d6d6a26..2dbeea6 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200.h
+++ b/drivers/staging/comedi/drivers/amplc_dio200.h
@@ -1,24 +1,24 @@
/*
- comedi/drivers/amplc_dio.h
-
- Header for amplc_dio200.c, amplc_dio200_common.c and
- amplc_dio200_pci.c.
-
- Copyright (C) 2005-2013 MEV Ltd. <http://www.mev.co.uk/>
-
- COMEDI - Linux Control and Measurement Device Interface
- Copyright (C) 1998,2000 David A. Schleef <[email protected]>
-
- 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.
-*/
+ * comedi/drivers/amplc_dio.h
+ *
+ * Header for amplc_dio200.c, amplc_dio200_common.c and
+ * amplc_dio200_pci.c.
+ *
+ * Copyright (C) 2005-2013 MEV Ltd. <http://www.mev.co.uk/>
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 1998,2000 David A. Schleef <[email protected]>
+ *
+ * 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 AMPLC_DIO200_H_INCLUDED
#define AMPLC_DIO200_H_INCLUDED
--
2.1.4

2015-05-22 17:16:21

by Ian Abbott

[permalink] [raw]
Subject: [PATCH 2/6] staging: comedi: amplc_dio200.h: make self-reliant

The Comedi "amplc_dio200.h" header file included by drivers for Amplicon
DIO200 series cards does not compile cleanly when it is the first header
included by the ".c" file. It uses `struct comedi_device *` in the
parameter lists of some function prototypes, so just declare `struct
comedi_device` as an incomplete type. It also uses `bool`, so include
<linux/types.h> to declare it.

Signed-off-by: Ian Abbott <[email protected]>
---
drivers/staging/comedi/drivers/amplc_dio200.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/staging/comedi/drivers/amplc_dio200.h b/drivers/staging/comedi/drivers/amplc_dio200.h
index 2dbeea6..53fb86d 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200.h
+++ b/drivers/staging/comedi/drivers/amplc_dio200.h
@@ -23,6 +23,10 @@
#ifndef AMPLC_DIO200_H_INCLUDED
#define AMPLC_DIO200_H_INCLUDED

+#include <linux/types.h>
+
+struct comedi_device;
+
/*
* Subdevice types.
*/
--
2.1.4

2015-05-22 17:16:18

by Ian Abbott

[permalink] [raw]
Subject: [PATCH 3/6] staging: comedi: amplc_dio200.c: reformat copyright comment

Reformat the copyright comment at the top of the file to use the
preferred block comment style.

Signed-off-by: Ian Abbott <[email protected]>
---
drivers/staging/comedi/drivers/amplc_dio200.c | 37 ++++++++++++++-------------
1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c
index 4fe1183..f5cfa71 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200.c
@@ -1,23 +1,24 @@
/*
- comedi/drivers/amplc_dio200.c
-
- Driver for Amplicon PC212E, PC214E, PC215E, PC218E, PC272E.
-
- Copyright (C) 2005-2013 MEV Ltd. <http://www.mev.co.uk/>
-
- COMEDI - Linux Control and Measurement Device Interface
- Copyright (C) 1998,2000 David A. Schleef <[email protected]>
-
- 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/amplc_dio200.c
+ *
+ * Driver for Amplicon PC212E, PC214E, PC215E, PC218E, PC272E.
+ *
+ * Copyright (C) 2005-2013 MEV Ltd. <http://www.mev.co.uk/>
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 1998,2000 David A. Schleef <[email protected]>
+ *
+ * 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: amplc_dio200
* Description: Amplicon 200 Series ISA Digital I/O
--
2.1.4

2015-05-22 17:17:13

by Ian Abbott

[permalink] [raw]
Subject: [PATCH 4/6] staging: comedi: amplc_dio200_common.c: reformat copyright comment

Reformat the copyright comment at the top of the file to use the
preferred block comment style.

Signed-off-by: Ian Abbott <[email protected]>
---
.../staging/comedi/drivers/amplc_dio200_common.c | 38 +++++++++++-----------
1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c
index 3a8b3f2..8886252 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
@@ -1,23 +1,23 @@
/*
- comedi/drivers/amplc_dio200_common.c
-
- Common support code for "amplc_dio200" and "amplc_dio200_pci".
-
- Copyright (C) 2005-2013 MEV Ltd. <http://www.mev.co.uk/>
-
- COMEDI - Linux Control and Measurement Device Interface
- Copyright (C) 1998,2000 David A. Schleef <[email protected]>
-
- 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.
-*/
+ * comedi/drivers/amplc_dio200_common.c
+ *
+ * Common support code for "amplc_dio200" and "amplc_dio200_pci".
+ *
+ * Copyright (C) 2005-2013 MEV Ltd. <http://www.mev.co.uk/>
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 1998,2000 David A. Schleef <[email protected]>
+ *
+ * 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.
+ */

#include <linux/module.h>
#include <linux/interrupt.h>
--
2.1.4

2015-05-22 17:16:23

by Ian Abbott

[permalink] [raw]
Subject: [PATCH 5/6] staging: comedi: amplc_dio200_common.c: fix up brace style

Use braces when the single statement following an `if` (or `else`)
spans more than one line (including any preceding comments).

Signed-off-by: Ian Abbott <[email protected]>
---
drivers/staging/comedi/drivers/amplc_dio200_common.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c
index 8886252..d1539e7 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
@@ -337,9 +337,10 @@ static int dio200_handle_read_intr(struct comedi_device *dev,
* interested in (just in case there's a race
* condition).
*/
- if (triggered & subpriv->enabled_isns)
+ if (triggered & subpriv->enabled_isns) {
/* Collect scan data. */
dio200_read_scan_intr(dev, s, triggered);
+ }
}
}
spin_unlock_irqrestore(&subpriv->spinlock, flags);
@@ -576,12 +577,13 @@ static int dio200_subdev_8254_init(struct comedi_device *dev,
regshift = 0;
}

- if (dev->mmio)
+ if (dev->mmio) {
i8254 = comedi_8254_mm_init(dev->mmio + offset,
0, I8254_IO8, regshift);
- else
+ } else {
i8254 = comedi_8254_init(dev->iobase + offset,
0, I8254_IO8, regshift);
+ }
if (!i8254)
return -ENOMEM;

@@ -641,15 +643,18 @@ static int dio200_subdev_8255_bits(struct comedi_device *dev,

mask = comedi_dio_update_state(s, data);
if (mask) {
- if (mask & 0xff)
+ if (mask & 0xff) {
dio200_write8(dev, subpriv->ofs + I8255_DATA_A_REG,
s->state & 0xff);
- if (mask & 0xff00)
+ }
+ if (mask & 0xff00) {
dio200_write8(dev, subpriv->ofs + I8255_DATA_B_REG,
(s->state >> 8) & 0xff);
- if (mask & 0xff0000)
+ }
+ if (mask & 0xff0000) {
dio200_write8(dev, subpriv->ofs + I8255_DATA_C_REG,
(s->state >> 16) & 0xff);
+ }
}

val = dio200_read8(dev, subpriv->ofs + I8255_DATA_A_REG);
--
2.1.4

2015-05-22 17:16:25

by Ian Abbott

[permalink] [raw]
Subject: [PATCH 6/6] staging: comedi: amplc_dio200_pci.c: reformat copyright comment

Reformat the copyright comment at the top of the file to use the
preferred block comment style.

Signed-off-by: Ian Abbott <[email protected]>
---
drivers/staging/comedi/drivers/amplc_dio200_pci.c | 35 ++++++++++++-----------
1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_dio200_pci.c b/drivers/staging/comedi/drivers/amplc_dio200_pci.c
index d9850c9..2598e6e 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200_pci.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200_pci.c
@@ -1,22 +1,23 @@
/* comedi/drivers/amplc_dio200_pci.c
+ *
+ * Driver for Amplicon PCI215, PCI272, PCIe215, PCIe236, PCIe296.
+ *
+ * Copyright (C) 2005-2013 MEV Ltd. <http://www.mev.co.uk/>
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 1998,2000 David A. Schleef <[email protected]>
+ *
+ * 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.
+ */

- Driver for Amplicon PCI215, PCI272, PCIe215, PCIe236, PCIe296.
-
- Copyright (C) 2005-2013 MEV Ltd. <http://www.mev.co.uk/>
-
- COMEDI - Linux Control and Measurement Device Interface
- Copyright (C) 1998,2000 David A. Schleef <[email protected]>
-
- 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.
-*/
/*
* Driver: amplc_dio200_pci
* Description: Amplicon 200 Series PCI Digital I/O
--
2.1.4

2015-05-27 00:20:27

by Hartley Sweeten

[permalink] [raw]
Subject: RE: [PATCH 0/6] staging: comedi: amplc_dio200*: minor source cleanups

On Friday, May 22, 2015 10:16 AM, Ian Abbott wrote:
> A few coding style cleanups for the Comedi amplc_dio200* modules, and to
> make the "amplc_dio200.h" header file self-reliant.
>
> 1) staging: comedi: amplc_dio200.h: reformat copyright comment
> 2) staging: comedi: amplc_dio200.h: make self-reliant
> 3) staging: comedi: amplc_dio200.c: reformat copyright comment
> 4) staging: comedi: amplc_dio200_common.c: reformat copyright comment
> 5) staging: comedi: amplc_dio200_common.c: fix up brace style
> 6) staging: comedi: amplc_dio200_pci.c: reformat copyright comment
>
> drivers/staging/comedi/drivers/amplc_dio200.c | 37 ++++++++-------
> drivers/staging/comedi/drivers/amplc_dio200.h | 44 +++++++++--------
> .../staging/comedi/drivers/amplc_dio200_common.c | 55 ++++++++++++----------
> drivers/staging/comedi/drivers/amplc_dio200_pci.c | 35 +++++++-------
> 4 files changed, 91 insertions(+), 80 deletions(-)

Reviewed-by: H Hartley Sweeten <[email protected]>