Re: [PATCH 2/2] mmc: rtsx: Revert "mmc: rtsx: add support for pre_req and post_req"

2014-05-05 Thread Ulf Hansson
On 29 April 2014 09:36, Ulf Hansson  wrote:
> On 29 April 2014 03:54,   wrote:
>> From: Micky Ching 
>>
>> This reverts commit c42deffd5b53c9e583d83c7964854ede2f12410d.
>>
>> commit  did use
>> mutex_unlock() in tasklet, but mutex_unlock() can't used in
>> tasklet(atomic context). The driver need use mutex to avoid concurrency,
>> so we can't use tasklet here, the patch need to be removed.
>>
>> The spinlock host->lock and pcr->lock may deadlock, one way to solve the
>> deadlock is remove host->lock in sd_isr_done_transfer(), but if using
>> workqueue the we can avoid using the spinlock and also avoid the problem.
>>
>> Signed-off-by: Micky Ching 
>
> Acked-by: Ulf Hansson 

Hi Lee,

Would you mind to pick this up and send it for 3.15 fixes?

The other revert "[PATCH 1/2] mmc: rtsx: Revert "mmc: rtsx: modify
error handle and remove smatch warnings", needs to go through the mmc
tree.

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


Re: [PATCH] staging: android: fix missing a blank line after declarations

2014-05-05 Thread Dan Carpenter
On Sat, May 03, 2014 at 07:43:26PM -0400, Greg KH wrote:
> On Tue, Apr 29, 2014 at 08:32:21PM +0300, Dan Carpenter wrote:
> > On Wed, Apr 30, 2014 at 01:59:12AM +0900, Seunghun Lee wrote:
> > > This patch fixes "Missing a blank line after declarations" warnings.
> > > 
> > > Signed-off-by: Seunghun Lee 
> > 
> > Quite a few of these are false checkpatch.pl false positives.  Just
> > ignore the false positives.
> 
> Really?  It looks good to me, what am I missing?
> 

Gar.  You're right.  In my head I remember seeing a bunch of false
positives but now that I'm looking at it again I'm not sure what I was
talking about.

regards,
dan carpenter

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


[RESEND PATCH] staging: dgnc: use dev_err() instead of printk()

2014-05-05 Thread Martin Kepplinger
Use dev_err() instead of printk() and remove "dgnc:" from the message.
This should provide userspace with more useful information and use
the common kernel coding style.

Signed-off-by: Martin Kepplinger 
---
 drivers/staging/dgnc/dgnc_sysfs.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/dgnc/dgnc_sysfs.c 
b/drivers/staging/dgnc/dgnc_sysfs.c
index 946230c..88a2106 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -739,7 +739,7 @@ void dgnc_create_tty_sysfs(struct un_t *un, struct device 
*c)
 
ret = sysfs_create_group(&c->kobj, &dgnc_tty_attribute_group);
if (ret) {
-   printk(KERN_ERR "dgnc: failed to create sysfs tty device 
attributes.\n");
+   dev_err(c, "failed to create sysfs tty device attributes.\n");
sysfs_remove_group(&c->kobj, &dgnc_tty_attribute_group);
return;
}
-- 
1.7.10.4

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


Re: [RESEND PATCH] staging: dgnc: use dev_err() instead of printk()

2014-05-05 Thread Dan Carpenter
On Mon, May 05, 2014 at 12:29:39PM +0200, Martin Kepplinger wrote:
> Use dev_err() instead of printk() and remove "dgnc:" from the message.
> This should provide userspace with more useful information and use
> the common kernel coding style.
> 

Whenever I see a "RESEND" in a subject and no explanation then it means
our development process has broken down.  Meanwhile this is the first
time I have seen this patch so the problem is not on our side.

regards,
dan carpenter

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


Re: [RESEND PATCH] staging: dgnc: use dev_err() instead of printk()

2014-05-05 Thread Martin Kepplinger
Am 2014-05-05 13:35, schrieb Dan Carpenter:
> On Mon, May 05, 2014 at 12:29:39PM +0200, Martin Kepplinger wrote:
>> Use dev_err() instead of printk() and remove "dgnc:" from the message.
>> This should provide userspace with more useful information and use
>> the common kernel coding style.
>>
> 
> Whenever I see a "RESEND" in a subject and no explanation then it means
> our development process has broken down.  Meanwhile this is the first
> time I have seen this patch so the problem is not on our side.
> 
> regards,
> dan carpenter
> 

I just resent https://lkml.org/lkml/2014/4/29/164 after waiting a week
or so. I don't see any breakdown.

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


Re: [RESEND PATCH] staging: dgnc: use dev_err() instead of printk()

2014-05-05 Thread Dan Carpenter
On Mon, May 05, 2014 at 01:59:25PM +0200, Martin Kepplinger wrote:
> Am 2014-05-05 13:35, schrieb Dan Carpenter:
> > On Mon, May 05, 2014 at 12:29:39PM +0200, Martin Kepplinger wrote:
> >> Use dev_err() instead of printk() and remove "dgnc:" from the message.
> >> This should provide userspace with more useful information and use
> >> the common kernel coding style.
> >>
> > 
> > Whenever I see a "RESEND" in a subject and no explanation then it means
> > our development process has broken down.  Meanwhile this is the first
> > time I have seen this patch so the problem is not on our side.
> > 
> > regards,
> > dan carpenter
> > 
> 
> I just resent https://lkml.org/lkml/2014/4/29/164 after waiting a week
> or so. I don't see any breakdown.

What I'm saying is just put an explanation after the --- cut off so we
know what you did wrong the first time.

Signed-off-by ...
---
Resending because I sent it to the wrong email list the first time.
Oops!  Next time I will use get_maintainer.pl, I promise!


Just a simple explanation like that is ok.

regards,
dan carpenter

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


Re: [RESEND PATCH] staging: dgnc: use dev_err() instead of printk()

2014-05-05 Thread Martin Kepplinger
Am 2014-05-05 14:36, schrieb Dan Carpenter:
> On Mon, May 05, 2014 at 01:59:25PM +0200, Martin Kepplinger wrote:
>> Am 2014-05-05 13:35, schrieb Dan Carpenter:
>>> On Mon, May 05, 2014 at 12:29:39PM +0200, Martin Kepplinger wrote:
 Use dev_err() instead of printk() and remove "dgnc:" from the message.
 This should provide userspace with more useful information and use
 the common kernel coding style.

>>>
>>> Whenever I see a "RESEND" in a subject and no explanation then it means
>>> our development process has broken down.  Meanwhile this is the first
>>> time I have seen this patch so the problem is not on our side.
>>>
>>> regards,
>>> dan carpenter
>>>
>>
>> I just resent https://lkml.org/lkml/2014/4/29/164 after waiting a week
>> or so. I don't see any breakdown.
> 
> What I'm saying is just put an explanation after the --- cut off so we
> know what you did wrong the first time.
> 
> Signed-off-by ...
> ---
> Resending because I sent it to the wrong email list the first time.
> Oops!  Next time I will use get_maintainer.pl, I promise!
> 
> 
> Just a simple explanation like that is ok.
> 
> regards,
> dan carpenter
> 
sure, thanks.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] locks: ensure that fl_owner is always initialized properly in flock and lease codepaths

2014-05-05 Thread J. Bruce Fields
Looks fine to me, ACK.--b.

