Re: lustre/lnet/lnet/lib-move.c: memcpy with (struct iovec*)->iov_base, which is __user

2015-01-07 Thread Dan Carpenter
Didn't Al change these to kvec instead of iovec?  You have to look at
the callers to figure out if it's actually a user space pointer or a
kernel pointer.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v8 2/4] fpga manager: add sysfs interface document

2015-01-07 Thread Pavel Machek
On Tue 2015-01-06 14:13:37, at...@opensource.altera.com wrote:
> From: Alan Tull 
> 
> Add documentation under drivers/staging for new fpga manager's
> sysfs interface.
> 
> Signed-off-by: Alan Tull 
> ---
> v5  : (actually second version, but keeping version numbers
>   aligned with rest of patch series)
>   Move document to drivers/staging/fpga/Documentation/ABI
> 
> v6  : No change in this patch for v6 of the patch set
> 
> v7  : No change in this patch for v7 of the patch set
> 
> v8  : No change in this patch for v8 of the patch set
> ---
>  .../Documentation/ABI/sysfs-class-fpga-manager |   38 
> 
>  1 file changed, 38 insertions(+)
>  create mode 100644 
> drivers/staging/fpga/Documentation/ABI/sysfs-class-fpga-manager
> 
> diff --git a/drivers/staging/fpga/Documentation/ABI/sysfs-class-fpga-manager 
> b/drivers/staging/fpga/Documentation/ABI/sysfs-class-fpga-manager
> new file mode 100644
> index 000..eb600f2
> --- /dev/null
> +++ b/drivers/staging/fpga/Documentation/ABI/sysfs-class-fpga-manager
> @@ -0,0 +1,38 @@
> +What:/sys/class/fpga_manager//name
> +Date:October 2014
> +KernelVersion:   3.18
> +Contact: Alan Tull 
> +Description: Name of low level driver.
> +
> +What:/sys/class/fpga_manager//firmware
> +Date:October 2014
> +KernelVersion:   3.18
> +Contact: Alan Tull 
> +Description: Name of the FPGA image file to load using firmware
> class.

This one is ugly: it unneccessarily passes firmware name through the
kernel. Just make interface and code simpler by always passing
"socfpga-fpga-image" or something like that.

Thanks,
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/3] staging: android: fix indentation to match open parenthesis

2015-01-07 Thread Fabian Holler
This patches fixes the following checkpatch.pl warning:
ashmem.c:450: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open 
parenthesis

Signed-off-by: Fabian Holler 
---
 drivers/staging/android/ashmem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index 8c78527..181a71e 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -447,8 +447,8 @@ ashmem_shrink_scan(struct shrinker *shrink, struct 
shrink_control *sc)
loff_t end = (range->pgend + 1) * PAGE_SIZE;
 
vfs_fallocate(range->asma->file,
-   FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
-   start, end - start);
+ FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
+ start, end - start);
range->purged = ASHMEM_WAS_PURGED;
lru_del(range);
 
-- 
2.1.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/3] staging: android: remove blank lines after open braces

2015-01-07 Thread Fabian Holler
This patch fixes the following checkpatch.pl warnings:
ashmem.c:552: CHECK:BRACES: Blank lines aren't necessary after an open 
brace '{'
ashmem.c:801: CHECK:BRACES: Blank lines aren't necessary after an open 
brace

Signed-off-by: Fabian Holler 
---
 drivers/staging/android/ashmem.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index 181a71e..6b228d9 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -549,7 +549,6 @@ static int get_name(struct ashmem_area *asma, void __user 
*name)
 
