Re: [PATCH v2] net: hyperv: else branch not necessary

2015-01-27 Thread David Miller
From: Nicholas Mc Guire 
Date: Sun, 25 Jan 2015 19:08:37 +0100

> As the if completes with a unconditional goto the else branch
> is not needed here.
> 
> Signed-off-by: Nicholas Mc Guire 
> ---
> 
> v2: added missing subsystem string in subject line - patch unchanged

The feedback you were given was completely bogus.

Saying "net: " in addition to "hyperv: " is unnecessary, redundant,
and something you should not do.

Just plain "hyperv: " is complete and unambiguous enough to stand
upon itself.

Nobody says "net: ixgbe: " for Intel ethernet driver changes.  That's
just stupid.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: rtl8712: fix Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...

2015-01-27 Thread Dan Carpenter

The subject line is too long.

> - printk(KERN_INFO "r8712u: Staging version\n");
> + pr_info("r8712u: Staging version\n");

This is a dumb thing to print.  Just delete this line.

regards,
dan carpenter

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


Re: [PATCH] staging: comedi: pcl812: fix logic error in pcl812_ai_setup_dma()

2015-01-27 Thread Ian Abbott

On 26/01/15 21:20, H Hartley Sweeten wrote:

commit 92afc2b229038d7b962ae69de5b07bc6c1cf51bf inroduced a logic error
in the DMA size calculation.

If the 'nsamples' is greater than the 'unread_samples' then DMA needs to
be restarted. The current code checks it agains the 'max_samples'.

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

diff --git a/drivers/staging/comedi/drivers/pcl812.c 
b/drivers/staging/comedi/drivers/pcl812.c
index 37cc5e4..3ffb1ea 100644
--- a/drivers/staging/comedi/drivers/pcl812.c
+++ b/drivers/staging/comedi/drivers/pcl812.c
@@ -559,8 +559,8 @@ static void pcl812_ai_setup_dma(struct comedi_device *dev,
 * unread samples and the number of samples remaining in the command.
 */
nsamples = comedi_nsamples_left(s, max_samples + unread_samples);
-   if (nsamples > max_samples) {
-   nsamples -= max_samples;
+   if (nsamples > unread_samples) {
+   nsamples -= unread_samples;
desc->size = comedi_samples_to_bytes(s, nsamples);
comedi_isadma_program(desc);
}



Reviewed-by: Ian Abbott 

--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/5] staging: comedi: das16: simplify cmd->scan_begin_src validation

2015-01-27 Thread Ian Abbott

On 26/01/15 17:25, Hartley Sweeten wrote:

On Monday, January 26, 2015 3:29 AM, Ian Abbott wrote:

On 23/01/15 23:12, H Hartley Sweeten wrote:

The analog input (*do_cmdtest) in this driver currently validates that the
scan_begin_src is TRIG_FOLLOW or, if the board can_burst, TRIG_TIMER or 
TRIG_EXT.
The rest of the driver is coded to assume that the scan_begin_src is always
TRIG_FOLLOW.


I don't think that's correct.  If the device allows bursting,
das16_cmd_ext() (*do_cmd()) has code to handle convert_src == TRIG_NOW,
which due to the validations in das16_cmd_test() (*do_cmdtest()) (step
2b) implies that scan_begin_src != TRIG_FOLLOW.


Ah.. I overlooked that. Step 2b isn't very clear. Step 4 doesn't help clarify 
it,
especially since the divisors are calculated again in the (*do_cmd). It's also
not nice that the (*do_cmd) possibly modifies cmd->convert_arg.

I'll take another look at it...


It's not that clear, but basically it supports either scans running 
continually (scan_begin_src == TRIG_FOLLOW) with samples triggered 
individually (convert_src == TRIG_TIMER or TRIG_EXT), or scans triggered 
individually (scan_begin_src == TRIG_TIMER or TRIG_EXT) with samples 
triggered altogether in a burst (convert_src == TRIG_NOW).  Not all the 
supported boards support bursting.


--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 0/9] staging: comedi: das16: tidy up driver

2015-01-27 Thread Ian Abbott

On 26/01/15 23:17, H Hartley Sweeten wrote:

This series was originally submitted as:
   [PATCH 0/5] staging: comedi: das16: tidy up ai command operation

Ian Abbott pointed out some issues in that series with my changes to the
analog input (*do_cmdtest) and (*do_cmd) functions.

This series drops those patches and just does some driver tidying. The
(*do_cmdtest) and (*do_cmd) cleanup will come later once I get my head
wrapped around it...

H Hartley Sweeten (9):
   staging: comedi: das16: absorb das16_ai_enable()
   staging: comedi: das16: remove unnecessary das16_ai_disable()
   staging: comedi: das16: absorb das16_ai_disable()
   staging: comedi: das16: introduce das16_ai_range()
   staging: comedi: das16: introduce das16_ao_range()
   staging: comedi: das16: change type of private data 'timer_running'
   staging: comedi: das16: use comedi_async 'scans_done' to detect EOA
   staging: comedi: das16: fix DMA size for short transfers
   staging: comedi: das16: introduce das16_ai_set_mux_range()

  drivers/staging/comedi/drivers/das16.c | 272 ++---
  1 file changed, 146 insertions(+), 126 deletions(-)



Reviewed-by: Ian Abbott 

--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: make allyesconfig i386 build failure with next-20150122 (caused by fb_agm1264k-fl driver)

2015-01-27 Thread Tilman Schmidt
Am 27.01.2015 um 03:42 schrieb Guenter Roeck:
> On 01/26/2015 02:46 PM, Greg Kroah-Hartman wrote:
>> On Mon, Jan 26, 2015 at 01:59:59PM -0800, Guenter Roeck wrote:
>>> On Thu, Jan 22, 2015 at 12:10:33PM -0700, Jim Davis wrote:
 make ARCH=i386 allyesconfig fails with

 drivers/staging/built-in.o: In function `reset':
 (.text+0x2ae89d): multiple definition of `reset'
 drivers/isdn/built-in.o:(.text+0x185dc2): first defined here
 make[1]: *** [drivers/built-in.o] Error 1
>>>
>>> Culprit:
>>>
>>> commit b2ebd4be6fa1d2329b63531b044f9e25474981cb
>>> Author: Thomas Petazzoni 
>>> Date:   Wed Dec 31 10:11:10 2014 +0100
>>>
>>>  staging: fbtft: add fb_agm1264k-fl driver
>>>
>>> A global function named 'reset' isn't really a good idea.
>>>
>>> Not that the global function with the same name in the isdn code
>>> is better ;-).
>>
>> Agreed, the fbtft code is now fixed.  Patches to fix the isdn code would
>> be gladly accepted as well :)
>>
> 
> Did you have a look into the isdn code ? It will need someone
> with a lot of spare time to clean this code up.

Cleaning up the entire isdn code certainly will, but that particular
problem is in fact much more limited. The function in question is
declared, along with several other also much too generically named
ones, in drivers/isdn/sc/card.h which is included nowhere outside
drivers/isdn/sc. So these are really private functions of the
SpellCaster driver which could easily be renamed.

OTOH good old SpellCaster was an ISA card, and the sc driver depends
on the deprecated I4L framework. I wonder if it's worth any effort.

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


Re: [PATCH v2 0/4] iio: mxs-lradc: fix interactions between the touchscreen and the ADC

2015-01-27 Thread Kristina Martšenko
On 26/01/15 23:01, Jonathan Cameron wrote:
> On 25/01/15 18:47, Marek Vasut wrote:
>> On Sunday, January 25, 2015 at 05:28:18 PM, Kristina Martšenko wrote:
>>> These patches fix some issues with using the touchscreen and reading
>>> other ADC channels at the same time.
>>
>> Entire series
>>
>> Reviewed-by: Marek Vasut 

Thanks again!

> All 4 applied to the fixes-togreg branch of iio.git and cc'd to
> stable.

Thanks, Jonathan! I'm not entirely sure if these are critical enough to
go in stable, but alright.

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


[PATCH 3.19.0-rc5 01/02] STAGING: Fix pcl818.c coding style issue: code indent should use tabs where possible

2015-01-27 Thread Simon Guo

Correct one coding style problem(detected by checkpatch.pl) in pcl818.c.
- code indent should use tabs where possible
It is fixed by reformatting the comment block to usual comment style.

And with the reformatting, following coding style problem is also fixed:
- please, no space before tabs

Signed-off-by: Simon Guo 
---
 drivers/staging/comedi/drivers/pcl818.c | 189 +++-
 1 file changed, 91 insertions(+), 98 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcl818.c 
b/drivers/staging/comedi/drivers/pcl818.c
index ba2e137..5d9050c 100644
--- a/drivers/staging/comedi/drivers/pcl818.c
+++ b/drivers/staging/comedi/drivers/pcl818.c
@@ -1,102 +1,95 @@
 /*
-   comedi/drivers/pcl818.c
-
-   Author:  Michal Dobes 
-
-   hardware driver for Advantech cards:
-card:   PCL-818L, PCL-818H, PCL-818HD, PCL-818HG, PCL-818, PCL-718
-driver: pcl818l,  pcl818h,  pcl818hd,  pcl818hg,  pcl818,  pcl718
-*/
-/*
-Driver: pcl818
-Description: Advantech PCL-818 cards, PCL-718
-Author: Michal Dobes 
-Devices: [Advantech] PCL-818L (pcl818l), PCL-818H (pcl818h),
-  PCL-818HD (pcl818hd), PCL-818HG (pcl818hg), PCL-818 (pcl818),
-  PCL-718 (pcl718)
-Status: works
-
-All cards have 16 SE/8 DIFF ADCs, one or two DACs, 16 DI and 16 DO.
-Differences are only at maximal sample speed, range list and FIFO
-support.
-The driver support AI mode 0, 1, 3 other subdevices (AO, DI, DO) support
-only mode 0. If DMA/FIFO/INT are disabled then AI support only mode 0.
-PCL-818HD and PCL-818HG support 1kword FIFO. Driver support this FIFO
-but this code is untested.
-A word or two about DMA. Driver support DMA operations at two ways:
-1) DMA uses two buffers and after one is filled then is generated
-   INT and DMA restart with second buffer. With this mode I'm unable run
-   more that 80Ksamples/secs without data dropouts on K6/233.
-2) DMA uses one buffer and run in autoinit mode and the data are
-   from DMA buffer moved on the fly with 2kHz interrupts from RTC.
-   This mode is used if the interrupt 8 is available for allocation.
-   If not, then first DMA mode is used. With this I can run at
-   full speed one card (100ksamples/secs) or two cards with
-   60ksamples/secs each (more is problem on account of ISA limitations).
-   To use this mode you must have compiled  kernel with disabled
-   "Enhanced Real Time Clock Support".
-   Maybe you can have problems if you use xntpd or similar.
-   If you've data dropouts with DMA mode 2 then:
-a) disable IDE DMA
-b) switch text mode console to fb.
-
-   Options for PCL-818L:
-[0] - IO Base
-[1] - IRQ  (0=disable, 2, 3, 4, 5, 6, 7)
-[2] - DMA  (0=disable, 1, 3)
-[3] - 0, 10=10MHz clock for 8254
-  1= 1MHz clock for 8254
-[4] - 0,  5=A/D input  -5V.. +5V
-  1, 10=A/D input -10V..+10V
-[5] - 0,  5=D/A output 0-5V  (internal reference -5V)
-  1, 10=D/A output 0-10V (internal reference -10V)
- 2=D/A output unknown (external reference)
-
-   Options for PCL-818, PCL-818H:
-[0] - IO Base
-[1] - IRQ  (0=disable, 2, 3, 4, 5, 6, 7)
-[2] - DMA  (0=disable, 1, 3)
-[3] - 0, 10=10MHz clock for 8254
-  1= 1MHz clock for 8254
-[4] - 0,  5=D/A output 0-5V  (internal reference -5V)
-  1, 10=D/A output 0-10V (internal reference -10V)
- 2=D/A output unknown (external reference)
-
-   Options for PCL-818HD, PCL-818HG:
-[0] - IO Base
-[1] - IRQ  (0=disable, 2, 3, 4, 5, 6, 7)
-[2] - DMA/FIFO  (-1=use FIFO, 0=disable both FIFO and DMA,
-  1=use DMA ch 1, 3=use DMA ch 3)
-[3] - 0, 10=10MHz clock for 8254
-  1= 1MHz clock for 8254
-[4] - 0,  5=D/A output 0-5V  (internal reference -5V)
-  1, 10=D/A output 0-10V (internal reference -10V)
- 2=D/A output unknown (external reference)
-
-   Options for PCL-718:
-[0] - IO Base
-[1] - IRQ  (0=disable, 2, 3, 4, 5, 6, 7)
-[2] - DMA  (0=disable, 1, 3)
-[3] - 0, 10=10MHz clock for 8254
-  1= 1MHz clock for 8254
-[4] - 0=A/D Range is +/-10V
- 1= +/-5V
- 2= +/-2.5V
- 3= +/-1V
- 4= +/-0.5V
- 5= user defined bipolar
- 6= 0-10V
- 7= 0-5V
- 8= 0-2V
- 9= 0-1V
-10= user defined unipolar
-[5] - 0,  5=D/A outputs 0-5V  (internal reference -5V)
-  1, 10=D/A outputs 0-10V (internal reference -10V)
- 2=D/A outputs unknown (external reference)
-[6] - 0, 60=max  60kHz A/D sampling
-  1,100=max 100kHz A/D sampling (PCL-718 with Option 001 installed)
-
-*/
+ * comedi/drivers/pcl818.c
+ *
+ * Driver: pcl818
+ * Description: Advantech PCL-818 cards, PCL-718
+ * Author: Michal Dobes 
+ * Devices: [Advantech] PCL-818L (pcl818l), PCL-818H (pcl818h),
+ *   PCL-818HD (pcl8

[PATCH 3.19.0-rc5 02/02] STAGING: Fix pcl818.c coding style issue: line over 80 characters

2015-01-27 Thread Simon Guo
Correct one coding style problem(detected by checkpatch.pl) in pcl818.c.
- line over 80 characters

Signed-off-by: Simon Guo 
---
 drivers/staging/comedi/drivers/pcl818.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcl818.c 
b/drivers/staging/comedi/drivers/pcl818.c
index 5d9050c..2b8a05e 100644
--- a/drivers/staging/comedi/drivers/pcl818.c
+++ b/drivers/staging/comedi/drivers/pcl818.c
@@ -297,9 +297,11 @@ static const struct pcl818_board boardtypes[] = {
 
 struct pcl818_private {
struct comedi_isadma *dma;
-   unsigned int ns_min;/*  manimal allowed delay between samples (in 
us) for actual card */
+   /*  manimal allowed delay between samples (in us) for actual card */
+   unsigned int ns_min;
int i8253_osc_base; /*  1/frequency of on board oscilator in ns */
-   unsigned int act_chanlist[16];  /*  MUX setting for actual AI 
operations */
+   /*  MUX setting for actual AI operations */
+   unsigned int act_chanlist[16];
unsigned int act_chanlist_len;  /*  how long is actual MUX list */
unsigned int act_chanlist_pos;  /*  actual position in MUX list */
unsigned int divisor1;
@@ -641,7 +643,8 @@ static int check_channel_list(struct comedi_device *dev,
break;
nowmustbechan =
(CR_CHAN(chansegment[i - 1]) + 1) % s->n_chan;
-   if (nowmustbechan != CR_CHAN(chanlist[i])) {/*  
channel list isn't continuous :-( */
+   if (nowmustbechan != CR_CHAN(chanlist[i])) {
+   /*  channel list isn't continuous :-( */
dev_dbg(dev->class_dev,
"channel list must be continuous! 
chanlist[%i]=%d but must be %d or %d!\n",
i, CR_CHAN(chanlist[i]), nowmustbechan,
@@ -1147,8 +1150,10 @@ static int pcl818_attach(struct comedi_device *dev, 
struct comedi_devconfig *it)
devpriv->ns_min = board->ns_min;
 
if (!board->is_818) {
-   if ((it->options[6] == 1) || (it->options[6] == 100))
-   devpriv->ns_min = 1;/* extended PCL718 to 
100kHz DAC */
+   if ((it->options[6] == 1) || (it->options[6] == 100)) {
+   /* extended PCL718 to 100kHz DAC */
+   devpriv->ns_min = 1;
+   }
}
 
pcl818_reset(dev);
-- 
1.8.1.2

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


[PATCH 2/7] staging: comedi: comedi_compat32.h: reformat copyright comment

2015-01-27 Thread Ian Abbott
Use the usual block comment style.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/comedi_compat32.h | 38 
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/comedi/comedi_compat32.h 
b/drivers/staging/comedi/comedi_compat32.h
index 2d0a6fc..5ce77f3 100644
--- a/drivers/staging/comedi/comedi_compat32.h
+++ b/drivers/staging/comedi/comedi_compat32.h
@@ -1,23 +1,23 @@
 /*
-comedi/comedi_compat32.h
-32-bit ioctl compatibility for 64-bit comedi kernel module.
-
-Author: Ian Abbott, MEV Ltd. 
-Copyright (C) 2007 MEV Ltd. 
-
-COMEDI - Linux Control and Measurement Device Interface
-Copyright (C) 1997-2007 David A. Schleef 
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-*/
+ * comedi/comedi_compat32.h
+ * 32-bit ioctl compatibility for 64-bit comedi kernel module.
+ *
+ * Author: Ian Abbott, MEV Ltd. 
+ * Copyright (C) 2007 MEV Ltd. 
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 1997-2007 David A. Schleef 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
 
 #ifndef _COMEDI_COMPAT32_H
 #define _COMEDI_COMPAT32_H
-- 
2.1.4

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


[PATCH 1/7] staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back

2015-01-27 Thread Ian Abbott
`do_cmd_ioctl()` in "comedi_fops.c" handles the `COMEDI_CMD` ioctl.
This returns `-EAGAIN` if it has copied a modified `struct comedi_cmd`
back to user-space.  (This occurs when the low-level Comedi driver's
`do_cmdtest()` handler returns non-zero to indicate a problem with the
contents of the `struct comedi_cmd`, or when the `struct comedi_cmd` has
the `CMDF_BOGUS` flag set.)

`compat_cmd()` in "comedi_compat32.c" handles the 32-bit compatible
version of the `COMEDI_CMD` ioctl.  Currently, it never copies a 32-bit
compatible version of `struct comedi_cmd` back to user-space, which is
at odds with the way the regular `COMEDI_CMD` ioctl is handled.  To fix
it, change `compat_cmd()` to copy a 32-bit compatible version of the
`struct comedi_cmd` back to user-space when the main ioctl handler
returns `-EAGAIN`.

Signed-off-by: Ian Abbott 
Cc: 
---
 drivers/staging/comedi/comedi_compat32.c | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/comedi_compat32.c 
b/drivers/staging/comedi/comedi_compat32.c
index 5a4c74f..2440c60 100644
--- a/drivers/staging/comedi/comedi_compat32.c
+++ b/drivers/staging/comedi/comedi_compat32.c
@@ -262,7 +262,8 @@ static int compat_cmd(struct file *file, unsigned long arg)
 {
struct comedi_cmd __user *cmd;
struct comedi32_cmd_struct __user *cmd32;
-   int rc;
+   long rc;
+   int err;
 
cmd32 = compat_ptr(arg);
cmd = compat_alloc_user_space(sizeof(*cmd));
@@ -271,7 +272,15 @@ static int compat_cmd(struct file *file, unsigned long arg)
if (rc)
return rc;
 
-   return translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd);
+   rc = translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd);
+   if (rc == -EAGAIN) {
+   /* Special case: copy cmd back to user. */
+   err = put_compat_cmd(cmd32, cmd);
+   if (err)
+   rc = err;
+   }
+
+   return rc;
 }
 
 /* Handle 32-bit COMEDI_CMDTEST ioctl. */
-- 
2.1.4

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


[PATCH 3/7] staging: comedi: comedi_compat.c: reformat copyright comment

2015-01-27 Thread Ian Abbott
Use the usual block comment style.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/comedi_compat32.c | 38 
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/comedi/comedi_compat32.c 
b/drivers/staging/comedi/comedi_compat32.c
index 2440c60..9364f08 100644
--- a/drivers/staging/comedi/comedi_compat32.c
+++ b/drivers/staging/comedi/comedi_compat32.c
@@ -1,23 +1,23 @@
 /*
-comedi/comedi_compat32.c
-32-bit ioctl compatibility for 64-bit comedi kernel module.
-
-Author: Ian Abbott, MEV Ltd. 
-Copyright (C) 2007 MEV Ltd. 
-
-COMEDI - Linux Control and Measurement Device Interface
-Copyright (C) 1997-2007 David A. Schleef 
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-*/
+ * comedi/comedi_compat32.c
+ * 32-bit ioctl compatibility for 64-bit comedi kernel module.
+ *
+ * Author: Ian Abbott, MEV Ltd. 
+ * Copyright (C) 2007 MEV Ltd. 
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 1997-2007 David A. Schleef 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
 
 #include 
 #include 
-- 
2.1.4

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


[PATCH 0/7] staging: comedi: comedi_compat32.[ch] fix and tidy up

2015-01-27 Thread Ian Abbott
Fix a bug in the handling of the 32-bit compatible version of the
COMEDI_CMD ioctl and tidy up the rest of the 32-bit compatible ioctl
handling code a bit.

1) staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back
2) staging: comedi: comedi_compat32.h: reformat copyright comment
3) staging: comedi: comedi_compat.c: reformat copyright comment
4) staging: comedi: comedi_compat32.c: reformat other block comments
5) staging: comedi: comedi_compat32.c: align some comments
6) staging: comedi: comedi_compat32.c: absorb raw_ioctl()
7) staging: comedi: comedi_compat.c: use long unlocked_ioctl return
   value

 drivers/staging/comedi/comedi_compat32.c | 121 +--
 drivers/staging/comedi/comedi_compat32.h |  38 +-
 2 files changed, 85 insertions(+), 74 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 5/7] staging: comedi: comedi_compat32.c: align some comments