On Mon, Apr 28, 2014 at 01:50:13PM -0400, Jeff Layton wrote:
> Currently, the fl_owner isn't set for flock locks. Some filesystems use
> byte-range locks to simulate flock locks and there is a common idiom in
> those that does:
> 
> fl->fl_owner = (fl_owner_t)filp;
> fl->fl_start = 0;
> fl->fl_end = OFFSET_MAX;
> 
> Since flock locks are generally "owned" by the open file description,
> move this into the common flock lock setup code. The fl_start and fl_end
> fields are already set appropriately, so remove the unneeded setting of
> that in flock ops in those filesystems as well.
> 
> Finally, the lease code also sets the fl_owner as if they were owned by
> the process and not the open file description. This is incorrect as
> leases have the same ownership semantics as flock locks. Set them the
> same way. The lease code doesn't actually use the fl_owner value for
> anything, so this is more for consistency's sake than a bugfix.
> 
> Reported-by: Trond Myklebust 
> Signed-off-by: Jeff Layton 
> ---
>  drivers/staging/lustre/lustre/llite/file.c | 17 ++---
>  fs/9p/vfs_file.c   |  3 ---
>  fs/afs/flock.c |  4 
>  fs/ceph/locks.c| 10 ++
>  fs/fuse/file.c |  1 -
>  fs/locks.c |  4 +++-
>  fs/nfs/file.c  |  4 
>  7 files changed, 11 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/llite/file.c 
> b/drivers/staging/lustre/lustre/llite/file.c
> index 8e844a6371e0..760ccd83f1f7 100644
> --- a/drivers/staging/lustre/lustre/llite/file.c
> +++ b/drivers/staging/lustre/lustre/llite/file.c
> @@ -2691,20 +2691,15 @@ int ll_file_flock(struct file *file, int cmd, struct 
> file_lock *file_lock)
>  
>   ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_FLOCK, 1);
>  
> - if (file_lock->fl_flags & FL_FLOCK) {
> + if (file_lock->fl_flags & FL_FLOCK)
>   LASSERT((cmd == F_SETLKW) || (cmd == F_SETLK));
> - /* flocks are whole-file locks */
> - flock.l_flock.end = OFFSET_MAX;
> - /* For flocks owner is determined by the local file descriptor*/
> - flock.l_flock.owner = (unsigned long)file_lock->fl_file;
> - } else if (file_lock->fl_flags & FL_POSIX) {
> - flock.l_flock.owner = (unsigned long)file_lock->fl_owner;
> - flock.l_flock.start = file_lock->fl_start;
> - flock.l_flock.end = file_lock->fl_end;
> - } else {
> + else if (!(file_lock->fl_flags & FL_POSIX))
>   return -EINVAL;
> - }
> +
> + flock.l_flock.owner = (unsigned long)file_lock->fl_owner;
>   flock.l_flock.pid = file_lock->fl_pid;
> + flock.l_flock.start = file_lock->fl_start;
> + flock.l_flock.end = file_lock->fl_end;
>  
>   /* Somewhat ugly workaround for svc lockd.
>* lockd installs custom fl_lmops->lm_compare_owner that checks
> diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
> index d8223209d4b1..59e3fe3d56c0 100644
> --- a/fs/9p/vfs_file.c
> +++ b/fs/9p/vfs_file.c
> @@ -352,9 +352,6 @@ static int v9fs_file_flock_dotl(struct file *filp, int 
> cmd,
>   invalidate_mapping_pages(&inode->i_data, 0, -1);
>   }
>   /* Convert flock to posix lock */
> - fl->fl_owner = (fl_owner_t)filp;
> - fl->fl_start = 0;
> - fl->fl_end = OFFSET_MAX;
>   fl->fl_flags |= FL_POSIX;
>   fl->fl_flags ^= FL_FLOCK;
>  
> diff --git a/fs/afs/flock.c b/fs/afs/flock.c
> index a8cf2cff836c..4baf1d2b39e4 100644
> --- a/fs/afs/flock.c
> +++ b/fs/afs/flock.c
> @@ -555,10 +555,6 @@ int afs_flock(struct file *file, int cmd, struct 
> file_lock *fl)
>   return -ENOLCK;
>  
>   /* we're simulating flock() locks using posix locks on the server */
> - fl->fl_owner = (fl_owner_t) file;
> - fl->fl_start = 0;
> - fl->fl_end = OFFSET_MAX;
> -
>   if (fl->fl_type == F_UNLCK)
>   return afs_do_unlk(file, fl);
>   return afs_do_setlk(file, fl);
> diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c
> index d94ba0df9f4d..db8c1ca15d72 100644
> --- a/fs/ceph/locks.c
> +++ b/fs/ceph/locks.c
> @@ -52,10 +52,7 @@ static int ceph_lock_message(u8 lock_type, u16 operation, 
> struct file *file,
>   else
>   length = fl->fl_end - fl->fl_start + 1;
>  
> - if (lock_type == CEPH_LOCK_FCNTL)
> - owner = secure_addr(fl->fl_owner);
> - else
> - owner = secure_addr(fl->fl_file);
> + owner = secure_addr(fl->fl_owner);
>  
>   dout("ceph_lock_message: rule: %d, op: %d, owner: %llx, pid: %llu, "
>"start: %llu, length: %llu, wait: %d, type: %d", (int)lock_type,
> @@ -313,10 +310,7 @@ int lock_to_ceph_filelock(struct file_lock *lock,
>   cephlock->length = cpu_to_le64(lock->fl_end - lock->fl_start + 1);
>   cephlock->client = cpu_to_le64(0);
>   ceph

[PATCH 12/20] staging: comedi: adl_pci9118: remove 'valid' from private data

2014-05-05 Thread H Hartley Sweeten
This member of the private data is set only used during the (*detach)
to check if the board can be reset. The pci9118_reset() function just
needs a valid dev->iobase. Use that instead.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index dd1cd6b..f60dc41 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -320,7 +320,6 @@ struct pci9118_private {
unsigned char AdControlReg; /* A/D control register */
unsigned char IntControlReg;/* Interrupt control register */
unsigned char AdFunctionReg;/* A/D function register */
-   char valid; /* driver is ok */
char ai_neverending;/* we do unlimited AI */
unsigned int ai_do; /* what do AI? 0=nothing, 1 to 4 mode */
unsigned int ai_act_scan;   /* how many scans we finished */
@@ -2044,7 +2043,6 @@ static int pci9118_common_attach(struct comedi_device 
*dev, int disable_irq,
s->range_table = &range_digital;
s->insn_bits = pci9118_insn_bits_do;
 
-   devpriv->valid = 1;
devpriv->ai_maskharderr = 0x10a;
/* default measure crash condition */
if (hw_err_mask)/* disable some requested */
@@ -2121,7 +2119,7 @@ static void pci9118_detach(struct comedi_device *dev)
struct pci9118_private *devpriv = dev->private;
 
if (devpriv) {
-   if (devpriv->valid)
+   if (dev->iobase)
pci9118_reset(dev);
if (dev->irq)
free_irq(dev->irq, dev);
-- 
1.9.2

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


[PATCH 10/20] staging: comedi: adl_pci9118: cmd->stop_src == TRIG_INT is not supported

2014-05-05 Thread H Hartley Sweeten
The (*do_cmdtest) only allows TRIG_COUNT, TRIG_NONE, or TRIG_EXT as the
cmd->stop_src. Remove the disabled code.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 60cc41a..89e6b92 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -1626,12 +1626,6 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
devpriv->ai12_startstop |= START_AI_INT;
s->async->inttrig = pci9118_ai_inttrig;
}
-#if 0
-   if (cmd->stop_src == TRIG_INT) {
-   devpriv->ai_neverending = 1;
-   devpriv->ai12_startstop |= STOP_AI_INT;
-   }
-#endif
if (cmd->stop_src == TRIG_NONE)
devpriv->ai_neverending = 1;
if (cmd->stop_src == TRIG_COUNT)
-- 
1.9.2

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


[PATCH 00/20] staging: comedi: adl_pci9118: cleanup the private data

2014-05-05 Thread H Hartley Sweeten
Remove the unused or unnecessary members from the private data.

H Hartley Sweeten (20):
  staging: comedi: adl_pci9118: remove 'ai_n_chan' from private data
  staging: comedi: adl_pci9118: remove 'ai_chanlist' from private data
  staging: comedi: adl_pci9118: remove 'ai_data_len' from private data
  staging: comedi: adl_pci9118: remove 'ai_timer1' from private data
  staging: comedi: adl_pci9118: remove 'ai_timer2' from private data
  staging: comedi: adl_pci9118: remove 'ai_n_scanlen' from private data
  staging: comedi: adl_pci9118: remove 'i8254_osc_base' from private data
  staging: comedi: adl_pci9118: remove 'ai_scans' from private data
  staging: comedi: adl_pci9118: remove 'usessh' from private data
  staging: comedi: adl_pci9118: cmd->stop_src == TRIG_INT is not supported
  staging: comedi: adl_pci9118: remove 'ai_buf_ptr' from private data
  staging: comedi: adl_pci9118: remove 'valid' from private data
  staging: comedi: adl_pci9118: remove 'cnt0_users' from private data
  staging: comedi: adl_pci9118: remove 'useeoshandle' from private data
  staging: comedi: adl_pci9118: remove 'ai16bits' from private data
  staging: comedi: adl_pci9118: remove 'int_ai_func' from private data
  staging: comedi: adl_pci9118: tidy up interrupt_pci9118()
  staging: comedi: adl_pci9118: tidy up start_pacer()
  staging: comedi: adl_pci9118: remove 'cnt0_divisor' from private data
  staging: comedi: adl_pci9118: remove 'dmabuf_samples' from private data

 drivers/staging/comedi/drivers/adl_pci9118.c | 365 ++-
 1 file changed, 130 insertions(+), 235 deletions(-)

-- 
1.9.2

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


[PATCH 15/20] staging: comedi: adl_pci9118: remove 'ai16bits' from private data

2014-05-05 Thread H Hartley Sweeten
This member of the private data is only set when the analog input
subdevice maxdata is 0x. Just check the s->maxdata and remove
the private data member.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 394337e..0e9fc0d 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -376,7 +376,6 @@ struct pci9118_private {
 * ptr to actual interrupt
 * AI function
 */
-   unsigned char ai16bits; /* =1 16 bit card */
unsigned char usedma;   /* =1 use DMA transfer and not INT */
int softsshdelay;   /*
 * >0 use software S&H,
@@ -586,7 +585,7 @@ static int pci9118_insn_read_ai(struct comedi_device *dev,
return ret;
}
 
-   if (devpriv->ai16bits) {
+   if (s->maxdata == 0x) {
data[n] =
(inl(dev->iobase +
 PCI9118_AD_DATA) & 0x) ^ 0x8000;
@@ -908,7 +907,7 @@ static void pci9118_ai_munge(struct comedi_device *dev,
for (i = 0; i < num_samples; i++) {
if (devpriv->usedma)
array[i] = be16_to_cpu(array[i]);
-   if (devpriv->ai16bits)
+   if (s->maxdata == 0x)
array[i] ^= 0x8000;
else
array[i] = (array[i] >> 4) & 0x0fff;
@@ -933,7 +932,7 @@ static void interrupt_pci9118_ai_onesample(struct 
comedi_device *dev,
sampl = inw(dev->iobase + PCI9118_AD_DATA);
 
 #ifdef PCI9118_PARANOIDCHECK
-   if (devpriv->ai16bits == 0) {
+   if (s->maxdata != 0x) {
if ((sampl & 0x000f) != devpriv->chanlist[s->async->cur_chan]) {
/* data dropout! */
dev_info(dev->class_dev,
@@ -2017,15 +2016,6 @@ static int pci9118_common_attach(struct comedi_device 
*dev, int disable_irq,
if (hw_err_mask)/* disable some requested */
devpriv->ai_maskharderr &= ~hw_err_mask;
 
-   switch (this_board->ai_maxdata) {
-   case 0x:
-   devpriv->ai16bits = 1;
-   break;
-   default:
-   devpriv->ai16bits = 0;
-   break;
-   }
-
return 0;
 }
 
-- 
1.9.2

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


[PATCH 11/20] staging: comedi: adl_pci9118: remove 'ai_buf_ptr' from private data

2014-05-05 Thread H Hartley Sweeten
This member of the private data is set to 0 but never used. Remove it.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 89e6b92..dd1cd6b 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -324,7 +324,6 @@ struct pci9118_private {
char ai_neverending;/* we do unlimited AI */
unsigned int ai_do; /* what do AI? 0=nothing, 1 to 4 mode */
unsigned int ai_act_scan;   /* how many scans we finished */
-   unsigned int ai_buf_ptr;/* data buffer ptr in samples */
unsigned int ai_n_realscanlen;  /*
 * what we must transfer for one
 * outgoing scan include front/back adds
@@ -875,7 +874,6 @@ static int pci9118_ai_cancel(struct comedi_device *dev,
devpriv->ai_act_dmapos = 0;
s->async->cur_chan = 0;
s->async->inttrig = NULL;
-   devpriv->ai_buf_ptr = 0;
devpriv->ai_neverending = 0;
devpriv->dma_actbuf = 0;
 
@@ -1797,7 +1795,6 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
devpriv->ai_act_scan = 0;
devpriv->ai_act_dmapos = 0;
s->async->cur_chan = 0;
-   devpriv->ai_buf_ptr = 0;
 
if (devpriv->usedma)
ret = pci9118_ai_docmd_dma(dev, s);
-- 
1.9.2

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


[PATCH 19/20] staging: comedi: adl_pci9118: remove 'cnt0_divisor' from private data

2014-05-05 Thread H Hartley Sweeten
This member of the private data is not used. Remove it.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 2be7037..c9c6f14 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -368,7 +368,6 @@ struct pci9118_private {
 * bit field of external trigger
 * users(0-AI, 1-AO, 2-DI, 3-DO)
 */
-   unsigned int cnt0_divisor;  /* actual CNT0 divisor */
unsigned char usedma;   /* =1 use DMA transfer and not INT */
int softsshdelay;   /*
 * >0 use software S&H,
-- 
1.9.2

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


[PATCH 20/20] staging: comedi: adl_pci9118: remove 'dmabuf_samples' from private data

2014-05-05 Thread H Hartley Sweeten
This member of the private data is set but never used. Remove it.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index c9c6f14..89ed2d6 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -362,7 +362,6 @@ struct pci9118_private {
 */
unsigned int dmabuf_used_size[2];   /* which size was truly used */
unsigned int dmabuf_panic_size[2];
-   unsigned int dmabuf_samples[2]; /* size in samples */
int dmabuf_pages[2];/* number of pages in buffer */
unsigned char exttrg_users; /*
 * bit field of external trigger
@@ -1885,8 +1884,6 @@ static int pci9118_common_attach(struct comedi_device 
*dev, int disable_irq,
if (devpriv->dmabuf_virt[i]) {
devpriv->dmabuf_pages[i] = pages;
devpriv->dmabuf_size[i] = PAGE_SIZE * pages;
-   devpriv->dmabuf_samples[i] =
-   devpriv->dmabuf_size[i] >> 1;
devpriv->dmabuf_hw[i] =
virt_to_bus((void *)
devpriv->dmabuf_virt[i]);
-- 
1.9.2

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


[PATCH 14/20] staging: comedi: adl_pci9118: remove 'useeoshandle' from private data

2014-05-05 Thread H Hartley Sweeten
This member of the private data is always set to 0. Remove it and the
affected code.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 8814b06..394337e 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -378,10 +378,6 @@ struct pci9118_private {
 */
unsigned char ai16bits; /* =1 16 bit card */
unsigned char usedma;   /* =1 use DMA transfer and not INT */
-   unsigned char useeoshandle; /*
-* =1 change WAKE_EOS DMA transfer
-* to fit on every second
-*/
int softsshdelay;   /*
 * >0 use software S&H,
 * numer is requested delay in ns
@@ -452,7 +448,7 @@ static int check_channel_list(struct comedi_device *dev,
 static int setup_channel_list(struct comedi_device *dev,
  struct comedi_subdevice *s, int n_chan,
  unsigned int *chanlist, int rot, int frontadd,
- int backadd, int usedma, char useeos)
+ int backadd, int usedma)
 {
struct pci9118_private *devpriv = dev->private;
unsigned int i, differencial = 0, bipolar = 0;
@@ -536,18 +532,6 @@ static int setup_channel_list(struct comedi_device *dev,
 #ifdef PCI9118_PARANOIDCHECK
devpriv->chanlist[n_chan ^ usedma] = devpriv->chanlist[0 ^ usedma];
/* for 32bit operations */
-   if (useeos) {
-   for (i = 1; i < n_chan; i++) {  /* store range list to card */
-   devpriv->chanlist[(n_chan + i) ^ usedma] =
-   (CR_CHAN(chanlist[i]) & 0xf) << rot;
-   }
-   devpriv->chanlist[(2 * n_chan) ^ usedma] =
-   devpriv->chanlist[0 ^ usedma];
-   /* for 32bit operations */
-   useeos = 2;
-   } else {
-   useeos = 1;
-   }
 #endif
outl(0, dev->iobase + PCI9118_SCANMOD); /* close scan queue */
/* udelay(100); important delay, or first sample will be crippled */
@@ -587,7 +571,7 @@ static int pci9118_insn_read_ai(struct comedi_device *dev,
 * trigger stop
 */
 
-   if (!setup_channel_list(dev, s, 1, &insn->chanspec, 0, 0, 0, 0, 0))
+   if (!setup_channel_list(dev, s, 1, &insn->chanspec, 0, 0, 0, 0))
return -EINVAL;
 
outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */
@@ -1353,8 +1337,6 @@ static int Compute_and_setup_dma(struct comedi_device 
*dev,
} else {
/* short first DMA buffer to one scan */
dmalen0 = devpriv->ai_n_realscanlen << 1;
-   if (devpriv->useeoshandle)
-   dmalen0 += 2;
if (dmalen0 < 4) {
dev_info(dev->class_dev,
 "ERR: DMA0 buf len bug? (%d<4)\n",
@@ -1373,8 +1355,6 @@ static int Compute_and_setup_dma(struct comedi_device 
*dev,
} else {
/* short second DMA buffer to one scan */
dmalen1 = devpriv->ai_n_realscanlen << 1;
-   if (devpriv->useeoshandle)
-   dmalen1 -= 2;
if (dmalen1 < 4) {
dev_info(dev->class_dev,
 "ERR: DMA1 buf len bug? (%d<4)\n",
@@ -1630,7 +1610,6 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
 */
devpriv->ai_add_front = 0;
devpriv->ai_add_back = 0;
-   devpriv->useeoshandle = 0;
if (devpriv->master) {
devpriv->usedma = 1;
if ((cmd->flags & TRIG_WAKE_EOS) &&
@@ -1649,10 +1628,6 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
(cmd->scan_end_arg & 1) &&
(cmd->scan_end_arg > 1)) {
if (cmd->scan_begin_src == TRIG_FOLLOW) {
-   /*
-* vpriv->useeoshandle=1; // change DMA transfer
-* block to fit EOS on every second call
-*/
devpriv->usedma

[PATCH 07/20] staging: comedi: adl_pci9118: remove 'i8254_osc_base' from private data

2014-05-05 Thread H Hartley Sweeten
This member of the private data is always set to I8254_OSC_BASE_4MHZ.
Use that instead.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index bdb1ed3..ae8afc7 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -322,7 +322,6 @@ struct pci9118_private {
unsigned char AdFunctionReg;/* A/D function register */
char valid; /* driver is ok */
char ai_neverending;/* we do unlimited AI */
-   unsigned int i8254_osc_base;/* frequence of onboard oscilator */
unsigned int ai_do; /* what do AI? 0=nothing, 1 to 4 mode */
unsigned int ai_act_scan;   /* how many scans we finished */
unsigned int ai_buf_ptr;/* data buffer ptr in samples */
@@ -789,37 +788,35 @@ static void pci9118_calc_divisors(char mode, struct 
comedi_device *dev,
  char usessh, unsigned int chnsshfront)
 {
const struct boardtype *this_board = comedi_board(dev);
-   struct pci9118_private *devpriv = dev->private;
 
switch (mode) {
case 1:
case 4:
if (*tim2 < this_board->ai_ns_min)
*tim2 = this_board->ai_ns_min;
-   i8253_cascade_ns_to_timer(devpriv->i8254_osc_base,
+   i8253_cascade_ns_to_timer(I8254_OSC_BASE_4MHZ,
  div1, div2,
  tim2, flags & TRIG_ROUND_NEAREST);
break;
case 2:
if (*tim2 < this_board->ai_ns_min)
*tim2 = this_board->ai_ns_min;
-   *div1 = *tim2 / devpriv->i8254_osc_base;
+   *div1 = *tim2 / I8254_OSC_BASE_4MHZ;
/* convert timer (burst) */
if (*div1 < this_board->ai_pacer_min)
*div1 = this_board->ai_pacer_min;
-   *div2 = *tim1 / devpriv->i8254_osc_base;/* scan timer */
+   *div2 = *tim1 / I8254_OSC_BASE_4MHZ;/* scan timer */
*div2 = *div2 / *div1;  /* major timer is c1*c2 */
if (*div2 < chans)
*div2 = chans;
 
-   *tim2 = *div1 * devpriv->i8254_osc_base;
-   /* real convert timer */
+   *tim2 = *div1 * I8254_OSC_BASE_4MHZ;/* real convert timer */
 
if (usessh && (chnsshfront == 0))   /* use BSSH signal */
if (*div2 < (chans + 2))
*div2 = chans + 2;
 
-   *tim1 = *div1 * *div2 * devpriv->i8254_osc_base;
+   *tim1 = *div1 * *div2 * I8254_OSC_BASE_4MHZ;
break;
}
 }
@@ -1279,7 +1276,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev,
 
if (cmd->scan_begin_src == TRIG_TIMER) {
tmp = cmd->scan_begin_arg;
-   i8253_cascade_ns_to_timer(devpriv->i8254_osc_base,
+   i8253_cascade_ns_to_timer(I8254_OSC_BASE_4MHZ,
  &divisor1, &divisor2,
  &cmd->scan_begin_arg, cmd->flags);
if (cmd->scan_begin_arg < this_board->ai_ns_min)
@@ -1290,7 +1287,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev,
 
if (cmd->convert_src & (TRIG_TIMER | TRIG_NOW)) {
tmp = cmd->convert_arg;
-   i8253_cascade_ns_to_timer(devpriv->i8254_osc_base,
+   i8253_cascade_ns_to_timer(I8254_OSC_BASE_4MHZ,
  &divisor1, &divisor2,
  &cmd->convert_arg, cmd->flags);
if (cmd->convert_arg < this_board->ai_ns_min)
@@ -2065,7 +2062,6 @@ static int pci9118_common_attach(struct comedi_device 
*dev, int disable_irq,
s->insn_bits = pci9118_insn_bits_do;
 
devpriv->valid = 1;
-   devpriv->i8254_osc_base = I8254_OSC_BASE_4MHZ;
devpriv->ai_maskharderr = 0x10a;
/* default measure crash condition */
if (hw_err_mask)/* disable some requested */
-- 
1.9.2

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


[PATCH 02/20] staging: comedi: adl_pci9118: remove 'ai_chanlist' from private data

2014-05-05 Thread H Hartley Sweeten
This member of the private data is just a copy of the cmd->chanlist.
Use that instead.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 6b64484..cc56da4 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -340,7 +340,6 @@ struct pci9118_private {
 * how many channels we must add
 * before scan to satisfy DMA?
 */
-   unsigned int *ai_chanlist;  /* actual chanlist */
unsigned int ai_timer1;
unsigned int ai_timer2;
unsigned int ai_flags;
@@ -1617,7 +1616,6 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
devpriv->ai12_startstop = 0;
devpriv->ai_flags = cmd->flags;
devpriv->ai_n_scanlen = cmd->scan_end_arg;
-   devpriv->ai_chanlist = cmd->chanlist;
devpriv->ai_data_len = s->async->prealloc_bufsz;
devpriv->ai_timer1 = 0;
devpriv->ai_timer2 = 0;
@@ -1741,11 +1739,11 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
 
/* check and setup channel list */
if (!check_channel_list(dev, s, cmd->chanlist_len,
-   devpriv->ai_chanlist, devpriv->ai_add_front,
+   cmd->chanlist, devpriv->ai_add_front,
devpriv->ai_add_back))
return -EINVAL;
if (!setup_channel_list(dev, s, cmd->chanlist_len,
-   devpriv->ai_chanlist, 0, devpriv->ai_add_front,
+   cmd->chanlist, 0, devpriv->ai_add_front,
devpriv->ai_add_back, devpriv->usedma,
devpriv->useeoshandle))
return -EINVAL;
-- 
1.9.2

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


[PATCH 01/20] staging: comedi: adl_pci9118: remove 'ai_n_chan' from private data

2014-05-05 Thread H Hartley Sweeten
This member of the private data is just a copy of the cmd->chanlist_len.
Use that instead.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 4be5f67..6b64484 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -326,7 +326,6 @@ struct pci9118_private {
unsigned int ai_do; /* what do AI? 0=nothing, 1 to 4 mode */
unsigned int ai_act_scan;   /* how many scans we finished */
unsigned int ai_buf_ptr;/* data buffer ptr in samples */
-   unsigned int ai_n_chan; /* how many channels is measured */
unsigned int ai_n_scanlen;  /* len of actual scanlist */
unsigned int ai_n_realscanlen;  /*
 * what we must transfer for one
@@ -712,10 +711,11 @@ static unsigned int defragment_dma_buffer(struct 
comedi_device *dev,
  unsigned int num_samples)
 {
struct pci9118_private *devpriv = dev->private;
+   struct comedi_cmd *cmd = &s->async->cmd;
unsigned int i = 0, j = 0;
unsigned int start_pos = devpriv->ai_add_front,
-   stop_pos = devpriv->ai_add_front + devpriv->ai_n_chan;
-   unsigned int raw_scanlen = devpriv->ai_add_front + devpriv->ai_n_chan +
+   stop_pos = devpriv->ai_add_front + cmd->chanlist_len;
+   unsigned int raw_scanlen = devpriv->ai_add_front + cmd->chanlist_len +
devpriv->ai_add_back;
 
for (i = 0; i < num_samples; i++) {
@@ -1616,7 +1616,6 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
 
devpriv->ai12_startstop = 0;
devpriv->ai_flags = cmd->flags;
-   devpriv->ai_n_chan = cmd->chanlist_len;
devpriv->ai_n_scanlen = cmd->scan_end_arg;
devpriv->ai_chanlist = cmd->chanlist;
devpriv->ai_data_len = s->async->prealloc_bufsz;
@@ -1725,7 +1724,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
devpriv->ai_add_front = addchans + 1;
if (devpriv->usedma == 1)
if ((devpriv->ai_add_front +
-devpriv->ai_n_chan +
+cmd->chanlist_len +
 devpriv->ai_add_back) & 1)
devpriv->ai_add_front++;
/* round up to 32 bit */
@@ -1736,16 +1735,16 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
 * what we must take from card in real
 * to have ai_n_scanlen on output?
 */
-   (devpriv->ai_add_front + devpriv->ai_n_chan +
+   (devpriv->ai_add_front + cmd->chanlist_len +
 devpriv->ai_add_back) * (devpriv->ai_n_scanlen /
- devpriv->ai_n_chan);
+ cmd->chanlist_len);
 
/* check and setup channel list */
-   if (!check_channel_list(dev, s, devpriv->ai_n_chan,
+   if (!check_channel_list(dev, s, cmd->chanlist_len,
devpriv->ai_chanlist, devpriv->ai_add_front,
devpriv->ai_add_back))
return -EINVAL;
-   if (!setup_channel_list(dev, s, devpriv->ai_n_chan,
+   if (!setup_channel_list(dev, s, cmd->chanlist_len,
devpriv->ai_chanlist, 0, devpriv->ai_add_front,
devpriv->ai_add_back, devpriv->usedma,
devpriv->useeoshandle))
-- 
1.9.2

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


[PATCH 03/20] staging: comedi: adl_pci9118: remove 'ai_data_len' from private data

2014-05-05 Thread H Hartley Sweeten
This member of the private data is just a copy of the s->async->prealloc_bufsz.
Use that instead.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index cc56da4..94ede35 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -351,7 +351,6 @@ struct pci9118_private {
 * divisors for start of measure
 * on external start
 */
-   unsigned int ai_data_len;
unsigned short ao_data[2];  /* data output buffer */
unsigned int ai_scans;  /* number of scans to do */
char dma_doublebuf; /* we can use double buffering 
*/
@@ -1035,10 +1034,8 @@ static void interrupt_pci9118_ai_dma(struct 
comedi_device *dev,
}
 
if (samplesinbuf) {
-   m = devpriv->ai_data_len >> 1;  /*
-* how many samples is to
-* end of buffer
-*/
+   /* how many samples is to end of buffer */
+   m = s->async->prealloc_bufsz >> 1;
sampls = m;
move_block_from_dma(dev, s,
devpriv->dmabuf_virt[devpriv->dma_actbuf],
@@ -1335,7 +1332,8 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev,
return 0;
 }
 
-static int Compute_and_setup_dma(struct comedi_device *dev)
+static int Compute_and_setup_dma(struct comedi_device *dev,
+struct comedi_subdevice *s)
 {
struct pci9118_private *devpriv = dev->private;
unsigned int dmalen0, dmalen1, i;
@@ -1343,15 +1341,13 @@ static int Compute_and_setup_dma(struct comedi_device 
*dev)
dmalen0 = devpriv->dmabuf_size[0];
dmalen1 = devpriv->dmabuf_size[1];
/* isn't output buff smaller that our DMA buff? */
-   if (dmalen0 > (devpriv->ai_data_len)) {
-   dmalen0 = devpriv->ai_data_len & ~3L;   /*
-* align to 32bit down
-*/
+   if (dmalen0 > s->async->prealloc_bufsz) {
+   /* align to 32bit down */
+   dmalen0 = s->async->prealloc_bufsz & ~3L;
}
-   if (dmalen1 > (devpriv->ai_data_len)) {
-   dmalen1 = devpriv->ai_data_len & ~3L;   /*
-* align to 32bit down
-*/
+   if (dmalen1 > s->async->prealloc_bufsz) {
+   /* align to 32bit down */
+   dmalen1 = s->async->prealloc_bufsz & ~3L;
}
 
/* we want wake up every scan? */
@@ -1540,7 +1536,7 @@ static int pci9118_ai_docmd_dma(struct comedi_device *dev,
 {
struct pci9118_private *devpriv = dev->private;
 
-   Compute_and_setup_dma(dev);
+   Compute_and_setup_dma(dev, s);
 
switch (devpriv->ai_do) {
case 1:
@@ -1616,7 +1612,6 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
devpriv->ai12_startstop = 0;
devpriv->ai_flags = cmd->flags;
devpriv->ai_n_scanlen = cmd->scan_end_arg;
-   devpriv->ai_data_len = s->async->prealloc_bufsz;
devpriv->ai_timer1 = 0;
devpriv->ai_timer2 = 0;
devpriv->ai_add_front = 0;
-- 
1.9.2

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


[PATCH 09/20] staging: comedi: adl_pci9118: remove 'usessh' from private data

2014-05-05 Thread H Hartley Sweeten
This member of the private data is only set when the cmd->convert_src
is TRIG_NOW. Use that instead.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index bfcd90c..60cc41a 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -388,7 +388,6 @@ struct pci9118_private {
 * =1 change WAKE_EOS DMA transfer
 * to fit on every second
 */
-   unsigned char usessh;   /* =1 turn on S&H support */
int softsshdelay;   /*
 * >0 use software S&H,
 * numer is requested delay in ns
@@ -784,9 +783,10 @@ static void pci9118_calc_divisors(char mode, struct 
comedi_device *dev,
  unsigned int *tim1, unsigned int *tim2,
  unsigned int flags, int chans,
  unsigned int *div1, unsigned int *div2,
- char usessh, unsigned int chnsshfront)
+ unsigned int chnsshfront)
 {
const struct boardtype *this_board = comedi_board(dev);
+   struct comedi_cmd *cmd = &s->async->cmd;
 
switch (mode) {
case 1:
@@ -811,9 +811,11 @@ static void pci9118_calc_divisors(char mode, struct 
comedi_device *dev,
 
*tim2 = *div1 * I8254_OSC_BASE_4MHZ;/* real convert timer */
 
-   if (usessh && (chnsshfront == 0))   /* use BSSH signal */
+   if (cmd->convert_src == TRIG_NOW && !chnsshfront) {
+   /* use BSSH signal */
if (*div2 < (chans + 2))
*div2 = chans + 2;
+   }
 
*tim1 = *div1 * *div2 * I8254_OSC_BASE_4MHZ;
break;
@@ -1532,6 +1534,7 @@ static int pci9118_ai_docmd_dma(struct comedi_device *dev,
struct comedi_subdevice *s)
 {
struct pci9118_private *devpriv = dev->private;
+   struct comedi_cmd *cmd = &s->async->cmd;
 
Compute_and_setup_dma(dev, s);
 
@@ -1546,7 +1549,7 @@ static int pci9118_ai_docmd_dma(struct comedi_device *dev,
devpriv->AdFunctionReg =
AdFunction_PDTrg | AdFunction_PETrg | AdFunction_BM |
AdFunction_BS;
-   if (devpriv->usessh && (!devpriv->softsshdelay))
+   if (cmd->convert_src == TRIG_NOW && !devpriv->softsshdelay)
devpriv->AdFunctionReg |= AdFunction_BSSH;
outl(devpriv->ai_n_realscanlen, dev->iobase + PCI9118_BURST);
break;
@@ -1634,14 +1637,6 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
if (cmd->stop_src == TRIG_COUNT)
devpriv->ai_neverending = 0;
 
-   /* use sample&hold signal? */
-   if (cmd->convert_src == TRIG_NOW)
-   devpriv->usessh = 1;
-   /* yes */
-   else
-   devpriv->usessh = 0;
-   /*  no */
-
/*
 * use additional sample at end of every scan
 * to satisty DMA 32 bit transfer?
@@ -1690,7 +1685,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
 * we need software S&H signal?
 * It adds two samples before every scan as minimum
 */
-   if (devpriv->usessh && devpriv->softsshdelay) {
+   if (cmd->convert_src == TRIG_NOW && devpriv->softsshdelay) {
devpriv->ai_add_front = 2;
if ((devpriv->usedma == 1) && (devpriv->ai_add_back == 1)) {
/* move it to front */
@@ -1752,7 +1747,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
  devpriv->ai_flags,
  devpriv->ai_n_realscanlen,
  &devpriv->ai_divisor1,
- &devpriv->ai_divisor2, devpriv->usessh,
+ &devpriv->ai_divisor2,
  devpriv->ai_add_front);
}
 
@@ -1773,7 +1768,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
  devpriv->ai_flags,
  devpriv->ai_n_realscanlen,
  &devpriv->ai_divisor1,
- &devpriv->ai_divisor2, devpriv->usessh,
+   

[PATCH 16/20] staging: comedi: adl_pci9118: remove 'int_ai_func' from private data

2014-05-05 Thread H Hartley Sweeten
The devpriv->usedma flag can be checked to determine which handler
function should be used to transfer the analog input data. Do that
instead and remove the member from the private data.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 0e9fc0d..358f09c6 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -369,13 +369,6 @@ struct pci9118_private {
 * users(0-AI, 1-AO, 2-DI, 3-DO)
 */
unsigned int cnt0_divisor;  /* actual CNT0 divisor */
-   void (*int_ai_func)(struct comedi_device *, struct comedi_subdevice *,
-   unsigned short,
-   unsigned int,
-   unsigned short);/*
-* ptr to actual interrupt
-* AI function
-*/
unsigned char usedma;   /* =1 use DMA transfer and not INT */
int softsshdelay;   /*
 * >0 use software S&H,
@@ -1040,6 +1033,7 @@ static void interrupt_pci9118_ai_dma(struct comedi_device 
*dev,
 static irqreturn_t interrupt_pci9118(int irq, void *d)
 {
struct comedi_device *dev = d;
+   struct comedi_subdevice *s = dev->read_subdev;
struct pci9118_private *devpriv = dev->private;
unsigned int int_daq = 0, int_amcc, int_adstat;
 
@@ -1061,7 +1055,7 @@ static irqreturn_t interrupt_pci9118(int irq, void *d)
/* get STATUS register */
 
if (devpriv->ai_do) {
-   if (devpriv->ai12_startstop)
+   if (devpriv->ai12_startstop) {
if ((int_adstat & AdStatus_DTH) &&
(int_daq & Int_DTrg)) {
/* start stop of measure */
@@ -1095,9 +1089,14 @@ static irqreturn_t interrupt_pci9118(int irq, void *d)
}
}
}
+   }
 
-   (devpriv->int_ai_func) (dev, dev->read_subdev, int_adstat,
-   int_amcc, int_daq);
+   if (devpriv->usedma)
+   interrupt_pci9118_ai_dma(dev, s, int_adstat,
+int_amcc, int_daq);
+   else
+   interrupt_pci9118_ai_onesample(dev, s, int_adstat,
+  int_amcc, int_daq);
 
}
return IRQ_HANDLED;
@@ -1472,9 +1471,6 @@ static int pci9118_ai_docmd_sampl(struct comedi_device 
*dev,
return -EIO;
}
 
-   devpriv->int_ai_func = interrupt_pci9118_ai_onesample;
-   /* transfer function */
-
if (devpriv->ai12_startstop)
pci9118_exttrg_add(dev, EXTTRG_AI);
/* activate EXT trigger */
@@ -1553,9 +1549,6 @@ static int pci9118_ai_docmd_dma(struct comedi_device *dev,
/* activate EXT trigger */
}
 
-   devpriv->int_ai_func = interrupt_pci9118_ai_dma;
-   /* transfer function */
-
outl(0x0200 | AINT_WRITE_COMPL,
 devpriv->iobase_a + AMCC_OP_REG_INTCSR);
 
-- 
1.9.2

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


[PATCH 05/20] staging: comedi: adl_pci9118: remove 'ai_timer2' from private data

2014-05-05 Thread H Hartley Sweeten
This member of the private data is set but never used. Remove it.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index b30d3e8..da1ae75 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -340,7 +340,6 @@ struct pci9118_private {
 * how many channels we must add
 * before scan to satisfy DMA?
 */
-   unsigned int ai_timer2;
unsigned int ai_flags;
char ai12_startstop;/*
 * measure can start/stop
@@ -1611,7 +1610,6 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
devpriv->ai12_startstop = 0;
devpriv->ai_flags = cmd->flags;
devpriv->ai_n_scanlen = cmd->scan_end_arg;
-   devpriv->ai_timer2 = 0;
devpriv->ai_add_front = 0;
devpriv->ai_add_back = 0;
devpriv->ai_maskerr = 0x10e;
@@ -1762,7 +1760,6 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
  &devpriv->ai_divisor1,
  &devpriv->ai_divisor2, devpriv->usessh,
  devpriv->ai_add_front);
-   devpriv->ai_timer2 = cmd->convert_arg;
}
 
if ((cmd->scan_begin_src == TRIG_TIMER) &&
@@ -1784,7 +1781,6 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
  &devpriv->ai_divisor1,
  &devpriv->ai_divisor2, devpriv->usessh,
  devpriv->ai_add_front);
-   devpriv->ai_timer2 = cmd->convert_arg;
}
 
if ((cmd->scan_begin_src == TRIG_FOLLOW)
-- 
1.9.2

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


[PATCH 17/20] staging: comedi: adl_pci9118: tidy up interrupt_pci9118()

2014-05-05 Thread H Hartley Sweeten
For aesthetics, rename this function so it has namespace associated
with the driver.

Refactor the function to reduce the indent level and tidy up the code.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 358f09c6..b1d9e35 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -1030,75 +1030,62 @@ static void interrupt_pci9118_ai_dma(struct 
comedi_device *dev,
cfc_handle_events(dev, s);
 }
 
-static irqreturn_t interrupt_pci9118(int irq, void *d)
+static irqreturn_t pci9118_interrupt(int irq, void *d)
 {
struct comedi_device *dev = d;
struct comedi_subdevice *s = dev->read_subdev;
struct pci9118_private *devpriv = dev->private;
-   unsigned int int_daq = 0, int_amcc, int_adstat;
+   unsigned int intsrc;/* IRQ reasons from card */
+   unsigned int intcsr;/* INT register from AMCC chip */
+   unsigned int adstat;/* STATUS register */
 
if (!dev->attached)
-   return IRQ_NONE;/* not fully initialized */
-
-   int_daq = inl(dev->iobase + PCI9118_INTSRC) & 0xf;
-   /* get IRQ reasons from card */
-   int_amcc = inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR);
-   /* get INT register from AMCC chip */
-
-   if ((!int_daq) && (!(int_amcc & ANY_S593X_INT)))
-   return IRQ_NONE;/* interrupt from other source */
-
-   outl(int_amcc | 0x00ff, devpriv->iobase_a + AMCC_OP_REG_INTCSR);
-   /* shutdown IRQ reasons in AMCC */
-
-   int_adstat = inw(dev->iobase + PCI9118_ADSTAT) & 0x1ff;
-   /* get STATUS register */
-
-   if (devpriv->ai_do) {
-   if (devpriv->ai12_startstop) {
-   if ((int_adstat & AdStatus_DTH) &&
-   (int_daq & Int_DTrg)) {
-   /* start stop of measure */
-   if (devpriv->ai12_startstop & START_AI_EXT) {
-   devpriv->ai12_startstop &=
-   ~START_AI_EXT;
-   if (!(devpriv->ai12_startstop &
-   STOP_AI_EXT))
-   pci9118_exttrg_del
-   (dev, EXTTRG_AI);
-   /* deactivate EXT trigger */
-   start_pacer(dev, devpriv->ai_do,
-   devpriv->ai_divisor1,
-   devpriv->ai_divisor2);
-   /* start pacer */
-   outl(devpriv->AdControlReg,
-   dev->iobase + PCI9118_ADCNTRL);
-   } else {
-   if (devpriv->ai12_startstop &
-   STOP_AI_EXT) {
-   devpriv->ai12_startstop &=
-   ~STOP_AI_EXT;
-   pci9118_exttrg_del
-   (dev, EXTTRG_AI);
-   /* deactivate EXT trigger */
-   devpriv->ai_neverending = 0;
-   /*
-* well, on next interrupt from
-* DMA/EOC measure will stop
-*/
-   }
-   }
+   return IRQ_NONE;
+
+   intsrc = inl(dev->iobase + PCI9118_INTSRC) & 0xf;
+   intcsr = inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR);
+
+   if (!intsrc && !(intcsr & ANY_S593X_INT))
+   return IRQ_NONE;
+
+   outl(intcsr | 0x00ff, devpriv->iobase_a + AMCC_OP_REG_INTCSR);
+
+   adstat = inw(dev->iobase + PCI9118_ADSTAT) & 0x1ff;
+
+   if (!devpriv->ai_do)
+   return IRQ_HANDLED;
+
+   if (devpriv->ai12_startstop) {
+   if ((adstat & AdStatus_DTH) && (intsrc & Int_DTrg)) {
+   /* start/stop of measure */
+   if (devpriv->ai12_startstop & START_AI_EXT) {
+   /* deactivate E

[PATCH 13/20] staging: comedi: adl_pci9118: remove 'cnt0_users' from private data

2014-05-05 Thread H Hartley Sweeten
This member of the private data is set to 0 but never used. Remove it.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index f60dc41..8814b06 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -364,10 +364,6 @@ struct pci9118_private {
unsigned int dmabuf_panic_size[2];
unsigned int dmabuf_samples[2]; /* size in samples */
int dmabuf_pages[2];/* number of pages in buffer */
-   unsigned char cnt0_users;   /*
-* bit field of 8254 CNT0 users
-* (0-unused, 1-AO, 2-DI, 3-DO)
-*/
unsigned char exttrg_users; /*
 * bit field of external trigger
 * users(0-AI, 1-AO, 2-DI, 3-DO)
@@ -1857,7 +1853,6 @@ static int pci9118_reset(struct comedi_device *dev)
 * disable INT and DMA
 */
 
-   devpriv->cnt0_users = 0;
devpriv->exttrg_users = 0;
 
return 0;
-- 
1.9.2

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


[PATCH 08/20] staging: comedi: adl_pci9118: remove 'ai_scans' from private data

2014-05-05 Thread H Hartley Sweeten
This member of the private data is just a copy of the cmd->stop_arg.
Use that instead.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index ae8afc7..bfcd90c 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -348,7 +348,6 @@ struct pci9118_private {
 * on external start
 */
unsigned short ao_data[2];  /* data output buffer */
-   unsigned int ai_scans;  /* number of scans to do */
char dma_doublebuf; /* we can use double buffering 
*/
unsigned int dma_actbuf;/* which buffer is used now */
unsigned short *dmabuf_virt[2]; /*
@@ -976,7 +975,7 @@ static void interrupt_pci9118_ai_onesample(struct 
comedi_device *dev,
devpriv->ai_act_scan++;
if (!devpriv->ai_neverending) {
/* all data sampled? */
-   if (devpriv->ai_act_scan >= devpriv->ai_scans)
+   if (devpriv->ai_act_scan >= cmd->stop_arg)
s->async->events |= COMEDI_CB_EOA;
}
}
@@ -991,6 +990,7 @@ static void interrupt_pci9118_ai_dma(struct comedi_device 
*dev,
 unsigned short int_daq)
 {
struct pci9118_private *devpriv = dev->private;
+   struct comedi_cmd *cmd = &s->async->cmd;
unsigned int next_dma_buf, samplesinbuf, sampls, m;
 
if (int_amcc & MASTER_ABORT_INT) {
@@ -1041,7 +1041,7 @@ static void interrupt_pci9118_ai_dma(struct comedi_device 
*dev,
 
if (!devpriv->ai_neverending) {
/* all data sampled? */
-   if (devpriv->ai_act_scan >= devpriv->ai_scans)
+   if (devpriv->ai_act_scan >= cmd->stop_arg)
s->async->events |= COMEDI_CB_EOA;
}
 
@@ -1332,6 +1332,7 @@ static int Compute_and_setup_dma(struct comedi_device 
*dev,
 struct comedi_subdevice *s)
 {
struct pci9118_private *devpriv = dev->private;
+   struct comedi_cmd *cmd = &s->async->cmd;
unsigned int dmalen0, dmalen1, i;
 
dmalen0 = devpriv->dmabuf_size[0];
@@ -1413,10 +1414,10 @@ static int Compute_and_setup_dma(struct comedi_device 
*dev,
/* fits whole measure into one DMA buffer? */
if (dmalen0 >
((devpriv->ai_n_realscanlen << 1) *
-devpriv->ai_scans)) {
+cmd->stop_arg)) {
dmalen0 =
(devpriv->ai_n_realscanlen << 1) *
-   devpriv->ai_scans;
+   cmd->stop_arg;
dmalen0 &= ~3L;
} else {/*
 * fits whole measure into
@@ -1424,10 +1425,10 @@ static int Compute_and_setup_dma(struct comedi_device 
*dev,
 */
if (dmalen1 >
((devpriv->ai_n_realscanlen << 1) *
-devpriv->ai_scans - dmalen0))
+cmd->stop_arg - dmalen0))
dmalen1 =
(devpriv->ai_n_realscanlen << 1) *
-   devpriv->ai_scans - dmalen0;
+   cmd->stop_arg - dmalen0;
dmalen1 &= ~3L;
}
}
@@ -1630,12 +1631,8 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
 #endif
if (cmd->stop_src == TRIG_NONE)
devpriv->ai_neverending = 1;
-   if (cmd->stop_src == TRIG_COUNT) {
-   devpriv->ai_scans = cmd->stop_arg;
+   if (cmd->stop_src == TRIG_COUNT)
devpriv->ai_neverending = 0;
-   } else {
-   devpriv->ai_scans = 0;
-   }
 
/* use sample&hold signal? */
if (cmd->convert_src == TRIG_NOW)
-- 
1.9.2

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


[PATCH] [staging/silicom] Fixing missing blank line after declarations

2014-05-05 Thread Fernando Apesteguia
Small fix to driver. If these patches are welcomed, more could come in the
future.

Regards
>From d8369cba0552c5ea5f4eadc750434e39785e042a Mon Sep 17 00:00:00 2001
From: Fernando Apesteguia 
Date: Mon, 5 May 2014 18:16:53 +0200
Subject: [PATCH] [staging/silicom] Fixing missing blank line after
 declarations

---
 drivers/staging/silicom/bpctl_mod.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/silicom/bpctl_mod.c b/drivers/staging/silicom/bpctl_mod.c
index 7f3d884..8fb527b 100644
--- a/drivers/staging/silicom/bpctl_mod.c
+++ b/drivers/staging/silicom/bpctl_mod.c
@@ -7450,6 +7450,7 @@ static int bypass_proc_remove_dev_sd(struct bpctl_dev *pbp_device_block)
 {

	struct bypass_pfs_sd *current_pfs = &pbp_device_block->bypass_pfs_set;
+
	remove_proc_subtree(current_pfs->dir_name, bp_procfs_dir);
	current_pfs->bypass_entry = NULL;
	return 0;
--
1.7.9.5
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 06/20] staging: comedi: adl_pci9118: remove 'ai_n_scanlen' from private data

2014-05-05 Thread H Hartley Sweeten
This member of the private data is just a copy of the cmd->scan_end_arg.
Use that instead.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index da1ae75..bdb1ed3 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -326,7 +326,6 @@ struct pci9118_private {
unsigned int ai_do; /* what do AI? 0=nothing, 1 to 4 mode */
unsigned int ai_act_scan;   /* how many scans we finished */
unsigned int ai_buf_ptr;/* data buffer ptr in samples */
-   unsigned int ai_n_scanlen;  /* len of actual scanlist */
unsigned int ai_n_realscanlen;  /*
 * what we must transfer for one
 * outgoing scan include front/back adds
@@ -732,13 +731,14 @@ static int move_block_from_dma(struct comedi_device *dev,
unsigned int num_samples)
 {
struct pci9118_private *devpriv = dev->private;
+   struct comedi_cmd *cmd = &s->async->cmd;
unsigned int num_bytes;
 
num_samples = defragment_dma_buffer(dev, s, dma_buffer, num_samples);
devpriv->ai_act_scan +=
-   (s->async->cur_chan + num_samples) / devpriv->ai_n_scanlen;
+   (s->async->cur_chan + num_samples) / cmd->scan_end_arg;
s->async->cur_chan += num_samples;
-   s->async->cur_chan %= devpriv->ai_n_scanlen;
+   s->async->cur_chan %= cmd->scan_end_arg;
num_bytes =
cfc_write_array_to_buffer(s, dma_buffer,
  num_samples * sizeof(short));
@@ -948,6 +948,7 @@ static void interrupt_pci9118_ai_onesample(struct 
comedi_device *dev,
   unsigned short int_daq)
 {
struct pci9118_private *devpriv = dev->private;
+   struct comedi_cmd *cmd = &s->async->cmd;
unsigned short sampl;
 
if (int_adstat & devpriv->ai_maskerr)
@@ -972,9 +973,9 @@ static void interrupt_pci9118_ai_onesample(struct 
comedi_device *dev,
 #endif
cfc_write_to_buffer(s, sampl);
s->async->cur_chan++;
-   if (s->async->cur_chan >= devpriv->ai_n_scanlen) {
+   if (s->async->cur_chan >= cmd->scan_end_arg) {
/* one scan done */
-   s->async->cur_chan %= devpriv->ai_n_scanlen;
+   s->async->cur_chan %= cmd->scan_end_arg;
devpriv->ai_act_scan++;
if (!devpriv->ai_neverending) {
/* all data sampled? */
@@ -1441,18 +1442,18 @@ static int Compute_and_setup_dma(struct comedi_device 
*dev,
devpriv->dmabuf_use_size[1] = dmalen1;
 
 #if 0
-   if (devpriv->ai_n_scanlen < this_board->half_fifo_size) {
+   if (cmd->scan_end_arg < this_board->half_fifo_size) {
devpriv->dmabuf_panic_size[0] =
-   (this_board->half_fifo_size / devpriv->ai_n_scanlen +
-1) * devpriv->ai_n_scanlen * sizeof(short);
+   (this_board->half_fifo_size / cmd->scan_end_arg +
+1) * cmd->scan_end_arg * sizeof(short);
devpriv->dmabuf_panic_size[1] =
-   (this_board->half_fifo_size / devpriv->ai_n_scanlen +
-1) * devpriv->ai_n_scanlen * sizeof(short);
+   (this_board->half_fifo_size / cmd->scan_end_arg +
+1) * cmd->scan_end_arg * sizeof(short);
} else {
devpriv->dmabuf_panic_size[0] =
-   (devpriv->ai_n_scanlen << 1) % devpriv->dmabuf_size[0];
+   (cmd->scan_end_arg << 1) % devpriv->dmabuf_size[0];
devpriv->dmabuf_panic_size[1] =
-   (devpriv->ai_n_scanlen << 1) % devpriv->dmabuf_size[1];
+   (cmd->scan_end_arg << 1) % devpriv->dmabuf_size[1];
}
 #endif
 
@@ -1609,7 +1610,6 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
 
devpriv->ai12_startstop = 0;
devpriv->ai_flags = cmd->flags;
-   devpriv->ai_n_scanlen = cmd->scan_end_arg;
devpriv->ai_add_front = 0;
devpriv->ai_add_back = 0;
devpriv->ai_maskerr = 0x10e;
@@ -1658,7 +1658,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
if (devpriv->master) {
devpriv->usedma = 1;
if ((cmd->flags & TRIG_WAKE_EOS) &&
-   (devpriv->ai_n_scanlen == 1)) {
+   (cmd->scan_end_arg == 1)) {
if (cmd->convert_src == TRIG_NOW)
devpriv->ai_add_back = 1;
if 

[PATCH 18/20] staging: comedi: adl_pci9118: tidy up start_pacer()

2014-05-05 Thread H Hartley Sweeten
For aesthetics, rename this function so it has namespace associated
with the driver.

The divisors used to load the counters are stored in the private data.
Get them from there and remove the parameters.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index b1d9e35..2be7037 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -792,9 +792,12 @@ static void pci9118_calc_divisors(char mode, struct 
comedi_device *dev,
}
 }
 
-static void start_pacer(struct comedi_device *dev, int mode,
-   unsigned int divisor1, unsigned int divisor2)
+static void pci9118_start_pacer(struct comedi_device *dev, int mode)
 {
+   struct pci9118_private *devpriv = dev->private;
+   unsigned int divisor1 = devpriv->ai_divisor1;
+   unsigned int divisor2 = devpriv->ai_divisor2;
+
outl(0x74, dev->iobase + PCI9118_CNTCTRL);
outl(0xb4, dev->iobase + PCI9118_CNTCTRL);
 /* outl(0x30, dev->iobase + PCI9118_CNTCTRL); */
@@ -818,7 +821,7 @@ static int pci9118_ai_cancel(struct comedi_device *dev,
(~EN_A2P_TRANSFERS),
devpriv->iobase_a + AMCC_OP_REG_MCSR);  /* stop DMA */
pci9118_exttrg_del(dev, EXTTRG_AI);
-   start_pacer(dev, 0, 0, 0);  /* stop 8254 counters */
+   pci9118_start_pacer(dev, 0);/* stop 8254 counters */
devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg;
outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC);
/*
@@ -1065,9 +1068,7 @@ static irqreturn_t pci9118_interrupt(int irq, void *d)
pci9118_exttrg_del(dev, EXTTRG_AI);
 
/* start pacer */
-   start_pacer(dev, devpriv->ai_do,
-   devpriv->ai_divisor1,
-   devpriv->ai_divisor2);
+   pci9118_start_pacer(dev, devpriv->ai_do);
outl(devpriv->AdControlReg,
 dev->iobase + PCI9118_ADCNTRL);
} else if (devpriv->ai12_startstop & STOP_AI_EXT) {
@@ -1105,8 +1106,7 @@ static int pci9118_ai_inttrig(struct comedi_device *dev,
outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL);
outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC);
if (devpriv->ai_do != 3) {
-   start_pacer(dev, devpriv->ai_do, devpriv->ai_divisor1,
-   devpriv->ai_divisor2);
+   pci9118_start_pacer(dev, devpriv->ai_do);
devpriv->AdControlReg |= AdControl_SoftG;
}
outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL);
@@ -1475,8 +1475,7 @@ static int pci9118_ai_docmd_sampl(struct comedi_device 
*dev,
outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL);
outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC);
if (devpriv->ai_do != 3) {
-   start_pacer(dev, devpriv->ai_do, devpriv->ai_divisor1,
-   devpriv->ai_divisor2);
+   pci9118_start_pacer(dev, devpriv->ai_do);
devpriv->AdControlReg |= AdControl_SoftG;
}
outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL);
@@ -1543,8 +1542,7 @@ static int pci9118_ai_docmd_dma(struct comedi_device *dev,
outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC);
outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL);
if (devpriv->ai_do != 3) {
-   start_pacer(dev, devpriv->ai_do, devpriv->ai_divisor1,
-   devpriv->ai_divisor2);
+   pci9118_start_pacer(dev, devpriv->ai_do);
devpriv->AdControlReg |= AdControl_SoftG;
}
outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL);
@@ -1717,7 +1715,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
devpriv->ai_do = 3;
}
 
-   start_pacer(dev, -1, 0, 0); /* stop pacer */
+   pci9118_start_pacer(dev, -1);   /* stop pacer */
 
devpriv->AdControlReg = 0;  /*
 * bipolar, S.E., use 8254, stop 8354,
@@ -1763,7 +1761,7 @@ static int pci9118_reset(struct comedi_device *dev)
/* disable interrupts source */
outl(0x30, dev->iobase + PCI9118_CNTCTRL);
 /* outl(0xb4, dev->iobase + PC

[PATCH 04/20] staging: comedi: adl_pci9118: remove 'ai_timer1' from private data

2014-05-05 Thread H Hartley Sweeten
This member of the private data is set but never used. Remove it.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 94ede35..b30d3e8 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -340,7 +340,6 @@ struct pci9118_private {
 * how many channels we must add
 * before scan to satisfy DMA?
 */
-   unsigned int ai_timer1;
unsigned int ai_timer2;
unsigned int ai_flags;
char ai12_startstop;/*
@@ -1612,7 +1611,6 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
devpriv->ai12_startstop = 0;
devpriv->ai_flags = cmd->flags;
devpriv->ai_n_scanlen = cmd->scan_end_arg;
-   devpriv->ai_timer1 = 0;
devpriv->ai_timer2 = 0;
devpriv->ai_add_front = 0;
devpriv->ai_add_back = 0;
@@ -1786,7 +1784,6 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
  &devpriv->ai_divisor1,
  &devpriv->ai_divisor2, devpriv->usessh,
  devpriv->ai_add_front);
-   devpriv->ai_timer1 = cmd->scan_begin_arg;
devpriv->ai_timer2 = cmd->convert_arg;
}
 
-- 
1.9.2

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


RE: [PATCH 0/4] staging: comedi: addi_apci_1564: Further cleanups

2014-05-05 Thread Hartley Sweeten
On Saturday, May 03, 2014 12:54 AM, Chase Southwood wrote:
> Latest patchset in a continuing cleanup of addi_apci_1564.c.  Main focus
> is on the auto_attach() function, but also cleaning up some of the old addi
> common code wrappers.
>
> To be applied on top of my prior patchset to this file (the one beginning
> with [PATCH 1/6] staging: comedi: addi_apci_1564: remove eeprom support code)
>
> Chase Southwood (4):
>   staging: comedi: addi_apci_1564: board has 32 digital outputs
>   staging: comedi: addi_apci_1564: don't allocate unused subdevices
>   staging: comedi: addi_apci_1564: absorb apci1564_reset()
>   staging: comedi: addi_apci_1564: call apci1564_interrupt() directly
>
>  .../comedi/drivers/addi-data/hwdrv_apci1564.c  | 32 ---
>  drivers/staging/comedi/drivers/addi_apci_1564.c| 98 
> ++
>  2 files changed, 45 insertions(+), 85 deletions(-)

Looks good.

Reviewed-by: H Hartley Sweeten 

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


[PATCH 3/4] staging: comedi: adl_pc19111: remove 'chanlist_len' from private data

2014-05-05 Thread H Hartley Sweeten
This member of the private data is a copy of the cmd->chanlist_len. Use
that instead.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c 
b/drivers/staging/comedi/drivers/adl_pci9111.c
index 7596b4e..c84930c 100644
--- a/drivers/staging/comedi/drivers/adl_pci9111.c
+++ b/drivers/staging/comedi/drivers/adl_pci9111.c
@@ -139,7 +139,6 @@ struct pci9111_private_data {
int stop_counter;
 
unsigned int scan_delay;
-   unsigned int chanlist_len;
unsigned int chunk_counter;
unsigned int chunk_num_samples;
 
@@ -513,10 +512,9 @@ static int pci9111_ai_do_cmd(struct comedi_device *dev,
}
 
dev_private->stop_counter *= (1 + dev_private->scan_delay);
-   dev_private->chanlist_len = cmd->chanlist_len;
dev_private->chunk_counter = 0;
-   dev_private->chunk_num_samples =
-   dev_private->chanlist_len * (1 + dev_private->scan_delay);
+   dev_private->chunk_num_samples = cmd->chanlist_len *
+(1 + dev_private->scan_delay);
 
return 0;
 }
@@ -612,9 +610,8 @@ static irqreturn_t pci9111_interrupt(int irq, void 
*p_device)
 
while (position < num_samples) {
if (dev_private->chunk_counter <
-   dev_private->chanlist_len) {
-   to_read =
-   dev_private->chanlist_len -
+   cmd->chanlist_len) {
+   to_read = cmd->chanlist_len -
dev_private->chunk_counter;
 
if (to_read >
-- 
1.9.2

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


[PATCH 0/4] staging: comedi: adl_pc19111: cleanup the private data

2014-05-05 Thread H Hartley Sweeten
Remove the unused or unnecessary members from the private data.

H Hartley Sweeten (4):
  staging: comedi: adl_pc19111: remove 'stop_is_none' from private data
  staging: comedi: adl_pc19111: rename 'async_cmd' variable in (*do_cmd)
  staging: comedi: adl_pc19111: remove 'chanlist_len' from private data
  staging: comedi: adl_pc19111: remove 'continuous' from subdevice private data

 drivers/staging/comedi/drivers/adl_pci9111.c   | 57 +-
 .../staging/comedi/drivers/amplc_dio200_common.c   | 18 ++-
 2 files changed, 29 insertions(+), 46 deletions(-)

-- 
1.9.2

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


[PATCH 1/4] staging: comedi: adl_pc19111: remove 'stop_is_none' from private data

2014-05-05 Thread H Hartley Sweeten
This member of the private data can be determined by checking the
cmd->stop_src. Do that instead.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c 
b/drivers/staging/comedi/drivers/adl_pci9111.c
index 96b1bf8..430b51a 100644
--- a/drivers/staging/comedi/drivers/adl_pci9111.c
+++ b/drivers/staging/comedi/drivers/adl_pci9111.c
@@ -137,7 +137,6 @@ struct pci9111_private_data {
unsigned long lcr_io_base;
 
int stop_counter;
-   int stop_is_none;
 
unsigned int scan_delay;
unsigned int chanlist_len;
@@ -485,10 +484,8 @@ static int pci9111_ai_do_cmd(struct comedi_device *dev,
if (async_cmd->stop_src == TRIG_COUNT) {
dev_private->stop_counter =
async_cmd->stop_arg * async_cmd->chanlist_len;
-   dev_private->stop_is_none = 0;
} else {/* TRIG_NONE */
dev_private->stop_counter = 0;
-   dev_private->stop_is_none = 1;
}
 
/*  Set timer pacer */
@@ -550,6 +547,7 @@ static irqreturn_t pci9111_interrupt(int irq, void 
*p_device)
struct pci9111_private_data *dev_private = dev->private;
struct comedi_subdevice *s = dev->read_subdev;
struct comedi_async *async;
+   struct comedi_cmd *cmd;
unsigned int status;
unsigned long irq_flags;
unsigned char intcsr;
@@ -561,6 +559,7 @@ static irqreturn_t pci9111_interrupt(int irq, void 
*p_device)
}
 
async = s->async;
+   cmd = &async->cmd;
 
spin_lock_irqsave(&dev->spinlock, irq_flags);
 
@@ -596,12 +595,11 @@ static irqreturn_t pci9111_interrupt(int irq, void 
*p_device)
unsigned int num_samples;
unsigned int bytes_written = 0;
 
-   num_samples =
-   PCI9111_FIFO_HALF_SIZE >
-   dev_private->stop_counter
-   && !dev_private->
-   stop_is_none ? dev_private->stop_counter :
-   PCI9111_FIFO_HALF_SIZE;
+   if (cmd->stop_src == TRIG_COUNT &&
+   PCI9111_FIFO_HALF_SIZE > dev_private->stop_counter)
+   num_samples = dev_private->stop_counter;
+   else
+   num_samples = PCI9111_FIFO_HALF_SIZE;
insw(dev->iobase + PCI9111_AI_FIFO_REG,
 dev_private->ai_bounce_buffer, num_samples);
 
@@ -664,7 +662,7 @@ static irqreturn_t pci9111_interrupt(int irq, void 
*p_device)
}
}
 
-   if (dev_private->stop_counter == 0 && !dev_private->stop_is_none)
+   if (cmd->stop_src == TRIG_COUNT && dev_private->stop_counter == 0)
async->events |= COMEDI_CB_EOA;
 
outb(0, dev->iobase + PCI9111_INT_CLR_REG);
-- 
1.9.2

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


[PATCH 4/4] staging: comedi: adl_pc19111: remove 'continuous' from subdevice private data

2014-05-05 Thread H Hartley Sweeten
This member of the subdevice private data can be determined from the
cmd->stop_src. Do that instead.

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

diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c 
b/drivers/staging/comedi/drivers/amplc_dio200_common.c
index ee18537..5125bf0 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
@@ -130,7 +130,6 @@ struct dio200_subdev_intr {
unsigned int enabled_isns;
unsigned int stopcount;
bool active:1;
-   bool continuous:1;
 };
 
 static inline const struct dio200_layout *
@@ -259,7 +258,7 @@ static int dio200_start_intr(struct comedi_device *dev,
struct comedi_cmd *cmd = &s->async->cmd;
int retval = 0;
 
-   if (!subpriv->continuous && subpriv->stopcount == 0) {
+   if (cmd->stop_src == TRIG_COUNT && subpriv->stopcount == 0) {
/* An empty acquisition! */
s->async->events |= COMEDI_CB_EOA;
subpriv->active = false;
@@ -311,6 +310,7 @@ static void dio200_read_scan_intr(struct comedi_device *dev,
  unsigned int triggered)
 {
struct dio200_subdev_intr *subpriv = s->private;
+   struct comedi_cmd *cmd = &s->async->cmd;
unsigned short val;
unsigned int n, ch, len;
 
@@ -332,8 +332,7 @@ static void dio200_read_scan_intr(struct comedi_device *dev,
}
 
/* Check for end of acquisition. */
-   if (!subpriv->continuous) {
-   /* stop_src == TRIG_COUNT */
+   if (cmd->stop_src == TRIG_COUNT) {
if (subpriv->stopcount > 0) {
subpriv->stopcount--;
if (subpriv->stopcount == 0) {
@@ -512,17 +511,10 @@ static int dio200_subdev_intr_cmd(struct comedi_device 
*dev,
subpriv->active = true;
 
/* Set up end of acquisition. */
-   switch (cmd->stop_src) {
-   case TRIG_COUNT:
-   subpriv->continuous = false;
+   if (cmd->stop_src == TRIG_COUNT)
subpriv->stopcount = cmd->stop_arg;
-   break;
-   default:
-   /* TRIG_NONE */
-   subpriv->continuous = true;
+   else/* TRIG_NONE */
subpriv->stopcount = 0;
-   break;
-   }
 
if (cmd->start_src == TRIG_INT)
s->async->inttrig = dio200_inttrig_start_intr;
-- 
1.9.2

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


[PATCH 2/4] staging: comedi: adl_pc19111: rename 'async_cmd' variable in (*do_cmd)

2014-05-05 Thread H Hartley Sweeten
The comedi_cmd pointer is typically just called 'cmd'. Rename the local
variable in pci9111_ai_do_cmd().

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c 
b/drivers/staging/comedi/drivers/adl_pci9111.c
index 430b51a..7596b4e 100644
--- a/drivers/staging/comedi/drivers/adl_pci9111.c
+++ b/drivers/staging/comedi/drivers/adl_pci9111.c
@@ -458,18 +458,18 @@ static int pci9111_ai_do_cmd(struct comedi_device *dev,
 struct comedi_subdevice *s)
 {
struct pci9111_private_data *dev_private = dev->private;
-   struct comedi_cmd *async_cmd = &s->async->cmd;
+   struct comedi_cmd *cmd = &s->async->cmd;
 
/*  Set channel scan limit */
/*  PCI9111 allows only scanning from channel 0 to channel n */
/*  TODO: handle the case of an external multiplexer */
 
-   if (async_cmd->chanlist_len > 1) {
-   outb(async_cmd->chanlist_len - 1,
+   if (cmd->chanlist_len > 1) {
+   outb(cmd->chanlist_len - 1,
dev->iobase + PCI9111_AI_CHANNEL_REG);
pci9111_autoscan_set(dev, true);
} else {
-   outb(CR_CHAN(async_cmd->chanlist[0]),
+   outb(CR_CHAN(cmd->chanlist[0]),
dev->iobase + PCI9111_AI_CHANNEL_REG);
pci9111_autoscan_set(dev, false);
}
@@ -477,20 +477,18 @@ static int pci9111_ai_do_cmd(struct comedi_device *dev,
/*  Set gain */
/*  This is the same gain on every channel */
 
-   outb(CR_RANGE(async_cmd->chanlist[0]) & PCI9111_AI_RANGE_MASK,
+   outb(CR_RANGE(cmd->chanlist[0]) & PCI9111_AI_RANGE_MASK,
dev->iobase + PCI9111_AI_RANGE_STAT_REG);
 
/* Set counter */
-   if (async_cmd->stop_src == TRIG_COUNT) {
-   dev_private->stop_counter =
-   async_cmd->stop_arg * async_cmd->chanlist_len;
-   } else {/* TRIG_NONE */
+   if (cmd->stop_src == TRIG_COUNT)
+   dev_private->stop_counter = cmd->stop_arg * cmd->chanlist_len;
+   else/* TRIG_NONE */
dev_private->stop_counter = 0;
-   }
 
/*  Set timer pacer */
dev_private->scan_delay = 0;
-   if (async_cmd->convert_src == TRIG_TIMER) {
+   if (cmd->convert_src == TRIG_TIMER) {
pci9111_trigger_source_set(dev, software);
pci9111_timer_set(dev);
pci9111_fifo_reset(dev);
@@ -500,11 +498,9 @@ static int pci9111_ai_do_cmd(struct comedi_device *dev,
plx9050_interrupt_control(dev_private->lcr_io_base, true, true,
  false, true, true);
 
-   if (async_cmd->scan_begin_src == TRIG_TIMER) {
-   dev_private->scan_delay =
-   (async_cmd->scan_begin_arg /
-(async_cmd->convert_arg *
- async_cmd->chanlist_len)) - 1;
+   if (cmd->scan_begin_src == TRIG_TIMER) {
+   dev_private->scan_delay = (cmd->scan_begin_arg /
+   (cmd->convert_arg * cmd->chanlist_len)) - 1;
}
} else {/* TRIG_EXT */
pci9111_trigger_source_set(dev, external);
@@ -517,7 +513,7 @@ static int pci9111_ai_do_cmd(struct comedi_device *dev,
}
 
dev_private->stop_counter *= (1 + dev_private->scan_delay);
-   dev_private->chanlist_len = async_cmd->chanlist_len;
+   dev_private->chanlist_len = cmd->chanlist_len;
dev_private->chunk_counter = 0;
dev_private->chunk_num_samples =
dev_private->chanlist_len * (1 + dev_private->scan_delay);
-- 
1.9.2

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


Re: [PATCH] [staging/silicom] Fixing missing blank line after declarations

2014-05-05 Thread Greg KH
On Mon, May 05, 2014 at 06:40:13PM +0200, Fernando Apesteguia wrote:
> Small fix to driver. If these patches are welcomed, more could come in the
> future.
> 
> Regards

> >From d8369cba0552c5ea5f4eadc750434e39785e042a Mon Sep 17 00:00:00 2001
> From: Fernando Apesteguia 
> Date: Mon, 5 May 2014 18:16:53 +0200
> Subject: [PATCH] [staging/silicom] Fixing missing blank line after
>  declarations
> 
> ---
>  drivers/staging/silicom/bpctl_mod.c |1 +
>  1 file changed, 1 insertion(+)

They would be welcome if they were in a format I could apply them in :)

See Documentation/SubmittingPatches for the details on how to do this
properly.

> 
> diff --git a/drivers/staging/silicom/bpctl_mod.c 
> b/drivers/staging/silicom/bpctl_mod.c
> index 7f3d884..8fb527b 100644
> --- a/drivers/staging/silicom/bpctl_mod.c
> +++ b/drivers/staging/silicom/bpctl_mod.c
> @@ -7450,6 +7450,7 @@ static int bypass_proc_remove_dev_sd(struct bpctl_dev 
> *pbp_device_block)
>  {
> 
>   struct bypass_pfs_sd *current_pfs = &pbp_device_block->bypass_pfs_set;
> +

Why not also delete the empty line above this statement?

thanks,

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


[PATCH 14/24] staging: comedi: ni_at_a2150: use comedi_fc helpers to validate timer arg

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger argument when the source is TRIG_TIMER.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons.

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

diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c 
b/drivers/staging/comedi/drivers/ni_at_a2150.c
index f8d6bfc..5bd19494 100644
--- a/drivers/staging/comedi/drivers/ni_at_a2150.c
+++ b/drivers/staging/comedi/drivers/ni_at_a2150.c
@@ -334,7 +334,7 @@ static int a2150_ai_cmdtest(struct comedi_device *dev,
 {
const struct a2150_board *thisboard = comedi_board(dev);
int err = 0;
-   int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -379,10 +379,9 @@ static int a2150_ai_cmdtest(struct comedi_device *dev,
/* step 4: fix up any arguments */
 
if (cmd->scan_begin_src == TRIG_TIMER) {
-   tmp = cmd->scan_begin_arg;
-   a2150_get_timing(dev, &cmd->scan_begin_arg, cmd->flags);
-   if (tmp != cmd->scan_begin_arg)
-   err++;
+   arg = cmd->scan_begin_arg;
+   a2150_get_timing(dev, &arg, cmd->flags);
+   err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
}
 
if (err)
-- 
1.9.2

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


[PATCH 08/24] staging: comedi: das16: use comedi_fc helpers to validate timer args

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger arguments when the source is TRIG_TIMER.

Tidy up the local varaibles in the function.

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

diff --git a/drivers/staging/comedi/drivers/das16.c 
b/drivers/staging/comedi/drivers/das16.c
index a18c6b6..f40d422 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -633,23 +633,23 @@ static int das16_cmd_test(struct comedi_device *dev, 
struct comedi_subdevice *s,
 {
const struct das16_board *board = comedi_board(dev);
struct das16_private_struct *devpriv = dev->private;
-   int err = 0, tmp;
-   int mask;
+   int err = 0;
+   unsigned int trig_mask;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
err |= cfc_check_trigger_src(&cmd->start_src, TRIG_NOW);
 
-   mask = TRIG_FOLLOW;
+   trig_mask = TRIG_FOLLOW;
if (devpriv->can_burst)
-   mask |= TRIG_TIMER | TRIG_EXT;
-   err |= cfc_check_trigger_src(&cmd->scan_begin_src, mask);
+   trig_mask |= TRIG_TIMER | TRIG_EXT;
+   err |= cfc_check_trigger_src(&cmd->scan_begin_src, trig_mask);
 
-   tmp = cmd->convert_src;
-   mask = TRIG_TIMER | TRIG_EXT;
+   trig_mask = TRIG_TIMER | TRIG_EXT;
if (devpriv->can_burst)
-   mask |= TRIG_NOW;
-   err |= cfc_check_trigger_src(&cmd->convert_src, mask);
+   trig_mask |= TRIG_NOW;
+   err |= cfc_check_trigger_src(&cmd->convert_src, trig_mask);
 
err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT);
err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE);
@@ -700,22 +700,20 @@ static int das16_cmd_test(struct comedi_device *dev, 
struct comedi_subdevice *s,
 
/*  step 4: fix up arguments */
if (cmd->scan_begin_src == TRIG_TIMER) {
-   unsigned int tmp = cmd->scan_begin_arg;
-   /*  set divisors, correct timing arguments */
+   arg = cmd->scan_begin_arg;
i8253_cascade_ns_to_timer(devpriv->clockbase,
  &devpriv->divisor1,
  &devpriv->divisor2,
- &cmd->scan_begin_arg, cmd->flags);
-   err += (tmp != cmd->scan_begin_arg);
+ &arg, cmd->flags);
+   err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
}
if (cmd->convert_src == TRIG_TIMER) {
-   unsigned int tmp = cmd->convert_arg;
-   /*  set divisors, correct timing arguments */
+   arg = cmd->convert_arg;
i8253_cascade_ns_to_timer(devpriv->clockbase,
  &devpriv->divisor1,
  &devpriv->divisor2,
- &cmd->convert_arg, cmd->flags);
-   err += (tmp != cmd->convert_arg);
+ &arg, cmd->flags);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
}
if (err)
return 4;
-- 
1.9.2

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


[PATCH 02/24] staging: comedi: adv_pci1710: use comedi_fc helpers to validate timer args

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper, cfc_check_trigger_arg_is(), to validate the
cmd->convert_arg for the convert_src TRIG_TIMER. Pass the local variable
to i8253_cascade_ns_to_timer() instead of the cmd argument. This value
is modified by that function to return the actual time (in nanoseconds)
that the timer will be programmed with based on the calculated divisors.
The cfc_check_trigger_arg_is() helper will then validate that the
cmd->convert_arg is that value and modify it if not.

The minimum validation is not needed. That was already handled in Step 3.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons..

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 0dc946e..a57e4d7 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -971,7 +971,7 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev,
const struct boardtype *this_board = comedi_board(dev);
struct pci1710_private *devpriv = dev->private;
int err = 0;
-   int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -1019,15 +1019,12 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev,
/* step 4: fix up any arguments */
 
if (cmd->convert_src == TRIG_TIMER) {
-   tmp = cmd->convert_arg;
+   arg = cmd->convert_arg;
i8253_cascade_ns_to_timer(I8254_OSC_BASE_10MHZ,
  &devpriv->next_divisor1,
  &devpriv->next_divisor2,
- &cmd->convert_arg, cmd->flags);
-   if (cmd->convert_arg < this_board->ai_ns_min)
-   cmd->convert_arg = this_board->ai_ns_min;
-   if (tmp != cmd->convert_arg)
-   err++;
+ &arg, cmd->flags);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
}
 
if (err)
-- 
1.9.2

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


[PATCH 05/24] staging: comedi: amplc_pci224: use comedi_fc helpers to validate timer args

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
scan_begin_arg when the scan_begin_src is TRIG_TIMER.

For aesthetics reasons, rename the local variable 'tmp' to 'arg'.

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

diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c 
b/drivers/staging/comedi/drivers/amplc_pci224.c
index c2b352c..ec65a34 100644
--- a/drivers/staging/comedi/drivers/amplc_pci224.c
+++ b/drivers/staging/comedi/drivers/amplc_pci224.c
@@ -719,7 +719,7 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct 
comedi_subdevice *s,
 {
struct pci224_private *devpriv = dev->private;
int err = 0;
-   unsigned int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -746,14 +746,14 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct 
comedi_subdevice *s,
 * There's only one external trigger signal (which makes these
 * tests easier).  Only one thing can use it.
 */
-   tmp = 0;
+   err = 0;
if (cmd->start_src & TRIG_EXT)
-   tmp++;
+   err++;
if (cmd->scan_begin_src & TRIG_EXT)
-   tmp++;
+   err++;
if (cmd->stop_src & TRIG_EXT)
-   tmp++;
-   if (tmp > 1)
+   err++;
+   if (err > 1)
err |= -EINVAL;
 
if (err)
@@ -761,6 +761,7 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct 
comedi_subdevice *s,
 
/* Step 3: check if arguments are trivially valid */
 
+   err = 0;
switch (cmd->start_src) {
case TRIG_INT:
err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0);
@@ -786,10 +787,10 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct 
comedi_subdevice *s,
err |= cfc_check_trigger_arg_max(&cmd->scan_begin_arg,
 MAX_SCAN_PERIOD);
 
-   tmp = cmd->chanlist_len * CONVERT_PERIOD;
-   if (tmp < MIN_SCAN_PERIOD)
-   tmp = MIN_SCAN_PERIOD;
-   err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, tmp);
+   arg = cmd->chanlist_len * CONVERT_PERIOD;
+   if (arg < MIN_SCAN_PERIOD)
+   arg = MIN_SCAN_PERIOD;
+   err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, arg);
break;
case TRIG_EXT:
/* Force to external trigger 0. */
@@ -840,15 +841,13 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct 
comedi_subdevice *s,
/* Step 4: fix up any arguments. */
 
if (cmd->scan_begin_src == TRIG_TIMER) {
-   tmp = cmd->scan_begin_arg;
+   arg = cmd->scan_begin_arg;
/* Use two timers. */
i8253_cascade_ns_to_timer(I8254_OSC_BASE_10MHZ,
  &devpriv->cached_div1,
  &devpriv->cached_div2,
- &cmd->scan_begin_arg,
- cmd->flags);
-   if (tmp != cmd->scan_begin_arg)
-   err++;
+ &arg, cmd->flags);
+   err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
}
 
if (err)
-- 
1.9.2

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


[PATCH 12/24] staging: comedi: dt2814: use comedi_fc helpers to validate timer arg

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger argument when the source is TRIG_TIMER.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons.

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

diff --git a/drivers/staging/comedi/drivers/dt2814.c 
b/drivers/staging/comedi/drivers/dt2814.c
index 3794b7e..904c9f0 100644
--- a/drivers/staging/comedi/drivers/dt2814.c
+++ b/drivers/staging/comedi/drivers/dt2814.c
@@ -128,7 +128,7 @@ static int dt2814_ai_cmdtest(struct comedi_device *dev,
 struct comedi_subdevice *s, struct comedi_cmd *cmd)
 {
int err = 0;
-   int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -170,10 +170,9 @@ static int dt2814_ai_cmdtest(struct comedi_device *dev,
 
/* step 4: fix up any arguments */
 
-   tmp = cmd->scan_begin_arg;
-   dt2814_ns_to_timer(&cmd->scan_begin_arg, cmd->flags & TRIG_ROUND_MASK);
-   if (tmp != cmd->scan_begin_arg)
-   err++;
+   arg = cmd->scan_begin_arg;
+   dt2814_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+   err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
 
if (err)
return 4;
-- 
1.9.2

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


[PATCH 00/24] staging: comedi: cleanup timer arg validation

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helpers to validate the timer arguments.

H Hartley Sweeten (24):
  staging: comedi: adl_pci9111: use comedi_fc helpers to validate timer args
  staging: comedi: adv_pci1710: use comedi_fc helpers to validate timer args
  staging: comedi: dt3000: use comedi_fc helpers to validate timer args
  staging: comedi: adl_pci9118: use comedi_fc helpers to validate timer args
  staging: comedi: amplc_pci224: use comedi_fc helpers to validate timer args
  staging: comedi: cb_pcidas: use comedi_fc helpers to validate timer args
  staging: comedi: comedi_test: use comedi_fc helpers to validate timer args
  staging: comedi: das16: use comedi_fc helpers to validate timer args
  staging: comedi: das16m1: use comedi_fc helpers to validate timer args
  staging: comedi: das800: use comedi_fc helpers to validate timer args
  staging: comedi: dmm32at: use comedi_fc helpers to validate timer args
  staging: comedi: dt2814: use comedi_fc helpers to validate timer arg
  staging: comedi: dt282x: use comedi_fc helpers to validate timer args
  staging: comedi: ni_at_a2150: use comedi_fc helpers to validate timer arg
  staging: comedi: ni_pcidio: use comedi_fc helpers to validate timer arg
  staging: comedi: pcl711: use comedi_fc helpers to validate timer arg
  staging: comedi: pcl812: use comedi_fc helpers to validate timer arg
  staging: comedi: pcl816: use comedi_fc helpers to validate timer arg
  staging: comedi: pcl818: use comedi_fc helpers to validate timer arg
  staging: comedi: quatech_daqp_cs: use comedi_fc helpers to validate timer args
  staging: comedi: rtd520: use comedi_fc helpers to validate timer args
  staging: comedi: s626: use comedi_fc helpers to validate timer args
  staging: comedi: skel: use comedi_fc helpers to validate timer args
  staging: comedi: addi_apci_3xxx: use comedi_fc helpers to validate timer arg

 drivers/staging/comedi/drivers/addi_apci_3xxx.c  | 10 +++---
 drivers/staging/comedi/drivers/adl_pci9111.c | 10 ++
 drivers/staging/comedi/drivers/adl_pci9118.c | 45 
 drivers/staging/comedi/drivers/adv_pci1710.c | 11 +++---
 drivers/staging/comedi/drivers/amplc_pci224.c| 29 ---
 drivers/staging/comedi/drivers/cb_pcidas.c   | 25 ++---
 drivers/staging/comedi/drivers/comedi_test.c | 22 +---
 drivers/staging/comedi/drivers/das16.c   | 32 -
 drivers/staging/comedi/drivers/das16m1.c | 11 +++---
 drivers/staging/comedi/drivers/das800.c  | 10 +++---
 drivers/staging/comedi/drivers/dmm32at.c | 29 +++
 drivers/staging/comedi/drivers/dt2814.c  |  9 +++--
 drivers/staging/comedi/drivers/dt282x.c  | 18 +-
 drivers/staging/comedi/drivers/dt3000.c  | 29 +++
 drivers/staging/comedi/drivers/ni_at_a2150.c |  9 +++--
 drivers/staging/comedi/drivers/ni_pcidio.c   | 10 +++---
 drivers/staging/comedi/drivers/pcl711.c  | 10 +++---
 drivers/staging/comedi/drivers/pcl812.c  | 11 +++---
 drivers/staging/comedi/drivers/pcl816.c  | 11 +++---
 drivers/staging/comedi/drivers/pcl818.c  | 11 +++---
 drivers/staging/comedi/drivers/quatech_daqp_cs.c | 18 --
 drivers/staging/comedi/drivers/rtd520.c  | 32 +++--
 drivers/staging/comedi/drivers/s626.c| 36 +--
 drivers/staging/comedi/drivers/skel.c| 29 +++
 24 files changed, 192 insertions(+), 275 deletions(-)

-- 
1.9.2

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


[PATCH 19/24] staging: comedi: pcl818: use comedi_fc helpers to validate timer arg

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger argument when the source is TRIG_TIMER.

The minimum test is not needed, this was already validated in Step 3.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons.

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

diff --git a/drivers/staging/comedi/drivers/pcl818.c 
b/drivers/staging/comedi/drivers/pcl818.c
index 6463476..95f9bb6 100644
--- a/drivers/staging/comedi/drivers/pcl818.c
+++ b/drivers/staging/comedi/drivers/pcl818.c
@@ -741,7 +741,7 @@ static int ai_cmdtest(struct comedi_device *dev, struct 
comedi_subdevice *s,
const struct pcl818_board *board = comedi_board(dev);
struct pcl818_private *devpriv = dev->private;
int err = 0;
-   int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -788,15 +788,12 @@ static int ai_cmdtest(struct comedi_device *dev, struct 
comedi_subdevice *s,
/* step 4: fix up any arguments */
 
if (cmd->convert_src == TRIG_TIMER) {
-   tmp = cmd->convert_arg;
+   arg = cmd->convert_arg;
i8253_cascade_ns_to_timer(devpriv->i8253_osc_base,
  &devpriv->divisor1,
  &devpriv->divisor2,
- &cmd->convert_arg, cmd->flags);
-   if (cmd->convert_arg < board->ns_min)
-   cmd->convert_arg = board->ns_min;
-   if (tmp != cmd->convert_arg)
-   err++;
+ &arg, cmd->flags);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
}
 
if (err)
-- 
1.9.2

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


[PATCH 04/24] staging: comedi: adl_pci9118: use comedi_fc helpers to validate timer args

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper, cfc_check_trigger_arg_is(), to validate the
arguments for the TRIG_TIMER command sources. Pass the local variable to
i8253_cascade_ns_to_timer() instead of the cmd argument. This value
is modified by that function to return the actual time (in nanoseconds)
that the timer will be programmed with based on the calculated divisors.
The cfc_check_trigger_arg_is() helper will then validate that the argument
is that value and modify it if not.

Use cfc_check_trigger_arg_min() to do validate the cmd->scan_begin_arg
when the scan_begin_src is TRIG_TIMER and the convert_src is TRIG_NOW.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 89ed2d6..59a65cb 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -1120,7 +1120,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev,
struct pci9118_private *devpriv = dev->private;
int err = 0;
unsigned int flags;
-   int tmp;
+   unsigned int arg;
unsigned int divisor1 = 0, divisor2 = 0;
 
/* Step 1 : check if triggers are trivially valid */
@@ -1237,45 +1237,30 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev,
/* step 4: fix up any arguments */
 
if (cmd->scan_begin_src == TRIG_TIMER) {
-   tmp = cmd->scan_begin_arg;
+   arg = cmd->scan_begin_arg;
i8253_cascade_ns_to_timer(I8254_OSC_BASE_4MHZ,
  &divisor1, &divisor2,
- &cmd->scan_begin_arg, cmd->flags);
-   if (cmd->scan_begin_arg < this_board->ai_ns_min)
-   cmd->scan_begin_arg = this_board->ai_ns_min;
-   if (tmp != cmd->scan_begin_arg)
-   err++;
+ &arg, cmd->flags);
+   err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
}
 
if (cmd->convert_src & (TRIG_TIMER | TRIG_NOW)) {
-   tmp = cmd->convert_arg;
+   arg = cmd->convert_arg;
i8253_cascade_ns_to_timer(I8254_OSC_BASE_4MHZ,
  &divisor1, &divisor2,
- &cmd->convert_arg, cmd->flags);
-   if (cmd->convert_arg < this_board->ai_ns_min)
-   cmd->convert_arg = this_board->ai_ns_min;
-   if (tmp != cmd->convert_arg)
-   err++;
-   if (cmd->scan_begin_src == TRIG_TIMER
-   && cmd->convert_src == TRIG_NOW) {
+ &arg, cmd->flags);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
+
+   if (cmd->scan_begin_src == TRIG_TIMER &&
+   cmd->convert_src == TRIG_NOW) {
if (cmd->convert_arg == 0) {
-   if (cmd->scan_begin_arg <
-   this_board->ai_ns_min *
-   (cmd->scan_end_arg + 2)) {
-   cmd->scan_begin_arg =
-   this_board->ai_ns_min *
-   (cmd->scan_end_arg + 2);
-   err++;
-   }
+   arg = this_board->ai_ns_min *
+ (cmd->scan_end_arg + 2);
} else {
-   if (cmd->scan_begin_arg <
-   cmd->convert_arg * cmd->chanlist_len) {
-   cmd->scan_begin_arg =
-   cmd->convert_arg *
-   cmd->chanlist_len;
-   err++;
-   }
+   arg = cmd->convert_arg * cmd->chanlist_len;
}
+   err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg,
+arg);
}
}
 
-- 
1.9.2

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


[PATCH 13/24] staging: comedi: dt282x: use comedi_fc helpers to validate timer args

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger arguments when the source is TRIG_TIMER.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons.

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

diff --git a/drivers/staging/comedi/drivers/dt282x.c 
b/drivers/staging/comedi/drivers/dt282x.c
index 474f52d..f1a73b3 100644
--- a/drivers/staging/comedi/drivers/dt282x.c
+++ b/drivers/staging/comedi/drivers/dt282x.c
@@ -578,7 +578,7 @@ static int dt282x_ai_cmdtest(struct comedi_device *dev,
 {
const struct dt282x_board *board = comedi_board(dev);
int err = 0;
-   int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -633,10 +633,9 @@ static int dt282x_ai_cmdtest(struct comedi_device *dev,
 
/* step 4: fix up any arguments */
 
-   tmp = cmd->convert_arg;
-   dt282x_ns_to_timer(&cmd->convert_arg, cmd->flags & TRIG_ROUND_MASK);
-   if (tmp != cmd->convert_arg)
-   err++;
+   arg = cmd->convert_arg;
+   dt282x_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
 
if (err)
return 4;
@@ -825,7 +824,7 @@ static int dt282x_ao_cmdtest(struct comedi_device *dev,
 struct comedi_subdevice *s, struct comedi_cmd *cmd)
 {
int err = 0;
-   int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -865,10 +864,9 @@ static int dt282x_ao_cmdtest(struct comedi_device *dev,
 
/* step 4: fix up any arguments */
 
-   tmp = cmd->scan_begin_arg;
-   dt282x_ns_to_timer(&cmd->scan_begin_arg, cmd->flags & TRIG_ROUND_MASK);
-   if (tmp != cmd->scan_begin_arg)
-   err++;
+   arg = cmd->scan_begin_arg;
+   dt282x_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+   err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
 
if (err)
return 4;
-- 
1.9.2

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


[PATCH 22/24] staging: comedi: s626: use comedi_fc helpers to validate timer args

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger arguments when the source is TRIG_TIMER.

Use cfc_check_trigger_arg_min() to vaidate the scan_begin_arg when the
scan_begin_src and convert_src are both TRIG_TIMER.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons.

Change the type of the first parameter to s626_ns_to_timer() to remove
the need for the casts.

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

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index 647b9e5..b3d8bca 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -2099,7 +2099,7 @@ static int s626_ai_inttrig(struct comedi_device *dev,
  * Also, it should adjust ns so that it cooresponds to the actual time
  * that the device will use.
  */
-static int s626_ns_to_timer(int *nanosec, int round_mode)
+static int s626_ns_to_timer(unsigned int *nanosec, int round_mode)
 {
int divider, base;
 
@@ -2207,7 +2207,7 @@ static int s626_ai_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
 * interval
 */
k = &s626_enc_chan_info[5];
-   tick = s626_ns_to_timer((int *)&cmd->scan_begin_arg,
+   tick = s626_ns_to_timer(&cmd->scan_begin_arg,
cmd->flags & TRIG_ROUND_MASK);
 
/* load timer value and enable interrupt */
@@ -2230,7 +2230,7 @@ static int s626_ai_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
 * interval
 */
k = &s626_enc_chan_info[4];
-   tick = s626_ns_to_timer((int *)&cmd->convert_arg,
+   tick = s626_ns_to_timer(&cmd->convert_arg,
cmd->flags & TRIG_ROUND_MASK);
 
/* load timer value and enable interrupt */
@@ -2289,7 +2289,7 @@ static int s626_ai_cmdtest(struct comedi_device *dev,
   struct comedi_subdevice *s, struct comedi_cmd *cmd)
 {
int err = 0;
-   int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -2372,24 +2372,20 @@ static int s626_ai_cmdtest(struct comedi_device *dev,
/* step 4: fix up any arguments */
 
if (cmd->scan_begin_src == TRIG_TIMER) {
-   tmp = cmd->scan_begin_arg;
-   s626_ns_to_timer((int *)&cmd->scan_begin_arg,
-cmd->flags & TRIG_ROUND_MASK);
-   if (tmp != cmd->scan_begin_arg)
-   err++;
+   arg = cmd->scan_begin_arg;
+   s626_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+   err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
}
+
if (cmd->convert_src == TRIG_TIMER) {
-   tmp = cmd->convert_arg;
-   s626_ns_to_timer((int *)&cmd->convert_arg,
-cmd->flags & TRIG_ROUND_MASK);
-   if (tmp != cmd->convert_arg)
-   err++;
-   if (cmd->scan_begin_src == TRIG_TIMER &&
-   cmd->scan_begin_arg < cmd->convert_arg *
- cmd->scan_end_arg) {
-   cmd->scan_begin_arg = cmd->convert_arg *
- cmd->scan_end_arg;
-   err++;
+   arg = cmd->convert_arg;
+   s626_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
+
+   if (cmd->scan_begin_src == TRIG_TIMER) {
+   arg = cmd->convert_arg * cmd->scan_end_arg;
+   err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg,
+arg);
}
}
 
-- 
1.9.2

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


[PATCH 01/24] staging: comedi: adl_pci9111: use comedi_fc helpers to validate timer args

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper, cfc_check_trigger_arg_is(), to validate
the cmd->convert_arg for the convert_src TRIG_TIMER. Pass the local
variable to i8253_cascade_ns_to_timer() instead of the cmd argument.
This value is modified by that function to return the actual time
(in nanoseconds) that the timer will be programmed with based on the
calculated divisors. The cfc_check_trigger_arg_is() helper will then
validate that the cmd->convert_arg is that value and modify it if not.

Also use cfc_check_trigger_arg_is() to validate that the
cmd->scan_begin_arg is the calculate value and modify it if not.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c 
b/drivers/staging/comedi/drivers/adl_pci9111.c
index c84930c..bb1d56e 100644
--- a/drivers/staging/comedi/drivers/adl_pci9111.c
+++ b/drivers/staging/comedi/drivers/adl_pci9111.c
@@ -418,9 +418,8 @@ static int pci9111_ai_do_cmd_test(struct comedi_device *dev,
i8253_cascade_ns_to_timer(I8254_OSC_BASE_2MHZ,
  &dev_private->div1,
  &dev_private->div2,
- &cmd->convert_arg, cmd->flags);
-   if (cmd->convert_arg != arg)
-   err |= -EINVAL;
+ &arg, cmd->flags);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
}
 
/*
@@ -433,10 +432,7 @@ static int pci9111_ai_do_cmd_test(struct comedi_device 
*dev,
if (arg < cmd->scan_begin_arg)
arg *= (cmd->scan_begin_arg / arg);
 
-   if (cmd->scan_begin_arg != arg) {
-   cmd->scan_begin_arg = arg;
-   err |= -EINVAL;
-   }
+   err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
}
 
if (err)
-- 
1.9.2

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


[PATCH 11/24] staging: comedi: dmm32at: use comedi_fc helpers to validate timer args

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger arguments when the source is TRIG_TIMER.

Use cfc_check_trigger_arg_min() to vaidate the scan_begin_arg when the
scan_begin_src and convert_src are both TRIG_TIMER.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons.

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

diff --git a/drivers/staging/comedi/drivers/dmm32at.c 
b/drivers/staging/comedi/drivers/dmm32at.c
index 68260e6..b50c0d2 100644
--- a/drivers/staging/comedi/drivers/dmm32at.c
+++ b/drivers/staging/comedi/drivers/dmm32at.c
@@ -275,7 +275,7 @@ static int dmm32at_ai_cmdtest(struct comedi_device *dev,
  struct comedi_cmd *cmd)
 {
int err = 0;
-   int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -351,24 +351,19 @@ static int dmm32at_ai_cmdtest(struct comedi_device *dev,
/* step 4: fix up any arguments */
 
if (cmd->scan_begin_src == TRIG_TIMER) {
-   tmp = cmd->scan_begin_arg;
-   dmm32at_ns_to_timer(&cmd->scan_begin_arg,
-   cmd->flags & TRIG_ROUND_MASK);
-   if (tmp != cmd->scan_begin_arg)
-   err++;
+   arg = cmd->scan_begin_arg;
+   dmm32at_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+   err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
}
if (cmd->convert_src == TRIG_TIMER) {
-   tmp = cmd->convert_arg;
-   dmm32at_ns_to_timer(&cmd->convert_arg,
-   cmd->flags & TRIG_ROUND_MASK);
-   if (tmp != cmd->convert_arg)
-   err++;
-   if (cmd->scan_begin_src == TRIG_TIMER &&
-   cmd->scan_begin_arg <
-   cmd->convert_arg * cmd->scan_end_arg) {
-   cmd->scan_begin_arg =
-   cmd->convert_arg * cmd->scan_end_arg;
-   err++;
+   arg = cmd->convert_arg;
+   dmm32at_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
+
+   if (cmd->scan_begin_src == TRIG_TIMER) {
+   arg = cmd->convert_arg * cmd->scan_end_arg;
+   err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg,
+arg);
}
}
 
-- 
1.9.2

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


[PATCH 17/24] staging: comedi: pcl812: use comedi_fc helpers to validate timer arg

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger argument when the source is TRIG_TIMER.

The minimum test is not needed, this was already validated in Step 3.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons.

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

diff --git a/drivers/staging/comedi/drivers/pcl812.c 
b/drivers/staging/comedi/drivers/pcl812.c
index 0cf115e..06a27cc 100644
--- a/drivers/staging/comedi/drivers/pcl812.c
+++ b/drivers/staging/comedi/drivers/pcl812.c
@@ -721,7 +721,7 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev,
struct pcl812_private *devpriv = dev->private;
int err = 0;
unsigned int flags;
-   int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -774,15 +774,12 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev,
/* step 4: fix up any arguments */
 
if (cmd->convert_src == TRIG_TIMER) {
-   tmp = cmd->convert_arg;
+   arg = cmd->convert_arg;
i8253_cascade_ns_to_timer(I8254_OSC_BASE_2MHZ,
  &devpriv->divisor1,
  &devpriv->divisor2,
- &cmd->convert_arg, cmd->flags);
-   if (cmd->convert_arg < board->ai_ns_min)
-   cmd->convert_arg = board->ai_ns_min;
-   if (tmp != cmd->convert_arg)
-   err++;
+ &arg, cmd->flags);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
}
 
if (err)
-- 
1.9.2

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


[PATCH 16/24] staging: comedi: pcl711: use comedi_fc helpers to validate timer arg

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger argument when the source is TRIG_TIMER.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons.

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

diff --git a/drivers/staging/comedi/drivers/pcl711.c 
b/drivers/staging/comedi/drivers/pcl711.c
index 2da6fec..5d25363 100644
--- a/drivers/staging/comedi/drivers/pcl711.c
+++ b/drivers/staging/comedi/drivers/pcl711.c
@@ -295,8 +295,8 @@ static int pcl711_ai_cmdtest(struct comedi_device *dev,
 struct comedi_subdevice *s, struct comedi_cmd *cmd)
 {
struct pcl711_private *devpriv = dev->private;
-   int tmp;
int err = 0;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -344,14 +344,12 @@ static int pcl711_ai_cmdtest(struct comedi_device *dev,
/* step 4 */
 
if (cmd->scan_begin_src == TRIG_TIMER) {
-   tmp = cmd->scan_begin_arg;
+   arg = cmd->scan_begin_arg;
i8253_cascade_ns_to_timer(I8254_OSC_BASE_2MHZ,
  &devpriv->divisor1,
  &devpriv->divisor2,
- &cmd->scan_begin_arg,
- cmd->flags);
-   if (tmp != cmd->scan_begin_arg)
-   err++;
+ &arg, cmd->flags);
+   err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
}
 
if (err)
-- 
1.9.2

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


[PATCH 18/24] staging: comedi: pcl816: use comedi_fc helpers to validate timer arg

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger argument when the source is TRIG_TIMER.

The minimum test is not needed, this was already validated in Step 3.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons.

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

diff --git a/drivers/staging/comedi/drivers/pcl816.c 
b/drivers/staging/comedi/drivers/pcl816.c
index 6f276f2..0dd5145 100644
--- a/drivers/staging/comedi/drivers/pcl816.c
+++ b/drivers/staging/comedi/drivers/pcl816.c
@@ -370,7 +370,7 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev,
 {
struct pcl816_private *devpriv = dev->private;
int err = 0;
-   int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -417,15 +417,12 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev,
 
/* step 4: fix up any arguments */
if (cmd->convert_src == TRIG_TIMER) {
-   tmp = cmd->convert_arg;
+   arg = cmd->convert_arg;
i8253_cascade_ns_to_timer(I8254_OSC_BASE_10MHZ,
  &devpriv->divisor1,
  &devpriv->divisor2,
- &cmd->convert_arg, cmd->flags);
-   if (cmd->convert_arg < 1)
-   cmd->convert_arg = 1;
-   if (tmp != cmd->convert_arg)
-   err++;
+ &arg, cmd->flags);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
}
 
if (err)
-- 
1.9.2

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


[PATCH 03/24] staging: comedi: dt3000: use comedi_fc helpers to validate timer args

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper, cfc_check_trigger_arg_is(), to validate the
cmd->scan_begin_arg for the scan_begin_src TRIG_TIMER. Pass the local
variable to dt2k_ns_to_timer() instead of the cmd argument. This value
is modified by that function to return the actual time (in nanoseconds)
that the timer will be programmed with based on the calculated divisor.
The cfc_check_trigger_arg_is() helper will then validate that the
cmd->cscan_begin_arg is that value and modify it if not.

Also use cfc_check_trigger_arg_is() to validate the cmd->convert_arg
using the same logic.

Use cfc_check_trigger_arg_min() to do validate the cmd->scan_begin_arg
when the convert_src and scan_begin_src are both TRIG_TIMER.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons.

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

diff --git a/drivers/staging/comedi/drivers/dt3000.c 
b/drivers/staging/comedi/drivers/dt3000.c
index 436e451..b8390a0 100644
--- a/drivers/staging/comedi/drivers/dt3000.c
+++ b/drivers/staging/comedi/drivers/dt3000.c
@@ -416,7 +416,7 @@ static int dt3k_ai_cmdtest(struct comedi_device *dev,
 {
const struct dt3k_boardtype *this_board = comedi_board(dev);
int err = 0;
-   int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -466,25 +466,20 @@ static int dt3k_ai_cmdtest(struct comedi_device *dev,
/* step 4: fix up any arguments */
 
if (cmd->scan_begin_src == TRIG_TIMER) {
-   tmp = cmd->scan_begin_arg;
-   dt3k_ns_to_timer(100, &cmd->scan_begin_arg,
-cmd->flags & TRIG_ROUND_MASK);
-   if (tmp != cmd->scan_begin_arg)
-   err++;
+   arg = cmd->scan_begin_arg;
+   dt3k_ns_to_timer(100, &arg, cmd->flags & TRIG_ROUND_MASK);
+   err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
}
 
if (cmd->convert_src == TRIG_TIMER) {
-   tmp = cmd->convert_arg;
-   dt3k_ns_to_timer(50, &cmd->convert_arg,
-cmd->flags & TRIG_ROUND_MASK);
-   if (tmp != cmd->convert_arg)
-   err++;
-   if (cmd->scan_begin_src == TRIG_TIMER &&
-   cmd->scan_begin_arg <
-   cmd->convert_arg * cmd->scan_end_arg) {
-   cmd->scan_begin_arg =
-   cmd->convert_arg * cmd->scan_end_arg;
-   err++;
+   arg = cmd->convert_arg;
+   dt3k_ns_to_timer(50, &arg, cmd->flags & TRIG_ROUND_MASK);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
+
+   if (cmd->scan_begin_src == TRIG_TIMER) {
+   arg = cmd->convert_arg * cmd->scan_end_arg;
+   err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg,
+arg);
}
}
 
-- 
1.9.2

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


[PATCH 21/24] staging: comedi: rtd520: use comedi_fc helpers to validate timer args

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger arguments when the source is TRIG_TIMER.

Use cfc_check_trigger_arg_min() to vaidate the scan_begin_arg when the
scan_begin_src and convert_src are both TRIG_TIMER.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons.

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

diff --git a/drivers/staging/comedi/drivers/rtd520.c 
b/drivers/staging/comedi/drivers/rtd520.c
index e7c2e34..5696bb3 100644
--- a/drivers/staging/comedi/drivers/rtd520.c
+++ b/drivers/staging/comedi/drivers/rtd520.c
@@ -779,7 +779,7 @@ static int rtd_ai_cmdtest(struct comedi_device *dev,
  struct comedi_subdevice *s, struct comedi_cmd *cmd)
 {
int err = 0;
-   int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -894,26 +894,20 @@ static int rtd_ai_cmdtest(struct comedi_device *dev,
/* step 4: fix up any arguments */
 
if (cmd->scan_begin_src == TRIG_TIMER) {
-   tmp = cmd->scan_begin_arg;
-   rtd_ns_to_timer(&cmd->scan_begin_arg,
-   cmd->flags & TRIG_ROUND_MASK);
-   if (tmp != cmd->scan_begin_arg)
-   err++;
-
+   arg = cmd->scan_begin_arg;
+   rtd_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+   err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
}
+
if (cmd->convert_src == TRIG_TIMER) {
-   tmp = cmd->convert_arg;
-   rtd_ns_to_timer(&cmd->convert_arg,
-   cmd->flags & TRIG_ROUND_MASK);
-   if (tmp != cmd->convert_arg)
-   err++;
-
-   if (cmd->scan_begin_src == TRIG_TIMER
-   && (cmd->scan_begin_arg
-   < (cmd->convert_arg * cmd->scan_end_arg))) {
-   cmd->scan_begin_arg =
-   cmd->convert_arg * cmd->scan_end_arg;
-   err++;
+   arg = cmd->convert_arg;
+   rtd_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
+
+   if (cmd->scan_begin_src == TRIG_TIMER) {
+   arg = cmd->convert_arg * cmd->scan_end_arg;
+   err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg,
+arg);
}
}
 
-- 
1.9.2

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


[PATCH 23/24] staging: comedi: skel: use comedi_fc helpers to validate timer args

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger arguments when the source is TRIG_TIMER.

Use cfc_check_trigger_arg_min() to vaidate the scan_begin_arg when the
scan_begin_src and convert_src are both TRIG_TIMER.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons.

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

diff --git a/drivers/staging/comedi/drivers/skel.c 
b/drivers/staging/comedi/drivers/skel.c
index 39008cf..3bfa221 100644
--- a/drivers/staging/comedi/drivers/skel.c
+++ b/drivers/staging/comedi/drivers/skel.c
@@ -220,7 +220,7 @@ static int skel_ai_cmdtest(struct comedi_device *dev,
   struct comedi_cmd *cmd)
 {
int err = 0;
-   int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -286,24 +286,19 @@ static int skel_ai_cmdtest(struct comedi_device *dev,
/* step 4: fix up any arguments */
 
if (cmd->scan_begin_src == TRIG_TIMER) {
-   tmp = cmd->scan_begin_arg;
-   skel_ns_to_timer(&cmd->scan_begin_arg,
-cmd->flags & TRIG_ROUND_MASK);
-   if (tmp != cmd->scan_begin_arg)
-   err++;
+   arg = cmd->scan_begin_arg;
+   skel_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+   err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
}
if (cmd->convert_src == TRIG_TIMER) {
-   tmp = cmd->convert_arg;
-   skel_ns_to_timer(&cmd->convert_arg,
-cmd->flags & TRIG_ROUND_MASK);
-   if (tmp != cmd->convert_arg)
-   err++;
-   if (cmd->scan_begin_src == TRIG_TIMER &&
-   cmd->scan_begin_arg <
-   cmd->convert_arg * cmd->scan_end_arg) {
-   cmd->scan_begin_arg =
-   cmd->convert_arg * cmd->scan_end_arg;
-   err++;
+   arg = cmd->convert_arg;
+   skel_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
+
+   if (cmd->scan_begin_src == TRIG_TIMER) {
+   arg = cmd->convert_arg * cmd->scan_end_arg;
+   err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg,
+arg);
}
}
 
-- 
1.9.2

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


[PATCH 24/24] staging: comedi: addi_apci_3xxx: use comedi_fc helpers to validate timer arg

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger argument when the source is TRIG_TIMER.

For aesthetics, rename the local variable 'tmp' to 'arg'.

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

diff --git a/drivers/staging/comedi/drivers/addi_apci_3xxx.c 
b/drivers/staging/comedi/drivers/addi_apci_3xxx.c
index f290be8..48e40e3 100644
--- a/drivers/staging/comedi/drivers/addi_apci_3xxx.c
+++ b/drivers/staging/comedi/drivers/addi_apci_3xxx.c
@@ -533,7 +533,7 @@ static int apci3xxx_ai_cmdtest(struct comedi_device *dev,
 {
const struct apci3xxx_boardinfo *board = comedi_board(dev);
int err = 0;
-   unsigned int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -573,11 +573,9 @@ static int apci3xxx_ai_cmdtest(struct comedi_device *dev,
 
/* step 4: fix up any arguments */
 
-   tmp = cmd->convert_arg;
-   err |= apci3xxx_ai_ns_to_timer(dev, &cmd->convert_arg,
-  cmd->flags & TRIG_ROUND_MASK);
-   if (tmp != cmd->convert_arg)
-   err |= -EINVAL;
+   arg = cmd->convert_arg;
+   err |= apci3xxx_ai_ns_to_timer(dev, &arg, cmd->flags & TRIG_ROUND_MASK);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
 
if (err)
return 4;
-- 
1.9.2

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


[PATCH 10/24] staging: comedi: das800: use comedi_fc helpers to validate timer args

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger arguments when the source is TRIG_TIMER.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons.

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

diff --git a/drivers/staging/comedi/drivers/das800.c 
b/drivers/staging/comedi/drivers/das800.c
index 615ae3f..38f6a6d 100644
--- a/drivers/staging/comedi/drivers/das800.c
+++ b/drivers/staging/comedi/drivers/das800.c
@@ -331,6 +331,7 @@ static int das800_ai_do_cmdtest(struct comedi_device *dev,
const struct das800_board *thisboard = comedi_board(dev);
struct das800_private *devpriv = dev->private;
int err = 0;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -376,15 +377,12 @@ static int das800_ai_do_cmdtest(struct comedi_device *dev,
/* step 4: fix up any arguments */
 
if (cmd->convert_src == TRIG_TIMER) {
-   int tmp = cmd->convert_arg;
-
-   /* calculate counter values that give desired timing */
+   arg = cmd->convert_arg;
i8253_cascade_ns_to_timer(I8254_OSC_BASE_1MHZ,
  &devpriv->divisor1,
  &devpriv->divisor2,
- &cmd->convert_arg, cmd->flags);
-   if (tmp != cmd->convert_arg)
-   err++;
+ &arg, cmd->flags);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
}
 
if (err)
-- 
1.9.2

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


[PATCH 20/24] staging: comedi: quatech_daqp_cs: use comedi_fc helpers to validate timer args

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger arguments when the source is TRIG_TIMER.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons.

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

diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c 
b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
index 298dba0..0196db3 100644
--- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c
+++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
@@ -373,7 +373,7 @@ static int daqp_ai_cmdtest(struct comedi_device *dev,
   struct comedi_subdevice *s, struct comedi_cmd *cmd)
 {
int err = 0;
-   int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -435,19 +435,15 @@ static int daqp_ai_cmdtest(struct comedi_device *dev,
/* step 4: fix up any arguments */
 
if (cmd->scan_begin_src == TRIG_TIMER) {
-   tmp = cmd->scan_begin_arg;
-   daqp_ns_to_timer(&cmd->scan_begin_arg,
-cmd->flags & TRIG_ROUND_MASK);
-   if (tmp != cmd->scan_begin_arg)
-   err++;
+   arg = cmd->scan_begin_arg;
+   daqp_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+   err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
}
 
if (cmd->convert_src == TRIG_TIMER) {
-   tmp = cmd->convert_arg;
-   daqp_ns_to_timer(&cmd->convert_arg,
-cmd->flags & TRIG_ROUND_MASK);
-   if (tmp != cmd->convert_arg)
-   err++;
+   arg = cmd->convert_arg;
+   daqp_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
}
 
if (err)
-- 
1.9.2

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


[PATCH 15/24] staging: comedi: ni_pcidio: use comedi_fc helpers to validate timer arg

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger argument when the source is TRIG_TIMER.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons.

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

diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c 
b/drivers/staging/comedi/drivers/ni_pcidio.c
index 962c235..df0c942 100644
--- a/drivers/staging/comedi/drivers/ni_pcidio.c
+++ b/drivers/staging/comedi/drivers/ni_pcidio.c
@@ -536,7 +536,7 @@ static int ni_pcidio_cmdtest(struct comedi_device *dev,
 struct comedi_subdevice *s, struct comedi_cmd *cmd)
 {
int err = 0;
-   int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -595,11 +595,9 @@ static int ni_pcidio_cmdtest(struct comedi_device *dev,
/* step 4: fix up any arguments */
 
if (cmd->scan_begin_src == TRIG_TIMER) {
-   tmp = cmd->scan_begin_arg;
-   ni_pcidio_ns_to_timer(&cmd->scan_begin_arg,
- cmd->flags & TRIG_ROUND_MASK);
-   if (tmp != cmd->scan_begin_arg)
-   err++;
+   arg = cmd->scan_begin_arg;
+   ni_pcidio_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK);
+   err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
}
 
if (err)
-- 
1.9.2

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


[PATCH 06/24] staging: comedi: cb_pcidas: use comedi_fc helpers to validate timer args

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger arguments when the source is TRIG_TIMER.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons.

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

diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c 
b/drivers/staging/comedi/drivers/cb_pcidas.c
index 0df55dd..7b02959 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas.c
@@ -837,7 +837,7 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev,
const struct cb_pcidas_board *thisboard = comedi_board(dev);
struct cb_pcidas_private *devpriv = dev->private;
int err = 0;
-   int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -912,22 +912,20 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev,
/* step 4: fix up any arguments */
 
if (cmd->scan_begin_src == TRIG_TIMER) {
-   tmp = cmd->scan_begin_arg;
+   arg = cmd->scan_begin_arg;
i8253_cascade_ns_to_timer(I8254_OSC_BASE_10MHZ,
  &devpriv->divisor1,
  &devpriv->divisor2,
- &cmd->scan_begin_arg, cmd->flags);
-   if (tmp != cmd->scan_begin_arg)
-   err++;
+ &arg, cmd->flags);
+   err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
}
if (cmd->convert_src == TRIG_TIMER) {
-   tmp = cmd->convert_arg;
+   arg = cmd->convert_arg;
i8253_cascade_ns_to_timer(I8254_OSC_BASE_10MHZ,
  &devpriv->divisor1,
  &devpriv->divisor2,
- &cmd->convert_arg, cmd->flags);
-   if (tmp != cmd->convert_arg)
-   err++;
+ &arg, cmd->flags);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
}
 
if (err)
@@ -1064,7 +1062,7 @@ static int cb_pcidas_ao_cmdtest(struct comedi_device *dev,
const struct cb_pcidas_board *thisboard = comedi_board(dev);
struct cb_pcidas_private *devpriv = dev->private;
int err = 0;
-   int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -1107,13 +1105,12 @@ static int cb_pcidas_ao_cmdtest(struct comedi_device 
*dev,
/* step 4: fix up any arguments */
 
if (cmd->scan_begin_src == TRIG_TIMER) {
-   tmp = cmd->scan_begin_arg;
+   arg = cmd->scan_begin_arg;
i8253_cascade_ns_to_timer(I8254_OSC_BASE_10MHZ,
  &devpriv->ao_divisor1,
  &devpriv->ao_divisor2,
- &cmd->scan_begin_arg, cmd->flags);
-   if (tmp != cmd->scan_begin_arg)
-   err++;
+ &arg, cmd->flags);
+   err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
}
 
if (err)
-- 
1.9.2

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


Re: [PATCH] [staging/silicom] Fixing missing blank line after declarations

2014-05-05 Thread Fernando Apesteguia
On Mon, May 05, 2014 at 09:57:48AM -0700, Greg KH wrote:
> On Mon, May 05, 2014 at 06:40:13PM +0200, Fernando Apesteguia wrote:
> > Small fix to driver. If these patches are welcomed, more could come in the
> > future.
> > 
> > Regards
> 
> > >From d8369cba0552c5ea5f4eadc750434e39785e042a Mon Sep 17 00:00:00 2001
> > From: Fernando Apesteguia 
> > Date: Mon, 5 May 2014 18:16:53 +0200
> > Subject: [PATCH] [staging/silicom] Fixing missing blank line after
> >  declarations
> > 
> > ---
> >  drivers/staging/silicom/bpctl_mod.c |1 +
> >  1 file changed, 1 insertion(+)
> 
> They would be welcome if they were in a format I could apply them in :)
> 
> See Documentation/SubmittingPatches for the details on how to do this
> properly.

I think this one is good.

> 
> > 
> > diff --git a/drivers/staging/silicom/bpctl_mod.c 
> > b/drivers/staging/silicom/bpctl_mod.c
> > index 7f3d884..8fb527b 100644
> > --- a/drivers/staging/silicom/bpctl_mod.c
> > +++ b/drivers/staging/silicom/bpctl_mod.c
> > @@ -7450,6 +7450,7 @@ static int bypass_proc_remove_dev_sd(struct bpctl_dev 
> > *pbp_device_block)
> >  {
> > 
> > struct bypass_pfs_sd *current_pfs = &pbp_device_block->bypass_pfs_set;
> > +
> 
> Why not also delete the empty line above this statement?

Hehe, I just wanted to fix "one coding style problem". But this new patch also
fixes the first blank line.

> 
> thanks,
> 
> greg k-h
--- drivers/staging/silicom/bpctl_mod.c.orig	2014-05-05 18:58:49.654207305 +0200
+++ drivers/staging/silicom/bpctl_mod.c	2014-05-05 18:59:10.394206591 +0200
@@ -7448,8 +7448,8 @@ static int bypass_proc_create_dev_sd(str

 static int bypass_proc_remove_dev_sd(struct bpctl_dev *pbp_device_block)
 {
-
	struct bypass_pfs_sd *current_pfs = &pbp_device_block->bypass_pfs_set;
+
	remove_proc_subtree(current_pfs->dir_name, bp_procfs_dir);
	current_pfs->bypass_entry = NULL;
	return 0;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 09/24] staging: comedi: das16m1: use comedi_fc helpers to validate timer args

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger arguments when the source is TRIG_TIMER.

For aesthetics, rename the local variable 'tmp' to 'arg'.

Also, change the 'err' variable to the correct type.

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

diff --git a/drivers/staging/comedi/drivers/das16m1.c 
b/drivers/staging/comedi/drivers/das16m1.c
index c974449..ec039fb 100644
--- a/drivers/staging/comedi/drivers/das16m1.c
+++ b/drivers/staging/comedi/drivers/das16m1.c
@@ -182,7 +182,8 @@ static int das16m1_cmd_test(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_cmd *cmd)
 {
struct das16m1_private_struct *devpriv = dev->private;
-   unsigned int err = 0, tmp;
+   int err = 0;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -231,14 +232,12 @@ static int das16m1_cmd_test(struct comedi_device *dev,
/* step 4: fix up arguments */
 
if (cmd->convert_src == TRIG_TIMER) {
-   tmp = cmd->convert_arg;
-   /* calculate counter values that give desired timing */
+   arg = cmd->convert_arg;
i8253_cascade_ns_to_timer(I8254_OSC_BASE_10MHZ,
  &devpriv->divisor1,
  &devpriv->divisor2,
- &cmd->convert_arg, cmd->flags);
-   if (tmp != cmd->convert_arg)
-   err++;
+ &arg, cmd->flags);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
}
 
if (err)
-- 
1.9.2

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


[PATCH 07/24] staging: comedi: comedi_test: use comedi_fc helpers to validate timer args

2014-05-05 Thread H Hartley Sweeten
Use the comedi_fc helper cfc_check_trigger_arg_is() to validate the
trigger arguments when the source is TRIG_TIMER.

All the arguments are unsigned int, change the local variable to an
unsigned int and rename it for aesthetic reasons.

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

diff --git a/drivers/staging/comedi/drivers/comedi_test.c 
b/drivers/staging/comedi/drivers/comedi_test.c
index ad5014a..30d8204 100644
--- a/drivers/staging/comedi/drivers/comedi_test.c
+++ b/drivers/staging/comedi/drivers/comedi_test.c
@@ -224,7 +224,7 @@ static int waveform_ai_cmdtest(struct comedi_device *dev,
   struct comedi_cmd *cmd)
 {
int err = 0;
-   int tmp;
+   unsigned int arg;
 
/* Step 1 : check if triggers are trivially valid */
 
@@ -276,22 +276,18 @@ static int waveform_ai_cmdtest(struct comedi_device *dev,
/* step 4: fix up any arguments */
 
if (cmd->scan_begin_src == TRIG_TIMER) {
-   tmp = cmd->scan_begin_arg;
+   arg = cmd->scan_begin_arg;
/* round to nearest microsec */
-   cmd->scan_begin_arg =
-   nano_per_micro * ((tmp +
-  (nano_per_micro / 2)) / nano_per_micro);
-   if (tmp != cmd->scan_begin_arg)
-   err++;
+   arg = nano_per_micro *
+ ((arg + (nano_per_micro / 2)) / nano_per_micro);
+   err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg);
}
if (cmd->convert_src == TRIG_TIMER) {
-   tmp = cmd->convert_arg;
+   arg = cmd->convert_arg;
/* round to nearest microsec */
-   cmd->convert_arg =
-   nano_per_micro * ((tmp +
-  (nano_per_micro / 2)) / nano_per_micro);
-   if (tmp != cmd->convert_arg)
-   err++;
+   arg = nano_per_micro *
+ ((arg + (nano_per_micro / 2)) / nano_per_micro);
+   err |= cfc_check_trigger_arg_is(&cmd->convert_arg, arg);
}
 
if (err)
-- 
1.9.2

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


Re: [PATCH] [staging/silicom] Fixing missing blank line after declarations

2014-05-05 Thread Greg KH
On Mon, May 05, 2014 at 07:10:37PM +0200, Fernando Apesteguia wrote:
> On Mon, May 05, 2014 at 09:57:48AM -0700, Greg KH wrote:
> > On Mon, May 05, 2014 at 06:40:13PM +0200, Fernando Apesteguia wrote:
> > > Small fix to driver. If these patches are welcomed, more could come in the
> > > future.
> > > 
> > > Regards
> > 
> > > >From d8369cba0552c5ea5f4eadc750434e39785e042a Mon Sep 17 00:00:00 2001
> > > From: Fernando Apesteguia 
> > > Date: Mon, 5 May 2014 18:16:53 +0200
> > > Subject: [PATCH] [staging/silicom] Fixing missing blank line after
> > >  declarations
> > > 
> > > ---
> > >  drivers/staging/silicom/bpctl_mod.c |1 +
> > >  1 file changed, 1 insertion(+)
> > 
> > They would be welcome if they were in a format I could apply them in :)
> > 
> > See Documentation/SubmittingPatches for the details on how to do this
> > properly.
> 
> I think this one is good.

What one?  This email, no, I can't take it.

The patch needs to be in a format that I do not need to edit by hand,
and you forgot the signed-off-by: line, which is described in the kernel
file I pointed you at.  Please read that file for what it means, and how
to properly format a patch for inclusion.

thanks,

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


Re: [PATCH] staging: vt6655: correct coding style issue

2014-05-05 Thread Clément Calmels
On Sun, 4 May 2014 17:26:58 -0400
Greg KH  wrote:

> On Sun, May 04, 2014 at 09:52:09PM +0200, Clément Calmels wrote:
> > Remove C99 comment and rewrite lines over 80 characters.
> > Warnings and error found by checkpatch.pl script.
> > 
> > Signed-off-by: Clément Calmels 
> > ---
> >  drivers/staging/vt6655/tmacro.h | 13 +
> >  1 file changed, 9 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/staging/vt6655/tmacro.h
> > b/drivers/staging/vt6655/tmacro.h index 59c6e72..264c6ed 100644
> > --- a/drivers/staging/vt6655/tmacro.h
> > +++ b/drivers/staging/vt6655/tmacro.h
> > @@ -44,17 +44,22 @@
> >  #define LOWORD(d)   ((unsigned short)(d))
> >  #endif
> >  #if !defined(HIWORD)
> > -#define HIWORD(d)   ((unsigned short)unsigned
> > long)(d)) >> 16) & 0x)) +#define
> > HIWORD(d)   \
> > +   ((unsigned short)unsigned long)(d)) >> 16) & 0x))
> >  #endif
> >  
> >  #define LODWORD(q)  ((q).u.dwLowDword)
> >  #define HIDWORD(q)  ((q).u.dwHighDword)
> >  
> >  #if !defined(MAKEWORD)
> > -#define MAKEWORD(lb, hb)((unsigned short)(((unsigned
> > char)(lb)) | (((unsigned short)((unsigned char)(hb))) << 8)))
> > +#define MAKEWORD(lb, hb)\
> > +   ((unsigned short)(((unsigned
> > char)(lb))  \
> > + | (((unsigned short)((unsigned
> > char)(hb))) << 8))) #endif
> >  #if !defined(MAKEDWORD)
> > -#define MAKEDWORD(lw, hw)   ((unsigned long)(((unsigned
> > short)(lw)) | (((unsigned long)((unsigned short)(hw))) << 16)))
> > +#define MAKEDWORD(lw, hw)\
> > +   ((unsigned long)(((unsigned
> > short)(lw)) \
> > +| (((unsigned long)((unsigned
> > short)(hw))) << 16))) #endif
> >  
> > -#endif // __TMACRO_H__
> > +#endif /* __TMACRO_H__ */
> 
> Why not just switch to use the built-in macros the kernel provides for
> this?
> 
> greg k-h

Are you talking about changing types (unsigned char => u8) as used
there:
http://lxr.free-electrons.com/source/sound/isa/msnd/msnd.h#L182 or
there:
http://lxr.free-electrons.com/source/include/acpi/actypes.h#L481 ?

C.

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


re: staging/lustre: Replace jobid acquiring with per node setting

2014-05-05 Thread Dan Carpenter
Hello Oleg Drokin,

The patch 76133e66b141: "staging/lustre: Replace jobid acquiring with
per node setting" from Apr 27, 2014, leads to the following static
checker warning:

drivers/staging/lustre/lustre/obdclass/class_obd.c:131 
lustre_get_jobid()
error: strcpy() 'obd_jobid_node' too large for 'jobid' (33 vs 32)

drivers/staging/lustre/lustre/obdclass/class_obd.c
   105  char obd_jobid_node[JOBSTATS_JOBID_SIZE + 1];
   106  
   107  /* Get jobid of current process from stored variable or calculate
   108   * it from pid and user_id.
   109   *
   110   * Historically this was also done by reading the environment variable
   111   * stored in between the "env_start" & "env_end" of task struct.
   112   * This is now deprecated.
   113   */
   114  int lustre_get_jobid(char *jobid)
   115  {
   116  memset(jobid, 0, JOBSTATS_JOBID_SIZE);
   117  /* Jobstats isn't enabled */
   118  if (strcmp(obd_jobid_var, JOBSTATS_DISABLE) == 0)
   119  return 0;
   120  
   121  /* Use process name + fsuid as jobid */
   122  if (strcmp(obd_jobid_var, JOBSTATS_PROCNAME_UID) == 0) {
   123  snprintf(jobid, JOBSTATS_JOBID_SIZE, "%s.%u",
   124   current_comm(),
   125   from_kuid(&init_user_ns, current_fsuid()));
   126  return 0;
   127  }
   128  
   129  /* Whole node dedicated to single job */
   130  if (strcmp(obd_jobid_var, JOBSTATS_NODELOCAL) == 0) {
   131  strcpy(jobid, obd_jobid_node);


jobid is JOBSTATS_JOBID_SIZE 32 characters but obd_jobid_node is
33 characters.

   132  return 0;
   133  }
   134  
   135  return -ENOENT;
   136  }

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


Re: [PATCH] staging: android: fix missing a blank line after declarations

2014-05-05 Thread Joe Perches
On Mon, 2014-05-05 at 12:59 +0300, Dan Carpenter wrote:
> On Sat, May 03, 2014 at 07:43:26PM -0400, Greg KH wrote:
> > On Tue, Apr 29, 2014 at 08:32:21PM +0300, Dan Carpenter wrote:
> > > On Wed, Apr 30, 2014 at 01:59:12AM +0900, Seunghun Lee wrote:
> > > > This patch fixes "Missing a blank line after declarations" warnings.
> > > > 
> > > > Signed-off-by: Seunghun Lee 
> > > 
> > > Quite a few of these are false checkpatch.pl false positives.  Just
> > > ignore the false positives.
> > 
> > Really?  It looks good to me, what am I missing?
> > 
> 
> Gar.  You're right.  In my head I remember seeing a bunch of false
> positives but now that I'm looking at it again I'm not sure what I was
> talking about.

I think they were around here:

> diff --git a/drivers/staging/android/binder.c 
> b/drivers/staging/android/binder.c
[]
> @@ -228,8 +230,10 @@ struct binder_node {
>   int internal_strong_refs;
>   int local_weak_refs;
>   int local_strong_refs;
> +
>   binder_uintptr_t ptr;
>   binder_uintptr_t cookie;
> +
>   unsigned has_strong_ref:1;

These 2 new blank lines aren't necessary.

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


Re: [PATCH] staging: rtl8712: fix potential leaks in r8712_set_key()

2014-05-05 Thread Christian Engelmayer
On Sat, 3 May 2014 20:27:35 -0400, Greg KH  wrote:
> On Thu, May 01, 2014 at 11:54:02PM +0200, Christian Engelmayer wrote:
> > Fix potential leaks in the error paths of r8712_set_key(). In case the
> > algorithm specific checks fail, the function returns without enqueuing
> > or freeing the already allocated command and parameter structs. Use a
> > centralized exit path and make sure that all memory is freed correctly.
> > Detected by Coverity - CID 144370, 144371.
> > 
> > Signed-off-by: Christian Engelmayer 
> > ---
> > Compile tested and applies against branch staging-next of tree
> > git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
> 
> This doesn't apply either, and neither does one of your other patches,
> what is going on?

Greg, I am sorry that last weeks set of staging patches had problems. It
is not my intention to waste Your time.

I could reproduce the issue by running git am on my patches as received
back from the mailing list. Most of the set failed as the mails were split
incorrectly. I started rebasing the patches to the current staging-next
and fixed my mail agents settings to generate no multipart, 7bit text/plain
us-ascii. Thus the same set sent to myself applies now to a fresh clone of
Your tree.


git checkout -b integration-test origin/staging-next 
Branch integration-test set up to track remote branch staging-next from origin.
Switched to a new branch 'integration-test'

git am ./staging.mbox
Applying: staging: binder: fix usage of uninit scalar in binder_transaction()
Applying: staging: comedi: ii_pci20kc: fix usage of uninit scalar in 
ii20k_attach()
Applying: staging: rtl8188eu: fix potential leak in rtw_set_key()
Applying: staging: rtl8188eu: fix potential leak in rtw_wx_read32()
Applying: staging: rtl8188eu: fix potential leak in update_bcn_wps_ie()
Applying: staging: rtl8712: fix potential leaks in r8712_set_key()
Applying: staging: rtl8723au: Remove unused pointer in rtw_wdev_free()
Applying: staging: rtl8712: fix potential leak in r871x_wx_set_enc_ext()
Applying: staging: silicom: Remove needless calls of get_status_port_fn()
Applying: staging: silicom: Remove unused pointer in bypass_init_module()
Applying: staging: vt6656: fix potential leak in vt6656_hostap_ioctl()
Applying: staging: rtl8188eu: fix potential leak in rtw_wx_set_enc_ext()
Applying: staging: rtl8188eu: fix potential leak in rtw_mp_QueryDrv()
Applying: staging: rtl8188eu: fix potential leak in rtw_mp_SetRFPath()
Applying: staging: rtl8188eu: fix potential leak in rtw_mp_pwrtrk()


> Can you just refresh all of the outstanding patches you have sent me
> that I have not applied and resend them?

Of course. In case there are no objections or further hints, I will check
the refreshed patches later this week when I have got a bit more time and
will resend them.

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


Re: [PATCH] staging: et131x: add blank lines after declarations

2014-05-05 Thread Mark Einon
On Sun, May 04, 2014 at 07:26:51PM +0200, Maarten de Jonge wrote:
> Signed-off-by: Maarten de Jonge 

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


[PATCH] checkpatch: Improve missing blank line after declarations test

2014-05-05 Thread Joe Perches
A couple more modifications to the declarations tests.

o Declarations can also be bitfields so exclude things with a colon
o Make sure the current and previous lines are indented the same
  to avoid matching some macro where a struct type is passed on
  the previous line like:

next = list_entry(buffer->entry.next,
  struct binder_buffer, entry);
if (buffer_start_page(next) == buffer_end_page(buffer)) 

Signed-off-by: Joe Perches 
---
 scripts/checkpatch.pl | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 89f44f1..f2ef63a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2275,7 +2275,7 @@ sub process {
 # check for missing blank lines after declarations
if ($sline =~ /^\+\s+\S/ && #Not at char 1
# actual declarations
-   ($prevline =~ /^\+\s+$Declare\s*$Ident\s*[=,;\[]/ ||
+   ($prevline =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
# foo bar; where foo is some local typedef or #define
 $prevline =~ 
/^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
# known declaration macros
@@ -2287,7 +2287,7 @@ sub process {
# not starting a section or a macro "\" extended line
  $prevline =~ /(?:\{\s*|\\)$/) &&
# looks like a declaration
-   !($sline =~ /^\+\s+$Declare\s*$Ident\s*[=,;\[]/ ||
+   !($sline =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
# foo bar; where foo is some local typedef or #define
  $sline =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ 
||
# known declaration macros
@@ -2299,7 +2299,9 @@ sub process {
# bitfield continuation
  $sline =~ /^\+\s+$Ident\s*:\s*\d+\s*[,;]/ ||
# other possible extensions of declaration lines
- $sline =~ 
/^\+\s+\(?\s*(?:$Compare|$Assignment|$Operators)/)) {
+ $sline =~ 
/^\+\s+\(?\s*(?:$Compare|$Assignment|$Operators)/) &&
+   # indentation of previous and current line are the same
+   (($prevline =~ /\+(\s+)\S/) && $sline =~ /^\+$1\S/)) {
WARN("SPACING",
 "Missing a blank line after declarations\n" . 
$hereprev);
}


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


Re: [PATCH] staging: vt6655: correct coding style issue

2014-05-05 Thread Greg KH
On Mon, May 05, 2014 at 09:16:03PM +0200, Clément Calmels wrote:
> On Sun, 4 May 2014 17:26:58 -0400
> Greg KH  wrote:
> 
> > On Sun, May 04, 2014 at 09:52:09PM +0200, Clément Calmels wrote:
> > > Remove C99 comment and rewrite lines over 80 characters.
> > > Warnings and error found by checkpatch.pl script.
> > > 
> > > Signed-off-by: Clément Calmels 
> > > ---
> > >  drivers/staging/vt6655/tmacro.h | 13 +
> > >  1 file changed, 9 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/drivers/staging/vt6655/tmacro.h
> > > b/drivers/staging/vt6655/tmacro.h index 59c6e72..264c6ed 100644
> > > --- a/drivers/staging/vt6655/tmacro.h
> > > +++ b/drivers/staging/vt6655/tmacro.h
> > > @@ -44,17 +44,22 @@
> > >  #define LOWORD(d)   ((unsigned short)(d))
> > >  #endif
> > >  #if !defined(HIWORD)
> > > -#define HIWORD(d)   ((unsigned short)unsigned
> > > long)(d)) >> 16) & 0x)) +#define
> > > HIWORD(d) \
> > > + ((unsigned short)unsigned long)(d)) >> 16) & 0x))
> > >  #endif
> > >  
> > >  #define LODWORD(q)  ((q).u.dwLowDword)
> > >  #define HIDWORD(q)  ((q).u.dwHighDword)
> > >  
> > >  #if !defined(MAKEWORD)
> > > -#define MAKEWORD(lb, hb)((unsigned short)(((unsigned
> > > char)(lb)) | (((unsigned short)((unsigned char)(hb))) << 8)))
> > > +#define MAKEWORD(lb, hb)\
> > > + ((unsigned short)(((unsigned
> > > char)(lb))\
> > > +   | (((unsigned short)((unsigned
> > > char)(hb))) << 8))) #endif
> > >  #if !defined(MAKEDWORD)
> > > -#define MAKEDWORD(lw, hw)   ((unsigned long)(((unsigned
> > > short)(lw)) | (((unsigned long)((unsigned short)(hw))) << 16)))
> > > +#define MAKEDWORD(lw, hw)\
> > > + ((unsigned long)(((unsigned
> > > short)(lw))   \
> > > +  | (((unsigned long)((unsigned
> > > short)(hw))) << 16))) #endif
> > >  
> > > -#endif // __TMACRO_H__
> > > +#endif /* __TMACRO_H__ */
> > 
> > Why not just switch to use the built-in macros the kernel provides for
> > this?
> > 
> > greg k-h
> 
> Are you talking about changing types (unsigned char => u8) as used
> there:
> http://lxr.free-electrons.com/source/sound/isa/msnd/msnd.h#L182 or
> there:
> http://lxr.free-electrons.com/source/include/acpi/actypes.h#L481 ?

No, how about get_unaligned_le16() and put_unaligned_le16()?  Don't
those do what you want here?

thanks,

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


[GIT PULL] Staging driver fixes for 3.15-rc5

2014-05-05 Thread Greg KH
The following changes since commit d1db0eea852497762cab43b905b879dfcd3b8987:

  Linux 3.15-rc3 (2014-04-27 19:29:27 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/ 
tags/staging-3.15-rc4

for you to fetch changes up to 86281966c7395aa9a13a20c52e26005f5e142451:

  Merge tag 'iio-fixes-for-3.15b' of 
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus 
(2014-04-30 14:19:23 -0700)



Staging / IIO fixes for 3.15-rc4

Here are some small IIO driver fixes for 3.15-rc4 that resolve some
reported issues.

Signed-off-by: Greg Kroah-Hartman 


Atilla Filiz (1):
  iio:imu:mpu6050: Fixed segfault in Invensens MPU driver due to null 
dereference

Doug Anderson (1):
  iio: adc: Nothing in ADC should be a bool CONFIG

Greg Kroah-Hartman (1):
  Merge tag 'iio-fixes-for-3.15b' of git://git.kernel.org/.../jic23/iio 
into staging-linus

Jimmy Li (1):
  staging:iio:ad2s1200 fix missing parenthesis in a for statment.

Naveen Krishna Ch (1):
  iio: exynos_adc: use indio_dev->dev structure to handle child nodes

 drivers/iio/adc/Kconfig| 4 ++--
 drivers/iio/adc/exynos_adc.c   | 6 +++---
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 7 +--
 drivers/staging/iio/resolver/ad2s1200.c| 3 ++-
 4 files changed, 12 insertions(+), 8 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] r8192e_pci driver broken 3.14+

2014-05-05 Thread Jouke Witteveen
> A sparse error fixup removed a htons() which is required for the driver
> to function. This patch puts the htons() back and fixes the sparse
> warning correctly by changing the left side cast.
>
> Signed-off-by: Sean MacLennan 

I found that this patch is necessary and sufficient on my Samsung N510
(Intel Atom N280, kernel 3.14.2).

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


Re: [PATCH] [staging/silicom] Fixing missing blank line after declarations

2014-05-05 Thread Fernando Apesteguia
On Mon, May 05, 2014 at 10:38:37AM -0700, Greg KH wrote:
> On Mon, May 05, 2014 at 07:10:37PM +0200, Fernando Apesteguia wrote:
> > On Mon, May 05, 2014 at 09:57:48AM -0700, Greg KH wrote:
> > > On Mon, May 05, 2014 at 06:40:13PM +0200, Fernando Apesteguia wrote:
> > > > Small fix to driver. If these patches are welcomed, more could come in 
> > > > the
> > > > future.
> > > > 
> > > > Regards
> > > 
> > > > >From d8369cba0552c5ea5f4eadc750434e39785e042a Mon Sep 17 00:00:00 2001
> > > > From: Fernando Apesteguia 
> > > > Date: Mon, 5 May 2014 18:16:53 +0200
> > > > Subject: [PATCH] [staging/silicom] Fixing missing blank line after
> > > >  declarations
> > > > 
> > > > ---
> > > >  drivers/staging/silicom/bpctl_mod.c |1 +
> > > >  1 file changed, 1 insertion(+)
> > > 
> > > They would be welcome if they were in a format I could apply them in :)
> > > 
> > > See Documentation/SubmittingPatches for the details on how to do this
> > > properly.
> > 
> > I think this one is good.
> 
> What one?  This email, no, I can't take it.
> 
> The patch needs to be in a format that I do not need to edit by hand,
> and you forgot the signed-off-by: line, which is described in the kernel
> file I pointed you at.  Please read that file for what it means, and how
> to properly format a patch for inclusion.

From: Fernando Apesteguia 

Fix style bug by removing blank line at the beginning of the function and
adding an empty line after variable declarations

Signed-off-by: Fernando Apesteguia 
---
--- drivers/staging/silicom/bpctl_mod.c.orig2014-05-05 18:58:49.654207305 
+0200
+++ drivers/staging/silicom/bpctl_mod.c 2014-05-05 18:59:10.394206591 +0200
@@ -7448,8 +7448,8 @@ static int bypass_proc_create_dev_sd(str

 static int bypass_proc_remove_dev_sd(struct bpctl_dev *pbp_device_block)
 {
-
struct bypass_pfs_sd *current_pfs = &pbp_device_block->bypass_pfs_set;
+
remove_proc_subtree(current_pfs->dir_name, bp_procfs_dir);
current_pfs->bypass_entry = NULL;
return 0;

>


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


Re: [PATCH] checkpatch: Improve missing blank line after declarations test

2014-05-05 Thread Andrew Morton
On Mon, 05 May 2014 13:12:16 -0700 Joe Perches  wrote:

> A couple more modifications to the declarations tests.
> 
> o Declarations can also be bitfields so exclude things with a colon
> o Make sure the current and previous lines are indented the same
>   to avoid matching some macro where a struct type is passed on
>   the previous line like:
> 
>   next = list_entry(buffer->entry.next,
> struct binder_buffer, entry);
>   if (buffer_start_page(next) == buffer_end_page(buffer)) 

So 
checkpatch-always-warn-on-missing-blank-line-after-variable-declaration-block.patch
is stuck in -mm while I evaluate its effects.  Thus far that evaluation
has been "super non-intrusive", because the patch doesn't actually
do anything.

--- a/fs/open.c~a
+++ a/fs/open.c
@@ -39,6 +39,7 @@ int do_truncate(struct dentry *dentry, l
 {
int ret;
struct iattr newattrs;
+   wibble();
 
/* Not pretty: "inode->i_size" shouldn't really be signed. But it is. */
if (length < 0)
@@ -67,6 +68,7 @@ long vfs_truncate(struct path *path, lof
 {
struct inode *inode;
long error;
+   wobble();
 
inode = path->dentry->d_inode;
 



I add --strict and it still doesn't warn.  What did I do wrong this time?

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


Re: [PATCH] [staging/silicom] Fixing missing blank line after declarations

2014-05-05 Thread Dan Carpenter
Read some of these links.
https://www.google.com/search?q=how+to+send+a+v2+patch

Send the email to yourself.  Save it as raw text including headers and
everything.  `cat raw_email.txt | git am`.  Review the log with
`git log`.  When that works then resend it to the list.

The subject of the email is not correct:
 Bad: [PATCH] [staging/silicom] Fixing missing blank line after declarations
Good: [PATCH] staging: silicom: add blank line after declarations

regards,
dan carpenter

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


Re: [PATCH] checkpatch: Improve missing blank line after declarations test

2014-05-05 Thread Joe Perches
On Mon, 2014-05-05 at 15:15 -0700, Andrew Morton wrote:
> On Mon, 05 May 2014 13:12:16 -0700 Joe Perches  wrote:
> 
> > A couple more modifications to the declarations tests.
> > 
> > o Declarations can also be bitfields so exclude things with a colon
> > o Make sure the current and previous lines are indented the same
> >   to avoid matching some macro where a struct type is passed on
> >   the previous line like:
> > 
> > next = list_entry(buffer->entry.next,
> >   struct binder_buffer, entry);
> > if (buffer_start_page(next) == buffer_end_page(buffer)) 
> 
> So 
> checkpatch-always-warn-on-missing-blank-line-after-variable-declaration-block.patch
> is stuck in -mm while I evaluate its effects.  Thus far that evaluation
> has been "super non-intrusive", because the patch doesn't actually
> do anything.
[]
> @@ -67,6 +68,7 @@ long vfs_truncate(struct path *path, lof
>  {
>   struct inode *inode;
>   long error;
> + wobble();
>  
>   inode = path->dentry->d_inode;

Patch content can be a bit odd when lines are
both added and deleted so checkpatch bleats
only when both lines are added.

+   int foo;
+   wibble();

generates a complaint.

int foo;
+   wibble_wobble();

does not.

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


Re: [PATCH] checkpatch: Improve missing blank line after declarations test

2014-05-05 Thread Andrew Morton
On Mon, 05 May 2014 15:35:43 -0700 Joe Perches  wrote:

> > @@ -67,6 +68,7 @@ long vfs_truncate(struct path *path, lof
> >  {
> > struct inode *inode;
> > long error;
> > +   wobble();
> >  
> > inode = path->dentry->d_inode;
> 
> Patch content can be a bit odd when lines are
> both added and deleted so checkpatch bleats
> only when both lines are added.
> 
> + int foo;
> + wibble();
> 
> generates a complaint.
> 
>   int foo;
> + wibble_wobble();
> 
> does not.

Oh, OK.

I have seen no instances of this warning since adding the patch.  So I
guess it's safe to merge but perhaps insufficiently aggressive.  Or
maybe people are being well-behaved.

Oh well, I'll keep an eye out.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[RESEND PATCH] staging: vt6656: make spin_lock_irq() human readable

2014-05-05 Thread Martin Kepplinger
Don't require FIRMWAREbDownload() to, first off, unlock a held lock.
Thus do all locking in main_usb.c and hold it for a insignificantly
shorter period of time. This makes the affected area significantly more
readable though.

Signed-off-by: Martin Kepplinger 
---
I resend https://lkml.org/lkml/2014/4/30/453 and add de...@driverdev.osuosl.org
after waiting a week or so.

This fixes a sparse warning too, and uses less spin_lock functions.
Maybe someone can think it through.

 drivers/staging/vt6656/firmware.c |2 --
 drivers/staging/vt6656/main_usb.c |5 -
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vt6656/firmware.c 
b/drivers/staging/vt6656/firmware.c
index cd2ea76..79129ad 100644
--- a/drivers/staging/vt6656/firmware.c
+++ b/drivers/staging/vt6656/firmware.c
@@ -54,7 +54,6 @@ int FIRMWAREbDownload(struct vnt_private *pDevice)
int ii, rc;
 
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO">Download firmware\n");
-   spin_unlock_irq(&pDevice->lock);
 
rc = request_firmware(&fw, FIRMWARE_NAME, dev);
if (rc) {
@@ -91,7 +90,6 @@ free_fw:
 out:
kfree(pBuffer);
 
-   spin_lock_irq(&pDevice->lock);
return result;
 }
 MODULE_FIRMWARE(FIRMWARE_NAME);
diff --git a/drivers/staging/vt6656/main_usb.c 
b/drivers/staging/vt6656/main_usb.c
index 3c93230..1dc02c4 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -319,7 +319,11 @@ static int device_init_registers(struct vnt_private 
*pDevice)
memcpy(pDevice->abySNAP_Bridgetunnel, abySNAP_Bridgetunnel, ETH_ALEN);
 
if (!FIRMWAREbCheckVersion(pDevice)) {
+
+   spin_unlock_irq(&pDevice->lock);
if (FIRMWAREbDownload(pDevice) == true) {
+
+   spin_lock_irq(&pDevice->lock);
if (FIRMWAREbBrach2Sram(pDevice) == false) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
" FIRMWAREbBrach2Sram fail\n");
@@ -329,7 +333,6 @@ static int device_init_registers(struct vnt_private 
*pDevice)
} else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
" FIRMWAREbDownload fail\n");
-   spin_unlock_irq(&pDevice->lock);
return false;
}
}
-- 
1.7.10.4

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