mutex_lock(&ashmem_mutex);
if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0') {
-
/*
 * Copying only `len', instead of ASHMEM_NAME_LEN, bytes
 * prevents us from revealing one user's stack to another.
@@ -798,7 +797,6 @@ static long ashmem_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
 static long compat_ashmem_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
 {
-
switch (cmd) {
case COMPAT_ASHMEM_SET_SIZE:
cmd = ASHMEM_SET_SIZE;
-- 
2.1.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/3] staging: android: fix checkpatch warnings in ashmem.c

2015-01-07 Thread Fabian Holler
Hello,

this patchset fixes the checkpatch.pl warnings in
drivers/staging/android/ashmem.c

regards

Fabian

Fabian Holler (3):
  staging: android: fix indentation to match open parenthesis
  staging: android: remove unnecessary blank lines after open brace
  staging: android: remove unnecessary space after cast

 drivers/staging/android/ashmem.c | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

-- 
2.1.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/3] staging: android: remove space after casts

2015-01-07 Thread Fabian Holler
This patch fixes the following checkpatch.pl warnings:
ashmem.c:753: CHECK:SPACING: No space is necessary after a cast
ashmem.c:756: CHECK:SPACING: No space is necessary after a cast
ashmem.c:777: CHECK:SPACING: No space is necessary after a cast

Signed-off-by: Fabian Holler 
---
 drivers/staging/android/ashmem.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index 6b228d9..d140b733 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -750,10 +750,10 @@ static long ashmem_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
 
switch (cmd) {
case ASHMEM_SET_NAME:
-   ret = set_name(asma, (void __user *) arg);
+   ret = set_name(asma, (void __user *)arg);
break;
case ASHMEM_GET_NAME:
-   ret = get_name(asma, (void __user *) arg);
+   ret = get_name(asma, (void __user *)arg);
break;
case ASHMEM_SET_SIZE:
ret = -EINVAL;
@@ -774,7 +774,7 @@ static long ashmem_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
case ASHMEM_PIN:
case ASHMEM_UNPIN:
case ASHMEM_GET_PIN_STATUS:
-   ret = ashmem_pin_unpin(asma, cmd, (void __user *) arg);
+   ret = ashmem_pin_unpin(asma, cmd, (void __user *)arg);
break;
case ASHMEM_PURGE_ALL_CACHES:
ret = -EPERM;
-- 
2.1.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: lustre/lnet/lnet/lib-move.c: memcpy with (struct iovec*)->iov_base, which is __user

2015-01-07 Thread Andrey Utkin
2015-01-07 10:36 GMT+02:00 Dan Carpenter :
> Didn't Al change these to kvec instead of iovec?  You have to look at
> the callers to figure out if it's actually a user space pointer or a
> kernel pointer.

I am looking at current linux-next checkout.

-- 
Andrey Utkin
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: lustre/lnet/lnet/lib-move.c: memcpy with (struct iovec*)->iov_base, which is __user

2015-01-07 Thread Dilger, Andreas
On 2015/01/07, 1:36 AM, "Dan Carpenter"  wrote:
> Didn't Al change these to kvec instead of iovec?  You have to look at
> the callers to figure out if it's actually a user space pointer or a
> kernel pointer.

A patch was sent by Al on Dec 2 to replace iovec with kvec, in a thread
titled "[PATCH] staging:lustre:lnet: Incorrect type in assignment".  Greg
replied on Dec 10 in another thread (also fixing this same warning) titled
"[PATCH] staging: lustre: Fix the warning messages about casting without
__user macro" that Al's patch was in the staging tree for 3.19-rc1.

Cheers, Andreas
-- 
Andreas Dilger

Lustre Software Architect
Intel High Performance Data Division


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: lustre/lnet/lnet/lib-move.c: memcpy with (struct iovec*)->iov_base, which is __user

2015-01-07 Thread Andrey Utkin
2015-01-07 13:32 GMT+02:00 Dilger, Andreas :
> On 2015/01/07, 1:36 AM, "Dan Carpenter"  wrote:
>> Didn't Al change these to kvec instead of iovec?  You have to look at
>> the callers to figure out if it's actually a user space pointer or a
>> kernel pointer.
>
> A patch was sent by Al on Dec 2 to replace iovec with kvec, in a thread
> titled "[PATCH] staging:lustre:lnet: Incorrect type in assignment".  Greg
> replied on Dec 10 in another thread (also fixing this same warning) titled
> "[PATCH] staging: lustre: Fix the warning messages about casting without
> __user macro" that Al's patch was in the staging tree for 3.19-rc1.

In current linux-next, I see none of the mentioned patches. Also I
don't see them mentioned in GKH's merge commit "Merge tag
'staging-3.19-rc1'..."
Is it ok?

-- 
Andrey Utkin
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] STAGING: Fix pcl818.c coding style issue

2015-01-07 Thread simon
 Signed-off-by: Simon Guo 

 Correct coding style problem in pcl818.c
---
 drivers/staging/comedi/drivers/pcl818.c | 50 -
 1 file changed, 30 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcl818.c 
b/drivers/staging/comedi/drivers/pcl818.c
index 8edea35..111bee1 100644
--- a/drivers/staging/comedi/drivers/pcl818.c
+++ b/drivers/staging/comedi/drivers/pcl818.c
@@ -45,11 +45,11 @@ A word or two about DMA. Driver support DMA operations at 
two ways:
 [1] - IRQ  (0=disable, 2, 3, 4, 5, 6, 7)
 [2] - DMA  (0=disable, 1, 3)
 [3] - 0, 10=10MHz clock for 8254
-  1= 1MHz clock for 8254
+ 1= 1MHz clock for 8254
 [4] - 0,  5=A/D input  -5V.. +5V
-  1, 10=A/D input -10V..+10V
+ 1, 10=A/D input -10V..+10V
 [5] - 0,  5=D/A output 0-5V  (internal reference -5V)
-  1, 10=D/A output 0-10V (internal reference -10V)
+ 1, 10=D/A output 0-10V (internal reference -10V)
  2=D/A output unknown (external reference)
 
Options for PCL-818, PCL-818H:
@@ -57,44 +57,44 @@ A word or two about DMA. Driver support DMA operations at 
two ways:
 [1] - IRQ  (0=disable, 2, 3, 4, 5, 6, 7)
 [2] - DMA  (0=disable, 1, 3)
 [3] - 0, 10=10MHz clock for 8254
-  1= 1MHz clock for 8254
+ 1= 1MHz clock for 8254
 [4] - 0,  5=D/A output 0-5V  (internal reference -5V)
-  1, 10=D/A output 0-10V (internal reference -10V)
+ 1, 10=D/A output 0-10V (internal reference -10V)
  2=D/A output unknown (external reference)
 
Options for PCL-818HD, PCL-818HG:
 [0] - IO Base
 [1] - IRQ  (0=disable, 2, 3, 4, 5, 6, 7)
 [2] - DMA/FIFO  (-1=use FIFO, 0=disable both FIFO and DMA,
-  1=use DMA ch 1, 3=use DMA ch 3)
+ 1=use DMA ch 1, 3=use DMA ch 3)
 [3] - 0, 10=10MHz clock for 8254
-  1= 1MHz clock for 8254
+ 1= 1MHz clock for 8254
 [4] - 0,  5=D/A output 0-5V  (internal reference -5V)
-  1, 10=D/A output 0-10V (internal reference -10V)
- 2=D/A output unknown (external reference)
+ 1, 10=D/A output 0-10V (internal reference -10V)
+ 2=D/A output unknown (external reference)
 
Options for PCL-718:
 [0] - IO Base
 [1] - IRQ  (0=disable, 2, 3, 4, 5, 6, 7)
 [2] - DMA  (0=disable, 1, 3)
 [3] - 0, 10=10MHz clock for 8254
-  1= 1MHz clock for 8254
+ 1= 1MHz clock for 8254
 [4] - 0=A/D Range is +/-10V
  1= +/-5V
  2= +/-2.5V
  3= +/-1V
  4= +/-0.5V
- 5= user defined bipolar
+ 5= user defined bipolar
  6= 0-10V
  7= 0-5V
- 8= 0-2V
+ 8= 0-2V
  9= 0-1V
 10= user defined unipolar
 [5] - 0,  5=D/A outputs 0-5V  (internal reference -5V)
-  1, 10=D/A outputs 0-10V (internal reference -10V)
+ 1, 10=D/A outputs 0-10V (internal reference -10V)
  2=D/A outputs unknown (external reference)
 [6] - 0, 60=max  60kHz A/D sampling
-  1,100=max 100kHz A/D sampling (PCL-718 with Option 001 installed)
+ 1,100=max 100kHz A/D sampling (PCL-718 with Option 001 installed)
 
 */
 