2015-01-27 Thread Ian Abbott
Align some comments attached to members of the 32-bit compatibility
structure definitions.  These comments describe the original pointer
types that are being represented by a `compat_uptr_t`.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/comedi_compat32.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/comedi_compat32.c 
b/drivers/staging/comedi/comedi_compat32.c
index c0d404c..88a784f 100644
--- a/drivers/staging/comedi/comedi_compat32.c
+++ b/drivers/staging/comedi/comedi_compat32.c
@@ -43,7 +43,7 @@
 struct comedi32_chaninfo_struct {
unsigned int subdev;
compat_uptr_t maxdata_list; /* 32-bit 'unsigned int *' */
-   compat_uptr_t flaglist; /* 32-bit 'unsigned int *' */
+   compat_uptr_t flaglist; /* 32-bit 'unsigned int *' */
compat_uptr_t rangelist;/* 32-bit 'unsigned int *' */
unsigned int unused[4];
 };
@@ -66,16 +66,16 @@ struct comedi32_cmd_struct {
unsigned int scan_end_arg;
unsigned int stop_src;
unsigned int stop_arg;
-   compat_uptr_t chanlist; /* 32-bit 'unsigned int *' */
+   compat_uptr_t chanlist; /* 32-bit 'unsigned int *' */
unsigned int chanlist_len;
-   compat_uptr_t data; /* 32-bit 'short *' */
+   compat_uptr_t data; /* 32-bit 'short *' */
unsigned int data_len;
 };
 
 struct comedi32_insn_struct {
unsigned int insn;
unsigned int n;
-   compat_uptr_t data; /* 32-bit 'unsigned int *' */
+   compat_uptr_t data; /* 32-bit 'unsigned int *' */
unsigned int subdev;
unsigned int chanspec;
unsigned int unused[3];
@@ -83,7 +83,7 @@ struct comedi32_insn_struct {
 
 struct comedi32_insnlist_struct {
unsigned int n_insns;
-   compat_uptr_t insns;/* 32-bit 'struct comedi_insn *' */
+   compat_uptr_t insns;/* 32-bit 'struct comedi_insn *' */
 };
 
 /* Handle translated ioctl. */
-- 
2.1.4

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


[PATCH 7/7] staging: comedi: comedi_compat.c: use long unlocked_ioctl return value

2015-01-27 Thread Ian Abbott
The `unlocked_ioctl` and `compat_ioctl` file operations are both defined
to return a `long` (I don't know why).  Comedi's `compat_ioctl` handler
`comedi_compat_ioctl()` and its helper functions currently assume the
`unlocked_ioctl` handler return value will fit in an `int` (which it
does, in fact).  Change it to pass through the full `long` return value.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/comedi_compat32.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/comedi_compat32.c 
b/drivers/staging/comedi/comedi_compat32.c
index 24078b9..06ccf3c 100644
--- a/drivers/staging/comedi/comedi_compat32.c
+++ b/drivers/staging/comedi/comedi_compat32.c
@@ -87,8 +87,8 @@ struct comedi32_insnlist_struct {
 };
 
 /* Handle translated ioctl. */
-static int translated_ioctl(struct file *file, unsigned int cmd,
-   unsigned long arg)
+static long translated_ioctl(struct file *file, unsigned int cmd,
+unsigned long arg)
 {
if (file->f_op->unlocked_ioctl)
return file->f_op->unlocked_ioctl(file, cmd, arg);
@@ -97,7 +97,7 @@ static int translated_ioctl(struct file *file, unsigned int 
cmd,
 }
 
 /* Handle 32-bit COMEDI_CHANINFO ioctl. */
-static int compat_chaninfo(struct file *file, unsigned long arg)
+static long compat_chaninfo(struct file *file, unsigned long arg)
 {
struct comedi_chaninfo __user *chaninfo;
struct comedi32_chaninfo_struct __user *chaninfo32;
@@ -131,7 +131,7 @@ static int compat_chaninfo(struct file *file, unsigned long 
arg)
 }
 
 /* Handle 32-bit COMEDI_RANGEINFO ioctl. */
-static int compat_rangeinfo(struct file *file, unsigned long arg)
+static long compat_rangeinfo(struct file *file, unsigned long arg)
 {
struct comedi_rangeinfo __user *rangeinfo;
struct comedi32_rangeinfo_struct __user *rangeinfo32;
@@ -264,7 +264,7 @@ static int put_compat_cmd(struct comedi32_cmd_struct __user 
*cmd32,
 }
 
 /* Handle 32-bit COMEDI_CMD ioctl. */
-static int compat_cmd(struct file *file, unsigned long arg)
+static long compat_cmd(struct file *file, unsigned long arg)
 {
struct comedi_cmd __user *cmd;
struct comedi32_cmd_struct __user *cmd32;
@@ -290,11 +290,12 @@ static int compat_cmd(struct file *file, unsigned long 
arg)
 }
 
 /* Handle 32-bit COMEDI_CMDTEST ioctl. */
-static int compat_cmdtest(struct file *file, unsigned long arg)
+static long compat_cmdtest(struct file *file, unsigned long arg)
 {
struct comedi_cmd __user *cmd;
struct comedi32_cmd_struct __user *cmd32;
-   int rc, err;
+   long rc;
+   int err;
 
cmd32 = compat_ptr(arg);
cmd = compat_alloc_user_space(sizeof(*cmd));
@@ -344,7 +345,7 @@ static int get_compat_insn(struct comedi_insn __user *insn,
 }
 
 /* Handle 32-bit COMEDI_INSNLIST ioctl. */
-static int compat_insnlist(struct file *file, unsigned long arg)
+static long compat_insnlist(struct file *file, unsigned long arg)
 {
struct combined_insnlist {
struct comedi_insnlist insnlist;
@@ -394,7 +395,7 @@ static int compat_insnlist(struct file *file, unsigned long 
arg)
 }
 
 /* Handle 32-bit COMEDI_INSN ioctl. */
-static int compat_insn(struct file *file, unsigned long arg)
+static long compat_insn(struct file *file, unsigned long arg)
 {
struct comedi_insn __user *insn;
struct comedi32_insn_struct __user *insn32;
@@ -417,7 +418,7 @@ static int compat_insn(struct file *file, unsigned long arg)
  */
 long comedi_compat_ioctl(struct file *file, unsigned int cmd, unsigned long 
arg)
 {
-   int rc;
+   long rc;
 
switch (cmd) {
case COMEDI_DEVCONFIG:
-- 
2.1.4

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


[PATCH 6/7] staging: comedi: comedi_compat32.c: absorb raw_ioctl()

2015-01-27 Thread Ian Abbott
`comedi_compat_ioctl()` just calls static inline function `raw_ioctl()`
with the same parameters (although the former returns a `long` and the
latter returns an `int`).  Since `raw_ioctl()` is not called from
anywhere else, just absorb its body into `comedi_compat_ioctl()`.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/comedi_compat32.c | 15 ++-
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/comedi/comedi_compat32.c 
b/drivers/staging/comedi/comedi_compat32.c
index 88a784f..24078b9 100644
--- a/drivers/staging/comedi/comedi_compat32.c
+++ b/drivers/staging/comedi/comedi_compat32.c
@@ -411,12 +411,11 @@ static int compat_insn(struct file *file, unsigned long 
arg)
 }
 
 /*
- * Process untranslated ioctl.
+ * compat_ioctl file operation.
  *
  * Returns -ENOIOCTLCMD for unrecognised ioctl codes.
  */
-static inline int raw_ioctl(struct file *file, unsigned int cmd,
-   unsigned long arg)
+long comedi_compat_ioctl(struct file *file, unsigned int cmd, unsigned long 
arg)
 {
int rc;
 
@@ -463,13 +462,3 @@ static inline int raw_ioctl(struct file *file, unsigned 
int cmd,
}
return rc;
 }
-
-/*
- * compat_ioctl file operation.
- *
- * Returns -ENOIOCTLCMD for unrecognised ioctl codes.
- */
-long comedi_compat_ioctl(struct file *file, unsigned int cmd, unsigned long 
arg)
-{
-   return raw_ioctl(file, cmd, arg);
-}
-- 
2.1.4

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


[PATCH 4/7] staging: comedi: comedi_compat32.c: reformat other block comments

2015-01-27 Thread Ian Abbott
Use the usual block comment style.  Combine some consecutive comments
into block comments.  Also remove part of a comment referring to
`ptr_to_compat()` not being implemented until kernel version 2.6.11 as
it's irrelevant.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/comedi_compat32.c | 36 +---
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/comedi/comedi_compat32.c 
b/drivers/staging/comedi/comedi_compat32.c
index 9364f08..c0d404c 100644
--- a/drivers/staging/comedi/comedi_compat32.c
+++ b/drivers/staging/comedi/comedi_compat32.c
@@ -27,11 +27,15 @@
 
 #define COMEDI32_CHANINFO _IOR(CIO, 3, struct comedi32_chaninfo_struct)
 #define COMEDI32_RANGEINFO _IOR(CIO, 8, struct comedi32_rangeinfo_struct)
-/* N.B. COMEDI32_CMD and COMEDI_CMD ought to use _IOWR, not _IOR.
- * It's too late to change it now, but it only affects the command number. */
+/*
+ * N.B. COMEDI32_CMD and COMEDI_CMD ought to use _IOWR, not _IOR.
+ * It's too late to change it now, but it only affects the command number.
+ */
 #define COMEDI32_CMD _IOR(CIO, 9, struct comedi32_cmd_struct)
-/* N.B. COMEDI32_CMDTEST and COMEDI_CMDTEST ought to use _IOWR, not _IOR.
- * It's too late to change it now, but it only affects the command number. */
+/*
+ * N.B. COMEDI32_CMDTEST and COMEDI_CMDTEST ought to use _IOWR, not _IOR.
+ * It's too late to change it now, but it only affects the command number.
+ */
 #define COMEDI32_CMDTEST _IOR(CIO, 10, struct comedi32_cmd_struct)
 #define COMEDI32_INSNLIST _IOR(CIO, 11, struct comedi32_insnlist_struct)
 #define COMEDI32_INSN _IOR(CIO, 12, struct comedi32_insn_struct)
@@ -215,10 +219,12 @@ static int put_compat_cmd(struct comedi32_cmd_struct 
__user *cmd32,
int err;
unsigned int temp;
 
-   /* Copy back most of cmd structure. */
-   /* Assume the pointer values are already valid. */
-   /* (Could use ptr_to_compat() to set them, but that wasn't implemented
-* until kernel version 2.6.11.) */
+   /*
+* Copy back most of cmd structure.
+*
+* Assume the pointer values are already valid.
+* (Could use ptr_to_compat() to set them.)
+*/
if (!access_ok(VERIFY_READ, cmd, sizeof(*cmd)) ||
!access_ok(VERIFY_WRITE, cmd32, sizeof(*cmd32)))
return -EFAULT;
@@ -404,8 +410,11 @@ static int compat_insn(struct file *file, unsigned long 
arg)
return translated_ioctl(file, COMEDI_INSN, (unsigned long)insn);
 }
 
-/* Process untranslated ioctl. */
-/* Returns -ENOIOCTLCMD for unrecognised ioctl codes. */
+/*
+ * Process untranslated ioctl.
+ *
+ * Returns -ENOIOCTLCMD for unrecognised ioctl codes.
+ */
 static inline int raw_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
 {
@@ -455,8 +464,11 @@ static inline int raw_ioctl(struct file *file, unsigned 
int cmd,
return rc;
 }
 
-/* compat_ioctl file operation. */
-/* Returns -ENOIOCTLCMD for unrecognised ioctl codes. */
+/*
+ * compat_ioctl file operation.
+ *
+ * Returns -ENOIOCTLCMD for unrecognised ioctl codes.
+ */
 long comedi_compat_ioctl(struct file *file, unsigned int cmd, unsigned long 
arg)
 {
return raw_ioctl(file, cmd, arg);
-- 
2.1.4

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


Re: [PATCH 3.19.0-rc5 01/02] STAGING: Fix pcl818.c coding style issue: code indent should use tabs where possible

2015-01-27 Thread Ian Abbott

[Stripped a non-fully-qualified 'To:' address from the reply.]

On 26/01/15 16:58, Simon Guo wrote:


Correct one coding style problem(detected by checkpatch.pl) in pcl818.c.
- code indent should use tabs where possible
It is fixed by reformatting the comment block to usual comment style.

And with the reformatting, following coding style problem is also fixed:
- please, no space before tabs

Signed-off-by: Simon Guo 
---
  drivers/staging/comedi/drivers/pcl818.c | 189 +++-
  1 file changed, 91 insertions(+), 98 deletions(-)


Reviewed-by: Ian Abbott 

--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/7] staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back

2015-01-27 Thread Ian Abbott

On 27/01/15 15:50, Ian Abbott wrote:

`do_cmd_ioctl()` in "comedi_fops.c" handles the `COMEDI_CMD` ioctl.
This returns `-EAGAIN` if it has copied a modified `struct comedi_cmd`
back to user-space.  (This occurs when the low-level Comedi driver's
`do_cmdtest()` handler returns non-zero to indicate a problem with the
contents of the `struct comedi_cmd`, or when the `struct comedi_cmd` has
the `CMDF_BOGUS` flag set.)

`compat_cmd()` in "comedi_compat32.c" handles the 32-bit compatible
version of the `COMEDI_CMD` ioctl.  Currently, it never copies a 32-bit
compatible version of `struct comedi_cmd` back to user-space, which is
at odds with the way the regular `COMEDI_CMD` ioctl is handled.  To fix
it, change `compat_cmd()` to copy a 32-bit compatible version of the
`struct comedi_cmd` back to user-space when the main ioctl handler
returns `-EAGAIN`.

Signed-off-by: Ian Abbott 
Cc: 
---
  drivers/staging/comedi/comedi_compat32.c | 13 +++--
  1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/comedi_compat32.c 
b/drivers/staging/comedi/comedi_compat32.c
index 5a4c74f..2440c60 100644
--- a/drivers/staging/comedi/comedi_compat32.c
+++ b/drivers/staging/comedi/comedi_compat32.c
@@ -262,7 +262,8 @@ static int compat_cmd(struct file *file, unsigned long arg)
  {
struct comedi_cmd __user *cmd;
struct comedi32_cmd_struct __user *cmd32;
-   int rc;
+   long rc;
+   int err;


Gah!  That change in type of the 'rc' variable resulted from me changing 
the order of the patches in the series.  It still works, but looks a bit 
out of place.  Should I post an updated version without this niggle?




cmd32 = compat_ptr(arg);
cmd = compat_alloc_user_space(sizeof(*cmd));
@@ -271,7 +272,15 @@ static int compat_cmd(struct file *file, unsigned long arg)
if (rc)
return rc;

-   return translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd);
+   rc = translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd);
+   if (rc == -EAGAIN) {
+   /* Special case: copy cmd back to user. */
+   err = put_compat_cmd(cmd32, cmd);
+   if (err)
+   rc = err;
+   }
+
+   return rc;
  }

  /* Handle 32-bit COMEDI_CMDTEST ioctl. */




--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 3.19.0-rc5 02/02] STAGING: Fix pcl818.c coding style issue: line over 80 characters

2015-01-27 Thread Ian Abbott

On 26/01/15 16:59, Simon Guo wrote:

Correct one coding style problem(detected by checkpatch.pl) in pcl818.c.
- line over 80 characters

Signed-off-by: Simon Guo 
---
  drivers/staging/comedi/drivers/pcl818.c | 15 ++-
  1 file changed, 10 insertions(+), 5 deletions(-)


Reviewed-by: Ian Abbott 

--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 0/5] Drivers: hv: vmbus: fix crashes on hv_vmbus load/unload path

2015-01-27 Thread Vitaly Kuznetsov
Changes since v1:
- '[PATCH 2/3] Drivers: hv: vmbus: introduce vmbus_acpi_remove' was dropped in
  favor of Jake's '[PATCH v2 1/1] drivers:hv:vmbus drivers:hv:vmbus Allow for
  more than one MMIO range for children'. It is required to make unload/load
  work on Gen2 instances.

- Added '[PATCH v2 3/5] drivers: hv: Teardown synthetic interrupt controllers
  on module unload' to deal with synic.

- Added '[PATCH v2 4/5] clockevents: export clockevents_unbind_device instead
 of clockevents_unbind'. It is not for Hyper-V subsystem, however, it is a
 pre-requisite for 'PATCH 5/5' and a natural part of this series. CC: Thomas
 Gleixner as the subsystem maintainer.

- Added '[PATCH v2 5/5] Drivers: hv: vmbus: Teardown clockevent devices on
 module unload' to deal with clockevent devices.

Patches are supposed to be applied on top of current char-misc-next tree.

Original description:

It is possible (since 93e5bd06a953: "Drivers: hv: Make the vmbus driver
unloadable") to unload hv_vmbus driver if no other devices are connected.
1aec169673d7: "x86: Hyperv: Cleanup the irq mess" fixed doulble interrupt
gate setup. However, if we try to unload hv_vmbus and then load it back
crashes in different places of vmbus driver occur on both unload and second
load paths. Address those I saw in my testing.

Not everything is fixed though. MCE was hit once on Generation2 instance and
I neither understand what caused it nor do I know the way to reproduce it.
Anyway, here is the log:

[  204.846255] mce: [Hardware Error]: CPU 0: Machine Check Exception: 4 Bank 0: 
b200c0020001
[  204.846675] mce: [Hardware Error]: TSC 6b5cd64bc8
[  204.846675] mce: [Hardware Error]: PROCESSOR 0:306e4 TIME 1421944123 SOCKET 
0 APIC 0 microcode 
[  204.846675] mce: [Hardware Error]: Run the above through 'mcelog --ascii'
[  204.846675] mce: [Hardware Error]: Machine check: Processor context corrupt
[  204.846675] Kernel panic - not syncing: Fatal Machine check
[  204.846675] Kernel Offset: 0x0 from 0x8100 (relocation range: 
0x8000-0x9fff)
[  204.846675] Rebooting in 30 seconds..
[  204.846675] ACPI MEMORY or I/O RESET_REG.

Vitaly Kuznetsov (5):
  Drivers: hv: vmbus: avoid double kfree for device_obj
  Drivers: hv: vmbus: teardown hv_vmbus_con workqueue and
vmbus_connection pages on shutdown
  drivers: hv: Teardown synthetic interrupt controllers on module unload
  clockevents: export clockevents_unbind_device instead of
clockevents_unbind
  Drivers: hv: vmbus: Teardown clockevent devices on module unload

 drivers/hv/channel_mgmt.c |  1 -
 drivers/hv/connection.c   | 17 -
 drivers/hv/hv.c   | 34 +++---
 drivers/hv/hyperv_vmbus.h |  3 +++
 drivers/hv/vmbus_drv.c| 11 +++
 kernel/time/clockevents.c |  2 +-
 6 files changed, 58 insertions(+), 10 deletions(-)

-- 
1.9.3

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


[PATCH v2 1/5] Drivers: hv: vmbus: avoid double kfree for device_obj

2015-01-27 Thread Vitaly Kuznetsov
On driver shutdown device_obj is being freed twice:
1) In vmbus_free_channels()
2) vmbus_device_release() (which is being triggered by device_unregister() in
   vmbus_device_unregister().
This double kfree leads to the following sporadic crash on driver unload:

[   23.469876] general protection fault:  [#1] SMP
[   23.470036] Modules linked in: hv_vmbus(-)
[   23.470036] CPU: 2 PID: 213 Comm: rmmod Not tainted 3.19.0-rc5_bug923184+ 
#488
[   23.470036] Hardware name: Microsoft Corporation Virtual Machine/Virtual 
Machine, BIOS 090006  05/23/2012
[   23.470036] task: 880036ef1cb0 ti: 880036ce8000 task.ti: 
880036ce8000
[   23.470036] RIP: 0010:[]  [] 
__kmalloc_node_track_caller+0xdb/0x1e0
[   23.470036] RSP: 0018:880036cebcc8  EFLAGS: 00010246
...

When this crash does not happen on driver unload the similar one is expected if
we try to load hv_vmbus again.

Remove kfree from vmbus_free_channels() as freeing it from
vmbus_device_release() seems right.

Signed-off-by: Vitaly Kuznetsov 
---
 drivers/hv/channel_mgmt.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 1d7df25..ac357b8 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -259,7 +259,6 @@ void vmbus_free_channels(void)
 
list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
vmbus_device_unregister(channel->device_obj);
-   kfree(channel->device_obj);
free_channel(channel);
}
 }
-- 
1.9.3

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


[PATCH v2 5/5] Drivers: hv: vmbus: Teardown clockevent devices on module unload

2015-01-27 Thread Vitaly Kuznetsov
Newly introduced clockevent devices made it impossible to unload hv_vmbus
module as clockevents_config_and_register() takes additional reverence to
the module. To make it possible again we do the following:
- avoid setting dev->owner for clockevent devices;
- implement hv_synic_clockevents_cleanup() doing clockevents_unbind_device();
- call it from vmbus_exit().

In theory hv_synic_clockevents_cleanup() can be merged with hv_synic_cleanup(),
however, we call hv_synic_cleanup() from smp_call_function_single() and this
doesn't work for clockevents_unbind_device() as it does such call on its own. I
opted for a separate function.

Signed-off-by: Vitaly Kuznetsov 
---
 drivers/hv/hv.c   | 25 -
 drivers/hv/hyperv_vmbus.h |  2 ++
 drivers/hv/vmbus_drv.c|  1 +
 3 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 39531dc..d3943bc 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -312,7 +312,11 @@ static void hv_init_clockevent_device(struct 
clock_event_device *dev, int cpu)
dev->features = CLOCK_EVT_FEAT_ONESHOT;
dev->cpumask = cpumask_of(cpu);
dev->rating = 1000;
-   dev->owner = THIS_MODULE;
+   /*
+* Avoid settint dev->owner = THIS_MODULE deliberately as doing so will
+* result in clockevents_config_and_register() taking additional
+* references to the hv_vmbus module making it impossible to unload.
+*/
 
dev->set_mode = hv_ce_setmode;
dev->set_next_event = hv_ce_set_next_event;
@@ -470,6 +474,20 @@ void hv_synic_init(void *arg)
 }
 
 /*
+ * hv_synic_clockevents_cleanup - Cleanup clockevent devices
+ */
+void hv_synic_clockevents_cleanup(void)
+{
+   int cpu;
+
+   if (!(ms_hyperv.features & HV_X64_MSR_SYNTIMER_AVAILABLE))
+   return;
+
+   for_each_online_cpu(cpu)
+   clockevents_unbind_device(hv_context.clk_evt[cpu], cpu);
+}
+
+/*
  * hv_synic_cleanup - Cleanup routine for hv_synic_init().
  */
 void hv_synic_cleanup(void *arg)
@@ -483,6 +501,11 @@ void hv_synic_cleanup(void *arg)
if (!hv_context.synic_initialized)
return;
 
+   /* Turn off clockevent device */
+   if (ms_hyperv.features & HV_X64_MSR_SYNTIMER_AVAILABLE)
+   hv_ce_setmode(CLOCK_EVT_MODE_SHUTDOWN,
+ hv_context.clk_evt[cpu]);
+
rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
 
shared_sint.masked = 1;
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 6cf2de9..b055e53 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -572,6 +572,8 @@ extern void hv_synic_init(void *irqarg);
 
 extern void hv_synic_cleanup(void *arg);
 
+extern void hv_synic_clockevents_cleanup(void);
+
 /*
  * Host version information.
  */
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index f7e2c9e..fe6d35e 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -999,6 +999,7 @@ static void __exit vmbus_exit(void)
int cpu;
 
vmbus_connection.conn_state = DISCONNECTED;
+   hv_synic_clockevents_cleanup();
hv_remove_vmbus_irq();
vmbus_free_channels();
bus_unregister(&hv_bus);
-- 
1.9.3

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


[PATCH v2 4/5] clockevents: export clockevents_unbind_device instead of clockevents_unbind

2015-01-27 Thread Vitaly Kuznetsov
It looks like clockevents_unbind is being exported by mistake as:
- it is static;
- it is not listed in include/linux/clockchips.h;
- EXPORT_SYMBOL_GPL(clockevents_unbind) follows clockevents_unbind_device()
  implementation.

I think clockevents_unbind_device should be exported instead. This is going to
be used to teardown Hyper-V clockevent devices on module unload.

Signed-off-by: Vitaly Kuznetsov 
---
 kernel/time/clockevents.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 5544990..888ecc1 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -371,7 +371,7 @@ int clockevents_unbind_device(struct clock_event_device 
*ced, int cpu)
mutex_unlock(&clockevents_mutex);
return ret;
 }
-EXPORT_SYMBOL_GPL(clockevents_unbind);
+EXPORT_SYMBOL_GPL(clockevents_unbind_device);
 
 /**
  * clockevents_register_device - register a clock event device
-- 
1.9.3

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


[PATCH v2 3/5] drivers: hv: Teardown synthetic interrupt controllers on module unload

2015-01-27 Thread Vitaly Kuznetsov
SynIC has to be switched off when we unload the module, otherwise registered
memory pages can get corrupted after (as Hyper-V host still writes there) and
we see the following crashes for random processes:

[   89.116774] BUG: Bad page map in process sh  pte:4989c716 pmd:36f81067
[   89.159454] addr:00437000 vm_flags:0875 anon_vma:  
(null) mapping:88007bba55a0 index:37
[   89.226146] vma->vm_ops->fault: filemap_fault+0x0/0x410
[   89.257776] vma->vm_file->f_op->mmap: generic_file_mmap+0x0/0x60
[   89.297570] CPU: 0 PID: 215 Comm: sh Tainted: GB  
3.19.0-rc5_bug923184+ #488
[   89.353738] Hardware name: Microsoft Corporation Virtual Machine/Virtual 
Machine, BIOS 090006  05/23/2012
[   89.409138]   4e083d7b 880036e9fa18 
81a68d31
[   89.468724]   00437000 880036e9fa68 
811a1e3a
[   89.519233]  4989c716 0037 ea0001edc340 
00437000
[   89.575751] Call Trace:
[   89.591060]  [] dump_stack+0x45/0x57
[   89.625164]  [] print_bad_pte+0x1aa/0x250
[   89.667234]  [] vm_normal_page+0x55/0xa0
[   89.703818]  [] unmap_page_range+0x425/0x8a0
[   89.737982]  [] unmap_single_vma+0x81/0xf0
[   89.780385]  [] ? lru_deactivate_fn+0x190/0x190
[   89.820130]  [] unmap_vmas+0x51/0xa0
[   89.860168]  [] exit_mmap+0xac/0x1a0
[   89.890588]  [] mmput+0x63/0x100
[   89.919205]  [] flush_old_exec+0x3f8/0x8b0
[   89.962135]  [] load_elf_binary+0x32b/0x1260
[   89.998581]  [] ? get_user_pages+0x52/0x60

hv_synic_cleanup() function exists but noone calls it now. Do the following:
- call hv_synic_cleanup() on each cpu from vmbus_exit();
- write global disable bit through MSR;
- use hv_synic_free_cpu() to avoid memory leask and code duplication.

Signed-off-by: Vitaly Kuznetsov 
---
 drivers/hv/hv.c| 9 +++--
 drivers/hv/vmbus_drv.c | 4 
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 50e51a5..39531dc 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -477,6 +477,7 @@ void hv_synic_cleanup(void *arg)
union hv_synic_sint shared_sint;
union hv_synic_simp simp;
union hv_synic_siefp siefp;
+   union hv_synic_scontrol sctrl;
int cpu = smp_processor_id();
 
if (!hv_context.synic_initialized)
@@ -502,6 +503,10 @@ void hv_synic_cleanup(void *arg)
 
wrmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64);
 
-   free_page((unsigned long)hv_context.synic_message_page[cpu]);
-   free_page((unsigned long)hv_context.synic_event_page[cpu]);
+   /* Disable the global synic bit */
+   rdmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64);
+   sctrl.enable = 0;
+   wrmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64);
+
+   hv_synic_free_cpu(cpu);
 }
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index d5cd2fb..f7e2c9e 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -996,11 +996,15 @@ cleanup:
 
 static void __exit vmbus_exit(void)
 {
+   int cpu;
+
vmbus_connection.conn_state = DISCONNECTED;
hv_remove_vmbus_irq();
vmbus_free_channels();
bus_unregister(&hv_bus);
hv_cleanup();
+   for_each_online_cpu(cpu)
+   smp_call_function_single(cpu, hv_synic_cleanup, NULL, 1);
acpi_bus_unregister_driver(&vmbus_acpi_driver);
vmbus_disconnect();
 }
