[PATCH] Staging: vt6655: fix missing blank line after variable declaration

2014-07-16 Thread Igor Bezukh
From: Igor bezukh 

Checkpatch fix - Add missing blank line after variable declaration

Signed-off-by: Igor Bezukh 
---
 drivers/staging/vt6655/card.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index e21abd8..0b2ca2f 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -351,6 +351,7 @@ s_vSetRSPINF(PSDevice pDevice, CARD_PHY_TYPE ePHYType, void 
*pvSupportRateIEs, v
 bool CARDbIsShortPreamble(void *pDeviceHandler)
 {
PSDevicepDevice = (PSDevice) pDeviceHandler;
+
if (pDevice->byPreambleType == 0)
return false;
 
@@ -372,6 +373,7 @@ bool CARDbIsShortPreamble(void *pDeviceHandler)
 bool CARDbIsShorSlotTime(void *pDeviceHandler)
 {
PSDevicepDevice = (PSDevice) pDeviceHandler;
+
return pDevice->bShortSlotTime;
 }
 
@@ -929,6 +931,7 @@ bool CARDbRadioPowerOn(void *pDeviceHandler)
 {
PSDevicepDevice = (PSDevice) pDeviceHandler;
bool bResult = true;
+
printk("chester power on\n");
if (pDevice->bRadioControlOff == true) {
if (pDevice->bHWRadioOff == true) printk("chester 
bHWRadioOff\n");
-- 
1.7.9.5

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


Re: XVME 6300 with TSI148 bridge on 64 bit Debian (Linux 3.2.57) vme_user issue

2014-07-16 Thread Martyn Welch



On 14/07/14 19:29, Maurice Moss wrote:

Hi all,

I have updated my Linux Kernel to the latest.  I am on Debian 64bit
3.15.5.  I issue the following Kernel command line, and the vme_user
module seems to load correctly, however the vme bus is neither mounted
on /dev nor /proc.



Just to make sure, you're looking under /dev/bus/vme?


I was earlier using a 3.2 debian 32bit and managed to mount the vme
bus by following the exact same procedure of rebuilding the kernel
with vme_user module.  Any help is appreciated.  Here is what I see on
dmesg.

[0.00] Kernel command line:
BOOT_IMAGE=/boot/vmlinuz-3.15.5-vme
root=UUID=4cdc2e84-9fbc-471c-9eb4-fde8f0b1ce96 ro vme_user.bus=0
vme_tsi148.err_chk=1 quiet
[1.754278] vme_user: VME User Space Access Driver
[1.754695] vme_tsi148 :04:04.0: Board is the VME system controller
[1.754700] vme_tsi148 :04:04.0: VME geographical address is 0
[1.754704] vme_tsi148 :04:04.0: VME Write and flush and error
check is enabled
[1.754942] vme_tsi148 :04:04.0: CR/CSR Offset: 0
[1.754948] vme_tsi148 :04:04.0: Enabling CR/CSR space

Cheers!



It's unfortunately going to take me a while to get everything together 
to take a look, some of my old installs I've been eeking along for a 
while to do adhoc VME tests are now broken :-(


Martyn


On Thu, Jul 3, 2014 at 8:18 AM, Maurice Moss  wrote:

Martyn,

OK.  I feel like I am not clear.  The kernel command line has a space,
but the line here in the email doesn't (I don't know how that
happened).  I am still stuck with the same issue.

Sorry for all the confusion


On Thu, Jul 3, 2014 at 8:15 AM, Maurice Moss  wrote:

Yes, copy and paste issue, I had double checked that right after I
sent you the mail.  Sorry!!

On Thu, Jul 3, 2014 at 3:47 AM, Martyn Welch  wrote:



On 03/07/14 00:47, Maurice Moss wrote:


I upgraded to linux kernel 3.14.9 (on Fedora).  Re-compiled the kernel
with the vme support etc.  I now get the below in my log, and don't
see any vme related files in /dev !!

[0.00] Kernel command line: BOOT_IMAGE=/vmlinuz-3.14.9
root=UUID=aee6e594-4be8-46d4-abe6-7c054ef239b0 ro
vconsole.font=latarcyrheb-sun16 vme_user.bus=0vme_tsi148.err_chk=1
rhgb quiet



Unless this is a copy and paste issue, you seem to be missing a space
between "vme_user.bus=0" and "vme_tsi148.err_chk=1".


Martyn

--
Martyn Welch (Lead Software Engineer)  | Registered in England and Wales
GE Intelligent Platforms   | (3828642) at 100 Barbirolli Square
T +44(0)1327322748 | Manchester, M2 3AB
E martyn.we...@ge.com  | VAT:GB 927559189


--
Martyn Welch (Lead Software Engineer)  | Registered in England and Wales
GE Intelligent Platforms   | (3828642) at 100 Barbirolli Square
T +44(0)1327322748 | Manchester, M2 3AB
E martyn.we...@ge.com  | VAT:GB 927559189
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/2] ARM: OMAP2+: remove DSP platform device

2014-07-16 Thread Tony Lindgren
* Kristina Martšenko  [140715 16:33]:
> It was added to support DSP Bridge. Since DSP Bridge was removed, and
> nothing else is using the platform device, remove it too.
> 
> Signed-off-by: Kristina Martšenko 
> Cc: Omar Ramirez Luna 
> Cc: Suman Anna 
> Cc: Felipe Contreras 

This should not affect idling the DSP hardware block either,
so Greg feel free to queue with the DSP removal patch:

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


Re: [PATCH 1/2] staging: tidspbridge: remove driver

2014-07-16 Thread Tony Lindgren
* Kristina Martšenko  [140716 02:33]:
> The driver has been broken and disabled for several kernel versions now.
> It doesn't have a maintainer anymore, and most of the people who've
> worked on it have moved on. There's also still a long list of issues in
> the TODO file before it can be moved out of staging. Until someone can
> put in the work to make the driver work again and move it out of
> staging, remove it from the kernel.
> 
> Signed-off-by: Kristina Martšenko 
> Cc: Omar Ramirez Luna 
> Cc: Suman Anna 
> Cc: Felipe Contreras 
> Cc: Ohad Ben-Cohen 

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


Re: [PATCH 02/28] staging: comedi: comedidev.h: introduce some 'range_is_external' helpers

2014-07-16 Thread Ian Abbott

On 2014-07-14 20:23, H Hartley Sweeten wrote:

The comedi_krange includes a flags member that currently identifies the
'units' of the range (RF_UNIT) and if the range is from an internal or
external source (RF_EXTERNAL).

Introduce some helper functions to check if a given range is from an
external source.

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

diff --git a/drivers/staging/comedi/comedidev.h 
b/drivers/staging/comedi/comedidev.h
index 83fd155..6af6467 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -363,6 +363,12 @@ static inline bool comedi_range_is_unipolar(struct 
comedi_subdevice *s,
return s->range_table->range[range].min >= 0;
  }

+static inline bool comedi_range_is_external(struct comedi_subdevice *s,
+   unsigned int range)
+{
+   return !!(s->range_table->range[range].flags & RF_EXTERNAL);
+}
+
  static inline bool comedi_chan_range_is_bipolar(struct comedi_subdevice *s,
unsigned int chan,
unsigned int range)
@@ -377,6 +383,13 @@ static inline bool comedi_chan_range_is_unipolar(struct 
comedi_subdevice *s,
return s->range_table_list[chan]->range[range].min >= 0;
  }

+static inline bool comedi_chan_range_is_external(struct comedi_subdevice *s,
+unsigned int chan,
+unsigned int range)
+{
+   return !!(s->range_table_list[chan]->range[range].flags & RF_EXTERNAL);
+}
+
  /* munge between offset binary and two's complement values */
  static inline unsigned int comedi_offset_munge(struct comedi_subdevice *s,
   unsigned int val)



Converting any value to _Bool (typedef'd to bool in ) 
automatically produces the value 0 or 1, so the "double logical NOT" 
operators are redundant here.  They're harmless though!


--
-=( Ian Abbott @ MEV Ltd.E-mail: )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 07/10] staging: unisys: fix chipsetready parsing

2014-07-16 Thread Dan Carpenter
On Tue, Jul 15, 2014 at 01:30:47PM -0400, Benjamin Romer wrote:
> + char msgtype[64];
> + int msgparam;
> +
> + if (sscanf(buf, "%64s %d", msgtype, &msgparam) == 2) {

The 64 in "%s64s" is off by one because of the NUL.

[ This is where I do my memory corruption preventing dance of success.
  I did that with my eyeballs, yo! *flex* *flex* ]

regards,
dan carpenter

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


Re: [PATCH 6/8 V2] staging: dgap: remove unneeded dgap_err()

2014-07-16 Thread DaeSeok Youn
2014-07-16 8:50 GMT+09:00 Greg KH :
> On Wed, Jul 16, 2014 at 08:21:30AM +0900, DaeSeok Youn wrote:
>> Hi,
>>
>> 2014-07-16 0:29 GMT+09:00 Greg KH :
>> > On Tue, Jul 15, 2014 at 06:11:44PM +0900, Daeseok Youn wrote:
>> >> The dgap_err() is printing a message with pr_err(),
>> >> so all those are replaced.
>> >>
>> >> Use definition "pr_fmt" and then all of "dgap:" in
>> >> the beginning of print messages are removed.
>> >>
>> >> And also removed "out of memory" message because
>> >> the kernel has own message for that.
>> >>
>> >> Signed-off-by: Daeseok Youn 
>> >> ---
>> >> V2: use pr_fmt "dgap:" prefix on print message on dgap.
>> >> remove "out of memory" message.
>> >>
>> >> Adds Mark to TO list and CC list for checking send
>> >> this email properly to him.
>> >>
>> >>  drivers/staging/dgap/dgap.c |  306 
>> >> +++
>> >>  1 files changed, 133 insertions(+), 173 deletions(-)
>> >>
>> >> diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
>> >> index 06c55cb..9e750fb 100644
>> >> --- a/drivers/staging/dgap/dgap.c
>> >> +++ b/drivers/staging/dgap/dgap.c
>> >> @@ -41,6 +41,8 @@
>> >>   */
>> >>  #undef DIGI_CONCENTRATORS_SUPPORTED
>> >>
>> >> +#define pr_fmt(fmt) "dgap: " fmt
>> >> +
>> >>  #include 
>> >>  #include 
>> >>  #include 
>> >> @@ -153,7 +155,6 @@ static void dgap_firmware_reset_port(struct channel_t 
>> >> *ch);
>> >>  static int dgap_gettok(char **in);
>> >>  static char *dgap_getword(char **in);
>> >>  static int dgap_checknode(struct cnode *p);
>> >> -static void dgap_err(char *s);
>> >>
>> >>  /*
>> >>   * Function prototypes from dgap_sysfs.h
>> >> @@ -815,7 +816,7 @@ static struct board_t *dgap_found_board(struct 
>> >> pci_dev *pdev, int id,
>> >>   if (ret)
>> >>   goto free_brd;
>> >>
>> >> - pr_info("dgap: board %d: %s (rev %d), irq %ld\n",
>> >> + pr_info("board %d: %s (rev %d), irq %ld\n",
>> >>   boardnum, brd->name, brd->rev, brd->irq);
>> >
>> > Almost all of the pr_*() calls in this driver should be converted over
>> > to use dev_*() calls instead.  And some of them, like this one, should
>> > be removed entirely (no need for a driver to be "noisy" when a device
>> > for it is found, it should be quiet if at all possible, unless something
>> > went wrong.)
>> >
>> > So can you do that here instead?  I've applied the earlier patches in
>> > this series, and stopped here.
>> OK. I can. pr_*() calls are replaced with dev_*() calls.
>> And also removes some of print message which are useless like "out
>> of memory"
>
> Yes, please do that, that would be great.
I have been working to change pr_*() to dev_*(), but dgap_parse() has no
"struct device" for using dev_*(). If dgap_parse still need for this driver,
it need to take a parameter for using dev_*(), it may be "pdev" but
configuration
file doesn't need to parse in kernel at all, dgap_parse() will be removed.

So I will wait to verify by Mark about parsing configuration file.

Thanks.

regards,
Daeseok Youn.

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


Re: [PATCH] Staging: vt6655: fix missing blank line after variable declaration

2014-07-16 Thread Dan Carpenter
On Wed, Jul 16, 2014 at 10:45:30AM +0300, Igor Bezukh wrote:
> From: Igor bezukh 

Just leave this line out.  The capitalization is wrong anyway.

regards,
dan carpenter

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


Re: [PATCH 00/28] staging: comedi: ni_mio_common: more cleanup

2014-07-16 Thread Ian Abbott

On 2014-07-14 20:23, H Hartley Sweeten wrote:

The ni_mio_common.c file is included by a number of National Instruments
drivers to provide the "common" driver support. This series does some
more cleanup to get the file closer to being changed into a module instead
of including it in the drivers.

H Hartley Sweeten (28):
   staging: comedi: mite.h: tidy up the mite channel register offsets
   staging: comedi: comedidev.h: introduce some 'range_is_external' helpers
   staging: comedi: ni_stc.h: remove 'ao_unipolar' flag from ni_board_struct
   staging: comedi: ni_mio_common: fix ni_ao_insn_write_671x()
   staging: comedi: ni_mio_common: remove ao_win_out() macro
   staging: comedi: ni_mio_common: fix ni_ao_insn_write()
   staging: comedi: ni_stc.h: add some 'is_{board type}' flags to private data
   staging: comedi: ni_mio_common: tidy up ni_ao_munge()
   staging: comedi: ni_mio_common: remove INSN_CONFIG_ANALOG_TRIG support code
   staging: comedi: ni_mio_common: remove some unnecessary boardinfo access
   staging: comedi: ni_mio_common: merge analog output (*insn_write) functions
   staging: comedi: ni_mio_common: remove ai_continuous from private data
   staging: comedi: ni_mio_common: fix ni_ao_insn_read()
   staging: comedi: ni_mio_common: remove unnecessary use of 'board->adbits'
   staging: comedi: ni_stc.h: refactor 'adbits' boardinfo
   staging: comedi: ni_stc.h: refactor 'aobits' boardinfo
   staging: comedi: ni_mio_common: (*cancel) only works with async cmd support
   staging: comedi: ni_mio_common: tidy up the Analog Input subdevice init
   staging: comedi: ni_mio_common: tidy up the Analog Output subdevice init
   staging: comedi: ni_mio_common: refactor 'num_p0_dio_channels' boardinfo
   staging: comedi: ni_mio_common: tidy up the Digital I/O subdevice init
   staging: comedi: ni_mio_common: init clock dividers early in ni_E_init()
   staging: comedi: ni_mio_common: only reset the ai/ao subdevices if they exist
   staging: comedi: ni_mio_common: tidy up the calibration subdevice init
   staging: comedi: ni_mio_common: tidy up the EEPROM subdevice init
   staging: comedi: ni_mio_common: tidy up the PFI subdevice init
   staging: comedi: ni_mio_common: tidy up the gpct counter subdevice init
   staging: comedi: ni_mio_common: tidy up the frequency output subdevice init

  drivers/staging/comedi/comedidev.h |  13 +
  drivers/staging/comedi/drivers/mite.h  | 106 +---
  drivers/staging/comedi/drivers/ni_atmio.c  |  44 +-
  drivers/staging/comedi/drivers/ni_mio_common.c | 753 +++--
  drivers/staging/comedi/drivers/ni_mio_cs.c |  24 +-
  drivers/staging/comedi/drivers/ni_pcimio.c | 289 --
  drivers/staging/comedi/drivers/ni_stc.h|  24 +-
  7 files changed, 508 insertions(+), 745 deletions(-)



Jolly good!

One thing you missed is simplifying ni_ao_config_chanlist(), 
ni_old_ao_config_chanlist() and ni_m_series_ao_config_chanlist() a 
little more by changing them to return 'void' and removing the 'invert' 
variable from ni_old_ao_config_chanlist().


Reviewed-by: Ian Abbott 

--
-=( Ian Abbott @ MEV Ltd.E-mail: )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 4/8] Drivers: scsi: storvsc: Filter WRITE_SAME_16

2014-07-16 Thread h...@infradead.org
On Sun, Jul 13, 2014 at 08:58:34AM -0400, Martin K. Petersen wrote:
> > "KY" == KY Srinivasan  writes:
> 
> KY> Windows hosts do support UNMAP and set the field in the
> KY> EVPD. However, since the host advertises SPC-2 compliance, Linux
> KY> does not even query the VPD page.
>  
> >> If we want to enable UNMAP in this case I'd prefer a blacklist entry
> >> than trying UNMAP despite the device not advertising it.
> 
> I agree with that. We could do something like the patch below.
> 
> However, I do think it's a good idea that you guys are looking into
> reporting SPC-3.

KY mentioned that they have a prototype for that now.

Btw, I looked over sd.c a bit more, and I think I understand why they
get the WRITE SAME commands now:

read_capacity_16 calls sd_config_discard(sdkp, SD_LBP_WS16) if the LPBME
bit is set.  At least older SBC drafts left it wide open if a target
supports WRITE SAME with UNMAP or UNMAP in this case.  So I think we'd
still want a patch to use UNMAP instead of WRITE SAME for this case,
which should also fix hyperv.  Below is the quick hack version of that
that just checks the host no_write_same flag, as the one on the device
isn't set yet - I guess we need to refactor some of that logic.


diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 87566b5..4480fdf 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2035,7 +2035,10 @@ static int read_capacity_16(struct scsi_disk *sdkp, 
struct scsi_device *sdp,
if (buffer[14] & 0x40) /* LBPRZ */
sdkp->lbprz = 1;
 
-   sd_config_discard(sdkp, SD_LBP_WS16);
+   if (sdp->host->no_write_same)
+   sd_config_discard(sdkp, SD_LBP_UNMAP);
+   else
+   sd_config_discard(sdkp, SD_LBP_WS16);
}
 
sdkp->capacity = lba + 1;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: question regarding drivers/staging/iio/adc/ad7280a.c

2014-07-16 Thread Lars-Peter Clausen

On 07/15/2014 07:31 PM, Jonathan Cameron wrote:

On 14/07/14 21:31, Himangi Saraogi wrote:

Hi,

The code seems to have a memory leak. The function ad7280_attr_init
calls kasprintf a number of times, which calls kmalloc (or more
precisely kmalloc_track_caller), but this data does not ever seem to
be freed. I propose to introduce a devm_  version of kasprintf, which
will be useful for other files also. I am not very sure that will it
be useful to introduce a bunch of kfrees, just to remove the memory
leaks immediately, but I think it would be safer just to devm
everything, so then one is sure that everything is freed as it should
be, in the right order.


The question here is whether such a memory leak squashing would be
worth applying to stable.  Personally I'd go with no. In which case
feel free to fix it via the introduction of a devm version.


devm is probably fine here.

The long term fix should be to switch the driver to use 
iio_chan_spec_ext_info infrastructure which will handle the allocation and 
freeing internally in the IIO framework.


- Lars

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


[PATCH] Staging: gdm724x: fix missing blank line after variable declaration

2014-07-16 Thread Kiran Padwal
From: Kiran Padwal 

Checkpatch fix - Add missing blank line after variable declaration

Signed-off-by:Kiran Padwal 

---
 drivers/staging/gdm724x/gdm_lte.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/gdm724x/gdm_lte.c 
b/drivers/staging/gdm724x/gdm_lte.c
index 64c55b9..bc6d574 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -447,6 +447,7 @@ static int gdm_lte_tx(struct sk_buff *skb, struct 
net_device *dev)
 */
if (nic_type & NIC_TYPE_F_VLAN) {
struct vlan_ethhdr *vlan_eth = (struct vlan_ethhdr *)skb->data;
+
nic->vlan_id = ntohs(vlan_eth->h_vlan_TCI) & VLAN_VID_MASK;
data_buf = skb->data + (VLAN_ETH_HLEN - ETH_HLEN);
data_len = skb->len - (VLAN_ETH_HLEN - ETH_HLEN);
@@ -505,6 +506,7 @@ static int gdm_lte_tx(struct sk_buff *skb, struct 
net_device *dev)
 static struct net_device_stats *gdm_lte_stats(struct net_device *dev)
 {
struct nic *nic = netdev_priv(dev);
+
return &nic->stats;
 }
 
-- 
1.7.9.5

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


Re: [PATCH 01/15] staging: comedi: ni_daq_700: remove unnecessary enable and flush of ADC

2014-07-16 Thread Ian Abbott

On 2014-07-15 01:20, H Hartley Sweeten wrote:

The ADC conversions are enabled and the FIFO is flushed by daq700_ai_config()
when the driver is initially attached. There is no reason to repeat the ADC
enable and flush the FIFO before each sample read in the (*insn_read).

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

diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c 
b/drivers/staging/comedi/drivers/ni_daq_700.c
index 5e472cb..4d5cb5a 100644
--- a/drivers/staging/comedi/drivers/ni_daq_700.c
+++ b/drivers/staging/comedi/drivers/ni_daq_700.c
@@ -169,11 +169,7 @@ static int daq700_ai_rinsn(struct comedi_device *dev,
/* convert n samples */
for (n = 0; n < insn->n; n++) {
/* trigger conversion with out0 L to H */
-   outb(0x00, dev->iobase + CMD_R2); /* enable ADC conversions */
outb(0x30, dev->iobase + CMO_R); /* mode 0 out0 L, from H */
-   outb(0x00, dev->iobase + ADCLEAR_R); /* clear the ADC FIFO */
-   /* read 16bit junk from FIFO to clear */
-   inw(dev->iobase + ADFIFO_R);
/* mode 1 out0 H, L to H, start conversion */
outb(0x32, dev->iobase + CMO_R);




I wouldn't be comfortable changing that - it looks important.  Could you 
run it past Fred Brooks?


--
-=( Ian Abbott @ MEV Ltd.E-mail: )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 02/15] staging: comedi: ni_daq_700: use 8253.h helpers for timer operations

2014-07-16 Thread Ian Abbott

On 2014-07-15 01:20, H Hartley Sweeten wrote:

Clarify the timer operations by using the helper functions in 8253.h.

For aesthetics, factor the "ai start conversion" code out of daq700_ai_rinsn().

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

diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c 
b/drivers/staging/comedi/drivers/ni_daq_700.c
index 4d5cb5a..16b52b6 100644
--- a/drivers/staging/comedi/drivers/ni_daq_700.c
+++ b/drivers/staging/comedi/drivers/ni_daq_700.c
@@ -51,11 +51,18 @@
  #include 
  #include 

-#include "../comedidev.h"
-
  #include 
  #include 

+#include "../comedidev.h"
+
+#include "8253.h"
+
+/*
+ * Regsiter I/O map
+ */


Typo :)

--
-=( Ian Abbott @ MEV Ltd.E-mail: )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 03/15] staging: comedi: ni_daq_700: fix daq700_dio_insn_config()

2014-07-16 Thread Ian Abbott

On 2014-07-15 01:21, H Hartley Sweeten wrote:

This board has 8 digital output and 8 digital input channels. The direction
of these channels is not configurable. For convienence all 16 channels are
packed into one DIO subdevice.

The (*insn_config) for this subdevice currently uses the comedi core provided
comedi_dio_insn_config() function to handle the instructions. This function
handles the INSN_CONFIG_DIO_INPUT and INSN_CONFIG_DIO_OUTPUT instructions
which are used to change the configuration of the channels. After calling
the core function, this driver "fixes" the subdevice io_bits and returns
success. These instructions should be returning -EINVAL since the channels
are not configurable.

Refactor the (*insn_config) to only handle the INSN_CONFIG_DIO_QUERY instruction
and return -EINVAL for all others.

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

diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c 
b/drivers/staging/comedi/drivers/ni_daq_700.c
index 16b52b6..ba22951 100644
--- a/drivers/staging/comedi/drivers/ni_daq_700.c
+++ b/drivers/staging/comedi/drivers/ni_daq_700.c
@@ -113,14 +113,19 @@ static int daq700_dio_insn_config(struct comedi_device 
*dev,
  struct comedi_insn *insn,
  unsigned int *data)
  {
-   int ret;
-
-   ret = comedi_dio_insn_config(dev, s, insn, data, 0);
-   if (ret)
-   return ret;
+   unsigned int mask = 1 << CR_CHAN(insn->chanspec);

-   /* The DIO channels are not configurable, fix the io_bits */
-   s->io_bits = 0x00ff;
+   /*
+* The DIO channels are not configurable, only the query instruction
+* is supported.
+*/
+   switch (data[0]) {
+   case INSN_CONFIG_DIO_QUERY:
+   data[1] = (s->io_bits & mask) ? COMEDI_OUTPUT : COMEDI_INPUT;
+   break;
+   default:
+   return -EINVAL;
+   }

return insn->n;
  }



DIO subdevices ought to be able to handle INSN_CONFIG_DIO_INPUT, 
INSN_CONFIG_DIO_OUTPUT and INSN_CONFIG_DIO_QUERY as a mimimum.  It could 
return an error if you try and configure a fixed output as an input for 
example:


ret = comedi_dio_insn_config(dev, s, insn, data, 0);
if (ret)
return ret;

if (s->io_bits != 0x00ff) {
/* The DIO channels are not configurable, fix the io_bits */

s->io_bits = 0x00ff;
return -EINVAL;
}

return insn->n;

--
-=( Ian Abbott @ MEV Ltd.E-mail: )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: comedi: adl_pci9118: a style issue fixed

2014-07-16 Thread Sam Asadi
'quoted string split across lines' warning in checkpatching fixed
by group whole string in one line.

Signed-off-by: Sam Asadi 
---
 drivers/staging/comedi/drivers/adl_pci9118.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 59a65cb..b2d25f5 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -412,8 +412,7 @@ static int check_channel_list(struct comedi_device *dev,
if ((CR_AREF(chanlist[i]) == AREF_DIFF) !=
(differencial)) {
comedi_error(dev,
-"Differencial and single ended "
-   "inputs can't be mixtured!");
+"Differencial and single ended 
inputs can't be mixtured!");
return 0;
}
if ((CR_RANGE(chanlist[i]) < PCI9118_BIPOLAR_RANGES) !=
--
1.7.10.4
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: gdm724x: fix missing blank line after variable declaration

2014-07-16 Thread Kiran Padwal
Checkpatch fix - Add missing blank line after variable declaration

Signed-off-by: Kiran Padwal 
---
 drivers/staging/gdm724x/gdm_tty.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/staging/gdm724x/gdm_tty.c 
b/drivers/staging/gdm724x/gdm_tty.c
index fe47cd3..001348c 100644
--- a/drivers/staging/gdm724x/gdm_tty.c
+++ b/drivers/staging/gdm724x/gdm_tty.c
@@ -111,24 +111,28 @@ static int gdm_tty_install(struct tty_driver *driver, 
struct tty_struct *tty)
 static int gdm_tty_open(struct tty_struct *tty, struct file *filp)
 {
struct gdm *gdm = tty->driver_data;
+
return tty_port_open(&gdm->port, tty, filp);
 }
 
 static void gdm_tty_cleanup(struct tty_struct *tty)
 {
struct gdm *gdm = tty->driver_data;
+
tty_port_put(&gdm->port);
 }
 
 static void gdm_tty_hangup(struct tty_struct *tty)
 {
struct gdm *gdm = tty->driver_data;
+
tty_port_hangup(&gdm->port);
 }
 
 static void gdm_tty_close(struct tty_struct *tty, struct file *filp)
 {
struct gdm *gdm = tty->driver_data;
+
tty_port_close(&gdm->port, tty, filp);
 }
 
@@ -139,6 +143,7 @@ static int gdm_tty_recv_complete(void *data,
 int complete)
 {
struct gdm *gdm = tty_dev->gdm[index];
+
if (!GDM_TTY_READY(gdm)) {
if (complete == RECV_PACKET_PROCESS_COMPLETE)
gdm_tty_recv(gdm, gdm_tty_recv_complete);
-- 
1.7.9.5

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


Re: [PATCH 7/8 RESEND] staging: dgap: introduce dgap_cleanup_nodes()

2014-07-16 Thread Mark Hounschell

On 07/15/2014 11:30 AM, Greg KH wrote:

On Tue, Jul 15, 2014 at 06:14:25PM +0900, Daeseok Youn wrote:

When a configration file is parsed with dgap_parsefile(),
makes nodes for saving configrations for board.


configuration files should not be parsed in the kernel at all.  That
logic should be removed as it should not be needed.

Mark, can you verify that this is not needed with your hardware anymore?



As far as I can see it is still needed. If no config file, no devices 
are created and configured. I had planned to remove that code such that 
all the different cards supported are still supported. Even though I 
only have 2 different types of cards. I Just haven't got to it yet. I 
realize "configuration files should not be parsed in the kernel" and I'm 
certainly not going to argue that. But the way it is, it allows user 
land to define board order and even device node names (additional links 
to the actual device). No matter where boards are installed and found by 
the kernel, you have persistent naming.  I guess all that can be done 
with udev (well, sort of anyway).


There are also options in the config file that should be passed in as 
module parameters

and I planned to do that part before messing with the config file code.

We also have this "DIGI_EXPANDERS_SUPPORTED" thingy. I have none of 
these cards. These cards interrogate the expander to find out how many 
ports there are. Then configure accordingly. Should we just remove all 
that code and NOT support expanders since we don't currently have the 
hardware to test?


I will update from your current git tree and test this week. I've been 
swamped lately and unable to do much. I thought I'd be available to do 
some more work but things come up as you know.


Regards
Mark

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


[PATCH v4 (staging-next) 1/5] staging:iio:hmc5843: Added regmap support

2014-07-16 Thread Josef Gajdusek
This patch changes hmc5843.c to use regmap. This provides transparent caching
to the code as well as abstraction necessary to add support for SPI-based
hmc5983.

Signed-off-by: Josef Gajdusek 
---
 drivers/staging/iio/magnetometer/Kconfig   |   1 +
 drivers/staging/iio/magnetometer/hmc5843.c | 140 +++--
 2 files changed, 96 insertions(+), 45 deletions(-)

diff --git a/drivers/staging/iio/magnetometer/Kconfig 
b/drivers/staging/iio/magnetometer/Kconfig
index 34634da..ad88d61 100644
--- a/drivers/staging/iio/magnetometer/Kconfig
+++ b/drivers/staging/iio/magnetometer/Kconfig
@@ -8,6 +8,7 @@ config SENSORS_HMC5843
depends on I2C
select IIO_BUFFER
select IIO_TRIGGERED_BUFFER
+   select REGMAP_I2C
help
  Say Y here to add support for the Honeywell HMC5843, HMC5883 and
  HMC5883L 3-Axis Magnetometer (digital compass).
diff --git a/drivers/staging/iio/magnetometer/hmc5843.c 
b/drivers/staging/iio/magnetometer/hmc5843.c
index f595fdc..6f06f98 100644
--- a/drivers/staging/iio/magnetometer/hmc5843.c
+++ b/drivers/staging/iio/magnetometer/hmc5843.c
@@ -21,6 +21,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -34,6 +35,7 @@
 #define HMC5843_DATA_OUT_MSB_REGS  0x03
 #define HMC5843_STATUS_REG 0x09
 #define HMC5843_ID_REG 0x0a
+#define HMC5843_ID_END 0x0c
 
 enum hmc5843_ids {
HMC5843_ID,
@@ -49,6 +51,7 @@ enum hmc5843_ids {
 #define HMC5843_RANGE_GAIN_OFFSET  0x05
 #define HMC5843_RANGE_GAIN_DEFAULT 0x01
 #define HMC5843_RANGE_GAINS8
+#define HMC5843_RANGE_GAIN_MASK0xe0
 
 /* Device status */
 #define HMC5843_DATA_READY 0x01
@@ -68,6 +71,7 @@ enum hmc5843_ids {
 #define HMC5843_RATE_OFFSET0x02
 #define HMC5843_RATE_DEFAULT   0x04
 #define HMC5843_RATES  7
+#define HMC5843_RATE_MASK  0x1c
 
 /* Device measurement configuration */
 #define HMC5843_MEAS_CONF_NORMAL   0x00
@@ -121,10 +125,7 @@ struct hmc5843_chip_info {
 struct hmc5843_data {
struct i2c_client *client;
struct mutex lock;
-   u8 rate;
-   u8 meas_conf;
-   u8 operating_mode;
-   u8 range;
+   struct regmap *regmap;
const struct hmc5843_chip_info *variant;
__be16 buffer[8]; /* 3x 16-bit channels + padding + 64-bit timestamp */
 };
@@ -135,10 +136,8 @@ static s32 hmc5843_set_mode(struct hmc5843_data *data, u8 
operating_mode)
int ret;
 
mutex_lock(&data->lock);
-   ret = i2c_smbus_write_byte_data(data->client, HMC5843_MODE_REG,
-   operating_mode & HMC5843_MODE_MASK);
-   if (ret >= 0)
-   data->operating_mode = operating_mode;
+   ret = regmap_update_bits(data->regmap, HMC5843_MODE_REG,
+   HMC5843_MODE_MASK, operating_mode);
mutex_unlock(&data->lock);
 
return ret;
@@ -146,15 +145,15 @@ static s32 hmc5843_set_mode(struct hmc5843_data *data, u8 
operating_mode)
 
 static int hmc5843_wait_measurement(struct hmc5843_data *data)
 {
-   s32 result;
int tries = 150;
+   int val;
+   int ret;
 
while (tries-- > 0) {
-   result = i2c_smbus_read_byte_data(data->client,
-   HMC5843_STATUS_REG);
-   if (result < 0)
-   return result;
-   if (result & HMC5843_DATA_READY)
+   ret = regmap_read(data->regmap, HMC5843_STATUS_REG, &val);
+   if (ret < 0)
+   return ret;
+   if (val & HMC5843_DATA_READY)
break;
msleep(20);
}
@@ -171,20 +170,20 @@ static int hmc5843_wait_measurement(struct hmc5843_data 
*data)
 static int hmc5843_read_measurement(struct hmc5843_data *data,
int idx, int *val)
 {
-   s32 result;
__be16 values[3];
+   int ret;
 
mutex_lock(&data->lock);
-   result = hmc5843_wait_measurement(data);
-   if (result < 0) {
+   ret = hmc5843_wait_measurement(data);
+   if (ret < 0) {
mutex_unlock(&data->lock);
-   return result;
+   return ret;
}
-   result = i2c_smbus_read_i2c_block_data(data->client,
-   HMC5843_DATA_OUT_MSB_REGS, sizeof(values), (u8 *) values);
+   ret = regmap_bulk_read(data->regmap, HMC5843_DATA_OUT_MSB_REGS,
+   values, sizeof(values));
mutex_unlock(&data->lock);
-   if (result < 0)
-   return -EINVAL;
+   if (ret < 0)
+   return ret;
 
*val = sign_extend32(be16_to_cpu(values[idx]), 15);
return IIO_VAL_INT;
@@ -208,16 +207,13 @@ static int hmc5843_read_measurement(struct hmc5843_data 
*data,
  * and BN.
  *
  *

[PATCH v4 (staging-next) 0/5] staging:iio:hmc5843: Few adjustments and support for hmc5983

2014-07-16 Thread Josef Gajdusek
This patch series modifies the hmc5843 driver to support the hmc5983 i2c and
spi interfaces.

v2:
* Reverted the changed order of iio unregister and setting hmc mode to 
sleep

v3:
* Fixed bug introduced in the first patch
* Readded few comment lines which have gone missing in the hmc5843.c ->
  hmc5843_core.c move

v4: 
* Changes suggested by Lars in https://lkml.org/lkml/2014/7/14/968
  * The i2c and spi drivers are now user-selectable with the core driver
being selected automatically
  * The regmap_config structs in both _spi and _i2c files are now static
  * The iio_dev allocation is now done in the common function
  * pm ops are now defined in the header file and the same definition is
shared between both interface-specific drivers
* regmap tables in hmc5843.h are not longer static (this fixed bunch of 
  variable not used warnings)

Rebased v4 on top of staging-next

Josef Gajdusek (5):
  staging:iio:hmc5843: Added regmap support
  staging:iio:hmc5843: Split hmc5843.c to multiple files
  staging:iio:hmc5843: register <-> value arrays now can have different
lengths
  staging:iio:hmc5843: Add support for i2c hmc5983
  staging:iio:hmc5843: Add support for spi hmc5983

 drivers/staging/iio/magnetometer/Kconfig|  30 +-
 drivers/staging/iio/magnetometer/Makefile   |   4 +-
 drivers/staging/iio/magnetometer/hmc5843.c  | 652 
 drivers/staging/iio/magnetometer/hmc5843.h  |  86 
 drivers/staging/iio/magnetometer/hmc5843_core.c | 638 +++
 drivers/staging/iio/magnetometer/hmc5843_i2c.c  |  74 +++
 drivers/staging/iio/magnetometer/hmc5843_spi.c  |  73 +++
 7 files changed, 900 insertions(+), 657 deletions(-)
 delete mode 100644 drivers/staging/iio/magnetometer/hmc5843.c
 create mode 100644 drivers/staging/iio/magnetometer/hmc5843.h
 create mode 100644 drivers/staging/iio/magnetometer/hmc5843_core.c
 create mode 100644 drivers/staging/iio/magnetometer/hmc5843_i2c.c
 create mode 100644 drivers/staging/iio/magnetometer/hmc5843_spi.c

-- 
1.8.5.5

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


[PATCH v4 (staging-next) 2/5] staging:iio:hmc5843: Split hmc5843.c to multiple files

2014-07-16 Thread Josef Gajdusek
This patch splits hmc5843.c to multiple files - the interface-agnostic
hmc5843_core.c, i2c specific hmc5843_i2c.c and header file hmc5843.h. This is
another step to add support of SPI-enabled hmc5983.

Signed-off-by: Josef Gajdusek 
---
 drivers/staging/iio/magnetometer/Kconfig   |  14 +-
 drivers/staging/iio/magnetometer/Makefile  |   3 +-
 drivers/staging/iio/magnetometer/hmc5843.h |  85 
 .../iio/magnetometer/{hmc5843.c => hmc5843_core.c} | 154 +
 drivers/staging/iio/magnetometer/hmc5843_i2c.c |  75 ++
 5 files changed, 203 insertions(+), 128 deletions(-)
 create mode 100644 drivers/staging/iio/magnetometer/hmc5843.h
 rename drivers/staging/iio/magnetometer/{hmc5843.c => hmc5843_core.c} (79%)
 create mode 100644 drivers/staging/iio/magnetometer/hmc5843_i2c.c

diff --git a/drivers/staging/iio/magnetometer/Kconfig 
b/drivers/staging/iio/magnetometer/Kconfig
index ad88d61..0a27f98 100644
--- a/drivers/staging/iio/magnetometer/Kconfig
+++ b/drivers/staging/iio/magnetometer/Kconfig
@@ -4,16 +4,22 @@
 menu "Magnetometer sensors"
 
 config SENSORS_HMC5843
-   tristate "Honeywell HMC5843/5883/5883L 3-Axis Magnetometer"
-   depends on I2C
+   tristate
select IIO_BUFFER
select IIO_TRIGGERED_BUFFER
+
+config SENSORS_HMC5843_I2C
+   tristate "Honeywell HMC5843/5883/5883L 3-Axis Magnetometer (I2C)"
+   depends on I2C
+   select SENSORS_HMC5843
select REGMAP_I2C
help
  Say Y here to add support for the Honeywell HMC5843, HMC5883 and
  HMC5883L 3-Axis Magnetometer (digital compass).
 
- To compile this driver as a module, choose M here: the module
- will be called hmc5843.
+ This driver can also be compiled as a set of modules.
+ If so, these modules will be created:
+ - hmc5843_core (core functions)
+ - hmc5843_i2c (support for HMC5843, HMC5883 and HMC5883L)
 
 endmenu
diff --git a/drivers/staging/iio/magnetometer/Makefile 
b/drivers/staging/iio/magnetometer/Makefile
index f9bfb2e..65baf1c 100644
--- a/drivers/staging/iio/magnetometer/Makefile
+++ b/drivers/staging/iio/magnetometer/Makefile
@@ -2,4 +2,5 @@
 # Makefile for industrial I/O Magnetometer sensors
 #
 
-obj-$(CONFIG_SENSORS_HMC5843)  += hmc5843.o
+obj-$(CONFIG_SENSORS_HMC5843)  += hmc5843_core.o
+obj-$(CONFIG_SENSORS_HMC5843_I2C)  += hmc5843_i2c.o
diff --git a/drivers/staging/iio/magnetometer/hmc5843.h 
b/drivers/staging/iio/magnetometer/hmc5843.h
new file mode 100644
index 000..0d9b02e
--- /dev/null
+++ b/drivers/staging/iio/magnetometer/hmc5843.h
@@ -0,0 +1,85 @@
+/*
+ * Header file for hmc5843 driver
+ *
+ * Split from hmc5843.c
+ * Copyright (C) Josef Gajdusek 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * */
+
+
+#ifndef HMC5843_CORE_H
+#define HMC5843_CORE_H
+
+#include 
+#include 
+
+#define HMC5843_CONFIG_REG_A   0x00
+#define HMC5843_CONFIG_REG_B   0x01
+#define HMC5843_MODE_REG   0x02
+#define HMC5843_DATA_OUT_MSB_REGS  0x03
+#define HMC5843_STATUS_REG 0x09
+#define HMC5843_ID_REG 0x0a
+#define HMC5843_ID_END 0x0c
+
+enum hmc5843_ids {
+   HMC5843_ID,
+   HMC5883_ID,
+   HMC5883L_ID,
+};
+
+struct hmc5843_data {
+   struct device *dev;
+   struct mutex lock;
+   struct regmap *regmap;
+   const struct hmc5843_chip_info *variant;
+   __be16 buffer[8]; /* 3x 16-bit channels + padding + 64-bit timestamp */
+};
+
+int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
+   enum hmc5843_ids id);
+int hmc5843_common_remove(struct device *dev);
+
+int hmc5843_common_suspend(struct device *dev);
+int hmc5843_common_resume(struct device *dev);
+
+#ifdef CONFIG_PM_SLEEP
+static SIMPLE_DEV_PM_OPS(hmc5843_pm_ops,
+   hmc5843_common_suspend,
+   hmc5843_common_resume);
+#define HMC5843_PM_OPS (&hmc5843_pm_ops)
+#else
+#define HMC5843_PM_OPS NULL
+#endif
+
+static const struct regmap_range hmc5843_readable_ranges[] = {
+   regmap_reg_range(0, HMC5843_ID_END),
+};
+
+struct regmap_access_table hmc5843_readable_table = {
+   .yes_ranges = hmc5843_readable_ranges,
+   .n_yes_ranges = ARRAY_SIZE(hmc5843_readable_ranges),
+};
+
+static const struct regmap_range hmc5843_writable_ranges[] = {
+   regmap_reg_range(0, HMC5843_MODE_REG),
+};
+
+struct regmap_access_table hmc5843_writable_table = {
+   .yes_ranges = hmc5843_writable_ranges,
+   .n_yes_ranges = ARRAY_SIZE(hmc5843_writable_ranges),
+};
+
+static const struct regmap_range hmc5843_volatile_ranges[] = {
+   regmap_reg_range(HMC5843_DATA_OUT_MSB_REGS, HMC5843_STATUS_R

[PATCH v4 (staging-next) 3/5] staging:iio:hmc5843: register <-> value arrays now can have different lengths

2014-07-16 Thread Josef Gajdusek
Changed structure of struct hmc5843_chip_info to include length of translation
arrays. Code previously using #defined constant has been changed accordingly.
This allows to integrate devices which do have different amounts of available
rates/scales.

Signed-off-by: Josef Gajdusek 
---
 drivers/staging/iio/magnetometer/hmc5843_core.c | 34 +
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/iio/magnetometer/hmc5843_core.c 
b/drivers/staging/iio/magnetometer/hmc5843_core.c
index bdeaf43..08fb0be 100644
--- a/drivers/staging/iio/magnetometer/hmc5843_core.c
+++ b/drivers/staging/iio/magnetometer/hmc5843_core.c
@@ -39,7 +39,6 @@
  */
 #define HMC5843_RANGE_GAIN_OFFSET  0x05
 #define HMC5843_RANGE_GAIN_DEFAULT 0x01
-#define HMC5843_RANGE_GAINS8
 #define HMC5843_RANGE_GAIN_MASK0xe0
 
 /* Device status */
@@ -59,7 +58,6 @@
  */
 #define HMC5843_RATE_OFFSET0x02
 #define HMC5843_RATE_DEFAULT   0x04
-#define HMC5843_RATES  7
 #define HMC5843_RATE_MASK  0x1c
 
 /* Device measurement configuration */
@@ -69,15 +67,15 @@
 #define HMC5843_MEAS_CONF_MASK 0x03
 
 /* Scaling factors: 1000/Gain */
-static const int hmc5843_regval_to_nanoscale[HMC5843_RANGE_GAINS] = {
+static const int hmc5843_regval_to_nanoscale[] = {
6173, 7692, 10309, 12821, 18868, 21739, 25641, 35714
 };
 
-static const int hmc5883_regval_to_nanoscale[HMC5843_RANGE_GAINS] = {
+static const int hmc5883_regval_to_nanoscale[] = {
7812, 9766, 13021, 16287, 24096, 27701, 32573, 45662
 };
 
-static const int hmc5883l_regval_to_nanoscale[HMC5843_RANGE_GAINS] = {
+static const int hmc5883l_regval_to_nanoscale[] = {
7299, 9174, 12195, 15152, 22727, 25641, 30303, 43478
 };
 
@@ -94,11 +92,11 @@ static const int 
hmc5883l_regval_to_nanoscale[HMC5843_RANGE_GAINS] = {
  * 6   | 50| 75
  * 7   | Not used  | Not used
  */
-static const int hmc5843_regval_to_samp_freq[7][2] = {
+static const int hmc5843_regval_to_samp_freq[][2] = {
{0, 50}, {1, 0}, {2, 0}, {5, 0}, {10, 0}, {20, 0}, {50, 0}
 };
 
-static const int hmc5883_regval_to_samp_freq[7][2] = {
+static const int hmc5883_regval_to_samp_freq[][2] = {
{0, 75}, {1, 50}, {3, 0}, {7, 50}, {15, 0}, {30, 0},
{75, 0}
 };
@@ -107,7 +105,9 @@ static const int hmc5883_regval_to_samp_freq[7][2] = {
 struct hmc5843_chip_info {
const struct iio_chan_spec *channels;
const int (*regval_to_samp_freq)[2];
+   const int n_regval_to_samp_freq;
const int *regval_to_nanoscale;
+   const int n_regval_to_nanoscale;
 };
 
 /* The lower two bits contain the current conversion mode */
@@ -248,7 +248,7 @@ static ssize_t hmc5843_show_samp_freq_avail(struct device 
*dev,
size_t len = 0;
int i;
 
-   for (i = 0; i < HMC5843_RATES; i++)
+   for (i = 0; i < data->variant->n_regval_to_samp_freq; i++)
len += scnprintf(buf + len, PAGE_SIZE - len,
"%d.%d ", data->variant->regval_to_samp_freq[i][0],
data->variant->regval_to_samp_freq[i][1]);
@@ -278,7 +278,7 @@ static int hmc5843_get_samp_freq_index(struct hmc5843_data 
*data,
 {
int i;
 
-   for (i = 0; i < HMC5843_RATES; i++)
+   for (i = 0; i < data->variant->n_regval_to_samp_freq; i++)
if (val == data->variant->regval_to_samp_freq[i][0] &&
val2 == data->variant->regval_to_samp_freq[i][1])
return i;
@@ -307,7 +307,7 @@ static ssize_t hmc5843_show_scale_avail(struct device *dev,
size_t len = 0;
int i;
 
-   for (i = 0; i < HMC5843_RANGE_GAINS; i++)
+   for (i = 0; i < data->variant->n_regval_to_nanoscale; i++)
len += scnprintf(buf + len, PAGE_SIZE - len,
"0.%09d ", data->variant->regval_to_nanoscale[i]);
 
@@ -327,7 +327,7 @@ static int hmc5843_get_scale_index(struct hmc5843_data 
*data, int val, int val2)
if (val != 0)
return -EINVAL;
 
-   for (i = 0; i < HMC5843_RANGE_GAINS; i++)
+   for (i = 0; i < data->variant->n_regval_to_nanoscale; i++)
if (val2 == data->variant->regval_to_nanoscale[i])
return i;
 
@@ -480,17 +480,29 @@ static const struct hmc5843_chip_info 
hmc5843_chip_info_tbl[] = {
[HMC5843_ID] = {
.channels = hmc5843_channels,
.regval_to_samp_freq = hmc5843_regval_to_samp_freq,
+   .n_regval_to_samp_freq =
+   ARRAY_SIZE(hmc5843_regval_to_samp_freq),
.regval_to_nanoscale = hmc5843_regval_to_nanoscale,
+   .n_regval_to_nanoscale =
+   ARRAY_SIZE(hmc5843_regval_to_nanoscale),
},
[HMC5883_ID] = {
 

[PATCH v4 (staging-next) 4/5] staging:iio:hmc5843: Add support for i2c hmc5983

2014-07-16 Thread Josef Gajdusek
This patch adds support for the hmc5983 i2c interface.
This chip is almost identical to the hmc5883. The difference being added
temperature compensation, additional available sample rate (220Hz) and an SPI
interface.

Signed-off-by: Josef Gajdusek 
---
 drivers/staging/iio/magnetometer/Kconfig|  2 +-
 drivers/staging/iio/magnetometer/hmc5843.h  |  1 +
 drivers/staging/iio/magnetometer/hmc5843_core.c | 20 +---
 drivers/staging/iio/magnetometer/hmc5843_i2c.c  |  6 --
 4 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/iio/magnetometer/Kconfig 
b/drivers/staging/iio/magnetometer/Kconfig
index 0a27f98..c086f33 100644
--- a/drivers/staging/iio/magnetometer/Kconfig
+++ b/drivers/staging/iio/magnetometer/Kconfig
@@ -20,6 +20,6 @@ config SENSORS_HMC5843_I2C
  This driver can also be compiled as a set of modules.
  If so, these modules will be created:
  - hmc5843_core (core functions)
- - hmc5843_i2c (support for HMC5843, HMC5883 and HMC5883L)
+ - hmc5843_i2c (support for HMC5843, HMC5883, HMC5883L and HMC5983)
 
 endmenu
diff --git a/drivers/staging/iio/magnetometer/hmc5843.h 
b/drivers/staging/iio/magnetometer/hmc5843.h
index 0d9b02e..204bf92 100644
--- a/drivers/staging/iio/magnetometer/hmc5843.h
+++ b/drivers/staging/iio/magnetometer/hmc5843.h
@@ -29,6 +29,7 @@ enum hmc5843_ids {
HMC5843_ID,
HMC5883_ID,
HMC5883L_ID,
+   HMC5983_ID,
 };
 
 struct hmc5843_data {
diff --git a/drivers/staging/iio/magnetometer/hmc5843_core.c 
b/drivers/staging/iio/magnetometer/hmc5843_core.c
index 08fb0be..914ae1a 100644
--- a/drivers/staging/iio/magnetometer/hmc5843_core.c
+++ b/drivers/staging/iio/magnetometer/hmc5843_core.c
@@ -101,6 +101,11 @@ static const int hmc5883_regval_to_samp_freq[][2] = {
{75, 0}
 };
 
+static const int hmc5983_regval_to_samp_freq[][2] = {
+   {0, 75}, {1, 50}, {3, 0}, {7, 50}, {15, 0}, {30, 0},
+   {75, 0}, {220, 0}
+};
+
 /* Describe chip variants */
 struct hmc5843_chip_info {
const struct iio_chan_spec *channels;
@@ -457,7 +462,7 @@ static const struct iio_chan_spec hmc5843_channels[] = {
IIO_CHAN_SOFT_TIMESTAMP(3),
 };
 
-/* Beware: Y and Z are exchanged on HMC5883 */
+/* Beware: Y and Z are exchanged on HMC5883 and 5983 */
 static const struct iio_chan_spec hmc5883_channels[] = {
HMC5843_CHANNEL(X, 0),
HMC5843_CHANNEL(Z, 1),
@@ -504,6 +509,15 @@ static const struct hmc5843_chip_info 
hmc5843_chip_info_tbl[] = {
.n_regval_to_nanoscale =
ARRAY_SIZE(hmc5883l_regval_to_nanoscale),
},
+   [HMC5983_ID] = {
+   .channels = hmc5883_channels,
+   .regval_to_samp_freq = hmc5983_regval_to_samp_freq,
+   .n_regval_to_samp_freq =
+   ARRAY_SIZE(hmc5983_regval_to_samp_freq),
+   .regval_to_nanoscale = hmc5883l_regval_to_nanoscale,
+   .n_regval_to_nanoscale =
+   ARRAY_SIZE(hmc5883l_regval_to_nanoscale),
+   }
 };
 
 static int hmc5843_init(struct hmc5843_data *data)
@@ -516,7 +530,7 @@ static int hmc5843_init(struct hmc5843_data *data)
if (ret < 0)
return ret;
if (id[0] != 'H' || id[1] != '4' || id[2] != '3') {
-   dev_err(data->dev, "no HMC5843/5883/5883L sensor\n");
+   dev_err(data->dev, "no HMC5843/5883/5883L/5983 sensor\n");
return -ENODEV;
}
 
@@ -620,5 +634,5 @@ int hmc5843_common_remove(struct device *dev)
 EXPORT_SYMBOL(hmc5843_common_remove);
 
 MODULE_AUTHOR("Shubhrajyoti Datta ");
-MODULE_DESCRIPTION("HMC5843/5883/5883L core driver");
+MODULE_DESCRIPTION("HMC5843/5883/5883L/5983 core driver");
 MODULE_LICENSE("GPL");
diff --git a/drivers/staging/iio/magnetometer/hmc5843_i2c.c 
b/drivers/staging/iio/magnetometer/hmc5843_i2c.c
index 20b5c93..10f0a23 100644
--- a/drivers/staging/iio/magnetometer/hmc5843_i2c.c
+++ b/drivers/staging/iio/magnetometer/hmc5843_i2c.c
@@ -1,5 +1,5 @@
 /*
- * i2c driver for hmc5843/5843/5883/5883l
+ * i2c driver for hmc5843/5843/5883/5883l/5983
  *
  * Split from hmc5843.c
  * Copyright (C) Josef Gajdusek 
@@ -46,6 +46,7 @@ static const struct i2c_device_id hmc5843_id[] = {
{ "hmc5843", HMC5843_ID },
{ "hmc5883", HMC5883_ID },
{ "hmc5883l", HMC5883L_ID },
+   { "hmc5983", HMC5983_ID },
{ }
 };
 MODULE_DEVICE_TABLE(i2c, hmc5843_id);
@@ -54,6 +55,7 @@ static const struct of_device_id hmc5843_of_match[] = {
{ .compatible = "honeywell,hmc5843", .data = (void *)HMC5843_ID },
{ .compatible = "honeywell,hmc5883", .data = (void *)HMC5883_ID },
{ .compatible = "honeywell,hmc5883l", .data = (void *)HMC5883L_ID },
+   { .compatible = "honeywell,hmc5983", .data = (void *)HMC5983_ID },
{}
 };
 MODULE_DEVICE_TABLE(of, hmc5843_of_match);
@@ -71,5 +73,5 @@ static struct i2c_driver

[PATCH v4 (staging-next) 5/5] staging:iio:hmc5843: Add support for spi hmc5983

2014-07-16 Thread Josef Gajdusek
This patch adds support for the hmc5983 spi interface.
This chip is almost identical to the hmc5883. The difference being added
temperature compensation, additional available sample rate (220Hz) and an SPI
interface.

Signed-off-by: Josef Gajdusek 
---
 drivers/staging/iio/magnetometer/Kconfig   | 15 ++
 drivers/staging/iio/magnetometer/Makefile  |  1 +
 drivers/staging/iio/magnetometer/hmc5843_spi.c | 73 ++
 3 files changed, 89 insertions(+)
 create mode 100644 drivers/staging/iio/magnetometer/hmc5843_spi.c

diff --git a/drivers/staging/iio/magnetometer/Kconfig 
b/drivers/staging/iio/magnetometer/Kconfig
index c086f33..dec814a 100644
--- a/drivers/staging/iio/magnetometer/Kconfig
+++ b/drivers/staging/iio/magnetometer/Kconfig
@@ -22,4 +22,19 @@ config SENSORS_HMC5843_I2C
  - hmc5843_core (core functions)
  - hmc5843_i2c (support for HMC5843, HMC5883, HMC5883L and HMC5983)
 
+config SENSORS_HMC5843_SPI
+   tristate "Honeywell HMC5983 3-Axis Magnetometer (SPI)"
+   depends on SPI_MASTER
+   select SENSORS_HMC5843
+   select REGMAP_SPI
+   help
+ Say Y here to add support for the Honeywell HMC5983 3-Axis 
Magnetometer
+ (digital compass).
+
+ This driver can also be compiled as a set of modules.
+ If so, these modules will be created:
+ - hmc5843_core (core functions)
+ - hmc5843_spi (support for HMC5983)
+
+
 endmenu
diff --git a/drivers/staging/iio/magnetometer/Makefile 
b/drivers/staging/iio/magnetometer/Makefile
index 65baf1c..33761a1 100644
--- a/drivers/staging/iio/magnetometer/Makefile
+++ b/drivers/staging/iio/magnetometer/Makefile
@@ -4,3 +4,4 @@
 
 obj-$(CONFIG_SENSORS_HMC5843)  += hmc5843_core.o
 obj-$(CONFIG_SENSORS_HMC5843_I2C)  += hmc5843_i2c.o
+obj-$(CONFIG_SENSORS_HMC5843_SPI)  += hmc5843_spi.o
diff --git a/drivers/staging/iio/magnetometer/hmc5843_spi.c 
b/drivers/staging/iio/magnetometer/hmc5843_spi.c
new file mode 100644
index 000..62964a4
--- /dev/null
+++ b/drivers/staging/iio/magnetometer/hmc5843_spi.c
@@ -0,0 +1,73 @@
+/*
+ * SPI driver for hmc5983
+ *
+ * Copyright (C) Josef Gajdusek 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * */
+
+#include 
+#include 
+#include 
+
+#include "hmc5843.h"
+
+static struct regmap_config hmc5843_spi_regmap_config = {
+   .reg_bits = 8,
+   .val_bits = 8,
+
+   .rd_table = &hmc5843_readable_table,
+   .wr_table = &hmc5843_writable_table,
+   .volatile_table = &hmc5843_volatile_table,
+
+   /* Autoincrement address pointer */
+   .read_flag_mask = 0xc0,
+
+   .cache_type = REGCACHE_RBTREE,
+};
+
+static int hmc5843_spi_probe(struct spi_device *spi)
+{
+   int ret;
+
+   spi->mode = SPI_MODE_3;
+   spi->max_speed_hz = 800;
+   spi->bits_per_word = 8;
+   ret = spi_setup(spi);
+   if (ret)
+   return ret;
+
+   return hmc5843_common_probe(&spi->dev,
+   devm_regmap_init_spi(spi, &hmc5843_spi_regmap_config),
+   HMC5983_ID);
+}
+
+static int hmc5843_spi_remove(struct spi_device *spi)
+{
+   return hmc5843_common_remove(&spi->dev);
+}
+
+static const struct spi_device_id hmc5843_id[] = {
+   { "hmc5983", HMC5983_ID },
+   { }
+};
+
+static struct spi_driver hmc5843_driver = {
+   .driver = {
+   .name = "hmc5843",
+   .pm = HMC5843_PM_OPS,
+   .owner = THIS_MODULE,
+   },
+   .id_table = hmc5843_id,
+   .probe = hmc5843_spi_probe,
+   .remove = hmc5843_spi_remove,
+};
+
+module_spi_driver(hmc5843_driver);
+
+MODULE_AUTHOR("Josef Gajdusek ");
+MODULE_DESCRIPTION("HMC5983 SPI driver");
+MODULE_LICENSE("GPL");
-- 
1.8.5.5

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


Re: [PATCH 02/10] staging: unisys: add toolaction to sysfs

2014-07-16 Thread Romer, Benjamin M
On Tue, 2014-07-15 at 21:50 -0700, Greg KH wrote:
> On Tue, Jul 15, 2014 at 01:30:42PM -0400, Benjamin Romer wrote:
> All sysfs files need a Documentation/ABI/ entry.  As this isn't in the
> "real" part of the kernel yet, just create the entries in the unisys/
> subdir and then when it moves out, we can move them to the "right" place
> in the tree.
> 
> Can you redo this patch with that entry?
> 

Of course. I'll add an ABI-documentation file to our subdir with all of
the documentation as the first patch in my resubmission.

> How can this not be true?  I tried to follow the code here, but it's
> horrid, why is this assigned in a work queue and not when the module
> starts up?

I'm not sure of the history or original purpose for the delayed
initialization, and it also looks like there are two different ways
defined in separate files for the channel to be assigned an address, so
what's there now is definitely overcomplicated. In addition to the
initialization fix, I'll move the channel address function into this
file and remove the other files to simplify things further.

> > +   U8 toolAction;
> > +
> > +   visorchannel_read(ControlVm_channel,
> > +   offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL,
> > +  ToolAction), &toolAction, sizeof(U8));
> > +   return scnprintf(buf, PAGE_SIZE, "%u\n", toolAction);
> > +   } else
> > +   return -ENODEV;
> > +}
> 
> Why would this sysfs file be created if there is not a device?  That's
> not how sysfs files work, it should only be present if the file has a
> value, and if not, it shouldn't be there.

I'll clean this up so that it works that way, and remove the extraneous
checks for the channel address. 

> Same goes for your other sysfs files in this patchset, you should never
> be return -ENODEV, you just shouldn't have created the file in the first
> place.  That makes your kernel code simpler, and hopefully, your
> userspace code easier too.

It will. :) I'll do a cleanup patch set first and then redo the proc
changeover set after that.

> thanks,
> 
> greg k-h

-- 
Ben Romer | Software Engineer |
Virtual Systems Development 

Unisys Corporation |  2476
Swedesford Rd |  Malvern, PA 19355
|  610-648-7140



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


RE: [PATCH] Drivers: hv: hv_fcopy: fix a race condition for SMP guest

2014-07-16 Thread KY Srinivasan


> -Original Message-
> From: Dexuan Cui [mailto:de...@microsoft.com]
> Sent: Wednesday, July 16, 2014 12:01 AM
> To: gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; driverdev-
> de...@linuxdriverproject.org; o...@aepfle.de; a...@canonical.com;
> jasow...@redhat.com
> Cc: KY Srinivasan; Haiyang Zhang
> Subject: [PATCH] Drivers: hv: hv_fcopy: fix a race condition for SMP guest
> 
> We should schedule the 5s "timer work" before starting the data transfer,
> otherwise, the data transfer code may finish so fast on another virtual cpu
> that when the code(fcopy_write()) trying to cancel the 5s "timer work" can
> occasionally fail because the "timer work" may haven't been scheduled yet
> and as a result the fcopy process will be aborted wrongly by
> fcopy_work_func() in 5s.
> 
> Thank Liz Zhang  for the initial investigation on the
> bug.
> 
> This addresses https://bugzilla.redhat.com/show_bug.cgi?id=1118123
> 
> Tested-by: Liz Zhang 
> Cc: K. Y. Srinivasan 
> Cc: Haiyang Zhang 
> Cc: sta...@vger.kernel.org
> Signed-off-by: Dexuan Cui 

Thanks Dexuan.
Signed-off-by: K. Y. Srinivasan 


K. Y

> ---
>  drivers/hv/hv_fcopy.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hv/hv_fcopy.c b/drivers/hv/hv_fcopy.c index
> eaaa3d8..23b2ce2 100644
> --- a/drivers/hv/hv_fcopy.c
> +++ b/drivers/hv/hv_fcopy.c
> @@ -246,8 +246,8 @@ void hv_fcopy_onchannelcallback(void *context)
>   /*
>* Send the information to the user-level daemon.
>*/
> - fcopy_send_data();
>   schedule_delayed_work(&fcopy_work, 5*HZ);
> + fcopy_send_data();
>   return;
>   }
>   icmsghdr->icflags = ICMSGHDRFLAG_TRANSACTION |
> ICMSGHDRFLAG_RESPONSE;
> --
> 1.9.1

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


Re: [PATCH 7/8 RESEND] staging: dgap: introduce dgap_cleanup_nodes()

2014-07-16 Thread Dan Carpenter
On Wed, Jul 16, 2014 at 08:39:33AM -0400, Mark Hounschell wrote:
> We also have this "DIGI_EXPANDERS_SUPPORTED" thingy. I have none of
> these cards. These cards interrogate the expander to find out how
> many ports there are. Then configure accordingly. Should we just
> remove all that code and NOT support expanders since we don't
> currently have the hardware to test?

Maybe eventually, but it's not like we have run out of other less
painfull cleanups that we can do right away.

regards,
dan carpenter

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


[PATCH] staging: xillybus: fix some coding style errors

2014-07-16 Thread Vincent Bernat
This includes:
 - keep "else" on the same line as the closing brace
 - don't use "else" after "return"
 - don't issue a message for an out-of-memory error
 - blank line after a declaration

Signed-off-by: Vincent Bernat 
---
 drivers/staging/xillybus/xillybus_core.c | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/xillybus/xillybus_core.c 
b/drivers/staging/xillybus/xillybus_core.c
index ab6502caa72c..2d59734744e5 100644
--- a/drivers/staging/xillybus/xillybus_core.c
+++ b/drivers/staging/xillybus/xillybus_core.c
@@ -138,7 +138,6 @@ irqreturn_t xillybus_isr(int irq, void *data)
 * guaranteed no interrupt will occur, but in theory, the cache
 * lines may not be updated. So a memory barrier is issued.
 */
-
smp_rmb();
 
buf = ep->msgbuf_addr;
@@ -546,8 +545,7 @@ static int xilly_setupchannels(struct xilly_endpoint *ep,
channel->rd_buffers = buffers;
rc = xilly_get_dma_buffers(ep, &rd_alloc, buffers,
   bufnum, bytebufsize);
-   }
-   else if (channelnum > 0) {
+   } else if (channelnum > 0) {
channel->num_wr_buffers = bufnum;
 
channel->seekable = seekable;
@@ -610,8 +608,8 @@ static void xilly_scan_idt(struct xilly_endpoint *endpoint,
"IDT device name list overflow. Aborting.\n");
idt_handle->chandesc = NULL;
return;
-   } else
-   idt_handle->chandesc = scan;
+   }
+   idt_handle->chandesc = scan;
 
len = endpoint->idtlen - (3 + ((int) (scan - idt)));
 
@@ -722,6 +720,7 @@ static ssize_t xillybus_read(struct file *filp, char __user 
*userbuf,
 
while (1) { /* Note that we may drop mutex within this loop */
int bytes_to_do = count - bytes_done;
+
spin_lock_irqsave(&channel->wr_spinlock, flags);
 
empty = channel->wr_empty;
@@ -1963,10 +1962,8 @@ struct xilly_endpoint *xillybus_init_endpoint(struct 
pci_dev *pdev,
struct xilly_endpoint *endpoint;
 
endpoint = devm_kzalloc(dev, sizeof(*endpoint), GFP_KERNEL);
-   if (!endpoint) {
-   dev_err(dev, "Failed to allocate memory. Aborting.\n");
+   if (!endpoint)
return NULL;
-   }
 
endpoint->pdev = pdev;
endpoint->dev = dev;
-- 
2.0.1

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


Re: [PATCH] Staging: comedi: adl_pci9118: a style issue fixed

2014-07-16 Thread Joe Perches
On Wed, 2014-07-16 at 15:24 +0300, Sam Asadi wrote:
> 'quoted string split across lines' warning in checkpatching fixed
> by group whole string in one line.
[]
> diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
> b/drivers/staging/comedi/drivers/adl_pci9118.c
[]
> @@ -412,8 +412,7 @@ static int check_channel_list(struct comedi_device *dev,
>   if ((CR_AREF(chanlist[i]) == AREF_DIFF) !=
>   (differencial)) {
>   comedi_error(dev,
> -  "Differencial and single ended "
> - "inputs can't be mixtured!");
> +  "Differencial and single ended 
> inputs can't be mixtured!");

Might as well fix the fractured misspellings too.


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


Re: [PATCH 6/8 V2] staging: dgap: remove unneeded dgap_err()

2014-07-16 Thread Mark Hounschell

On 07/16/2014 05:26 AM, DaeSeok Youn wrote:

2014-07-16 8:50 GMT+09:00 Greg KH :

On Wed, Jul 16, 2014 at 08:21:30AM +0900, DaeSeok Youn wrote:

Hi,

2014-07-16 0:29 GMT+09:00 Greg KH :

On Tue, Jul 15, 2014 at 06:11:44PM +0900, Daeseok Youn wrote:

The dgap_err() is printing a message with pr_err(),
so all those are replaced.

Use definition "pr_fmt" and then all of "dgap:" in
the beginning of print messages are removed.

And also removed "out of memory" message because
the kernel has own message for that.

Signed-off-by: Daeseok Youn 
---
V2: use pr_fmt "dgap:" prefix on print message on dgap.
 remove "out of memory" message.

 Adds Mark to TO list and CC list for checking send
 this email properly to him.

  drivers/staging/dgap/dgap.c |  306 +++
  1 files changed, 133 insertions(+), 173 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 06c55cb..9e750fb 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -41,6 +41,8 @@
   */
  #undef DIGI_CONCENTRATORS_SUPPORTED

+#define pr_fmt(fmt) "dgap: " fmt
+
  #include 
  #include 
  #include 
@@ -153,7 +155,6 @@ static void dgap_firmware_reset_port(struct channel_t *ch);
  static int dgap_gettok(char **in);
  static char *dgap_getword(char **in);
  static int dgap_checknode(struct cnode *p);
-static void dgap_err(char *s);

  /*
   * Function prototypes from dgap_sysfs.h
@@ -815,7 +816,7 @@ static struct board_t *dgap_found_board(struct pci_dev 
*pdev, int id,
   if (ret)
   goto free_brd;

- pr_info("dgap: board %d: %s (rev %d), irq %ld\n",
+ pr_info("board %d: %s (rev %d), irq %ld\n",
   boardnum, brd->name, brd->rev, brd->irq);


Almost all of the pr_*() calls in this driver should be converted over
to use dev_*() calls instead.  And some of them, like this one, should
be removed entirely (no need for a driver to be "noisy" when a device
for it is found, it should be quiet if at all possible, unless something
went wrong.)

So can you do that here instead?  I've applied the earlier patches in
this series, and stopped here.

OK. I can. pr_*() calls are replaced with dev_*() calls.
And also removes some of print message which are useless like "out
of memory"


Yes, please do that, that would be great.

I have been working to change pr_*() to dev_*(), but dgap_parse() has no
"struct device" for using dev_*(). If dgap_parse still need for this driver,
it need to take a parameter for using dev_*(), it may be "pdev" but
configuration
file doesn't need to parse in kernel at all, dgap_parse() will be removed.

So I will wait to verify by Mark about parsing configuration file.

Thanks.

regards,
Daeseok Youn.



Hi Daeseok,

I would wait on that one for now. I know that code has to be removed 
eventually. I'm just not sure if we are quite ready. That is actually a 
LOT of lines of code also. I think a couple of things need done first.


Here is a sample config file created by one of DIGI's user land 
applications (mpi). These entries are only for 2 different cards. There 
are others cards that may have other things to consider. I only have 
these 2 cards types now. I had a third type which is just a 2 port but 
that one is gone now.


config_begin
board   Digi_AccelePort_8r_920_PCI
io 0x000
mem 0x00
start 1
nports 8
ttyname ttya
altpin 0
useintr 0
board   Digi_AccelePort_4r_920_PCI
io 0x000
mem 0x00
start 1
nports 4
ttyname ttyb
altpin 0
useintr 0
board   Digi_AccelePort_8r_920_PCI
io 0x000
mem 0x00
start 1
nports 8
ttyname ttyc
altpin 0
useintr 0
config_end

The altpin and useintr parameters need to be converted to module 
parameters. I found references in the code somewhere that the nports may 
not be reliably known using the device id for at least one card type. 
All the other stuff in this particular config file is pretty much 
useless. Well, sort of. The ttyname parameter is used by the driver to 
populate a "sys" file with a custom device name that is then used by a 
userland script and udev to allow a user  to define his own device 
names. Custom links are created. Perhaps this also would be nice to have 
as a module param?


Also, there is a userland utility (dpa) that is used to set some 
parameters of the card. Sort of like stty except it is for "special" 
things that the kernel does not directly support. Like special baud 
rates and such. I'm not sure what to do about that one. I personally 
have never used these "special" things but I'm sure they are used by 
someone somewhere?? I saw some code removed related to "dpa" recently. 
This came to mind.


Regards
Mark






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


Re: [PATCH 4/8] Drivers: scsi: storvsc: Filter WRITE_SAME_16

2014-07-16 Thread James Bottomley
On Wed, 2014-07-16 at 04:01 -0700, h...@infradead.org wrote:
> On Sun, Jul 13, 2014 at 08:58:34AM -0400, Martin K. Petersen wrote:
> > > "KY" == KY Srinivasan  writes:
> > 
> > KY> Windows hosts do support UNMAP and set the field in the
> > KY> EVPD. However, since the host advertises SPC-2 compliance, Linux
> > KY> does not even query the VPD page.
> >  
> > >> If we want to enable UNMAP in this case I'd prefer a blacklist entry
> > >> than trying UNMAP despite the device not advertising it.
> > 
> > I agree with that. We could do something like the patch below.
> > 
> > However, I do think it's a good idea that you guys are looking into
> > reporting SPC-3.
> 
> KY mentioned that they have a prototype for that now.
> 
> Btw, I looked over sd.c a bit more, and I think I understand why they
> get the WRITE SAME commands now:
> 
> read_capacity_16 calls sd_config_discard(sdkp, SD_LBP_WS16) if the LPBME
> bit is set.  At least older SBC drafts left it wide open if a target
> supports WRITE SAME with UNMAP or UNMAP in this case.  So I think we'd
> still want a patch to use UNMAP instead of WRITE SAME for this case,
> which should also fix hyperv.  Below is the quick hack version of that
> that just checks the host no_write_same flag, as the one on the device
> isn't set yet - I guess we need to refactor some of that logic.
> 
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 87566b5..4480fdf 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -2035,7 +2035,10 @@ static int read_capacity_16(struct scsi_disk *sdkp, 
> struct scsi_device *sdp,
>   if (buffer[14] & 0x40) /* LBPRZ */
>   sdkp->lbprz = 1;
>  
> - sd_config_discard(sdkp, SD_LBP_WS16);
> + if (sdp->host->no_write_same)
> + sd_config_discard(sdkp, SD_LBP_UNMAP);
> + else
> + sd_config_discard(sdkp, SD_LBP_WS16);

Right, I already said this was the problem: that was the reason for my
patch.  However, there are a couple of other cases (including the /sys
entry) which is why I patched sd_config_discard instead.

James

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


[PATCH 1/2] Staging: comedi: adl_pci9118: a style issue fixed

2014-07-16 Thread Sam Asadi
'quoted string split across lines' warning in checkpatching fixed
by group whole string in one line.

Signed-off-by: Sam Asadi 
---
 drivers/staging/comedi/drivers/adl_pci9118.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 59a65cb..b2d25f5 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -412,8 +412,7 @@ static int check_channel_list(struct comedi_device *dev,
if ((CR_AREF(chanlist[i]) == AREF_DIFF) !=
(differencial)) {
comedi_error(dev,
-"Differencial and single ended "
-   "inputs can't be mixtured!");
+"Differencial and single ended 
inputs can't be mixtured!");
return 0;
}
if ((CR_RANGE(chanlist[i]) < PCI9118_BIPOLAR_RANGES) !=
-- 
1.7.10.4

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


[PATCH 0/2] Staging: Comedi: adl_pci9118: 2 style issues fixed

2014-07-16 Thread Sam Asadi
2 style issues fixed: one misspelling & a quoted string split across lines.

Sam Asadi (2):
  Staging: comedi: adl_pci9118: a style issue fixed
  Staging: comedi: adl_pci9118: fractured spelling fixed

 drivers/staging/comedi/drivers/adl_pci9118.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

-- 
1.7.10.4

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


[PATCH 2/2] Staging: comedi: adl_pci9118: fractured spelling fixed

2014-07-16 Thread Sam Asadi
a fractured spelling in previous style issue fix mended.

Signed-off-by: Sam Asadi 
---
 drivers/staging/comedi/drivers/adl_pci9118.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index b2d25f5..f2a2d04 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -412,7 +412,7 @@ static int check_channel_list(struct comedi_device *dev,
if ((CR_AREF(chanlist[i]) == AREF_DIFF) !=
(differencial)) {
comedi_error(dev,
-"Differencial and single ended 
inputs can't be mixtured!");
+"Differential and single ended 
inputs can't be mixtured!");
return 0;
}
if ((CR_RANGE(chanlist[i]) < PCI9118_BIPOLAR_RANGES) !=
-- 
1.7.10.4

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


Re: [PATCH 1/2] staging: tidspbridge: remove driver

2014-07-16 Thread Suman Anna
On 07/15/2014 06:30 PM, Kristina Martšenko wrote:
> The driver has been broken and disabled for several kernel versions now.
> It doesn't have a maintainer anymore, and most of the people who've
> worked on it have moved on. There's also still a long list of issues in
> the TODO file before it can be moved out of staging. Until someone can
> put in the work to make the driver work again and move it out of
> staging, remove it from the kernel.
> 
> Signed-off-by: Kristina Martšenko 
> Cc: Omar Ramirez Luna 
> Cc: Suman Anna 
> Cc: Felipe Contreras 
> Cc: Ohad Ben-Cohen 

Acked-by: Suman Anna 

Thanks, I will refresh my OMAP mailbox framework adaptation series to
remove the adaptation changes done to the tidspbridge driver [1] to
avoid merge conflicts.

regards
Suman

[1] https://patchwork.kernel.org/patch/4538001/

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


Re: [PATCH 2/2] ARM: OMAP2+: remove DSP platform device

2014-07-16 Thread Suman Anna
On 07/15/2014 06:30 PM, Kristina Martšenko wrote:
> It was added to support DSP Bridge. Since DSP Bridge was removed, and
> nothing else is using the platform device, remove it too.
> 
> Signed-off-by: Kristina Martšenko 
> Cc: Omar Ramirez Luna 
> Cc: Suman Anna 
> Cc: Felipe Contreras 

Acked-by: Suman Anna 

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


Re: [PATCH 4/8] Drivers: scsi: storvsc: Filter WRITE_SAME_16

2014-07-16 Thread Martin K. Petersen
> "hch" == hch@infradead org  writes:

hch> read_capacity_16 calls sd_config_discard(sdkp, SD_LBP_WS16) if the
hch> LPBME bit is set.  At least older SBC drafts left it wide open if a
hch> target supports WRITE SAME with UNMAP or UNMAP in this case.

Correct.

hch> So I think we'd still want a patch to use UNMAP instead of WRITE
hch> SAME for this case, which should also fix hyperv. 

There are lots of devices out there that support WRITE SAME(10) or (16)
without the UNMAP bit. And there are devices that support WRITE SAME w/
UNMAP functionality but not "regular" WRITE SAME.

no_write_same is there to prevent the REQ_WRITE_SAME use case (for which
we have really weak heuristics). Your patch overloads no_write_same so
it also governs a REQ_DISCARD use case.

My proposed black list patch fixes the hyperv discard issue. So I don't
see why we'd need to overload no_write_same which was meant for an
entirely different purpose.

-- 
Martin K. Petersen  Oracle Linux Engineering
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V6 6/6] staging: vt6556: Replace printk by dev_warn

2014-07-16 Thread Peter Senna Tschudin
This patch fixes a checkpatch warning by replacing printk
by dev_warn. Tested by compilation only.

Signed-off-by: Peter Senna Tschudin 
---
Changes from V5
 - Refresh for staging-next of 16/07/2014

 drivers/staging/vt6656/main_usb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/vt6656/main_usb.c 
b/drivers/staging/vt6656/main_usb.c
index a3057da..c595a15 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -534,7 +534,8 @@ static void usb_device_reset(struct vnt_private *pDevice)
 
status = usb_reset_device(pDevice->usb);
if (status)
-printk("usb_device_reset fail status=%d\n",status);
+   dev_warn(&pDevice->usb->dev,
+"usb_device_reset fail status=%d\n", status);
return ;
 }
 
-- 
1.9.3

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


[PATCH V5 4/6] staging: vt6556: Remove typedefs

2014-07-16 Thread Peter Senna Tschudin
This patch removes uneeded typedefs reported by chackpatch and removes
one enum that is not in use. As checkpatch complained about the typedef
and the enum is not being used, this patch removes both typedef and enum.
The removed enum from card.h:

typedef enum _CARD_PHY_TYPE {
PHY_TYPE_AUTO = 0,
PHY_TYPE_11B,
PHY_TYPE_11G,
PHY_TYPE_11A
} CARD_PHY_TYPE, *PCARD_PHY_TYPE;

The following typedefs were removed, but enums were kept at device.h:

 typedef enum __device_msg_level
 typedef enum __DEVICE_NDIS_STATUS

Tested by compilation only.

Signed-off-by: Peter Senna Tschudin 
---
Cahnges from V4:
 - Updated commit message

 drivers/staging/vt6656/card.h   |  7 ---
 drivers/staging/vt6656/device.h | 17 -
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/vt6656/card.h b/drivers/staging/vt6656/card.h
index 80fcd53..03fc167 100644
--- a/drivers/staging/vt6656/card.h
+++ b/drivers/staging/vt6656/card.h
@@ -32,13 +32,6 @@
 
 /* init card type */
 
-typedef enum _CARD_PHY_TYPE {
-PHY_TYPE_AUTO = 0,
-PHY_TYPE_11B,
-PHY_TYPE_11G,
-PHY_TYPE_11A
-} CARD_PHY_TYPE, *PCARD_PHY_TYPE;
-
 #define CB_MAX_CHANNEL_24G 14
 #define CB_MAX_CHANNEL_5G  42 /* add channel9(5045MHz), 41==>42 */
 #define CB_MAX_CHANNEL (CB_MAX_CHANNEL_24G + CB_MAX_CHANNEL_5G)
diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index 50a6749..e3acf2f 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -187,13 +187,13 @@
 
 #define DBG_PRT(l, p, args...) { if (l <= msglevel) printk(p, ##args); }
 
-typedef enum __device_msg_level {
+enum {
MSG_LEVEL_ERR = 0,/* Errors causing abnormal operation */
MSG_LEVEL_NOTICE = 1, /* Errors needing user notification */
MSG_LEVEL_INFO = 2,   /* Normal message. */
MSG_LEVEL_VERBOSE = 3,/* Will report all trival errors. */
MSG_LEVEL_DEBUG = 4   /* Only for debug purpose. */
-} DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL;
+};
 
 #define DEVICE_INIT_COLD   0x0 /* cold init */
 #define DEVICE_INIT_RESET  0x1 /* reset init or Dx to D0 power remain */
@@ -268,13 +268,12 @@ struct vnt_interrupt_buffer {
 
 /*++ NDIS related */
 
-typedef enum __DEVICE_NDIS_STATUS {
-STATUS_SUCCESS = 0,
-STATUS_FAILURE,
-STATUS_RESOURCES,
-STATUS_PENDING,
-} DEVICE_NDIS_STATUS, *PDEVICE_NDIS_STATUS;
-
+enum {
+   STATUS_SUCCESS = 0,
+   STATUS_FAILURE,
+   STATUS_RESOURCES,
+   STATUS_PENDING,
+};
 
 /* flags for options */
 #define DEVICE_FLAGS_UNPLUG  0x0001UL
-- 
1.9.3

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


RE: [PATCH 00/28] staging: comedi: ni_mio_common: more cleanup

2014-07-16 Thread Hartley Sweeten
On Wednesday, July 16, 2014 3:54 AM, Ian Abbott wrote:
> On 2014-07-14 20:23, H Hartley Sweeten wrote:
>> The ni_mio_common.c file is included by a number of National Instruments
>> drivers to provide the "common" driver support. This series does some
>> more cleanup to get the file closer to being changed into a module instead
>> of including it in the drivers.
>
> Jolly good!
>
> One thing you missed is simplifying ni_ao_config_chanlist(), 
> ni_old_ao_config_chanlist() and ni_m_series_ao_config_chanlist() a 
> little more by changing them to return 'void' and removing the 'invert' 
> variable from ni_old_ao_config_chanlist().

The ni_mio_common stuff still needs additional cleanup. I'll get
around to tidying up the config_chanlist stuff eventually. ;-)

> Reviewed-by: Ian Abbott 

Thanks,
Hartley

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


RE: [PATCH 01/15] staging: comedi: ni_daq_700: remove unnecessary enable and flush of ADC

2014-07-16 Thread Hartley Sweeten
On Wednesday, July 16, 2014 4:35 AM, Ian Abbott wrote:
> On 2014-07-15 01:20, H Hartley Sweeten wrote:
>> The ADC conversions are enabled and the FIFO is flushed by daq700_ai_config()
>> when the driver is initially attached. There is no reason to repeat the ADC
>> enable and flush the FIFO before each sample read in the (*insn_read).
>>
>> Signed-off-by: H Hartley Sweeten 
>> Cc: Ian Abbott 
>> Cc: Greg Kroah-Hartman 
>
> I wouldn't be comfortable changing that - it looks important.  Could you 
> run it past Fred Brooks?

Greg,

Please drop this series until I can get some feedback from Fred Brooks.

Thanks,
Hartley

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


RE: [PATCH V3 1/7] Drivers: scsi: storvsc: Change the limits to reflect the values on the host

2014-07-16 Thread KY Srinivasan


> -Original Message-
> From: Hannes Reinecke [mailto:h...@suse.de]
> Sent: Monday, July 14, 2014 1:58 AM
> To: Christoph Hellwig
> Cc: KY Srinivasan; jasow...@redhat.com; a...@canonical.com; linux-
> ker...@vger.kernel.org; de...@linuxdriverproject.org; oher...@suse.com;
> jbottom...@parallels.com; linux-s...@vger.kernel.org;
> sta...@vger.kernel.org
> Subject: Re: [PATCH V3 1/7] Drivers: scsi: storvsc: Change the limits to 
> reflect
> the values on the host
> 
> On 07/14/2014 10:30 AM, Christoph Hellwig wrote:
> > On Mon, Jul 14, 2014 at 08:15:17AM +0200, Hannes Reinecke wrote:
> >> Limiting max_lun to 255 will make the driver to _not_ respond to LUNs
> >> higher than that; ie Well-known LUN won't work here.
> >> Also the SCSI stack will be using REPORT LUNS anyway since you're
> >> advertising SPC-2 compliance. So your driver runs into issues if
> >> Hyper-V would ever return more than 256 LUNs with the REPORT LUN
> >> command or if any of the LUNs has an addressing scheme other than
> >> '0x00'.
> >> I would suggest to raise this to the technical limit (ie the largest
> >> LUN which the _protocol_ supports) and let REPORT LUNS deal with the
> >> actual LUNs.
> >
> > I suspect hypverv doesn't support anything more.  For now I'd be
> > inclined to just put it in ASAP and if your suggestion works out fix
> > it up later, although I'll wait a bit for more review feedback.
> >
> Okay, that's fine by me.

Christoph,

Is this patch-set ready to be checked in. Let me know if you want me to make any
further corrections.

Regards,

K. Y
> 
> Cheers,
> 
> Hannes
> --
> Dr. Hannes Reinecke zSeries & Storage
> h...@suse.de+49 911 74053 688
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
> GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH V3 1/7] Drivers: scsi: storvsc: Change the limits to reflect the values on the host

2014-07-16 Thread Christoph Hellwig
On Wed, Jul 16, 2014 at 05:26:48PM +, KY Srinivasan wrote:
> Christoph,
> 
> Is this patch-set ready to be checked in. Let me know if you want me to make 
> any
> further corrections.

Hi Ky,

I've applied it locally, but I'm still waiting on reviews for two
important core fixes before pushing out the updated tree.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH V3 1/7] Drivers: scsi: storvsc: Change the limits to reflect the values on the host

2014-07-16 Thread KY Srinivasan


> -Original Message-
> From: Christoph Hellwig [mailto:h...@infradead.org]
> Sent: Wednesday, July 16, 2014 10:29 AM
> To: KY Srinivasan
> Cc: Hannes Reinecke; jasow...@redhat.com; a...@canonical.com; linux-
> ker...@vger.kernel.org; de...@linuxdriverproject.org; oher...@suse.com;
> jbottom...@parallels.com; linux-s...@vger.kernel.org;
> sta...@vger.kernel.org
> Subject: Re: [PATCH V3 1/7] Drivers: scsi: storvsc: Change the limits to 
> reflect
> the values on the host
> 
> On Wed, Jul 16, 2014 at 05:26:48PM +, KY Srinivasan wrote:
> > Christoph,
> >
> > Is this patch-set ready to be checked in. Let me know if you want me
> > to make any further corrections.
> 
> Hi Ky,
> 
> I've applied it locally, but I'm still waiting on reviews for two important 
> core
> fixes before pushing out the updated tree.

Thank you.

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


Re: [PATCH 4/8] Drivers: scsi: storvsc: Filter WRITE_SAME_16

2014-07-16 Thread h...@infradead.org
On Wed, Jul 16, 2014 at 11:44:18AM -0400, Martin K. Petersen wrote:
> There are lots of devices out there that support WRITE SAME(10) or (16)
> without the UNMAP bit. And there are devices that support WRITE SAME w/
> UNMAP functionality but not "regular" WRITE SAME.

Oh, we actually have devices that support WRITE SAME with unmap, but not
without?  That's defintively a little strange.

> no_write_same is there to prevent the REQ_WRITE_SAME use case (for which
> we have really weak heuristics). Your patch overloads no_write_same so
> it also governs a REQ_DISCARD use case.

Yes, and it did this intentionally.  I really wouldn't expect devices
to support WRITE SAME with UNMAP but blow up on a WRITE SAME without
it (and not just simple fail it in an orderly way).

> My proposed black list patch fixes the hyperv discard issue. So I don't
> see why we'd need to overload no_write_same which was meant for an
> entirely different purpose.

It definitively seems odd to default to trying WRITE SAME for unmap
for a device that explicitly tells us that it doesn't support WRITE
SAME.

Note that I'm not against your patch - I suspect forcing us to read
EVPD pages even for devices that claim to be SPC-2 will come in useful
in various scenarios.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 01/32] staging: comedi: comedi_fops: checkpatch.pl cleanup (else after return)

2014-07-16 Thread H Hartley Sweeten
Fix the two checkpatch.pl warnings in this file:

WARNING: else is not generally useful after a break or return

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

diff --git a/drivers/staging/comedi/comedi_fops.c 
b/drivers/staging/comedi/comedi_fops.c
index 038b69a..3686296 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -206,8 +206,8 @@ struct comedi_device *comedi_dev_get_from_minor(unsigned 
minor)
 {
if (minor < COMEDI_NUM_BOARD_MINORS)
return comedi_dev_get_from_board_minor(minor);
-   else
-   return comedi_dev_get_from_subdevice_minor(minor);
+
+   return comedi_dev_get_from_subdevice_minor(minor);
 }
 EXPORT_SYMBOL_GPL(comedi_dev_get_from_minor);
 
@@ -2625,10 +2625,9 @@ static int __init comedi_init(void)
unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
 COMEDI_NUM_MINORS);
return PTR_ERR(dev);
-   } else {
-   /* comedi_alloc_board_minor() locked the mutex */
-   mutex_unlock(&dev->mutex);
}
+   /* comedi_alloc_board_minor() locked the mutex */
+   mutex_unlock(&dev->mutex);
}
 
return 0;
-- 
1.9.3

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


[PATCH 00/32] staging: comedi: checkpatch.pl cleanup (pass 1)

2014-07-16 Thread H Hartley Sweeten
Start cleaning up the checkpatch.pl issues. This pass gets most of the:

WARNING: else is not generally useful after a break or return
WARNING: break is not useful after a goto or return

H Hartley Sweeten (32):
  staging: comedi: comedi_fops: checkpatch.pl cleanup (else after return)
  staging: comedi: comedi.h: checkpatch.pl cleanup (else after return)
  staging: comedi: comedidev.h: checkpatch.pl cleanup (else after return)
  staging: comedi: 8255_pci: checkpatch.pl cleanup (else after return)
  staging: comedi: 8255: checkpatch.pl cleanup (else after return)
  staging: comedi: addi_apci_3xxx: checkpatch.pl cleanup (else after return)
  staging: comedi: amplc_dio200_common: checkpatch.pl cleanup (else after 
return)
  staging: comedi: amplc_pc236: checkpatch.pl cleanup (else after return)
  staging: comedi: amplc_pci224: checkpatch.pl cleanup (else after return)
  staging: comedi: cb_pcidas64: checkpatch.pl cleanup (else after return)
  staging: comedi: daqboard2000: checkpatch.pl cleanup (else after return)
  staging: comedi: dt282x: checkpatch.pl cleanup (else after return)
  staging: comedi: pcl724: checkpatch.pl cleanup (else after return)
  staging: comedi: das1800: checkpatch.pl cleanup (break not useful)
  staging: comedi: ni_at_a2150: checkpatch.pl cleanup (break not useful)
  staging: comedi: s526: checkpatch.pl cleanup (break not useful)
  staging: comedi: cb_pcidas64: checkpatch.pl cleanup (break not useful)
  staging: comedi: cb_pcidas: checkpatch.pl cleanup (break not useful)
  staging: comedi: ni_660x: checkpatch.pl cleanup (break not useful)
  staging: comedi: ni_660x: checkpatch.pl cleanup (else not useful)
  staging: comedi: s626: checkpatch.pl cleanup (else not useful)
  staging: comedi: ni_mio_common: checkpatch.pl cleanup (break not useful)
  staging: comedi: ni_mio_common: checkpatch.pl cleanup (else not useful)
  staging: comedi: usbdux: checkpatch.pl cleanup (else not useful)
  staging: comedi: usbduxsigma: checkpatch.pl cleanup (else not useful)
  staging: comedi: ni_tio: checkpatch.pl cleanup (break is not useful)
  staging: comedi: ni_tio: checkpatch.pl cleanup (else is not useful)
  staging: comedi: ni_tiocmd: checkpatch.pl cleanup (break is not useful)
  staging: comedi: ni_labpc: checkpatch.pl cleanup (else is not useful)
  staging: comedi: das08: checkpatch.pl cleanup (break is not useful)
  staging: comedi: ni_tio_internal.c: checkpatch.pl cleanup (break is not 
useful)
  staging: comedi: mite.h: tidy up mite_csigr_wpdep()

 drivers/staging/comedi/comedi.h|   8 +-
 drivers/staging/comedi/comedi_fops.c   |   9 +-
 drivers/staging/comedi/comedidev.h |   8 +-
 drivers/staging/comedi/drivers/8255.c  |   3 +-
 drivers/staging/comedi/drivers/8255_pci.c  |   3 +-
 drivers/staging/comedi/drivers/addi_apci_3xxx.c|  10 +-
 .../staging/comedi/drivers/amplc_dio200_common.c   |   8 +-
 drivers/staging/comedi/drivers/amplc_pc236.c   |   8 +-
 drivers/staging/comedi/drivers/amplc_pci224.c  |   3 +-
 drivers/staging/comedi/drivers/cb_pcidas.c |   3 -
 drivers/staging/comedi/drivers/cb_pcidas64.c   |  29 ++
 drivers/staging/comedi/drivers/daqboard2000.c  |   3 +-
 drivers/staging/comedi/drivers/das08.c |   1 -
 drivers/staging/comedi/drivers/das1800.c   |   8 --
 drivers/staging/comedi/drivers/dt282x.c|   8 +-
 drivers/staging/comedi/drivers/mite.h  |   8 +-
 drivers/staging/comedi/drivers/ni_660x.c   |   7 +-
 drivers/staging/comedi/drivers/ni_at_a2150.c   |   1 -
 drivers/staging/comedi/drivers/ni_labpc.c  |   4 +-
 drivers/staging/comedi/drivers/ni_mio_common.c | 101 ++--
 drivers/staging/comedi/drivers/ni_tio.c| 105 -
 drivers/staging/comedi/drivers/ni_tio_internal.h   |   2 -
 drivers/staging/comedi/drivers/ni_tiocmd.c |   1 -
 drivers/staging/comedi/drivers/pcl724.c|   6 +-
 drivers/staging/comedi/drivers/s526.c  |   1 -
 drivers/staging/comedi/drivers/s626.c  |  12 +--
 drivers/staging/comedi/drivers/usbdux.c|  12 +--
 drivers/staging/comedi/drivers/usbduxsigma.c   |  12 +--
 28 files changed, 108 insertions(+), 276 deletions(-)

-- 
1.9.3

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


[PATCH 06/32] staging: comedi: addi_apci_3xxx: checkpatch.pl cleanup (else after return)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning in this file:

WARNING: else is not generally useful after a break or return

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

diff --git a/drivers/staging/comedi/drivers/addi_apci_3xxx.c 
b/drivers/staging/comedi/drivers/addi_apci_3xxx.c
index 0532b6c..12096ee 100644
--- a/drivers/staging/comedi/drivers/addi_apci_3xxx.c
+++ b/drivers/staging/comedi/drivers/addi_apci_3xxx.c
@@ -389,9 +389,8 @@ static int apci3xxx_ai_started(struct comedi_device *dev)
 
if ((readl(devpriv->mmio + 8) & 0x8) == 0x8)
return 1;
-   else
-   return 0;
 
+   return 0;
 }
 
 static int apci3xxx_ai_setup(struct comedi_device *dev, unsigned int chanspec)
@@ -696,10 +695,9 @@ static int apci3xxx_dio_insn_config(struct comedi_device 
*dev,
/* ignore all other instructions for ports 0 and 1 */
if (chan < 16)
return -EINVAL;
-   else
-   /* changing any channel in port 2 */
-   /* changes the entire port*/
-   mask = 0xff;
+
+   /* changing any channel in port 2 changes the entire port */
+   mask = 0xff;
}
 
ret = comedi_dio_insn_config(dev, s, insn, data, mask);
-- 
1.9.3

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


[PATCH 11/32] staging: comedi: daqboard2000: checkpatch.pl cleanup (else after return)

2014-07-16 Thread H Hartley Sweeten
Fix these checkpatch.pl warnings:

WARNING: else is not generally useful after a break or return

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

diff --git a/drivers/staging/comedi/drivers/daqboard2000.c 
b/drivers/staging/comedi/drivers/daqboard2000.c
index a8f6036..b63b818 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -673,9 +673,8 @@ static int daqboard2000_8255_cb(int dir, int port, int data,
if (dir) {
writew(data, mmio_base + port * 2);
return 0;
-   } else {
-   return readw(mmio_base + port * 2);
}
+   return readw(mmio_base + port * 2);
 }
 
 static const void *daqboard2000_find_boardinfo(struct comedi_device *dev,
-- 
1.9.3

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


[PATCH 15/32] staging: comedi: ni_at_a2150: checkpatch.pl cleanup (break not useful)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: break is not useful after a goto or return

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

diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c 
b/drivers/staging/comedi/drivers/ni_at_a2150.c
index 5bd19494..a862dc3 100644
--- a/drivers/staging/comedi/drivers/ni_at_a2150.c
+++ b/drivers/staging/comedi/drivers/ni_at_a2150.c
@@ -681,7 +681,6 @@ static int a2150_set_chanlist(struct comedi_device *dev,
break;
default:
return -1;
-   break;
}
 
return 0;
-- 
1.9.3

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


[PATCH 02/32] staging: comedi: comedi.h: checkpatch.pl cleanup (else after return)

2014-07-16 Thread H Hartley Sweeten
Fix the two checkpatch.pl warnings in this file:

WARNING: else is not generally useful after a break or return

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

diff --git a/drivers/staging/comedi/comedi.h b/drivers/staging/comedi/comedi.h
index dbaeba7..552a5e2 100644
--- a/drivers/staging/comedi/comedi.h
+++ b/drivers/staging/comedi/comedi.h
@@ -555,16 +555,16 @@ static inline unsigned NI_USUAL_PFI_SELECT(unsigned 
pfi_channel)
 {
if (pfi_channel < 10)
return 0x1 + pfi_channel;
-   else
-   return 0xb + pfi_channel;
+
+   return 0xb + pfi_channel;
 }
 
 static inline unsigned NI_USUAL_RTSI_SELECT(unsigned rtsi_channel)
 {
if (rtsi_channel < 7)
return 0xb + rtsi_channel;
-   else
-   return 0x1b;
+
+   return 0x1b;
 }
 
 /* mode bits for NI general-purpose counters, set with
-- 
1.9.3

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


[PATCH 27/32] staging: comedi: ni_tio: checkpatch.pl cleanup (else is not useful)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warnings:

WARNING: else is not generally useful after a break or return

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

diff --git a/drivers/staging/comedi/drivers/ni_tio.c 
b/drivers/staging/comedi/drivers/ni_tio.c
index a25e2f5..1a5bb23 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -165,20 +165,16 @@ static const unsigned ni_m_series_max_pfi_channel = 15;
 static inline unsigned NI_M_Series_PFI_Clock(unsigned n)
 {
BUG_ON(n > ni_m_series_max_pfi_channel);
-   if (n < 10)
-   return 1 + n;
-   else
-   return 0xb + n;
+
+   return (n < 10) ? (1 + n) : (0xb + n);
 }
 
 static const unsigned ni_m_series_max_rtsi_channel = 7;
 static inline unsigned NI_M_Series_RTSI_Clock(unsigned n)
 {
BUG_ON(n > ni_m_series_max_rtsi_channel);
-   if (n == 7)
-   return 0x1b;
-   else
-   return 0xb + n;
+
+   return (n == 7) ? 0x1b : (0xb + n);
 }
 
 enum ni_660x_gate_select {
@@ -1408,12 +1404,12 @@ static int ni_tio_get_gate_src(struct ni_gpct *counter, 
unsigned gate_index,
Gi_Gating_Disabled_Bits) {
*gate_source = NI_GPCT_DISABLED_GATE_SELECT;
return 0;
-   } else {
-   gate_select_bits =
-   (ni_tio_get_soft_copy(counter,
- NITIO_INPUT_SEL_REG(cidx)) &
-Gi_Gate_Select_Mask) >> Gi_Gate_Select_Shift;
}
+
+   gate_select_bits =
+   (ni_tio_get_soft_copy(counter, NITIO_INPUT_SEL_REG(cidx)) &
+   Gi_Gate_Select_Mask) >> Gi_Gate_Select_Shift;
+
switch (counter_dev->variant) {
case ni_gpct_variant_e_series:
case ni_gpct_variant_m_series:
@@ -1442,12 +1438,11 @@ static int ni_tio_get_gate_src(struct ni_gpct *counter, 
unsigned gate_index,
== 0) {
*gate_source = NI_GPCT_DISABLED_GATE_SELECT;
return 0;
-   } else {
-   gate_select_bits =
-   (counter_dev->regs[second_gate_reg] &
-Gi_Second_Gate_Select_Mask) >>
-   Gi_Second_Gate_Select_Shift;
}
+
+   gate_select_bits = (counter_dev->regs[second_gate_reg] &
+   Gi_Second_Gate_Select_Mask) >>
+   Gi_Second_Gate_Select_Shift;
switch (counter_dev->variant) {
case ni_gpct_variant_e_series:
case ni_gpct_variant_m_series:
@@ -1570,10 +1565,9 @@ static unsigned ni_tio_next_load_register(struct ni_gpct 
*counter)
const unsigned bits =
read_register(counter, NITIO_SHARED_STATUS_REG(cidx));
 
-   if (bits & Gi_Next_Load_Source_Bit(cidx))
-   return NITIO_LOADB_REG(cidx);
-   else
-   return NITIO_LOADA_REG(cidx);
+   return (bits & Gi_Next_Load_Source_Bit(cidx))
+   ? NITIO_LOADB_REG(cidx)
+   : NITIO_LOADA_REG(cidx);
 }
 
 int ni_tio_insn_write(struct comedi_device *dev,
-- 
1.9.3

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


[PATCH 25/32] staging: comedi: usbduxsigma: checkpatch.pl cleanup (else not useful)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: else is not generally useful after a break or return

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

diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c 
b/drivers/staging/comedi/drivers/usbduxsigma.c
index e869af4..94a09c1 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -1176,13 +1176,13 @@ static int usbduxsigma_pwm_period(struct comedi_device 
*dev,
struct usbduxsigma_private *devpriv = dev->private;
int fx2delay = 255;
 
-   if (period < MIN_PWM_PERIOD) {
+   if (period < MIN_PWM_PERIOD)
return -EAGAIN;
-   } else {
-   fx2delay = (period / (6 * 512 * 1000 / 33)) - 6;
-   if (fx2delay > 255)
-   return -EAGAIN;
-   }
+
+   fx2delay = (period / (6 * 512 * 1000 / 33)) - 6;
+   if (fx2delay > 255)
+   return -EAGAIN;
+
devpriv->pwm_delay = fx2delay;
devpriv->pwm_period = period;
return 0;
-- 
1.9.3

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


[PATCH 23/32] staging: comedi: ni_mio_common: checkpatch.pl cleanup (else not useful)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warnings:

WARNING: else is not generally useful after a break or return

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

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index fe88a1c..b630c66 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -250,8 +250,8 @@ static void ni_writel(struct comedi_device *dev, uint32_t 
data, int reg)
 
if (devpriv->mite)
writel(data, devpriv->mite->daq_io_addr + reg);
-   else
-   outl(data, dev->iobase + reg);
+
+   outl(data, dev->iobase + reg);
 }
 
 static void ni_writew(struct comedi_device *dev, uint16_t data, int reg)
@@ -260,8 +260,8 @@ static void ni_writew(struct comedi_device *dev, uint16_t 
data, int reg)
 
if (devpriv->mite)
writew(data, devpriv->mite->daq_io_addr + reg);
-   else
-   outw(data, dev->iobase + reg);
+
+   outw(data, dev->iobase + reg);
 }
 
 static void ni_writeb(struct comedi_device *dev, uint8_t data, int reg)
@@ -270,8 +270,8 @@ static void ni_writeb(struct comedi_device *dev, uint8_t 
data, int reg)
 
if (devpriv->mite)
writeb(data, devpriv->mite->daq_io_addr + reg);
-   else
-   outb(data, dev->iobase + reg);
+
+   outb(data, dev->iobase + reg);
 }
 
 static uint32_t ni_readl(struct comedi_device *dev, int reg)
@@ -280,8 +280,8 @@ static uint32_t ni_readl(struct comedi_device *dev, int reg)
 
if (devpriv->mite)
return readl(devpriv->mite->daq_io_addr + reg);
-   else
-   return inl(dev->iobase + reg);
+
+   return inl(dev->iobase + reg);
 }
 
 static uint16_t ni_readw(struct comedi_device *dev, int reg)
@@ -290,8 +290,8 @@ static uint16_t ni_readw(struct comedi_device *dev, int reg)
 
if (devpriv->mite)
return readw(devpriv->mite->daq_io_addr + reg);
-   else
-   return inw(dev->iobase + reg);
+
+   return inw(dev->iobase + reg);
 }
 
 static uint8_t ni_readb(struct comedi_device *dev, int reg)
@@ -300,8 +300,8 @@ static uint8_t ni_readb(struct comedi_device *dev, int reg)
 
if (devpriv->mite)
return readb(devpriv->mite->daq_io_addr + reg);
-   else
-   return inb(dev->iobase + reg);
+
+   return inb(dev->iobase + reg);
 }
 
 /*
@@ -4195,9 +4195,9 @@ static int ni_8255_callback(int dir, int port, int data, 
unsigned long arg)
if (dir) {
ni_writeb(dev, data, Port_A + 2 * port);
return 0;
-   } else {
-   return ni_readb(dev, Port_A + 2 * port);
}
+
+   return ni_readb(dev, Port_A + 2 * port);
 }
 
 static int ni_get_pwm_config(struct comedi_device *dev, unsigned int *data)
@@ -4635,10 +4635,9 @@ static unsigned ni_get_pfi_routing(struct comedi_device 
*dev, unsigned chan)
 {
struct ni_private *devpriv = dev->private;
 
-   if (devpriv->is_m_series)
-   return ni_m_series_get_pfi_routing(dev, chan);
-   else
-   return ni_old_get_pfi_routing(dev, chan);
+   return (devpriv->is_m_series)
+   ? ni_m_series_get_pfi_routing(dev, chan)
+   : ni_old_get_pfi_routing(dev, chan);
 }
 
 static int ni_set_pfi_routing(struct comedi_device *dev, unsigned chan,
@@ -4646,10 +4645,9 @@ static int ni_set_pfi_routing(struct comedi_device *dev, 
unsigned chan,
 {
struct ni_private *devpriv = dev->private;
 
-   if (devpriv->is_m_series)
-   return ni_m_series_set_pfi_routing(dev, chan, source);
-   else
-   return ni_old_set_pfi_routing(dev, chan, source);
+   return (devpriv->is_m_series)
+   ? ni_m_series_set_pfi_routing(dev, chan, source)
+   : ni_old_set_pfi_routing(dev, chan, source);
 }
 
 static int ni_config_filter(struct comedi_device *dev,
@@ -5045,9 +5043,8 @@ static int ni_set_master_clock(struct comedi_device *dev,
("%s: we don't handle an 
unspecified clock period correctly yet, returning error.\n",
 __func__);
return -EINVAL;
-   } else {
-   devpriv->clock_ns = period_ns;
}
+   devpriv->clock_ns = period_ns;
devpriv->clock_source = source;
} else
return -EINVAL;
@@ -5060,10 +5057,7 @@ static unsigned num_configurable_rtsi_channels(struct 
comedi_device *dev)
 {
struct ni_private *devpriv = dev->private;
 
-  

[PATCH 12/32] staging: comedi: dt282x: checkpatch.pl cleanup (else after return)

2014-07-16 Thread H Hartley Sweeten
Fix checkpatch.pl warning:

WARNING: else is not generally useful after a break or return

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

diff --git a/drivers/staging/comedi/drivers/dt282x.c 
b/drivers/staging/comedi/drivers/dt282x.c
index 27a8bb1..cacb4f4 100644
--- a/drivers/staging/comedi/drivers/dt282x.c
+++ b/drivers/staging/comedi/drivers/dt282x.c
@@ -1079,11 +1079,11 @@ static const struct comedi_lrange 
*opt_ai_range_lkup(int ispgl, int x)
if (x < 0 || x >= 2)
x = 0;
return ai_range_pgl_table[x];
-   } else {
-   if (x < 0 || x >= 4)
-   x = 0;
-   return ai_range_table[x];
}
+
+   if (x < 0 || x >= 4)
+   x = 0;
+   return ai_range_table[x];
 }
 
 static int dt282x_grab_dma(struct comedi_device *dev, int dma1, int dma2)
-- 
1.9.3

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


[PATCH 08/32] staging: comedi: amplc_pc236: checkpatch.pl cleanup (else after return)

2014-07-16 Thread H Hartley Sweeten
Fix these checkpatch.pl warnings:

WARNING: else is not generally useful after a break or return

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

diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c 
b/drivers/staging/comedi/drivers/amplc_pc236.c
index c9a96ad..373739a 100644
--- a/drivers/staging/comedi/drivers/amplc_pc236.c
+++ b/drivers/staging/comedi/drivers/amplc_pc236.c
@@ -460,11 +460,11 @@ static int pc236_attach(struct comedi_device *dev, struct 
comedi_devconfig *it)
if (!pci_dev)
return -EIO;
return pc236_pci_common_attach(dev, pci_dev);
-   } else {
-   dev_err(dev->class_dev, PC236_DRIVER_NAME
-   ": BUG! cannot determine board type!\n");
-   return -EINVAL;
}
+
+   dev_err(dev->class_dev, PC236_DRIVER_NAME
+   ": BUG! cannot determine board type!\n");
+   return -EINVAL;
 }
 
 /*
-- 
1.9.3

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


[PATCH 26/32] staging: comedi: ni_tio: checkpatch.pl cleanup (break is not useful)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warnings:

WARNING: break is not useful after a goto or return

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

diff --git a/drivers/staging/comedi/drivers/ni_tio.c 
b/drivers/staging/comedi/drivers/ni_tio.c
index 92691b4..a25e2f5 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -60,13 +60,10 @@ static inline enum Gi_Counting_Mode_Reg_Bits 
Gi_Alternate_Sync_Bit(enum
switch (variant) {
case ni_gpct_variant_e_series:
return 0;
-   break;
case ni_gpct_variant_m_series:
return Gi_M_Series_Alternate_Sync_Bit;
-   break;
case ni_gpct_variant_660x:
return Gi_660x_Alternate_Sync_Bit;
-   break;
default:
BUG();
break;
@@ -81,13 +78,10 @@ static inline enum Gi_Counting_Mode_Reg_Bits 
Gi_Prescale_X2_Bit(enum
switch (variant) {
case ni_gpct_variant_e_series:
return 0;
-   break;
case ni_gpct_variant_m_series:
return Gi_M_Series_Prescale_X2_Bit;
-   break;
case ni_gpct_variant_660x:
return Gi_660x_Prescale_X2_Bit;
-   break;
default:
BUG();
break;
@@ -102,13 +96,10 @@ static inline enum Gi_Counting_Mode_Reg_Bits 
Gi_Prescale_X8_Bit(enum
switch (variant) {
case ni_gpct_variant_e_series:
return 0;
-   break;
case ni_gpct_variant_m_series:
return Gi_M_Series_Prescale_X8_Bit;
-   break;
case ni_gpct_variant_660x:
return Gi_660x_Prescale_X8_Bit;
-   break;
default:
BUG();
break;
@@ -123,13 +114,10 @@ static inline enum Gi_Counting_Mode_Reg_Bits 
Gi_HW_Arm_Select_Mask(enum
switch (variant) {
case ni_gpct_variant_e_series:
return 0;
-   break;
case ni_gpct_variant_m_series:
return Gi_M_Series_HW_Arm_Select_Mask;
-   break;
case ni_gpct_variant_660x:
return Gi_660x_HW_Arm_Select_Mask;
-   break;
default:
BUG();
break;
@@ -331,11 +319,9 @@ static int ni_tio_second_gate_registers_present(const 
struct ni_gpct_device
switch (counter_dev->variant) {
case ni_gpct_variant_e_series:
return 0;
-   break;
case ni_gpct_variant_m_series:
case ni_gpct_variant_660x:
return 1;
-   break;
default:
BUG();
break;
@@ -704,7 +690,6 @@ static void ni_tio_set_source_subselect(struct ni_gpct 
*counter,
/* Gi_Source_Subselect doesn't matter */
default:
return;
-   break;
}
write_register(counter, counter_dev->regs[second_gate_reg],
   second_gate_reg);
@@ -757,7 +742,6 @@ static int ni_tio_set_clock_src(struct ni_gpct *counter,
break;
default:
return -EINVAL;
-   break;
}
ni_tio_set_bits(counter, NITIO_CNT_MODE_REG(cidx),
Gi_Prescale_X2_Bit(counter_dev->variant) |
@@ -915,10 +899,8 @@ static unsigned ni_tio_generic_clock_src_select(const 
struct ni_gpct *counter)
case ni_gpct_variant_e_series:
case ni_gpct_variant_m_series:
return ni_m_series_clock_src_select(counter);
-   break;
case ni_gpct_variant_660x:
return ni_660x_clock_src_select(counter);
-   break;
default:
BUG();
break;
@@ -947,7 +929,6 @@ static uint64_t ni_tio_clock_period_ps(const struct ni_gpct 
*counter,
default:
/* clock period is specified by user with prescaling already 
taken into account. */
return counter->clock_period_ps;
-   break;
}
 
switch (generic_clock_source & NI_GPCT_PRESCALE_MODE_CLOCK_SRC_MASK) {
@@ -1035,7 +1016,6 @@ static int ni_660x_set_first_gate(struct ni_gpct *counter,
if (i <= ni_660x_max_gate_pin)
break;
return -EINVAL;
-   break;
}
ni_tio_set_bits(counter, NITIO_INPUT_SEL_REG(cidx),
Gi_Gate_Select_Mask,
@@ -1084,7 +1064,6 @@ static int ni_m_series_set_first_gate(struct ni_gpct 
*counter,
if (i <= ni_m_series_max_pfi_channel)
break;
return -EINVAL;
-   break;
}
ni_tio_set_bits(counter, NITIO_INPUT_SEL

[PATCH 09/32] staging: comedi: amplc_pci224: checkpatch.pl cleanup (else after return)

2014-07-16 Thread H Hartley Sweeten
Fix this checkpatch.pl warning:

WARNING: else is not generally useful after a break or return

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

diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c 
b/drivers/staging/comedi/drivers/amplc_pci224.c
index 339c47c..55f69c5 100644
--- a/drivers/staging/comedi/drivers/amplc_pci224.c
+++ b/drivers/staging/comedi/drivers/amplc_pci224.c
@@ -1255,9 +1255,8 @@ static int pci224_attach_common(struct comedi_device *dev,
dev_err(dev->class_dev,
"error! unable to allocate irq %u\n", irq);
return ret;
-   } else {
-   dev->irq = irq;
}
+   dev->irq = irq;
}
 
return 0;
-- 
1.9.3

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


[PATCH 04/32] staging: comedi: 8255_pci: checkpatch.pl cleanup (else after return)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning in this file:

WARNING: else is not generally useful after a break or return

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

diff --git a/drivers/staging/comedi/drivers/8255_pci.c 
b/drivers/staging/comedi/drivers/8255_pci.c
index be4c95e..e4cec93 100644
--- a/drivers/staging/comedi/drivers/8255_pci.c
+++ b/drivers/staging/comedi/drivers/8255_pci.c
@@ -201,9 +201,8 @@ static int pci_8255_mmio(int dir, int port, int data, 
unsigned long iobase)
if (dir) {
writeb(data, mmio_base + port);
return 0;
-   } else {
-   return readb(mmio_base  + port);
}
+   return readb(mmio_base  + port);
 }
 
 static int pci_8255_auto_attach(struct comedi_device *dev,
-- 
1.9.3

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


[PATCH 19/32] staging: comedi: ni_660x: checkpatch.pl cleanup (break not useful)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warnings:

WARNING: break is not useful after a goto or return

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

diff --git a/drivers/staging/comedi/drivers/ni_660x.c 
b/drivers/staging/comedi/drivers/ni_660x.c
index 27d435f..d09b866 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -619,10 +619,8 @@ static inline unsigned ni_660x_read_register(struct 
comedi_device *dev,
switch (registerData[reg].size) {
case DATA_2B:
return readw(read_address);
-   break;
case DATA_4B:
return readl(read_address);
-   break;
default:
BUG();
break;
-- 
1.9.3

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


[PATCH 13/32] staging: comedi: pcl724: checkpatch.pl cleanup (else after return)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: else is not generally useful after a break or return

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

diff --git a/drivers/staging/comedi/drivers/pcl724.c 
b/drivers/staging/comedi/drivers/pcl724.c
index 655bac4..c7f8eb1 100644
--- a/drivers/staging/comedi/drivers/pcl724.c
+++ b/drivers/staging/comedi/drivers/pcl724.c
@@ -88,14 +88,12 @@ static int pcl724_8255mapped_io(int dir, int port, int data,
 
iobase &= 0x0fff;
 
+   outb(port + movport, iobase);
if (dir) {
-   outb(port + movport, iobase);
outb(data, iobase + 1);
return 0;
-   } else {
-   outb(port + movport, iobase);
-   return inb(iobase + 1);
}
+   return inb(iobase + 1);
 }
 
 static int pcl724_attach(struct comedi_device *dev,
-- 
1.9.3

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


[PATCH 03/32] staging: comedi: comedidev.h: checkpatch.pl cleanup (else after return)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning in this file:

WARNING: else is not generally useful after a break or return

Also, for aesthetics, rename the comedi_subdevice parameter from
'subd' to 's' since this is the norm for comedi source files.

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

diff --git a/drivers/staging/comedi/comedidev.h 
b/drivers/staging/comedi/comedidev.h
index 6af6467..53095bc 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -397,12 +397,12 @@ static inline unsigned int comedi_offset_munge(struct 
comedi_subdevice *s,
return val ^ s->maxdata ^ (s->maxdata >> 1);
 }
 
-static inline unsigned int bytes_per_sample(const struct comedi_subdevice 
*subd)
+static inline unsigned int bytes_per_sample(const struct comedi_subdevice *s)
 {
-   if (subd->subdev_flags & SDF_LSAMPL)
+   if (s->subdev_flags & SDF_LSAMPL)
return sizeof(unsigned int);
-   else
-   return sizeof(short);
+
+   return sizeof(short);
 }
 
 /*
-- 
1.9.3

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


[PATCH 21/32] staging: comedi: s626: checkpatch.pl cleanup (else not useful)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: else is not generally useful after a break or return

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

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index 9da6822..b276ce4 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -836,10 +836,8 @@ static uint16_t s626_get_mode_b(struct comedi_device *dev,
 static uint16_t s626_get_mode(struct comedi_device *dev,
  unsigned int chan)
 {
-   if (chan < 3)
-   return s626_get_mode_a(dev, chan);
-   else
-   return s626_get_mode_b(dev, chan);
+   return (chan < 3) ? s626_get_mode_a(dev, chan)
+ : s626_get_mode_b(dev, chan);
 }
 #endif
 
@@ -1047,10 +1045,8 @@ static uint16_t s626_get_enable(struct comedi_device 
*dev,
 {
uint16_t crb = s626_debi_read(dev, S626_LP_CRB(chan));
 
-   if (chan < 3)
-   return S626_GET_CRB_CLKENAB_A(crb);
-   else
-   return S626_GET_CRB_CLKENAB_B(crb);
+   return (chan < 3) ? S626_GET_CRB_CLKENAB_A(crb)
+ : S626_GET_CRB_CLKENAB_B(crb);
 }
 #endif
 
-- 
1.9.3

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


[PATCH 32/32] staging: comedi: mite.h: tidy up mite_csigr_wpdep()

2014-07-16 Thread H Hartley Sweeten
Refactor this inline function to fix the checkpatch.pl warnings:

WARNING: Missing a blank line after declarations
WARNING: else is not generally useful after a break or return

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/mite.h | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/mite.h 
b/drivers/staging/comedi/drivers/mite.h
index 33d87a2..ef7172a 100644
--- a/drivers/staging/comedi/drivers/mite.h
+++ b/drivers/staging/comedi/drivers/mite.h
@@ -184,11 +184,9 @@ static inline int mite_csigr_dmac(u32 csigr_bits)
 static inline int mite_csigr_wpdep(u32 csigr_bits)
 {  /*  write post fifo depth */
unsigned int wpdep_bits = (csigr_bits >> 20) & 0x7;
-   if (wpdep_bits == 0)
-   return 0;
-   else
-   return 1 << (wpdep_bits - 1);
-};
+
+   return (wpdep_bits) ? (1 << (wpdep_bits - 1)) : 0;
+}
 
 static inline int mite_csigr_wins(u32 csigr_bits)
 {
-- 
1.9.3

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


[PATCH 18/32] staging: comedi: cb_pcidas: checkpatch.pl cleanup (break not useful)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warnings:

WARNING: break is not useful after a goto or return

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

diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c 
b/drivers/staging/comedi/drivers/cb_pcidas.c
index 7377da1..9badd19 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas.c
@@ -461,7 +461,6 @@ static int ai_config_insn(struct comedi_device *dev, struct 
comedi_subdevice *s,
break;
default:
return -EINVAL;
-   break;
}
return insn->n;
 }
@@ -776,7 +775,6 @@ static int cb_pcidas_trimpot_write(struct comedi_device 
*dev,
default:
comedi_error(dev, "driver bug?");
return -1;
-   break;
}
 
return 1;
@@ -1253,7 +1251,6 @@ static int cb_pcidas_ao_cmd(struct comedi_device *dev,
spin_unlock_irqrestore(&dev->spinlock, flags);
comedi_error(dev, "error setting dac pacer source");
return -1;
-   break;
}
spin_unlock_irqrestore(&dev->spinlock, flags);
 
-- 
1.9.3

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


[PATCH 07/32] staging: comedi: amplc_dio200_common: checkpatch.pl cleanup (else after return)

2014-07-16 Thread H Hartley Sweeten
Fix these checkpatch.pl warnings:

WARNING: else is not generally useful after a break or return

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

diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c 
b/drivers/staging/comedi/drivers/amplc_dio200_common.c
index 3edaa40..2996b1a 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
@@ -156,8 +156,8 @@ static unsigned char dio200_read8(struct comedi_device *dev,
offset <<= thisboard->mainshift;
if (devpriv->io.regtype == io_regtype)
return inb(devpriv->io.u.iobase + offset);
-   else
-   return readb(devpriv->io.u.membase + offset);
+
+   return readb(devpriv->io.u.membase + offset);
 }
 
 /*
@@ -188,8 +188,8 @@ static unsigned int dio200_read32(struct comedi_device *dev,
offset <<= thisboard->mainshift;
if (devpriv->io.regtype == io_regtype)
return inl(devpriv->io.u.iobase + offset);
-   else
-   return readl(devpriv->io.u.membase + offset);
+
+   return readl(devpriv->io.u.membase + offset);
 }
 
 /*
-- 
1.9.3

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


[PATCH 20/32] staging: comedi: ni_660x: checkpatch.pl cleanup (else not useful)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: else is not generally useful after a break or return

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

diff --git a/drivers/staging/comedi/drivers/ni_660x.c 
b/drivers/staging/comedi/drivers/ni_660x.c
index d09b866..72805e9 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -310,10 +310,7 @@ enum clock_config_register_bits {
 /* ioconfigreg */
 static inline unsigned ioconfig_bitshift(unsigned pfi_channel)
 {
-   if (pfi_channel % 2)
-   return 0;
-   else
-   return 8;
+   return (pfi_channel % 2) ? 0 : 8;
 }
 
 static inline unsigned pfi_output_select_mask(unsigned pfi_channel)
-- 
1.9.3

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


[PATCH 14/32] staging: comedi: das1800: checkpatch.pl cleanup (break not useful)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warnings:

WARNING: break is not useful after a goto or return

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index b2f8391d..d89512e 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -1301,7 +1301,6 @@ static int das1800_init_dma(struct comedi_device *dev, 
unsigned int dma0,
dev_err(dev->class_dev,
"dma 5,6 / 6,7 / or 7,5\n");
return -EINVAL;
-   break;
}
if (request_dma(dma0, dev->driver->driver_name)) {
dev_err(dev->class_dev,
@@ -1360,7 +1359,6 @@ static int das1800_probe(struct comedi_device *dev)
printk
(" Board model (probed, not recommended): das-1800st-da 
series\n");
return das1801st;
-   break;
case 0x4:
if (board == das1802hr_da || board == das1702hr_da) {
dev_dbg(dev->class_dev, "Board model: %s\n",
@@ -1370,7 +1368,6 @@ static int das1800_probe(struct comedi_device *dev)
printk
(" Board model (probed, not recommended): das-1802hr-da\n");
return das1802hr;
-   break;
case 0x5:
if (board == das1801ao || board == das1802ao ||
board == das1701ao || board == das1702ao) {
@@ -1381,7 +1378,6 @@ static int das1800_probe(struct comedi_device *dev)
printk
(" Board model (probed, not recommended): das-1800ao 
series\n");
return das1801ao;
-   break;
case 0x6:
if (board == das1802hr || board == das1702hr) {
dev_dbg(dev->class_dev, "Board model: %s\n",
@@ -1391,7 +1387,6 @@ static int das1800_probe(struct comedi_device *dev)
printk
(" Board model (probed, not recommended): das-1802hr\n");
return das1802hr;
-   break;
case 0x7:
if (board == das1801st || board == das1802st ||
board == das1701st || board == das1702st) {
@@ -1402,7 +1397,6 @@ static int das1800_probe(struct comedi_device *dev)
printk
(" Board model (probed, not recommended): das-1800st 
series\n");
return das1801st;
-   break;
case 0x8:
if (board == das1801hc || board == das1802hc) {
dev_dbg(dev->class_dev, "Board model: %s\n",
@@ -1412,13 +1406,11 @@ static int das1800_probe(struct comedi_device *dev)
printk
(" Board model (probed, not recommended): das-1800hc 
series\n");
return das1801hc;
-   break;
default:
printk
(" Board model: probe returned 0x%x (unknown, please 
report)\n",
 id);
return board;
-   break;
}
return -1;
 }
-- 
1.9.3

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


[PATCH 22/32] staging: comedi: ni_mio_common: checkpatch.pl cleanup (break not useful)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: break is not useful after a goto or return

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

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 01b29d5..fe88a1c 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -223,10 +223,8 @@ static inline unsigned NI_GPCT_SUBDEV(unsigned 
counter_index)
switch (counter_index) {
case 0:
return NI_GPCT0_SUBDEV;
-   break;
case 1:
return NI_GPCT1_SUBDEV;
-   break;
default:
break;
}
@@ -3026,7 +3024,6 @@ static int ni_ao_insn_config(struct comedi_device *dev,
break;
default:
return -EINVAL;
-   break;
}
return 0;
default:
@@ -4015,7 +4012,6 @@ static unsigned ni_gpct_to_stc_register(enum 
ni_gpct_register reg)
   __func__, reg);
BUG();
return 0;
-   break;
}
return stc_register;
 }
@@ -4113,7 +4109,6 @@ static unsigned ni_gpct_read_register(struct ni_gpct 
*counter,
default:
stc_register = ni_gpct_to_stc_register(reg);
return ni_stc_readw(dev, stc_register);
-   break;
}
return 0;
 }
@@ -4240,7 +4235,6 @@ static int ni_m_series_pwm_config(struct comedi_device 
*dev,
break;
default:
return -EINVAL;
-   break;
}
switch (data[3]) {
case TRIG_ROUND_NEAREST:
@@ -4258,7 +4252,6 @@ static int ni_m_series_pwm_config(struct comedi_device 
*dev,
break;
default:
return -EINVAL;
-   break;
}
if (up_count * devpriv->clock_ns != data[2] ||
down_count * devpriv->clock_ns != data[4]) {
@@ -4272,13 +4265,10 @@ static int ni_m_series_pwm_config(struct comedi_device 
*dev,
devpriv->pwm_up_count = up_count;
devpriv->pwm_down_count = down_count;
return 5;
-   break;
case INSN_CONFIG_GET_PWM_OUTPUT:
return ni_get_pwm_config(dev, data);
-   break;
default:
return -EINVAL;
-   break;
}
return 0;
 }
@@ -4309,7 +4299,6 @@ static int ni_6143_pwm_config(struct comedi_device *dev,
break;
default:
return -EINVAL;
-   break;
}
switch (data[3]) {
case TRIG_ROUND_NEAREST:
@@ -4327,7 +4316,6 @@ static int ni_6143_pwm_config(struct comedi_device *dev,
break;
default:
return -EINVAL;
-   break;
}
if (up_count * devpriv->clock_ns != data[2] ||
down_count * devpriv->clock_ns != data[4]) {
@@ -4340,12 +4328,10 @@ static int ni_6143_pwm_config(struct comedi_device *dev,
ni_writel(dev, down_count, Calibration_LowTime_6143);
devpriv->pwm_down_count = down_count;
return 5;
-   break;
case INSN_CONFIG_GET_PWM_OUTPUT:
return ni_get_pwm_config(dev, data);
default:
return -EINVAL;
-   break;
}
return 0;
 }
@@ -4581,34 +4567,24 @@ static unsigned ni_old_get_pfi_routing(struct 
comedi_device *dev,
switch (chan) {
case 0:
return NI_PFI_OUTPUT_AI_START1;
-   break;
case 1:
return NI_PFI_OUTPUT_AI_START2;
-   break;
case 2:
return NI_PFI_OUTPUT_AI_CONVERT;
-   break;
case 3:
return NI_PFI_OUTPUT_G_SRC1;
-   break;
case 4:
return NI_PFI_OUTPUT_G_GATE1;
-   break;
case 5:
return NI_PFI_OUTPUT_AO_UPDATE_N;
-   break;
case 6:
return NI_PFI_OUTPUT_AO_START1;
-   break;
case 7:
return NI_PFI_OUTPUT_AI_START_PULSE;
-   break;
case 8:
return NI_PFI_OUTPUT_G_SRC0;
-   break;
case 9:
return NI_PFI_OUTPUT_G_GATE0;
-   break;
default:
printk("%s: bug, unhandled case in switch.\n", __func__);
break;
@@ -4718,16 +4694,13 @@ static 

[PATCH 10/32] staging: comedi: cb_pcidas64: checkpatch.pl cleanup (else after return)

2014-07-16 Thread H Hartley Sweeten
Fix these checkpatch.pl warnings:

WARNING: else is not generally useful after a break or return

Also, remove an unnecessary trailing ';' at the end of a function.

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

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
b/drivers/staging/comedi/drivers/cb_pcidas64.c
index 035c3a1..bf4c1b2 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -636,8 +636,8 @@ static inline unsigned int ai_dma_ring_count(const struct 
pcidas64_board *board)
 {
if (board->layout == LAYOUT_4020)
return MAX_AI_DMA_RING_COUNT;
-   else
-   return MIN_AI_DMA_RING_COUNT;
+
+   return MIN_AI_DMA_RING_COUNT;
 }
 
 static const int bytes_in_sample = 2;
@@ -1045,9 +1045,9 @@ static inline unsigned short se_diff_bit_6xxx(struct 
comedi_device *dev,
if ((thisboard->layout == LAYOUT_64XX && !use_differential) ||
(thisboard->layout == LAYOUT_60XX && use_differential))
return ADC_SE_DIFF_BIT;
-   else
-   return 0;
-};
+
+   return 0;
+}
 
 struct ext_clock_info {
/*  master clock divisor to use for scans with external master clock */
@@ -2162,8 +2162,8 @@ static int use_hw_sample_counter(struct comedi_cmd *cmd)
 
if (cmd->stop_src == TRIG_COUNT && cmd->stop_arg <= max_counter_value)
return 1;
-   else
-   return 0;
+
+   return 0;
 }
 
 static void setup_sample_counters(struct comedi_device *dev,
@@ -3384,9 +3384,8 @@ static int dio_callback(int dir, int port, int data, 
unsigned long arg)
if (dir) {
writeb(data, iobase + port);
return 0;
-   } else {
-   return readb(iobase + port);
}
+   return readb(iobase + port);
 }
 
 static int dio_callback_4020(int dir, int port, int data, unsigned long arg)
@@ -3395,9 +3394,8 @@ static int dio_callback_4020(int dir, int port, int data, 
unsigned long arg)
if (dir) {
writew(data, iobase + 2 * port);
return 0;
-   } else {
-   return readw(iobase + 2 * port);
}
+   return readw(iobase + 2 * port);
 }
 
 static int di_rbits(struct comedi_device *dev, struct comedi_subdevice *s,
-- 
1.9.3

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


[PATCH 24/32] staging: comedi: usbdux: checkpatch.pl cleanup (else not useful)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: else is not generally useful after a break or return

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

diff --git a/drivers/staging/comedi/drivers/usbdux.c 
b/drivers/staging/comedi/drivers/usbdux.c
index 5f65e42..053bc50 100644
--- a/drivers/staging/comedi/drivers/usbdux.c
+++ b/drivers/staging/comedi/drivers/usbdux.c
@@ -1327,13 +1327,13 @@ static int usbdux_pwm_period(struct comedi_device *dev,
struct usbdux_private *devpriv = dev->private;
int fx2delay = 255;
 
-   if (period < MIN_PWM_PERIOD) {
+   if (period < MIN_PWM_PERIOD)
return -EAGAIN;
-   } else {
-   fx2delay = (period / (6 * 512 * 1000 / 33)) - 6;
-   if (fx2delay > 255)
-   return -EAGAIN;
-   }
+
+   fx2delay = (period / (6 * 512 * 1000 / 33)) - 6;
+   if (fx2delay > 255)
+   return -EAGAIN;
+
devpriv->pwm_delay = fx2delay;
devpriv->pwm_period = period;
 
-- 
1.9.3

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


[PATCH 05/32] staging: comedi: 8255: checkpatch.pl cleanup (else after return)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning in this file:

WARNING: else is not generally useful after a break or return

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

diff --git a/drivers/staging/comedi/drivers/8255.c 
b/drivers/staging/comedi/drivers/8255.c
index 46113a3..a33a196 100644
--- a/drivers/staging/comedi/drivers/8255.c
+++ b/drivers/staging/comedi/drivers/8255.c
@@ -102,9 +102,8 @@ static int subdev_8255_io(int dir, int port, int data, 
unsigned long iobase)
if (dir) {
outb(data, iobase + port);
return 0;
-   } else {
-   return inb(iobase + port);
}
+   return inb(iobase + port);
 }
 
 void subdev_8255_interrupt(struct comedi_device *dev,
-- 
1.9.3

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


[PATCH 30/32] staging: comedi: das08: checkpatch.pl cleanup (break is not useful)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: break is not useful after a goto or return

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

diff --git a/drivers/staging/comedi/drivers/das08.c 
b/drivers/staging/comedi/drivers/das08.c
index c5e352f..6e55ba5 100644
--- a/drivers/staging/comedi/drivers/das08.c
+++ b/drivers/staging/comedi/drivers/das08.c
@@ -452,7 +452,6 @@ static int das08_counter_config(struct comedi_device *dev,
break;
default:
return -EINVAL;
-   break;
}
return 2;
 }
-- 
1.9.3

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


[PATCH 29/32] staging: comedi: ni_labpc: checkpatch.pl cleanup (else is not useful)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: else is not generally useful after a break or return

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

diff --git a/drivers/staging/comedi/drivers/ni_labpc.c 
b/drivers/staging/comedi/drivers/ni_labpc.c
index 3e3f940..34ffa2e 100644
--- a/drivers/staging/comedi/drivers/ni_labpc.c
+++ b/drivers/staging/comedi/drivers/ni_labpc.c
@@ -1051,9 +1051,9 @@ static int labpc_8255_mmio(int dir, int port, int data, 
unsigned long iobase)
if (dir) {
writeb(data, (void __iomem *)(iobase + port));
return 0;
-   } else {
-   return readb((void __iomem *)(iobase + port));
}
+
+   return readb((void __iomem *)(iobase + port));
 }
 
 /* lowlevel write to eeprom/dac */
-- 
1.9.3

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


[PATCH 16/32] staging: comedi: s526: checkpatch.pl cleanup (break not useful)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: break is not useful after a goto or return

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

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index 85d2b7a..208567d 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -345,7 +345,6 @@ static int s526_gpct_insn_config(struct comedi_device *dev,
 
default:
return -EINVAL;
-   break;
}
 
return insn->n;
-- 
1.9.3

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


[PATCH 17/32] staging: comedi: cb_pcidas64: checkpatch.pl cleanup (break not useful)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warnings:

WARNING: break is not useful after a goto or return

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

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
b/drivers/staging/comedi/drivers/cb_pcidas64.c
index bf4c1b2..f296cbc 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -1874,7 +1874,6 @@ static int ai_config_master_clock_4020(struct 
comedi_device *dev,
break;
default:
return -EINVAL;
-   break;
}
 
data[4] = divisor;
@@ -1890,10 +1889,8 @@ static int ai_config_master_clock(struct comedi_device 
*dev, unsigned int *data)
switch (thisboard->layout) {
case LAYOUT_4020:
return ai_config_master_clock_4020(dev, data);
-   break;
default:
return -EINVAL;
-   break;
}
 
return -EINVAL;
@@ -1907,16 +1904,12 @@ static int ai_config_insn(struct comedi_device *dev, 
struct comedi_subdevice *s,
switch (id) {
case INSN_CONFIG_ALT_SOURCE:
return ai_config_calibration_source(dev, data);
-   break;
case INSN_CONFIG_BLOCK_SIZE:
return ai_config_block_size(dev, data);
-   break;
case INSN_CONFIG_TIMER_1:
return ai_config_master_clock(dev, data);
-   break;
default:
return -EINVAL;
-   break;
}
return -EINVAL;
 }
@@ -2224,7 +2217,6 @@ static uint32_t ai_scan_counter_6xxx(struct comedi_device 
*dev,
break;
default:
return 0;
-   break;
}
return count - 3;
 }
@@ -3568,7 +3560,6 @@ static int caldac_i2c_write(struct comedi_device *dev,
default:
comedi_error(dev, "invalid caldac channel\n");
return -1;
-   break;
}
serial_bytes[1] = NOT_CLEAR_REGISTERS | ((value >> 8) & 0xf);
serial_bytes[2] = value & 0xff;
-- 
1.9.3

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


[PATCH 31/32] staging: comedi: ni_tio_internal.c: checkpatch.pl cleanup (break is not useful)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: break is not useful after a goto or return

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

diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h 
b/drivers/staging/comedi/drivers/ni_tio_internal.h
index 15b81b8..3c53958 100644
--- a/drivers/staging/comedi/drivers/ni_tio_internal.h
+++ b/drivers/staging/comedi/drivers/ni_tio_internal.h
@@ -334,11 +334,9 @@ static inline int 
ni_tio_counting_mode_registers_present(const struct
switch (counter_dev->variant) {
case ni_gpct_variant_e_series:
return 0;
-   break;
case ni_gpct_variant_m_series:
case ni_gpct_variant_660x:
return 1;
-   break;
default:
BUG();
break;
-- 
1.9.3

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


Re: [PATCH 4/8] Drivers: scsi: storvsc: Filter WRITE_SAME_16

2014-07-16 Thread Martin K. Petersen
> "Christoph" == hch@infradead org  writes:

Christoph> Oh, we actually have devices that support WRITE SAME with
Christoph> unmap, but not without?  That's defintively a little strange.

Yep :(

There were several SSDs that did not want to support wearing out flash
by writing gobs of zeroes and only support the UNMAP case.

Christoph> Yes, and it did this intentionally.  I really wouldn't expect
Christoph> devices to support WRITE SAME with UNMAP but blow up on a
Christoph> WRITE SAME without it (and not just simple fail it in an
Christoph> orderly way).

*sigh*

Christoph> It definitively seems odd to default to trying WRITE SAME for
Christoph> unmap for a device that explicitly tells us that it doesn't
Christoph> support WRITE SAME.

Maybe it's just a naming thing. I was really trying to convey
no_req_write_same support, not no_write_same_10_or_16.

Christoph> Note that I'm not against your patch - I suspect forcing us
Christoph> to read EVPD pages even for devices that claim to be SPC-2
Christoph> will come in useful in various scenarios.

I don't have a problem with a BLIST_PREFER_UNMAP flag or something like
that. But BLIST_TRY_VPD_PAGES seems more generally useful and it does
fix the problem at hand. That's why I went that route.

-- 
Martin K. Petersen  Oracle Linux Engineering
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 28/32] staging: comedi: ni_tiocmd: checkpatch.pl cleanup (break is not useful)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: break is not useful after a goto or return

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

diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c 
b/drivers/staging/comedi/drivers/ni_tiocmd.c
index 2557ab4..f66b504 100644
--- a/drivers/staging/comedi/drivers/ni_tiocmd.c
+++ b/drivers/staging/comedi/drivers/ni_tiocmd.c
@@ -342,7 +342,6 @@ static int should_ack_gate(struct ni_gpct *counter)
in register-level manual) */
case ni_gpct_variant_660x:
return 1;
-   break;
case ni_gpct_variant_e_series:
spin_lock_irqsave(&counter->lock, flags);
{
-- 
1.9.3

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


Re: [PATCH 4/8] Drivers: scsi: storvsc: Filter WRITE_SAME_16

2014-07-16 Thread h...@infradead.org
On Wed, Jul 16, 2014 at 01:47:35PM -0400, Martin K. Petersen wrote:
> There were several SSDs that did not want to support wearing out flash
> by writing gobs of zeroes and only support the UNMAP case.

Given that SSDs usually aren't hard provisioned anyway that seems like
an odd decision.  But SAS SSD would be something I'd at least expect
to properly fail these..

> I don't have a problem with a BLIST_PREFER_UNMAP flag or something like
> that. But BLIST_TRY_VPD_PAGES seems more generally useful and it does
> fix the problem at hand. That's why I went that route.

As I said I'm perfectly fine with your patch and I think we'll find more
uses for it.  I'll apply it as soon as I get a second review.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 01/22] staging: comedi: 8253.h: checkpatch.pl cleanup (void function return)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning in this file:

WARNING: void function return statements are not generally useful

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

diff --git a/drivers/staging/comedi/drivers/8253.h 
b/drivers/staging/comedi/drivers/8253.h
index 5829b46..035b3e3 100644
--- a/drivers/staging/comedi/drivers/8253.h
+++ b/drivers/staging/comedi/drivers/8253.h
@@ -118,7 +118,6 @@ static inline void i8253_cascade_ns_to_timer(int 
i8253_osc_base,
/*  masking is done since counter maps zero to 0x1 */
*d1 = div1 & 0x;
*d2 = div2 & 0x;
-   return;
 }
 
 #ifndef CMDTEST
-- 
1.9.3

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


[PATCH 00/22] staging: comedi: checkpatch.pl cleanup (pass 2)

2014-07-16 Thread H Hartley Sweeten
Continue cleaning up the checkpatch.pl issues. This pass gets the:

WARNING: void function return statements are not generally useful
WARNING: Missing a blank line after declarations

It also fixes this one that was missed in the serial2000 driver:

WARNING: else is not generally useful after a break or return

H Hartley Sweeten (22):
  staging: comedi: 8253.h: checkpatch.pl cleanup (void function return)
  staging: comedi: adv_pci1723: checkpatch.pl cleanup (missing blank line)
  staging: comedi: amplc_pc236: checkpatch.pl cleanup (missing blank line)
  staging: comedi: amplc_pci230: checkpatch.pl cleanup (void function return)
  staging: comedi: cb_pcidas64: checkpatch.pl cleanup (missing blank line)
  staging: comedi: cd_pcidas64: checkpatch.pl cleanup (void function return)
  staging: comedi: das16: checkpatch.pl cleanup (missing blank line)
  staging: comedi: das1800: checkpatch.pl cleanup (void function return)
  staging: comedi: dt2815: checkpatch.pl cleanup (missing blank line)
  staging: comedi: dt9812: checkpatch.pl cleanup (missing blank line)
  staging: comedi: jr3_pci: checkpatch.pl cleanup (missing blank line)
  staging: comedi: comedi_test: checkpatch.pl cleanup (break is not useful)
  staging: comedi: serial2000: checkpatch.pl cleanup (missing blank line)
  staging: comedi: serial2000: reduce indent level of serial2002_setup_subdevs()
  staging: comedi: ni_at_a2150: checkpatch.pl cleanup (missing blank line)
  staging: comedi: pcmuio: checkpatch.pl cleanup (missing blank line)
  staging: comedi: multiq3: checkpatch.pl cleanup (missing blank line)
  staging: comedi: ni_660x: checkpatch.pl cleanup (missing blank line)
  staging: comedi: ni_pcidio: checkpatch.pl cleanup (missing blank line)
  staging: comedi: ni_mio_common: checkpatch.pl cleanup (missing blank line)
  staging: comedi: mite: checkpatch.pl cleanup (missing blank line)
  staging: comedi: ni_tio: checkpatch.pl cleanup (missing blank line)

 drivers/staging/comedi/drivers/8253.h  |   1 -
 drivers/staging/comedi/drivers/adv_pci1723.c   |   5 +-
 drivers/staging/comedi/drivers/amplc_pc236.c   |   1 +
 drivers/staging/comedi/drivers/amplc_pci230.c  |   1 -
 drivers/staging/comedi/drivers/cb_pcidas64.c   |   6 +-
 drivers/staging/comedi/drivers/comedi_test.c   |   2 -
 drivers/staging/comedi/drivers/das16.c |   8 +-
 drivers/staging/comedi/drivers/das1800.c   |  13 
 drivers/staging/comedi/drivers/dt2815.c|   1 +
 drivers/staging/comedi/drivers/dt9812.c|   1 +
 drivers/staging/comedi/drivers/jr3_pci.c   |   5 +-
 drivers/staging/comedi/drivers/mite.c  |   3 +
 drivers/staging/comedi/drivers/multiq3.c   |   4 +-
 drivers/staging/comedi/drivers/ni_660x.c   |   1 +
 drivers/staging/comedi/drivers/ni_at_a2150.c   |   1 +
 drivers/staging/comedi/drivers/ni_mio_common.c |  12 +++
 drivers/staging/comedi/drivers/ni_pcidio.c |   2 +
 drivers/staging/comedi/drivers/ni_tio.c|   1 +
 drivers/staging/comedi/drivers/pcmuio.c|   1 +
 drivers/staging/comedi/drivers/serial2002.c| 104 -
 20 files changed, 92 insertions(+), 81 deletions(-)

-- 
1.9.3

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


[PATCH 04/22] staging: comedi: amplc_pci230: checkpatch.pl cleanup (void function return)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning in this file:

WARNING: void function return statements are not generally useful

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

diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c 
b/drivers/staging/comedi/drivers/amplc_pci230.c
index 3895bc7..f003449 100644
--- a/drivers/staging/comedi/drivers/amplc_pci230.c
+++ b/drivers/staging/comedi/drivers/amplc_pci230.c
@@ -758,7 +758,6 @@ static void pci230_ns_to_single_timer(unsigned int *ns, 
unsigned int round)
 
clk_src = pci230_choose_clk_count(*ns, &count, round);
*ns = count * pci230_timebase[clk_src];
-   return;
 }
 
 static void pci230_ct_setup_ns_mode(struct comedi_device *dev, unsigned int ct,
-- 
1.9.3

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


[PATCH 02/22] staging: comedi: adv_pci1723: checkpatch.pl cleanup (missing blank line)

2014-07-16 Thread H Hartley Sweeten
Fix this checkpatch.pl warning:

WARNING: Missing a blank line after declarations

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

diff --git a/drivers/staging/comedi/drivers/adv_pci1723.c 
b/drivers/staging/comedi/drivers/adv_pci1723.c
index 07b107d..1881df4 100644
--- a/drivers/staging/comedi/drivers/adv_pci1723.c
+++ b/drivers/staging/comedi/drivers/adv_pci1723.c
@@ -161,11 +161,10 @@ static int pci1723_ao_write_winsn(struct comedi_device 
*dev,
  struct comedi_insn *insn, unsigned int *data)
 {
struct pci1723_private *devpriv = dev->private;
-   int n, chan;
-   chan = CR_CHAN(insn->chanspec);
+   unsigned int chan = CR_CHAN(insn->chanspec);
+   int n;
 
for (n = 0; n < insn->n; n++) {
-
devpriv->ao_data[chan] = data[n];
outw(data[n], dev->iobase + PCI1723_DA(chan));
}
-- 
1.9.3

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


[PATCH 05/22] staging: comedi: cb_pcidas64: checkpatch.pl cleanup (missing blank line)

2014-07-16 Thread H Hartley Sweeten
Fix this checkpatch.pl warning:

WARNING: Missing a blank line after declarations

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

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
b/drivers/staging/comedi/drivers/cb_pcidas64.c
index f296cbc..171342a 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -1769,6 +1769,7 @@ static int ai_rinsn(struct comedi_device *dev, struct 
comedi_subdevice *s,
 *  as it is very slow */
if (old_cal_range_bits != devpriv->i2c_cal_range_bits) {
uint8_t i2c_data = devpriv->i2c_cal_range_bits;
+
i2c_write(dev, RANGE_CAL_I2C_ADDR, &i2c_data,
  sizeof(i2c_data));
}
@@ -2446,6 +2447,7 @@ static int setup_channel_queue(struct comedi_device *dev,
 *  as it is very slow */
if (old_cal_range_bits != devpriv->i2c_cal_range_bits) {
uint8_t i2c_data = devpriv->i2c_cal_range_bits;
+
i2c_write(dev, RANGE_CAL_I2C_ADDR, &i2c_data,
  sizeof(i2c_data));
}
@@ -3373,6 +3375,7 @@ static int ao_cancel(struct comedi_device *dev, struct 
comedi_subdevice *s)
 static int dio_callback(int dir, int port, int data, unsigned long arg)
 {
void __iomem *iobase = (void __iomem *)arg;
+
if (dir) {
writeb(data, iobase + port);
return 0;
@@ -3383,6 +3386,7 @@ static int dio_callback(int dir, int port, int data, 
unsigned long arg)
 static int dio_callback_4020(int dir, int port, int data, unsigned long arg)
 {
void __iomem *iobase = (void __iomem *)arg;
+
if (dir) {
writew(data, iobase + 2 * port);
return 0;
-- 
1.9.3

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


[PATCH 08/22] staging: comedi: das1800: checkpatch.pl cleanup (void function return)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: void function return statements are not generally useful

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

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index d89512e..c3561ff 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -492,7 +492,6 @@ static void das1800_handle_fifo_half_full(struct 
comedi_device *dev,
  numPoints * sizeof(devpriv->ai_buf0[0]));
if (cmd->stop_src == TRIG_COUNT)
devpriv->count -= numPoints;
-   return;
 }
 
 static void das1800_handle_fifo_not_empty(struct comedi_device *dev,
@@ -517,8 +516,6 @@ static void das1800_handle_fifo_not_empty(struct 
comedi_device *dev,
if (cmd->stop_src == TRIG_COUNT)
devpriv->count--;
}
-
-   return;
 }
 
 /* Utility function used by das1800_flush_dma() and das1800_handle_dma().
@@ -549,8 +546,6 @@ static void das1800_flush_dma_channel(struct comedi_device 
*dev,
cfc_write_array_to_buffer(s, buffer, num_bytes);
if (cmd->stop_src == TRIG_COUNT)
devpriv->count -= num_samples;
-
-   return;
 }
 
 /* flushes remaining data from board when external trigger has stopped 
acquisition
@@ -583,8 +578,6 @@ static void das1800_flush_dma(struct comedi_device *dev,
 
/*  get any remaining samples in fifo */
das1800_handle_fifo_not_empty(dev, s);
-
-   return;
 }
 
 static void das1800_handle_dma(struct comedi_device *dev,
@@ -619,8 +612,6 @@ static void das1800_handle_dma(struct comedi_device *dev,
}
}
}
-
-   return;
 }
 
 static int das1800_cancel(struct comedi_device *dev, struct comedi_subdevice 
*s)
@@ -1060,8 +1051,6 @@ static void setup_dma(struct comedi_device *dev, const 
struct comedi_cmd *cmd)
enable_dma(devpriv->dma1);
}
release_dma_lock(lock_flags);
-
-   return;
 }
 
 /* programs channel/gain list into card */
@@ -1088,8 +1077,6 @@ static void program_chanlist(struct comedi_device *dev,
}
outb(n - 1, dev->iobase + DAS1800_QRAM_ADDRESS);/*finish write 
to QRAM */
spin_unlock_irqrestore(&dev->spinlock, irq_flags);
-
-   return;
 }
 
 /* analog input do_cmd */
-- 
1.9.3

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


[PATCH 17/22] staging: comedi: multiq3: checkpatch.pl cleanup (missing blank line)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: Missing a blank line after declarations

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

diff --git a/drivers/staging/comedi/drivers/multiq3.c 
b/drivers/staging/comedi/drivers/multiq3.c
index b74b9e9..60bda9c 100644
--- a/drivers/staging/comedi/drivers/multiq3.c
+++ b/drivers/staging/comedi/drivers/multiq3.c
@@ -189,12 +189,12 @@ static int multiq3_encoder_insn_read(struct comedi_device 
*dev,
 struct comedi_insn *insn,
 unsigned int *data)
 {
-   int n;
int chan = CR_CHAN(insn->chanspec);
int control = MULTIQ3_CONTROL_MUST | MULTIQ3_AD_MUX_EN | (chan << 3);
+   int value;
+   int n;
 
for (n = 0; n < insn->n; n++) {
-   int value;
outw(control, dev->iobase + MULTIQ3_CONTROL);
outb(MULTIQ3_BP_RESET, dev->iobase + MULTIQ3_ENC_CONTROL);
outb(MULTIQ3_TRSFRCNTR_OL, dev->iobase + MULTIQ3_ENC_CONTROL);
-- 
1.9.3

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


[PATCH 09/22] staging: comedi: dt2815: checkpatch.pl cleanup (missing blank line)

2014-07-16 Thread H Hartley Sweeten
Fix checkpatch.pl warning:

WARNING: Missing a blank line after declarations

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

diff --git a/drivers/staging/comedi/drivers/dt2815.c 
b/drivers/staging/comedi/drivers/dt2815.c
index b9ac4ed..1f321db 100644
--- a/drivers/staging/comedi/drivers/dt2815.c
+++ b/drivers/staging/comedi/drivers/dt2815.c
@@ -195,6 +195,7 @@ static int dt2815_attach(struct comedi_device *dev, struct 
comedi_devconfig *it)
status = inb(dev->iobase + DT2815_STATUS);
if (status == 4) {
unsigned int program;
+
program = (it->options[4] & 0x3) << 3 | 0x7;
outb(program, dev->iobase + DT2815_DATA);
dev_dbg(dev->class_dev, "program: 0x%x (@t=%d)\n",
-- 
1.9.3

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


[PATCH 06/22] staging: comedi: cd_pcidas64: checkpatch.pl cleanup (void function return)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: void function return statements are not generally useful

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

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
b/drivers/staging/comedi/drivers/cb_pcidas64.c
index 171342a..046336f 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -1985,8 +1985,6 @@ static void check_adc_timing(struct comedi_device *dev, 
struct comedi_cmd *cmd)
scan_divisor = min_scan_divisor;
cmd->scan_begin_arg = scan_divisor * TIMER_BASE;
}
-
-   return;
 }
 
 static int cb_pcidas64_ai_check_chanlist(struct comedi_device *dev,
-- 
1.9.3

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


[PATCH 10/22] staging: comedi: dt9812: checkpatch.pl cleanup (missing blank line)

2014-07-16 Thread H Hartley Sweeten
Fix checkpatch.pl warning:

WARNING: Missing a blank line after declarations

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

diff --git a/drivers/staging/comedi/drivers/dt9812.c 
b/drivers/staging/comedi/drivers/dt9812.c
index b3aeb6f..bd2ca2b 100644
--- a/drivers/staging/comedi/drivers/dt9812.c
+++ b/drivers/staging/comedi/drivers/dt9812.c
@@ -653,6 +653,7 @@ static int dt9812_find_endpoints(struct comedi_device *dev)
 
for (i = 0; i < host->desc.bNumEndpoints; ++i) {
int dir = -1;
+
ep = &host->endpoint[i].desc;
switch (i) {
case 0:
-- 
1.9.3

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


[PATCH 07/22] staging: comedi: das16: checkpatch.pl cleanup (missing blank line)

2014-07-16 Thread H Hartley Sweeten
Fix thess checkpatch.pl warnings:

WARNING: Missing a blank line after declarations

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

diff --git a/drivers/staging/comedi/drivers/das16.c 
b/drivers/staging/comedi/drivers/das16.c
index 2feecf1..d92cc18 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -506,18 +506,18 @@ static void das16_ai_disable(struct comedi_device *dev)
 static int disable_dma_on_even(struct comedi_device *dev)
 {
struct das16_private_struct *devpriv = dev->private;
-   int residue;
-   int i;
static const int disable_limit = 100;
static const int enable_timeout = 100;
+   int residue;
+   int new_residue;
+   int i;
+   int j;
 
disable_dma(devpriv->dma_chan);
residue = get_dma_residue(devpriv->dma_chan);
for (i = 0; i < disable_limit && (residue % 2); ++i) {
-   int j;
enable_dma(devpriv->dma_chan);
for (j = 0; j < enable_timeout; ++j) {
-   int new_residue;
udelay(2);
new_residue = get_dma_residue(devpriv->dma_chan);
if (new_residue != residue)
-- 
1.9.3

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


[PATCH 14/22] staging: comedi: serial2000: reduce indent level of serial2002_setup_subdevs()

2014-07-16 Thread H Hartley Sweeten
Tidy up this function a bit to reduce the indent level.

This also fixex the checkpatch.pl warning:

WARNING: else is not generally useful after a break or return

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

diff --git a/drivers/staging/comedi/drivers/serial2002.c 
b/drivers/staging/comedi/drivers/serial2002.c
index 162cfaf..e1fae74 100644
--- a/drivers/staging/comedi/drivers/serial2002.c
+++ b/drivers/staging/comedi/drivers/serial2002.c
@@ -422,67 +422,65 @@ static int serial2002_setup_subdevs(struct comedi_device 
*dev)
serial2002_tty_setspeed(devpriv->tty, devpriv->speed);
serial2002_poll_channel(devpriv->tty, 31);
while (1) {
-   struct serial_data data;
+   struct serial_data data = serial2002_read(devpriv->tty, 1000);
+   int kind = S2002_CFG_KIND(data.value);
+   int channel = S2002_CFG_CHAN(data.value);
+   int range = S2002_CFG_BASE(data.value);
+   int cmd = S2002_CFG_CMD(data.value);
 
-   data = serial2002_read(devpriv->tty, 1000);
if (data.kind != is_channel || data.index != 31 ||
-   S2002_CFG_KIND(data.value) == S2002_CFG_KIND_INVALID) {
+   kind == S2002_CFG_KIND_INVALID)
break;
-   } else {
-   int channel = S2002_CFG_CHAN(data.value);
-   int range = S2002_CFG_BASE(data.value);
 
-   switch (S2002_CFG_KIND(data.value)) {
-   case S2002_CFG_KIND_DIGITAL_IN:
-   cfg = di_cfg;
-   break;
-   case S2002_CFG_KIND_DIGITAL_OUT:
-   cfg = do_cfg;
-   break;
-   case S2002_CFG_KIND_ANALOG_IN:
-   cfg = ai_cfg;
-   break;
-   case S2002_CFG_KIND_ANALOG_OUT:
-   cfg = ao_cfg;
-   break;
-   case S2002_CFG_KIND_ENCODER_IN:
-   cfg = ai_cfg;
-   break;
-   default:
-   cfg = NULL;
-   break;
-   }
-   if (!cfg)
-   continue;   /* unknown kind, skip it */
+   switch (kind) {
+   case S2002_CFG_KIND_DIGITAL_IN:
+   cfg = di_cfg;
+   break;
+   case S2002_CFG_KIND_DIGITAL_OUT:
+   cfg = do_cfg;
+   break;
+   case S2002_CFG_KIND_ANALOG_IN:
+   cfg = ai_cfg;
+   break;
+   case S2002_CFG_KIND_ANALOG_OUT:
+   cfg = ao_cfg;
+   break;
+   case S2002_CFG_KIND_ENCODER_IN:
+   cfg = ai_cfg;
+   break;
+   default:
+   cfg = NULL;
+   break;
+   }
+   if (!cfg)
+   continue;   /* unknown kind, skip it */
 
-   cfg[channel].kind = S2002_CFG_KIND(data.value);
+   cfg[channel].kind = kind;
 
-   switch (S2002_CFG_CMD(data.value)) {
-   case S2002_CFG_CMD_BITS:
-   cfg[channel].bits = S2002_CFG_BITS(data.value);
+   switch (cmd) {
+   case S2002_CFG_CMD_BITS:
+   cfg[channel].bits = S2002_CFG_BITS(data.value);
+   break;
+   case S2002_CFG_CMD_MIN:
+   case S2002_CFG_CMD_MAX:
+   switch (S2002_CFG_UNITS(data.value)) {
+   case 0:
+   range *= 100;
break;
-   case S2002_CFG_CMD_MIN:
-   case S2002_CFG_CMD_MAX:
-   switch (S2002_CFG_UNITS(data.value)) {
-   case 0:
-   range *= 100;
-   break;
-   case 1:
-   range *= 1000;
-   break;
-   case 2:
-   range *= 1;
-   break;
-   }
-   if (S2002_CFG_SIGN(data.value))
-   range = -range;
-   if (S2002_CFG_CMD(

[PATCH 03/22] staging: comedi: amplc_pc236: checkpatch.pl cleanup (missing blank line)

2014-07-16 Thread H Hartley Sweeten
Fix this checkpatch.pl warning:

WARNING: Missing a blank line after declarations

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

diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c 
b/drivers/staging/comedi/drivers/amplc_pc236.c
index 373739a..2a10068 100644
--- a/drivers/staging/comedi/drivers/amplc_pc236.c
+++ b/drivers/staging/comedi/drivers/amplc_pc236.c
@@ -515,6 +515,7 @@ static void pc236_detach(struct comedi_device *dev)
comedi_legacy_detach(dev);
} else if (is_pci_board(thisboard)) {
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
+
if (dev->irq)
free_irq(dev->irq, dev);
comedi_pci_disable(dev);
-- 
1.9.3

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


[PATCH 22/22] staging: comedi: ni_tio: checkpatch.pl cleanup (missing blank line)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warnings:

WARNING: Missing a blank line after declarations

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

diff --git a/drivers/staging/comedi/drivers/ni_tio.c 
b/drivers/staging/comedi/drivers/ni_tio.c
index 1a5bb23..0ac9fbf 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -463,6 +463,7 @@ static int ni_tio_set_counter_mode(struct ni_gpct *counter, 
unsigned mode)
 
if (ni_tio_counting_mode_registers_present(counter_dev)) {
unsigned counting_mode_bits = 0;
+
counting_mode_bits |=
(mode >> NI_GPCT_COUNTING_MODE_SHIFT) &
Gi_Counting_Mode_Mask;
-- 
1.9.3

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


[PATCH 20/22] staging: comedi: ni_mio_common: checkpatch.pl cleanup (missing blank line)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warnings:

WARNING: Missing a blank line after declarations

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

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index b630c66..af5ee50 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -1115,6 +1115,7 @@ static int ni_ao_wait_for_dma_load(struct comedi_device 
*dev)
 {
static const int timeout = 1;
int i;
+
for (i = 0; i < timeout; i++) {
unsigned short b_status;
 
@@ -1810,6 +1811,7 @@ static int ni_ai_reset(struct comedi_device *dev, struct 
comedi_subdevice *s)
  AI_Output_Control_Register);
} else {
unsigned ai_output_control_bits;
+
ni_stc_writew(dev,
  AI_SHIFTIN_Pulse_Width |
  AI_SOC_Polarity |
@@ -1904,6 +1906,7 @@ static void ni_m_series_load_channelgain_list(struct 
comedi_device *dev,
 
if ((list[0] & CR_ALT_SOURCE)) {
unsigned bypass_bits;
+
chan = CR_CHAN(list[0]);
range = CR_RANGE(list[0]);
range_code = ni_gainlkup[board->gainlkup][range];
@@ -1927,6 +1930,7 @@ static void ni_m_series_load_channelgain_list(struct 
comedi_device *dev,
}
for (i = 0; i < n_chan; i++) {
unsigned config_bits = 0;
+
chan = CR_CHAN(list[i]);
aref = CR_AREF(list[i]);
range = CR_RANGE(list[i]);
@@ -2703,6 +2707,7 @@ static int ni_ai_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
 #ifdef PCIDMA
{
int retval = ni_ai_setup_MITE_dma(dev);
+
if (retval)
return retval;
}
@@ -2825,6 +2830,7 @@ static int ni_m_series_ao_config_chanlist(struct 
comedi_device *dev,
}
for (i = 0; i < n_chans; i++) {
const struct comedi_krange *krange;
+
chan = CR_CHAN(chanspec[i]);
range = CR_RANGE(chanspec[i]);
krange = s->range_table->range + range;
@@ -3249,6 +3255,7 @@ static int ni_ao_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
  AO_Output_Control_Register);
} else {
unsigned bits;
+
devpriv->ao_mode1 &= ~AO_Multiple_Channels;
bits = AO_UPDATE_Output_Select(AO_Update_Output_High_Z);
if (devpriv->is_m_series || devpriv->is_6xxx) {
@@ -3426,6 +3433,7 @@ static int ni_ao_reset(struct comedi_device *dev, struct 
comedi_subdevice *s)
if (devpriv->is_6xxx) {
unsigned immediate_bits = 0;
unsigned i;
+
for (i = 0; i < s->n_chan; ++i)
immediate_bits |= 1 << i;
ni_ao_win_outw(dev, immediate_bits, AO_Immediate_671x);
@@ -3928,6 +3936,7 @@ static void init_ao_67xx(struct comedi_device *dev, 
struct comedi_subdevice *s)
 static unsigned ni_gpct_to_stc_register(enum ni_gpct_register reg)
 {
unsigned stc_register;
+
switch (reg) {
case NITIO_G0_AUTO_INC:
stc_register = G_Autoincrement_Register(0);
@@ -4882,6 +4891,7 @@ static int ni_mseries_get_pll_parameters(unsigned 
reference_period_ns,
static const unsigned target_picosec = 12500;
static const unsigned fudge_factor_80_to_20Mhz = 4;
int best_period_picosec = 0;
+
for (div = 1; div <= max_div; ++div) {
for (mult = 1; mult <= max_mult; ++mult) {
unsigned new_period_ps =
@@ -4961,6 +4971,7 @@ static int ni_mseries_set_pll_master_clock(struct 
comedi_device *dev,
{
unsigned rtsi_channel;
static const unsigned max_rtsi_channel = 7;
+
for (rtsi_channel = 0; rtsi_channel <= max_rtsi_channel;
 ++rtsi_channel) {
if (source ==
@@ -5758,6 +5769,7 @@ static int ni_E_init(struct comedi_device *dev,
ni_writeb(dev, 0, Magic_611x);
} else if (devpriv->is_m_series) {
int channel;
+
for (channel = 0; channel < board->n_aochan; ++channel) {
ni_writeb(dev, 0xf,
  M_Offset_AO_Waveform_Order(channel));
-- 
1.9.3

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


[PATCH 15/22] staging: comedi: ni_at_a2150: checkpatch.pl cleanup (missing blank line)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: Missing a blank line after declarations

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

diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c 
b/drivers/staging/comedi/drivers/ni_at_a2150.c
index a862dc3..465c729 100644
--- a/drivers/staging/comedi/drivers/ni_at_a2150.c
+++ b/drivers/staging/comedi/drivers/ni_at_a2150.c
@@ -690,6 +690,7 @@ static int a2150_set_chanlist(struct comedi_device *dev,
 static int a2150_probe(struct comedi_device *dev)
 {
int status = inw(dev->iobase + STATUS_REG);
+
return ID_BITS(status);
 }
 
-- 
1.9.3

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


[PATCH 13/22] staging: comedi: serial2000: checkpatch.pl cleanup (missing blank line)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: Missing a blank line after declarations

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

diff --git a/drivers/staging/comedi/drivers/serial2002.c 
b/drivers/staging/comedi/drivers/serial2002.c
index 441813f..162cfaf 100644
--- a/drivers/staging/comedi/drivers/serial2002.c
+++ b/drivers/staging/comedi/drivers/serial2002.c
@@ -174,6 +174,7 @@ static int serial2002_tty_read(struct file *f, int timeout)
} else {
/* Device does not support poll, busy wait */
int retries = 0;
+
while (1) {
retries++;
if (retries >= timeout)
@@ -311,6 +312,7 @@ static void serial2002_write(struct file *f, struct 
serial_data data)
} else {
unsigned char ch[6];
int i = 0;
+
if (data.value >= (1L << 30)) {
ch[i] = 0x80 | ((data.value >> 30) & 0x03);
i++;
-- 
1.9.3

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


[PATCH 12/22] staging: comedi: comedi_test: checkpatch.pl cleanup (break is not useful)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: break is not useful after a goto or return

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

diff --git a/drivers/staging/comedi/drivers/comedi_test.c 
b/drivers/staging/comedi/drivers/comedi_test.c
index 67a09aa..1e2fb91 100644
--- a/drivers/staging/comedi/drivers/comedi_test.c
+++ b/drivers/staging/comedi/drivers/comedi_test.c
@@ -146,10 +146,8 @@ static unsigned short fake_waveform(struct comedi_device 
*dev,
switch (channel) {
case SAWTOOTH_CHAN:
return fake_sawtooth(dev, range, current_time);
-   break;
case SQUARE_CHAN:
return fake_squarewave(dev, range, current_time);
-   break;
default:
break;
}
-- 
1.9.3

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


[PATCH 18/22] staging: comedi: ni_660x: checkpatch.pl cleanup (missing blank line)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: Missing a blank line after declarations

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

diff --git a/drivers/staging/comedi/drivers/ni_660x.c 
b/drivers/staging/comedi/drivers/ni_660x.c
index 72805e9..7755f11 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -161,6 +161,7 @@ enum ni_660x_register {
 static inline unsigned IOConfigReg(unsigned pfi_channel)
 {
unsigned reg = NI660X_IO_CFG_0_1 + pfi_channel / 2;
+
BUG_ON(reg > NI660X_IO_CFG_38_39);
return reg;
 }
-- 
1.9.3

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


[PATCH 19/22] staging: comedi: ni_pcidio: checkpatch.pl cleanup (missing blank line)

2014-07-16 Thread H Hartley Sweeten
Fix the checkpatch.pl warning:

WARNING: Missing a blank line after declarations

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

diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c 
b/drivers/staging/comedi/drivers/ni_pcidio.c
index 4d6b2ed..ac800da 100644
--- a/drivers/staging/comedi/drivers/ni_pcidio.c
+++ b/drivers/staging/comedi/drivers/ni_pcidio.c
@@ -711,6 +711,7 @@ static int ni_pcidio_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
 
{
int retval = setup_mite_dma(dev, s);
+
if (retval)
return retval;
}
@@ -853,6 +854,7 @@ static int pci_6534_load_fpga(struct comedi_device *dev,
}
for (j = 0; j + 1 < data_len;) {
unsigned int value = data[j++];
+
value |= data[j++] << 8;
writew(value,
   devpriv->mite->daq_io_addr + Firmware_Data_Register);
-- 
1.9.3

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


  1   2   >