@@ -309,11 +309,19 @@ struct pcl818_private {
unsigned long dmabuf[2];/*  pointers to begin of DMA buffers */
unsigned int hwdmaptr[2];   /*  hardware address of DMA buffers */
int next_dma_buf;   /*  which DMA buffer will be used next round */
-   long dma_runs_to_end;   /*  how many we must permorm DMA transfer to 
end of record */
-   unsigned long last_dma_run; /*  how many bytes we must transfer on 
last DMA page */
-   unsigned int ns_min;/*  manimal allowed delay between samples (in 
us) for actual card */
+   long dma_runs_to_end;   /*  how many we must permorm DMA transfer
+*  to end of record
+*/
+   unsigned long last_dma_run; /*  how many bytes we must transfer
+*  on last DMA page
+*/
+   unsigned int ns_min;/*  manimal allowed delay between
+*  samples (in us) for actual card
+*/
int i8253_osc_base; /*  1/frequency of on board oscilator in ns */
-   unsigned int act_chanlist[16];  /*  MUX setting for actual AI 
operations */
+   unsigned int act_chanlist[16];  /*  MUX setting for actual
+*  AI operations
+*/
unsigned int act_chanlist_len;  /*  how long is actual MUX list */
unsigned int act_chan

Re: [PATCH] STAGING: Fix pcl818.c coding style issue

2015-01-07 Thread Greg Kroah-Hartman
On Wed, Jan 07, 2015 at 10:39:24PM +0800, simon wrote:
>  Signed-off-by: Simon Guo 
> 
>  Correct coding style problem in pcl818.c

Why reverse the order here of things?

And what specific coding style issue(s) were fixed, you have to be
specific.

please fix up and resend.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: ft1000: Fix code style issue

2015-01-07 Thread Greg KH
On Wed, Jan 07, 2015 at 12:57:05PM +0530, Arjun AK wrote:
> Remove unnecessary braces from single statement blocks.
> 
> Signed-off-by: Arjun AK 

Is that the name you use to sign legal documents?  If so, great,
otherwise, please resend it with the correct name.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Fixed line over 80 characters warning

2015-01-07 Thread sakshi
Signed-off-by: sakshi 
---
 drivers/staging/vt6655/baseband.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/vt6655/baseband.c 
b/drivers/staging/vt6655/baseband.c
index 86c72ba..c138f9b 100644
--- a/drivers/staging/vt6655/baseband.c
+++ b/drivers/staging/vt6655/baseband.c
@@ -27,7 +27,8 @@
  *
  * Functions:
  *  BBuGetFrameTime- Calculate data frame transmitting time
- *  BBvCaculateParameter   - Caculate PhyLength, PhyService and Phy Signal 
parameter for baseband Tx
+ *  BBvCaculateParameter   - Caculate PhyLength, PhyService and Phy Signal
+ *   parameter for baseband Tx
  *  BBbReadEmbedded - Embedded read baseband register via MAC
  *  BBbWriteEmbedded- Embedded write baseband register via MAC
  *  BBbVT3253Init  - VIA VT3253 baseband chip init code
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Fixed line over 80 characters warning

2015-01-07 Thread Greg KH
On Wed, Jan 07, 2015 at 10:37:26PM +0530, sakshi wrote:
> Signed-off-by: sakshi 

Your subject needs to provide a little bit more data, as what part of
the kernel you are modifying, and the like.  Look at existing patches
for examples of this.

Also, we need a changelog body, saying what you are doing.

And finally, we need a "full" name for the From: and signed-off-by:
line, I doubt you sign legal documents with just those 6 letters, right?

Please fix up and resend.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/8] staging: comedi: aio_iiro_16: cleaup driver