-- 
1.9.3

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


[PATCH v2 2/5] Drivers: hv: vmbus: teardown hv_vmbus_con workqueue and vmbus_connection pages on shutdown

2015-01-27 Thread Vitaly Kuznetsov
We need to destroy hv_vmbus_con on module shutdown, otherwise the following
crash is sometimes observed:

[   76.569845] hv_vmbus: Hyper-V Host Build:9600-6.3-17-0.17039; Vmbus 
version:3.0
[   82.598859] BUG: unable to handle kernel paging request at a0003480
[   82.599287] IP: [] 0xa0003480
[   82.599287] PGD 1f34067 PUD 1f35063 PMD 3f72d067 PTE 0
[   82.599287] Oops: 0010 [#1] SMP
[   82.599287] Modules linked in: [last unloaded: hv_vmbus]
[   82.599287] CPU: 0 PID: 26 Comm: kworker/0:1 Not tainted 
3.19.0-rc5_bug923184+ #488
[   82.599287] Hardware name: Microsoft Corporation Virtual Machine/Virtual 
Machine, BIOS Hyper-V UEFI Release v1.0 11/26/2012
[   82.599287] Workqueue: hv_vmbus_con 0xa0003480
[   82.599287] task: 88007b6ddfa0 ti: 88007f8f8000 task.ti: 
88007f8f8000
[   82.599287] RIP: 0010:[]  [] 
0xa0003480
[   82.599287] RSP: 0018:88007f8fbe00  EFLAGS: 00010202
...

To avoid memory leaks we need to free monitor_pages and int_page for
vmbus_connection. Implement vmbus_disconnect() function by separating cleanup
path from vmbus_connect().

As we use hv_vmbus_con to release channels (see free_channel() in 
channel_mgmt.c)
we need to make sure the work was done before we remove the queue, do that with
drain_workqueue(). We also need to avoid handling messages  which can 
(potentially)
create new channels, so set vmbus_connection.conn_state = DISCONNECTED at the 
very
beginning of vmbus_exit() and check for that in vmbus_onmessage_work().

Signed-off-by: Vitaly Kuznetsov 
---
 drivers/hv/connection.c   | 17 -
 drivers/hv/hyperv_vmbus.h |  1 +
 drivers/hv/vmbus_drv.c|  6 ++
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index a63a795..c4acd1c 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -216,10 +216,21 @@ int vmbus_connect(void)
 
 cleanup:
pr_err("Unable to connect to host\n");
+
vmbus_connection.conn_state = DISCONNECTED;
+   vmbus_disconnect();
+
+   kfree(msginfo);
+
+   return ret;
+}
 