2015-01-07 Thread H Hartley Sweeten
Tidy up this driver and add async command support for change-of-state
detection of the digital inputs.

H Hartley Sweeten (8):
  staging: comedi: aio_iiro_16: fix subdevice 0 'type'
  staging: comedi: aio_iiro_16: fix subdevice 1 'type'
  staging: comedi: aio_iiro_16: tidy up subdevice init
  staging: comedi: aio_iiro_16: tidy up multi-line comments
  staging: comedi: aio_iiro_16: read intial state of the digital outputs
  staging: comedi: aio_iiro_16: introduce aio_iiro_enable_irq()
  staging: comedi: aio_iiro_16: add command support for change of state 
detection
  staging: comedi: aio_iiro_16: update the MODULE_DESCRIPTION

 drivers/staging/comedi/drivers/aio_iiro_16.c | 219 ---
 1 file changed, 168 insertions(+), 51 deletions(-)

-- 
2.0.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/8] staging: comedi: aio_iiro_16: tidy up multi-line comments

2015-01-07 Thread H Hartley Sweeten
Tidy up the multi-line comments to follow the kernel CodingStyle.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/aio_iiro_16.c | 51 +---
 1 file changed, 23 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/comedi/drivers/aio_iiro_16.c 
b/drivers/staging/comedi/drivers/aio_iiro_16.c
index 3637269..96ea174 100644
--- a/drivers/staging/comedi/drivers/aio_iiro_16.c
+++ b/drivers/staging/comedi/drivers/aio_iiro_16.c
@@ -1,34 +1,29 @@
 /*
-
-comedi/drivers/aio_iiro_16.c
-
-Driver for Access I/O Products PC-104 AIO-IIRO-16 Digital I/O board
-Copyright (C) 2006 C&C Technologies, Inc.
-
-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.
-*/
+ * aio_iiro_16.c
+ * Comedi driver for Access I/O Products 104-IIRO-16 board
+ * Copyright (C) 2006 C&C Technologies, Inc.
+ *
+ * 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: aio_iiro_16
-Description: Access I/O Products PC-104 IIRO16 Relay And Isolated Input Board
-Author: Zachary Ware 
-Devices:
- [Access I/O] PC-104 AIO12-8
-Status: experimental
-
-Configuration Options:
-  [0] - I/O port base address
-
-*/
+ * Driver: aio_iiro_16
+ * Description: Access I/O Products PC/104 Isolated Input/Relay Output Board
+ * Author: Zachary Ware 
+ * Devices: [Access I/O] 104-IIRO-16 (aio_iiro_16)
+ * Status: experimental
+ *
+ * Configuration Options:
+ *   [0] - I/O port base address
+ */
 
 #include 
 #include "../comedidev.h"
-- 
2.0.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/8] staging: comedi: aio_iiro_16: tidy up subdevice init

2015-01-07 Thread H Hartley Sweeten
For aesthetics, add some white space to the subdevice initialization.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/aio_iiro_16.c | 28 +++-
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/comedi/drivers/aio_iiro_16.c 
b/drivers/staging/comedi/drivers/aio_iiro_16.c
index 2cfbb61..3637269 100644
--- a/drivers/staging/comedi/drivers/aio_iiro_16.c
+++ b/drivers/staging/comedi/drivers/aio_iiro_16.c
@@ -81,21 +81,23 @@ static int aio_iiro_16_attach(struct comedi_device *dev,
if (ret)
return ret;
 
+   /* Digital Output subdevice */
s = &dev->subdevices[0];
-   s->type = COMEDI_SUBD_DO;
-   s->subdev_flags = SDF_WRITABLE;
-   s->n_chan = 16;
-   s->maxdata = 1;
-   s->range_table = &range_digital;
-   s->insn_bits = aio_iiro_16_do_insn_bits;
-
+   s->type = COMEDI_SUBD_DO;
+   s->subdev_flags = SDF_WRITABLE;
+   s->n_chan   = 16;
+   s->maxdata  = 1;
+   s->range_table  = &range_digital;
+   s->insn_bits= aio_iiro_16_do_insn_bits;
+
+   /* Digital Input subdevice */
s = &dev->subdevices[1];
-   s->type = COMEDI_SUBD_DI;
-   s->subdev_flags = SDF_READABLE;
-   s->n_chan = 16;
-   s->maxdata = 1;
-   s->range_table = &range_digital;
-   s->insn_bits = aio_iiro_16_di_insn_bits;
+   s->type = COMEDI_SUBD_DI;
+   s->subdev_flags = SDF_READABLE;
+   s->n_chan   = 16;
+   s->maxdata  = 1;
+   s->range_table  = &range_digital;
+   s->insn_bits= aio_iiro_16_di_insn_bits;
 
return 0;
 }
-- 
2.0.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/8] staging: comedi: aio_iiro_16: fix subdevice 1 'type'