-   if (vmbus_connection.work_queue)
+void vmbus_disconnect(void)
+{
+   if (vmbus_connection.work_queue) {
+   drain_workqueue(vmbus_connection.work_queue);
destroy_workqueue(vmbus_connection.work_queue);
+   }
 
if (vmbus_connection.int_page) {
free_pages((unsigned long)vmbus_connection.int_page, 0);
@@ -230,10 +241,6 @@ cleanup:
free_pages((unsigned long)vmbus_connection.monitor_pages[1], 0);
vmbus_connection.monitor_pages[0] = NULL;
vmbus_connection.monitor_pages[1] = NULL;
-
-   kfree(msginfo);
-
-   return ret;
 }
 
 /*
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 44b1c94..6cf2de9 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -692,6 +692,7 @@ void vmbus_free_channels(void);
 /* Connection interface */
 
 int vmbus_connect(void);
+void vmbus_disconnect(void);
 
 int vmbus_post_msg(void *buffer, size_t buflen);
 
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 7488111..d5cd2fb 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -573,6 +573,10 @@ static void vmbus_onmessage_work(struct work_struct *work)
 {
struct onmessage_work_context *ctx;
 
+   /* Do not process messages if we're in DISCONNECTED state */
+   if (vmbus_connection.conn_state == DISCONNECTED)
+   return;
+
ctx = container_of(work, struct onmessage_work_context,
   work);
vmbus_onmessage(&ctx->msg);
@@ -992,11 +996,13 @@ cleanup:
 
 static void __exit vmbus_exit(void)
 {
+   vmbus_connection.conn_state = DISCONNECTED;
hv_remove_vmbus_irq();
vmbus_free_channels();
bus_unregister(&hv_bus);
hv_cleanup();
acpi_bus_unregister_driver(&vmbus_acpi_driver);
+   vmbus_disconnect();
 }
 
 
-- 
1.9.3

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


RE: [PATCH 1/7] staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back

2015-01-27 Thread Hartley Sweeten
On Tuesday, January 27, 2015 8:59 AM, Ian Abbott wrote:
> On 27/01/15 15:50, Ian Abbott wrote:
>> `do_cmd_ioctl()` in "comedi_fops.c" handles the `COMEDI_CMD` ioctl.
>> This returns `-EAGAIN` if it has copied a modified `struct comedi_cmd`
>> back to user-space.  (This occurs when the low-level Comedi driver's
>> `do_cmdtest()` handler returns non-zero to indicate a problem with the
>> contents of the `struct comedi_cmd`, or when the `struct comedi_cmd` has
>> the `CMDF_BOGUS` flag set.)
>>
>> `compat_cmd()` in "comedi_compat32.c" handles the 32-bit compatible
>> version of the `COMEDI_CMD` ioctl.  Currently, it never copies a 32-bit
>> compatible version of `struct comedi_cmd` back to user-space, which is
>> at odds with the way the regular `COMEDI_CMD` ioctl is handled.  To fix
>> it, change `compat_cmd()` to copy a 32-bit compatible version of the
>> `struct comedi_cmd` back to user-space when the main ioctl handler
>> returns `-EAGAIN`.
>>
>> Signed-off-by: Ian Abbott 
>> Cc: 
>> ---
>>   drivers/staging/comedi/comedi_compat32.c | 13 +++--
>>   1 file changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/staging/comedi/comedi_compat32.c 
>> b/drivers/staging/comedi/comedi_compat32.c
>> index 5a4c74f..2440c60 100644
>> --- a/drivers/staging/comedi/comedi_compat32.c
>> +++ b/drivers/staging/comedi/comedi_compat32.c
>> @@ -262,7 +262,8 @@ static int compat_cmd(struct file *file, unsigned long 
>> arg)
>>   {
>>  struct comedi_cmd __user *cmd;
>>  struct comedi32_cmd_struct __user *cmd32;
>> -int rc;
>> +long rc;
>> +int err;
>
> Gah!  That change in type of the 'rc' variable resulted from me changing 
> the order of the patches in the series.  It still works, but looks a bit 
> out of place.  Should I post an updated version without this niggle?

Please fix it. I does look strange. Actually, the last patch looks strange.

The "normal" return type in the kernel is an 'int'. As you mention in the
commit message: "The `unlocked_ioctl` and `compat_ioctl` file operations
are both defined to return a `long` (I don't know why)." It seems cleaner
to just have all the static functions return an int and just have
comedi_compat_ioctl() return the long value. Maybe just add a comment
why...

My 2 cents...

Regards,
Hartley




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


[PATCH 4/9] staging: comedi: ni_usb6501: include new "comedi_usb.h" header

2015-01-27 Thread Ian Abbott
Include the new "../comedi_usb.h" header instead of  and
"../comedidev.h", which will now get included indirectly.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/ni_usb6501.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_usb6501.c 
b/drivers/staging/comedi/drivers/ni_usb6501.c
index 3b5a1b9..5f649f8 100644
--- a/drivers/staging/comedi/drivers/ni_usb6501.c
+++ b/drivers/staging/comedi/drivers/ni_usb6501.c
@@ -96,9 +96,8 @@
 #include 
 #include 
 #include 
-#include 
 
-#include "../comedidev.h"
+#include "../comedi_usb.h"
 
 #defineNI6501_TIMEOUT  1000
 
-- 
2.1.4

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


[PATCH 6/9] staging: comedi: usbduxfast: include new "comedi_usb.h" header

2015-01-27 Thread Ian Abbott
Include the new "../comedi_usb.h" header instead of  and
"../comedidev.h", which will now get included indirectly.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/usbduxfast.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c 
b/drivers/staging/comedi/drivers/usbduxfast.c
index 85071da..7ce27c1 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -46,11 +46,10 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include "comedi_fc.h"
-#include "../comedidev.h"
+#include "../comedi_usb.h"
 
 /*
  * timeout for the USB-transfer
-- 
2.1.4

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


[PATCH 8/9] staging: comedi: vmk80xx: include new "comedi_usb.h" header

2015-01-27 Thread Ian Abbott
Include the new "../comedi_usb.h" header instead of  and
"../comedidev.h", which will now get included indirectly.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/vmk80xx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/vmk80xx.c 
b/drivers/staging/comedi/drivers/vmk80xx.c
index eb76460..e371183 100644
--- a/drivers/staging/comedi/drivers/vmk80xx.c
+++ b/drivers/staging/comedi/drivers/vmk80xx.c
@@ -42,10 +42,9 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
-#include "../comedidev.h"
+#include "../comedi_usb.h"
 
 enum {
DEVICE_VMK8055,
-- 
2.1.4

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


[PATCH 9/9] staging: comedi: comedi_usb.h: move USB stuff out of comedidev.h

2015-01-27 Thread Ian Abbott
Move the USB-specific stuff out of "comedidev.h" into "comedi_usb.h".
Comedi USB drivers now include "comedi_usb.h" instead of "comedidev.h",
which now gets pulled in indirectly.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/comedi_usb.h | 24 ++--
 drivers/staging/comedi/comedidev.h  | 29 -
 2 files changed, 22 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/comedi/comedi_usb.h 
b/drivers/staging/comedi/comedi_usb.h
index a57025b..721128b 100644
--- a/drivers/staging/comedi/comedi_usb.h
+++ b/drivers/staging/comedi/comedi_usb.h
@@ -23,8 +23,28 @@
 
 #include "comedidev.h"
 
-/*
- * TODO: Move USB-specific stuff into here from "comedidev.h".
+struct usb_interface *comedi_to_usb_interface(struct comedi_device *);
+struct usb_device *comedi_to_usb_dev(struct comedi_device *);
+
+int comedi_usb_auto_config(struct usb_interface *, struct comedi_driver *,
+  unsigned long context);
+void comedi_usb_auto_unconfig(struct usb_interface *);
+
+int comedi_usb_driver_register(struct comedi_driver *, struct usb_driver *);
+void comedi_usb_driver_unregister(struct comedi_driver *, struct usb_driver *);
+
+/**
+ * module_comedi_usb_driver() - Helper macro for registering a comedi USB 
driver
+ * @__comedi_driver: comedi_driver struct
+ * @__usb_driver: usb_driver struct
+ *
+ * Helper macro for comedi USB drivers which do not do anything special
+ * in module init/exit. This eliminates a lot of boilerplate. Each
+ * module may only use this macro once, and calling it replaces
+ * module_init() and module_exit()
  */
+#define module_comedi_usb_driver(__comedi_driver, __usb_driver) \
+   module_driver(__comedi_driver, comedi_usb_driver_register, \
+   comedi_usb_driver_unregister, &(__usb_driver))
 
 #endif /* _COMEDI_USB_H */
diff --git a/drivers/staging/comedi/comedidev.h 
b/drivers/staging/comedi/comedidev.h
index e5daaeb..bc1dfc1 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -629,33 +629,4 @@ void comedi_pcmcia_driver_unregister(struct comedi_driver 
*,
module_driver(__comedi_driver, comedi_pcmcia_driver_register, \
comedi_pcmcia_driver_unregister, &(__pcmcia_driver))
 
-/* comedi_usb.c - comedi USB driver specific functions */
-
-struct usb_driver;
-struct usb_interface;
-
-struct usb_interface *comedi_to_usb_interface(struct comedi_device *);
-struct usb_device *comedi_to_usb_dev(struct comedi_device *);
-
-int comedi_usb_auto_config(struct usb_interface *, struct comedi_driver *,
-  unsigned long context);
-void comedi_usb_auto_unconfig(struct usb_interface *);
-
-int comedi_usb_driver_register(struct comedi_driver *, struct usb_driver *);
-void comedi_usb_driver_unregister(struct comedi_driver *, struct usb_driver *);
-
-/**
- * module_comedi_usb_driver() - Helper macro for registering a comedi USB 
driver
- * @__comedi_driver: comedi_driver struct
- * @__usb_driver: usb_driver struct
- *
- * Helper macro for comedi USB drivers which do not do anything special
- * in module init/exit. This eliminates a lot of boilerplate. Each
- * module may only use this macro once, and calling it replaces
- * module_init() and module_exit()
- */
-#define module_comedi_usb_driver(__comedi_driver, __usb_driver) \
-   module_driver(__comedi_driver, comedi_usb_driver_register, \
-   comedi_usb_driver_unregister, &(__usb_driver))
-
 #endif /* _COMEDIDEV_H */
-- 
2.1.4

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


[PATCH 2/9] staging: comedi: comedi_usb.c: include new "comedi_usb.h" header

2015-01-27 Thread Ian Abbott
Include the new "comedi_usb.h" header instead of  and
"comedidev.h", which will now get included indirectly.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/comedi_usb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/comedi_usb.c 
b/drivers/staging/comedi/comedi_usb.c
index 0b862a6..68b75e8 100644
--- a/drivers/staging/comedi/comedi_usb.c
+++ b/drivers/staging/comedi/comedi_usb.c
@@ -17,9 +17,8 @@
  */
 
 #include 
-#include 
 
-#include "comedidev.h"
+#include "comedi_usb.h"
 
 /**
  * comedi_to_usb_interface() - comedi_device pointer to usb_interface pointer.
-- 
2.1.4

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


[PATCH 5/9] staging: comedi: usbdux: include new "comedi_usb.h" header

2015-01-27 Thread Ian Abbott
Include the new "../comedi_usb.h" header instead of  and
"../comedidev.h", which will now get included indirectly.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/usbdux.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbdux.c 
b/drivers/staging/comedi/drivers/usbdux.c
index 0683d6a..1cd7403 100644
--- a/drivers/staging/comedi/drivers/usbdux.c
+++ b/drivers/staging/comedi/drivers/usbdux.c
@@ -80,11 +80,10 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
-#include "../comedidev.h"
+#include "../comedi_usb.h"
 
 #include "comedi_fc.h"
 
-- 
2.1.4

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


[PATCH 0/9] staging: comedi: introduce comedi_usb.h header

2015-01-27 Thread Ian Abbott
"comedidev.h" includes USB-specific stuff that gets included by all
comedi drivers including non-USB ones.  Separate it out into its own
header "comedi_usb.h".  Make the new header include  and
"comedidev.h" so that comedi USB drivers do not need to include them
explicitly.

1) staging: comedi: add comedi_usb.h
2) staging: comedi: comedi_usb.c: include new "comedi_usb.h" header
3) staging: comedi: dt9812: include new "comedi_usb.h" header
4) staging: comedi: ni_usb6501: include new "comedi_usb.h" header
5) staging: comedi: usbdux: include new "comedi_usb.h" header
6) staging: comedi: usbduxfast: include new "comedi_usb.h" header
7) staging: comedi: usbduxsigma: include new "comedi_usb.h" header
8) staging: comedi: vmk80xx: include new "comedi_usb.h" header
9) staging: comedi: comedi_usb.h: move USB stuff out of comedidev.h

 drivers/staging/comedi/comedi_usb.c  |  3 +-
 drivers/staging/comedi/comedi_usb.h  | 50 
 drivers/staging/comedi/comedidev.h   | 29 
 drivers/staging/comedi/drivers/dt9812.c  |  3 +-
 drivers/staging/comedi/drivers/ni_usb6501.c  |  3 +-
 drivers/staging/comedi/drivers/usbdux.c  |  3 +-
 drivers/staging/comedi/drivers/usbduxfast.c  |  3 +-
 drivers/staging/comedi/drivers/usbduxsigma.c |  3 +-
 drivers/staging/comedi/drivers/vmk80xx.c |  3 +-
 9 files changed, 57 insertions(+), 43 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 7/9] staging: comedi: usbduxsigma: include new "comedi_usb.h" header

2015-01-27 Thread Ian Abbott
Include the new "../comedi_usb.h" header instead of  and
"../comedidev.h", which will now get included indirectly.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/usbduxsigma.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c 
b/drivers/staging/comedi/drivers/usbduxsigma.c
index 17e5a81..378c449 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -45,13 +45,12 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 
 #include "comedi_fc.h"
-#include "../comedidev.h"
+#include "../comedi_usb.h"
 
 /* timeout for the USB-transfer in ms*/
 #define BULK_TIMEOUT 1000
-- 
2.1.4

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


[PATCH 1/9] staging: comedi: add comedi_usb.h

2015-01-27 Thread Ian Abbott
Add a new header that Comedi USB drivers can include instead of
"comedidev.h".  Currently, it just pulls in  and
"comedidev.h", but the plan is to migrate the USB-specific stuff from
"comedidev.h" here.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/comedi_usb.h | 30 ++
 1 file changed, 30 insertions(+)
 create mode 100644 drivers/staging/comedi/comedi_usb.h

diff --git a/drivers/staging/comedi/comedi_usb.h 
b/drivers/staging/comedi/comedi_usb.h
new file mode 100644
index 000..a57025b
--- /dev/null
+++ b/drivers/staging/comedi/comedi_usb.h
@@ -0,0 +1,30 @@
+/*
+ * comedi_usb.h
+ * header file for USB Comedi drivers
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 1997-2000 David A. Schleef 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _COMEDI_USB_H
+#define _COMEDI_USB_H
+
+#include 
+
+#include "comedidev.h"
+
+/*
+ * TODO: Move USB-specific stuff into here from "comedidev.h".
+ */
+
+#endif /* _COMEDI_USB_H */
-- 
2.1.4

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


[PATCH 3/9] staging: comedi: dt9812: include new "comedi_usb.h" header

2015-01-27 Thread Ian Abbott
Include the new "../comedi_usb.h" header instead of  and
"../comedidev.h", which will now get included indirectly.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/dt9812.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dt9812.c 
b/drivers/staging/comedi/drivers/dt9812.c
index 06c601d..e11c216 100644
--- a/drivers/staging/comedi/drivers/dt9812.c
+++ b/drivers/staging/comedi/drivers/dt9812.c
@@ -42,9 +42,8 @@ for my needs.
 #include 
 #include 
 #include 
-#include 
 
-#include "../comedidev.h"
+#include "../comedi_usb.h"
 
 #define DT9812_DIAGS_BOARD_INFO_ADDR   0xFBFF
 #define DT9812_MAX_WRITE_CMD_PIPE_SIZE 32
-- 
2.1.4

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


Re: [PATCH 1/7] staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back

2015-01-27 Thread Ian Abbott

On 27/01/15 17:20, Hartley Sweeten wrote:

On Tuesday, January 27, 2015 8:59 AM, Ian Abbott wrote:

On 27/01/15 15:50, Ian Abbott wrote:

`do_cmd_ioctl()` in "comedi_fops.c" handles the `COMEDI_CMD` ioctl.
This returns `-EAGAIN` if it has copied a modified `struct comedi_cmd`
back to user-space.  (This occurs when the low-level Comedi driver's
`do_cmdtest()` handler returns non-zero to indicate a problem with the
contents of the `struct comedi_cmd`, or when the `struct comedi_cmd` has
the `CMDF_BOGUS` flag set.)

`compat_cmd()` in "comedi_compat32.c" handles the 32-bit compatible
version of the `COMEDI_CMD` ioctl.  Currently, it never copies a 32-bit
compatible version of `struct comedi_cmd` back to user-space, which is
at odds with the way the regular `COMEDI_CMD` ioctl is handled.  To fix
it, change `compat_cmd()` to copy a 32-bit compatible version of the
`struct comedi_cmd` back to user-space when the main ioctl handler
returns `-EAGAIN`.

Signed-off-by: Ian Abbott 
Cc: 
---
   drivers/staging/comedi/comedi_compat32.c | 13 +++--
   1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/comedi_compat32.c 
b/drivers/staging/comedi/comedi_compat32.c
index 5a4c74f..2440c60 100644
--- a/drivers/staging/comedi/comedi_compat32.c
+++ b/drivers/staging/comedi/comedi_compat32.c
@@ -262,7 +262,8 @@ static int compat_cmd(struct file *file, unsigned long arg)
   {
struct comedi_cmd __user *cmd;
struct comedi32_cmd_struct __user *cmd32;
-   int rc;
+   long rc;
+   int err;


Gah!  That change in type of the 'rc' variable resulted from me changing
the order of the patches in the series.  It still works, but looks a bit
out of place.  Should I post an updated version without this niggle?


Please fix it. I does look strange. Actually, the last patch looks strange.

The "normal" return type in the kernel is an 'int'. As you mention in the
commit message: "The `unlocked_ioctl` and `compat_ioctl` file operations
are both defined to return a `long` (I don't know why)." It seems cleaner
to just have all the static functions return an int and just have
comedi_compat_ioctl() return the long value. Maybe just add a comment
why...

My 2 cents...


Yes, on reflection I think passing through the `long` return value is 
just pandering to an abomination that should be ignored.  I'll post a v2 
series with the above niggle fixed and the final patch dropped.


--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: rtl8192u: Use put_unaligned_le16 in rtl819x_BAProc.c

2015-01-27 Thread Vaishali Thakkar
This patch introduces the use of function put_unaligned_le16.

This is done using Coccinelle and semantic patch used is as follows:

@a@
typedef u16, __le16, uint16_t;
{u16,__le16,uint16_t} e16;
identifier tmp;
expression ptr;
expression y,e;
type T;
type T;
@@

- tmp = cpu_to_le16(y);

<+... when != tmp
(
- memcpy(ptr, (T)&tmp, 
\(2\|sizeof(u16)\|sizeof(__le16)\|sizeof(uint16_t)\|sizeof(e16)\));
+ put_unaligned_le16(y,ptr);
|
- memcpy(ptr, (T)&tmp, ...);
+ put_unaligned_le16(y,ptr);
)
...+>
? tmp = e

@@ type T; identifier a.tmp; @@

- T tmp;
...when != tmp

Signed-off-by: Vaishali Thakkar 
---
 .../staging/rtl8192u/ieee80211/rtl819x_BAProc.c| 24 +++---
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
index a9fd2cb..1b4623c 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
@@ -4,6 +4,8 @@
  * ADDBAREQ ADDBARSP and DELBA packet is still on consideration. Temporarily 
use MANAGE QUEUE instead of Normal Queue.
  * WB 2008-05-27
  * 
*/
+#include 
+#include 
 #include "ieee80211.h"
 #include "rtl819x_BA.h"
 
@@ -110,7 +112,6 @@ static struct sk_buff *ieee80211_ADDBA(struct 
ieee80211_device *ieee, u8 *Dst, P
struct sk_buff *skb = NULL;
 struct ieee80211_hdr_3addr *BAReq = NULL;
u8 *tag = NULL;
-   __le16 tmp = 0;
u16 len = ieee->tx_headroom + 9;
//category(1) + action field(1) + Dialog Token(1) + BA Parameter Set(2) 
+  BA Timeout Value(2) +  BA Start SeqCtrl(2)(or StatusCode(2))
IEEE80211_DEBUG(IEEE80211_DL_TRACE | IEEE80211_DL_BA, ">%s(), 
frame(%d) sentd to:%pM, ieee->dev:%p\n", __func__, type, Dst, ieee->dev);
@@ -149,17 +150,17 @@ static struct sk_buff *ieee80211_ADDBA(struct 
ieee80211_device *ieee, u8 *Dst, P
{
// Status Code
printk("=>to send ADDBARSP\n");
-   tmp = cpu_to_le16(StatusCode);
-   memcpy(tag, (u8 *)&tmp, 2);
+
+   put_unaligned_le16(StatusCode, tag);
tag += 2;
}
// BA Parameter Set
-   tmp = cpu_to_le16(pBA->BaParamSet.shortData);
-   memcpy(tag, (u8 *)&tmp, 2);
+
+   put_unaligned_le16(pBA->BaParamSet.shortData, tag);
tag += 2;
// BA Timeout Value
-   tmp = cpu_to_le16(pBA->BaTimeoutValue);
-   memcpy(tag, (u8 *)&tmp, 2);
+
+   put_unaligned_le16(pBA->BaTimeoutValue, tag);
tag += 2;
 
if (ACT_ADDBAREQ == type)
@@ -196,7 +197,6 @@ static struct sk_buff *ieee80211_DELBA(
struct sk_buff *skb = NULL;
 struct ieee80211_hdr_3addr *Delba = NULL;
u8 *tag = NULL;
-   __le16 tmp = 0;
//len = head len + DELBA Parameter Set(2) + Reason Code(2)
u16 len = 6 + ieee->tx_headroom;
 
@@ -230,12 +230,12 @@ static struct sk_buff *ieee80211_DELBA(
*tag ++= ACT_DELBA;
 
// DELBA Parameter Set
-   tmp = cpu_to_le16(DelbaParamSet.shortData);
-   memcpy(tag, (u8 *)&tmp, 2);
+
+   put_unaligned_le16(DelbaParamSet.shortData, tag);
tag += 2;
// Reason Code
-   tmp = cpu_to_le16(ReasonCode);
-   memcpy(tag, (u8 *)&tmp, 2);
+
+   put_unaligned_le16(ReasonCode, tag);
tag += 2;
 
IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA|IEEE80211_DL_BA, skb->data, 
skb->len);
-- 
1.9.1

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


[PATCH v2 5/6] staging: comedi: comedi_compat32.c: align some comments

2015-01-27 Thread Ian Abbott
Align some comments attached to members of the 32-bit compatibility
structure definitions.  These comments describe the original pointer
types that are being represented by a `compat_uptr_t`.

Signed-off-by: Ian Abbott 
---
v2: no change
---
 drivers/staging/comedi/comedi_compat32.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/comedi_compat32.c 
b/drivers/staging/comedi/comedi_compat32.c
index acbacff..0eab6c6 100644
--- a/drivers/staging/comedi/comedi_compat32.c
+++ b/drivers/staging/comedi/comedi_compat32.c
@@ -43,7 +43,7 @@
 struct comedi32_chaninfo_struct {
unsigned int subdev;
compat_uptr_t maxdata_list; /* 32-bit 'unsigned int *' */
-   compat_uptr_t flaglist; /* 32-bit 'unsigned int *' */
+   compat_uptr_t flaglist; /* 32-bit 'unsigned int *' */
compat_uptr_t rangelist;/* 32-bit 'unsigned int *' */
unsigned int unused[4];
 };
@@ -66,16 +66,16 @@ struct comedi32_cmd_struct {
unsigned int scan_end_arg;
unsigned int stop_src;
unsigned int stop_arg;
-   compat_uptr_t chanlist; /* 32-bit 'unsigned int *' */
+   compat_uptr_t chanlist; /* 32-bit 'unsigned int *' */
unsigned int chanlist_len;
-   compat_uptr_t data; /* 32-bit 'short *' */
+   compat_uptr_t data; /* 32-bit 'short *' */
unsigned int data_len;
 };
 
 struct comedi32_insn_struct {
unsigned int insn;
unsigned int n;
-   compat_uptr_t data; /* 32-bit 'unsigned int *' */
+   compat_uptr_t data; /* 32-bit 'unsigned int *' */
unsigned int subdev;
unsigned int chanspec;
unsigned int unused[3];
@@ -83,7 +83,7 @@ struct comedi32_insn_struct {
 
 struct comedi32_insnlist_struct {
unsigned int n_insns;
-   compat_uptr_t insns;/* 32-bit 'struct comedi_insn *' */
+   compat_uptr_t insns;/* 32-bit 'struct comedi_insn *' */
 };
 
 /* Handle translated ioctl. */
-- 
2.1.4

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


[PATCH v2 2/6] staging: comedi: comedi_compat32.h: reformat copyright comment

2015-01-27 Thread Ian Abbott
Use the usual block comment style.

Signed-off-by: Ian Abbott 
---
v2: no change
---
 drivers/staging/comedi/comedi_compat32.h | 38 
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/comedi/comedi_compat32.h 
b/drivers/staging/comedi/comedi_compat32.h
index 2d0a6fc..5ce77f3 100644
--- a/drivers/staging/comedi/comedi_compat32.h
+++ b/drivers/staging/comedi/comedi_compat32.h
@@ -1,23 +1,23 @@
 /*
-comedi/comedi_compat32.h
-32-bit ioctl compatibility for 64-bit comedi kernel module.
-
-Author: Ian Abbott, MEV Ltd. 
-Copyright (C) 2007 MEV Ltd. 
-
-COMEDI - Linux Control and Measurement Device Interface
-Copyright (C) 1997-2007 David A. Schleef 
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-*/
+ * comedi/comedi_compat32.h
+ * 32-bit ioctl compatibility for 64-bit comedi kernel module.
+ *
+ * Author: Ian Abbott, MEV Ltd. 
+ * Copyright (C) 2007 MEV Ltd. 
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 1997-2007 David A. Schleef 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
 
 #ifndef _COMEDI_COMPAT32_H
 #define _COMEDI_COMPAT32_H
-- 
2.1.4

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


[PATCH v2 3/6] staging: comedi: comedi_compat.c: reformat copyright comment

2015-01-27 Thread Ian Abbott
Use the usual block comment style.

Signed-off-by: Ian Abbott 
---
v2: no change
---
 drivers/staging/comedi/comedi_compat32.c | 38 
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/comedi/comedi_compat32.c 
b/drivers/staging/comedi/comedi_compat32.c
index 03a2d07..097fd4d 100644
--- a/drivers/staging/comedi/comedi_compat32.c
+++ b/drivers/staging/comedi/comedi_compat32.c
@@ -1,23 +1,23 @@
 /*
-comedi/comedi_compat32.c
-32-bit ioctl compatibility for 64-bit comedi kernel module.
-
-Author: Ian Abbott, MEV Ltd. 
-Copyright (C) 2007 MEV Ltd. 
-
-COMEDI - Linux Control and Measurement Device Interface
-Copyright (C) 1997-2007 David A. Schleef 
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-*/
+ * comedi/comedi_compat32.c
+ * 32-bit ioctl compatibility for 64-bit comedi kernel module.
+ *
+ * Author: Ian Abbott, MEV Ltd. 
+ * Copyright (C) 2007 MEV Ltd. 
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 1997-2007 David A. Schleef 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
 
 #include 
 #include 
-- 
2.1.4

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


[PATCH v2 1/6] staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back

2015-01-27 Thread Ian Abbott
`do_cmd_ioctl()` in "comedi_fops.c" handles the `COMEDI_CMD` ioctl.
This returns `-EAGAIN` if it has copied a modified `struct comedi_cmd`
back to user-space.  (This occurs when the low-level Comedi driver's
`do_cmdtest()` handler returns non-zero to indicate a problem with the
contents of the `struct comedi_cmd`, or when the `struct comedi_cmd` has
the `CMDF_BOGUS` flag set.)

`compat_cmd()` in "comedi_compat32.c" handles the 32-bit compatible
version of the `COMEDI_CMD` ioctl.  Currently, it never copies a 32-bit
compatible version of `struct comedi_cmd` back to user-space, which is
at odds with the way the regular `COMEDI_CMD` ioctl is handled.  To fix
it, change `compat_cmd()` to copy a 32-bit compatible version of the
`struct comedi_cmd` back to user-space when the main ioctl handler
returns `-EAGAIN`.

Signed-off-by: Ian Abbott 
Cc: 
---
v2: keep existing type of `rc` variable - don't change it to `long`.
---
 drivers/staging/comedi/comedi_compat32.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/comedi_compat32.c 
b/drivers/staging/comedi/comedi_compat32.c
index 5a4c74f..03a2d07 100644
--- a/drivers/staging/comedi/comedi_compat32.c
+++ b/drivers/staging/comedi/comedi_compat32.c
@@ -262,7 +262,7 @@ static int compat_cmd(struct file *file, unsigned long arg)
 {
struct comedi_cmd __user *cmd;
struct comedi32_cmd_struct __user *cmd32;
-   int rc;
+   int rc, err;
 
cmd32 = compat_ptr(arg);
cmd = compat_alloc_user_space(sizeof(*cmd));
@@ -271,7 +271,15 @@ static int compat_cmd(struct file *file, unsigned long arg)
if (rc)
return rc;
 
-   return translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd);
+   rc = translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd);
+   if (rc == -EAGAIN) {
+   /* Special case: copy cmd back to user. */
+   err = put_compat_cmd(cmd32, cmd);
+   if (err)
+   rc = err;
+   }
+
+   return rc;
 }
 
 /* Handle 32-bit COMEDI_CMDTEST ioctl. */
-- 
2.1.4

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


[PATCH v2 6/6] staging: comedi: comedi_compat32.c: absorb raw_ioctl()

2015-01-27 Thread Ian Abbott
`comedi_compat_ioctl()` just calls static inline function `raw_ioctl()`
with the same parameters (although the former returns a `long` and the
latter returns an `int`).  Since `raw_ioctl()` is not called from
anywhere else, just absorb its body into `comedi_compat_ioctl()`.

Signed-off-by: Ian Abbott 
---
v2: no change
---
 drivers/staging/comedi/comedi_compat32.c | 15 ++-
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/comedi/comedi_compat32.c 
b/drivers/staging/comedi/comedi_compat32.c
index 0eab6c6..2584824 100644
--- a/drivers/staging/comedi/comedi_compat32.c
+++ b/drivers/staging/comedi/comedi_compat32.c
@@ -410,12 +410,11 @@ static int compat_insn(struct file *file, unsigned long 
arg)
 }
 
 /*
- * Process untranslated ioctl.
+ * compat_ioctl file operation.
  *
  * Returns -ENOIOCTLCMD for unrecognised ioctl codes.
  */
-static inline int raw_ioctl(struct file *file, unsigned int cmd,
-   unsigned long arg)
+long comedi_compat_ioctl(struct file *file, unsigned int cmd, unsigned long 
arg)
 {
int rc;
 
@@ -462,13 +461,3 @@ static inline int raw_ioctl(struct file *file, unsigned 
int cmd,
}
return rc;
 }
-
-/*
- * compat_ioctl file operation.
- *
- * Returns -ENOIOCTLCMD for unrecognised ioctl codes.
- */
-long comedi_compat_ioctl(struct file *file, unsigned int cmd, unsigned long 
arg)
-{
-   return raw_ioctl(file, cmd, arg);
-}
-- 
2.1.4

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


[PATCH v2 4/6] staging: comedi: comedi_compat32.c: reformat other block comments

2015-01-27 Thread Ian Abbott
Use the usual block comment style.  Combine some consecutive comments
into block comments.  Also remove part of a comment referring to
`ptr_to_compat()` not being implemented until kernel version 2.6.11 as
it's irrelevant.

Signed-off-by: Ian Abbott 
---
v2: no change
---
 drivers/staging/comedi/comedi_compat32.c | 36 +---
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/comedi/comedi_compat32.c 
b/drivers/staging/comedi/comedi_compat32.c
index 097fd4d..acbacff 100644
--- a/drivers/staging/comedi/comedi_compat32.c
+++ b/drivers/staging/comedi/comedi_compat32.c
@@ -27,11 +27,15 @@
 
 #define COMEDI32_CHANINFO _IOR(CIO, 3, struct comedi32_chaninfo_struct)
 #define COMEDI32_RANGEINFO _IOR(CIO, 8, struct comedi32_rangeinfo_struct)
-/* N.B. COMEDI32_CMD and COMEDI_CMD ought to use _IOWR, not _IOR.
- * It's too late to change it now, but it only affects the command number. */
+/*
+ * N.B. COMEDI32_CMD and COMEDI_CMD ought to use _IOWR, not _IOR.
+ * It's too late to change it now, but it only affects the command number.
+ */
 #define COMEDI32_CMD _IOR(CIO, 9, struct comedi32_cmd_struct)
-/* N.B. COMEDI32_CMDTEST and COMEDI_CMDTEST ought to use _IOWR, not _IOR.
- * It's too late to change it now, but it only affects the command number. */
+/*
+ * N.B. COMEDI32_CMDTEST and COMEDI_CMDTEST ought to use _IOWR, not _IOR.
+ * It's too late to change it now, but it only affects the command number.
+ */
 #define COMEDI32_CMDTEST _IOR(CIO, 10, struct comedi32_cmd_struct)
 #define COMEDI32_INSNLIST _IOR(CIO, 11, struct comedi32_insnlist_struct)
 #define COMEDI32_INSN _IOR(CIO, 12, struct comedi32_insn_struct)
@@ -215,10 +219,12 @@ static int put_compat_cmd(struct comedi32_cmd_struct 
__user *cmd32,
int err;
unsigned int temp;
 
-   /* Copy back most of cmd structure. */
-   /* Assume the pointer values are already valid. */
-   /* (Could use ptr_to_compat() to set them, but that wasn't implemented
-* until kernel version 2.6.11.) */
+   /*
+* Copy back most of cmd structure.
+*
+* Assume the pointer values are already valid.
+* (Could use ptr_to_compat() to set them.)
+*/
if (!access_ok(VERIFY_READ, cmd, sizeof(*cmd)) ||
!access_ok(VERIFY_WRITE, cmd32, sizeof(*cmd32)))
return -EFAULT;
@@ -403,8 +409,11 @@ static int compat_insn(struct file *file, unsigned long 
arg)
return translated_ioctl(file, COMEDI_INSN, (unsigned long)insn);
 }
 
-/* Process untranslated ioctl. */
-/* Returns -ENOIOCTLCMD for unrecognised ioctl codes. */
+/*
+ * Process untranslated ioctl.
+ *
+ * Returns -ENOIOCTLCMD for unrecognised ioctl codes.
+ */
 static inline int raw_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
 {
@@ -454,8 +463,11 @@ static inline int raw_ioctl(struct file *file, unsigned 
int cmd,
return rc;
 }
 
-/* compat_ioctl file operation. */
-/* Returns -ENOIOCTLCMD for unrecognised ioctl codes. */
+/*
+ * compat_ioctl file operation.
+ *
+ * Returns -ENOIOCTLCMD for unrecognised ioctl codes.
+ */
 long comedi_compat_ioctl(struct file *file, unsigned int cmd, unsigned long 
arg)
 {
return raw_ioctl(file, cmd, arg);
-- 
2.1.4

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


[PATCH v2 0/6] staging: comedi: comedi_compat32.[ch] fix and tidy up

2015-01-27 Thread Ian Abbott
Fix a bug in the handling of the 32-bit compatible version of the
COMEDI_CMD ioctl and tidy up the rest of the 32-bit compatible ioctl
handling code a bit.

v2: fix minor niggle in patch 1 and drop patch 7.

1) staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back
2) staging: comedi: comedi_compat32.h: reformat copyright comment
3) staging: comedi: comedi_compat.c: reformat copyright comment
4) staging: comedi: comedi_compat32.c: reformat other block comments
5) staging: comedi: comedi_compat32.c: align some comments
6) staging: comedi: comedi_compat32.c: absorb raw_ioctl()

 drivers/staging/comedi/comedi_compat32.c | 99 +---
 drivers/staging/comedi/comedi_compat32.h | 38 ++--
 2 files changed, 73 insertions(+), 64 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: unisys: rework signal remove/insert to avoid sparse lock warnings

2015-01-27 Thread Romer, Benjamin M
On Sun, 2015-01-25 at 19:48 +0800, Greg KH wrote:
> On Sat, Jan 17, 2015 at 10:39:53PM +1100, Zachary Warren wrote:
> > Avoids the following warnings from sparse:
> > visorchannel_funcs.c:457:9: warning:
> >  context imbalance in 'visorchannel_signalremove' - different lock contexts 
> > for basic block
> > visorchannel_funcs.c:512:9: warning:
> >  context imbalance in 'visorchannel_signalinsert' - different lock contexts 
> > for basic

> Benjamin, I need an ack from you before I can take this.
> 
> thanks,
> 
> greg k-h

This one looks good, thanks! Sorry about the late reply.

--Ben

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


Re: [PATCH v2 3/6] staging: comedi: comedi_compat.c: reformat copyright comment

2015-01-27 Thread Ian Abbott

Bugger!  That should be "comedi_compat32.c", not "comedi_compat.c".

--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 3/6] staging: comedi: comedi_compat32.c: reformat copyright comment

2015-01-27 Thread Ian Abbott
Use the usual block comment style.

Signed-off-by: Ian Abbott 
---
v2: no change
v3: corrected commit summary line
---
 drivers/staging/comedi/comedi_compat32.c | 38 
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/comedi/comedi_compat32.c 
b/drivers/staging/comedi/comedi_compat32.c
index 03a2d07..097fd4d 100644
--- a/drivers/staging/comedi/comedi_compat32.c
+++ b/drivers/staging/comedi/comedi_compat32.c
@@ -1,23 +1,23 @@
 /*
-comedi/comedi_compat32.c
-32-bit ioctl compatibility for 64-bit comedi kernel module.
-
-Author: Ian Abbott, MEV Ltd. 
-Copyright (C) 2007 MEV Ltd. 
-
-COMEDI - Linux Control and Measurement Device Interface
-Copyright (C) 1997-2007 David A. Schleef 
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-*/
+ * comedi/comedi_compat32.c
+ * 32-bit ioctl compatibility for 64-bit comedi kernel module.
+ *
+ * Author: Ian Abbott, MEV Ltd. 
+ * Copyright (C) 2007 MEV Ltd. 
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 1997-2007 David A. Schleef 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
 
 #include 
 #include 
-- 
2.1.4

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


RE: [PATCH 0/9] staging: comedi: introduce comedi_usb.h header

2015-01-27 Thread Hartley Sweeten
On Tuesday, January 27, 2015 10:49 AM, Ian Abbott wrote:
> "comedidev.h" includes USB-specific stuff that gets included by all
> comedi drivers including non-USB ones.  Separate it out into its own
> header "comedi_usb.h".  Make the new header include  and
> "comedidev.h" so that comedi USB drivers do not need to include them
> explicitly.
>
> 1) staging: comedi: add comedi_usb.h
> 2) staging: comedi: comedi_usb.c: include new "comedi_usb.h" header
> 3) staging: comedi: dt9812: include new "comedi_usb.h" header
> 4) staging: comedi: ni_usb6501: include new "comedi_usb.h" header
> 5) staging: comedi: usbdux: include new "comedi_usb.h" header
> 6) staging: comedi: usbduxfast: include new "comedi_usb.h" header
> 7) staging: comedi: usbduxsigma: include new "comedi_usb.h" header
> 8) staging: comedi: vmk80xx: include new "comedi_usb.h" header
> 9) staging: comedi: comedi_usb.h: move USB stuff out of comedidev.h
>
>  drivers/staging/comedi/comedi_usb.c  |  3 +-
>  drivers/staging/comedi/comedi_usb.h  | 50 
> 
>  drivers/staging/comedi/comedidev.h   | 29 
>  drivers/staging/comedi/drivers/dt9812.c  |  3 +-
>  drivers/staging/comedi/drivers/ni_usb6501.c  |  3 +-
>  drivers/staging/comedi/drivers/usbdux.c  |  3 +-
>  drivers/staging/comedi/drivers/usbduxfast.c  |  3 +-
>  drivers/staging/comedi/drivers/usbduxsigma.c |  3 +-
>  drivers/staging/comedi/drivers/vmk80xx.c |  3 +-
>  9 files changed, 57 insertions(+), 43 deletions(-)