2015-01-07 Thread H Hartley Sweeten
Subdevice 1 is a digial input not a digital I/O subdevice.

Fix the type and, for aesthetics, rename the (*insn_bits) function used
to read the inputs.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/aio_iiro_16.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/aio_iiro_16.c 
b/drivers/staging/comedi/drivers/aio_iiro_16.c
index 87d1372..2cfbb61 100644
--- a/drivers/staging/comedi/drivers/aio_iiro_16.c
+++ b/drivers/staging/comedi/drivers/aio_iiro_16.c
@@ -55,10 +55,10 @@ static int aio_iiro_16_do_insn_bits(struct comedi_device 
*dev,
return insn->n;
 }
 
-static int aio_iiro_16_dio_insn_bits_read(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn,
- unsigned int *data)
+static int aio_iiro_16_di_insn_bits(struct comedi_device *dev,
+   struct comedi_subdevice *s,
+   struct comedi_insn *insn,
+   unsigned int *data)
 {
data[1] = 0;
data[1] |= inb(dev->iobase + AIO_IIRO_16_INPUT_0_7);
@@ -90,12 +90,12 @@ static int aio_iiro_16_attach(struct comedi_device *dev,
s->insn_bits = aio_iiro_16_do_insn_bits;
 
s = &dev->subdevices[1];
-   s->type = COMEDI_SUBD_DIO;
+   s->type = COMEDI_SUBD_DI;
s->subdev_flags = SDF_READABLE;
s->n_chan = 16;
s->maxdata = 1;
s->range_table = &range_digital;
-   s->insn_bits = aio_iiro_16_dio_insn_bits_read;
+   s->insn_bits = aio_iiro_16_di_insn_bits;
 
return 0;
 }
-- 
2.0.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/8] staging: comedi: aio_iiro_16: fix subdevice 0 'type'

2015-01-07 Thread H Hartley Sweeten
Subdevice 0 is a digial output not a digital I/O subdevice.

Fix the type and, for aesthetics, rename the (*insn_bits) function used
to set the outputs.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/aio_iiro_16.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/aio_iiro_16.c 
b/drivers/staging/comedi/drivers/aio_iiro_16.c
index 7b5ed43..87d1372 100644
--- a/drivers/staging/comedi/drivers/aio_iiro_16.c
+++ b/drivers/staging/comedi/drivers/aio_iiro_16.c
@@ -39,10 +39,10 @@ Configuration Options:
 #define AIO_IIRO_16_RELAY_8_15 0x04
 #define AIO_IIRO_16_INPUT_8_15 0x05
 
-static int aio_iiro_16_dio_insn_bits_write(struct comedi_device *dev,
-  struct comedi_subdevice *s,
-  struct comedi_insn *insn,
-  unsigned int *data)
+static int aio_iiro_16_do_insn_bits(struct comedi_device *dev,
+   struct comedi_subdevice *s,
+   struct comedi_insn *insn,
+   unsigned int *data)
 {
if (comedi_dio_update_state(s, data)) {
outb(s->state & 0xff, dev->iobase + AIO_IIRO_16_RELAY_0_7);
@@ -82,12 +82,12 @@ static int aio_iiro_16_attach(struct comedi_device *dev,
return ret;
 
s = &dev->subdevices[0];
-   s->type = COMEDI_SUBD_DIO;
+   s->type = COMEDI_SUBD_DO;
s->subdev_flags = SDF_WRITABLE;
s->n_chan = 16;
s->maxdata = 1;
s->range_table = &range_digital;
-   s->insn_bits = aio_iiro_16_dio_insn_bits_write;
+   s->insn_bits = aio_iiro_16_do_insn_bits;
 
s = &dev->subdevices[1];
s->type = COMEDI_SUBD_DIO;
-- 
2.0.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 8/8] staging: comedi: aio_iiro_16: update the MODULE_DESCRIPTION

2015-01-07 Thread H Hartley Sweeten
Update the MODULE_DESCRIPTION to something more useful than the generic
"Comedi low-level driver".

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/aio_iiro_16.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/aio_iiro_16.c 
b/drivers/staging/comedi/drivers/aio_iiro_16.c
index ae67006..d8884a3 100644
--- a/drivers/staging/comedi/drivers/aio_iiro_16.c
+++ b/drivers/staging/comedi/drivers/aio_iiro_16.c
@@ -226,5 +226,5 @@ static struct comedi_driver aio_iiro_16_driver = {
 module_comedi_driver(aio_iiro_16_driver);
 
 MODULE_AUTHOR("Comedi http://www.comedi.org";);
-MODULE_DESCRIPTION("Comedi low-level driver");
+MODULE_DESCRIPTION("Comedi driver for Access I/O Products 104-IIRO-16 board");
 MODULE_LICENSE("GPL");
-- 
2.0.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 5/8] staging: comedi: aio_iiro_16: read intial state of the digital outputs

2015-01-07 Thread H Hartley Sweeten
The relay registers are readable. Read them during the attach to get
the initial state of the digital outputs.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/aio_iiro_16.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/comedi/drivers/aio_iiro_16.c 
b/drivers/staging/comedi/drivers/aio_iiro_16.c
index 96ea174..8cd5f11 100644
--- a/drivers/staging/comedi/drivers/aio_iiro_16.c
+++ b/drivers/staging/comedi/drivers/aio_iiro_16.c
@@ -85,6 +85,10 @@ static int aio_iiro_16_attach(struct comedi_device *dev,
s->range_table  = &range_digital;
s->insn_bits= aio_iiro_16_do_insn_bits;
 
+   /* get the initial state of the relays */
+   s->state = inb(dev->iobase + AIO_IIRO_16_RELAY_0_7) |
+  (inb(dev->iobase + AIO_IIRO_16_RELAY_8_15) << 8);
+
/* Digital Input subdevice */
s = &dev->subdevices[1];
s->type = COMEDI_SUBD_DI;
-- 
2.0.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 7/8] staging: comedi: aio_iiro_16: add command support for change of state detection

2015-01-07 Thread H Hartley Sweeten
This board supports interrupts on change of state of the digital inputs.

Add the necessary subdevice support and interrupt handler to allow async
commands to detect the change of state.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/aio_iiro_16.c | 116 +--
 1 file changed, 111 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/aio_iiro_16.c 
b/drivers/staging/comedi/drivers/aio_iiro_16.c
index f84fb74..ae67006 100644
--- a/drivers/staging/comedi/drivers/aio_iiro_16.c
+++ b/drivers/staging/comedi/drivers/aio_iiro_16.c
@@ -23,16 +23,49 @@
  *
  * Configuration Options:
  *   [0] - I/O port base address
+ *   [1] - IRQ (optional)
+ *
+ * The board supports interrupts on change of state of the digital inputs.
+ * The sample data returned by the async command indicates which inputs
+ * changed state:
+ *
+ * Bit 7 - IRQ Enable (1) / Disable (0)
+ * Bit 1 - Input 8-15 Changed State (1 = Changed, 0 = No Change)
+ * Bit 0 - Input 0-7 Changed State (1 = Changed, 0 = No Change)
  */
 
 #include 
+#include 
+
 #include "../comedidev.h"
 
-#define AIO_IIRO_16_RELAY_0_7  0x00
-#define AIO_IIRO_16_INPUT_0_7  0x01
-#define AIO_IIRO_16_IRQ0x02
-#define AIO_IIRO_16_RELAY_8_15 0x04
-#define AIO_IIRO_16_INPUT_8_15 0x05
+#include "comedi_fc.h"
+
+#define AIO_IIRO_16_RELAY_0_7  0x00
+#define AIO_IIRO_16_INPUT_0_7  0x01
+#define AIO_IIRO_16_IRQ0x02
+#define AIO_IIRO_16_RELAY_8_15 0x04
+#define AIO_IIRO_16_INPUT_8_15 0x05
+#define AIO_IIRO_16_STATUS 0x07
+#define AIO_IIRO_16_STATUS_IRQEBIT(7)
+#define AIO_IIRO_16_STATUS_INPUT_8_15  BIT(1)
+#define AIO_IIRO_16_STATUS_INPUT_0_7   BIT(0)
+
+static irqreturn_t aio_iiro_16_cos(int irq, void *d)
+{
+   struct comedi_device *dev = d;
+   struct comedi_subdevice *s = dev->read_subdev;
+   unsigned int status;
+
+   status = inb(dev->iobase + AIO_IIRO_16_STATUS);
+   if (!(status & AIO_IIRO_16_STATUS_IRQE))
+   return IRQ_NONE;
+
+   comedi_buf_write_samples(s, &status, 1);
+   comedi_handle_events(dev, s);
+
+   return IRQ_HANDLED;
+}
 
 static void aio_iiro_enable_irq(struct comedi_device *dev, bool enable)
 {
@@ -42,6 +75,60 @@ static void aio_iiro_enable_irq(struct comedi_device *dev, 
bool enable)
outb(0, dev->iobase + AIO_IIRO_16_IRQ);
 }
 
+static int aio_iiro_16_cos_cancel(struct comedi_device *dev,
+ struct comedi_subdevice *s)
+{
+   aio_iiro_enable_irq(dev, false);
+
+   return 0;
+}
+
+static int aio_iiro_16_cos_cmd(struct comedi_device *dev,
+  struct comedi_subdevice *s)
+{
+   aio_iiro_enable_irq(dev, true);
+
+   return 0;
+}
+
+static int aio_iiro_16_cos_cmdtest(struct comedi_device *dev,
+  struct comedi_subdevice *s,
+  struct comedi_cmd *cmd)
+{
+   int err = 0;
+
+   /* Step 1 : check if triggers are trivially valid */
+
+   err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW);
+   err |= cfc_check_trigger_src(&cmd->scan_begin_src, TRIG_EXT);
+   err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_FOLLOW);
+   err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT);
+   err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_NONE);
+
+   if (err)
+   return 1;
+
+   /* Step 2a : make sure trigger sources are unique */
+   /* Step 2b : and mutually compatible */
+
+   /* Step 3: check if arguments are trivially valid */
+
+   err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0);
+   err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0);
+   err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len);
+   err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0);
+
+   if (err)
+   return 3;
+
+   /* Step 4: fix up any arguments */
+
+   /* Step 5: check channel list if it exists */
+
+   return 0;
+}
+
 static int aio_iiro_16_do_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