Reviewed-by: H Hartley Sweeten 

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


[PATCH 0/6] Fix fbtft/fb_pcd8544.c coding style errors

2015-01-27 Thread Heba Aamer
This patch set fixes most of the checkpatch.pl coding
style errors found in drivers/staging/fbtft/fb_pcd8544.c

Heba Aamer (6):
  staging: fbtft: fix space required after that ';'
  staging: fbtft: fix spaces required around that '='
  staging: fbtft: fix spaces required around that '<'
  staging: fbtft: fix Macros with complex values should be enclosed in
parentheses
  staging: fbtft: fix do not initialise statics to 0 or NULL
  staging: fbtft: fix trailing whitespace

 drivers/staging/fbtft/fb_pcd8544.c |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

-- 
1.7.9.5

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


[PATCH 1/6] staging: fbtft: fix space required after that ';'

2015-01-27 Thread Heba Aamer
This patch fixes the following checkpatch.pl error:
fix space required after that ';'

Signed-off-by: Heba Aamer 
---
 drivers/staging/fbtft/fb_pcd8544.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fbtft/fb_pcd8544.c 
b/drivers/staging/fbtft/fb_pcd8544.c
index 678ab8e..387190d 100644
--- a/drivers/staging/fbtft/fb_pcd8544.c
+++ b/drivers/staging/fbtft/fb_pcd8544.c
@@ -117,10 +117,10 @@ static int write_vmem(struct fbtft_par *par, size_t 
offset, size_t len)
 
fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s()\n", __func__);
 
-   for (x=0;x<84;x++) {
-   for (y=0;y<6;y++) {
+   for (x=0; x<84; x++) {
+   for (y=0; y<6; y++) {
*buf = 0x00;
-   for (i=0;i<8;i++) {
+   for (i=0; i<8; i++) {
*buf |= (vmem16[(y*8+i)*84+x] ? 1 : 0) << i;
}
buf++;
-- 
1.7.9.5

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


[PATCH 2/6] staging: fbtft: fix spaces required around that '='

2015-01-27 Thread Heba Aamer
This patch fixes the following checkpatch.pl error:
fix spaces required around that '='

Signed-off-by: Heba Aamer 
---
 drivers/staging/fbtft/fb_pcd8544.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fbtft/fb_pcd8544.c 
b/drivers/staging/fbtft/fb_pcd8544.c
index 387190d..ed0922d 100644
--- a/drivers/staging/fbtft/fb_pcd8544.c
+++ b/drivers/staging/fbtft/fb_pcd8544.c
@@ -117,10 +117,10 @@ static int write_vmem(struct fbtft_par *par, size_t 
offset, size_t len)
 
fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s()\n", __func__);
 
-   for (x=0; x<84; x++) {
-   for (y=0; y<6; y++) {
+   for (x = 0; x<84; x++) {
+   for (y = 0; y<6; y++) {
*buf = 0x00;
-   for (i=0; i<8; i++) {
+   for (i = 0; i<8; i++) {
*buf |= (vmem16[(y*8+i)*84+x] ? 1 : 0) << i;
}
buf++;
-- 
1.7.9.5

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


[PATCH 3/6] staging: fbtft: fix spaces required around that '<'

2015-01-27 Thread Heba Aamer
This patch fixes the following checkpatch.pl error:
fix spaces required around that '<'

Signed-off-by: Heba Aamer 
---
 drivers/staging/fbtft/fb_pcd8544.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fbtft/fb_pcd8544.c 
b/drivers/staging/fbtft/fb_pcd8544.c
index ed0922d..dd72bed 100644
--- a/drivers/staging/fbtft/fb_pcd8544.c
+++ b/drivers/staging/fbtft/fb_pcd8544.c
@@ -117,10 +117,10 @@ static int write_vmem(struct fbtft_par *par, size_t 
offset, size_t len)
 
fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s()\n", __func__);
 
-   for (x = 0; x<84; x++) {
-   for (y = 0; y<6; y++) {
+   for (x = 0; x < 84; x++) {
+   for (y = 0; y < 6; y++) {
*buf = 0x00;
-   for (i = 0; i<8; i++) {
+   for (i = 0; i < 8; i++) {
*buf |= (vmem16[(y*8+i)*84+x] ? 1 : 0) << i;
}
buf++;
-- 
1.7.9.5

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


RE: [PATCH v2 0/6] staging: comedi: comedi_compat32.[ch] fix and tidy up

2015-01-27 Thread Hartley Sweeten
On Tuesday, January 27, 2015 11:17 AM, Ian Abbott wrote:
> Fix a bug in the handling of the 32-bit compatible version of the
> COMEDI_CMD ioctl and tidy up the rest of the 32-bit compatible ioctl
> handling code a bit.
>
> v2: fix minor niggle in patch 1 and drop patch 7.
>
> 1) staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back
> 2) staging: comedi: comedi_compat32.h: reformat copyright comment
> 3) staging: comedi: comedi_compat.c: reformat copyright comment
> 4) staging: comedi: comedi_compat32.c: reformat other block comments
> 5) staging: comedi: comedi_compat32.c: align some comments
> 6) staging: comedi: comedi_compat32.c: absorb raw_ioctl()
>
>  drivers/staging/comedi/comedi_compat32.c | 99 
> +---
>  drivers/staging/comedi/comedi_compat32.h | 38 ++--
>  2 files changed, 73 insertions(+), 64 deletions(-)

Looks better. Thanks.

Reviewed-by: H Hartley Sweeten 

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


[PATCH 4/6] staging: fbtft: fix Macros with complex values should be enclosed in parentheses

2015-01-27 Thread Heba Aamer
This patch fixes the following checkpatch.pl error:
fix Macros with complex values should be enclosed in parentheses

Signed-off-by: Heba Aamer 
---
 drivers/staging/fbtft/fb_pcd8544.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fbtft/fb_pcd8544.c 
b/drivers/staging/fbtft/fb_pcd8544.c
index dd72bed..d20d432 100644
--- a/drivers/staging/fbtft/fb_pcd8544.c
+++ b/drivers/staging/fbtft/fb_pcd8544.c
@@ -33,7 +33,7 @@
 #define DRVNAME   "fb_pcd8544"
 #define WIDTH  84
 #define HEIGHT 48
-#define TXBUFLEN   84*6
+#define TXBUFLEN   (84*6)
 #define DEFAULT_GAMMA  "40" /* gamma is used to control contrast in this 
driver */
 
 static unsigned tc = 0;
-- 
1.7.9.5

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


[PATCH 5/6] staging: fbtft: fix do not initialise statics to 0 or NULL

2015-01-27 Thread Heba Aamer
This patch fixes the following checkpatch.pl error:
fix do not initialise statics to 0 or NULL

Signed-off-by: Heba Aamer 
---
 drivers/staging/fbtft/fb_pcd8544.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fbtft/fb_pcd8544.c 
b/drivers/staging/fbtft/fb_pcd8544.c
index d20d432..0510547 100644
--- a/drivers/staging/fbtft/fb_pcd8544.c
+++ b/drivers/staging/fbtft/fb_pcd8544.c
@@ -36,7 +36,7 @@
 #define TXBUFLEN   (84*6)
 #define DEFAULT_GAMMA  "40" /* gamma is used to control contrast in this 
driver */
 
-static unsigned tc = 0;
+static unsigned tc;
 module_param(tc, uint, 0);
 MODULE_PARM_DESC(tc, "TC[1:0] Temperature coefficient: 0-3 (default: 0)");
 
-- 
1.7.9.5

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


[PATCH 6/6] staging: fbtft: fix trailing whitespace

2015-01-27 Thread Heba Aamer
This patch fixes the following checkpatch.pl error:
fix trailing whitespace

Signed-off-by: Heba Aamer 
---
 drivers/staging/fbtft/fb_pcd8544.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fbtft/fb_pcd8544.c 
b/drivers/staging/fbtft/fb_pcd8544.c
index 0510547..8b9ebfb 100644
--- a/drivers/staging/fbtft/fb_pcd8544.c
+++ b/drivers/staging/fbtft/fb_pcd8544.c
@@ -59,14 +59,14 @@ static int init_display(struct fbtft_par *par)
  */
 
/* H=1 Temperature control */
-   write_reg(par, 0x04 | (tc & 0x3)); /* 
+   write_reg(par, 0x04 | (tc & 0x3)); /*
 2:1  1
 1:x  TC1 - Temperature Coefficient: 0x10
 0:x  TC0
  */
 
/* H=1 Bias system */
-   write_reg(par, 0x10 | (bs & 0x7)); /* 
+   write_reg(par, 0x10 | (bs & 0x7)); /*
 4:1  1
 3:0  0
 2:x  BS2 - Bias System
@@ -82,7 +82,7 @@ static int init_display(struct fbtft_par *par)
  */
 
/* H=0 Display control */
-   write_reg(par, 0x08 | 4); /* 
+   write_reg(par, 0x08 | 4); /*
 3:1  1
 2:1  D  - DE: 10=normal mode
 1:0  0
-- 
1.7.9.5

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


Re: [PATCH 0/6] Fix fbtft/fb_pcd8544.c coding style errors

2015-01-27 Thread Joe Perches
On Tue, 2015-01-27 at 22:30 +0200, Heba Aamer wrote:
> This patch set fixes most of the checkpatch.pl coding
> style errors found in drivers/staging/fbtft/fb_pcd8544.c
> 
> Heba Aamer (6):
>   staging: fbtft: fix space required after that ';'
>   staging: fbtft: fix spaces required around that '='
>   staging: fbtft: fix spaces required around that '<'

I suppose this is OK, but I think it's
better to do all the horizontal whitespace
changes in the same patch.

It's trivial and easy to verify all-at-once
instead of modifying the same line multiple
times.

It's also nice to say that git diff -w shows
no difference and that objdiff is empty.

>   staging: fbtft: fix trailing whitespace



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


[PATCH] staging: iio: trigger: iio-trig-periodic-rtc: Change type in printf format string

2015-01-27 Thread Rickard Strandqvist
Wrong type in printf format string, requires 'unsigned int'
but the argument type is 'int'

This was found using a static code analysis program called cppcheck

Signed-off-by: Rickard Strandqvist 
---
 drivers/staging/iio/trigger/iio-trig-periodic-rtc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c 
b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
index a24caf7..66d54a0 100644
--- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
+++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
@@ -52,7 +52,7 @@ static ssize_t iio_trig_periodic_read_freq(struct device *dev,
struct iio_trigger *trig = to_iio_trigger(dev);
struct iio_prtc_trigger_info *trig_info = iio_trigger_get_drvdata(trig);
 
-   return sprintf(buf, "%u\n", trig_info->frequency);
+   return sprintf(buf, "%d\n", trig_info->frequency);
 }
 
 static ssize_t iio_trig_periodic_write_freq(struct device *dev,
-- 
1.7.10.4

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


[PATCH] staging: lustre: libcfs: nidstrings: Change type in printf format string

2015-01-27 Thread Rickard Strandqvist
Wrong type in printf format string, requires 'unsigned int'
but the argument type is 'int'

This was found using a static code analysis program called cppcheck

Signed-off-by: Rickard Strandqvist 
---
 drivers/staging/lustre/lustre/libcfs/nidstrings.c |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/nidstrings.c 
b/drivers/staging/lustre/lustre/libcfs/nidstrings.c
index 47c239f..634ad09 100644
--- a/drivers/staging/lustre/lustre/libcfs/nidstrings.c
+++ b/drivers/staging/lustre/lustre/libcfs/nidstrings.c
@@ -343,7 +343,7 @@ libcfs_lnd2str(int lnd)
return nf->nf_name;
 
str = libcfs_next_nidstring();
-   snprintf(str, LNET_NIDSTR_SIZE, "?%u?", lnd);
+   snprintf(str, LNET_NIDSTR_SIZE, "?%d?", lnd);
return str;
 }
 EXPORT_SYMBOL(libcfs_lnd2str);
@@ -369,11 +369,11 @@ libcfs_net2str(__u32 net)
char *str = libcfs_next_nidstring();
 
if (nf == NULL)
-   snprintf(str, LNET_NIDSTR_SIZE, "<%u:%u>", lnd, num);
+   snprintf(str, LNET_NIDSTR_SIZE, "<%d:%d>", lnd, num);
else if (num == 0)
snprintf(str, LNET_NIDSTR_SIZE, "%s", nf->nf_name);
else
-   snprintf(str, LNET_NIDSTR_SIZE, "%s%u", nf->nf_name, num);
+   snprintf(str, LNET_NIDSTR_SIZE, "%s%d", nf->nf_name, num);
 
return str;
 }
@@ -397,7 +397,7 @@ libcfs_nid2str(lnet_nid_t nid)
str = libcfs_next_nidstring();
 
if (nf == NULL)
-   snprintf(str, LNET_NIDSTR_SIZE, "%x@<%u:%u>", addr, lnd, nnum);
+   snprintf(str, LNET_NIDSTR_SIZE, "%x@<%d:%d>", addr, lnd, nnum);
else {
nf->nf_addr2str(addr, str);
nob = strlen(str);
@@ -405,7 +405,7 @@ libcfs_nid2str(lnet_nid_t nid)
snprintf(str + nob, LNET_NIDSTR_SIZE - nob, "@%s",
 nf->nf_name);
else
-   snprintf(str + nob, LNET_NIDSTR_SIZE - nob, "@%s%u",
+   snprintf(str + nob, LNET_NIDSTR_SIZE - nob, "@%s%d",
 nf->nf_name, nnum);
}
 
-- 
1.7.10.4

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


[PATCH] staging: iio: impedance-analyzer: ad5933: Change type in printf format string

2015-01-27 Thread Rickard Strandqvist
Wrong type in printf format string, requires 'int'
but the argument type is 'unsigned int'

This was found using a static code analysis program called cppcheck

Signed-off-by: Rickard Strandqvist 
---
 drivers/staging/iio/impedance-analyzer/ad5933.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c 
b/drivers/staging/iio/impedance-analyzer/ad5933.c
index b6bd609..4230a43 100644
--- a/drivers/staging/iio/impedance-analyzer/ad5933.c
+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
@@ -360,11 +360,11 @@ static ssize_t ad5933_show(struct device *dev,
mutex_lock(&indio_dev->mlock);
switch ((u32) this_attr->address) {
case AD5933_OUT_RANGE:
-   len = sprintf(buf, "%d\n",
+   len = sprintf(buf, "%u\n",
  st->range_avail[(st->ctrl_hb >> 1) & 0x3]);
break;
case AD5933_OUT_RANGE_AVAIL:
-   len = sprintf(buf, "%d %d %d %d\n", st->range_avail[0],
+   len = sprintf(buf, "%u %u %u %u\n", st->range_avail[0],
  st->range_avail[3], st->range_avail[2],
  st->range_avail[1]);
break;
-- 
1.7.10.4

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


[PATCH] staging: iio: light: tsl2583: Change type in printf format string

2015-01-27 Thread Rickard Strandqvist
Wrong type in printf format string, requires 'int'
but the argument type is 'unsigned int'

This was found using a static code analysis program called cppcheck

Signed-off-by: Rickard Strandqvist 
---
 drivers/staging/iio/light/tsl2583.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/light/tsl2583.c 
b/drivers/staging/iio/light/tsl2583.c
index cc4ddcc..8afae8e 100644
--- a/drivers/staging/iio/light/tsl2583.c
+++ b/drivers/staging/iio/light/tsl2583.c
@@ -692,7 +692,7 @@ static ssize_t taos_luxtable_show(struct device *dev,
int offset = 0;
 
for (i = 0; i < ARRAY_SIZE(taos_device_lux); i++) {
-   offset += sprintf(buf + offset, "%d,%d,%d,",
+   offset += sprintf(buf + offset, "%u,%u,%u,",
  taos_device_lux[i].ratio,
  taos_device_lux[i].ch0,
  taos_device_lux[i].ch1);
-- 
1.7.10.4

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


[PATCH] staging: iio: light: tsl2x7x_core: Change type in printf format string

2015-01-27 Thread Rickard Strandqvist
Wrong type in printf format string, requires 'int'
but the argument type is 'unsigned int'

This was found using a static code analysis program called cppcheck

Signed-off-by: Rickard Strandqvist 
---
 drivers/staging/iio/light/tsl2x7x_core.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/light/tsl2x7x_core.c 
b/drivers/staging/iio/light/tsl2x7x_core.c
index 423f96b..4a5dc26 100644
--- a/drivers/staging/iio/light/tsl2x7x_core.c
+++ b/drivers/staging/iio/light/tsl2x7x_core.c
@@ -1147,7 +1147,7 @@ static ssize_t tsl2x7x_luxtable_show(struct device *dev,
int offset = 0;
 
while (i < (TSL2X7X_MAX_LUX_TABLE_SIZE * 3)) {
-   offset += snprintf(buf + offset, PAGE_SIZE, "%d,%d,%d,",
+   offset += snprintf(buf + offset, PAGE_SIZE, "%u,%u,%u,",
chip->tsl2x7x_device_lux[i].ratio,
chip->tsl2x7x_device_lux[i].ch0,
chip->tsl2x7x_device_lux[i].ch1);
-- 
1.7.10.4

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


[PATCH] staging: iio: magnetometer: hmc5843_core: Change type in printf format string

2015-01-27 Thread Rickard Strandqvist
Wrong type in printf format string, requires 'int'
but the argument type is 'unsigned int'

This was found using a static code analysis program called cppcheck

Signed-off-by: Rickard Strandqvist 
---
 drivers/staging/iio/magnetometer/hmc5843_core.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/magnetometer/hmc5843_core.c 
b/drivers/staging/iio/magnetometer/hmc5843_core.c
index fd171d8..cd049bb 100644
--- a/drivers/staging/iio/magnetometer/hmc5843_core.c
+++ b/drivers/staging/iio/magnetometer/hmc5843_core.c
@@ -217,7 +217,7 @@ static ssize_t 
hmc5843_show_measurement_configuration(struct device *dev,
return ret;
val &= HMC5843_MEAS_CONF_MASK;
 
-   return sprintf(buf, "%d\n", val);
+   return sprintf(buf, "%u\n", val);
 }
 
 static ssize_t hmc5843_set_measurement_configuration(struct device *dev,
-- 
1.7.10.4

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


[PATCH] staging: iio: resolver: ad2s1210: Change type in printf format string

2015-01-27 Thread Rickard Strandqvist
Wrong type in printf format string, requires 'int'
but the argument type is 'unsigned int'

This was found using a static code analysis program called cppcheck

Signed-off-by: Rickard Strandqvist 
---
 drivers/staging/iio/resolver/ad2s1210.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/resolver/ad2s1210.c 
b/drivers/staging/iio/resolver/ad2s1210.c
index b4c14ba..a8ecf87 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -198,7 +198,7 @@ static ssize_t ad2s1210_show_fclkin(struct device *dev,
 {
struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev));
 
-   return sprintf(buf, "%d\n", st->fclkin);
+   return sprintf(buf, "%u\n", st->fclkin);
 }
 
 static ssize_t ad2s1210_store_fclkin(struct device *dev,
@@ -237,7 +237,7 @@ static ssize_t ad2s1210_show_fexcit(struct device *dev,
 {
struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev));
 
-   return sprintf(buf, "%d\n", st->fexcit);
+   return sprintf(buf, "%u\n", st->fexcit);
 }
 
 static ssize_t ad2s1210_store_fexcit(struct device *dev,
-- 
1.7.10.4

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


[PATCH] staging: iio: adc: mxs-lradc: Change type in printf format string

2015-01-27 Thread Rickard Strandqvist
Wrong type in printf format string, requires 'int'
but the argument type is 'unsigned int'

This was found using a static code analysis program called cppcheck

Signed-off-by: Rickard Strandqvist 
---
 drivers/staging/iio/adc/mxs-lradc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/adc/mxs-lradc.c 
b/drivers/staging/iio/adc/mxs-lradc.c
index f053535..887767b 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -1001,7 +1001,7 @@ static ssize_t mxs_lradc_show_scale_available_ch(struct 
device *dev,
int i, len = 0;
 
for (i = 0; i < ARRAY_SIZE(lradc->scale_avail[ch]); i++)
-   len += sprintf(buf + len, "%d.%09u ",
+   len += sprintf(buf + len, "%u.%09u ",
   lradc->scale_avail[ch][i].integer,
   lradc->scale_avail[ch][i].nano);
 
-- 
1.7.10.4

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


[PATCH 0/8] Drivers: hv: vmbus: Enable unloading of vmbus driver

2015-01-27 Thread K. Y. Srinivasan
Windows hosts starting with Ws2012 R2 permit re-establishing the vmbus
connection from the guest. This patch-set includes patches from Vitaly
to cleanup the VMBUS unload path so we can potentially reload the driver.

This set also includes a patch from Jake to correctly extract MMIO
information on both Gen1 and Gen 2 firmware.


Jake Oshins (1):
  drivers:hv:vmbus drivers:hv:vmbus Allow for more than one MMIO range
for children

Vitaly Kuznetsov (7):
  Drivers: hv: vmbus: prevent cpu offlining on newer hypervisors
  Drivers: hv: vmbus: rename channel work queues
  Drivers: hv: vmbus: avoid double kfree for device_obj
  Drivers: hv: vmbus: teardown hv_vmbus_con workqueue and
vmbus_connection pages on shutdown
  drivers: hv: vmbus: Teardown synthetic interrupt controllers on
module unload
  clockevents: export clockevents_unbind_device instead of
clockevents_unbind
  Drivers: hv: vmbus: Teardown clockevent devices on module unload

 drivers/hv/channel_mgmt.c   |6 +-
 drivers/hv/connection.c |   17 +++--
 drivers/hv/hv.c |   34 -
 drivers/hv/hyperv_vmbus.h   |3 +
 drivers/hv/vmbus_drv.c  |  150 ++-
 drivers/video/fbdev/hyperv_fb.c |2 +-
 include/linux/hyperv.h  |5 +-
 kernel/time/clockevents.c   |2 +-
 8 files changed, 188 insertions(+), 31 deletions(-)

-- 
1.7.4.1

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


[PATCH RESEND 2/8] Drivers: hv: vmbus: rename channel work queues

2015-01-27 Thread K. Y. Srinivasan
From: Vitaly Kuznetsov <[mailto:vkuzn...@redhat.com]>

All channel work queues are named 'hv_vmbus_ctl', this makes them
indistinguishable in ps output and makes it hard to link to the corresponding
vmbus device. Rename them to hv_vmbus_ctl/N and make vmbus device names match,
e.g. now vmbus_1 device is served by hv_vmbus_ctl/1 work queue.

Signed-off-by: Vitaly Kuznetsov 
Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/channel_mgmt.c |5 -
 drivers/hv/vmbus_drv.c|6 ++
 include/linux/hyperv.h|3 +++
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 3736f71..ba4b25f 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -139,19 +139,22 @@ EXPORT_SYMBOL_GPL(vmbus_prep_negotiate_resp);
  */
 static struct vmbus_channel *alloc_channel(void)
 {
+   static atomic_t chan_num = ATOMIC_INIT(0);
struct vmbus_channel *channel;
 
channel = kzalloc(sizeof(*channel), GFP_ATOMIC);
if (!channel)
return NULL;
 
+   channel->id = atomic_inc_return(&chan_num);
spin_lock_init(&channel->inbound_lock);
spin_lock_init(&channel->lock);
 
INIT_LIST_HEAD(&channel->sc_list);
INIT_LIST_HEAD(&channel->percpu_list);
 
-   channel->controlwq = create_workqueue("hv_vmbus_ctl");
+   channel->controlwq = alloc_workqueue("hv_vmbus_ctl/%d", WQ_MEM_RECLAIM,
+1, channel->id);
if (!channel->controlwq) {
kfree(channel);
return NULL;
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 3b18a66..e334ccc 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -875,10 +875,8 @@ int vmbus_device_register(struct hv_device 
*child_device_obj)
 {
int ret = 0;
 
-   static atomic_t device_num = ATOMIC_INIT(0);
-
-   dev_set_name(&child_device_obj->device, "vmbus_0_%d",
-atomic_inc_return(&device_num));
+   dev_set_name(&child_device_obj->device, "vmbus_%d",
+child_device_obj->channel->id);
 
child_device_obj->device.bus = &hv_bus;
child_device_obj->device.parent = &hv_acpi_dev->dev;
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 5a2ba67..26a32b7 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -646,6 +646,9 @@ struct hv_input_signal_event_buffer {
 };
 
 struct vmbus_channel {
+   /* Unique channel id */
+   int id;
+
struct list_head listentry;
 
struct hv_device *device_obj;
-- 
1.7.4.1

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


[PATCH RESEND 3/8] drivers:hv:vmbus drivers:hv:vmbus Allow for more than one MMIO range for children

2015-01-27 Thread K. Y. Srinivasan
From: Jake Oshins <[mailto:ja...@microsoft.com]>

This set of changes finds the _CRS object in the ACPI namespace
that contains memory address space descriptors, intended to convey
to VMBus which ranges of memory-mapped I/O space are available for
child devices, and then builds a resource list that contains all
those ranges.  Without this change, only some of the memory-mapped
I/O space will be available for child devices, and only in some
virtual BIOS configurations (Generation 2 VMs).

Signed-off-by: Jake Oshins 
Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/vmbus_drv.c  |   97 +--
 drivers/video/fbdev/hyperv_fb.c |2 +-
 include/linux/hyperv.h  |2 +-
 3 files changed, 85 insertions(+), 16 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index e334ccc..aebc8fe 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -45,10 +45,7 @@ static struct tasklet_struct msg_dpc;
 static struct completion probe_event;
 static int irq;
 
-struct resource hyperv_mmio = {
-   .name  = "hyperv mmio",
-   .flags = IORESOURCE_MEM,
-};
+struct resource *hyperv_mmio;
 EXPORT_SYMBOL_GPL(hyperv_mmio);
 
 static int vmbus_exists(void)
@@ -915,30 +912,98 @@ void vmbus_device_unregister(struct hv_device *device_obj)
 
 
 /*
- * VMBUS is an acpi enumerated device. Get the the information we
+ * VMBUS is an acpi enumerated device. Get the information we
  * need from DSDT.
  */
 
 static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx)
 {
+   resource_size_t start = 0;
+   resource_size_t end = 0;
+   struct resource *new_res;
+   struct resource **old_res = &hyperv_mmio;
+
switch (res->type) {
case ACPI_RESOURCE_TYPE_IRQ:
irq = res->data.irq.interrupts[0];
+   return AE_OK;
+
+   /*
+* "Address" descriptors are for bus windows. Ignore
+* "memory" descriptors, which are for registers on
+* devices.
+*/
+   case ACPI_RESOURCE_TYPE_ADDRESS32:
+   start = res->data.address32.address.minimum;
+   end = res->data.address32.address.maximum;
break;
 
case ACPI_RESOURCE_TYPE_ADDRESS64:
-   hyperv_mmio.start = res->data.address64.address.minimum;
-   hyperv_mmio.end = res->data.address64.address.maximum;
+   start = res->data.address64.address.minimum;
+   end = res->data.address64.address.maximum;
break;
+
+   default:
+   /* Unused resource type */
+   return AE_OK;
+
}
+   /*
+* Ignore ranges that are below 1MB, as they're not
+* necessary or useful here.
+   */
+   if (end < 0x10)
+   return AE_OK;
+
+   new_res = kzalloc(sizeof(*new_res), GFP_ATOMIC);
+   if (!new_res)
+   return AE_NO_MEMORY;
+
+   new_res->name = "hyperv mmio";
+   new_res->flags = IORESOURCE_MEM;
+   new_res->start = start;
+   new_res->end = end;
+
+   do {
+   if (!*old_res) {
+   *old_res = new_res;
+   break;
+   }
+
+   if ((*old_res)->start > new_res->end) {
+   new_res->sibling = *old_res;
+   *old_res = new_res;
+   break;
+   }
+
+   old_res = &(*old_res)->sibling;
+
+   } while (1);
 
return AE_OK;
 }
 
+static int vmbus_acpi_remove(struct acpi_device *device)
+{
+   struct resource *cur_res;
+   struct resource *next_res;
+
+   if (hyperv_mmio) {
+   release_resource(hyperv_mmio);
+   for (cur_res = hyperv_mmio; cur_res; cur_res = next_res) {
+   next_res = cur_res->sibling;
+   kfree(cur_res);
+   }
+   }
+
+   return 0;
+}
+
 static int vmbus_acpi_add(struct acpi_device *device)
 {
acpi_status result;
int ret_val = -ENODEV;
+   struct acpi_device *ancestor;
 
hv_acpi_dev = device;
 
@@ -948,23 +1013,26 @@ static int vmbus_acpi_add(struct acpi_device *device)
if (ACPI_FAILURE(result))
goto acpi_walk_err;
/*
-* The parent of the vmbus acpi device (Gen2 firmware) is the VMOD that
-* has the mmio ranges. Get that.
+* Some ancestor of the vmbus acpi device (Gen1 or Gen2
+* firmware) is the VMOD that has the mmio ranges. Get that.
 */
-   if (device->parent) {
-   result = acpi_walk_resources(device->parent->handle,
+   for (ancestor = device->parent; ancestor; ancestor = ancestor->parent) {
+   result = acpi_walk_resources(ancestor->handle,
METHOD_NAME__CRS,
vmbus_walk_resources, NULL);
 
if (ACPI_FAILURE(result))
-  

[PATCH RESEND 1/8] Drivers: hv: vmbus: prevent cpu offlining on newer hypervisors

2015-01-27 Thread K. Y. Srinivasan
From: Vitaly Kuznetsov 

When an SMP Hyper-V guest is running on top of 2012R2 Server and secondary
cpus are sent offline (with echo 0 > /sys/devices/system/cpu/cpu$cpu/online)
the system freeze is observed. This happens due to the fact that on newer
hypervisors (Win8, WS2012R2, ...) vmbus channel handlers are distributed
across all cpus (see init_vp_index() function in drivers/hv/channel_mgmt.c)
and on cpu offlining nobody reassigns them to CPU0. Prevent cpu offlining
when vmbus is loaded until the issue is fixed host-side.

This patch also disables hibernation but it is OK as it is also broken (MCE
error is hit on resume). Suspend still works.

Tested with WS2008R2 and WS2012R2.

Signed-off-by: Vitaly Kuznetsov 
Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/vmbus_drv.c |   36 
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index f518b8d7..3b18a66 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -704,6 +705,39 @@ static void vmbus_isr(void)
}
 }
 
+#ifdef CONFIG_HOTPLUG_CPU
+static int hyperv_cpu_disable(void)
+{
+   return -ENOSYS;
+}
+
+static void hv_cpu_hotplug_quirk(bool vmbus_loaded)
+{
+   static void *previous_cpu_disable;
+
+   /*
+* Offlining a CPU when running on newer hypervisors (WS2012R2, Win8,
+* ...) is not supported at this moment as channel interrupts are
+* distributed across all of them.
+*/
+
+   if ((vmbus_proto_version == VERSION_WS2008) ||
+   (vmbus_proto_version == VERSION_WIN7))
+   return;
+
+   if (vmbus_loaded) {
+   previous_cpu_disable = smp_ops.cpu_disable;
+   smp_ops.cpu_disable = hyperv_cpu_disable;
+   pr_notice("CPU offlining is not supported by hypervisor\n");
+   } else if (previous_cpu_disable)
+   smp_ops.cpu_disable = previous_cpu_disable;
+}
+#else
+static void hv_cpu_hotplug_quirk(bool vmbus_loaded)
+{
+}
+#endif
+
 /*
  * vmbus_bus_init -Main vmbus driver initialization routine.
  *
@@ -744,6 +778,7 @@ static int vmbus_bus_init(int irq)
if (ret)
goto err_alloc;
 
+   hv_cpu_hotplug_quirk(true);
vmbus_request_offers();
 
return 0;
@@ -997,6 +1032,7 @@ static void __exit vmbus_exit(void)
bus_unregister(&hv_bus);
hv_cleanup();
acpi_bus_unregister_driver(&vmbus_acpi_driver);
+   hv_cpu_hotplug_quirk(false);
 }
 
 
-- 
1.7.4.1

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


[PATCH RESEND 7/8] clockevents: export clockevents_unbind_device instead of clockevents_unbind

2015-01-27 Thread K. Y. Srinivasan
From: Vitaly Kuznetsov <[mailto:vkuzn...@redhat.com]>

It looks like clockevents_unbind is being exported by mistake as:
- it is static;
- it is not listed in include/linux/clockchips.h;
- EXPORT_SYMBOL_GPL(clockevents_unbind) follows clockevents_unbind_device()
  implementation.

I think clockevents_unbind_device should be exported instead. This is going to
be used to teardown Hyper-V clockevent devices on module unload.

Signed-off-by: Vitaly Kuznetsov 
Signed-off-by: K. Y. Srinivasan 
---
 kernel/time/clockevents.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 5544990..888ecc1 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -371,7 +371,7 @@ int clockevents_unbind_device(struct clock_event_device 
*ced, int cpu)
mutex_unlock(&clockevents_mutex);
return ret;
 }
-EXPORT_SYMBOL_GPL(clockevents_unbind);
+EXPORT_SYMBOL_GPL(clockevents_unbind_device);
 
 /**
  * clockevents_register_device - register a clock event device
-- 
1.7.4.1

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


[PATCH RESEND 4/8] Drivers: hv: vmbus: avoid double kfree for device_obj

2015-01-27 Thread K. Y. Srinivasan
From: Vitaly Kuznetsov <[mailto:vkuzn...@redhat.com]>

On driver shutdown device_obj is being freed twice:
1) In vmbus_free_channels()
2) vmbus_device_release() (which is being triggered by device_unregister() in
   vmbus_device_unregister().
This double kfree leads to the following sporadic crash on driver unload:

[   23.469876] general protection fault:  [#1] SMP
[   23.470036] Modules linked in: hv_vmbus(-)
[   23.470036] CPU: 2 PID: 213 Comm: rmmod Not tainted 3.19.0-rc5_bug923184+ 
#488
[   23.470036] Hardware name: Microsoft Corporation Virtual Machine/Virtual 
Machine, BIOS 090006  05/23/2012
[   23.470036] task: 880036ef1cb0 ti: 880036ce8000 task.ti: 
880036ce8000
[   23.470036] RIP: 0010:[]  [] 
__kmalloc_node_track_caller+0xdb/0x1e0
[   23.470036] RSP: 0018:880036cebcc8  EFLAGS: 00010246
...

When this crash does not happen on driver unload the similar one is expected if
we try to load hv_vmbus again.

Remove kfree from vmbus_free_channels() as freeing it from
vmbus_device_release() seems right.

Signed-off-by: Vitaly Kuznetsov 
Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/channel_mgmt.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index ba4b25f..36bacc7 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -262,7 +262,6 @@ void vmbus_free_channels(void)
 
list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
vmbus_device_unregister(channel->device_obj);
-   kfree(channel->device_obj);
free_channel(channel);
}
 }
-- 
1.7.4.1

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


[PATCH RESEND 5/8] Drivers: hv: vmbus: teardown hv_vmbus_con workqueue and vmbus_connection pages on shutdown

2015-01-27 Thread K. Y. Srinivasan
From: Vitaly Kuznetsov <[mailto:vkuzn...@redhat.com]>

We need to destroy hv_vmbus_con on module shutdown, otherwise the following
crash is sometimes observed:

[   76.569845] hv_vmbus: Hyper-V Host Build:9600-6.3-17-0.17039; Vmbus 
version:3.0
[   82.598859] BUG: unable to handle kernel paging request at a0003480
[   82.599287] IP: [] 0xa0003480
[   82.599287] PGD 1f34067 PUD 1f35063 PMD 3f72d067 PTE 0
[   82.599287] Oops: 0010 [#1] SMP
[   82.599287] Modules linked in: [last unloaded: hv_vmbus]
[   82.599287] CPU: 0 PID: 26 Comm: kworker/0:1 Not tainted 
3.19.0-rc5_bug923184+ #488
[   82.599287] Hardware name: Microsoft Corporation Virtual Machine/Virtual 
Machine, BIOS Hyper-V UEFI Release v1.0 11/26/2012
[   82.599287] Workqueue: hv_vmbus_con 0xa0003480
[   82.599287] task: 88007b6ddfa0 ti: 88007f8f8000 task.ti: 
88007f8f8000
[   82.599287] RIP: 0010:[]  [] 
0xa0003480
[   82.599287] RSP: 0018:88007f8fbe00  EFLAGS: 00010202
...

To avoid memory leaks we need to free monitor_pages and int_page for
vmbus_connection. Implement vmbus_disconnect() function by separating cleanup
path from vmbus_connect().

As we use hv_vmbus_con to release channels (see free_channel() in 
channel_mgmt.c)
we need to make sure the work was done before we remove the queue, do that with
drain_workqueue(). We also need to avoid handling messages  which can 
(potentially)
create new channels, so set vmbus_connection.conn_state = DISCONNECTED at the 
very
beginning of vmbus_exit() and check for that in vmbus_onmessage_work().

Signed-off-by: Vitaly Kuznetsov 
Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/connection.c   |   17 -
 drivers/hv/hyperv_vmbus.h |1 +
 drivers/hv/vmbus_drv.c|6 ++
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index a63a795..c4acd1c 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -216,10 +216,21 @@ int vmbus_connect(void)
 
 cleanup:
pr_err("Unable to connect to host\n");
+
vmbus_connection.conn_state = DISCONNECTED;
+   vmbus_disconnect();
+
+   kfree(msginfo);
+
+   return ret;
+}
 
-   if (vmbus_connection.work_queue)
+void vmbus_disconnect(void)
+{
+   if (vmbus_connection.work_queue) {
+   drain_workqueue(vmbus_connection.work_queue);
destroy_workqueue(vmbus_connection.work_queue);
+   }
 
if (vmbus_connection.int_page) {
free_pages((unsigned long)vmbus_connection.int_page, 0);
@@ -230,10 +241,6 @@ cleanup:
free_pages((unsigned long)vmbus_connection.monitor_pages[1], 0);
vmbus_connection.monitor_pages[0] = NULL;
vmbus_connection.monitor_pages[1] = NULL;
-
-   kfree(msginfo);
-
-   return ret;
 }
 
 /*
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 44b1c94..6cf2de9 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -692,6 +692,7 @@ void vmbus_free_channels(void);
 /* Connection interface */
 
 int vmbus_connect(void);
+void vmbus_disconnect(void);
 
 int vmbus_post_msg(void *buffer, size_t buflen);
 
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index aebc8fe..3b304b9 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -571,6 +571,10 @@ static void vmbus_onmessage_work(struct work_struct *work)
 {
struct onmessage_work_context *ctx;
 
+   /* Do not process messages if we're in DISCONNECTED state */
+   if (vmbus_connection.conn_state == DISCONNECTED)
+   return;
+
ctx = container_of(work, struct onmessage_work_context,
   work);
vmbus_onmessage(&ctx->msg);
@@ -1094,12 +1098,14 @@ cleanup:
 
 static void __exit vmbus_exit(void)
 {
+   vmbus_connection.conn_state = DISCONNECTED;
hv_remove_vmbus_irq();
vmbus_free_channels();
bus_unregister(&hv_bus);
hv_cleanup();
acpi_bus_unregister_driver(&vmbus_acpi_driver);
hv_cpu_hotplug_quirk(false);
+   vmbus_disconnect();
 }
 
 
-- 
1.7.4.1

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


[PATCH RESEND 8/8] Drivers: hv: vmbus: Teardown clockevent devices on module unload

2015-01-27 Thread K. Y. Srinivasan
From: Vitaly Kuznetsov <[mailto:vkuzn...@redhat.com]>

Newly introduced clockevent devices made it impossible to unload hv_vmbus
module as clockevents_config_and_register() takes additional reverence to
the module. To make it possible again we do the following:
- avoid setting dev->owner for clockevent devices;
- implement hv_synic_clockevents_cleanup() doing clockevents_unbind_device();
- call it from vmbus_exit().

In theory hv_synic_clockevents_cleanup() can be merged with hv_synic_cleanup(),
however, we call hv_synic_cleanup() from smp_call_function_single() and this
doesn't work for clockevents_unbind_device() as it does such call on its own. I
opted for a separate function.

Signed-off-by: Vitaly Kuznetsov 
Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/hv.c   |   25 -
 drivers/hv/hyperv_vmbus.h |2 ++
 drivers/hv/vmbus_drv.c|1 +
 3 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 39531dc..d3943bc 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -312,7 +312,11 @@ static void hv_init_clockevent_device(struct 
clock_event_device *dev, int cpu)
dev->features = CLOCK_EVT_FEAT_ONESHOT;
dev->cpumask = cpumask_of(cpu);
dev->rating = 1000;
-   dev->owner = THIS_MODULE;
+   /*
+* Avoid settint dev->owner = THIS_MODULE deliberately as doing so will
+* result in clockevents_config_and_register() taking additional
+* references to the hv_vmbus module making it impossible to unload.
+*/
 
dev->set_mode = hv_ce_setmode;
dev->set_next_event = hv_ce_set_next_event;
@@ -470,6 +474,20 @@ void hv_synic_init(void *arg)
 }
 
 /*
+ * hv_synic_clockevents_cleanup - Cleanup clockevent devices
+ */
+void hv_synic_clockevents_cleanup(void)
+{
+   int cpu;
+
+   if (!(ms_hyperv.features & HV_X64_MSR_SYNTIMER_AVAILABLE))
+   return;
+
+   for_each_online_cpu(cpu)
+   clockevents_unbind_device(hv_context.clk_evt[cpu], cpu);
+}
+
+/*
  * hv_synic_cleanup - Cleanup routine for hv_synic_init().
  */
 void hv_synic_cleanup(void *arg)
@@ -483,6 +501,11 @@ void hv_synic_cleanup(void *arg)
if (!hv_context.synic_initialized)
return;
 
+   /* Turn off clockevent device */
+   if (ms_hyperv.features & HV_X64_MSR_SYNTIMER_AVAILABLE)
+   hv_ce_setmode(CLOCK_EVT_MODE_SHUTDOWN,
+ hv_context.clk_evt[cpu]);
+
rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
 
shared_sint.masked = 1;
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 6cf2de9..b055e53 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -572,6 +572,8 @@ extern void hv_synic_init(void *irqarg);
 
 extern void hv_synic_cleanup(void *arg);
 
+extern void hv_synic_clockevents_cleanup(void);
+
 /*
  * Host version information.
  */
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 8ff6f69..2de170a 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1101,6 +1101,7 @@ static void __exit vmbus_exit(void)
int cpu;
 
vmbus_connection.conn_state = DISCONNECTED;
+   hv_synic_clockevents_cleanup();
hv_remove_vmbus_irq();
vmbus_free_channels();
bus_unregister(&hv_bus);
-- 
1.7.4.1

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


[PATCH RESEND 6/8] drivers: hv: vmbus: Teardown synthetic interrupt controllers on module unload

2015-01-27 Thread K. Y. Srinivasan
From: Vitaly Kuznetsov <[mailto:vkuzn...@redhat.com]>

SynIC has to be switched off when we unload the module, otherwise registered
memory pages can get corrupted after (as Hyper-V host still writes there) and
we see the following crashes for random processes:

[   89.116774] BUG: Bad page map in process sh  pte:4989c716 pmd:36f81067
[   89.159454] addr:00437000 vm_flags:0875 anon_vma:  
(null) mapping:88007bba55a0 index:37
[   89.226146] vma->vm_ops->fault: filemap_fault+0x0/0x410
[   89.257776] vma->vm_file->f_op->mmap: generic_file_mmap+0x0/0x60
[   89.297570] CPU: 0 PID: 215 Comm: sh Tainted: GB  
3.19.0-rc5_bug923184+ #488
[   89.353738] Hardware name: Microsoft Corporation Virtual Machine/Virtual 
Machine, BIOS 090006  05/23/2012
[   89.409138]   4e083d7b 880036e9fa18 
81a68d31
[   89.468724]   00437000 880036e9fa68 
811a1e3a
[   89.519233]  4989c716 0037 ea0001edc340 
00437000
[   89.575751] Call Trace:
[   89.591060]  [] dump_stack+0x45/0x57
[   89.625164]  [] print_bad_pte+0x1aa/0x250
[   89.667234]  [] vm_normal_page+0x55/0xa0
[   89.703818]  [] unmap_page_range+0x425/0x8a0
[   89.737982]  [] unmap_single_vma+0x81/0xf0
[   89.780385]  [] ? lru_deactivate_fn+0x190/0x190
[   89.820130]  [] unmap_vmas+0x51/0xa0
[   89.860168]  [] exit_mmap+0xac/0x1a0
[   89.890588]  [] mmput+0x63/0x100
[   89.919205]  [] flush_old_exec+0x3f8/0x8b0
[   89.962135]  [] load_elf_binary+0x32b/0x1260
[   89.998581]  [] ? get_user_pages+0x52/0x60

hv_synic_cleanup() function exists but noone calls it now. Do the following:
- call hv_synic_cleanup() on each cpu from vmbus_exit();
- write global disable bit through MSR;
- use hv_synic_free_cpu() to avoid memory leask and code duplication.

Signed-off-by: Vitaly Kuznetsov 
Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/hv.c|9 +++--
 drivers/hv/vmbus_drv.c |4 
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 50e51a5..39531dc 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -477,6 +477,7 @@ void hv_synic_cleanup(void *arg)
union hv_synic_sint shared_sint;
union hv_synic_simp simp;
union hv_synic_siefp siefp;
+   union hv_synic_scontrol sctrl;
int cpu = smp_processor_id();
 
if (!hv_context.synic_initialized)
@@ -502,6 +503,10 @@ void hv_synic_cleanup(void *arg)
 
wrmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64);
 
-   free_page((unsigned long)hv_context.synic_message_page[cpu]);
-   free_page((unsigned long)hv_context.synic_event_page[cpu]);
+   /* Disable the global synic bit */
+   rdmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64);
+   sctrl.enable = 0;
+   wrmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64);
+
+   hv_synic_free_cpu(cpu);
 }
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 3b304b9..8ff6f69 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1098,11 +1098,15 @@ cleanup:
 
 static void __exit vmbus_exit(void)
 {
+   int cpu;
+
vmbus_connection.conn_state = DISCONNECTED;
hv_remove_vmbus_irq();
vmbus_free_channels();
bus_unregister(&hv_bus);
hv_cleanup();
+   for_each_online_cpu(cpu)
+   smp_call_function_single(cpu, hv_synic_cleanup, NULL, 1);
acpi_bus_unregister_driver(&vmbus_acpi_driver);
hv_cpu_hotplug_quirk(false);
vmbus_disconnect();
-- 
1.7.4.1

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


Re: [PATCH] staging: iio: adc: mxs-lradc: Change type in printf format string

2015-01-27 Thread Marek Vasut
On Tuesday, January 27, 2015 at 11:23:33 PM, Rickard Strandqvist wrote:
> Wrong type in printf format string, requires 'int'
> but the argument type is 'unsigned int'
> 
> This was found using a static code analysis program called cppcheck
> 
> Signed-off-by: Rickard Strandqvist 

Makes sense, thanks!

Reviewed-by: Marek Vasut 

Best regards,
Marek Vasut
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3.18 39/61] x86, hyperv: Mark the Hyper-V clocksource as being continuous

2015-01-27 Thread Greg Kroah-Hartman
3.18-stable review patch.  If anyone has any objections, please let me know.

--

From: "K. Y. Srinivasan" 

commit 32c6590d126836a062b3140ed52d898507987017 upstream.

The Hyper-V clocksource is continuous; mark it accordingly.

Signed-off-by: K. Y. Srinivasan 
Acked-by: jasow...@redhat.com
Cc: gre...@linuxfoundation.org
Cc: de...@linuxdriverproject.org
Cc: o...@aepfle.de
Cc: a...@canonical.com
Link: 
http://lkml.kernel.org/r/1421108762-3331-1-git-send-email-...@microsoft.com
Signed-off-by: Thomas Gleixner 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/x86/kernel/cpu/mshyperv.c |1 +
 1 file changed, 1 insertion(+)

--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -107,6 +107,7 @@ static struct clocksource hyperv_cs = {
.rating = 400, /* use this when running on Hyperv*/
.read   = read_hv_clock,
.mask   = CLOCKSOURCE_MASK(64),
+   .flags  = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
 static void __init ms_hyperv_init_platform(void)


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


[PATCH 3.10 16/32] x86, hyperv: Mark the Hyper-V clocksource as being continuous

2015-01-27 Thread Greg Kroah-Hartman
3.10-stable review patch.  If anyone has any objections, please let me know.

--

From: "K. Y. Srinivasan" 

commit 32c6590d126836a062b3140ed52d898507987017 upstream.

The Hyper-V clocksource is continuous; mark it accordingly.

Signed-off-by: K. Y. Srinivasan 
Acked-by: jasow...@redhat.com
Cc: gre...@linuxfoundation.org
Cc: de...@linuxdriverproject.org
Cc: o...@aepfle.de
Cc: a...@canonical.com
Link: 
http://lkml.kernel.org/r/1421108762-3331-1-git-send-email-...@microsoft.com
Signed-off-by: Thomas Gleixner 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/x86/kernel/cpu/mshyperv.c |1 +
 1 file changed, 1 insertion(+)

--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -60,6 +60,7 @@ static struct clocksource hyperv_cs = {
.rating = 400, /* use this when running on Hyperv*/
.read   = read_hv_clock,
.mask   = CLOCKSOURCE_MASK(64),
+   .flags  = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
 static void __init ms_hyperv_init_platform(void)


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


[PATCH 3.14 23/77] x86, hyperv: Mark the Hyper-V clocksource as being continuous

2015-01-27 Thread Greg Kroah-Hartman
3.14-stable review patch.  If anyone has any objections, please let me know.

--

From: "K. Y. Srinivasan" 

commit 32c6590d126836a062b3140ed52d898507987017 upstream.

The Hyper-V clocksource is continuous; mark it accordingly.

Signed-off-by: K. Y. Srinivasan 
Acked-by: jasow...@redhat.com
Cc: gre...@linuxfoundation.org
Cc: de...@linuxdriverproject.org
Cc: o...@aepfle.de
Cc: a...@canonical.com
Link: 
http://lkml.kernel.org/r/1421108762-3331-1-git-send-email-...@microsoft.com
Signed-off-by: Thomas Gleixner 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/x86/kernel/cpu/mshyperv.c |1 +
 1 file changed, 1 insertion(+)

--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -67,6 +67,7 @@ static struct clocksource hyperv_cs = {
.rating = 400, /* use this when running on Hyperv*/
.read   = read_hv_clock,
.mask   = CLOCKSOURCE_MASK(64),
+   .flags  = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
 static void __init ms_hyperv_init_platform(void)


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


Re: [PATCH 1/4] staging: vt6655: correcting function declaration sparse error

2015-01-27 Thread Mathieu Poirier
On 25 January 2015 at 04:39, Greg KH  wrote:
> On Sat, Jan 17, 2015 at 07:04:23PM -0700, mathieu.poir...@linaro.org wrote:
>> From: Mathieu Poirier 
>>
>> mpoirier@t430:~/work/kernel1$ make C=1 M=drivers/staging/vt6655/
>>   LD  drivers/staging/vt6655/built-in.o
>>   CHECK   drivers/staging/vt6655/device_main.c
>> drivers/staging/vt6655/device_main.c:1672:5: warning: symbol 'vnt_init' was 
>> not declared. Should it be static?
>>   CC [M]  drivers/staging/vt6655/device_main.o
>>
>> Function @vnt_init is only called by @vt6655_probe, in turn is declared 
>> "static".
>> As sparse suggest, @vnt_init should very likely be declared static as well.  
>> At
>> least nothing in the file indicate that it should be otherwise.
>>
>> Signed-off-by: Mathieu Poirier 
>> ---
>>  drivers/staging/vt6655/device_main.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> This whole series does not apply to my staging-next branch, of
> staging.git, please refresh against it and resend if it is still needed
> (hint, I don't think they all are...)

Turns out none of them are necessary anymore.

Regards,
Mathieu

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


Re: make allyesconfig i386 build failure with next-20150122 (caused by fb_agm1264k-fl driver)

2015-01-27 Thread Guenter Roeck
On Thu, Jan 22, 2015 at 12:10:33PM -0700, Jim Davis wrote:
> make ARCH=i386 allyesconfig fails with
> 
> drivers/staging/built-in.o: In function `reset':
> (.text+0x2ae89d): multiple definition of `reset'
> drivers/isdn/built-in.o:(.text+0x185dc2): first defined here
> make[1]: *** [drivers/built-in.o] Error 1

Culprit:

commit b2ebd4be6fa1d2329b63531b044f9e25474981cb
Author: Thomas Petazzoni 
Date:   Wed Dec 31 10:11:10 2014 +0100

staging: fbtft: add fb_agm1264k-fl driver

A global function named 'reset' isn't really a good idea.

Not that the global function with the same name in the isdn code
is better ;-).

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