@@ -82,6 +169,17 @@ static int aio_iiro_16_attach(struct comedi_device *dev,
 
aio_iiro_enable_irq(dev, false);
 
+   /*
+* Digital input change of state interrupts are optionally supported
+* using IRQ 2-7, 10-12, 14, or 15.
+*/
+   if ((1 << it->options[1]) & 0xdcfc) {
+   ret = request_irq(it->options[1], aio_iiro_16_cos, 0,
+ dev->board_name, dev);
+   if (ret == 0)
+   dev->irq = it->options[1];
+   }
+
ret = comedi_alloc_subdevices(dev, 2);
if (ret)
 

[PATCH 6/8] staging: comedi: aio_iiro_16: introduce aio_iiro_enable_irq()

2015-01-07 Thread H Hartley Sweeten
This board supports interrupts on change of state of the digital inputs.

Introduce a helper function to enable/disable the interrupt. Use the new
helper function to ensure that interrupts are initially disabled during
the driver (*attach).

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/aio_iiro_16.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/staging/comedi/drivers/aio_iiro_16.c 
b/drivers/staging/comedi/drivers/aio_iiro_16.c
index 8cd5f11..f84fb74 100644
--- a/drivers/staging/comedi/drivers/aio_iiro_16.c
+++ b/drivers/staging/comedi/drivers/aio_iiro_16.c
@@ -34,6 +34,14 @@
 #define AIO_IIRO_16_RELAY_8_15 0x04
 #define AIO_IIRO_16_INPUT_8_15 0x05
 
+static void aio_iiro_enable_irq(struct comedi_device *dev, bool enable)
+{
+   if (enable)
+   inb(dev->iobase + AIO_IIRO_16_IRQ);
+   else
+   outb(0, dev->iobase + AIO_IIRO_16_IRQ);
+}
+
 static int aio_iiro_16_do_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
@@ -72,6 +80,8 @@ static int aio_iiro_16_attach(struct comedi_device *dev,
if (ret)
return ret;
 
+   aio_iiro_enable_irq(dev, false);
+
ret = comedi_alloc_subdevices(dev, 2);
if (ret)
return ret;
-- 
2.0.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel